@bacons/apple-targets 3.0.1 → 3.0.2
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/README.md
CHANGED
|
@@ -388,6 +388,7 @@ ExtensionStorage.reloadWidget();
|
|
|
388
388
|
|
|
389
389
|
- `set(key: string, value: string | number | Record<string, string | number> | Array<Record<string, string | number>> | undefined): void` - Sets a value in the shared storage for a given key. Setting `undefined` will remove the key.
|
|
390
390
|
- `ExtensionStorage.reloadWidget(name?: string): void` - A static method for reloading the widget. Behind the scenes, this calls `WidgetCenter.shared.reloadAllTimelines()`. If given a name, it will reload a specific widget using `WidgetCenter.shared.reloadTimelines(ofKind: timeline)`.
|
|
391
|
+
- `ExtensionStorage.reloadControls(name?: string): void` - A static method for reloading the controls. Behind the scenes, this calls `ControlCenter.shared.reloadAllControls(): void`. If given a name, it will reload a specific widget using `ControlCenter.shared.reloadControls(ofKind?: string): void`.
|
|
391
392
|
- `remove(key: string): void` - A method for removing the key from the shared storage.
|
|
392
393
|
- `get(key: string): string | null` - A static method for getting the value from the shared storage.
|
|
393
394
|
|
|
@@ -478,6 +479,14 @@ struct OpenAppIntent0: ControlConfigurationIntent {
|
|
|
478
479
|
|
|
479
480
|
You should copy the intents into your main `WidgetBundle` struct.
|
|
480
481
|
|
|
482
|
+
**Reloading Controls from Your App**
|
|
483
|
+
|
|
484
|
+
Changes in your app’s state may affect control displays. You can request a reload of specific controls or all controls using
|
|
485
|
+
|
|
486
|
+
```js
|
|
487
|
+
ExtensionStorage.reloadControls();
|
|
488
|
+
```
|
|
489
|
+
|
|
481
490
|
Custom images can be used but they must be SF Symbols, you can use a tool like [Create Custom Symbols](https://github.com/jaywcjlove/create-custom-symbols) to do this. Then simply add to the Assets.xcassets folder and reference it in the `Label`.
|
|
482
491
|
|
|
483
492
|
You can do a lot of things with Control Widgets like launching a custom UI instead of opening the app. This plugin should allow for most of these things to work.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class ExtensionStorage {
|
|
2
2
|
private readonly appGroup;
|
|
3
3
|
static reloadWidget(name?: string): void;
|
|
4
|
+
static reloadControls(name?: string): void;
|
|
4
5
|
constructor(appGroup: string);
|
|
5
6
|
set(key: string, value?: string | number | Record<string, string | number> | Array<Record<string, string | number>>): void;
|
|
6
7
|
get(key: string): string | null;
|
|
@@ -7,9 +7,10 @@ const ExtensionStorageModule = (_a = expo === null || expo === void 0 ? void 0 :
|
|
|
7
7
|
const nativeModule = ExtensionStorageModule !== null && ExtensionStorageModule !== void 0 ? ExtensionStorageModule : {
|
|
8
8
|
setInt() { },
|
|
9
9
|
setString() { },
|
|
10
|
+
reloadWidget() { },
|
|
11
|
+
reloadControls() { },
|
|
10
12
|
setObject() { },
|
|
11
13
|
setArray() { },
|
|
12
|
-
reloadWidget() { },
|
|
13
14
|
get() { },
|
|
14
15
|
remove() { },
|
|
15
16
|
};
|
|
@@ -25,6 +26,9 @@ class ExtensionStorage {
|
|
|
25
26
|
static reloadWidget(name) {
|
|
26
27
|
nativeModule.reloadWidget(name);
|
|
27
28
|
}
|
|
29
|
+
static reloadControls(name) {
|
|
30
|
+
nativeModule.reloadControls(name);
|
|
31
|
+
}
|
|
28
32
|
constructor(appGroup) {
|
|
29
33
|
this.appGroup = appGroup;
|
|
30
34
|
}
|
|
@@ -17,6 +17,16 @@ public class ExtensionStorageModule: Module {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
Function("reloadControls") { (kind: String?) in
|
|
21
|
+
if #available(iOS 18.0, *) {
|
|
22
|
+
if let kind = kind {
|
|
23
|
+
ControlCenter.shared.reloadControls(ofKind: kind)
|
|
24
|
+
} else {
|
|
25
|
+
ControlCenter.shared.reloadAllControls()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
Function("setArray") { (forKey: String, data: [[String: Any]], suiteName: String?) -> Bool in
|
|
21
31
|
// Convert the incoming array of dictionaries directly to JSON data
|
|
22
32
|
do {
|