Commit 9762c394 authored by wanglei's avatar wanglei

垃圾清理

parent 5d8143d8
...@@ -59,41 +59,29 @@ class MyApplication : BaseApplication() { ...@@ -59,41 +59,29 @@ class MyApplication : BaseApplication() {
ScreenStatusReceiver.setupScreenStatusListener(this) ScreenStatusReceiver.setupScreenStatusListener(this)
InstallHelps.init() InstallHelps.init()
if (ifAgreePrivacy) { if (ifAgreePrivacy) {
MobileAds.initialize(this) { initializationStatus ->
InstallHelps.init()
NewComUtils.requestCfg {
ScreenStatusReceiver.setupScreenStatusListener(this)
val timerStatus: Int = AppPreferences.getInstance().getString("timerS", "1").toIntOrNull() ?: 1
if (timerStatus == 0) {
RecoveryTimerManager.getInstance().stopTaskTimer()
} else {
val timerDelay: Int = AppPreferences.getInstance().getString("timerDelay", "1").toIntOrNull() ?: 1
val timerInterval: Int = AppPreferences.getInstance().getString("timerInterval", "7").toIntOrNull() ?: 7
if (!RecoveryTimerManager.getInstance().isTaskTimerActive) {
RecoveryTimerManager.getInstance().scheduleTask(
(timerDelay * 60 * 1000).toLong(),
(timerInterval * 60 * 1000).toLong()
)
}
}
}
if (ifAgreePrivacy) {
if (ConfigHelper.admobTrueMaxFlase) { if (ConfigHelper.admobTrueMaxFlase) {
MobileAds.initialize(this) { initializationStatus -> MobileAds.initialize(this) { initializationStatus ->
} }
} else { } else {
initAdMax() initAdMax()
} }
MainScope().launch(Dispatchers.Main) { InstallHelps.init()
val deferred = async(Dispatchers.IO) { NewComUtils.requestCfg {
try { ScreenStatusReceiver.setupScreenStatusListener(this)
AdvertisingIdClient.getAdvertisingIdInfo(context).id val timerStatus: Int = AppPreferences.getInstance().getString("timerS", "1").toIntOrNull() ?: 1
} catch (_: Exception) { if (timerStatus == 0) {
"unknown" RecoveryTimerManager.getInstance().stopTaskTimer()
} else {
val timerDelay: Int = AppPreferences.getInstance().getString("timerDelay", "1").toIntOrNull() ?: 1
val timerInterval: Int = AppPreferences.getInstance().getString("timerInterval", "7").toIntOrNull() ?: 7
if (!RecoveryTimerManager.getInstance().isTaskTimerActive) {
RecoveryTimerManager.getInstance().scheduleTask(
(timerDelay * 60 * 1000).toLong(),
(timerInterval * 60 * 1000).toLong()
)
} }
} }
val gid = deferred.await() ?: ""
AppPreferences.getInstance().put("gid", gid)
} }
} }
initLifeListener() initLifeListener()
......
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