Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
fix #116 - FCM registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Boisselle committed Feb 4, 2021
1 parent 4c029de commit f16921a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions phoenix-ios/phoenix-ios/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate {
if UIApplication.shared.backgroundRefreshStatus != .available {
token = nil
}

business.registerFcmToken(token: token)

business.registerFcmToken(token: token) { result, error in
if let e = error {
print("ERROR: \(e)")
}
}

// Future optimization:
//
Expand Down
2 changes: 1 addition & 1 deletion phoenix-shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ kotlin {

val commonMain by getting {
dependencies {
api("fr.acinq.eclair:eclair-kmp:1.0-beta5")
api("fr.acinq.eclair:eclair-kmp:snapshot")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-cbor:$serializationVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class PhoenixBusiness(private val ctx: PlatformContext) {

// The (node_id, fcm_token) tuple only needs to be registered once.
// And after that, only if the tuple changes (e.g. different fcm_token).
fun registerFcmToken(token: String?) {
peerManager.peerState.value?.registerFcmToken(token)
suspend fun registerFcmToken(token: String?) {
peerManager.getPeer().registerFcmToken(token)
}

fun incomingPaymentFlow() =
Expand Down

0 comments on commit f16921a

Please sign in to comment.