Commit a54799e5 by 刘鹏

feat: 修复云信唤起多个界面问题

parent 00a90f23
......@@ -137,9 +137,9 @@ dependencies {
//====================云信基础库====================
implementation 'com.ydl:nim-base:1.1.1.2'
implementation 'com.netease.nimlib:basesdk:9.1.1'
implementation 'com.netease.nimlib:avchat:9.1.1'
implementation 'com.netease.nimlib:nrtc:9.1.1'
implementation 'com.netease.nimlib:basesdk:9.2.1'
implementation 'com.netease.nimlib:avchat:9.2.1'
implementation 'com.netease.nimlib:nrtc:9.2.1'
//OPPO推送需要单独引入
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'commons-codec:commons-codec:1.6'
......
......@@ -14,7 +14,7 @@ buildscript {
ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2'
componentVersion = "0.3.0.42.2-SNAPSHOT"
componentVersion = "0.3.0.42.4-SNAPSHOT"
}
repositories {
mavenCentral()
......
......@@ -118,6 +118,7 @@
<activity
android:name="com.yidianling.avchatkit.activity.AVChatActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="@style/FullScreenTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
......
package com.yidianling.avchatkit;
import android.app.NotificationManager;
import android.os.Build;
import android.os.Handler;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.netease.nimlib.app.AppForegroundWatcherCompat;
import com.netease.nimlib.sdk.avchat.model.AVChatData;
import com.yidianling.avchatkit.activity.AVChatActivity;
import com.yidianling.avchatkit.common.Handlers;
......@@ -21,6 +23,18 @@ public class AVChatProfile {
private boolean isAVChatting = false; // 是否正在音视频通话
private NotificationManager notificationManager;
public static AVChatProfile getInstance() {
return InstanceHolder.instance;
}
public boolean isAVChatting() {
return isAVChatting;
}
public void setAVChatting(boolean chating) {
isAVChatting = chating;
}
@Nullable
private AVChatData backgroundIncomingCallData;
@Nullable
......@@ -33,7 +47,12 @@ public class AVChatProfile {
return TextUtils.equals(backgroundIncomingCallData.getAccount(), account);
}
public void removeBackgroundIncomingCall(boolean activeMissCall) {
private static class InstanceHolder {
public final static AVChatProfile instance = new AVChatProfile();
}
public void removeBackgroundIncomingCall(boolean activeMissCall) {
backgroundIncomingCallData = null;
if (backgroundIncomingCallNotification != null) {
......@@ -50,32 +69,29 @@ public class AVChatProfile {
@Override
public void run() {
// 启动,如果 task正在启动,则稍等一下
if (AVChatKit.isMainTaskLaunching()) {
launchIncomingCall(data, displayName, source);
if (Build.VERSION.SDK_INT >= 29 && AppForegroundWatcherCompat.isBackground()) {
backgroundIncomingCallData = data;
backgroundIncomingCallNotification = new AVChatNotification(AVChatKit.getContext());
backgroundIncomingCallNotification.init(data.getAccount(), displayName);
backgroundIncomingCallNotification.activeIncomingCallNotification(true, backgroundIncomingCallData);
} else {
launchActivityTimeout();
AVChatActivity.incomingCall(AVChatKit.getContext(), data, displayName, source);
// 启动,如果 task正在启动,则稍等一下
if (AVChatKit.isMainTaskLaunching()) {
launchIncomingCall(data, displayName, source);
} else {
launchActivityTimeout();
AVChatActivity.incomingCall(AVChatKit.getContext(), data, displayName, source);
}
}
}
};
Handlers.sharedHandler(AVChatKit.getContext()).postDelayed(runnable, 200);
}
public static AVChatProfile getInstance() {
return InstanceHolder.instance;
}
public boolean isAVChatting() {
return isAVChatting;
}
public void setAVChatting(boolean chating) {
isAVChatting = chating;
}
private static class InstanceHolder {
public final static AVChatProfile instance = new AVChatProfile();
}
public void launchActivity(final AVChatData data, final String displayName, final int source) {
Runnable runnable = new Runnable() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment