Skip to content

Commit

Permalink
Merge pull request #1786 from novasamatech/fix/fix-signing-via-wc
Browse files Browse the repository at this point in the history
Fixed crash signing via wc
  • Loading branch information
antonijzelinskij authored Jan 29, 2025
2 parents 30056c9 + e953bd8 commit b4112ce
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/src/main/res/navigation/external_sign_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
android:id="@+id/ConfirmSignExtrinsicFragment"
android:name="io.novafoundation.nova.feature_external_sign_impl.presentation.signExtrinsic.ExternalSignFragment"
android:label="ConfirmSignExtrinsicFragment"
app:useAdd="true"
tools:layout="@layout/fragment_confirm_sign_extrinsic">

<action
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
// App version
versionName = '9.2.3'
versionCode = 174
versionName = '9.2.4'
versionCode = 175

applicationId = "io.novafoundation.nova"
releaseApplicationSuffix = "market"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class CompoundLedgerDiscoveryService(
private val delegates: List<LedgerDeviceDiscoveryService>
) : LedgerDeviceDiscoveryService {

private var discoveringSubscribersManager = DiscoveringSubscribersManager()

constructor(vararg delegates: LedgerDeviceDiscoveryService) : this(delegates.toList())

override val discoveredDevices: Flow<List<LedgerDevice>> by lazy {
Expand All @@ -26,10 +28,37 @@ class CompoundLedgerDiscoveryService(
}

override fun startDiscovery() {
delegates.forEach { it.startDiscovery() }
if (discoveringSubscribersManager.noSubscribers()) {
delegates.forEach { it.startDiscovery() }
}

discoveringSubscribersManager.addSubscriber()
}

override fun stopDiscovery() {
delegates.forEach { it.stopDiscovery() }
discoveringSubscribersManager.removeSubscriber()

if (discoveringSubscribersManager.noSubscribers()) {
delegates.forEach { it.stopDiscovery() }
}
}
}

private class DiscoveringSubscribersManager {

private var subscribers = 0

fun addSubscriber() {
subscribers++
}

fun removeSubscriber() {
if (subscribers == 0) return

subscribers--
}

fun noSubscribers(): Boolean {
return subscribers == 0
}
}

0 comments on commit b4112ce

Please sign in to comment.