Skip to content

Commit 5f0967c

Browse files
committed
refactor: remove listener API from artboard property
1 parent 6d905b7 commit 5f0967c

4 files changed

Lines changed: 3 additions & 31 deletions

File tree

android/src/main/java/com/margelo/nitro/rive/HybridViewModelArtboardProperty.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,4 @@ class HybridViewModelArtboardProperty(private val property: ViewModelArtboardPro
1313
val bindable = (artboard as? HybridBindableArtboard)?.bindableArtboard
1414
property.set(bindable)
1515
}
16-
17-
// Android SDK doesn't support listeners on artboard properties
18-
override fun addListener(onChanged: () -> Unit): () -> Unit {
19-
return {}
20-
}
21-
22-
override fun removeListeners() {
23-
// No-op on Android - artboard properties don't support listeners
24-
}
2516
}

ios/BaseHybridViewModelProperty.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ extension ListPropertyType: RivePropertyWithListeners {
6666
}
6767
}
6868

69-
extension ArtboardPropertyType: RivePropertyWithListeners {
70-
typealias ListenerValueType = Void
71-
72-
func addListener(_ callback: @escaping ListenerType) -> UUID {
73-
addListener { _ in callback(()) }
74-
}
75-
}
76-
7769
/// Helper class for managing ViewModel property listeners
7870
class PropertyListenerHelper<PropertyType: RivePropertyWithListeners> {
7971
private var listenerIds: [UUID] = []
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import RiveRuntime
22

3-
class HybridViewModelArtboardProperty: HybridViewModelArtboardPropertySpec, ValuedPropertyProtocol {
4-
typealias ValueType = Void
5-
6-
var property: ArtboardPropertyType!
7-
lazy var helper = PropertyListenerHelper(property: property!)
3+
class HybridViewModelArtboardProperty: HybridViewModelArtboardPropertySpec {
4+
private let property: ArtboardPropertyType
85

96
init(property: ArtboardPropertyType) {
107
self.property = property
@@ -18,8 +15,4 @@ class HybridViewModelArtboardProperty: HybridViewModelArtboardPropertySpec, Valu
1815
property.setValue(nil)
1916
}
2017
}
21-
22-
func addListener(onChanged: @escaping () -> Void) throws -> () -> Void {
23-
return helper.addListener { _ in onChanged() }
24-
}
2518
}

src/specs/ViewModel.nitro.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,10 @@ export interface ViewModelListProperty
162162
* This is a write-only property - artboards can be set but not read.
163163
* @see {@link https://rive.app/docs/runtimes/data-binding Rive Data Binding Documentation}
164164
*/
165-
export interface ViewModelArtboardProperty
166-
extends ViewModelProperty,
167-
ObservableProperty {
165+
export interface ViewModelArtboardProperty extends ViewModelProperty {
168166
/**
169167
* Set the artboard for this property.
170168
* Pass undefined to clear the currently bound artboard.
171169
*/
172170
set(artboard: BindableArtboard | undefined): void;
173-
/** Add a listener called when the artboard property changes. Returns cleanup function. */
174-
addListener(onChanged: () => void): () => void;
175171
}

0 commit comments

Comments
 (0)