mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Fix #337 and closing websocket connections
This commit is contained in:
parent
269b879ee4
commit
e5532a5842
BIN
app/assets/fonts/Nunito-Black.ttf
Normal file
BIN
app/assets/fonts/Nunito-Black.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-BlackItalic.ttf
Normal file
BIN
app/assets/fonts/Nunito-BlackItalic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-Bold.ttf
Normal file
BIN
app/assets/fonts/Nunito-Bold.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-BoldItalic.ttf
Normal file
BIN
app/assets/fonts/Nunito-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-ExtraBold.ttf
Normal file
BIN
app/assets/fonts/Nunito-ExtraBold.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-ExtraBoldItalic.ttf
Normal file
BIN
app/assets/fonts/Nunito-ExtraBoldItalic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-ExtraLight.ttf
Normal file
BIN
app/assets/fonts/Nunito-ExtraLight.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-ExtraLightItalic.ttf
Normal file
BIN
app/assets/fonts/Nunito-ExtraLightItalic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-Italic.ttf
Normal file
BIN
app/assets/fonts/Nunito-Italic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-Light.ttf
Normal file
BIN
app/assets/fonts/Nunito-Light.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-LightItalic.ttf
Normal file
BIN
app/assets/fonts/Nunito-LightItalic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-Regular.ttf
Normal file
BIN
app/assets/fonts/Nunito-Regular.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-SemiBold.ttf
Normal file
BIN
app/assets/fonts/Nunito-SemiBold.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/Nunito-SemiBoldItalic.ttf
Normal file
BIN
app/assets/fonts/Nunito-SemiBoldItalic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/NunitoHeavy-Italic.ttf
Normal file
BIN
app/assets/fonts/NunitoHeavy-Italic.ttf
Normal file
Binary file not shown.
BIN
app/assets/fonts/NunitoHeavy-Regular.ttf
Normal file
BIN
app/assets/fonts/NunitoHeavy-Regular.ttf
Normal file
Binary file not shown.
@ -190,6 +190,8 @@ dependencies {
|
|||||||
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||||
implementation 'com.kevalpatel2106:emoticongifkeyboard:1.1'
|
implementation 'com.kevalpatel2106:emoticongifkeyboard:1.1'
|
||||||
|
|
||||||
|
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation ('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
|
androidTestImplementation ('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
package com.nextcloud.talk.activities;
|
package com.nextcloud.talk.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.webkit.SslErrorHandler;
|
import android.webkit.SslErrorHandler;
|
||||||
@ -45,6 +46,7 @@ import javax.inject.Inject;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import autodagger.AutoInjector;
|
import autodagger.AutoInjector;
|
||||||
|
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication.class)
|
@AutoInjector(NextcloudTalkApplication.class)
|
||||||
public class BaseActivity extends AppCompatActivity {
|
public class BaseActivity extends AppCompatActivity {
|
||||||
@ -59,6 +61,11 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
|
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void attachBaseContext(Context newBase) {
|
||||||
|
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
|
||||||
|
}
|
||||||
|
|
||||||
public void showCertificateDialog(X509Certificate cert, MagicTrustManager magicTrustManager,
|
public void showCertificateDialog(X509Certificate cert, MagicTrustManager magicTrustManager,
|
||||||
@Nullable SslErrorHandler sslErrorHandler) {
|
@Nullable SslErrorHandler sslErrorHandler) {
|
||||||
DateFormat formatter = DateFormat.getDateInstance(DateFormat.LONG);
|
DateFormat formatter = DateFormat.getDateInstance(DateFormat.LONG);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
package com.nextcloud.talk.activities;
|
package com.nextcloud.talk.activities;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -45,6 +46,7 @@ import javax.inject.Inject;
|
|||||||
import autodagger.AutoInjector;
|
import autodagger.AutoInjector;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication.class)
|
@AutoInjector(NextcloudTalkApplication.class)
|
||||||
public class MagicCallActivity extends BaseActivity {
|
public class MagicCallActivity extends BaseActivity {
|
||||||
@ -64,6 +66,11 @@ public class MagicCallActivity extends BaseActivity {
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void attachBaseContext(Context newBase) {
|
||||||
|
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -55,6 +55,7 @@ import androidx.work.PeriodicWorkRequest;
|
|||||||
import androidx.work.WorkManager;
|
import androidx.work.WorkManager;
|
||||||
import autodagger.AutoComponent;
|
import autodagger.AutoComponent;
|
||||||
import autodagger.AutoInjector;
|
import autodagger.AutoInjector;
|
||||||
|
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
|
||||||
|
|
||||||
@AutoComponent(
|
@AutoComponent(
|
||||||
modules = {
|
modules = {
|
||||||
@ -109,6 +110,11 @@ public class NextcloudTalkApplication extends MultiDexApplication implements Lif
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
|
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
|
||||||
|
.setDefaultFontPath("fonts/Nunito-Regular.ttf")
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
sharedApplication = this;
|
sharedApplication = this;
|
||||||
|
|
||||||
initializeWebRtc();
|
initializeWebRtc();
|
||||||
|
@ -36,7 +36,6 @@ import com.nextcloud.talk.models.json.websocket.EventOverallWebSocketMessage;
|
|||||||
import com.nextcloud.talk.models.json.websocket.HelloResponseOverallWebSocketMessage;
|
import com.nextcloud.talk.models.json.websocket.HelloResponseOverallWebSocketMessage;
|
||||||
import com.nextcloud.talk.models.json.websocket.JoinedRoomOverallWebSocketMessage;
|
import com.nextcloud.talk.models.json.websocket.JoinedRoomOverallWebSocketMessage;
|
||||||
import com.nextcloud.talk.utils.MagicMap;
|
import com.nextcloud.talk.utils.MagicMap;
|
||||||
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
@ -93,16 +92,14 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOpen(WebSocket webSocket, Response response) {
|
public void onOpen(WebSocket webSocket, Response response) {
|
||||||
if (isConnected()) {
|
try {
|
||||||
try {
|
if (TextUtils.isEmpty(resumeId)) {
|
||||||
if (TextUtils.isEmpty(resumeId)) {
|
webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModel(conversationUser, webSocketTicket)));
|
||||||
webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModel(conversationUser, webSocketTicket)));
|
} else {
|
||||||
} else {
|
webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModelForResume(resumeId)));
|
||||||
webSocket.send(LoganSquare.serialize(webSocketConnectionHelper.getAssembledHelloModelForResume(resumeId)));
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Failed to serialize hello model");
|
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "Failed to serialize hello model");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +277,7 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||||||
ByeWebSocketMessage byeWebSocketMessage = new ByeWebSocketMessage();
|
ByeWebSocketMessage byeWebSocketMessage = new ByeWebSocketMessage();
|
||||||
byeWebSocketMessage.setType("bye");
|
byeWebSocketMessage.setType("bye");
|
||||||
byeWebSocketMessage.setBye(new HashMap<>());
|
byeWebSocketMessage.setBye(new HashMap<>());
|
||||||
webSocket.send(LoganSquare.serialize(byeWebSocketMessage);
|
webSocket.send(LoganSquare.serialize(byeWebSocketMessage));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Failed to serialize bye message");
|
Log.e(TAG, "Failed to serialize bye message");
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class WebSocketConnectionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MagicWebSocketInstance magicWebSocketInstance;
|
MagicWebSocketInstance magicWebSocketInstance;
|
||||||
if ((magicWebSocketInstance = magicWebSocketInstanceMap.get(userEntity.getId())) != null && !magicWebSocketInstance.isPermanentlyClosed()) {
|
if (magicWebSocketInstanceMap.containsKey(userEntity.getId()) && (magicWebSocketInstance = magicWebSocketInstanceMap.get(userEntity.getId())) != null && !magicWebSocketInstance.isPermanentlyClosed()) {
|
||||||
return magicWebSocketInstance;
|
return magicWebSocketInstance;
|
||||||
} else {
|
} else {
|
||||||
magicWebSocketInstance = new MagicWebSocketInstance(userEntity, generatedURL, webSocketTicket);
|
magicWebSocketInstance = new MagicWebSocketInstance(userEntity, generatedURL, webSocketTicket);
|
||||||
|
Loading…
Reference in New Issue
Block a user