@applicaster/zapp-react-native-utils 16.0.0-rc.105 → 16.0.0-rc.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "16.0.0-rc.105",
3
+ "version": "16.0.0-rc.107",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "16.0.0-rc.105",
30
+ "@applicaster/applicaster-types": "16.0.0-rc.107",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -105,3 +105,29 @@ describe("isActionAvailableFor", () => {
105
105
  expect(isActionAvailableFor(undefined, entry)).toBe(true);
106
106
  });
107
107
  });
108
+
109
+ describe("uiActionsRegistry.notifyProviderChanged", () => {
110
+ it("notifies subscribers for a registered provider", () => {
111
+ const unregister = uiActionsRegistry.registerAction("live-action", value);
112
+ const listener = jest.fn();
113
+ const unsubscribe = uiActionsRegistry.subscribe(listener);
114
+
115
+ uiActionsRegistry.notifyProviderChanged("live-action");
116
+
117
+ expect(listener).toHaveBeenCalledTimes(1);
118
+
119
+ unsubscribe();
120
+ unregister();
121
+ });
122
+
123
+ it("ignores names that are not registered", () => {
124
+ const listener = jest.fn();
125
+ const unsubscribe = uiActionsRegistry.subscribe(listener);
126
+
127
+ uiActionsRegistry.notifyProviderChanged("unknown-action");
128
+
129
+ expect(listener).not.toHaveBeenCalled();
130
+
131
+ unsubscribe();
132
+ });
133
+ });
@@ -246,6 +246,22 @@ class UIActionsRegistry {
246
246
  this.changeListeners.slice().forEach((listener) => listener());
247
247
  }
248
248
 
249
+ /**
250
+ * Tells consumers that a registered provider now returns different actions.
251
+ *
252
+ * Resolved actions are snapshots: an action whose availability depends on
253
+ * live state (cast devices found, downloads allowed) hands out a new value
254
+ * when that state changes, and consumers that resolved the old one keep
255
+ * asking it until they re-resolve. Registration alone never tells them.
256
+ */
257
+ notifyProviderChanged(name: string): void {
258
+ if (!this.registeredActions[name]) {
259
+ return;
260
+ }
261
+
262
+ this.notifyChanged();
263
+ }
264
+
249
265
  /**
250
266
  * Register a dynamic action provider under a unique `name`.
251
267
  * The provider can return one or more actions and may use the passed `entry`.