|
|
|
@ -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 {
|
|
|
|
|
): 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.")
|
|
|
|
|
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()
|
|
|
|
|