expo-task-manager 11.5.0 → 11.7.0
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 +48 -30
- package/android/src/main/java/expo/modules/taskManager/TaskManagerModule.kt +74 -0
- package/android/src/main/java/expo/modules/taskManager/TaskManagerPackage.java +0 -6
- package/build/ExpoTaskManager.d.ts +1 -1
- package/build/ExpoTaskManager.d.ts.map +1 -1
- package/build/ExpoTaskManager.js +2 -2
- package/build/ExpoTaskManager.js.map +1 -1
- package/expo-module.config.json +7 -0
- package/ios/EXTaskManager.podspec +1 -1
- package/package.json +3 -3
- package/src/ExpoTaskManager.ts +2 -2
- package/android/src/main/java/expo/modules/taskManager/TaskManagerModule.java +0 -145
- package/unimodule.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,24 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 11.7.0 — 2023-11-14
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
18
|
+
- On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
|
|
19
|
+
|
|
20
|
+
## 11.6.0 — 2023-10-17
|
|
21
|
+
|
|
22
|
+
### 🛠 Breaking changes
|
|
23
|
+
|
|
24
|
+
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
|
|
25
|
+
|
|
26
|
+
### 💡 Others
|
|
27
|
+
|
|
28
|
+
- Transpile for Node 18 (LTS). ([#24471](https://github.com/expo/expo/pull/24471) by [@EvanBacon](https://github.com/EvanBacon))
|
|
29
|
+
- Migrated codebase to use Expo Modules API. ([#24157](https://github.com/expo/expo/pull/24157) by [@lukmccall](https://github.com/lukmccall))
|
|
30
|
+
|
|
13
31
|
## 11.5.0 — 2023-09-04
|
|
14
32
|
|
|
15
33
|
### 🎉 New features
|
package/android/build.gradle
CHANGED
|
@@ -3,15 +3,20 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '11.
|
|
6
|
+
version = '11.7.0'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
9
|
+
if (expoModulesCorePlugin.exists()) {
|
|
10
|
+
apply from: expoModulesCorePlugin
|
|
11
|
+
applyKotlinExpoModulesCorePlugin()
|
|
12
|
+
// Remove this check, but keep the contents after SDK49 support is dropped
|
|
13
|
+
if (safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
14
|
+
useExpoPublishing()
|
|
15
|
+
useCoreDependencies()
|
|
13
16
|
}
|
|
17
|
+
}
|
|
14
18
|
|
|
19
|
+
buildscript {
|
|
15
20
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
16
21
|
ext.safeExtGet = { prop, fallback ->
|
|
17
22
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -35,23 +40,44 @@ buildscript {
|
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
44
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
45
|
+
afterEvaluate {
|
|
46
|
+
publishing {
|
|
47
|
+
publications {
|
|
48
|
+
release(MavenPublication) {
|
|
49
|
+
from components.release
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
repositories {
|
|
53
|
+
maven {
|
|
54
|
+
url = mavenLocal().url
|
|
55
|
+
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
android {
|
|
54
|
-
|
|
62
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
63
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
64
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
65
|
+
|
|
66
|
+
defaultConfig {
|
|
67
|
+
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
68
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
publishing {
|
|
72
|
+
singleVariant("release") {
|
|
73
|
+
withSourcesJar()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
lintOptions {
|
|
78
|
+
abortOnError false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
55
81
|
|
|
56
82
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
57
83
|
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
@@ -67,28 +93,20 @@ android {
|
|
|
67
93
|
|
|
68
94
|
namespace "expo.modules.taskManager"
|
|
69
95
|
defaultConfig {
|
|
70
|
-
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
71
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
72
96
|
versionCode 23
|
|
73
|
-
versionName "11.
|
|
74
|
-
}
|
|
75
|
-
lintOptions {
|
|
76
|
-
abortOnError false
|
|
77
|
-
}
|
|
78
|
-
publishing {
|
|
79
|
-
singleVariant("release") {
|
|
80
|
-
withSourcesJar()
|
|
81
|
-
}
|
|
97
|
+
versionName "11.7.0"
|
|
82
98
|
}
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
dependencies {
|
|
86
|
-
|
|
102
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
103
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
104
|
+
implementation project(':expo-modules-core')
|
|
105
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
106
|
+
}
|
|
87
107
|
implementation project(':unimodules-app-loader')
|
|
88
108
|
|
|
89
109
|
api "androidx.core:core:1.0.0"
|
|
90
|
-
|
|
91
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
92
110
|
}
|
|
93
111
|
repositories {
|
|
94
112
|
mavenCentral()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
package expo.modules.taskManager
|
|
2
|
+
|
|
3
|
+
import android.os.Handler
|
|
4
|
+
import android.os.Looper
|
|
5
|
+
import expo.modules.core.errors.ModuleNotFoundException
|
|
6
|
+
import expo.modules.interfaces.taskManager.TaskManagerInterface
|
|
7
|
+
import expo.modules.interfaces.taskManager.TaskServiceInterface
|
|
8
|
+
import expo.modules.kotlin.modules.Module
|
|
9
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
10
|
+
|
|
11
|
+
class TaskManagerModule : Module() {
|
|
12
|
+
private val _taskService: TaskServiceInterface? by lazy {
|
|
13
|
+
appContext.legacyModuleRegistry.getSingletonModule("TaskService", TaskServiceInterface::class.java)
|
|
14
|
+
}
|
|
15
|
+
private val taskService: TaskServiceInterface
|
|
16
|
+
get() = _taskService
|
|
17
|
+
?: throw ModuleNotFoundException(TaskServiceInterface::class.java.toString())
|
|
18
|
+
|
|
19
|
+
private val taskManagerInternal: TaskManagerInterface? by lazy {
|
|
20
|
+
appContext.legacyModule()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun definition() = ModuleDefinition {
|
|
24
|
+
Name("ExpoTaskManager")
|
|
25
|
+
|
|
26
|
+
Constants(
|
|
27
|
+
"EVENT_NAME" to TaskManagerInterface.EVENT_NAME
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
AsyncFunction("isAvailableAsync") {
|
|
31
|
+
taskService != null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
AsyncFunction("notifyTaskFinishedAsync") { taskName: String, response: Map<String, Any?> ->
|
|
35
|
+
taskService.notifyTaskFinished(taskName, appScopeKey, response)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
AsyncFunction("isTaskRegisteredAsync") { taskName: String ->
|
|
39
|
+
taskService.hasRegisteredTask(taskName, appScopeKey)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
AsyncFunction("getTaskOptionsAsync") { taskName: String ->
|
|
43
|
+
taskService.getTaskOptions(taskName, appScopeKey)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
AsyncFunction("getRegisteredTasksAsync") {
|
|
47
|
+
taskService.getTasksForAppScopeKey(appScopeKey)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
AsyncFunction("unregisterTaskAsync") { taskName: String ->
|
|
51
|
+
taskService.unregisterTask(taskName, appScopeKey, null)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
AsyncFunction("unregisterAllTasksAsync") {
|
|
55
|
+
taskService.unregisterAllTasksForAppScopeKey(appScopeKey)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
OnStartObserving {
|
|
59
|
+
val handler = Handler(Looper.getMainLooper())
|
|
60
|
+
handler.postDelayed(
|
|
61
|
+
{
|
|
62
|
+
taskManagerInternal?.flushQueuedEvents()
|
|
63
|
+
},
|
|
64
|
+
1000
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private val appScopeKey: String
|
|
70
|
+
get() = (
|
|
71
|
+
taskManagerInternal
|
|
72
|
+
?: throw ModuleNotFoundException(TaskManagerInterface::class.java.toString())
|
|
73
|
+
).appScopeKey
|
|
74
|
+
}
|
|
@@ -11,12 +11,6 @@ import java.util.Collections;
|
|
|
11
11
|
import java.util.List;
|
|
12
12
|
|
|
13
13
|
public class TaskManagerPackage extends BasePackage {
|
|
14
|
-
|
|
15
|
-
@Override
|
|
16
|
-
public List<ExportedModule> createExportedModules(Context context) {
|
|
17
|
-
return Collections.singletonList((ExportedModule) new TaskManagerModule(context));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
14
|
@Override
|
|
21
15
|
public List<InternalModule> createInternalModules(Context context) {
|
|
22
16
|
return Collections.singletonList(new TaskManagerInternalModule(context));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoTaskManager.d.ts","sourceRoot":"","sources":["../src/ExpoTaskManager.ts"],"names":[],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"ExpoTaskManager.d.ts","sourceRoot":"","sources":["../src/ExpoTaskManager.ts"],"names":[],"mappings":";AACA,wBAAsD"}
|
package/build/ExpoTaskManager.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
export default requireNativeModule('ExpoTaskManager');
|
|
3
3
|
//# sourceMappingURL=ExpoTaskManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoTaskManager.js","sourceRoot":"","sources":["../src/ExpoTaskManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ExpoTaskManager.js","sourceRoot":"","sources":["../src/ExpoTaskManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,eAAe,mBAAmB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nexport default requireNativeModule('ExpoTaskManager');\n"]}
|
|
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
|
-
s.platform = :ios, '13.
|
|
13
|
+
s.platform = :ios, '13.4'
|
|
14
14
|
s.source = { git: 'https://github.com/expo/expo-task-manager.git' }
|
|
15
15
|
s.static_framework = true
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-task-manager",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.7.0",
|
|
4
4
|
"description": "Expo module that provides support for tasks that can run in the background.",
|
|
5
5
|
"main": "build/TaskManager.js",
|
|
6
6
|
"types": "build/TaskManager.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"homepage": "https://docs.expo.dev/versions/latest/sdk/task-manager/",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"unimodules-app-loader": "~4.
|
|
36
|
+
"unimodules-app-loader": "~4.5.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"expo-module-scripts": "^3.0.0"
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"expo": "*"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "3142a086578deffd8704a8f1b6f0f661527d836c"
|
|
45
45
|
}
|
package/src/ExpoTaskManager.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
export default requireNativeModule('ExpoTaskManager');
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
package expo.modules.taskManager;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.os.Handler;
|
|
5
|
-
|
|
6
|
-
import expo.modules.core.ExportedModule;
|
|
7
|
-
import expo.modules.core.ModuleRegistry;
|
|
8
|
-
import expo.modules.core.Promise;
|
|
9
|
-
import expo.modules.core.interfaces.ExpoMethod;
|
|
10
|
-
import expo.modules.interfaces.taskManager.TaskManagerInterface;
|
|
11
|
-
import expo.modules.interfaces.taskManager.TaskServiceInterface;
|
|
12
|
-
|
|
13
|
-
import java.util.HashMap;
|
|
14
|
-
import java.util.Map;
|
|
15
|
-
|
|
16
|
-
public class TaskManagerModule extends ExportedModule {
|
|
17
|
-
|
|
18
|
-
private TaskServiceInterface mTaskService;
|
|
19
|
-
private TaskManagerInterface mTaskManagerInternal;
|
|
20
|
-
|
|
21
|
-
public TaskManagerModule(Context context) {
|
|
22
|
-
super(context);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
public String getName() {
|
|
27
|
-
return "ExpoTaskManager";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public Map<String, Object> getConstants() {
|
|
32
|
-
Map<String, Object> constants = new HashMap<>();
|
|
33
|
-
constants.put("EVENT_NAME", TaskManagerInterface.EVENT_NAME);
|
|
34
|
-
return constants;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@Override
|
|
38
|
-
public void onCreate(ModuleRegistry moduleRegistry) {
|
|
39
|
-
mTaskService = moduleRegistry.getSingletonModule("TaskService", TaskServiceInterface.class);
|
|
40
|
-
mTaskManagerInternal = moduleRegistry.getModule(TaskManagerInterface.class);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//region Expo methods
|
|
44
|
-
|
|
45
|
-
@ExpoMethod
|
|
46
|
-
public void isAvailableAsync(final Promise promise) {
|
|
47
|
-
promise.resolve(mTaskService != null);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@ExpoMethod
|
|
51
|
-
public void notifyTaskFinishedAsync(String taskName, Map<String, Object> response, final Promise promise) {
|
|
52
|
-
if (!checkTaskService(promise)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
mTaskService.notifyTaskFinished(taskName, getAppScopeKey(), response);
|
|
56
|
-
promise.resolve(null);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@ExpoMethod
|
|
60
|
-
public void isTaskRegisteredAsync(String taskName, final Promise promise) {
|
|
61
|
-
if (!checkTaskService(promise)) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
promise.resolve(mTaskService.hasRegisteredTask(taskName, getAppScopeKey()));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@ExpoMethod
|
|
68
|
-
public void getTaskOptionsAsync(String taskName, final Promise promise) {
|
|
69
|
-
if (!checkTaskService(promise)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
promise.resolve(mTaskService.getTaskOptions(taskName, getAppScopeKey()));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@ExpoMethod
|
|
76
|
-
public void getRegisteredTasksAsync(final Promise promise) {
|
|
77
|
-
if (!checkTaskService(promise)) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
promise.resolve(mTaskService.getTasksForAppScopeKey(getAppScopeKey()));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@ExpoMethod
|
|
84
|
-
public void unregisterTaskAsync(String taskName, final Promise promise) {
|
|
85
|
-
if (!checkTaskService(promise)) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
mTaskService.unregisterTask(taskName, getAppScopeKey(), null);
|
|
90
|
-
promise.resolve(null);
|
|
91
|
-
} catch (Exception e) {
|
|
92
|
-
promise.reject(e);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@ExpoMethod
|
|
97
|
-
public void unregisterAllTasksAsync(final Promise promise) {
|
|
98
|
-
if (!checkTaskService(promise)) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
mTaskService.unregisterAllTasksForAppScopeKey(getAppScopeKey());
|
|
103
|
-
promise.resolve(null);
|
|
104
|
-
} catch (Exception e) {
|
|
105
|
-
promise.reject(e);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@ExpoMethod
|
|
110
|
-
public void startObserving(final Promise promise) {
|
|
111
|
-
Handler handler = new Handler();
|
|
112
|
-
handler.postDelayed(new Runnable() {
|
|
113
|
-
@Override
|
|
114
|
-
public void run() {
|
|
115
|
-
if (mTaskManagerInternal != null) {
|
|
116
|
-
mTaskManagerInternal.flushQueuedEvents();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, 1000);
|
|
120
|
-
promise.resolve(null);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
@ExpoMethod
|
|
124
|
-
public void stopObserving(final Promise promise) {
|
|
125
|
-
// nothing
|
|
126
|
-
promise.resolve(null);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
//endregion
|
|
130
|
-
//region helpers
|
|
131
|
-
|
|
132
|
-
private String getAppScopeKey() {
|
|
133
|
-
return mTaskManagerInternal.getAppScopeKey();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private boolean checkTaskService(final Promise promise) {
|
|
137
|
-
if (mTaskService == null) {
|
|
138
|
-
promise.reject(TaskManagerInterface.ERR_TASK_SERVICE_NOT_FOUND, "Unable to find TaskService singleton module in module registry.");
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
//endregion
|
|
145
|
-
}
|
package/unimodule.json
DELETED