From acf20107c178cd26152c3193317bf204f17eb71e Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 21 Jun 2024 18:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B3=A8=E5=86=8C=E5=90=8E?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E5=BC=B9=E7=AA=97=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 +- app/tmp/full-r8-config.txt | 12 +- .../yunbao/common/bean/MessageSayHiBean.java | 10 ++ .../utils/MessageSayHiNotifyManager.java | 111 +++++++++++------- 4 files changed, 84 insertions(+), 53 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a289e6b1d..4325afa2e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -201,7 +201,7 @@ android { }else{ server='测试服' } - outputFileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${channel}-${server}-${variant.buildType.name}.apk" + outputFileName = "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]潘多拉-${defaultConfig.versionName}-${channel}-${server}-${variant.buildType.name}.apk" } tasks.named("sign${variant.name.capitalize()}Bundle", com.android.build.gradle.internal.tasks.FinalizeBundleTask) { File file = finalBundleFile.asFile.get() @@ -215,7 +215,7 @@ android { } else { channel = "链接" } - File finalFile = new File(file.parentFile, "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]PDLive-${defaultConfig.versionName}-${channel}-${variant.buildType.name}.aab") + File finalFile = new File(file.parentFile, "[${new Date().format("yyyy-MM-dd HHmmss", TimeZone.getTimeZone("GMT+8"))}]潘多拉-${defaultConfig.versionName}-${channel}-${variant.buildType.name}.aab") finalBundleFile.set(finalFile) } project.afterEvaluate { project -> diff --git a/app/tmp/full-r8-config.txt b/app/tmp/full-r8-config.txt index 975b568ab..0f89f7fb3 100644 --- a/app/tmp/full-r8-config.txt +++ b/app/tmp/full-r8-config.txt @@ -416,7 +416,7 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode; -ignorewarnings # End of content from C:\Users\58381\Documents\AndroidProject\pandorapan\app\proguard-rules.pro -# The proguard configuration file for the following section is C:\Users\58381\Documents\AndroidProject\pandorapan\app\build\intermediates\aapt_proguard_file\google_onlineRelease\processGoogle_onlineReleaseResources\aapt_rules.txt +# The proguard configuration file for the following section is C:\Users\58381\Documents\AndroidProject\pandorapan\app\build\intermediates\aapt_proguard_file\link_testRelease\processLink_testReleaseResources\aapt_rules.txt -keep class androidx.core.app.CoreComponentFactory { (); } -keep class androidx.core.content.FileProvider { (); } -keep class androidx.core.content.FileProvider4Utils { (); } @@ -1090,10 +1090,10 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode; -keepclassmembers class * { *** videoEditClick(android.view.View); } -# End of content from C:\Users\58381\Documents\AndroidProject\pandorapan\app\build\intermediates\aapt_proguard_file\google_onlineRelease\processGoogle_onlineReleaseResources\aapt_rules.txt -# The proguard configuration file for the following section is C:\Users\58381\Documents\AndroidProject\pandorapan\lib_faceunity\build\intermediates\consumer_proguard_dir\google_onlineRelease\exportGoogle_onlineReleaseConsumerProguardFiles\lib0\proguard.txt +# End of content from C:\Users\58381\Documents\AndroidProject\pandorapan\app\build\intermediates\aapt_proguard_file\link_testRelease\processLink_testReleaseResources\aapt_rules.txt +# The proguard configuration file for the following section is C:\Users\58381\Documents\AndroidProject\pandorapan\lib_faceunity\build\intermediates\consumer_proguard_dir\link_testRelease\exportLink_testReleaseConsumerProguardFiles\lib0\proguard.txt -# End of content from C:\Users\58381\Documents\AndroidProject\pandorapan\lib_faceunity\build\intermediates\consumer_proguard_dir\google_onlineRelease\exportGoogle_onlineReleaseConsumerProguardFiles\lib0\proguard.txt +# End of content from C:\Users\58381\Documents\AndroidProject\pandorapan\lib_faceunity\build\intermediates\consumer_proguard_dir\link_testRelease\exportLink_testReleaseConsumerProguardFiles\lib0\proguard.txt # The proguard configuration file for the following section is C:\gradle-6.1.1\caches\transforms-3\8d3e3177c15403546de73d87508067d6\transformed\jetified-XPopup-2.10.0\proguard.txt # Generated keep rule for Lifecycle observer adapter. -if class com.lxj.xpopup.core.BasePopupView { @@ -1153,9 +1153,9 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode; # End of content from C:\gradle-6.1.1\caches\transforms-3\a1df9a6aa192455030f7c9970b70e0e9\transformed\material-1.4.0\proguard.txt -# The proguard configuration file for the following section is C:\Users\58381\Documents\AndroidProject\pandorapan\lib_google\build\intermediates\consumer_proguard_dir\google_onlineRelease\exportGoogle_onlineReleaseConsumerProguardFiles\lib0\proguard.txt +# The proguard configuration file for the following section is C:\Users\58381\Documents\AndroidProject\pandorapan\lib_google\build\intermediates\consumer_proguard_dir\link_testRelease\exportLink_testReleaseConsumerProguardFiles\lib0\proguard.txt -# End of content from C:\Users\58381\Documents\AndroidProject\pandorapan\lib_google\build\intermediates\consumer_proguard_dir\google_onlineRelease\exportGoogle_onlineReleaseConsumerProguardFiles\lib0\proguard.txt +# End of content from C:\Users\58381\Documents\AndroidProject\pandorapan\lib_google\build\intermediates\consumer_proguard_dir\link_testRelease\exportLink_testReleaseConsumerProguardFiles\lib0\proguard.txt # The proguard configuration file for the following section is C:\gradle-6.1.1\caches\transforms-3\2929985d9627ba3bb45a0ebd18eaf9d3\transformed\jetified-linesdk-5.0.1\proguard.txt -keepattributes *Annotation* diff --git a/common/src/main/java/com/yunbao/common/bean/MessageSayHiBean.java b/common/src/main/java/com/yunbao/common/bean/MessageSayHiBean.java index 4baea89cd..462717835 100644 --- a/common/src/main/java/com/yunbao/common/bean/MessageSayHiBean.java +++ b/common/src/main/java/com/yunbao/common/bean/MessageSayHiBean.java @@ -12,6 +12,16 @@ public class MessageSayHiBean extends BaseModel{ @SerializedName("status") private int status; + private int oldTime; + + public int getOldTime() { + return oldTime; + } + + public void setOldTime(int oldTime) { + this.oldTime = oldTime; + } + public MessageUserInfoBean getUser() { return user; } diff --git a/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java b/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java index 412b09ff3..8ade4772d 100644 --- a/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java +++ b/common/src/main/java/com/yunbao/common/utils/MessageSayHiNotifyManager.java @@ -58,6 +58,7 @@ public class MessageSayHiNotifyManager { hiBean = new MessageSayHiBean(); hiBean.setModel("init"); hiBean.setNextTime(data.getNextTime()); + hiBean.setOldTime(data.getNextTime()); Log.i(TAG, "onSuccess: 初始化定时器,第一轮时间:" + data.getNextTime()); } @@ -87,8 +88,10 @@ public class MessageSayHiNotifyManager { timer.schedule(createTask(), data.getNextTime() * 1000L); return; } + data.setOldTime(hiBean.getNextTime()); hiBean = data; - showDialog(data); + Log.i(TAG, "onSuccess: 展示弹框时间:" + data); + showDialog(); } @Override @@ -97,49 +100,7 @@ public class MessageSayHiNotifyManager { } - void showDialog(MessageSayHiBean bean) { - if (isShowDialog) { - Log.i(TAG, "showDialog: 展示对话框中"); - return; - } - if (isStopShow) { - Log.i(TAG, "showDialog: 非目标页面,停止展示"); - lastActivity = null; - isRun = false; - return; - } - String simpleName = AppManager.getInstance().getLastActivity().getClass().getSimpleName(); - if (simpleName.equals(lastActivity)) { - Log.i(TAG, "showDialog: 与上次触发是同一个页面,不展示"); - isRun = false; - return; - } - isShowDialog = true; - Log.i(TAG, "showDialog: 打开本轮打招呼弹框 " + bean); - lastActivity = AppManager.getInstance().getLastActivity().getClass().getSimpleName(); - new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), bean.getUser()).setOnDismissListener((userId, position) -> - { - Log.i(TAG, "showDialog: 关闭打招呼弹窗,uid:" + userId + ",是否点击打招呼:" + (position == 2)); - isShowDialog = false; - LiveNetManager.get(AppManager.getInstance().getLastActivity()) - .callBackMessageSayHiTimer(userId, position, new HttpCallback>() { - @Override - public void onSuccess(List data) { - } - - @Override - public void onError(String error) { - - } - }); - - Log.i(TAG, "onSuccess: 启动定时器,下一轮时间:" + bean.getNextTime() + "秒"); - timer = new Timer(); - timer.schedule(createTask(), bean.getNextTime() * 1000L); - }).setCancelable(isCancelDialog) - .showDialog(); - } }); } @@ -149,13 +110,18 @@ public class MessageSayHiNotifyManager { return; } if (hiBean == null) return; - Log.i(TAG, "reload: 重载定时器,当前Activity:" + AppManager.getInstance().getLastActivity()); + Log.i(TAG, "reload: 重载定时器,当前Activity:" + AppManager.getInstance().getLastActivity() + "|等待:" + hiBean.getNextTime()); isStopShow = false; if (timer != null) { timer.cancel(); } timer = new Timer(); - timer.schedule(createTask(), hiBean.getNextTime() * 1000L); + if (hiBean.getStatus() == -2) { + Log.i(TAG, "reload: -2的bean = " + hiBean); + timer.schedule(createTask(), hiBean.getOldTime() * 1000L); + } else { + timer.schedule(createTask(), hiBean.getNextTime() * 1000L); + } } public void resetActivity() { @@ -169,6 +135,9 @@ public class MessageSayHiNotifyManager { public void stop() { Log.i(TAG, "stop: 停止定时器,当前Activity:" + AppManager.getInstance().getLastActivity()); isStopShow = true; + if(hiBean!=null) { + hiBean.setStatus(-2); + } if (timer != null) { timer.cancel(); timer = null; @@ -184,6 +153,10 @@ public class MessageSayHiNotifyManager { timer.cancel(); } cancel(); + if (hiBean.getStatus() == -2) { + showDialog(); + return; + } Log.i(TAG, "run: 定时器到点,启动下一轮"); next(); } @@ -220,6 +193,54 @@ public class MessageSayHiNotifyManager { } } + void showDialog() { + if (isShowDialog) { + Log.i(TAG, "showDialog: 展示对话框中"); + hiBean.setStatus(-2); + return; + } + if (isStopShow) { + Log.i(TAG, "showDialog: 非目标页面,停止展示"); + hiBean.setStatus(-2); + lastActivity = null; + isRun = false; + return; + } + String simpleName = AppManager.getInstance().getLastActivity().getClass().getSimpleName(); + if (simpleName.equals(lastActivity)) { + Log.i(TAG, "showDialog: 与上次触发是同一个页面,不展示"); + isRun = false; + hiBean.setStatus(-2); + return; + } + isShowDialog = true; + Log.i(TAG, "showDialog: 打开本轮打招呼弹框 " + hiBean); + lastActivity = AppManager.getInstance().getLastActivity().getClass().getSimpleName(); + new MessageSayHiNotifyDialog(AppManager.getInstance().getLastActivity(), hiBean.getUser()).setOnDismissListener((userId, position) -> + { + Log.i(TAG, "showDialog: 关闭打招呼弹窗,uid:" + userId + ",是否点击打招呼:" + (position == 2)); + isShowDialog = false; + LiveNetManager.get(AppManager.getInstance().getLastActivity()) + .callBackMessageSayHiTimer(userId, position, new HttpCallback>() { + @Override + public void onSuccess(List data) { + + } + + @Override + public void onError(String error) { + + } + }); + + Log.i(TAG, "onSuccess: 启动定时器,下一轮时间:" + hiBean.getNextTime() + "秒"); + hiBean.setStatus(1); + timer = new Timer(); + timer.schedule(createTask(), hiBean.getNextTime() * 1000L); + }).setCancelable(isCancelDialog) + .showDialog(); + } + public synchronized void push(Context mContext, String targetId, String content) { LiveNetManager.get(mContext) .getOtherInfo(targetId, new HttpCallback() {