Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed crash signing via wc #1786

Merged
merged 7 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading