Skip to content
6 changes: 6 additions & 0 deletions app/src/main/java/to/bitkit/repositories/LightningRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,13 @@ class LightningRepo @Inject constructor(

fun separateTrustedChannels(channels: List<ChannelDetails>) = lightningService.separateTrustedChannels(channels)

@Suppress("KotlinConstantConditions")
suspend fun registerForNotifications(token: String? = null) = executeWhenNodeRunning("registerForNotifications") {
if (Env.isE2eTest) {
Logger.info("Skipped push registration in E2E build", context = TAG)
return@executeWhenNodeRunning Result.success(Unit)
Comment thread
ovitrif marked this conversation as resolved.
}

runCatching {
val token = token ?: firebaseMessaging.token.await()
val cachedToken = keychain.loadString(Keychain.Key.PUSH_NOTIFICATION_TOKEN.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ class DevSettingsViewModel @Inject constructor(
fun registerForNotifications() = viewModelScope.launch {
lightningRepo.registerForNotifications()
.onSuccess {
ToastEventBus.send(type = Toast.ToastType.INFO, title = "Registered for notifications")
@Suppress("KotlinConstantConditions")
val title = if (Env.isE2eTest) "Skipped push registration" else "Registered for notifications"
ToastEventBus.send(type = Toast.ToastType.INFO, title = title)
}
.onFailure { ToastEventBus.send(it) }
}
Expand Down
Loading