From 848d352c605878c0b81678a1f6948dbafc6bba74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E5=AD=90=E7=BB=B4?= Date: Fri, 30 Jun 2023 10:20:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E3=80=90=E5=85=89=E7=8E=AF=E5=8A=A9?= =?UTF-8?q?=E6=89=8B=E3=80=91=E7=A5=9E=E7=AD=96=E5=9F=8B=E7=82=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98(1)=20https://jira.shanqu.cc/browse/GHZS-2818?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/gh/ndownload/NDataChanger.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/src/main/java/com/gh/ndownload/NDataChanger.kt b/app/src/main/java/com/gh/ndownload/NDataChanger.kt index 1b98b0c4e4..9b99cc4798 100644 --- a/app/src/main/java/com/gh/ndownload/NDataChanger.kt +++ b/app/src/main/java/com/gh/ndownload/NDataChanger.kt @@ -1,5 +1,6 @@ package com.gh.ndownload +import android.annotation.SuppressLint import com.gh.gamecenter.core.runOnUiThread import com.lightgame.download.DownloadEntity import java.util.* @@ -35,4 +36,20 @@ object NDataChanger : Observable() { } } + // 修改通知观察者的顺序为 添加观察者的顺序 + @SuppressLint("DiscouragedPrivateApi") + override fun notifyObservers(arg: Any?) { + var arrLocal: Array + + synchronized(this) { + if (!hasChanged()) return + + val obs = Observable::class.java.getDeclaredField("obs") + obs.isAccessible = true + arrLocal = (obs.get(this) as Vector<*>).toTypedArray() + clearChanged() + } + + for (i in arrLocal.indices) (arrLocal[i] as Observer).update(this, arg) + } } From c74663c0823641860fa127a499dd098b2f5a4444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E5=AD=90=E7=BB=B4?= Date: Fri, 30 Jun 2023 11:35:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E3=80=90=E5=85=89=E7=8E=AF=E5=8A=A9?= =?UTF-8?q?=E6=89=8B=E3=80=91=E7=A5=9E=E7=AD=96=E5=9F=8B=E7=82=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98(1)=20https://jira.shanqu.cc/browse/GHZS-2818?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/proguard-rules.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/proguard-rules.txt b/app/proguard-rules.txt index bdc8a0017a..1c70a891ce 100644 --- a/app/proguard-rules.txt +++ b/app/proguard-rules.txt @@ -91,3 +91,6 @@ native ; } +### Observable +-keep class java.util.Observable { *; } +