mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 23:17:44 +00:00
...
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user