@webority-technologies/mobile-core 0.0.6 → 0.0.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/android/build.gradle +65 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/AppSignatureHelper.kt +57 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModule.kt +20 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverModuleImpl.kt +146 -0
- package/android/src/newarch/java/com/webority/mobilecore/smsretriever/SmsRetrieverPackage.kt +33 -0
- package/lib/commonjs/formatters/dateMath.js +4 -4
- package/lib/commonjs/formatters/windowsToIanaTable.js +164 -0
- package/lib/commonjs/geolocation/index.js +9 -1
- package/lib/commonjs/permissions/calendar.js +14 -0
- package/lib/commonjs/permissions/camera.js +14 -0
- package/lib/commonjs/permissions/contacts.js +10 -0
- package/lib/commonjs/permissions/index.js +60 -150
- package/lib/commonjs/permissions/location.js +14 -0
- package/lib/commonjs/permissions/mediaLibrary.js +10 -0
- package/lib/commonjs/permissions/notifications.js +10 -0
- package/lib/commonjs/permissions/photos.js +14 -0
- package/lib/commonjs/smsRetriever/index.js +91 -0
- package/lib/commonjs/specs/NativeSmsRetriever.js +15 -0
- package/lib/commonjs/sqlite/index.js +12 -30
- package/lib/module/formatters/dateMath.js +4 -4
- package/lib/module/formatters/windowsToIanaTable.js +160 -0
- package/lib/module/geolocation/index.js +8 -1
- package/lib/module/index.js +3 -2
- package/lib/module/permissions/calendar.js +15 -0
- package/lib/module/permissions/camera.js +15 -0
- package/lib/module/permissions/contacts.js +11 -0
- package/lib/module/permissions/index.js +59 -150
- package/lib/module/permissions/location.js +15 -0
- package/lib/module/permissions/mediaLibrary.js +11 -0
- package/lib/module/permissions/notifications.js +11 -0
- package/lib/module/permissions/photos.js +15 -0
- package/lib/module/smsRetriever/index.js +86 -0
- package/lib/module/specs/NativeSmsRetriever.js +13 -0
- package/lib/module/sqlite/index.js +12 -30
- package/lib/typescript/commonjs/formatters/windowsToIanaTable.d.ts +18 -0
- package/lib/typescript/commonjs/geolocation/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts +3 -2
- package/lib/typescript/commonjs/permissions/calendar.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/camera.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/contacts.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/index.d.ts +29 -36
- package/lib/typescript/commonjs/permissions/location.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/mediaLibrary.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/notifications.d.ts +2 -0
- package/lib/typescript/commonjs/permissions/photos.d.ts +2 -0
- package/lib/typescript/commonjs/smsRetriever/index.d.ts +30 -0
- package/lib/typescript/commonjs/specs/NativeSmsRetriever.d.ts +15 -0
- package/lib/typescript/commonjs/sqlite/index.d.ts +10 -18
- package/lib/typescript/module/formatters/windowsToIanaTable.d.ts +18 -0
- package/lib/typescript/module/geolocation/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts +3 -2
- package/lib/typescript/module/permissions/calendar.d.ts +2 -0
- package/lib/typescript/module/permissions/camera.d.ts +2 -0
- package/lib/typescript/module/permissions/contacts.d.ts +2 -0
- package/lib/typescript/module/permissions/index.d.ts +29 -36
- package/lib/typescript/module/permissions/location.d.ts +2 -0
- package/lib/typescript/module/permissions/mediaLibrary.d.ts +2 -0
- package/lib/typescript/module/permissions/notifications.d.ts +2 -0
- package/lib/typescript/module/permissions/photos.d.ts +2 -0
- package/lib/typescript/module/smsRetriever/index.d.ts +30 -0
- package/lib/typescript/module/specs/NativeSmsRetriever.d.ts +15 -0
- package/lib/typescript/module/sqlite/index.d.ts +10 -18
- package/package.json +101 -49
- package/lib/commonjs/sqlite/adapters/op.js +0 -43
- package/lib/commonjs/sqlite/adapters/rows.js +0 -33
- package/lib/commonjs/sqlite/adapters/storage.js +0 -50
- package/lib/commonjs/sqlite/adapters/sync.js +0 -45
- package/lib/commonjs/sqlite/nitro.js +0 -17
- package/lib/commonjs/sqlite/op.js +0 -18
- package/lib/commonjs/sqlite/quick.js +0 -14
- package/lib/commonjs/sqlite/storage.js +0 -14
- package/lib/module/sqlite/adapters/op.js +0 -38
- package/lib/module/sqlite/adapters/rows.js +0 -28
- package/lib/module/sqlite/adapters/storage.js +0 -46
- package/lib/module/sqlite/adapters/sync.js +0 -41
- package/lib/module/sqlite/nitro.js +0 -12
- package/lib/module/sqlite/op.js +0 -13
- package/lib/module/sqlite/quick.js +0 -9
- package/lib/module/sqlite/storage.js +0 -9
- package/lib/typescript/commonjs/sqlite/adapters/op.d.ts +0 -27
- package/lib/typescript/commonjs/sqlite/adapters/rows.d.ts +0 -7
- package/lib/typescript/commonjs/sqlite/adapters/storage.d.ts +0 -30
- package/lib/typescript/commonjs/sqlite/adapters/sync.d.ts +0 -31
- package/lib/typescript/commonjs/sqlite/nitro.d.ts +0 -7
- package/lib/typescript/commonjs/sqlite/op.d.ts +0 -8
- package/lib/typescript/commonjs/sqlite/quick.d.ts +0 -4
- package/lib/typescript/commonjs/sqlite/storage.d.ts +0 -4
- package/lib/typescript/module/sqlite/adapters/op.d.ts +0 -27
- package/lib/typescript/module/sqlite/adapters/rows.d.ts +0 -7
- package/lib/typescript/module/sqlite/adapters/storage.d.ts +0 -30
- package/lib/typescript/module/sqlite/adapters/sync.d.ts +0 -31
- package/lib/typescript/module/sqlite/nitro.d.ts +0 -7
- package/lib/typescript/module/sqlite/op.d.ts +0 -8
- package/lib/typescript/module/sqlite/quick.d.ts +0 -4
- package/lib/typescript/module/sqlite/storage.d.ts +0 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Android-only — the Play Services SMS Retriever API has no iOS equivalent.
|
|
7
|
+
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
8
|
+
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
9
|
+
* registered `SmsRetrieverPackage`.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export default TurboModuleRegistry.getEnforcing('WeborityMobileCoreSmsRetriever');
|
|
13
|
+
//# sourceMappingURL=NativeSmsRetriever.js.map
|
|
@@ -5,40 +5,25 @@ import { Logger } from "../logger/index.js";
|
|
|
5
5
|
import { adaptExpoSqlite } from "./adapters/expo.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* setSqliteImplementation(opSqliteDriver());
|
|
16
|
-
*
|
|
17
|
-
* Supported entry points: /sqlite/op, /sqlite/nitro, /sqlite/quick,
|
|
18
|
-
* /sqlite/storage. Any object matching SqliteDriver also works.
|
|
8
|
+
* expo-sqlite is the fleet's only sanctioned SQLite driver (react-native.md:
|
|
9
|
+
* "we will always use expo-sqlite, what Expo gives, we don't look elsewhere
|
|
10
|
+
* ever") — this module resolves it automatically, with no app-side wiring.
|
|
11
|
+
* `setSqliteImplementation` still exists, narrowed to tests and the showcase:
|
|
12
|
+
* it injects a denying/failing backend to reach error paths a healthy device
|
|
13
|
+
* never takes, the same pattern every other injectable surface in this
|
|
14
|
+
* library follows. It is not a way to pick an alternate real driver.
|
|
19
15
|
*/
|
|
20
16
|
|
|
21
17
|
/** Only what a test or an app injected; null means use expo-sqlite. */
|
|
22
18
|
let backend = null;
|
|
23
19
|
|
|
24
|
-
/**
|
|
25
|
-
* expo-sqlite, adapted once and memoised.
|
|
26
|
-
*
|
|
27
|
-
* Unlike the other surfaces this one keeps a real reason to inject: an app with
|
|
28
|
-
* an existing database on another driver (op-sqlite, nitro, quick,
|
|
29
|
-
* sqlite-storage) can hand it over, and those entry points stay published for
|
|
30
|
-
* exactly that. expo-sqlite is simply what happens when nobody does.
|
|
31
|
-
*/
|
|
20
|
+
/** expo-sqlite, adapted once and memoised. The only driver this module resolves. */
|
|
32
21
|
let expoDriver;
|
|
33
22
|
|
|
34
23
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* and defines only this interface. Wire a driver once at startup:
|
|
39
|
-
*
|
|
40
|
-
* import { opSqliteDriver } from '@webority-technologies/mobile-core/sqlite/op';
|
|
41
|
-
* setSqliteImplementation(opSqliteDriver());
|
|
24
|
+
* Test/showcase-only injection point — see the module header. Not a way to
|
|
25
|
+
* pick an alternate real driver; `@webority-technologies/mobile-core` always
|
|
26
|
+
* resolves expo-sqlite when nothing is injected. Pass `null` to clear it.
|
|
42
27
|
*/
|
|
43
28
|
export const setSqliteImplementation = impl => {
|
|
44
29
|
backend = impl;
|
|
@@ -56,10 +41,7 @@ export const isSqliteAvailable = () => resolveDriver() !== null;
|
|
|
56
41
|
const requireBackend = op => {
|
|
57
42
|
const b = resolveDriver();
|
|
58
43
|
if (!b) {
|
|
59
|
-
|
|
60
|
-
// installing a driver alone does nothing here, and the previous wording
|
|
61
|
-
// ("Install one of ...") sent people to fix a thing that was not broken.
|
|
62
|
-
const err = new Error(`[@webority-technologies/mobile-core] No SQLite driver injected; cannot ${op}. ` + 'Install a driver and wire it once at startup, e.g. ' + "`import { opSqliteDriver } from '@webority-technologies/mobile-core/sqlite/op'` " + 'then `setSqliteImplementation(opSqliteDriver())`. Drivers: @op-engineering/op-sqlite ' + '(recommended), expo-sqlite, react-native-nitro-sqlite, react-native-quick-sqlite, ' + 'react-native-sqlite-storage.');
|
|
44
|
+
const err = new Error(`[@webority-technologies/mobile-core] No SQLite driver available; cannot ${op}. ` + 'Install expo-sqlite (the only sanctioned driver) in the consuming app.');
|
|
63
45
|
Logger.error(err.message);
|
|
64
46
|
throw err;
|
|
65
47
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .NET-style Windows time zone ID → IANA time zone name, one entry per
|
|
3
|
+
* Windows zone, generated from CLDR's `windowsZones.xml` (the same
|
|
4
|
+
* upstream source the retired `windows-iana` npm package derived its own
|
|
5
|
+
* table from). Only the `territory="001"` (world-default) row is kept per
|
|
6
|
+
* Windows zone — `formatTimeInWindowsZone` only ever reads the first IANA
|
|
7
|
+
* candidate, and CLDR's `001` row is exactly that default candidate, so
|
|
8
|
+
* per-country territory variants (`US`, `CA`, `ZZ`, …) carry no information
|
|
9
|
+
* this table's one caller uses.
|
|
10
|
+
*
|
|
11
|
+
* Regenerate with `node packages/core/scripts/generate-windows-to-iana-table.mjs
|
|
12
|
+
* <path-to-windowsZones.xml>` (CLDR: `common/supplemental/windowsZones.xml` in
|
|
13
|
+
* https://github.com/unicode-org/cldr) whenever CLDR adds/renames a zone —
|
|
14
|
+
* this is a committed, static table; nothing fetches CLDR at build or test
|
|
15
|
+
* time.
|
|
16
|
+
*/
|
|
17
|
+
export declare const WINDOWS_TO_IANA: Readonly<Record<string, string>>;
|
|
18
|
+
//# sourceMappingURL=windowsToIanaTable.d.ts.map
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* for anyone importing anything at all. Those live behind their own import
|
|
6
6
|
* paths instead:
|
|
7
7
|
*
|
|
8
|
-
* @webority-technologies/mobile-core/permissions
|
|
8
|
+
* @webority-technologies/mobile-core/permissions per kind, its own Expo module
|
|
9
9
|
* @webority-technologies/mobile-core/compressor react-native-compressor
|
|
10
10
|
* @webority-technologies/mobile-core/geolocation a geolocation provider
|
|
11
|
-
* @webority-technologies/mobile-core/sqlite
|
|
11
|
+
* @webority-technologies/mobile-core/sqlite expo-sqlite
|
|
12
12
|
* @webority-technologies/mobile-core/download a filesystem module
|
|
13
|
+
* @webority-technologies/mobile-core/smsRetriever Android only, own TurboModule
|
|
13
14
|
*
|
|
14
15
|
* react-native-keychain is the exception and is a REQUIRED peer: the HTTP client
|
|
15
16
|
* reads the bearer token, so it is reachable from the main barrel by design.
|
|
@@ -1,46 +1,39 @@
|
|
|
1
1
|
export type PermissionKind = 'camera' | 'microphone' | 'photos' | 'photosAdd' | 'mediaLibrary' | 'location' | 'locationAlways' | 'contacts' | 'calendar' | 'reminders' | 'notifications' | 'bluetooth' | 'storage';
|
|
2
2
|
export type PermissionStatus = 'unavailable' | 'denied' | 'limited' | 'granted' | 'blocked';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
/** The shared response shape every Expo permission function returns. */
|
|
4
|
+
interface ExpoPermissionResponse {
|
|
5
|
+
status: 'granted' | 'denied' | 'undetermined';
|
|
6
|
+
granted: boolean;
|
|
7
|
+
canAskAgain: boolean;
|
|
8
|
+
/** iOS partial photo access, from expo-image-picker's MediaLibraryPermissionResponse. */
|
|
9
|
+
accessPrivileges?: 'all' | 'limited' | 'none';
|
|
10
|
+
}
|
|
11
|
+
interface ExpoPermissionFns {
|
|
12
|
+
check: () => Promise<ExpoPermissionResponse>;
|
|
13
|
+
request: () => Promise<ExpoPermissionResponse>;
|
|
14
|
+
}
|
|
15
|
+
export interface PermissionsBackend {
|
|
16
|
+
check: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
17
|
+
request: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Inject a custom permissions
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* `resolved` goes FALSE on null, never true. Marking it resolved with a null
|
|
24
|
-
* backend would permanently disable permissions: the resolver short-circuits and the
|
|
25
|
-
* real module is never loaded again, which contradicts this function's own
|
|
26
|
-
* documented contract. That exact bug shipped once, in the storage seam.
|
|
20
|
+
* Inject a custom permissions backend at runtime. Pass `null` to reset to the
|
|
21
|
+
* default per-kind Expo resolution.
|
|
27
22
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* so on), so there is no single object to adapt and the library must not guess
|
|
32
|
-
* which Expo modules an app installed. react-native-permissions stays, behind
|
|
33
|
-
* this module's own import path so an app that never asks for permissions
|
|
34
|
-
* never names the package to Metro.
|
|
23
|
+
* Two legitimate reasons to call this: tests/the showcase reaching a denied,
|
|
24
|
+
* blocked or unavailable path a healthy device never takes; and an app that
|
|
25
|
+
* genuinely needs `bluetooth` or `storage`, which no Expo module covers.
|
|
35
26
|
*/
|
|
36
|
-
export declare const setPermissionsImplementation: (impl:
|
|
27
|
+
export declare const setPermissionsImplementation: (impl: PermissionsBackend | null) => void;
|
|
28
|
+
/** Called by the per-package entry points to register their kind(s). Not for app code. */
|
|
29
|
+
export declare const registerPermissionAdapter: (kind: PermissionKind, fns: ExpoPermissionFns) => void;
|
|
37
30
|
/**
|
|
38
31
|
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
39
|
-
* (camera, photos, location, notifications, …) to
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
32
|
+
* (camera, photos, location, notifications, …) to whichever Expo adapter an
|
|
33
|
+
* app has registered by importing that kind's entry point — expo-camera,
|
|
34
|
+
* expo-image-picker, expo-location, expo-contacts, expo-calendar,
|
|
35
|
+
* expo-notifications, expo-media-library. An app imports only the entry
|
|
36
|
+
* points for the kinds it actually asks for.
|
|
44
37
|
*/
|
|
45
38
|
export declare const Permissions: {
|
|
46
39
|
check: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
@@ -51,5 +44,5 @@ export declare const Permissions: {
|
|
|
51
44
|
ensure: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
52
45
|
openSettings: () => Promise<boolean>;
|
|
53
46
|
};
|
|
54
|
-
export
|
|
47
|
+
export {};
|
|
55
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SmsRetrieverError {
|
|
2
|
+
type: 'TIMEOUT' | 'SERVICE_UNAVAILABLE' | 'UNKNOWN_ERROR';
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SmsListenerSubscription {
|
|
6
|
+
remove: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface SmsRetrieverBackend {
|
|
9
|
+
getAppHash: () => Promise<string>;
|
|
10
|
+
startListening: (onMessage: (message: string) => void, onError?: (error: SmsRetrieverError) => void) => SmsListenerSubscription;
|
|
11
|
+
}
|
|
12
|
+
/** Test-only injection point. Pass `null` to reset to the native module. */
|
|
13
|
+
export declare const setSmsRetrieverImplementation: (impl: SmsRetrieverBackend | null) => void;
|
|
14
|
+
/**
|
|
15
|
+
* The Play Services SMS Retriever API — auto-reads an incoming OTP SMS with
|
|
16
|
+
* no SMS permission, matched by an 11-character app-signature hash
|
|
17
|
+
* (`getAppHash`) the backend appends to the message. Android only; every
|
|
18
|
+
* method is safe to call on iOS and resolves/reports unavailable rather than
|
|
19
|
+
* throwing, so a caller doesn't need a platform check at every call site.
|
|
20
|
+
*
|
|
21
|
+
* OTP extraction is left to the caller — `onMessage` receives the raw SMS
|
|
22
|
+
* text, since the expected OTP format (digit count, prefix) is a backend
|
|
23
|
+
* concern, not this module's.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SmsRetriever: {
|
|
26
|
+
isAvailable: () => boolean;
|
|
27
|
+
getAppHash: () => Promise<string>;
|
|
28
|
+
startListening: (onMessage: (message: string) => void, onError?: (error: SmsRetrieverError) => void) => SmsListenerSubscription;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Android-only — the Play Services SMS Retriever API has no iOS equivalent.
|
|
4
|
+
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
5
|
+
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
6
|
+
* registered `SmsRetrieverPackage`.
|
|
7
|
+
*/
|
|
8
|
+
export interface Spec extends TurboModule {
|
|
9
|
+
startSMSListener(): void;
|
|
10
|
+
stopSMSListener(): void;
|
|
11
|
+
getAppHash(): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: Spec;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=NativeSmsRetriever.d.ts.map
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* setSqliteImplementation(opSqliteDriver());
|
|
10
|
-
*
|
|
11
|
-
* Supported entry points: /sqlite/op, /sqlite/nitro, /sqlite/quick,
|
|
12
|
-
* /sqlite/storage. Any object matching SqliteDriver also works.
|
|
2
|
+
* expo-sqlite is the fleet's only sanctioned SQLite driver (react-native.md:
|
|
3
|
+
* "we will always use expo-sqlite, what Expo gives, we don't look elsewhere
|
|
4
|
+
* ever") — this module resolves it automatically, with no app-side wiring.
|
|
5
|
+
* `setSqliteImplementation` still exists, narrowed to tests and the showcase:
|
|
6
|
+
* it injects a denying/failing backend to reach error paths a healthy device
|
|
7
|
+
* never takes, the same pattern every other injectable surface in this
|
|
8
|
+
* library follows. It is not a way to pick an alternate real driver.
|
|
13
9
|
*/
|
|
14
10
|
export interface SqliteResultSet {
|
|
15
11
|
rows: Record<string, unknown>[];
|
|
@@ -26,13 +22,9 @@ export interface SqliteDriver {
|
|
|
26
22
|
}) => Promise<SqliteDatabase>;
|
|
27
23
|
}
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* and defines only this interface. Wire a driver once at startup:
|
|
33
|
-
*
|
|
34
|
-
* import { opSqliteDriver } from '@webority-technologies/mobile-core/sqlite/op';
|
|
35
|
-
* setSqliteImplementation(opSqliteDriver());
|
|
25
|
+
* Test/showcase-only injection point — see the module header. Not a way to
|
|
26
|
+
* pick an alternate real driver; `@webority-technologies/mobile-core` always
|
|
27
|
+
* resolves expo-sqlite when nothing is injected. Pass `null` to clear it.
|
|
36
28
|
*/
|
|
37
29
|
export declare const setSqliteImplementation: (impl: SqliteDriver | null) => void;
|
|
38
30
|
export declare const isSqliteAvailable: () => boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .NET-style Windows time zone ID → IANA time zone name, one entry per
|
|
3
|
+
* Windows zone, generated from CLDR's `windowsZones.xml` (the same
|
|
4
|
+
* upstream source the retired `windows-iana` npm package derived its own
|
|
5
|
+
* table from). Only the `territory="001"` (world-default) row is kept per
|
|
6
|
+
* Windows zone — `formatTimeInWindowsZone` only ever reads the first IANA
|
|
7
|
+
* candidate, and CLDR's `001` row is exactly that default candidate, so
|
|
8
|
+
* per-country territory variants (`US`, `CA`, `ZZ`, …) carry no information
|
|
9
|
+
* this table's one caller uses.
|
|
10
|
+
*
|
|
11
|
+
* Regenerate with `node packages/core/scripts/generate-windows-to-iana-table.mjs
|
|
12
|
+
* <path-to-windowsZones.xml>` (CLDR: `common/supplemental/windowsZones.xml` in
|
|
13
|
+
* https://github.com/unicode-org/cldr) whenever CLDR adds/renames a zone —
|
|
14
|
+
* this is a committed, static table; nothing fetches CLDR at build or test
|
|
15
|
+
* time.
|
|
16
|
+
*/
|
|
17
|
+
export declare const WINDOWS_TO_IANA: Readonly<Record<string, string>>;
|
|
18
|
+
//# sourceMappingURL=windowsToIanaTable.d.ts.map
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* for anyone importing anything at all. Those live behind their own import
|
|
6
6
|
* paths instead:
|
|
7
7
|
*
|
|
8
|
-
* @webority-technologies/mobile-core/permissions
|
|
8
|
+
* @webority-technologies/mobile-core/permissions per kind, its own Expo module
|
|
9
9
|
* @webority-technologies/mobile-core/compressor react-native-compressor
|
|
10
10
|
* @webority-technologies/mobile-core/geolocation a geolocation provider
|
|
11
|
-
* @webority-technologies/mobile-core/sqlite
|
|
11
|
+
* @webority-technologies/mobile-core/sqlite expo-sqlite
|
|
12
12
|
* @webority-technologies/mobile-core/download a filesystem module
|
|
13
|
+
* @webority-technologies/mobile-core/smsRetriever Android only, own TurboModule
|
|
13
14
|
*
|
|
14
15
|
* react-native-keychain is the exception and is a REQUIRED peer: the HTTP client
|
|
15
16
|
* reads the bearer token, so it is reachable from the main barrel by design.
|
|
@@ -1,46 +1,39 @@
|
|
|
1
1
|
export type PermissionKind = 'camera' | 'microphone' | 'photos' | 'photosAdd' | 'mediaLibrary' | 'location' | 'locationAlways' | 'contacts' | 'calendar' | 'reminders' | 'notifications' | 'bluetooth' | 'storage';
|
|
2
2
|
export type PermissionStatus = 'unavailable' | 'denied' | 'limited' | 'granted' | 'blocked';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
/** The shared response shape every Expo permission function returns. */
|
|
4
|
+
interface ExpoPermissionResponse {
|
|
5
|
+
status: 'granted' | 'denied' | 'undetermined';
|
|
6
|
+
granted: boolean;
|
|
7
|
+
canAskAgain: boolean;
|
|
8
|
+
/** iOS partial photo access, from expo-image-picker's MediaLibraryPermissionResponse. */
|
|
9
|
+
accessPrivileges?: 'all' | 'limited' | 'none';
|
|
10
|
+
}
|
|
11
|
+
interface ExpoPermissionFns {
|
|
12
|
+
check: () => Promise<ExpoPermissionResponse>;
|
|
13
|
+
request: () => Promise<ExpoPermissionResponse>;
|
|
14
|
+
}
|
|
15
|
+
export interface PermissionsBackend {
|
|
16
|
+
check: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
17
|
+
request: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Inject a custom permissions
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* `resolved` goes FALSE on null, never true. Marking it resolved with a null
|
|
24
|
-
* backend would permanently disable permissions: the resolver short-circuits and the
|
|
25
|
-
* real module is never loaded again, which contradicts this function's own
|
|
26
|
-
* documented contract. That exact bug shipped once, in the storage seam.
|
|
20
|
+
* Inject a custom permissions backend at runtime. Pass `null` to reset to the
|
|
21
|
+
* default per-kind Expo resolution.
|
|
27
22
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* so on), so there is no single object to adapt and the library must not guess
|
|
32
|
-
* which Expo modules an app installed. react-native-permissions stays, behind
|
|
33
|
-
* this module's own import path so an app that never asks for permissions
|
|
34
|
-
* never names the package to Metro.
|
|
23
|
+
* Two legitimate reasons to call this: tests/the showcase reaching a denied,
|
|
24
|
+
* blocked or unavailable path a healthy device never takes; and an app that
|
|
25
|
+
* genuinely needs `bluetooth` or `storage`, which no Expo module covers.
|
|
35
26
|
*/
|
|
36
|
-
export declare const setPermissionsImplementation: (impl:
|
|
27
|
+
export declare const setPermissionsImplementation: (impl: PermissionsBackend | null) => void;
|
|
28
|
+
/** Called by the per-package entry points to register their kind(s). Not for app code. */
|
|
29
|
+
export declare const registerPermissionAdapter: (kind: PermissionKind, fns: ExpoPermissionFns) => void;
|
|
37
30
|
/**
|
|
38
31
|
* Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
|
|
39
|
-
* (camera, photos, location, notifications, …) to
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
32
|
+
* (camera, photos, location, notifications, …) to whichever Expo adapter an
|
|
33
|
+
* app has registered by importing that kind's entry point — expo-camera,
|
|
34
|
+
* expo-image-picker, expo-location, expo-contacts, expo-calendar,
|
|
35
|
+
* expo-notifications, expo-media-library. An app imports only the entry
|
|
36
|
+
* points for the kinds it actually asks for.
|
|
44
37
|
*/
|
|
45
38
|
export declare const Permissions: {
|
|
46
39
|
check: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
@@ -51,5 +44,5 @@ export declare const Permissions: {
|
|
|
51
44
|
ensure: (kind: PermissionKind) => Promise<PermissionStatus>;
|
|
52
45
|
openSettings: () => Promise<boolean>;
|
|
53
46
|
};
|
|
54
|
-
export
|
|
47
|
+
export {};
|
|
55
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SmsRetrieverError {
|
|
2
|
+
type: 'TIMEOUT' | 'SERVICE_UNAVAILABLE' | 'UNKNOWN_ERROR';
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SmsListenerSubscription {
|
|
6
|
+
remove: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface SmsRetrieverBackend {
|
|
9
|
+
getAppHash: () => Promise<string>;
|
|
10
|
+
startListening: (onMessage: (message: string) => void, onError?: (error: SmsRetrieverError) => void) => SmsListenerSubscription;
|
|
11
|
+
}
|
|
12
|
+
/** Test-only injection point. Pass `null` to reset to the native module. */
|
|
13
|
+
export declare const setSmsRetrieverImplementation: (impl: SmsRetrieverBackend | null) => void;
|
|
14
|
+
/**
|
|
15
|
+
* The Play Services SMS Retriever API — auto-reads an incoming OTP SMS with
|
|
16
|
+
* no SMS permission, matched by an 11-character app-signature hash
|
|
17
|
+
* (`getAppHash`) the backend appends to the message. Android only; every
|
|
18
|
+
* method is safe to call on iOS and resolves/reports unavailable rather than
|
|
19
|
+
* throwing, so a caller doesn't need a platform check at every call site.
|
|
20
|
+
*
|
|
21
|
+
* OTP extraction is left to the caller — `onMessage` receives the raw SMS
|
|
22
|
+
* text, since the expected OTP format (digit count, prefix) is a backend
|
|
23
|
+
* concern, not this module's.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SmsRetriever: {
|
|
26
|
+
isAvailable: () => boolean;
|
|
27
|
+
getAppHash: () => Promise<string>;
|
|
28
|
+
startListening: (onMessage: (message: string) => void, onError?: (error: SmsRetrieverError) => void) => SmsListenerSubscription;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Android-only — the Play Services SMS Retriever API has no iOS equivalent.
|
|
4
|
+
* The JS wrapper in `smsRetriever/index.ts` never touches this module on
|
|
5
|
+
* iOS, so `getEnforcing` only ever runs on Android, where autolinking has
|
|
6
|
+
* registered `SmsRetrieverPackage`.
|
|
7
|
+
*/
|
|
8
|
+
export interface Spec extends TurboModule {
|
|
9
|
+
startSMSListener(): void;
|
|
10
|
+
stopSMSListener(): void;
|
|
11
|
+
getAppHash(): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: Spec;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=NativeSmsRetriever.d.ts.map
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* setSqliteImplementation(opSqliteDriver());
|
|
10
|
-
*
|
|
11
|
-
* Supported entry points: /sqlite/op, /sqlite/nitro, /sqlite/quick,
|
|
12
|
-
* /sqlite/storage. Any object matching SqliteDriver also works.
|
|
2
|
+
* expo-sqlite is the fleet's only sanctioned SQLite driver (react-native.md:
|
|
3
|
+
* "we will always use expo-sqlite, what Expo gives, we don't look elsewhere
|
|
4
|
+
* ever") — this module resolves it automatically, with no app-side wiring.
|
|
5
|
+
* `setSqliteImplementation` still exists, narrowed to tests and the showcase:
|
|
6
|
+
* it injects a denying/failing backend to reach error paths a healthy device
|
|
7
|
+
* never takes, the same pattern every other injectable surface in this
|
|
8
|
+
* library follows. It is not a way to pick an alternate real driver.
|
|
13
9
|
*/
|
|
14
10
|
export interface SqliteResultSet {
|
|
15
11
|
rows: Record<string, unknown>[];
|
|
@@ -26,13 +22,9 @@ export interface SqliteDriver {
|
|
|
26
22
|
}) => Promise<SqliteDatabase>;
|
|
27
23
|
}
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* and defines only this interface. Wire a driver once at startup:
|
|
33
|
-
*
|
|
34
|
-
* import { opSqliteDriver } from '@webority-technologies/mobile-core/sqlite/op';
|
|
35
|
-
* setSqliteImplementation(opSqliteDriver());
|
|
25
|
+
* Test/showcase-only injection point — see the module header. Not a way to
|
|
26
|
+
* pick an alternate real driver; `@webority-technologies/mobile-core` always
|
|
27
|
+
* resolves expo-sqlite when nothing is injected. Pass `null` to clear it.
|
|
36
28
|
*/
|
|
37
29
|
export declare const setSqliteImplementation: (impl: SqliteDriver | null) => void;
|
|
38
30
|
export declare const isSqliteAvailable: () => boolean;
|