craft-native 0.0.37
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/LICENSE.md +21 -0
- package/README.md +424 -0
- package/bin/cli.ts +937 -0
- package/dist/api/android-advanced.d.ts +737 -0
- package/dist/api/android-advanced.d.ts.map +1 -0
- package/dist/api/app.d.ts +432 -0
- package/dist/api/app.d.ts.map +1 -0
- package/dist/api/clipboard.d.ts +85 -0
- package/dist/api/clipboard.d.ts.map +1 -0
- package/dist/api/crypto.d.ts +79 -0
- package/dist/api/crypto.d.ts.map +1 -0
- package/dist/api/db.d.ts +427 -0
- package/dist/api/db.d.ts.map +1 -0
- package/dist/api/dialog.d.ts +141 -0
- package/dist/api/dialog.d.ts.map +1 -0
- package/dist/api/fs.d.ts +131 -0
- package/dist/api/fs.d.ts.map +1 -0
- package/dist/api/http.d.ts +196 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/index.d.ts +38 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/ios-advanced.d.ts +833 -0
- package/dist/api/ios-advanced.d.ts.map +1 -0
- package/dist/api/macos-advanced.d.ts +721 -0
- package/dist/api/macos-advanced.d.ts.map +1 -0
- package/dist/api/media.d.ts +233 -0
- package/dist/api/media.d.ts.map +1 -0
- package/dist/api/mobile.d.ts +658 -0
- package/dist/api/mobile.d.ts.map +1 -0
- package/dist/api/process.d.ts +168 -0
- package/dist/api/process.d.ts.map +1 -0
- package/dist/api/sidebar.d.ts +125 -0
- package/dist/api/sidebar.d.ts.map +1 -0
- package/dist/api/tray.d.ts +410 -0
- package/dist/api/tray.d.ts.map +1 -0
- package/dist/api/window.d.ts +462 -0
- package/dist/api/window.d.ts.map +1 -0
- package/dist/api/windows-advanced.d.ts +719 -0
- package/dist/api/windows-advanced.d.ts.map +1 -0
- package/dist/assets/index.d.ts +69 -0
- package/dist/assets/index.d.ts.map +1 -0
- package/dist/binary-resolver.d.ts +39 -0
- package/dist/binary-resolver.d.ts.map +1 -0
- package/dist/bridge/android.d.ts +574 -0
- package/dist/bridge/android.d.ts.map +1 -0
- package/dist/bridge/core.d.ts +474 -0
- package/dist/bridge/core.d.ts.map +1 -0
- package/dist/bridge/ids.d.ts +18 -0
- package/dist/bridge/ids.d.ts.map +1 -0
- package/dist/bridge/ios.d.ts +528 -0
- package/dist/bridge/ios.d.ts.map +1 -0
- package/dist/bridge/webkit-pending.d.ts +50 -0
- package/dist/bridge/webkit-pending.d.ts.map +1 -0
- package/dist/build/bundle-optimizer.d.ts +69 -0
- package/dist/build/bundle-optimizer.d.ts.map +1 -0
- package/dist/components/index.d.ts +719 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/native.d.ts +728 -0
- package/dist/components/native.d.ts.map +1 -0
- package/dist/components/sidebar.d.ts +458 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/dev/devtools.d.ts +118 -0
- package/dist/dev/devtools.d.ts.map +1 -0
- package/dist/dev/error-overlay.d.ts +73 -0
- package/dist/dev/error-overlay.d.ts.map +1 -0
- package/dist/dev/hot-reload.d.ts +127 -0
- package/dist/dev/hot-reload.d.ts.map +1 -0
- package/dist/index.cjs +10253 -0
- package/dist/index.d.cts +59 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10240 -0
- package/dist/logging/index.d.ts +152 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/optimizations/index.d.ts +232 -0
- package/dist/optimizations/index.d.ts.map +1 -0
- package/dist/package.d.ts +90 -0
- package/dist/package.d.ts.map +1 -0
- package/dist/performance/runtime.d.ts +230 -0
- package/dist/performance/runtime.d.ts.map +1 -0
- package/dist/performance/startup.d.ts +223 -0
- package/dist/performance/startup.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +114 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/security/index.d.ts +268 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/signing/index.d.ts +104 -0
- package/dist/signing/index.d.ts.map +1 -0
- package/dist/styles/headwind.d.ts +222 -0
- package/dist/styles/headwind.d.ts.map +1 -0
- package/dist/styles/index.d.ts +31 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/sidebar-templates.d.ts +77 -0
- package/dist/styles/sidebar-templates.d.ts.map +1 -0
- package/dist/styles/sidebars.d.ts +194 -0
- package/dist/styles/sidebars.d.ts.map +1 -0
- package/dist/types.d.ts +1555 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/updater/index.d.ts +164 -0
- package/dist/updater/index.d.ts.map +1 -0
- package/dist/utils/audio.d.ts +40 -0
- package/dist/utils/audio.d.ts.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/native.d.ts +27 -0
- package/dist/utils/native.d.ts.map +1 -0
- package/dist/utils/react.d.ts +157 -0
- package/dist/utils/react.d.ts.map +1 -0
- package/dist/utils/storage.d.ts +35 -0
- package/dist/utils/storage.d.ts.map +1 -0
- package/dist/utils/svelte.d.ts +187 -0
- package/dist/utils/svelte.d.ts.map +1 -0
- package/dist/utils/timer.d.ts +57 -0
- package/dist/utils/timer.d.ts.map +1 -0
- package/dist/utils/vue.d.ts +157 -0
- package/dist/utils/vue.d.ts.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Android Advanced Features API
|
|
3
|
+
* @description Advanced Android-specific features including Jetpack Compose integration,
|
|
4
|
+
* Material You dynamic colors, Photo Picker, Work Manager, Foreground Services, and more.
|
|
5
|
+
* @module @craft-native/api/android-advanced
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Material You color scheme.
|
|
9
|
+
*/
|
|
10
|
+
export interface MaterialYouColors {
|
|
11
|
+
/** Primary color */
|
|
12
|
+
primary: string;
|
|
13
|
+
/** On primary color */
|
|
14
|
+
onPrimary: string;
|
|
15
|
+
/** Primary container */
|
|
16
|
+
primaryContainer: string;
|
|
17
|
+
/** On primary container */
|
|
18
|
+
onPrimaryContainer: string;
|
|
19
|
+
/** Secondary color */
|
|
20
|
+
secondary: string;
|
|
21
|
+
/** On secondary */
|
|
22
|
+
onSecondary: string;
|
|
23
|
+
/** Secondary container */
|
|
24
|
+
secondaryContainer: string;
|
|
25
|
+
/** On secondary container */
|
|
26
|
+
onSecondaryContainer: string;
|
|
27
|
+
/** Tertiary color */
|
|
28
|
+
tertiary: string;
|
|
29
|
+
/** On tertiary */
|
|
30
|
+
onTertiary: string;
|
|
31
|
+
/** Tertiary container */
|
|
32
|
+
tertiaryContainer: string;
|
|
33
|
+
/** On tertiary container */
|
|
34
|
+
onTertiaryContainer: string;
|
|
35
|
+
/** Error color */
|
|
36
|
+
error: string;
|
|
37
|
+
/** On error */
|
|
38
|
+
onError: string;
|
|
39
|
+
/** Error container */
|
|
40
|
+
errorContainer: string;
|
|
41
|
+
/** On error container */
|
|
42
|
+
onErrorContainer: string;
|
|
43
|
+
/** Background */
|
|
44
|
+
background: string;
|
|
45
|
+
/** On background */
|
|
46
|
+
onBackground: string;
|
|
47
|
+
/** Surface */
|
|
48
|
+
surface: string;
|
|
49
|
+
/** On surface */
|
|
50
|
+
onSurface: string;
|
|
51
|
+
/** Surface variant */
|
|
52
|
+
surfaceVariant: string;
|
|
53
|
+
/** On surface variant */
|
|
54
|
+
onSurfaceVariant: string;
|
|
55
|
+
/** Outline */
|
|
56
|
+
outline: string;
|
|
57
|
+
/** Outline variant */
|
|
58
|
+
outlineVariant: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Material You API for dynamic theming.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* // Get current dynamic colors
|
|
65
|
+
* const colors = await materialYou.getColors()
|
|
66
|
+
* document.body.style.backgroundColor = colors.background
|
|
67
|
+
*
|
|
68
|
+
* // Listen for wallpaper changes
|
|
69
|
+
* materialYou.onColorsChange((colors) => {
|
|
70
|
+
* applyTheme(colors)
|
|
71
|
+
* })
|
|
72
|
+
*/
|
|
73
|
+
export declare const materialYou: {
|
|
74
|
+
/**
|
|
75
|
+
* Check if Material You is supported.
|
|
76
|
+
*/
|
|
77
|
+
isSupported(): Promise<boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* Get current dynamic colors.
|
|
80
|
+
*/
|
|
81
|
+
getColors(darkMode?: boolean): Promise<MaterialYouColors | null>;
|
|
82
|
+
/**
|
|
83
|
+
* Get colors from a specific source.
|
|
84
|
+
*/
|
|
85
|
+
getColorsFromSource(source: "wallpaper" | "content"): Promise<MaterialYouColors | null>;
|
|
86
|
+
/**
|
|
87
|
+
* Listen for color changes.
|
|
88
|
+
*/
|
|
89
|
+
onColorsChange(handler: (colors: MaterialYouColors) => void): void;
|
|
90
|
+
/**
|
|
91
|
+
* Apply dynamic colors to system bars.
|
|
92
|
+
*/
|
|
93
|
+
applyToSystemBars(colors?: {
|
|
94
|
+
statusBarColor?: string;
|
|
95
|
+
navigationBarColor?: string;
|
|
96
|
+
lightStatusBar?: boolean;
|
|
97
|
+
lightNavigationBar?: boolean;
|
|
98
|
+
}): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Generate color scheme from seed color.
|
|
101
|
+
*/
|
|
102
|
+
generateScheme(seedColor: string, darkMode?: boolean): Promise<MaterialYouColors | null>;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Photo picker media type.
|
|
106
|
+
*/
|
|
107
|
+
export type PhotoPickerMediaType = 'images' | 'videos' | 'all';
|
|
108
|
+
/**
|
|
109
|
+
* Selected media item.
|
|
110
|
+
*/
|
|
111
|
+
export interface PhotoPickerResult {
|
|
112
|
+
/** Content URI */
|
|
113
|
+
uri: string;
|
|
114
|
+
/** MIME type */
|
|
115
|
+
mimeType: string;
|
|
116
|
+
/** File name */
|
|
117
|
+
name: string;
|
|
118
|
+
/** File size in bytes */
|
|
119
|
+
size: number;
|
|
120
|
+
/** Width (for images/videos) */
|
|
121
|
+
width?: number;
|
|
122
|
+
/** Height (for images/videos) */
|
|
123
|
+
height?: number;
|
|
124
|
+
/** Duration in ms (for videos) */
|
|
125
|
+
duration?: number;
|
|
126
|
+
/** Date taken */
|
|
127
|
+
dateTaken?: Date;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Photo Picker API for Android 13+ privacy-preserving media selection.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* // Pick a single image
|
|
134
|
+
* const photo = await photoPicker.pickImage()
|
|
135
|
+
*
|
|
136
|
+
* // Pick multiple images (up to 10)
|
|
137
|
+
* const photos = await photoPicker.pickImages(10)
|
|
138
|
+
*
|
|
139
|
+
* // Pick a video
|
|
140
|
+
* const video = await photoPicker.pickVideo()
|
|
141
|
+
*/
|
|
142
|
+
export declare const photoPicker: {
|
|
143
|
+
/**
|
|
144
|
+
* Check if Photo Picker is available (Android 13+).
|
|
145
|
+
*/
|
|
146
|
+
isAvailable(): Promise<boolean>;
|
|
147
|
+
/**
|
|
148
|
+
* Pick a single image.
|
|
149
|
+
*/
|
|
150
|
+
pickImage(): Promise<PhotoPickerResult | null>;
|
|
151
|
+
/**
|
|
152
|
+
* Pick multiple images.
|
|
153
|
+
*/
|
|
154
|
+
pickImages(maxCount?: number): Promise<PhotoPickerResult[]>;
|
|
155
|
+
/**
|
|
156
|
+
* Pick a single video.
|
|
157
|
+
*/
|
|
158
|
+
pickVideo(): Promise<PhotoPickerResult | null>;
|
|
159
|
+
/**
|
|
160
|
+
* Pick multiple videos.
|
|
161
|
+
*/
|
|
162
|
+
pickVideos(maxCount?: number): Promise<PhotoPickerResult[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Pick mixed media (images and videos).
|
|
165
|
+
*/
|
|
166
|
+
pickMedia(options?: {
|
|
167
|
+
maxCount?: number;
|
|
168
|
+
mediaType?: PhotoPickerMediaType;
|
|
169
|
+
}): Promise<PhotoPickerResult[]>;
|
|
170
|
+
/**
|
|
171
|
+
* Get a persistent URI for the selected media.
|
|
172
|
+
* Takes a content URI and returns a file path that can be used after app restart.
|
|
173
|
+
*/
|
|
174
|
+
getPersistedUri(uri: string): Promise<string | null>;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Work request constraints.
|
|
178
|
+
*/
|
|
179
|
+
export interface WorkConstraints {
|
|
180
|
+
/** Require network connectivity */
|
|
181
|
+
requiresNetwork?: 'connected' | 'unmetered' | 'not_roaming' | 'metered';
|
|
182
|
+
/** Require charging */
|
|
183
|
+
requiresCharging?: boolean;
|
|
184
|
+
/** Require device idle */
|
|
185
|
+
requiresDeviceIdle?: boolean;
|
|
186
|
+
/** Require battery not low */
|
|
187
|
+
requiresBatteryNotLow?: boolean;
|
|
188
|
+
/** Require storage not low */
|
|
189
|
+
requiresStorageNotLow?: boolean;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Work request configuration.
|
|
193
|
+
*/
|
|
194
|
+
export interface WorkRequest {
|
|
195
|
+
/** Unique work name */
|
|
196
|
+
name: string;
|
|
197
|
+
/** Work type */
|
|
198
|
+
type: 'oneTime' | 'periodic';
|
|
199
|
+
/** Input data */
|
|
200
|
+
inputData?: Record<string, string | number | boolean>;
|
|
201
|
+
/** Constraints */
|
|
202
|
+
constraints?: WorkConstraints;
|
|
203
|
+
/** Initial delay in milliseconds */
|
|
204
|
+
initialDelay?: number;
|
|
205
|
+
/** Repeat interval in milliseconds (for periodic work) */
|
|
206
|
+
repeatInterval?: number;
|
|
207
|
+
/** Flex interval in milliseconds (for periodic work) */
|
|
208
|
+
flexInterval?: number;
|
|
209
|
+
/** Backoff policy */
|
|
210
|
+
backoffPolicy?: {
|
|
211
|
+
policy: 'linear' | 'exponential';
|
|
212
|
+
delayMs: number;
|
|
213
|
+
};
|
|
214
|
+
/** Tags for grouping */
|
|
215
|
+
tags?: string[];
|
|
216
|
+
/** Expedited work (Android 12+) */
|
|
217
|
+
expedited?: boolean;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Work info.
|
|
221
|
+
*/
|
|
222
|
+
export interface WorkInfo {
|
|
223
|
+
/** Work ID */
|
|
224
|
+
id: string;
|
|
225
|
+
/** Work name */
|
|
226
|
+
name: string;
|
|
227
|
+
/** Current state */
|
|
228
|
+
state: 'enqueued' | 'running' | 'succeeded' | 'failed' | 'blocked' | 'cancelled';
|
|
229
|
+
/** Output data */
|
|
230
|
+
outputData?: Record<string, any>;
|
|
231
|
+
/** Run attempt count */
|
|
232
|
+
runAttemptCount: number;
|
|
233
|
+
/** Tags */
|
|
234
|
+
tags: string[];
|
|
235
|
+
/** Progress (0-100) */
|
|
236
|
+
progress?: number;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Work Manager API for background task scheduling.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* // Schedule a one-time sync task
|
|
243
|
+
* await workManager.enqueue({
|
|
244
|
+
* name: 'sync-data',
|
|
245
|
+
* type: 'oneTime',
|
|
246
|
+
* constraints: {
|
|
247
|
+
* requiresNetwork: 'connected'
|
|
248
|
+
* },
|
|
249
|
+
* inputData: { userId: '123' }
|
|
250
|
+
* })
|
|
251
|
+
*
|
|
252
|
+
* // Schedule periodic cleanup
|
|
253
|
+
* await workManager.enqueue({
|
|
254
|
+
* name: 'cleanup',
|
|
255
|
+
* type: 'periodic',
|
|
256
|
+
* repeatInterval: 24 * 60 * 60 * 1000, // Daily
|
|
257
|
+
* constraints: {
|
|
258
|
+
* requiresCharging: true,
|
|
259
|
+
* requiresDeviceIdle: true
|
|
260
|
+
* }
|
|
261
|
+
* })
|
|
262
|
+
*
|
|
263
|
+
* // Monitor work progress
|
|
264
|
+
* workManager.observeWork('sync-data', (info) => {
|
|
265
|
+
* console.log('State:', info.state, 'Progress:', info.progress)
|
|
266
|
+
* })
|
|
267
|
+
*/
|
|
268
|
+
export declare const workManager: {
|
|
269
|
+
/**
|
|
270
|
+
* Enqueue a work request.
|
|
271
|
+
*/
|
|
272
|
+
enqueue(request: WorkRequest): Promise<string>;
|
|
273
|
+
/**
|
|
274
|
+
* Enqueue unique work (replaces existing work with same name).
|
|
275
|
+
*/
|
|
276
|
+
enqueueUnique(request: WorkRequest, existingWorkPolicy: "replace" | "keep" | "append" | "update"): Promise<string>;
|
|
277
|
+
/**
|
|
278
|
+
* Cancel work by name.
|
|
279
|
+
*/
|
|
280
|
+
cancelByName(name: string): Promise<void>;
|
|
281
|
+
/**
|
|
282
|
+
* Cancel work by ID.
|
|
283
|
+
*/
|
|
284
|
+
cancelById(id: string): Promise<void>;
|
|
285
|
+
/**
|
|
286
|
+
* Cancel work by tag.
|
|
287
|
+
*/
|
|
288
|
+
cancelByTag(tag: string): Promise<void>;
|
|
289
|
+
/**
|
|
290
|
+
* Cancel all work.
|
|
291
|
+
*/
|
|
292
|
+
cancelAll(): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Get work info by name.
|
|
295
|
+
*/
|
|
296
|
+
getWorkInfo(name: string): Promise<WorkInfo | null>;
|
|
297
|
+
/**
|
|
298
|
+
* Get work info by ID.
|
|
299
|
+
*/
|
|
300
|
+
getWorkInfoById(id: string): Promise<WorkInfo | null>;
|
|
301
|
+
/**
|
|
302
|
+
* Get work info by tag.
|
|
303
|
+
*/
|
|
304
|
+
getWorkInfoByTag(tag: string): Promise<WorkInfo[]>;
|
|
305
|
+
/**
|
|
306
|
+
* Observe work by name.
|
|
307
|
+
*/
|
|
308
|
+
observeWork(name: string, handler: (info: WorkInfo) => void): () => void;
|
|
309
|
+
/**
|
|
310
|
+
* Prune finished work from database.
|
|
311
|
+
*/
|
|
312
|
+
pruneWork(): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Register work handler (called when work executes).
|
|
315
|
+
*/
|
|
316
|
+
onWork(name: string, handler: (inputData: Record<string, any>, setProgress: (progress: number) => void) => Promise<{
|
|
317
|
+
success: boolean;
|
|
318
|
+
outputData?: Record<string, any>;
|
|
319
|
+
}>): void;
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Foreground service type.
|
|
323
|
+
*/
|
|
324
|
+
export type ForegroundServiceType = 'camera' | 'connectedDevice' | 'dataSync' | 'health' | 'location' | 'mediaPlayback' | 'mediaProjection' | 'microphone' | 'phoneCall' | 'remoteMessaging' | 'shortService' | 'specialUse' | 'systemExempted';
|
|
325
|
+
/**
|
|
326
|
+
* Notification configuration for foreground service.
|
|
327
|
+
*/
|
|
328
|
+
export interface ForegroundNotification {
|
|
329
|
+
/** Notification channel ID */
|
|
330
|
+
channelId: string;
|
|
331
|
+
/** Notification ID */
|
|
332
|
+
notificationId: number;
|
|
333
|
+
/** Title */
|
|
334
|
+
title: string;
|
|
335
|
+
/** Content text */
|
|
336
|
+
content: string;
|
|
337
|
+
/** Small icon resource name */
|
|
338
|
+
smallIcon: string;
|
|
339
|
+
/** Large icon URL */
|
|
340
|
+
largeIcon?: string;
|
|
341
|
+
/** Ongoing (can't be dismissed) */
|
|
342
|
+
ongoing?: boolean;
|
|
343
|
+
/** Actions */
|
|
344
|
+
actions?: Array<{
|
|
345
|
+
id: string;
|
|
346
|
+
title: string;
|
|
347
|
+
icon?: string;
|
|
348
|
+
}>;
|
|
349
|
+
/** Progress (for determinate progress) */
|
|
350
|
+
progress?: {
|
|
351
|
+
max: number;
|
|
352
|
+
current: number;
|
|
353
|
+
indeterminate?: boolean;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Foreground Services API for long-running operations.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* // Start a media playback service
|
|
361
|
+
* await foregroundService.start({
|
|
362
|
+
* type: 'mediaPlayback',
|
|
363
|
+
* notification: {
|
|
364
|
+
* channelId: 'playback',
|
|
365
|
+
* notificationId: 1,
|
|
366
|
+
* title: 'Now Playing',
|
|
367
|
+
* content: 'Song Name - Artist',
|
|
368
|
+
* smallIcon: 'ic_music_note',
|
|
369
|
+
* actions: [
|
|
370
|
+
* { id: 'pause', title: 'Pause', icon: 'ic_pause' },
|
|
371
|
+
* { id: 'next', title: 'Next', icon: 'ic_skip_next' }
|
|
372
|
+
* ]
|
|
373
|
+
* }
|
|
374
|
+
* })
|
|
375
|
+
*
|
|
376
|
+
* // Handle notification actions
|
|
377
|
+
* foregroundService.onAction((actionId) => {
|
|
378
|
+
* if (actionId === 'pause') pausePlayback()
|
|
379
|
+
* })
|
|
380
|
+
*
|
|
381
|
+
* // Stop the service
|
|
382
|
+
* await foregroundService.stop()
|
|
383
|
+
*/
|
|
384
|
+
export declare const foregroundService: {
|
|
385
|
+
/**
|
|
386
|
+
* Start a foreground service.
|
|
387
|
+
*/
|
|
388
|
+
start(config: {
|
|
389
|
+
type: ForegroundServiceType;
|
|
390
|
+
notification: ForegroundNotification;
|
|
391
|
+
}): Promise<void>;
|
|
392
|
+
/**
|
|
393
|
+
* Stop the foreground service.
|
|
394
|
+
*/
|
|
395
|
+
stop(): Promise<void>;
|
|
396
|
+
/**
|
|
397
|
+
* Update notification.
|
|
398
|
+
*/
|
|
399
|
+
updateNotification(notification: Partial<ForegroundNotification>): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* Check if service is running.
|
|
402
|
+
*/
|
|
403
|
+
isRunning(): Promise<boolean>;
|
|
404
|
+
/**
|
|
405
|
+
* Register notification action handler.
|
|
406
|
+
*/
|
|
407
|
+
onAction(handler: (actionId: string) => void): void;
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* Back event info.
|
|
411
|
+
*/
|
|
412
|
+
export interface BackEvent {
|
|
413
|
+
/** Touch X position */
|
|
414
|
+
touchX: number;
|
|
415
|
+
/** Touch Y position */
|
|
416
|
+
touchY: number;
|
|
417
|
+
/** Progress of the back gesture (0-1) */
|
|
418
|
+
progress: number;
|
|
419
|
+
/** Swipe edge: 0 = left, 1 = right */
|
|
420
|
+
swipeEdge: 0 | 1;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Predictive Back API for Android 13+ back gesture handling.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* // Enable predictive back
|
|
427
|
+
* predictiveBack.enable()
|
|
428
|
+
*
|
|
429
|
+
* // Handle back progress for animations
|
|
430
|
+
* predictiveBack.onProgress((event) => {
|
|
431
|
+
* // Animate UI based on progress
|
|
432
|
+
* element.style.transform = `translateX(${event.progress * -100}px)`
|
|
433
|
+
* })
|
|
434
|
+
*
|
|
435
|
+
* // Handle back committed
|
|
436
|
+
* predictiveBack.onCommit(() => {
|
|
437
|
+
* navigateBack()
|
|
438
|
+
* })
|
|
439
|
+
*/
|
|
440
|
+
export declare const predictiveBack: {
|
|
441
|
+
/**
|
|
442
|
+
* Check if predictive back is supported.
|
|
443
|
+
*/
|
|
444
|
+
isSupported(): Promise<boolean>;
|
|
445
|
+
/**
|
|
446
|
+
* Enable predictive back handling.
|
|
447
|
+
*/
|
|
448
|
+
enable(): void;
|
|
449
|
+
/**
|
|
450
|
+
* Disable predictive back handling.
|
|
451
|
+
*/
|
|
452
|
+
disable(): void;
|
|
453
|
+
/**
|
|
454
|
+
* Register back started handler.
|
|
455
|
+
*/
|
|
456
|
+
onStart(handler: (event: BackEvent) => void): void;
|
|
457
|
+
/**
|
|
458
|
+
* Register back progress handler.
|
|
459
|
+
*/
|
|
460
|
+
onProgress(handler: (event: BackEvent) => void): void;
|
|
461
|
+
/**
|
|
462
|
+
* Register back committed handler.
|
|
463
|
+
*/
|
|
464
|
+
onCommit(handler: () => void): void;
|
|
465
|
+
/**
|
|
466
|
+
* Register back cancelled handler.
|
|
467
|
+
*/
|
|
468
|
+
onCancel(handler: () => void): void;
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* Language Preferences API for per-app language settings (Android 13+).
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* // Get available languages
|
|
475
|
+
* const languages = await appLanguage.getAvailableLanguages()
|
|
476
|
+
*
|
|
477
|
+
* // Set app language
|
|
478
|
+
* await appLanguage.setLanguage('es')
|
|
479
|
+
*
|
|
480
|
+
* // Get current language
|
|
481
|
+
* const current = await appLanguage.getCurrentLanguage()
|
|
482
|
+
*/
|
|
483
|
+
export declare const appLanguage: {
|
|
484
|
+
/**
|
|
485
|
+
* Check if per-app language is supported.
|
|
486
|
+
*/
|
|
487
|
+
isSupported(): Promise<boolean>;
|
|
488
|
+
/**
|
|
489
|
+
* Get available languages defined in app.
|
|
490
|
+
*/
|
|
491
|
+
getAvailableLanguages(): Promise<string[]>;
|
|
492
|
+
/**
|
|
493
|
+
* Get current app language.
|
|
494
|
+
*/
|
|
495
|
+
getCurrentLanguage(): Promise<string | null>;
|
|
496
|
+
/**
|
|
497
|
+
* Set app language.
|
|
498
|
+
*/
|
|
499
|
+
setLanguage(languageTag: string): Promise<void>;
|
|
500
|
+
/**
|
|
501
|
+
* Reset to system language.
|
|
502
|
+
*/
|
|
503
|
+
resetToSystem(): Promise<void>;
|
|
504
|
+
/**
|
|
505
|
+
* Open system language settings for this app.
|
|
506
|
+
*/
|
|
507
|
+
openSettings(): Promise<void>;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* Widget size class.
|
|
511
|
+
*/
|
|
512
|
+
export type WidgetSizeClass = 'small' | 'medium' | 'large' | 'extraLarge';
|
|
513
|
+
/**
|
|
514
|
+
* Widget configuration.
|
|
515
|
+
*/
|
|
516
|
+
export interface WidgetConfig {
|
|
517
|
+
/** Widget class name */
|
|
518
|
+
widgetClass: string;
|
|
519
|
+
/** Minimum width in dp */
|
|
520
|
+
minWidth: number;
|
|
521
|
+
/** Minimum height in dp */
|
|
522
|
+
minHeight: number;
|
|
523
|
+
/** Target cell width */
|
|
524
|
+
targetCellWidth?: number;
|
|
525
|
+
/** Target cell height */
|
|
526
|
+
targetCellHeight?: number;
|
|
527
|
+
/** Maximum resize width */
|
|
528
|
+
maxResizeWidth?: number;
|
|
529
|
+
/** Maximum resize height */
|
|
530
|
+
maxResizeHeight?: number;
|
|
531
|
+
/** Update period in milliseconds (minimum 30 minutes) */
|
|
532
|
+
updatePeriodMs?: number;
|
|
533
|
+
/** Whether widget is resizable */
|
|
534
|
+
resizable?: boolean;
|
|
535
|
+
/** Widget category */
|
|
536
|
+
category?: 'homeScreen' | 'keyguard' | 'searchBox';
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Widget data.
|
|
540
|
+
*/
|
|
541
|
+
export interface WidgetData {
|
|
542
|
+
/** Widget ID */
|
|
543
|
+
widgetId: number;
|
|
544
|
+
/** Widget data */
|
|
545
|
+
data: Record<string, any>;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* App Widgets API for home screen widgets.
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* // Update widget content
|
|
552
|
+
* await widgets.updateWidget(widgetId, {
|
|
553
|
+
* title: 'Weather',
|
|
554
|
+
* temperature: '72°F',
|
|
555
|
+
* icon: 'sunny'
|
|
556
|
+
* })
|
|
557
|
+
*
|
|
558
|
+
* // Request widget pin
|
|
559
|
+
* await widgets.requestPin('WeatherWidget')
|
|
560
|
+
*
|
|
561
|
+
* // Handle widget interactions
|
|
562
|
+
* widgets.onInteraction((_widgetId, action) => {
|
|
563
|
+
* if (action === 'refresh') {
|
|
564
|
+
* refreshWeatherData()
|
|
565
|
+
* }
|
|
566
|
+
* })
|
|
567
|
+
*/
|
|
568
|
+
export declare const widgets: {
|
|
569
|
+
/**
|
|
570
|
+
* Get all active widget IDs for a widget class.
|
|
571
|
+
*/
|
|
572
|
+
getActiveWidgets(widgetClass: string): Promise<number[]>;
|
|
573
|
+
/**
|
|
574
|
+
* Update a widget.
|
|
575
|
+
*/
|
|
576
|
+
updateWidget(widgetId: number, data: Record<string, any>): Promise<void>;
|
|
577
|
+
/**
|
|
578
|
+
* Update all widgets of a class.
|
|
579
|
+
*/
|
|
580
|
+
updateAllWidgets(widgetClass: string, data: Record<string, any>): Promise<void>;
|
|
581
|
+
/**
|
|
582
|
+
* Request to pin a widget to home screen.
|
|
583
|
+
*/
|
|
584
|
+
requestPin(widgetClass: string): Promise<boolean>;
|
|
585
|
+
/**
|
|
586
|
+
* Check if app widgets are supported.
|
|
587
|
+
*/
|
|
588
|
+
isSupported(): Promise<boolean>;
|
|
589
|
+
/**
|
|
590
|
+
* Register widget update handler.
|
|
591
|
+
*/
|
|
592
|
+
onUpdate(widgetClass: string, handler: (widgetIds: number[]) => void): void;
|
|
593
|
+
/**
|
|
594
|
+
* Register widget interaction handler.
|
|
595
|
+
*/
|
|
596
|
+
onInteraction(handler: (widgetId: number, action: string, extras?: Record<string, any>) => void): void;
|
|
597
|
+
/**
|
|
598
|
+
* Register widget resize handler.
|
|
599
|
+
*/
|
|
600
|
+
onResize(handler: (widgetId: number, width: number, height: number) => void): void;
|
|
601
|
+
/**
|
|
602
|
+
* Register widget delete handler.
|
|
603
|
+
*/
|
|
604
|
+
onDelete(handler: (widgetId: number) => void): void;
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* Product details from Google Play.
|
|
608
|
+
*/
|
|
609
|
+
export interface PlayProduct {
|
|
610
|
+
/** Product ID */
|
|
611
|
+
productId: string;
|
|
612
|
+
/** Product type */
|
|
613
|
+
productType: 'inapp' | 'subs';
|
|
614
|
+
/** Title */
|
|
615
|
+
title: string;
|
|
616
|
+
/** Name */
|
|
617
|
+
name: string;
|
|
618
|
+
/** Description */
|
|
619
|
+
description: string;
|
|
620
|
+
/** One-time purchase offer (for inapp) */
|
|
621
|
+
oneTimePurchaseOfferDetails?: {
|
|
622
|
+
formattedPrice: string;
|
|
623
|
+
priceAmountMicros: number;
|
|
624
|
+
priceCurrencyCode: string;
|
|
625
|
+
};
|
|
626
|
+
/** Subscription offer details (for subs) */
|
|
627
|
+
subscriptionOfferDetails?: Array<{
|
|
628
|
+
offerId: string;
|
|
629
|
+
basePlanId: string;
|
|
630
|
+
offerTags: string[];
|
|
631
|
+
pricingPhases: Array<{
|
|
632
|
+
formattedPrice: string;
|
|
633
|
+
priceAmountMicros: number;
|
|
634
|
+
priceCurrencyCode: string;
|
|
635
|
+
billingPeriod: string;
|
|
636
|
+
billingCycleCount: number;
|
|
637
|
+
recurrenceMode: 'infinite' | 'finite' | 'nonRecurring';
|
|
638
|
+
}>;
|
|
639
|
+
}>;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Purchase result.
|
|
643
|
+
*/
|
|
644
|
+
export interface PlayPurchase {
|
|
645
|
+
/** Order ID */
|
|
646
|
+
orderId: string;
|
|
647
|
+
/** Package name */
|
|
648
|
+
packageName: string;
|
|
649
|
+
/** Product IDs */
|
|
650
|
+
products: string[];
|
|
651
|
+
/** Purchase time */
|
|
652
|
+
purchaseTime: number;
|
|
653
|
+
/** Purchase state */
|
|
654
|
+
purchaseState: 'purchased' | 'pending' | 'unspecified';
|
|
655
|
+
/** Purchase token */
|
|
656
|
+
purchaseToken: string;
|
|
657
|
+
/** Whether acknowledged */
|
|
658
|
+
isAcknowledged: boolean;
|
|
659
|
+
/** Whether auto-renewing */
|
|
660
|
+
isAutoRenewing: boolean;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Google Play Billing API.
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* // Query products
|
|
667
|
+
* const products = await playBilling.getProducts(['premium', 'coins_100'], 'inapp')
|
|
668
|
+
*
|
|
669
|
+
* // Launch purchase flow
|
|
670
|
+
* const result = await playBilling.purchase('premium')
|
|
671
|
+
*
|
|
672
|
+
* // Check purchases
|
|
673
|
+
* const purchases = await playBilling.getPurchases('inapp')
|
|
674
|
+
*/
|
|
675
|
+
export declare const playBilling: {
|
|
676
|
+
/**
|
|
677
|
+
* Connect to billing service.
|
|
678
|
+
*/
|
|
679
|
+
connect(): Promise<boolean>;
|
|
680
|
+
/**
|
|
681
|
+
* Disconnect from billing service.
|
|
682
|
+
*/
|
|
683
|
+
disconnect(): Promise<void>;
|
|
684
|
+
/**
|
|
685
|
+
* Query product details.
|
|
686
|
+
*/
|
|
687
|
+
getProducts(productIds: string[], productType: "inapp" | "subs"): Promise<PlayProduct[]>;
|
|
688
|
+
/**
|
|
689
|
+
* Launch purchase flow.
|
|
690
|
+
*/
|
|
691
|
+
purchase(productId: string, options?: {
|
|
692
|
+
offerToken?: string;
|
|
693
|
+
isOfferPersonalized?: boolean;
|
|
694
|
+
oldPurchaseToken?: string;
|
|
695
|
+
replacementMode?: "charge_prorated_price" | "charge_full_price" | "without_proration" | "deferred";
|
|
696
|
+
}): Promise<{
|
|
697
|
+
success: boolean;
|
|
698
|
+
purchase?: PlayPurchase;
|
|
699
|
+
error?: string;
|
|
700
|
+
}>;
|
|
701
|
+
/**
|
|
702
|
+
* Get purchases.
|
|
703
|
+
*/
|
|
704
|
+
getPurchases(productType: "inapp" | "subs"): Promise<PlayPurchase[]>;
|
|
705
|
+
/**
|
|
706
|
+
* Acknowledge a purchase.
|
|
707
|
+
*/
|
|
708
|
+
acknowledgePurchase(purchaseToken: string): Promise<boolean>;
|
|
709
|
+
/**
|
|
710
|
+
* Consume a purchase (for consumables).
|
|
711
|
+
*/
|
|
712
|
+
consumePurchase(purchaseToken: string): Promise<boolean>;
|
|
713
|
+
/**
|
|
714
|
+
* Check subscription status.
|
|
715
|
+
*/
|
|
716
|
+
isSubscribed(productId: string): Promise<boolean>;
|
|
717
|
+
/**
|
|
718
|
+
* Listen for purchases updates.
|
|
719
|
+
*/
|
|
720
|
+
onPurchasesUpdated(handler: (purchases: PlayPurchase[]) => void): void;
|
|
721
|
+
/**
|
|
722
|
+
* Show subscription management.
|
|
723
|
+
*/
|
|
724
|
+
showSubscriptionManagement(productId?: string): Promise<void>;
|
|
725
|
+
};
|
|
726
|
+
declare const androidAdvanced: {
|
|
727
|
+
materialYou: typeof materialYou;
|
|
728
|
+
photoPicker: typeof photoPicker;
|
|
729
|
+
workManager: typeof workManager;
|
|
730
|
+
foregroundService: typeof foregroundService;
|
|
731
|
+
predictiveBack: typeof predictiveBack;
|
|
732
|
+
appLanguage: typeof appLanguage;
|
|
733
|
+
widgets: typeof widgets;
|
|
734
|
+
playBilling: typeof playBilling;
|
|
735
|
+
};
|
|
736
|
+
export default androidAdvanced;
|
|
737
|
+
//# sourceMappingURL=android-advanced.d.ts.map
|