Skip to content

Commit ec29b6c

Browse files
committed
Remove Lightning shortcut
1 parent ab39f6f commit ec29b6c

File tree

16 files changed

+12
-304
lines changed

16 files changed

+12
-304
lines changed

common/src/commonMain/composeResources/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,4 +1617,7 @@
16171617
<string name="id_you_will_receive_an_email_from">You will receive an email from Blockstream support</string>
16181618
<string name="id_system_default">System Default</string>
16191619
<string name="id_transact">Transact</string>
1620+
<string name="id_enable_notifications">Enable Notifications</string>
1621+
<string name="id_disable_notifications">Disable Notifications</string>
1622+
<string name="id_enable_push_notifications_for_seamless">Enable push notifications for seamless lightning payments. No need to keep your app open to receive.</string>
16201623
</resources>

common/src/commonMain/kotlin/com/blockstream/common/events/Events.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class Events : Event {
4747
data class ArchiveAccount(val account: Account): Event
4848
data class UnArchiveAccount(val account: Account, val navigateToRoot: Boolean): Event
4949
data class RemoveAccount(val account: Account): Event
50-
data class RemoveLightningShortcut(val wallet: GreenWallet? = null): Event
51-
data class AskRemoveLightningShortcut(val wallet: GreenWallet? = null): Event
5250
data class SetAccountAsset(val accountAsset: AccountAsset, val setAsActive: Boolean = false): Event
5351
data class SetBarcodeScannerResult(val scannedText : String): Event
5452
class ProvideCipher(

common/src/commonMain/kotlin/com/blockstream/common/models/GreenViewModel.kt

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,6 @@ open class GreenViewModel constructor(
452452
is Events.RemoveAccount -> {
453453
removeAccount(account = event.account)
454454
}
455-
is Events.RemoveLightningShortcut -> {
456-
removeLightningShortcut(greenWallet = event.wallet ?: greenWallet)
457-
}
458-
is Events.AskRemoveLightningShortcut -> {
459-
postSideEffect(SideEffects.AskRemoveLightningShortcut(wallet = event.wallet ?: greenWallet))
460-
}
461455
is EventWithSideEffect -> {
462456
postSideEffect(event.sideEffect)
463457
}
@@ -748,14 +742,6 @@ open class GreenViewModel constructor(
748742
}
749743
}
750744

751-
private fun removeLightningShortcut(greenWallet: GreenWallet) {
752-
doAsync({
753-
database.deleteLoginCredentials(greenWallet.id, CredentialType.LIGHTNING_MNEMONIC)
754-
}, onSuccess = {
755-
756-
})
757-
}
758-
759745
private fun setActiveAccount(account: Account) {
760746
session.setActiveAccount(account)
761747

@@ -859,25 +845,6 @@ open class GreenViewModel constructor(
859845
})
860846
}
861847

862-
protected suspend fun _enableLightningShortcut() {
863-
sessionOrNull?.also { session ->
864-
val encryptedData = withContext(context = Dispatchers.IO) {
865-
session.deriveLightningMnemonic().let {
866-
greenKeystore.encryptData(it.encodeToByteArray())
867-
}
868-
}
869-
870-
database.replaceLoginCredential(
871-
createLoginCredentials(
872-
walletId = greenWallet.id,
873-
network = session.lightning!!.id,
874-
credentialType = CredentialType.LIGHTNING_MNEMONIC,
875-
encryptedData = encryptedData
876-
)
877-
)
878-
}
879-
}
880-
881848
override fun interactionRequest(
882849
gdkHardwareWallet: GdkHardwareWallet,
883850
message: String?,

common/src/commonMain/kotlin/com/blockstream/common/models/add/AddAccountViewModelAbstract.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,7 @@ abstract class AddAccountViewModelAbstract(greenWallet: GreenWallet, val assetId
190190
postEvent(Events.SetAccountAsset(accountAsset, setAsActive = true))
191191
postSideEffect(SideEffects.AccountCreated(accountAsset))
192192

193-
val navigateToRoot = SideEffects.NavigateToRoot(popTo = popTo)
194-
195-
if (it.isLightning && !greenWallet.isEphemeral) {
196-
postSideEffect(SideEffects.LightningShortcut)
197-
_pendingSideEffect = navigateToRoot
198-
} else {
199-
postSideEffect(navigateToRoot)
200-
}
193+
postSideEffect(SideEffects.NavigateToRoot(popTo = popTo))
201194

202195
countly.createAccount(session, it)
203196
})

common/src/commonMain/kotlin/com/blockstream/common/models/onboarding/phone/PinViewModel.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,7 @@ class PinViewModel constructor(
329329
onProgress.value = it == null
330330
rocketAnimation.value = it == null
331331
}, onSuccess = {
332-
if (session.hasLightning && !setupArgs.isRecoveryFlow) {
333-
_greenWallet = it
334-
postSideEffect(SideEffects.LightningShortcut)
335-
} else {
336-
postSideEffect(SideEffects.NavigateTo(NavigateDestinations.WalletOverview(it)))
337-
}
332+
postSideEffect(SideEffects.NavigateTo(NavigateDestinations.WalletOverview(it)))
338333
})
339334
}
340335

common/src/commonMain/kotlin/com/blockstream/common/models/overview/AccountOverviewViewModel.kt

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@ package com.blockstream.common.models.overview
22

