通知取得中の表示とログの整理

This commit is contained in:
tateisu 2022-06-14 03:10:13 +09:00
parent 7794c487bf
commit 5db3786361
7 changed files with 9 additions and 13 deletions

View File

@ -27,7 +27,7 @@ object CheckerNotification {
if (text.isEmpty() || text == lastMessage) return
lastMessage = text
log.i("showMessage $text")
log.i(text)
// // This PendingIntent can be used to cancel the worker
// val cancel = context.getString(R.string.cancel)

View File

@ -202,13 +202,12 @@ class PollingChecker(
return@coroutineScope
}
progress("[${account.acct.pretty}] check start.")
client.account = account
progress("[${account.acct.pretty}] waiting network connection…")
progress("waiting network connection… [${account.acct.pretty}]")
wakelocks.checkConnection()
progress("[${account.acct.pretty}] check push subscription…")
progress("check push subscription… [${account.acct.pretty}]")
val wps = PushSubscriptionHelper(context, account)
if (wps.flags != 0) {
bPollingRequired.set(true)
@ -270,6 +269,7 @@ class PollingChecker(
}
}
progress("check notifications… [${account.acct.pretty}]")
cache = NotificationCache(account.db_id).apply {
load()
requestAsync(
@ -317,8 +317,6 @@ class PollingChecker(
if (isTimeout) {
wakelocks.notificationManager.createServerTimeoutNotification(context, account)
}
progress("[${account.acct.pretty}] check end.")
}
}

View File

@ -48,7 +48,7 @@ suspend fun loadFirebaseMessagingToken(context: Context): String =
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_coroutines_version"
val sv = FirebaseMessaging.getInstance().token.await()
if (sv.isNullOrBlank()) {
error("getFirebaseMessagingToken: device token is null or empty.")
error("loadFirebaseMessagingToken: device token is null or empty.")
}
return sv.also {
prefDevice.edit()
@ -185,7 +185,7 @@ fun checkNotificationImmediate(
context = context,
accountDbId = accountDbId,
injectData = injectData,
) { log.i(it) }.check()
) { log.i("(Immediate) $it") }.check()
} catch (ex: Throwable) {
log.trace(ex, "checkNotificationImmediate failed.")
}
@ -204,7 +204,7 @@ fun checkNotificationImmediateAll(context: Context) {
PollingChecker(
context = context,
accountDbId = sa.db_id,
) { log.i(it) }.check()
) { log.i("(ImmediateAll) $it") }.check()
}
} catch (ex: Throwable) {
log.trace(ex, "checkNotificationImmediateAll failed.")

View File

@ -84,7 +84,7 @@ class PollingWorker(
log.i("doWork start. accountDbId=$accountDbId")
val context = applicationContext
showMessage(context.getString(R.string.push_notification_checking))
showMessage(context.getString(R.string.loading_notification_title))
PollingChecker(
context = context,

View File

@ -78,4 +78,4 @@ object ServerTimeoutNotification {
notify(tag, NOTIFICATION_ID_ERROR, builder.build())
}
}
}

View File

@ -1149,5 +1149,4 @@
<string name="post_error_attachments_duplicated">Misskeyは添付データの重複を許可していません。</string>
<string name="use_web_settings">Web設定を使う</string>
<string name="content">本文</string>
<string name="push_notification_checking">プッシュ通知の処理中…</string>
</resources>

View File

@ -1158,5 +1158,4 @@
<string name="post_error_attachments_duplicated">Misskey does not allow duplicate in attachments.</string>
<string name="use_web_settings">(Use web setting)</string>
<string name="content">Content</string>
<string name="push_notification_checking">Processing push notifications…</string>
</resources>