expo-background-task 0.2.4 → 0.2.6
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 +10 -0
- package/android/build.gradle +2 -2
- package/build/BackgroundTask.d.ts.map +1 -1
- package/build/BackgroundTask.js +5 -5
- package/build/BackgroundTask.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/{0.2.4/expo.modules.backgroundtask-0.2.4.module → 0.2.6/expo.modules.backgroundtask-0.2.6.module} +17 -17
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/{0.2.4/expo.modules.backgroundtask-0.2.4.pom → 0.2.6/expo.modules.backgroundtask-0.2.6.pom} +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.6/expo.modules.backgroundtask-0.2.6.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.sha512 +1 -1
- package/package.json +4 -4
- package/src/BackgroundTask.ts +6 -6
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/0.2.4/expo.modules.backgroundtask-0.2.4.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/{0.2.4/expo.modules.backgroundtask-0.2.4-sources.jar → 0.2.6/expo.modules.backgroundtask-0.2.6-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/{0.2.4/expo.modules.backgroundtask-0.2.4-sources.jar.md5 → 0.2.6/expo.modules.backgroundtask-0.2.6-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/{0.2.4/expo.modules.backgroundtask-0.2.4-sources.jar.sha1 → 0.2.6/expo.modules.backgroundtask-0.2.6-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/{0.2.4/expo.modules.backgroundtask-0.2.4-sources.jar.sha256 → 0.2.6/expo.modules.backgroundtask-0.2.6-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/{0.2.4/expo.modules.backgroundtask-0.2.4-sources.jar.sha512 → 0.2.6/expo.modules.backgroundtask-0.2.6-sources.jar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.2.6 — 2025-04-30
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 0.2.5 — 2025-04-25
|
|
18
|
+
|
|
19
|
+
### 💡 Others
|
|
20
|
+
|
|
21
|
+
- Removed throwing an exception if registerTaskAsync/unregisterTaskAsync is called on a task that is already registered/unregistered ([#36393](https://github.com/expo/expo/pull/36393) by [@chrfalch](https://github.com/chrfalch))
|
|
22
|
+
|
|
13
23
|
## 0.2.4 — 2025-04-14
|
|
14
24
|
|
|
15
25
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -4,7 +4,7 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '0.2.
|
|
7
|
+
version = '0.2.6'
|
|
8
8
|
|
|
9
9
|
dependencies {
|
|
10
10
|
implementation 'androidx.work:work-runtime-ktx:2.9.1'
|
|
@@ -15,7 +15,7 @@ android {
|
|
|
15
15
|
namespace "expo.modules.backgroundtask"
|
|
16
16
|
defaultConfig {
|
|
17
17
|
versionCode 23
|
|
18
|
-
versionName "0.2.
|
|
18
|
+
versionName "0.2.6"
|
|
19
19
|
consumerProguardFiles("proguard-rules.pro")
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundTask.d.ts","sourceRoot":"","sources":["../src/BackgroundTask.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAwBrF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,oBAAoB,CAQnE,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"BackgroundTask.d.ts","sourceRoot":"","sources":["../src/BackgroundTask.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAwBrF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,oBAAoB,CAQnE,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAGD;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASzE;AAGD;;;;;GAKG;AAcH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC"}
|
package/build/BackgroundTask.js
CHANGED
|
@@ -70,9 +70,6 @@ export async function registerTaskAsync(taskName, options = {}) {
|
|
|
70
70
|
if (!TaskManager.isTaskDefined(taskName)) {
|
|
71
71
|
throw new Error(`Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`);
|
|
72
72
|
}
|
|
73
|
-
if (await TaskManager.isTaskRegisteredAsync(taskName)) {
|
|
74
|
-
throw new Error(`Task '${taskName}' is already registered.`);
|
|
75
|
-
}
|
|
76
73
|
if ((await ExpoBackgroundTaskModule.getStatusAsync()) === BackgroundTaskStatus.Restricted) {
|
|
77
74
|
if (!warnAboutRunningOniOSSimulator) {
|
|
78
75
|
const message = Platform.OS === 'ios'
|
|
@@ -84,6 +81,9 @@ export async function registerTaskAsync(taskName, options = {}) {
|
|
|
84
81
|
return;
|
|
85
82
|
}
|
|
86
83
|
_validate(taskName);
|
|
84
|
+
if (await TaskManager.isTaskRegisteredAsync(taskName)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
87
|
await ExpoBackgroundTaskModule.registerTaskAsync(taskName, options);
|
|
88
88
|
}
|
|
89
89
|
// @needsAudit
|
|
@@ -96,10 +96,10 @@ export async function unregisterTaskAsync(taskName) {
|
|
|
96
96
|
if (!ExpoBackgroundTaskModule.unregisterTaskAsync) {
|
|
97
97
|
throw new UnavailabilityError('BackgroundTask', 'unregisterTaskAsync');
|
|
98
98
|
}
|
|
99
|
+
_validate(taskName);
|
|
99
100
|
if (!(await TaskManager.isTaskRegisteredAsync(taskName))) {
|
|
100
|
-
|
|
101
|
+
return;
|
|
101
102
|
}
|
|
102
|
-
_validate(taskName);
|
|
103
103
|
await ExpoBackgroundTaskModule.unregisterTaskAsync(taskName);
|
|
104
104
|
}
|
|
105
105
|
// @needsAudit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundTask.js","sourceRoot":"","sources":["../src/BackgroundTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAyB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,gDAAgD;AAChD,IAAI,8BAA8B,GAAG,KAAK,CAAC;AAE3C,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAE9B,SAAS,SAAS,CAAC,QAAiB;IAClC,IAAI,iBAAiB,EAAE,EAAE,CAAC;QACxB,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,MAAM,OAAO,GACX,gEAAgE;gBAChE,+FAA+F,CAAC;YAClG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,iBAAiB,GA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qC;AACrC,MAAM;AACN,IAAI;AAEJ,eAAe;AACf,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,wBAAwB,CAAC","sourcesContent":["import { isRunningInExpoGo } from 'expo';\nimport { Platform, UnavailabilityError } from 'expo-modules-core';\nimport * as TaskManager from 'expo-task-manager';\n\nimport { BackgroundTaskOptions, BackgroundTaskStatus } from './BackgroundTask.types';\nimport ExpoBackgroundTaskModule from './ExpoBackgroundTaskModule';\n\n// Flag to warn about running on Apple simulator\nlet warnAboutRunningOniOSSimulator = false;\n\nlet warnedAboutExpoGo = false;\n\nfunction _validate(taskName: unknown) {\n if (isRunningInExpoGo()) {\n if (!warnedAboutExpoGo) {\n const message =\n '`Background Task` functionality is not available in Expo Go:\\n' +\n 'Please use a development build to avoid limitations. Learn more: https://expo.fyi/dev-client.';\n console.warn(message);\n warnedAboutExpoGo = true;\n }\n }\n if (!taskName || typeof taskName !== 'string') {\n throw new TypeError('`taskName` must be a non-empty string.');\n }\n}\n\n// @needsAudit\n/**\n * Returns the status for the Background Task API. On web, it always returns `BackgroundTaskStatus.Restricted`,\n * while on native platforms it returns `BackgroundTaskStatus.Available`.\n *\n * @returns A BackgroundTaskStatus enum value or `null` if not available.\n */\nexport const getStatusAsync = async (): Promise<BackgroundTaskStatus> => {\n if (!ExpoBackgroundTaskModule.getStatusAsync) {\n throw new UnavailabilityError('BackgroundTask', 'getStatusAsync');\n }\n\n return isRunningInExpoGo()\n ? BackgroundTaskStatus.Restricted\n : ExpoBackgroundTaskModule.getStatusAsync();\n};\n\n// @needsAudit\n/**\n * Registers a background task with the given name. Registered tasks are saved in persistent storage and restored once the app is initialized.\n * @param taskName Name of the task to register. The task needs to be defined first - see [`TaskManager.defineTask`](task-manager/#taskmanagerdefinetasktaskname-taskexecutor)\n * for more details.\n * @param options An object containing the background task options.\n *\n * @example\n * ```ts\n * import * as TaskManager from 'expo-task-manager';\n *\n * // Register the task outside of the component\n * TaskManager.defineTask(BACKGROUND_TASK_IDENTIFIER, () => {\n * try {\n * await AsyncStorage.setItem(LAST_TASK_DATE_KEY, Date.now().toString());\n * } catch (error) {\n * console.error('Failed to save the last fetch date', error);\n * return BackgroundTaskResult.Failed;\n * }\n * return BackgroundTaskResult.Success;\n * });\n * ```\n *\n * You can now use the `registerTaskAsync` function to register the task:\n *\n * ```ts\n * BackgroundTask.registerTaskAsync(BACKGROUND_TASK_IDENTIFIER, {});\n * ```\n */\nexport async function registerTaskAsync(\n taskName: string,\n options: BackgroundTaskOptions = {}\n): Promise<void> {\n if (!ExpoBackgroundTaskModule.registerTaskAsync) {\n throw new UnavailabilityError('BackgroundTask', 'registerTaskAsync');\n }\n if (!TaskManager.isTaskDefined(taskName)) {\n throw new Error(\n `Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`\n );\n }\n\n if ((await ExpoBackgroundTaskModule.getStatusAsync()) === BackgroundTaskStatus.Restricted) {\n if (!warnAboutRunningOniOSSimulator) {\n const message =\n Platform.OS === 'ios'\n ? `Background tasks are not supported on iOS simulators. Skipped registering task: ${taskName}.`\n : `Background tasks are not available in the current environment. Skipped registering task: ${taskName}.`;\n console.warn(message);\n warnAboutRunningOniOSSimulator = true;\n }\n return;\n }\n _validate(taskName);\n if (await TaskManager.isTaskRegisteredAsync(taskName)) {\n return;\n }\n await ExpoBackgroundTaskModule.registerTaskAsync(taskName, options);\n}\n\n// @needsAudit\n/**\n * Unregisters a background task, so the application will no longer be executing this task.\n * @param taskName Name of the task to unregister.\n * @return A promise which fulfils when the task is fully unregistered.\n */\nexport async function unregisterTaskAsync(taskName: string): Promise<void> {\n if (!ExpoBackgroundTaskModule.unregisterTaskAsync) {\n throw new UnavailabilityError('BackgroundTask', 'unregisterTaskAsync');\n }\n _validate(taskName);\n if (!(await TaskManager.isTaskRegisteredAsync(taskName))) {\n return;\n }\n await ExpoBackgroundTaskModule.unregisterTaskAsync(taskName);\n}\n\n// @needsAudit\n/**\n * When in debug mode this function will trigger running the background tasks.\n * This function will only work for apps built in debug mode.\n * @todo(chrfalch): When we have a usable devtools plugin we can enable this function.\n * @returns A promise which fulfils when the task is triggered.\n */\n// export async function triggerTaskWorkerForTestingAsync(): Promise<boolean> {\n// if (__DEV__) {\n// if (!ExpoBackgroundTaskModule.triggerTaskWorkerForTestingAsync) {\n// throw new UnavailabilityError('BackgroundTask', 'triggerTaskWorkerForTestingAsync');\n// }\n// console.log('Calling triggerTaskWorkerForTestingAsync');\n// return await ExpoBackgroundTaskModule.triggerTaskWorkerForTestingAsync();\n// } else {\n// return Promise.resolve(false);\n// }\n// }\n\n// Export types\nexport {\n BackgroundTaskStatus,\n BackgroundTaskResult,\n BackgroundTaskOptions,\n} from './BackgroundTask.types';\n"]}
|
package/expo-module.config.json
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e0acabbb1e698252139204a38916e1de
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d4e79935b62afcaf84d57b95f256df6a41586bfa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cbc6bb1d4a80dac949caf56fea16e50d38c9a5a4a690a2f6a5bf04cd929fbd73
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
176311633c2d7c17756447ddc521a4d6dd6ee13adb6862150517290b87b7ed89048e5d0d73b64309ea4240bb1edb2d79b4d35b61069b2eb6853689a4c185d6fd
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.backgroundtask",
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.6",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.backgroundtask-0.2.
|
|
28
|
-
"url": "expo.modules.backgroundtask-0.2.
|
|
29
|
-
"size":
|
|
30
|
-
"sha512": "
|
|
31
|
-
"sha256": "
|
|
32
|
-
"sha1": "
|
|
33
|
-
"md5": "
|
|
27
|
+
"name": "expo.modules.backgroundtask-0.2.6.aar",
|
|
28
|
+
"url": "expo.modules.backgroundtask-0.2.6.aar",
|
|
29
|
+
"size": 47827,
|
|
30
|
+
"sha512": "176311633c2d7c17756447ddc521a4d6dd6ee13adb6862150517290b87b7ed89048e5d0d73b64309ea4240bb1edb2d79b4d35b61069b2eb6853689a4c185d6fd",
|
|
31
|
+
"sha256": "cbc6bb1d4a80dac949caf56fea16e50d38c9a5a4a690a2f6a5bf04cd929fbd73",
|
|
32
|
+
"sha1": "d4e79935b62afcaf84d57b95f256df6a41586bfa",
|
|
33
|
+
"md5": "e0acabbb1e698252139204a38916e1de"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
},
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
],
|
|
65
65
|
"files": [
|
|
66
66
|
{
|
|
67
|
-
"name": "expo.modules.backgroundtask-0.2.
|
|
68
|
-
"url": "expo.modules.backgroundtask-0.2.
|
|
69
|
-
"size":
|
|
70
|
-
"sha512": "
|
|
71
|
-
"sha256": "
|
|
72
|
-
"sha1": "
|
|
73
|
-
"md5": "
|
|
67
|
+
"name": "expo.modules.backgroundtask-0.2.6.aar",
|
|
68
|
+
"url": "expo.modules.backgroundtask-0.2.6.aar",
|
|
69
|
+
"size": 47827,
|
|
70
|
+
"sha512": "176311633c2d7c17756447ddc521a4d6dd6ee13adb6862150517290b87b7ed89048e5d0d73b64309ea4240bb1edb2d79b4d35b61069b2eb6853689a4c185d6fd",
|
|
71
|
+
"sha256": "cbc6bb1d4a80dac949caf56fea16e50d38c9a5a4a690a2f6a5bf04cd929fbd73",
|
|
72
|
+
"sha1": "d4e79935b62afcaf84d57b95f256df6a41586bfa",
|
|
73
|
+
"md5": "e0acabbb1e698252139204a38916e1de"
|
|
74
74
|
}
|
|
75
75
|
]
|
|
76
76
|
},
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
},
|
|
85
85
|
"files": [
|
|
86
86
|
{
|
|
87
|
-
"name": "expo.modules.backgroundtask-0.2.
|
|
88
|
-
"url": "expo.modules.backgroundtask-0.2.
|
|
87
|
+
"name": "expo.modules.backgroundtask-0.2.6-sources.jar",
|
|
88
|
+
"url": "expo.modules.backgroundtask-0.2.6-sources.jar",
|
|
89
89
|
"size": 6743,
|
|
90
90
|
"sha512": "558f8112433c958b3ce00edac1b1e08835137759aca7f9344968661df70dccbaffb9a193a2a8f186b193edb6e59d0e94021a69455a5f04f6b5495a155ba7560f",
|
|
91
91
|
"sha256": "4019bc874cc09d9187352e03c4f54941c7abd91e4a3d8b41c2aaf351dd7ba28e",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
193cad2bf21c0848ad2f20311280ed57
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1dcffaa1767bf3591015c727e246069c506145ec
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1070ab1cece5ccfa65521802fb44a46353002ffa8335c2ce1ddb5e288d37cc73
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
88f4a2939e19813f4703963fddbe4e2428cd446c343b9c83f50f5564117d0b244b30a713885757a3fc057e7256da927e96de75c5ec957483fa26a3e384a7060a
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.backgroundtask</artifactId>
|
|
12
|
-
<version>0.2.
|
|
12
|
+
<version>0.2.6</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.backgroundtask</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b01b44a40e7d3489fe12ff2e389357ab
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
042f11cc6f50153ade08f17b85939fab1bcbfc69
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e6c998b29f76c61123792526727f3a28e870476ca1ed14cc2837a380d38dcf19
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
34d80cb85240d24e0773d0e96155065849f218b39740647103c10295033aeec90ceb0c9f86cc0d180d34e24dfbe59b975741d1b15bcdb40cc22c9c8f7283cd8e
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.backgroundtask</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>0.2.
|
|
7
|
-
<release>0.2.
|
|
6
|
+
<latest>0.2.6</latest>
|
|
7
|
+
<release>0.2.6</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>0.2.
|
|
9
|
+
<version>0.2.6</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250430211459</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.md5
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d124045fdb9bab038e1583b22f18de1f
|
package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.sha1
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4c460dd9b460b2f0772988a706830108a6aa56a1
|
package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1e386862747f3520f4ba51a9bab938dfbdb638d041f1a48c15cf05f4f81ce540
|
package/local-maven-repo/host/exp/exponent/expo.modules.backgroundtask/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
80e5727a10efbe6c2789d0e67de8b1584bc8ce9211638f76082d9b36f80079e176e44784ca79eb0fe525d19fc50f1d67a4d9ab2ea24841844f687094476475e5
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-background-task",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Expo Android and iOS module for Background Task APIs",
|
|
5
5
|
"main": "build/BackgroundTask.js",
|
|
6
6
|
"types": "build/BackgroundTask.d.ts",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"homepage": "https://docs.expo.dev/versions/latest/sdk/background-task/",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"expo-task-manager": "~13.1.
|
|
35
|
+
"expo-task-manager": "~13.1.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"expo-module-scripts": "^4.1.
|
|
38
|
+
"expo-module-scripts": "^4.1.6"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"expo": "*"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "84355076bc31a356aa3d23257f387f221885f53d"
|
|
44
44
|
}
|
package/src/BackgroundTask.ts
CHANGED
|
@@ -83,9 +83,7 @@ export async function registerTaskAsync(
|
|
|
83
83
|
`Task '${taskName}' is not defined. You must define a task using TaskManager.defineTask before registering.`
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
throw new Error(`Task '${taskName}' is already registered.`);
|
|
88
|
-
}
|
|
86
|
+
|
|
89
87
|
if ((await ExpoBackgroundTaskModule.getStatusAsync()) === BackgroundTaskStatus.Restricted) {
|
|
90
88
|
if (!warnAboutRunningOniOSSimulator) {
|
|
91
89
|
const message =
|
|
@@ -98,6 +96,9 @@ export async function registerTaskAsync(
|
|
|
98
96
|
return;
|
|
99
97
|
}
|
|
100
98
|
_validate(taskName);
|
|
99
|
+
if (await TaskManager.isTaskRegisteredAsync(taskName)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
101
102
|
await ExpoBackgroundTaskModule.registerTaskAsync(taskName, options);
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -111,11 +112,10 @@ export async function unregisterTaskAsync(taskName: string): Promise<void> {
|
|
|
111
112
|
if (!ExpoBackgroundTaskModule.unregisterTaskAsync) {
|
|
112
113
|
throw new UnavailabilityError('BackgroundTask', 'unregisterTaskAsync');
|
|
113
114
|
}
|
|
115
|
+
_validate(taskName);
|
|
114
116
|
if (!(await TaskManager.isTaskRegisteredAsync(taskName))) {
|
|
115
|
-
|
|
117
|
+
return;
|
|
116
118
|
}
|
|
117
|
-
|
|
118
|
-
_validate(taskName);
|
|
119
119
|
await ExpoBackgroundTaskModule.unregisterTaskAsync(taskName);
|
|
120
120
|
}
|
|
121
121
|
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f5d314c1b9764e51a897f9ce429090d7
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4b3529965f7a73a32b4624997c0161d52fbb8e6d
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
812c871ecce58021366e8bffc1b201cff6c121bdeeba5b53711f8c11635724fe
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
df365cff219528667a5ad1a044439dd3d46be3018c473bff6907568fb2ff5f484fa43b988c9dc4283b0edfc7035f1207f4d715d0483d12b30e37170aa94b6e8a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f20d358cb717a8720519fa607fd9bace
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9b4e4541aa148fa4e4190028ff4ed739e1501b2a
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3336622265f7251719c91c2a89bb22d358b94ce92642c9e4141beab1f832a1d3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7a0ba9debc9fe387c9342daebf841530dd3a75967b1ff969a6c7aa92abf63a8f2fd151ffeb1c3531df494386675c1b072b04715502da21d72c541d2ff1e95f1b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8573b7ae6e45fb56f7e12c5da1aacb98
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dddfd08b254a49abf771740e27205849ab37baad
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f9367c7fa56e5bb1017a2f26b5971baac7d3cccca63a2f64dbcdd9241900bbc8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d26f9eea02c07404cdbf4d8fa4cde84c0afb686026ca0c7332f593234d5c54d6746cfb39466426eb6ae338320c2bfbaed9981eb34438d0ce77d33f453fa98df5
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|