expo-modules-core 2.0.0-preview.7 → 2.0.0-preview.8

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 CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 2.0.0-preview.8 — 2024-10-31
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Remove expo barcode scanner interface. ([#32198](https://github.com/expo/expo/pull/32198) by [@aleqsio](https://github.com/aleqsio))
18
+
19
+ ### 💡 Others
20
+
21
+ - [android] Added helper for looking up TaskService instance used by expo-task-manager ([#32300](https://github.com/expo/expo/pull/32300) by [@chrfalch](https://github.com/chrfalch))
22
+
13
23
  ## 2.0.0-preview.7 — 2024-10-29
14
24
 
15
25
  ### 💡 Others
@@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3
3
  apply plugin: 'com.android.library'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '2.0.0-preview.7'
6
+ version = '2.0.0-preview.8'
7
7
 
8
8
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
9
  apply from: expoModulesCorePlugin
@@ -67,7 +67,7 @@ android {
67
67
  defaultConfig {
68
68
  consumerProguardFiles 'proguard-rules.pro'
69
69
  versionCode 1
70
- versionName "2.0.0-preview.7"
70
+ versionName "2.0.0-preview.8"
71
71
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
72
72
 
73
73
  testInstrumentationRunner "expo.modules.TestRunner"
@@ -20,7 +20,7 @@ object ModulePriorities {
20
20
  // {key} to {value}
21
21
  // key: full qualified class name
22
22
  // value: priority value, the higher value takes precedence
23
- "expo.modules.splashscreen.SplashScreenPackage" to 11,
23
+ "host.exp.exponent.experience.splashscreen.legacy.SplashScreenPackage" to 11,
24
24
  "expo.modules.updates.UpdatesPackage" to 10
25
25
  )
26
26
  }
@@ -0,0 +1,41 @@
1
+ package expo.modules.interfaces.taskManager
2
+
3
+ import android.content.Context
4
+ import expo.modules.core.ModulePriorities
5
+ import expo.modules.core.interfaces.DoNotStrip
6
+ import expo.modules.core.interfaces.Package
7
+
8
+ @DoNotStrip
9
+ object TaskServiceProviderHelper {
10
+ /**
11
+ Uses reflection to look through the current list of packages and attempts to find
12
+ one that provides a TaskServiceInterface implementation.
13
+ @param context Provide the application context (context.getApplicationContext())
14
+ @return A implementation of the TaskServiceInterface it a package offers it
15
+ */
16
+ @DoNotStrip
17
+ fun getTaskServiceImpl(context: Context): TaskServiceInterface? {
18
+ // Use reflection to get the packages list from ExpoModulesPackageList without
19
+ // creating the reactInstanceManager. ExpoModulesPackageList is generated by
20
+ // autolinking and should safely be callable in this way - we already have a
21
+ // few other places in our code where it is called like this.
22
+ val expoModules: Class<*>? = try {
23
+ Class.forName("expo.modules.ExpoModulesPackageList")
24
+ } catch (e: ClassNotFoundException) {
25
+ // Handle the exception, e.g., log it or fallback to a default behavior
26
+ return null
27
+ }
28
+ val getPackageList = expoModules?.getMethod("getPackageList") ?: return null
29
+
30
+ // Invoke and get the list of packages
31
+ val result = getPackageList.invoke(null) as? List<*> ?: return null
32
+ val packages = result.filterIsInstance<Package>()
33
+ .sortedByDescending { ModulePriorities.get(it::class.qualifiedName) }
34
+
35
+ // Check if any of the packages are providing a task manager implementation
36
+ return packages
37
+ .filterIsInstance<TaskServiceProviderInterface>()
38
+ .firstOrNull()
39
+ ?.getTaskServiceImpl(context)
40
+ }
41
+ }
@@ -0,0 +1,18 @@
1
+ package expo.modules.interfaces.taskManager;
2
+
3
+ import android.content.Context;
4
+
5
+ import expo.modules.core.interfaces.Package;
6
+
7
+ /**
8
+ * Interface defining a package that provides a TaskServiceInterface implementation.
9
+ * This is utilized when an app is launched in the background without an activity.
10
+ * It enables running expo-task-manager JavaScript tasks in the background via the HeadlessAppLoader.
11
+ */
12
+ public interface TaskServiceProviderInterface extends Package {
13
+ /**
14
+ * @param context Current application context
15
+ * @return A task service implementation that can be provided without having setup the whole app
16
+ */
17
+ TaskServiceInterface getTaskServiceImpl(Context context);
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "2.0.0-preview.7",
3
+ "version": "2.0.0-preview.8",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "src/index.ts",
6
6
  "types": "build/index.d.ts",
@@ -44,5 +44,5 @@
44
44
  "@testing-library/react-native": "^12.5.2",
45
45
  "expo-module-scripts": "^4.0.0"
46
46
  },
47
- "gitHead": "4079b33541cde650111f4cc417b1c1c4b170bcb6"
47
+ "gitHead": "1f7a56b5a5bcef23ac6e55b16db53077f6a4065c"
48
48
  }
@@ -1,22 +0,0 @@
1
- // Copyright 2016-present 650 Industries. All rights reserved.
2
-
3
- #import <Foundation/Foundation.h>
4
- #import <AVFoundation/AVFoundation.h>
5
-
6
- @protocol EXBarCodeScannerInterface
7
-
8
- #if !TARGET_OS_TV
9
- - (void)setSession:(AVCaptureSession *)session;
10
- - (void)setSessionQueue:(dispatch_queue_t)sessionQueue;
11
- - (void)setOnBarCodeScanned:(void (^)(NSDictionary *))onBarCodeScanned;
12
-
13
- - (void)setIsEnabled:(BOOL)enabled;
14
- - (void)setSettings:(NSDictionary *)settings;
15
-
16
- - (void)setPreviewLayer:(AVCaptureVideoPreviewLayer *)previewLayer;
17
-
18
- - (void)maybeStartBarCodeScanning;
19
- - (void)stopBarCodeScanning;
20
- #endif
21
-
22
- @end
@@ -1,9 +0,0 @@
1
- // Copyright 2016-present 650 Industries. All rights reserved.
2
-
3
- #import <ExpoModulesCore/EXBarcodeScannerInterface.h>
4
-
5
- @protocol EXBarCodeScannerProviderInterface
6
-
7
- - (id<EXBarCodeScannerInterface>)createBarCodeScanner;
8
-
9
- @end