@craft-native/android 0.0.92 → 0.0.95

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 CHANGED
@@ -132,12 +132,24 @@ Edit `craft.config.json` in your Android project:
132
132
  }
133
133
  ```
134
134
 
135
+ Every `enable*` flag is enforced, not only reported. A call whose capability is
136
+ off rejects with `CAPABILITY_DISABLED`, as it does on iOS, and
137
+ `window.craft.capabilities` reports the same answer, so a page that
138
+ feature-detects and a page that just calls behave the same. Calls that answer
139
+ nothing yet, such as `haptic` and `vibrate`, do nothing and say so on the
140
+ console. Every flag defaults to off, so an app that shipped without setting one
141
+ and relied on Android serving it anyway has to turn it on.
142
+
135
143
  Only the fields shown above are generator options. Enabling background location
136
144
  also enables foreground geolocation. Push notifications require a regular
137
145
  `googleServicesFile` whose JSON contains a client matching the generated
138
146
  Android package. Deep links require at least one valid URI scheme; scheme names
139
147
  are normalized to lowercase.
140
- Health Connect normalizes `minSdk` to at least 26 and `compileSdk` to at least 36.
148
+ The generated runtime supports Android 8.0 / API 26 and newer, exported as
149
+ `ANDROID_MIN_SDK`. `minSdk` defaults to that floor; lower values are rejected
150
+ before project files are written, including when Health Connect is enabled.
151
+ Health Connect normalizes `compileSdk` to at least 36.
152
+ The same effective `minSdk` is written to Gradle and both configuration files.
141
153
  A custom `appIconPath` must be a regular PNG, WebP, JPG, or GIF file; its supported
142
154
  extension is preserved in the generated drawable resource.
143
155
 
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Craft Android Builder
3
+ *
4
+ * Generates native Android apps from web content using WebView.
5
+ */
6
+ /** Oldest Android API level supported by the generated Kotlin runtime. */
7
+ export declare const ANDROID_MIN_SDK = 26;
8
+ export interface CraftAndroidConfig {
9
+ appName: string;
10
+ packageName: string;
11
+ version?: string;
12
+ versionCode?: number;
13
+ darkMode?: boolean;
14
+ backgroundColor?: string;
15
+ enableSpeechRecognition?: boolean;
16
+ enableHaptics?: boolean;
17
+ enableShare?: boolean;
18
+ enableCamera?: boolean;
19
+ enableBiometric?: boolean;
20
+ enablePushNotifications?: boolean;
21
+ enableSecureStorage?: boolean;
22
+ enableGeolocation?: boolean;
23
+ enableBackgroundLocation?: boolean;
24
+ enableHealthConnect?: boolean;
25
+ enableKeepAwake?: boolean;
26
+ enableDeepLinks?: boolean;
27
+ urlSchemes?: string[];
28
+ trustedOrigins?: string[];
29
+ appIconPath?: string;
30
+ googleServicesFile?: string;
31
+ devServerURL?: string;
32
+ hasBundledFallback?: boolean;
33
+ /** Android API level, at least ANDROID_MIN_SDK (26). */
34
+ minSdk?: number;
35
+ compileSdk?: number;
36
+ targetSdk?: number;
37
+ }
38
+ export interface InitOptions {
39
+ name: string;
40
+ packageName?: string;
41
+ output: string;
42
+ config?: Partial<CraftAndroidConfig>;
43
+ /**
44
+ * Where to find the Zig runtime's `<abi>/libcraft.so`.
45
+ *
46
+ * `null` means no runtime regardless of the environment; `undefined` falls
47
+ * through to `CRAFT_ANDROID_RUNTIME`. Same shape as the iOS builder's
48
+ * `runtimeDir`.
49
+ */
50
+ runtimeDir?: string | null;
51
+ }
52
+ export interface BuildOptions {
53
+ htmlPath?: string;
54
+ devServer?: string;
55
+ output: string;
56
+ release?: boolean;
57
+ compile?: boolean;
58
+ /** Same meaning as `InitOptions.runtimeDir`; refreshes what init installed. */
59
+ runtimeDir?: string | null;
60
+ }
61
+ export interface OpenOptions {
62
+ output: string;
63
+ }
64
+ export interface RunOptions {
65
+ device?: string;
66
+ output: string;
67
+ }
68
+ export declare function syncAndroidWebAssets(source: string, output: string): void;
69
+ export declare function renderAndroidPermissions(config: CraftAndroidConfig): string;
70
+ export declare function renderAndroidDeepLinks(config: CraftAndroidConfig): string;
71
+ /**
72
+ * Where the runtime directory comes from when the caller does not say.
73
+ *
74
+ * The same shape as `CRAFT_BIN` and the iOS builder's `CRAFT_IOS_RUNTIME`: an
75
+ * explicit override for the monorepo dev loop, not a lookup path. Shipping the
76
+ * runtime to real apps means putting these libraries in the pantry package
77
+ * beside the `craft` binary, which is a distribution decision this function
78
+ * does not make.
79
+ */
80
+ export declare function resolveRuntimeDir(override?: string | null): string | null;
81
+ /**
82
+ * Copy the Zig runtime into the generated project as
83
+ * `app/src/main/jniLibs/<abi>/libcraft.so`.
84
+ *
85
+ * That path is AGP's default `jniLibs.srcDirs`, so nothing in the Gradle
86
+ * templates has to know about it — the library is packaged into the APK and
87
+ * `System.loadLibrary("craft")` finds it because the file is named for the
88
+ * `craft` it asks for.
89
+ *
90
+ * Until this existed, nothing put the library anywhere. `CraftNative` caught
91
+ * the `UnsatisfiedLinkError`, set `isAvailable = false`, and every action fell
92
+ * through to the Kotlin shim — by design, so an app with no runtime still
93
+ * works, which is also why nobody noticed that *every* generated app was in
94
+ * that state and the whole Android half of the Zig bridge had never run.
95
+ *
96
+ * Returns true when a runtime was installed.
97
+ */
98
+ export declare function installRuntime(output: string, runtimeDir: string): boolean;
99
+ export declare function init(options: InitOptions): Promise<void>;
100
+ /**
101
+ * Build Android project
102
+ */
103
+ export declare function build(options: BuildOptions): Promise<void>;
104
+ /**
105
+ * Open Android project in Android Studio
106
+ */
107
+ export declare function open(options: OpenOptions): Promise<void>;
108
+ /**
109
+ * Run on Android device or emulator
110
+ */
111
+ export declare function run(options: RunOptions): Promise<void>;