Merge branch 'fix/removing-ad-id' of https://github.com/oxen-io/session-android into fix/removing-ad-id

pull/1605/head
ThomasSession 8 months ago
commit fe1fe2e109

@ -263,7 +263,7 @@ dependencies {
implementation 'androidx.fragment:fragment-ktx:1.5.3' implementation 'androidx.fragment:fragment-ktx:1.5.3'
implementation "androidx.core:core-ktx:$coreVersion" implementation "androidx.core:core-ktx:$coreVersion"
implementation "androidx.work:work-runtime-ktx:2.7.1" implementation "androidx.work:work-runtime-ktx:2.7.1"
playImplementation ("com.google.firebase:firebase-messaging:18.0.0") { playImplementation ("com.google.firebase:firebase-messaging:24.0.0") {
exclude group: 'com.google.firebase', module: 'firebase-core' exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics' exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
@ -393,7 +393,6 @@ dependencies {
implementation "androidx.camera:camera-lifecycle:1.3.2" implementation "androidx.camera:camera-lifecycle:1.3.2"
implementation "androidx.camera:camera-view:1.3.2" implementation "androidx.camera:camera-view:1.3.2"
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation "com.google.mlkit:barcode-scanning:17.2.0" implementation "com.google.mlkit:barcode-scanning:17.2.0"
} }

@ -1,19 +1,19 @@
package org.thoughtcrime.securesms.notifications package org.thoughtcrime.securesms.notifications
import com.google.android.gms.tasks.Tasks import com.google.firebase.messaging.FirebaseMessaging
import com.google.firebase.iid.FirebaseInstanceId
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.tasks.await
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
class FirebaseTokenFetcher @Inject constructor(): TokenFetcher { class FirebaseTokenFetcher @Inject constructor(): TokenFetcher {
val TAG = "FirebaseTF"
override suspend fun fetch() = withContext(Dispatchers.IO) { override suspend fun fetch() = withContext(Dispatchers.IO) {
FirebaseInstanceId.getInstance().instanceId FirebaseMessaging.getInstance().token.await().takeIf { isActive } ?: throw Exception("Firebase token is null")
.also(Tasks::await)
.takeIf { isActive } // don't 'complete' task if we were canceled
?.run { result?.token ?: throw exception!! }
} }
} }
Loading…
Cancel
Save