@smileid/usesmileid_huawei_face 12.3.0 → 12.3.1-SNAPSHOT.50

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.
@@ -17,3 +17,8 @@
17
17
  public static **[] values();
18
18
  public static ** valueOf(java.lang.String);
19
19
  }
20
+
21
+ # A store build may leave this backend out; LinkedAnalyzers finds it by this class name.
22
+ -keepnames class com.usesmileid.bridge.huawei.face.HuaweiFaceDetectorAnalyzer
23
+ -dontwarn com.usesmileid.bridge.huawei.face.**
24
+ -dontwarn com.huawei.hms.mlsdk.face.**
@@ -16,6 +16,7 @@ import com.usesmileid.bridge.session.UseSmileIDScanState
16
16
  import com.usesmileid.bridge.session.UseSmileIDScanStateType
17
17
  import com.usesmileid.bridge.storage.FrameStorage
18
18
  import com.usesmileid.bridge.model.CaptureType
19
+ import com.usesmileid.rn.analyzer.LinkedAnalyzers
19
20
  import com.usesmileid.rn.analyzer.UseSmileIDAnalyzerExecutor
20
21
  import expo.modules.kotlin.Promise
21
22
  import expo.modules.kotlin.modules.Module
@@ -102,7 +103,7 @@ class UseSmileIDHuaweiFaceModule : Module() {
102
103
  Name("UseSmileIDHuaweiFace")
103
104
 
104
105
  OnCreate {
105
- FaceAnalyzerFactoryRegistry.register(KEY) { HuaweiFaceDetectorAnalyzer() }
106
+ if (LinkedAnalyzers.has(KEY)) FaceAnalyzerFactoryRegistry.register(KEY) { HuaweiFaceDetectorAnalyzer() }
106
107
  val ctx = appContext.reactContext
107
108
  ?: throw IllegalStateException("Module not attached to a React context")
108
109
  executor.onAttach(ctx)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smileid/usesmileid_huawei_face",
3
- "version": "12.3.0",
3
+ "version": "12.3.1-SNAPSHOT.50",
4
4
  "description": "Huawei HMS face detection implementation for the UseSmileID React Native (Expo) SDK.",
5
5
  "homepage": "https://usesmileid.com",
6
6
  "repository": {
@@ -47,8 +47,8 @@
47
47
  "CHANGELOG.md"
48
48
  ],
49
49
  "dependencies": {
50
- "@smileid/usesmileid_bridge": "12.3.0",
51
- "@smileid/usesmileid_platform_interface": "12.3.0"
50
+ "@smileid/usesmileid_bridge": "12.3.1-SNAPSHOT.50",
51
+ "@smileid/usesmileid_platform_interface": "12.3.1-SNAPSHOT.50"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "expo": ">=56.0.0",
@@ -5,5 +5,15 @@ import { AndroidConfig, ConfigPlugin } from "expo/config-plugins";
5
5
  * with no value to replace is itself a merge error.
6
6
  */
7
7
  export declare function keepAppAllowBackup(manifest: AndroidConfig.Manifest.AndroidManifest): AndroidConfig.Manifest.AndroidManifest;
8
- declare const withHuaweiAllowBackup: ConfigPlugin;
9
- export default withHuaweiAllowBackup;
8
+ /** The analyzers a store flavor keeps: ML Kit's or Huawei's. */
9
+ export type StoreAnalyzers = "mlkit" | "huawei";
10
+ export type HuaweiPluginOptions = {
11
+ /** One flavor per store and the analyzers it keeps, for example `{ play: "mlkit", appgallery: "huawei" }`. */
12
+ storeFlavors?: Record<string, StoreAnalyzers>;
13
+ };
14
+ /** The Gradle block that creates the store flavors and leaves the other store's analyzers out of each. */
15
+ export declare function storeFlavorsGradle(storeFlavors: Record<string, StoreAnalyzers>): string;
16
+ /** Puts the store flavors block in `app/build.gradle`, replacing one an earlier run wrote. */
17
+ export declare function withStoreFlavors(buildGradle: string, storeFlavors: Record<string, StoreAnalyzers>): string;
18
+ declare const withHuawei: ConfigPlugin<HuaweiPluginOptions | void>;
19
+ export default withHuawei;
@@ -1 +1,5 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.keepAppAllowBackup=keepAppAllowBackup;const config_plugins_1=require("expo/config-plugins"),ALLOW_BACKUP="android:allowBackup",TOOLS_NAMESPACE="http://schemas.android.com/tools";function keepAppAllowBackup(e){const t=e.manifest.application?.[0];if(t?.$?.[ALLOW_BACKUP]===void 0)return e;e.manifest.$["xmlns:tools"]=TOOLS_NAMESPACE;const l=t.$,o=(l["tools:replace"]??"").split(",").map(s=>s.trim()).filter(s=>s.length>0);return o.includes(ALLOW_BACKUP)||o.push(ALLOW_BACKUP),l["tools:replace"]=o.join(","),e}const withHuaweiAllowBackup=e=>(0,config_plugins_1.withAndroidManifest)(e,t=>(t.modResults=keepAppAllowBackup(t.modResults),t));exports.default=withHuaweiAllowBackup;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.keepAppAllowBackup=keepAppAllowBackup,exports.storeFlavorsGradle=storeFlavorsGradle,exports.withStoreFlavors=withStoreFlavors;const config_plugins_1=require("expo/config-plugins"),ALLOW_BACKUP="android:allowBackup",TOOLS_NAMESPACE="http://schemas.android.com/tools";function keepAppAllowBackup(o){const t=o.manifest.application?.[0];if(t?.$?.[ALLOW_BACKUP]===void 0)return o;o.manifest.$["xmlns:tools"]=TOOLS_NAMESPACE;const e=t.$,s=(e["tools:replace"]??"").split(",").map(r=>r.trim()).filter(r=>r.length>0);return s.includes(ALLOW_BACKUP)||s.push(ALLOW_BACKUP),e["tools:replace"]=s.join(","),o}const withHuaweiAllowBackup=o=>(0,config_plugins_1.withAndroidManifest)(o,t=>(t.modResults=keepAppAllowBackup(t.modResults),t)),LEFT_OUT={mlkit:["huawei-face","huawei-document","kamera-huawei"],huawei:["mlkit-face","mlkit-document","kamera-mlkit"]},BEGIN="// @smileid store flavors: begin",END="// @smileid store flavors: end";function storeFlavorsGradle(o){const t=Object.entries(o);if(t.length===0)throw new Error("storeFlavors needs at least one flavor.");for(const[e,s]of t){if(!/^[a-z][A-Za-z0-9]*$/.test(e))throw new Error(`storeFlavors: "${e}" isn't a flavor name Gradle accepts.`);if(t.some(([r])=>r!==e&&r.startsWith(e)))throw new Error(`storeFlavors: "${e}" prefixes another flavor's name, so both would get its excludes.`);if(!Object.hasOwn(LEFT_OUT,s))throw new Error(`storeFlavors.${e} must be "mlkit" or "huawei".`)}return[BEGIN,"android {",' flavorDimensions "store"'," productFlavors {",...t.map(([e])=>` ${e} { dimension "store" }`)," }","}","react {",` debuggableVariants = [${t.map(([e])=>`"${e}Debug"`).join(", ")}]`,"}",...t.flatMap(([e,s])=>[`configurations.matching { it.name.startsWith("${e}") }.configureEach {`,...LEFT_OUT[s].map(r=>` exclude group: "com.usesmileid", module: "${r}"`),"}"]),END].join(`
2
+ `)}function withStoreFlavors(o,t){const e=storeFlavorsGradle(t),s=o.indexOf(BEGIN);if(s<0)return`${o.trimEnd()}
3
+
4
+ ${e}
5
+ `;const r=o.indexOf(END,s);if(r<0)throw new Error("app/build.gradle has a store flavors begin marker without its end; remove the partial block.");const n=r+END.length;return o.slice(0,s)+e+o.slice(n)}const withHuawei=(o,t)=>{const e=withHuaweiAllowBackup(o),s=t?.storeFlavors;return s?(0,config_plugins_1.withAppBuildGradle)(e,r=>{if(r.modResults.language!=="groovy")throw new Error("storeFlavors writes a Groovy app/build.gradle; this app's is Kotlin.");return r.modResults.contents=withStoreFlavors(r.modResults.contents,s),r}):e};exports.default=withHuawei;