expo-live-activity 0.2.0-alpha5 → 0.2.1-alpha1
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 +7 -3
- package/ios-files/Color+hex.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ The `config` object should include:
|
|
|
114
114
|
## Example Usage
|
|
115
115
|
Managing a live activity:
|
|
116
116
|
```javascript
|
|
117
|
-
const state = {
|
|
117
|
+
const state: LiveActivity.LiveActivityState = {
|
|
118
118
|
title: "Title",
|
|
119
119
|
subtitle: "This is a subtitle",
|
|
120
120
|
date: new Date(Date.now() + 60 * 1000 * 5).getTime(),
|
|
@@ -122,7 +122,7 @@ const state = {
|
|
|
122
122
|
dynamicIslandImageName: "dynamic_island_image"
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
const config = {
|
|
125
|
+
const config: LiveActivity.LiveActivityConfig = {
|
|
126
126
|
backgroundColor: "#FFFFFF",
|
|
127
127
|
titleColor: "#000000",
|
|
128
128
|
subtitleColor: "#333333",
|
|
@@ -147,9 +147,13 @@ useEffect(() => {
|
|
|
147
147
|
// Send token to a remote server to update live activity with push notifications
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
return () => subscription
|
|
150
|
+
return () => subscription?.remove();
|
|
151
151
|
}, []);
|
|
152
152
|
```
|
|
153
|
+
|
|
154
|
+
> [!NOTE]
|
|
155
|
+
> Receiving push token may not work on simulators. Make sure to use physical device when testing this functionality.
|
|
156
|
+
|
|
153
157
|
## Push notifications
|
|
154
158
|
By default, updating live activity is possible only via API. If you want to have possibility to update live activity using push notifications, you can enable that feature by adding `"enablePushNotifications": true` in the plugin config in your `app.json` or `app.config.ts` file. Then, the notification payload should look like this:
|
|
155
159
|
|
|
@@ -22,7 +22,7 @@ extension Color {
|
|
|
22
22
|
red: Double((rgbValue >> 24) & 0xff) / 255,
|
|
23
23
|
green: Double((rgbValue >> 16) & 0xff) / 255,
|
|
24
24
|
blue: Double((rgbValue >> 08) & 0xff) / 255,
|
|
25
|
-
opacity: Double((rgbValue >> 00) & 0xff) / 255
|
|
25
|
+
opacity: Double((rgbValue >> 00) & 0xff) / 255
|
|
26
26
|
)
|
|
27
27
|
} else {
|
|
28
28
|
self.init(
|