expo-widgets 56.0.16 → 56.0.18
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/CHANGELOG.md +18 -0
- package/android/build.gradle +2 -2
- package/build/ExpoWidgets.d.ts +1 -0
- package/build/ExpoWidgets.d.ts.map +1 -1
- package/build/ExpoWidgets.ios.d.ts +1 -0
- package/build/ExpoWidgets.ios.d.ts.map +1 -1
- package/build/ExpoWidgets.ios.js.map +1 -1
- package/build/ExpoWidgets.js +1 -0
- package/build/ExpoWidgets.js.map +1 -1
- package/build/Widgets.d.ts +5 -0
- package/build/Widgets.d.ts.map +1 -1
- package/build/Widgets.js +5 -0
- package/build/Widgets.js.map +1 -1
- package/ios/WidgetsModule.swift +14 -0
- package/package.json +5 -5
- package/plugin/build/android/withAndroidWidgetFiles.js +1 -1
- package/plugin/build/withWidgets.d.ts +5 -0
- package/plugin/build/withWidgets.js +3 -4
- package/plugin/src/android/withAndroidWidgetFiles.ts +1 -1
- package/plugin/src/withWidgets.ts +9 -5
- package/src/ExpoWidgets.ios.ts +1 -0
- package/src/ExpoWidgets.ts +1 -0
- package/src/Widgets.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,24 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 56.0.18 — 2026-06-10
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 56.0.17 — 2026-06-05
|
|
18
|
+
|
|
19
|
+
### 🎉 New features
|
|
20
|
+
|
|
21
|
+
- Expose shared directory for images. ([#46339](https://github.com/expo/expo/pull/46339) by [@jakex7](https://github.com/jakex7))
|
|
22
|
+
|
|
23
|
+
### 🐛 Bug fixes
|
|
24
|
+
|
|
25
|
+
- [Android] Fix widget strings file location. ([#46538](https://github.com/expo/expo/pull/46538) by [@jakex7](https://github.com/jakex7))
|
|
26
|
+
|
|
27
|
+
### 💡 Others
|
|
28
|
+
|
|
29
|
+
- Temporarily make the Android config plugin opt-in with `enableAndroid`. ([#46463](https://github.com/expo/expo/pull/46463) by [@jakex7](https://github.com/jakex7))
|
|
30
|
+
|
|
13
31
|
## 56.0.16 — 2026-05-29
|
|
14
32
|
|
|
15
33
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -13,7 +13,7 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
13
13
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
14
14
|
|
|
15
15
|
group = 'expo.modules.widgets'
|
|
16
|
-
version = '56.0.
|
|
16
|
+
version = '56.0.18'
|
|
17
17
|
|
|
18
18
|
expoModule {
|
|
19
19
|
canBePublished false
|
|
@@ -23,7 +23,7 @@ android {
|
|
|
23
23
|
namespace "expo.modules.widgets"
|
|
24
24
|
defaultConfig {
|
|
25
25
|
versionCode 1
|
|
26
|
-
versionName '56.0.
|
|
26
|
+
versionName '56.0.18'
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
buildFeatures {
|
package/build/ExpoWidgets.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EventSubscription } from 'expo-modules-core';
|
|
2
2
|
import type { ExpoWidgetsEvents, NativeLiveActivity, NativeLiveActivityFactory, NativeWidgetObject } from './Widgets.types';
|
|
3
3
|
declare const ExpoWidgetsModule: {
|
|
4
|
+
widgetsDirectory: string;
|
|
4
5
|
reloadAllWidgets(): void;
|
|
5
6
|
Widget: typeof NativeWidgetObject;
|
|
6
7
|
LiveActivityFactory: typeof NativeLiveActivityFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWidgets.d.ts","sourceRoot":"","sources":["../src/ExpoWidgets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAEV,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAyCzB,QAAA,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"ExpoWidgets.d.ts","sourceRoot":"","sources":["../src/ExpoWidgets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAEV,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAyCzB,QAAA,MAAM,iBAAiB;;wBAED,IAAI;YACF,OAAO,kBAAkB;yBACC,OAAO,yBAAyB;kBAC9C,OAAO,kBAAkB;gBAC/C,SAAS,SAAS,MAAM,iBAAiB,cACvC,SAAS,aACV,iBAAiB,CAAC,SAAS,CAAC,GACtC,iBAAiB;CAGrB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeModule } from 'expo';
|
|
2
2
|
import type { ExpoWidgetsEvents, NativeLiveActivity, NativeLiveActivityFactory, NativeWidgetObject } from './Widgets.types';
|
|
3
3
|
declare class ExpoWidgetsModule extends NativeModule<ExpoWidgetsEvents> {
|
|
4
|
+
widgetsDirectory: string;
|
|
4
5
|
reloadAllWidgets(): void;
|
|
5
6
|
readonly Widget: typeof NativeWidgetObject;
|
|
6
7
|
readonly LiveActivityFactory: typeof NativeLiveActivityFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWidgets.ios.d.ts","sourceRoot":"","sources":["../src/ExpoWidgets.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,OAAO,iBAAkB,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACrE,gBAAgB,IAAI,IAAI;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,kBAAkB,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,yBAAyB,CAAC;IAC/D,QAAQ,CAAC,YAAY,EAAE,OAAO,kBAAkB,CAAC;CAClD;;AAED,wBAAqE"}
|
|
1
|
+
{"version":3,"file":"ExpoWidgets.ios.d.ts","sourceRoot":"","sources":["../src/ExpoWidgets.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,OAAO,iBAAkB,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACrE,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,IAAI,IAAI;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,kBAAkB,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,yBAAyB,CAAC;IAC/D,QAAQ,CAAC,YAAY,EAAE,OAAO,kBAAkB,CAAC;CAClD;;AAED,wBAAqE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWidgets.ios.js","sourceRoot":"","sources":["../src/ExpoWidgets.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoWidgets.ios.js","sourceRoot":"","sources":["../src/ExpoWidgets.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAiBzD,eAAe,mBAAmB,CAAoB,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport type {\n ExpoWidgetsEvents,\n NativeLiveActivity,\n NativeLiveActivityFactory,\n NativeWidgetObject,\n} from './Widgets.types';\n\ndeclare class ExpoWidgetsModule extends NativeModule<ExpoWidgetsEvents> {\n widgetsDirectory: string;\n reloadAllWidgets(): void;\n readonly Widget: typeof NativeWidgetObject;\n readonly LiveActivityFactory: typeof NativeLiveActivityFactory;\n readonly LiveActivity: typeof NativeLiveActivity;\n}\n\nexport default requireNativeModule<ExpoWidgetsModule>('ExpoWidgets');\n"]}
|
package/build/ExpoWidgets.js
CHANGED
package/build/ExpoWidgets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWidgets.js","sourceRoot":"","sources":["../src/ExpoWidgets.ts"],"names":[],"mappings":"AAUA,MAAM,gBAAgB,GAAsB,EAAE,MAAM,KAAI,CAAC,EAAE,CAAC;AAE5D,MAAM,UAAU;IACd,qEAAqE;IACrE,YAAY,KAAa,EAAE,OAAe,IAAG,CAAC;IAC9C,MAAM,KAAU,CAAC;IACjB,cAAc,CAAC,QAA6B,IAAS,CAAC;IACtD,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,gBAAgB;IACpB,KAAK,CAAC,MAAM,CAAC,MAAc,IAAkB,CAAC;IAC9C,KAAK,CAAC,GAAG,CACP,gBAAyB,EACzB,UAAmB,EACnB,MAAe,EACf,YAAqB,IACL,CAAC;IACnB,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,WAAW,CAAC,UAAkB,EAAE,SAAuC;QACrE,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,uBAAuB;IAC3B,qEAAqE;IACrE,YAAY,KAAa,EAAE,OAAe,IAAG,CAAC;IAC9C,KAAK,CAAC,MAAc,EAAE,IAAa;QACjC,OAAO,IAAI,gBAAgB,EAAwB,CAAC;IACtD,CAAC;IACD,YAAY;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,iBAAiB,GAAG;IACxB,gBAAgB,KAAU,CAAC;IAC3B,MAAM,EAAE,UAAuC;IAC/C,mBAAmB,EAAE,uBAA2D;IAChF,YAAY,EAAE,gBAA6C;IAC3D,WAAW,CACT,UAAqB,EACrB,SAAuC;QAEvC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import type { EventSubscription } from 'expo-modules-core';\n\nimport type {\n ExpoTimelineEntry,\n ExpoWidgetsEvents,\n NativeLiveActivity,\n NativeLiveActivityFactory,\n NativeWidgetObject,\n} from './Widgets.types';\n\nconst noopSubscription: EventSubscription = { remove() {} };\n\nclass WidgetStub {\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(_name: string, _layout: string) {}\n reload(): void {}\n updateTimeline(_entries: ExpoTimelineEntry[]): void {}\n async getTimeline(): Promise<ExpoTimelineEntry[]> {\n return [];\n }\n}\n\nclass LiveActivityStub {\n async update(_props: string): Promise<void> {}\n async end(\n _dismissalPolicy?: string,\n _afterDate?: number,\n _state?: string,\n _contentDate?: number\n ): Promise<void> {}\n async getPushToken(): Promise<string | null> {\n return null;\n }\n addListener(_eventName: string, _listener: (...args: unknown[]) => void): EventSubscription {\n return noopSubscription;\n }\n}\n\nclass LiveActivityFactoryStub {\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(_name: string, _layout: string) {}\n start(_props: string, _url?: string): NativeLiveActivity {\n return new LiveActivityStub() as NativeLiveActivity;\n }\n getInstances(): NativeLiveActivity[] {\n return [];\n }\n}\n\nconst ExpoWidgetsModule = {\n reloadAllWidgets(): void {},\n Widget: WidgetStub as typeof NativeWidgetObject,\n LiveActivityFactory: LiveActivityFactoryStub as typeof NativeLiveActivityFactory,\n LiveActivity: LiveActivityStub as typeof NativeLiveActivity,\n addListener<EventName extends keyof ExpoWidgetsEvents>(\n _eventName: EventName,\n _listener: ExpoWidgetsEvents[EventName]\n ): EventSubscription {\n return noopSubscription;\n },\n};\n\nexport default ExpoWidgetsModule;\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoWidgets.js","sourceRoot":"","sources":["../src/ExpoWidgets.ts"],"names":[],"mappings":"AAUA,MAAM,gBAAgB,GAAsB,EAAE,MAAM,KAAI,CAAC,EAAE,CAAC;AAE5D,MAAM,UAAU;IACd,qEAAqE;IACrE,YAAY,KAAa,EAAE,OAAe,IAAG,CAAC;IAC9C,MAAM,KAAU,CAAC;IACjB,cAAc,CAAC,QAA6B,IAAS,CAAC;IACtD,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,gBAAgB;IACpB,KAAK,CAAC,MAAM,CAAC,MAAc,IAAkB,CAAC;IAC9C,KAAK,CAAC,GAAG,CACP,gBAAyB,EACzB,UAAmB,EACnB,MAAe,EACf,YAAqB,IACL,CAAC;IACnB,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,WAAW,CAAC,UAAkB,EAAE,SAAuC;QACrE,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,uBAAuB;IAC3B,qEAAqE;IACrE,YAAY,KAAa,EAAE,OAAe,IAAG,CAAC;IAC9C,KAAK,CAAC,MAAc,EAAE,IAAa;QACjC,OAAO,IAAI,gBAAgB,EAAwB,CAAC;IACtD,CAAC;IACD,YAAY;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,iBAAiB,GAAG;IACxB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,KAAU,CAAC;IAC3B,MAAM,EAAE,UAAuC;IAC/C,mBAAmB,EAAE,uBAA2D;IAChF,YAAY,EAAE,gBAA6C;IAC3D,WAAW,CACT,UAAqB,EACrB,SAAuC;QAEvC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import type { EventSubscription } from 'expo-modules-core';\n\nimport type {\n ExpoTimelineEntry,\n ExpoWidgetsEvents,\n NativeLiveActivity,\n NativeLiveActivityFactory,\n NativeWidgetObject,\n} from './Widgets.types';\n\nconst noopSubscription: EventSubscription = { remove() {} };\n\nclass WidgetStub {\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(_name: string, _layout: string) {}\n reload(): void {}\n updateTimeline(_entries: ExpoTimelineEntry[]): void {}\n async getTimeline(): Promise<ExpoTimelineEntry[]> {\n return [];\n }\n}\n\nclass LiveActivityStub {\n async update(_props: string): Promise<void> {}\n async end(\n _dismissalPolicy?: string,\n _afterDate?: number,\n _state?: string,\n _contentDate?: number\n ): Promise<void> {}\n async getPushToken(): Promise<string | null> {\n return null;\n }\n addListener(_eventName: string, _listener: (...args: unknown[]) => void): EventSubscription {\n return noopSubscription;\n }\n}\n\nclass LiveActivityFactoryStub {\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(_name: string, _layout: string) {}\n start(_props: string, _url?: string): NativeLiveActivity {\n return new LiveActivityStub() as NativeLiveActivity;\n }\n getInstances(): NativeLiveActivity[] {\n return [];\n }\n}\n\nconst ExpoWidgetsModule = {\n widgetsDirectory: '',\n reloadAllWidgets(): void {},\n Widget: WidgetStub as typeof NativeWidgetObject,\n LiveActivityFactory: LiveActivityFactoryStub as typeof NativeLiveActivityFactory,\n LiveActivity: LiveActivityStub as typeof NativeLiveActivity,\n addListener<EventName extends keyof ExpoWidgetsEvents>(\n _eventName: EventName,\n _listener: ExpoWidgetsEvents[EventName]\n ): EventSubscription {\n return noopSubscription;\n },\n};\n\nexport default ExpoWidgetsModule;\n"]}
|
package/build/Widgets.d.ts
CHANGED
|
@@ -111,4 +111,9 @@ export declare function addUserInteractionListener(listener: ExpoWidgetsEvents['
|
|
|
111
111
|
* @return An event subscription that can be used to remove the listener.
|
|
112
112
|
*/
|
|
113
113
|
export declare function addPushToStartTokenListener(listener: ExpoWidgetsEvents['onExpoWidgetsPushToStartTokenReceived']): EventSubscription;
|
|
114
|
+
/**
|
|
115
|
+
* A directory that can be used to store shared images for widgets.
|
|
116
|
+
* The contents of this directory are accessible by both the main app and widgets.
|
|
117
|
+
*/
|
|
118
|
+
export declare const widgetsDirectory: string;
|
|
114
119
|
//# sourceMappingURL=Widgets.d.ts.map
|
package/build/Widgets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Widgets.d.ts","sourceRoot":"","sources":["../src/Widgets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAGlB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,qBAAa,MAAM,CACjB,SAAS,SAAS,MAAM,GAAG,MAAM,EACjC,iBAAiB,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS;IAExD,cAAc;IACd,OAAO,CAAC,kBAAkB,CAAqB;gBAE7C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CACN,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,KAC9C,KAAK,CAAC,GAAG,CAAC,OAAO;IAKxB;;OAEG;IACH,MAAM;IAIN;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,EAAE;IAMxD;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,SAAS;IAI/B;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,CAAC;CAM/D;AAED;;GAEG;AACH,qBAAa,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACjD,cAAc;IACd,OAAO,CAAC,kBAAkB,CAAqB;gBACnC,kBAAkB,EAAE,kBAAkB;IAIlD;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,CAAC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AAM,EACZ,YAAY,EAAE,qBAAqB,CAAC,CAAC,CAAC,GACrC,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,iBAAiB,CAAC,8BAA8B,CAAC,GAC1D,iBAAiB,CAEnB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,iBAAiB,CAAC,uCAAuC,CAAC,GACnE,iBAAiB,CAEnB;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAqC,CAAC"}
|
package/build/Widgets.js
CHANGED
|
@@ -155,4 +155,9 @@ export function addUserInteractionListener(listener) {
|
|
|
155
155
|
export function addPushToStartTokenListener(listener) {
|
|
156
156
|
return ExpoWidgetsModule.addListener('onExpoWidgetsPushToStartTokenReceived', listener);
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* A directory that can be used to store shared images for widgets.
|
|
160
|
+
* The contents of this directory are accessible by both the main app and widgets.
|
|
161
|
+
*/
|
|
162
|
+
export const widgetsDirectory = ExpoWidgetsModule.widgetsDirectory;
|
|
158
163
|
//# sourceMappingURL=Widgets.js.map
|
package/build/Widgets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Widgets.js","sourceRoot":"","sources":["../src/Widgets.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,eAAe,CAAC;AAa9C;;GAEG;AACH,MAAM,OAAO,MAAM;IAIjB,cAAc;IACN,kBAAkB,CAAqB;IAC/C,YACE,IAAY,EACZ,MAGsB;QAEtB,IAAI,CAAC,kBAAkB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,MAA2B,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,OAAyC;QACtD,IA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O,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAI1B,IAAY,EACZ,MAA8F;IAE9F,OAAO,IAAI,MAAM,CAA+B,IAAI,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,YAAsC;IAEtC,OAAO,IAAI,mBAAmB,CAAI,IAAI,EAAE,YAAY,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,QAA2D;IAE3D,OAAO,iBAAiB,CAAC,WAAW,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAoE;IAEpE,OAAO,iBAAiB,CAAC,WAAW,CAAC,uCAAuC,EAAE,QAAQ,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import type { EventSubscription } from 'expo-modules-core';\n\nimport ExpoWidgetsModule from './ExpoWidgets';\nimport type {\n ExpoWidgetsEvents,\n LiveActivityComponent,\n LiveActivityDismissalPolicy,\n NativeLiveActivity,\n NativeLiveActivityFactory,\n NativeWidgetObject,\n PushTokenEvent,\n WidgetEnvironment,\n WidgetTimelineEntry,\n} from './Widgets.types';\n\n/**\n * Represents a widget instance. Provides methods to manage the widget's timeline.\n */\nexport class Widget<\n PropsType extends object = object,\n ConfigurationType extends object | undefined = undefined,\n> {\n /** @hidden */\n private nativeWidgetObject: NativeWidgetObject;\n constructor(\n name: string,\n layout: (\n props: PropsType,\n environment: WidgetEnvironment<ConfigurationType>\n ) => React.JSX.Element\n ) {\n this.nativeWidgetObject = new ExpoWidgetsModule.Widget(name, layout as unknown as string);\n }\n\n /**\n * Force reloads the widget, causing it to refresh its content and timeline.\n */\n reload() {\n this.nativeWidgetObject.reload();\n }\n\n /**\n * Schedules a series of updates for the widget's content and reloads the widget.\n * @param entries Timeline entries, each specifying a date and the props to display at that time.\n */\n updateTimeline(entries: WidgetTimelineEntry<PropsType>[]) {\n this.nativeWidgetObject.updateTimeline(\n entries.map((entry) => ({ timestamp: entry.date.getTime(), props: entry.props }))\n );\n }\n\n /**\n * Sets the widget's content to the given props immediately, without scheduling a timeline.\n * @param props The properties to display in the widget.\n */\n updateSnapshot(props: PropsType) {\n this.nativeWidgetObject.updateTimeline([{ timestamp: Date.now(), props }]);\n }\n\n /**\n * Returns the current timeline entries for the widget, including past and future entries.\n */\n async getTimeline(): Promise<WidgetTimelineEntry<PropsType>[]> {\n return (await this.nativeWidgetObject.getTimeline()).map((entry) => ({\n date: new Date(entry.timestamp),\n props: entry.props as PropsType,\n }));\n }\n}\n\n/**\n * Represents a Live Activity instance. Provides methods to update its content and end it.\n */\nexport class LiveActivity<T extends object = object> {\n /** @hidden */\n private nativeLiveActivity: NativeLiveActivity;\n constructor(nativeLiveActivity: NativeLiveActivity) {\n this.nativeLiveActivity = nativeLiveActivity;\n }\n\n /**\n * Updates the Live Activity's content. The UI reflects the new properties immediately.\n * @param props The updated content properties.\n */\n update(props: T): Promise<void> {\n return this.nativeLiveActivity.update(JSON.stringify(props));\n }\n\n /**\n * Ends the Live Activity.\n * @param dismissalPolicy Controls when the Live Activity is removed from the Lock Screen after ending.\n * Can be `'default'`, `'immediate'`, or `after(date)`.\n * @param props Final content properties to update after the activity ends.\n * @param contentDate The time the data in the payload was generated. If this is older than a previous update or push payload, the system ignores this update.\n */\n end(dismissalPolicy?: LiveActivityDismissalPolicy, props?: T, contentDate?: Date): Promise<void> {\n const serializedProps = props ? JSON.stringify(props) : undefined;\n if (\n typeof dismissalPolicy === 'object' &&\n dismissalPolicy !== null &&\n 'after' in dismissalPolicy\n ) {\n return this.nativeLiveActivity.end(\n 'after',\n dismissalPolicy.after?.getTime(),\n serializedProps,\n contentDate?.getTime()\n );\n }\n return this.nativeLiveActivity.end(\n dismissalPolicy,\n undefined,\n serializedProps,\n contentDate?.getTime()\n );\n }\n\n /**\n * Returns the push token for this Live Activity, used to send push notification updates via APNs.\n * Returns `null` if push notifications are not enabled or the token is not yet available.\n */\n getPushToken(): Promise<string | null> {\n return this.nativeLiveActivity.getPushToken();\n }\n\n /**\n * Adds a listener for push token update events on this Live Activity instance.\n * The token can be used to send content updates to this specific activity via APNs.\n * @param listener Callback invoked when a new push token is available.\n * @returns An event subscription that can be used to remove the listener.\n */\n addPushTokenListener(listener: (event: PushTokenEvent) => void): EventSubscription {\n return this.nativeLiveActivity.addListener('onExpoWidgetsTokenReceived', listener);\n }\n}\n\n/**\n * Manages Live Activity instances of a specific type. Use it to start new activities and retrieve currently active ones.\n */\nexport class LiveActivityFactory<T extends object = object> {\n /** @hidden */\n private nativeLiveActivityFactory: NativeLiveActivityFactory;\n constructor(name: string, layout: LiveActivityComponent<T>) {\n this.nativeLiveActivityFactory = new ExpoWidgetsModule.LiveActivityFactory(\n name,\n layout as unknown as string\n );\n }\n\n /**\n * Starts a new Live Activity with the given properties.\n * @param props The initial content properties for the Live Activity.\n * @param url An optional URL to associate with the Live Activity, used for deep linking.\n * @returns The new Live Activity instance.\n */\n start(props: T, url?: string) {\n return new LiveActivity<T>(this.nativeLiveActivityFactory.start(JSON.stringify(props), url));\n }\n\n /**\n * Returns all currently active instances of this Live Activity type.\n */\n getInstances() {\n return this.nativeLiveActivityFactory\n .getInstances()\n .map((instance) => new LiveActivity<T>(instance));\n }\n}\n\n/**\n * Creates a dismissal policy that removes the Live Activity at the specified time within a four-hour window.\n * @param date The date after which the Live Activity should be removed from the Lock Screen.\n * @hidden\n */\nexport function after(date: Date): { after: Date } {\n return { after: date };\n}\n\n/**\n * Creates a Widget instance.\n * @param name The widget name. Must match the `'name'` field in your widget configuration in the app config.\n * @param widget The widget component, marked with the `'widget'` directive.\n */\nexport function createWidget<\n PropsType extends object = object,\n ConfigurationType extends object | undefined = undefined,\n>(\n name: string,\n widget: (props: PropsType, context: WidgetEnvironment<ConfigurationType>) => React.JSX.Element\n): Widget<PropsType, ConfigurationType> {\n return new Widget<PropsType, ConfigurationType>(name, widget);\n}\n\n/**\n * Creates a Live Activity Factory for managing Live Activities of a specific type.\n * @param name The Live Activity name. Must match the `'name'` field in your widget configuration in the app config.\n * @param liveActivity The Live Activity component, marked with the `'widget'` directive.\n */\nexport function createLiveActivity<T extends object = object>(\n name: string,\n liveActivity: LiveActivityComponent<T>\n): LiveActivityFactory<T> {\n return new LiveActivityFactory<T>(name, liveActivity);\n}\n\n/**\n * Adds a listener for widget interaction events (for example, button taps).\n * @param listener Callback function to handle user interaction events.\n * @return An event subscription that can be used to remove the listener.\n */\nexport function addUserInteractionListener(\n listener: ExpoWidgetsEvents['onExpoWidgetsUserInteraction']\n): EventSubscription {\n return ExpoWidgetsModule.addListener('onExpoWidgetsUserInteraction', listener);\n}\n\n/**\n * Adds a listener for push-to-start token events.\n * This token can be used to start live activities remotely via APNs.\n * @param listener Callback function to handle push-to-start token events.\n * @return An event subscription that can be used to remove the listener.\n */\nexport function addPushToStartTokenListener(\n listener: ExpoWidgetsEvents['onExpoWidgetsPushToStartTokenReceived']\n): EventSubscription {\n return ExpoWidgetsModule.addListener('onExpoWidgetsPushToStartTokenReceived', listener);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Widgets.js","sourceRoot":"","sources":["../src/Widgets.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,eAAe,CAAC;AAa9C;;GAEG;AACH,MAAM,OAAO,MAAM;IAIjB,cAAc;IACN,kBAAkB,CAAqB;IAC/C,YACE,IAAY,EACZ,MAGsB;QAEtB,IAAI,CAAC,kBAAkB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,MAA2B,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,cAAc,CAAC,OAAyC;QACtD,IAAI,CAAC,kBA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,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAI1B,IAAY,EACZ,MAA8F;IAE9F,OAAO,IAAI,MAAM,CAA+B,IAAI,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,YAAsC;IAEtC,OAAO,IAAI,mBAAmB,CAAI,IAAI,EAAE,YAAY,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,QAA2D;IAE3D,OAAO,iBAAiB,CAAC,WAAW,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAoE;IAEpE,OAAO,iBAAiB,CAAC,WAAW,CAAC,uCAAuC,EAAE,QAAQ,CAAC,CAAC;AAC1F,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC","sourcesContent":["import type { EventSubscription } from 'expo-modules-core';\n\nimport ExpoWidgetsModule from './ExpoWidgets';\nimport type {\n ExpoWidgetsEvents,\n LiveActivityComponent,\n LiveActivityDismissalPolicy,\n NativeLiveActivity,\n NativeLiveActivityFactory,\n NativeWidgetObject,\n PushTokenEvent,\n WidgetEnvironment,\n WidgetTimelineEntry,\n} from './Widgets.types';\n\n/**\n * Represents a widget instance. Provides methods to manage the widget's timeline.\n */\nexport class Widget<\n PropsType extends object = object,\n ConfigurationType extends object | undefined = undefined,\n> {\n /** @hidden */\n private nativeWidgetObject: NativeWidgetObject;\n constructor(\n name: string,\n layout: (\n props: PropsType,\n environment: WidgetEnvironment<ConfigurationType>\n ) => React.JSX.Element\n ) {\n this.nativeWidgetObject = new ExpoWidgetsModule.Widget(name, layout as unknown as string);\n }\n\n /**\n * Force reloads the widget, causing it to refresh its content and timeline.\n */\n reload() {\n this.nativeWidgetObject.reload();\n }\n\n /**\n * Schedules a series of updates for the widget's content and reloads the widget.\n * @param entries Timeline entries, each specifying a date and the props to display at that time.\n */\n updateTimeline(entries: WidgetTimelineEntry<PropsType>[]) {\n this.nativeWidgetObject.updateTimeline(\n entries.map((entry) => ({ timestamp: entry.date.getTime(), props: entry.props }))\n );\n }\n\n /**\n * Sets the widget's content to the given props immediately, without scheduling a timeline.\n * @param props The properties to display in the widget.\n */\n updateSnapshot(props: PropsType) {\n this.nativeWidgetObject.updateTimeline([{ timestamp: Date.now(), props }]);\n }\n\n /**\n * Returns the current timeline entries for the widget, including past and future entries.\n */\n async getTimeline(): Promise<WidgetTimelineEntry<PropsType>[]> {\n return (await this.nativeWidgetObject.getTimeline()).map((entry) => ({\n date: new Date(entry.timestamp),\n props: entry.props as PropsType,\n }));\n }\n}\n\n/**\n * Represents a Live Activity instance. Provides methods to update its content and end it.\n */\nexport class LiveActivity<T extends object = object> {\n /** @hidden */\n private nativeLiveActivity: NativeLiveActivity;\n constructor(nativeLiveActivity: NativeLiveActivity) {\n this.nativeLiveActivity = nativeLiveActivity;\n }\n\n /**\n * Updates the Live Activity's content. The UI reflects the new properties immediately.\n * @param props The updated content properties.\n */\n update(props: T): Promise<void> {\n return this.nativeLiveActivity.update(JSON.stringify(props));\n }\n\n /**\n * Ends the Live Activity.\n * @param dismissalPolicy Controls when the Live Activity is removed from the Lock Screen after ending.\n * Can be `'default'`, `'immediate'`, or `after(date)`.\n * @param props Final content properties to update after the activity ends.\n * @param contentDate The time the data in the payload was generated. If this is older than a previous update or push payload, the system ignores this update.\n */\n end(dismissalPolicy?: LiveActivityDismissalPolicy, props?: T, contentDate?: Date): Promise<void> {\n const serializedProps = props ? JSON.stringify(props) : undefined;\n if (\n typeof dismissalPolicy === 'object' &&\n dismissalPolicy !== null &&\n 'after' in dismissalPolicy\n ) {\n return this.nativeLiveActivity.end(\n 'after',\n dismissalPolicy.after?.getTime(),\n serializedProps,\n contentDate?.getTime()\n );\n }\n return this.nativeLiveActivity.end(\n dismissalPolicy,\n undefined,\n serializedProps,\n contentDate?.getTime()\n );\n }\n\n /**\n * Returns the push token for this Live Activity, used to send push notification updates via APNs.\n * Returns `null` if push notifications are not enabled or the token is not yet available.\n */\n getPushToken(): Promise<string | null> {\n return this.nativeLiveActivity.getPushToken();\n }\n\n /**\n * Adds a listener for push token update events on this Live Activity instance.\n * The token can be used to send content updates to this specific activity via APNs.\n * @param listener Callback invoked when a new push token is available.\n * @returns An event subscription that can be used to remove the listener.\n */\n addPushTokenListener(listener: (event: PushTokenEvent) => void): EventSubscription {\n return this.nativeLiveActivity.addListener('onExpoWidgetsTokenReceived', listener);\n }\n}\n\n/**\n * Manages Live Activity instances of a specific type. Use it to start new activities and retrieve currently active ones.\n */\nexport class LiveActivityFactory<T extends object = object> {\n /** @hidden */\n private nativeLiveActivityFactory: NativeLiveActivityFactory;\n constructor(name: string, layout: LiveActivityComponent<T>) {\n this.nativeLiveActivityFactory = new ExpoWidgetsModule.LiveActivityFactory(\n name,\n layout as unknown as string\n );\n }\n\n /**\n * Starts a new Live Activity with the given properties.\n * @param props The initial content properties for the Live Activity.\n * @param url An optional URL to associate with the Live Activity, used for deep linking.\n * @returns The new Live Activity instance.\n */\n start(props: T, url?: string) {\n return new LiveActivity<T>(this.nativeLiveActivityFactory.start(JSON.stringify(props), url));\n }\n\n /**\n * Returns all currently active instances of this Live Activity type.\n */\n getInstances() {\n return this.nativeLiveActivityFactory\n .getInstances()\n .map((instance) => new LiveActivity<T>(instance));\n }\n}\n\n/**\n * Creates a dismissal policy that removes the Live Activity at the specified time within a four-hour window.\n * @param date The date after which the Live Activity should be removed from the Lock Screen.\n * @hidden\n */\nexport function after(date: Date): { after: Date } {\n return { after: date };\n}\n\n/**\n * Creates a Widget instance.\n * @param name The widget name. Must match the `'name'` field in your widget configuration in the app config.\n * @param widget The widget component, marked with the `'widget'` directive.\n */\nexport function createWidget<\n PropsType extends object = object,\n ConfigurationType extends object | undefined = undefined,\n>(\n name: string,\n widget: (props: PropsType, context: WidgetEnvironment<ConfigurationType>) => React.JSX.Element\n): Widget<PropsType, ConfigurationType> {\n return new Widget<PropsType, ConfigurationType>(name, widget);\n}\n\n/**\n * Creates a Live Activity Factory for managing Live Activities of a specific type.\n * @param name The Live Activity name. Must match the `'name'` field in your widget configuration in the app config.\n * @param liveActivity The Live Activity component, marked with the `'widget'` directive.\n */\nexport function createLiveActivity<T extends object = object>(\n name: string,\n liveActivity: LiveActivityComponent<T>\n): LiveActivityFactory<T> {\n return new LiveActivityFactory<T>(name, liveActivity);\n}\n\n/**\n * Adds a listener for widget interaction events (for example, button taps).\n * @param listener Callback function to handle user interaction events.\n * @return An event subscription that can be used to remove the listener.\n */\nexport function addUserInteractionListener(\n listener: ExpoWidgetsEvents['onExpoWidgetsUserInteraction']\n): EventSubscription {\n return ExpoWidgetsModule.addListener('onExpoWidgetsUserInteraction', listener);\n}\n\n/**\n * Adds a listener for push-to-start token events.\n * This token can be used to start live activities remotely via APNs.\n * @param listener Callback function to handle push-to-start token events.\n * @return An event subscription that can be used to remove the listener.\n */\nexport function addPushToStartTokenListener(\n listener: ExpoWidgetsEvents['onExpoWidgetsPushToStartTokenReceived']\n): EventSubscription {\n return ExpoWidgetsModule.addListener('onExpoWidgetsPushToStartTokenReceived', listener);\n}\n\n/**\n * A directory that can be used to store shared images for widgets.\n * The contents of this directory are accessible by both the main app and widgets.\n */\nexport const widgetsDirectory = ExpoWidgetsModule.widgetsDirectory;\n"]}
|
package/ios/WidgetsModule.swift
CHANGED
|
@@ -45,6 +45,20 @@ public final class WidgetsModule: Module {
|
|
|
45
45
|
pushToStartTokenObserverTask = nil
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
Constant("widgetsDirectory") { () -> String? in
|
|
49
|
+
guard let appGroupIdentifier = WidgetsStorage.appGroupIdentifier,
|
|
50
|
+
let containerUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier) else {
|
|
51
|
+
return nil
|
|
52
|
+
}
|
|
53
|
+
let directoryUrl = containerUrl.appendingPathComponent("ExpoWidgets", isDirectory: true)
|
|
54
|
+
do {
|
|
55
|
+
try FileManager.default.createDirectory(at: directoryUrl, withIntermediateDirectories: true)
|
|
56
|
+
return directoryUrl.absoluteString
|
|
57
|
+
} catch {
|
|
58
|
+
return nil
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
48
62
|
Function("reloadAllWidgets") {
|
|
49
63
|
WidgetCenter.shared.reloadAllTimelines()
|
|
50
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-widgets",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.18",
|
|
4
4
|
"description": "Widgets.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"homepage": "https://docs.expo.dev/versions/latest/sdk/widgets/",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@expo/plist": "^0.7.0",
|
|
25
|
-
"@expo/ui": "~56.0.
|
|
25
|
+
"@expo/ui": "~56.0.17"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@expo/spawn-async": "^1.8.0",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@types/react": "~19.2.0",
|
|
31
31
|
"react-native": "0.85.3",
|
|
32
32
|
"resolve-workspace-root": "^2.0.0",
|
|
33
|
-
"expo": "56.0.
|
|
34
|
-
"expo-module-scripts": "56.0.
|
|
33
|
+
"expo": "56.0.10",
|
|
34
|
+
"expo-module-scripts": "56.0.3"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"expo": "*",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"./scripts/xcode-build-bundle.sh"
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "b1e94a5c1c5b19472a42ca25752a3533699bc46a",
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "expo-module build",
|
|
50
50
|
"build:plugin": "expo-module build plugin",
|
|
@@ -50,7 +50,7 @@ const withAndroidWidgetFiles = (config, widgets) => {
|
|
|
50
50
|
const packageDirectory = path.join(projectRoot, 'app/src/main/java', ...androidPackage.split('.'));
|
|
51
51
|
const xmlDirectory = path.join(projectRoot, 'app/src/main/res/xml');
|
|
52
52
|
const valuesDirectory = path.join(projectRoot, 'app/src/main/res/values');
|
|
53
|
-
const widgetsXmlPath = path.join(
|
|
53
|
+
const widgetsXmlPath = path.join(valuesDirectory, 'expo_widgets.xml');
|
|
54
54
|
fs.mkdirSync(packageDirectory, { recursive: true });
|
|
55
55
|
fs.mkdirSync(xmlDirectory, { recursive: true });
|
|
56
56
|
fs.mkdirSync(valuesDirectory, { recursive: true });
|
|
@@ -5,6 +5,11 @@ export type ExpoWidgetsConfigPluginProps = {
|
|
|
5
5
|
groupIdentifier?: string;
|
|
6
6
|
enablePushNotifications?: boolean;
|
|
7
7
|
frequentUpdates?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Enable the Android config plugin. Defaults to false.
|
|
10
|
+
* This option will be removed and Android widget will be enabled by default in the future.
|
|
11
|
+
*/
|
|
12
|
+
enableAndroid?: boolean;
|
|
8
13
|
widgets?: WidgetConfig[];
|
|
9
14
|
};
|
|
10
15
|
declare const _default: ConfigPlugin<ExpoWidgetsConfigPluginProps | undefined>;
|
|
@@ -8,10 +8,9 @@ const withAndroidWidgets_1 = __importDefault(require("./android/withAndroidWidge
|
|
|
8
8
|
const withIosWidgets_1 = __importDefault(require("./ios/withIosWidgets"));
|
|
9
9
|
const pkg = require('../../package.json');
|
|
10
10
|
const withWidgets = (config, props) => {
|
|
11
|
+
const enableAndroid = props?.enableAndroid ?? false;
|
|
11
12
|
const widgets = props?.widgets ?? [];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[withIosWidgets_1.default, { ...(props ?? {}), widgets }],
|
|
15
|
-
]);
|
|
13
|
+
const nextConfig = enableAndroid ? (0, withAndroidWidgets_1.default)(config, { widgets }) : config;
|
|
14
|
+
return (0, withIosWidgets_1.default)(nextConfig, { ...props, widgets });
|
|
16
15
|
};
|
|
17
16
|
exports.default = (0, config_plugins_1.createRunOncePlugin)(withWidgets, pkg.name, pkg.version);
|
|
@@ -32,7 +32,7 @@ const withAndroidWidgetFiles: ConfigPlugin<WidgetConfig[]> = (config, widgets) =
|
|
|
32
32
|
);
|
|
33
33
|
const xmlDirectory = path.join(projectRoot, 'app/src/main/res/xml');
|
|
34
34
|
const valuesDirectory = path.join(projectRoot, 'app/src/main/res/values');
|
|
35
|
-
const widgetsXmlPath = path.join(
|
|
35
|
+
const widgetsXmlPath = path.join(valuesDirectory, 'expo_widgets.xml');
|
|
36
36
|
|
|
37
37
|
fs.mkdirSync(packageDirectory, { recursive: true });
|
|
38
38
|
fs.mkdirSync(xmlDirectory, { recursive: true });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigPlugin, createRunOncePlugin
|
|
1
|
+
import { ConfigPlugin, createRunOncePlugin } from 'expo/config-plugins';
|
|
2
2
|
|
|
3
3
|
import withAndroidWidgets from './android/withAndroidWidgets';
|
|
4
4
|
import withIosWidgets from './ios/withIosWidgets';
|
|
@@ -15,16 +15,20 @@ export type ExpoWidgetsConfigPluginProps = {
|
|
|
15
15
|
enablePushNotifications?: boolean;
|
|
16
16
|
// Enable frequent updates for widgets. Defaults to false.
|
|
17
17
|
frequentUpdates?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Enable the Android config plugin. Defaults to false.
|
|
20
|
+
* This option will be removed and Android widget will be enabled by default in the future.
|
|
21
|
+
*/
|
|
22
|
+
enableAndroid?: boolean;
|
|
18
23
|
widgets?: WidgetConfig[];
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
const withWidgets: ConfigPlugin<ExpoWidgetsConfigPluginProps | undefined> = (config, props) => {
|
|
27
|
+
const enableAndroid = props?.enableAndroid ?? false;
|
|
22
28
|
const widgets = props?.widgets ?? [];
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[withIosWidgets, { ...(props ?? {}), widgets }],
|
|
27
|
-
]);
|
|
30
|
+
const nextConfig = enableAndroid ? withAndroidWidgets(config, { widgets }) : config;
|
|
31
|
+
return withIosWidgets(nextConfig, { ...props, widgets });
|
|
28
32
|
};
|
|
29
33
|
|
|
30
34
|
export default createRunOncePlugin(withWidgets, pkg.name, pkg.version);
|
package/src/ExpoWidgets.ios.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
} from './Widgets.types';
|
|
9
9
|
|
|
10
10
|
declare class ExpoWidgetsModule extends NativeModule<ExpoWidgetsEvents> {
|
|
11
|
+
widgetsDirectory: string;
|
|
11
12
|
reloadAllWidgets(): void;
|
|
12
13
|
readonly Widget: typeof NativeWidgetObject;
|
|
13
14
|
readonly LiveActivityFactory: typeof NativeLiveActivityFactory;
|
package/src/ExpoWidgets.ts
CHANGED
|
@@ -48,6 +48,7 @@ class LiveActivityFactoryStub {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const ExpoWidgetsModule = {
|
|
51
|
+
widgetsDirectory: '',
|
|
51
52
|
reloadAllWidgets(): void {},
|
|
52
53
|
Widget: WidgetStub as typeof NativeWidgetObject,
|
|
53
54
|
LiveActivityFactory: LiveActivityFactoryStub as typeof NativeLiveActivityFactory,
|
package/src/Widgets.ts
CHANGED
|
@@ -225,3 +225,9 @@ export function addPushToStartTokenListener(
|
|
|
225
225
|
): EventSubscription {
|
|
226
226
|
return ExpoWidgetsModule.addListener('onExpoWidgetsPushToStartTokenReceived', listener);
|
|
227
227
|
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* A directory that can be used to store shared images for widgets.
|
|
231
|
+
* The contents of this directory are accessible by both the main app and widgets.
|
|
232
|
+
*/
|
|
233
|
+
export const widgetsDirectory = ExpoWidgetsModule.widgetsDirectory;
|