mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 17:57:47 +00:00
Fix
This commit is contained in:
@@ -94,7 +94,7 @@ fun MessageSender.create(
|
||||
// Add the group to the config now that it was successfully created
|
||||
storage.createInitialConfigGroup(groupPublicKey, name, GroupUtil.createConfigMemberMap(members, admins), sentTime, encryptionKeyPair)
|
||||
// Notify the PN server
|
||||
PushManagerV1.register(publicKey = userPublicKey, device = device)
|
||||
PushManagerV1.register(device = device, publicKey = userPublicKey)
|
||||
// Start polling
|
||||
ClosedGroupPollerV2.shared.startPolling(groupPublicKey)
|
||||
// Fulfill the promise
|
||||
|
@@ -556,7 +556,7 @@ private fun handleNewClosedGroup(sender: String, sentTimestamp: Long, groupPubli
|
||||
// Set expiration timer
|
||||
storage.setExpirationTimer(groupID, expireTimer)
|
||||
// Notify the PN server
|
||||
PushManagerV1.register(publicKey = userPublicKey, device = MessagingModuleConfiguration.shared.device)
|
||||
PushManagerV1.register(device = MessagingModuleConfiguration.shared.device, publicKey = userPublicKey)
|
||||
// Notify the user
|
||||
if (userPublicKey == sender && !groupExists) {
|
||||
val threadID = storage.getOrCreateThreadIdFor(Address.fromSerialized(groupID))
|
||||
|
@@ -27,18 +27,19 @@ object PushManagerV1 {
|
||||
private val server = Server.LEGACY
|
||||
|
||||
fun register(
|
||||
device: Device,
|
||||
isUsingFCM: Boolean = TextSecurePreferences.isUsingFCM(context),
|
||||
token: String? = TextSecurePreferences.getFCMToken(context),
|
||||
publicKey: String? = TextSecurePreferences.getLocalNumber(context),
|
||||
device: Device,
|
||||
legacyGroupPublicKeys: Collection<String> = MessagingModuleConfiguration.shared.storage.getAllClosedGroupPublicKeys()
|
||||
): Promise<*, Exception> =
|
||||
if (!isUsingFCM) {
|
||||
emptyPromise()
|
||||
} else retryIfNeeded(maxRetryCount) {
|
||||
doRegister(token, publicKey, device, legacyGroupPublicKeys)
|
||||
} fail { exception ->
|
||||
Log.d(TAG, "Couldn't register for FCM due to error: $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()
|
||||
}
|
||||
|
||||
private fun doRegister(token: String?, publicKey: String?, device: Device, legacyGroupPublicKeys: Collection<String>): Promise<*, Exception> {
|
||||
@@ -50,7 +51,7 @@ object PushManagerV1 {
|
||||
val parameters = mapOf(
|
||||
"token" to token,
|
||||
"pubKey" to publicKey,
|
||||
"device" to device,
|
||||
"device" to device.value,
|
||||
"legacyGroupPublicKeys" to legacyGroupPublicKeys
|
||||
)
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.session.libsession.utilities
|
||||
|
||||
enum class Device(val value: String) {
|
||||
ANDROID("android"),
|
||||
enum class Device(val value: String, val service: String = value) {
|
||||
ANDROID("android", "firebase"),
|
||||
HUAWEI("huawei");
|
||||
}
|
||||
|
Reference in New Issue
Block a user