Hopefully fix double messages with MCU

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-08-07 12:29:03 +02:00
parent d0b2db516f
commit 63db659079
2 changed files with 35 additions and 23 deletions

View file

@ -147,7 +147,7 @@ dependencies {
implementation ('com.gitlab.bitfireAT:dav4jvm:f2078bc846', {
exclude group: 'org.ogce', module: 'xpp3' // Android comes with its own XmlPullParser
})
implementation 'org.conscrypt:conscrypt-android:2.0.0'
implementation 'org.conscrypt:conscrypt-android:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
@ -158,25 +158,25 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation "io.reactivex.rxjava2:rxjava:2.2.7"
implementation "io.reactivex.rxjava2:rxjava:2.2.11"
implementation 'com.bluelinelabs:conductor:2.1.5'
implementation 'com.bluelinelabs:conductor-support:2.1.5'
implementation 'com.squareup.okhttp3:okhttp:3.14.2'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.14.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.2'
implementation 'com.squareup.okhttp3:okhttp:4.0.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.0.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.0.1'
implementation 'com.bluelinelabs:logansquare:1.3.7'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.8'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.0.pr1'
kapt 'com.bluelinelabs:logansquare-compiler:1.3.7'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.1'
implementation 'com.github.aurae.retrofit2:converter-logansquare:1.4.1'
implementation 'com.google.dagger:dagger:2.21'
kapt 'com.google.dagger:dagger-compiler:2.21'
implementation 'com.google.dagger:dagger:2.24'
kapt 'com.google.dagger:dagger-compiler:2.24'
implementation 'com.github.lukaspili.autodagger2:autodagger2:1.1'
kapt 'com.github.lukaspili.autodagger2:autodagger2-compiler:1.1'
compileOnly 'javax.annotation:jsr250-api:1.0'
@ -189,8 +189,8 @@ dependencies {
implementation 'org.parceler:parceler-api:1.1.12'
kapt 'org.parceler:parceler:1.1.12'
implementation 'net.orange-box.storebox:storebox-lib:1.4.0'
compileOnly 'org.projectlombok:lombok:1.18.6'
annotationProcessor "org.projectlombok:lombok:1.18.6"
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor "org.projectlombok:lombok:1.18.8"
implementation 'com.jakewharton:butterknife:10.1.0'
kapt 'com.jakewharton:butterknife-compiler:10.1.0'
implementation 'com.github.HITGIF:TextFieldBoxes:1.4.5'
@ -202,7 +202,7 @@ dependencies {
implementation 'com.yarolegovich:lovelyinput:1.0.9'
implementation 'com.yarolegovich:mp:1.0.9'
implementation 'me.zhanghai.android.effortlesspermissions:library:1.1.0'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation 'com.github.wooplr:Spotlight:1.3'
implementation('com.github.mario:chatkit:d63d61db95', {
exclude group: 'com.facebook.fresco'
@ -223,16 +223,16 @@ dependencies {
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'eu.medsea.mimeutil:mime-util:2.1.3'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.26.0'
testImplementation 'org.powermock:powermock-core:2.0.0'
testImplementation 'org.powermock:powermock-module-junit4:2.0.0'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.0'
testImplementation 'org.mockito:mockito-core:3.0.0'
testImplementation 'org.powermock:powermock-core:2.0.2'
testImplementation 'org.powermock:powermock-module-junit4:2.0.2'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.2'
androidTestImplementation ('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
exclude group: 'com.android.support', module: 'support-annotations'
})
findbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.8.0'
findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.3'
findbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0'
findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.6'
}
gradle.projectsEvaluated {

View file

@ -175,6 +175,8 @@ public class ChatController extends BaseController implements MessagesListAdapte
private CharSequence myFirstMessage;
private boolean waitingForFutureResponse = false;
private MenuItem conversationInfoMenuItem;
private MenuItem conversationVoiceCallMenuItem;
private MenuItem conversationVideoMenuItem;
@ -684,13 +686,14 @@ public class ChatController extends BaseController implements MessagesListAdapte
startPing();
havePulledFutureBefore = false;
setupWebsocket();
if (isFirstMessagesProcessing) {
pullChatMessages(0);
} else {
pullChatMessages(1);
}
setupWebsocket();
if (magicWebSocketInstance != null) {
magicWebSocketInstance.joinRoomWithRoomTokenAndSession(roomToken,
currentCall.getSessionId());
@ -854,7 +857,13 @@ public class ChatController extends BaseController implements MessagesListAdapte
return;
}
if (!lookingIntoFuture) {
if (lookIntoFuture > 0) {
if (waitingForFutureResponse) {
return;
} else {
waitingForFutureResponse = true;
}
lookingIntoFuture = true;
havePulledFutureBefore = true;
}
@ -884,7 +893,6 @@ public class ChatController extends BaseController implements MessagesListAdapte
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.takeWhile(observable -> inChat && !wasDetached)
.retry(3, observable -> inChat && !wasDetached)
.subscribe(new Observer<Response>() {
@Override
public void onSubscribe(Disposable d) {
@ -893,18 +901,22 @@ public class ChatController extends BaseController implements MessagesListAdapte
@Override
public void onNext(Response response) {
waitingForFutureResponse = false;
processMessages(response, true);
}
@Override
public void onError(Throwable e) {
waitingForFutureResponse = false;
}
@Override
public void onComplete() {
if (magicWebSocketInstance == null) {
pullChatMessages(1);
}
}
});
} else {