33
import blockstream_green.common.generated.resources.Res
44
import blockstream_green.common.generated.resources.box_arrow_down
5-
import blockstream_green.common.generated.resources.id_add_lightning_shortcut
65
import blockstream_green.common.generated.resources.id_archive_account
76
import blockstream_green.common.generated.resources.id_copied_to_clipboard
87
import blockstream_green.common.generated.resources.id_help
98
import blockstream_green.common.generated.resources.id_node_info
109
import blockstream_green.common.generated.resources.id_remove
11-
import blockstream_green.common.generated.resources.id_remove_lightning_shortcut
1210
import blockstream_green.common.generated.resources.id_rename_account
1311
import blockstream_green.common.generated.resources.id_rescan_swaps_initiated
1412
import blockstream_green.common.generated.resources.info
15-
import blockstream_green.common.generated.resources.lightning
16-
import blockstream_green.common.generated.resources.lightning_slash
1713
import blockstream_green.common.generated.resources.question
1814
import blockstream_green.common.generated.resources.text_aa
1915
import blockstream_green.common.generated.resources.trash
@@ -191,7 +187,6 @@ class AccountOverviewViewModel(greenWallet: GreenWallet, accountAsset: AccountAs
191187
object Send : Event
192188
object Receive : Event
193189
object Refresh : Event
194-
object EnableLightningShortcut : Event
195190
object LoadMoreTransactions : Event
196191
object RescanSwaps : Event
197192
object CopyAccountId : Event
@@ -239,22 +234,6 @@ class AccountOverviewViewModel(greenWallet: GreenWallet, accountAsset: AccountAs
239234
postEvent(NavigateDestinations.LightningNode(greenWallet = greenWallet))
240235
}
241236
).takeIf { account.isLightning },
242-
NavAction(
243-
title = getString(Res.string.id_add_lightning_shortcut),
244-
icon = Res.drawable.lightning,
245-
isMenuEntry = true,
246-
onClick = {
247-
postEvent(LocalEvents.EnableLightningShortcut)
248-
}
249-
).takeIf { account.isLightning && hasLightningShortcut == false },
250-
NavAction(
251-
title = getString(Res.string.id_remove_lightning_shortcut),
252-
icon = Res.drawable.lightning_slash,
253-
isMenuEntry = true,
254-
onClick = {
255-
postEvent(Events.AskRemoveLightningShortcut())
256-
}
257-
).takeIf { account.isLightning && hasLightningShortcut == true },
258237
NavAction(
259238
title = getString(Res.string.id_remove),
260239
icon = Res.drawable.trash,
@@ -319,10 +298,6 @@ class AccountOverviewViewModel(greenWallet: GreenWallet, accountAsset: AccountAs
319298
session.refresh(account = account)
320299
}
321300

322-
is LocalEvents.EnableLightningShortcut -> {
323-
enableLightningShortcut()
324-
}
325-
326301
is LocalEvents.LoadMoreTransactions -> {
327302
loadMoreTransactions()
328303
}
@@ -353,16 +328,6 @@ class AccountOverviewViewModel(greenWallet: GreenWallet, accountAsset: AccountAs
353328
session.getTransactions(account = account, isReset = false, isLoadMore = true)
354329
}
355330

356-
private fun enableLightningShortcut() {
357-
if (account.isLightning) {
358-
doAsync({
359-
_enableLightningShortcut()
360-
}, onSuccess = {
361-
postSideEffect(SideEffects.LightningShortcut)
362-
})
363-
}
364-
}
365-
366331
private fun rescanSwaps() {
367332
postSideEffect(SideEffects.Snackbar(StringHolder.create(Res.string.id_rescan_swaps_initiated)))
368333

common/src/commonMain/kotlin/com/blockstream/common/sideeffects/SideEffects.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ class SideEffects : SideEffect {
6666
data class ShareFile(val path: Path) : SideEffect
6767
data class TwoFactorResolver(val data: TwoFactorResolverData) : SideEffect
6868
data object OpenDenominationExchangeRate : SideEffect
69-
data object LightningShortcut : SideEffect
70-
data class AskRemoveLightningShortcut(val wallet: GreenWallet) : SideEffect
7169
data object EnableBluetooth: SideEffect
7270
data object EnableLocationService: SideEffect
7371
data object AskForBluetoothPermissions: SideEffect

compose/src/androidMain/kotlin/com/blockstream/compose/dialogs/LightningShortcutDialog.android.kt

Lines changed: 0 additions & 19 deletions
This file was deleted.

compose/src/commonMain/kotlin/com/blockstream/compose/dialogs/LightningShortcutDialog.kt

Lines changed: 0 additions & 92 deletions
This file was deleted.

compose/src/commonMain/kotlin/com/blockstream/compose/screens/WalletsScreen.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import blockstream_green.common.generated.resources.id_ephemeral_wallets
2626
import blockstream_green.common.generated.resources.id_hardware_devices
2727
import blockstream_green.common.generated.resources.id_setup_a_new_wallet
2828
import com.blockstream.common.data.GreenWallet
29-
import com.blockstream.common.events.Events
3029
import com.blockstream.common.looks.wallet.WalletListLook
3130
import com.blockstream.common.models.wallets.WalletsViewModel
3231
import com.blockstream.common.models.wallets.WalletsViewModelAbstract
@@ -90,7 +89,7 @@ fun WalletsScreen(
9089
)
9190
)
9291
}, onLightningShortcutDelete = {
93-
viewModel.postEvent(Events.AskRemoveLightningShortcut(wallet = it))
92+
// viewModel.postEvent(Events.AskRemoveLightningShortcut(wallet = it))
9493
}, onWalletDelete = {
9594
viewModel.postEvent(NavigateDestinations.DeleteWallet(it))
9695
}, onWalletRename = {

0 commit comments

Comments
 (0)