This commit is contained in:
andrew
2023-08-03 14:14:55 +09:30
parent 41d24ef2c3
commit cc6f880665
6 changed files with 131 additions and 108 deletions

View File

@@ -32,18 +32,25 @@ object PushManagerV1 {
token: String? = TextSecurePreferences.getFCMToken(context),
publicKey: String? = TextSecurePreferences.getLocalNumber(context),
legacyGroupPublicKeys: Collection<String> = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys()
): Promise<*, Exception> =
when {
isUsingFCM -> retryIfNeeded(maxRetryCount) {
doRegister(token, publicKey, device, legacyGroupPublicKeys)
} fail { exception ->
Log.d(TAG, "Couldn't register for FCM due to error: $exception.")
}
else -> emptyPromise()
): Promise<*, Exception> = when {
isUsingFCM -> retryIfNeeded(maxRetryCount) {
android.util.Log.d(
TAG,
"register() called with: device = $device, isUsingFCM = $isUsingFCM, token = $token, publicKey = $publicKey, legacyGroupPublicKeys = $legacyGroupPublicKeys"
)
doRegister(token, publicKey, device, legacyGroupPublicKeys)
} fail { exception ->
Log.d(TAG, "Couldn't register for FCM due to error: $exception... $device $token $publicKey $legacyGroupPublicKeys")
}
else -> emptyPromise()
}
private fun doRegister(token: String?, publicKey: String?, device: Device, legacyGroupPublicKeys: Collection<String>): Promise<*, Exception> {
Log.d(TAG, "registerV1 requested")
android.util.Log.d(
TAG,
"doRegister() called with: token = $token, publicKey = $publicKey, device = $device, legacyGroupPublicKeys = $legacyGroupPublicKeys"
)
token ?: return emptyPromise()
publicKey ?: return emptyPromise()