@webority-technologies/mobile-core 0.0.7 → 0.0.9

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.
Files changed (38) hide show
  1. package/lib/commonjs/geolocation/index.js +8 -0
  2. package/lib/commonjs/permissions/calendar.js +14 -0
  3. package/lib/commonjs/permissions/camera.js +14 -0
  4. package/lib/commonjs/permissions/contacts.js +10 -0
  5. package/lib/commonjs/permissions/index.js +28 -117
  6. package/lib/commonjs/permissions/location.js +14 -0
  7. package/lib/commonjs/permissions/mediaLibrary.js +10 -0
  8. package/lib/commonjs/permissions/notifications.js +10 -0
  9. package/lib/commonjs/permissions/photos.js +14 -0
  10. package/lib/module/geolocation/index.js +7 -0
  11. package/lib/module/permissions/calendar.js +15 -0
  12. package/lib/module/permissions/camera.js +15 -0
  13. package/lib/module/permissions/contacts.js +11 -0
  14. package/lib/module/permissions/index.js +26 -116
  15. package/lib/module/permissions/location.js +15 -0
  16. package/lib/module/permissions/mediaLibrary.js +11 -0
  17. package/lib/module/permissions/notifications.js +11 -0
  18. package/lib/module/permissions/photos.js +15 -0
  19. package/lib/typescript/commonjs/geolocation/index.d.ts +1 -0
  20. package/lib/typescript/commonjs/permissions/calendar.d.ts +2 -0
  21. package/lib/typescript/commonjs/permissions/camera.d.ts +2 -0
  22. package/lib/typescript/commonjs/permissions/contacts.d.ts +2 -0
  23. package/lib/typescript/commonjs/permissions/index.d.ts +20 -5
  24. package/lib/typescript/commonjs/permissions/location.d.ts +2 -0
  25. package/lib/typescript/commonjs/permissions/mediaLibrary.d.ts +2 -0
  26. package/lib/typescript/commonjs/permissions/notifications.d.ts +2 -0
  27. package/lib/typescript/commonjs/permissions/photos.d.ts +2 -0
  28. package/lib/typescript/module/geolocation/index.d.ts +1 -0
  29. package/lib/typescript/module/permissions/calendar.d.ts +2 -0
  30. package/lib/typescript/module/permissions/camera.d.ts +2 -0
  31. package/lib/typescript/module/permissions/contacts.d.ts +2 -0
  32. package/lib/typescript/module/permissions/index.d.ts +20 -5
  33. package/lib/typescript/module/permissions/location.d.ts +2 -0
  34. package/lib/typescript/module/permissions/mediaLibrary.d.ts +2 -0
  35. package/lib/typescript/module/permissions/notifications.d.ts +2 -0
  36. package/lib/typescript/module/permissions/photos.d.ts +2 -0
  37. package/package.json +72 -1
  38. package/src/specs/NativeSmsRetriever.ts +16 -0
@@ -8,8 +8,16 @@ var ExpoLocation = _interopRequireWildcard(require("expo-location"));
8
8
  var _react = require("react");
9
9
  var _index = require("../logger/index.js");
10
10
  var _index2 = require("../permissions/index.js");
11
+ require("../permissions/location.js");
11
12
  var _expoLocation2 = require("./adapters/expoLocation.js");
12
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ // expo-location is a REQUIRED peer (unlike the other Expo permission
15
+ // packages, which are optional and registered only when an app opts in by
16
+ // importing their own entry point) — anything that reaches this module
17
+ // already forces Metro to resolve expo-location, so self-registering its
18
+ // permission kinds here costs nothing extra and makes Geolocation's
19
+ // permission gating work without a separate app-level import.
20
+
13
21
  const PREFIX = '[@webority-technologies/mobile-core]';
14
22
  class GeolocationError extends Error {
15
23
  constructor(code, message) {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _index = require("./index.js");
4
+ /** The one place `expo-calendar` is named. Import only if you use calendar/reminders. */
5
+ const m = require('expo-calendar');
6
+ (0, _index.registerPermissionAdapter)('calendar', {
7
+ check: m.getCalendarPermissionsAsync,
8
+ request: m.requestCalendarPermissionsAsync
9
+ });
10
+ (0, _index.registerPermissionAdapter)('reminders', {
11
+ check: m.getRemindersPermissionsAsync,
12
+ request: m.requestRemindersPermissionsAsync
13
+ });
14
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _index = require("./index.js");
4
+ /** The one place `expo-camera` is named. Import only if you use camera/microphone. */
5
+ const m = require('expo-camera');
6
+ (0, _index.registerPermissionAdapter)('camera', {
7
+ check: m.getCameraPermissionsAsync,
8
+ request: m.requestCameraPermissionsAsync
9
+ });
10
+ (0, _index.registerPermissionAdapter)('microphone', {
11
+ check: m.getMicrophonePermissionsAsync,
12
+ request: m.requestMicrophonePermissionsAsync
13
+ });
14
+ //# sourceMappingURL=camera.js.map
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ var _index = require("./index.js");
4
+ /** The one place `expo-contacts` is named. Import only if you use contacts. */
5
+ const m = require('expo-contacts');
6
+ (0, _index.registerPermissionAdapter)('contacts', {
7
+ check: m.getPermissionsAsync,
8
+ request: m.requestPermissionsAsync
9
+ });
10
+ //# sourceMappingURL=contacts.js.map
@@ -3,23 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setPermissionsImplementation = exports.Permissions = void 0;
6
+ exports.setPermissionsImplementation = exports.registerPermissionAdapter = exports.Permissions = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _index = require("../logger/index.js");
9
9
  // Android only — legacy WRITE_EXTERNAL_STORAGE
10
10
 
11
11
  /** The shared response shape every Expo permission function returns. */
12
12
 
13
- /**
14
- * Every permission-bearing kind resolves through its own Expo module — no
15
- * single "permissions package" exists, so each kind names the one Expo module
16
- * that owns it and is required lazily, the same discipline every other Expo
17
- * surface in this library follows (an app that never asks for a permission
18
- * never names its package to Metro). `bluetooth` and `storage` have no Expo
19
- * module at all; they resolve through `setPermissionsImplementation` only,
20
- * same as the test/showcase injection seam every other surface has.
21
- *
22
- */
23
13
  let backend = null;
24
14
 
25
15
  /**
@@ -33,109 +23,30 @@ let backend = null;
33
23
  const setPermissionsImplementation = impl => {
34
24
  backend = impl;
35
25
  };
26
+
27
+ /**
28
+ * Populated by the per-package entry points (`./camera`, `./photos`, …), never
29
+ * by this file. This module names NO Expo package — Metro resolves every
30
+ * literal require() reachable from the static import graph regardless of
31
+ * which switch branch would have run, so naming seven packages here would
32
+ * make each one a mandatory install for every consumer, whichever kinds they
33
+ * actually use. An app wires only the kinds it needs:
34
+ *
35
+ * import '@webority-technologies/mobile-core/permissions/camera';
36
+ * import '@webority-technologies/mobile-core/permissions/location';
37
+ *
38
+ * `bluetooth` and `storage` have no Expo module and are never registered here
39
+ * — they resolve through `setPermissionsImplementation` only.
40
+ */
36
41
  exports.setPermissionsImplementation = setPermissionsImplementation;
37
- const resolveExpoModule = kind => {
38
- try {
39
- switch (kind) {
40
- case 'camera':
41
- {
42
- const m = require('expo-camera');
43
- return {
44
- check: m.getCameraPermissionsAsync,
45
- request: m.requestCameraPermissionsAsync
46
- };
47
- }
48
- case 'microphone':
49
- {
50
- const m = require('expo-camera');
51
- return {
52
- check: m.getMicrophonePermissionsAsync,
53
- request: m.requestMicrophonePermissionsAsync
54
- };
55
- }
56
- case 'photos':
57
- {
58
- const m = require('expo-image-picker');
59
- return {
60
- check: () => m.getMediaLibraryPermissionsAsync(false),
61
- request: () => m.requestMediaLibraryPermissionsAsync(false)
62
- };
63
- }
64
- case 'photosAdd':
65
- {
66
- const m = require('expo-image-picker');
67
- return {
68
- check: () => m.getMediaLibraryPermissionsAsync(true),
69
- request: () => m.requestMediaLibraryPermissionsAsync(true)
70
- };
71
- }
72
- case 'mediaLibrary':
73
- {
74
- const m = require('expo-media-library');
75
- return {
76
- check: m.getPermissionsAsync,
77
- request: m.requestPermissionsAsync
78
- };
79
- }
80
- case 'location':
81
- {
82
- const m = require('expo-location');
83
- return {
84
- check: m.getForegroundPermissionsAsync,
85
- request: m.requestForegroundPermissionsAsync
86
- };
87
- }
88
- case 'locationAlways':
89
- {
90
- const m = require('expo-location');
91
- return {
92
- check: m.getBackgroundPermissionsAsync,
93
- request: m.requestBackgroundPermissionsAsync
94
- };
95
- }
96
- case 'contacts':
97
- {
98
- const m = require('expo-contacts');
99
- return {
100
- check: m.getPermissionsAsync,
101
- request: m.requestPermissionsAsync
102
- };
103
- }
104
- case 'calendar':
105
- {
106
- const m = require('expo-calendar');
107
- return {
108
- check: m.getCalendarPermissionsAsync,
109
- request: m.requestCalendarPermissionsAsync
110
- };
111
- }
112
- case 'reminders':
113
- {
114
- const m = require('expo-calendar');
115
- return {
116
- check: m.getRemindersPermissionsAsync,
117
- request: m.requestRemindersPermissionsAsync
118
- };
119
- }
120
- case 'notifications':
121
- {
122
- const m = require('expo-notifications');
123
- return {
124
- check: m.getPermissionsAsync,
125
- request: m.requestPermissionsAsync
126
- };
127
- }
128
- case 'bluetooth':
129
- case 'storage':
130
- // No Expo module covers either — the injected backend is the only path.
131
- return null;
132
- default:
133
- return null;
134
- }
135
- } catch {
136
- return null;
137
- }
42
+ const registry = new Map();
43
+
44
+ /** Called by the per-package entry points to register their kind(s). Not for app code. */
45
+ const registerPermissionAdapter = (kind, fns) => {
46
+ registry.set(kind, fns);
138
47
  };
48
+ exports.registerPermissionAdapter = registerPermissionAdapter;
49
+ const resolveExpoModule = kind => registry.get(kind) ?? null;
139
50
  const toStatus = response => {
140
51
  if (!response) {
141
52
  return 'unavailable';
@@ -195,11 +106,11 @@ const openAppSettings = async () => {
195
106
 
196
107
  /**
197
108
  * Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
198
- * (camera, photos, location, notifications, …) to the Expo module that owns
199
- * it under the hood — expo-camera, expo-image-picker, expo-location,
200
- * expo-contacts, expo-calendar, expo-notifications, expo-media-library. Every
201
- * one is an optional peer, required lazily; an app installs only the modules
202
- * whose kinds it actually asks for.
109
+ * (camera, photos, location, notifications, …) to whichever Expo adapter an
110
+ * app has registered by importing that kind's entry point — expo-camera,
111
+ * expo-image-picker, expo-location, expo-contacts, expo-calendar,
112
+ * expo-notifications, expo-media-library. An app imports only the entry
113
+ * points for the kinds it actually asks for.
203
114
  */
204
115
  const Permissions = exports.Permissions = {
205
116
  check: checkPermission,
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _index = require("./index.js");
4
+ /** The one place `expo-location` is named. Import only if you use location/locationAlways. */
5
+ const m = require('expo-location');
6
+ (0, _index.registerPermissionAdapter)('location', {
7
+ check: m.getForegroundPermissionsAsync,
8
+ request: m.requestForegroundPermissionsAsync
9
+ });
10
+ (0, _index.registerPermissionAdapter)('locationAlways', {
11
+ check: m.getBackgroundPermissionsAsync,
12
+ request: m.requestBackgroundPermissionsAsync
13
+ });
14
+ //# sourceMappingURL=location.js.map
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ var _index = require("./index.js");
4
+ /** The one place `expo-media-library` is named. Import only if you use mediaLibrary. */
5
+ const m = require('expo-media-library');
6
+ (0, _index.registerPermissionAdapter)('mediaLibrary', {
7
+ check: m.getPermissionsAsync,
8
+ request: m.requestPermissionsAsync
9
+ });
10
+ //# sourceMappingURL=mediaLibrary.js.map
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ var _index = require("./index.js");
4
+ /** The one place `expo-notifications` is named. Import only if you use notifications. */
5
+ const m = require('expo-notifications');
6
+ (0, _index.registerPermissionAdapter)('notifications', {
7
+ check: m.getPermissionsAsync,
8
+ request: m.requestPermissionsAsync
9
+ });
10
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _index = require("./index.js");
4
+ /** The one place `expo-image-picker` is named. Import only if you use photos/photosAdd. */
5
+ const m = require('expo-image-picker');
6
+ (0, _index.registerPermissionAdapter)('photos', {
7
+ check: () => m.getMediaLibraryPermissionsAsync(false),
8
+ request: () => m.requestMediaLibraryPermissionsAsync(false)
9
+ });
10
+ (0, _index.registerPermissionAdapter)('photosAdd', {
11
+ check: () => m.getMediaLibraryPermissionsAsync(true),
12
+ request: () => m.requestMediaLibraryPermissionsAsync(true)
13
+ });
14
+ //# sourceMappingURL=photos.js.map
@@ -4,6 +4,13 @@ import * as ExpoLocation from 'expo-location';
4
4
  import { useCallback, useEffect, useRef, useState } from 'react';
5
5
  import { Logger } from "../logger/index.js";
6
6
  import { Permissions } from "../permissions/index.js";
7
+ // expo-location is a REQUIRED peer (unlike the other Expo permission
8
+ // packages, which are optional and registered only when an app opts in by
9
+ // importing their own entry point) — anything that reaches this module
10
+ // already forces Metro to resolve expo-location, so self-registering its
11
+ // permission kinds here costs nothing extra and makes Geolocation's
12
+ // permission gating work without a separate app-level import.
13
+ import "../permissions/location.js";
7
14
  import { adaptExpoLocation } from "./adapters/expoLocation.js";
8
15
  const PREFIX = '[@webority-technologies/mobile-core]';
9
16
  export class GeolocationError extends Error {
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { registerPermissionAdapter } from "./index.js";
4
+
5
+ /** The one place `expo-calendar` is named. Import only if you use calendar/reminders. */
6
+ const m = require('expo-calendar');
7
+ registerPermissionAdapter('calendar', {
8
+ check: m.getCalendarPermissionsAsync,
9
+ request: m.requestCalendarPermissionsAsync
10
+ });
11
+ registerPermissionAdapter('reminders', {
12
+ check: m.getRemindersPermissionsAsync,
13
+ request: m.requestRemindersPermissionsAsync
14
+ });
15
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { registerPermissionAdapter } from "./index.js";
4
+
5
+ /** The one place `expo-camera` is named. Import only if you use camera/microphone. */
6
+ const m = require('expo-camera');
7
+ registerPermissionAdapter('camera', {
8
+ check: m.getCameraPermissionsAsync,
9
+ request: m.requestCameraPermissionsAsync
10
+ });
11
+ registerPermissionAdapter('microphone', {
12
+ check: m.getMicrophonePermissionsAsync,
13
+ request: m.requestMicrophonePermissionsAsync
14
+ });
15
+ //# sourceMappingURL=camera.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import { registerPermissionAdapter } from "./index.js";
4
+
5
+ /** The one place `expo-contacts` is named. Import only if you use contacts. */
6
+ const m = require('expo-contacts');
7
+ registerPermissionAdapter('contacts', {
8
+ check: m.getPermissionsAsync,
9
+ request: m.requestPermissionsAsync
10
+ });
11
+ //# sourceMappingURL=contacts.js.map
@@ -7,16 +7,6 @@ import { Logger } from "../logger/index.js";
7
7
 
8
8
  /** The shared response shape every Expo permission function returns. */
9
9
 
10
- /**
11
- * Every permission-bearing kind resolves through its own Expo module — no
12
- * single "permissions package" exists, so each kind names the one Expo module
13
- * that owns it and is required lazily, the same discipline every other Expo
14
- * surface in this library follows (an app that never asks for a permission
15
- * never names its package to Metro). `bluetooth` and `storage` have no Expo
16
- * module at all; they resolve through `setPermissionsImplementation` only,
17
- * same as the test/showcase injection seam every other surface has.
18
- *
19
- */
20
10
  let backend = null;
21
11
 
22
12
  /**
@@ -30,108 +20,28 @@ let backend = null;
30
20
  export const setPermissionsImplementation = impl => {
31
21
  backend = impl;
32
22
  };
33
- const resolveExpoModule = kind => {
34
- try {
35
- switch (kind) {
36
- case 'camera':
37
- {
38
- const m = require('expo-camera');
39
- return {
40
- check: m.getCameraPermissionsAsync,
41
- request: m.requestCameraPermissionsAsync
42
- };
43
- }
44
- case 'microphone':
45
- {
46
- const m = require('expo-camera');
47
- return {
48
- check: m.getMicrophonePermissionsAsync,
49
- request: m.requestMicrophonePermissionsAsync
50
- };
51
- }
52
- case 'photos':
53
- {
54
- const m = require('expo-image-picker');
55
- return {
56
- check: () => m.getMediaLibraryPermissionsAsync(false),
57
- request: () => m.requestMediaLibraryPermissionsAsync(false)
58
- };
59
- }
60
- case 'photosAdd':
61
- {
62
- const m = require('expo-image-picker');
63
- return {
64
- check: () => m.getMediaLibraryPermissionsAsync(true),
65
- request: () => m.requestMediaLibraryPermissionsAsync(true)
66
- };
67
- }
68
- case 'mediaLibrary':
69
- {
70
- const m = require('expo-media-library');
71
- return {
72
- check: m.getPermissionsAsync,
73
- request: m.requestPermissionsAsync
74
- };
75
- }
76
- case 'location':
77
- {
78
- const m = require('expo-location');
79
- return {
80
- check: m.getForegroundPermissionsAsync,
81
- request: m.requestForegroundPermissionsAsync
82
- };
83
- }
84
- case 'locationAlways':
85
- {
86
- const m = require('expo-location');
87
- return {
88
- check: m.getBackgroundPermissionsAsync,
89
- request: m.requestBackgroundPermissionsAsync
90
- };
91
- }
92
- case 'contacts':
93
- {
94
- const m = require('expo-contacts');
95
- return {
96
- check: m.getPermissionsAsync,
97
- request: m.requestPermissionsAsync
98
- };
99
- }
100
- case 'calendar':
101
- {
102
- const m = require('expo-calendar');
103
- return {
104
- check: m.getCalendarPermissionsAsync,
105
- request: m.requestCalendarPermissionsAsync
106
- };
107
- }
108
- case 'reminders':
109
- {
110
- const m = require('expo-calendar');
111
- return {
112
- check: m.getRemindersPermissionsAsync,
113
- request: m.requestRemindersPermissionsAsync
114
- };
115
- }
116
- case 'notifications':
117
- {
118
- const m = require('expo-notifications');
119
- return {
120
- check: m.getPermissionsAsync,
121
- request: m.requestPermissionsAsync
122
- };
123
- }
124
- case 'bluetooth':
125
- case 'storage':
126
- // No Expo module covers either — the injected backend is the only path.
127
- return null;
128
- default:
129
- return null;
130
- }
131
- } catch {
132
- return null;
133
- }
23
+
24
+ /**
25
+ * Populated by the per-package entry points (`./camera`, `./photos`, …), never
26
+ * by this file. This module names NO Expo package — Metro resolves every
27
+ * literal require() reachable from the static import graph regardless of
28
+ * which switch branch would have run, so naming seven packages here would
29
+ * make each one a mandatory install for every consumer, whichever kinds they
30
+ * actually use. An app wires only the kinds it needs:
31
+ *
32
+ * import '@webority-technologies/mobile-core/permissions/camera';
33
+ * import '@webority-technologies/mobile-core/permissions/location';
34
+ *
35
+ * `bluetooth` and `storage` have no Expo module and are never registered here
36
+ * they resolve through `setPermissionsImplementation` only.
37
+ */
38
+ const registry = new Map();
39
+
40
+ /** Called by the per-package entry points to register their kind(s). Not for app code. */
41
+ export const registerPermissionAdapter = (kind, fns) => {
42
+ registry.set(kind, fns);
134
43
  };
44
+ const resolveExpoModule = kind => registry.get(kind) ?? null;
135
45
  const toStatus = response => {
136
46
  if (!response) {
137
47
  return 'unavailable';
@@ -191,11 +101,11 @@ const openAppSettings = async () => {
191
101
 
192
102
  /**
193
103
  * Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
194
- * (camera, photos, location, notifications, …) to the Expo module that owns
195
- * it under the hood — expo-camera, expo-image-picker, expo-location,
196
- * expo-contacts, expo-calendar, expo-notifications, expo-media-library. Every
197
- * one is an optional peer, required lazily; an app installs only the modules
198
- * whose kinds it actually asks for.
104
+ * (camera, photos, location, notifications, …) to whichever Expo adapter an
105
+ * app has registered by importing that kind's entry point — expo-camera,
106
+ * expo-image-picker, expo-location, expo-contacts, expo-calendar,
107
+ * expo-notifications, expo-media-library. An app imports only the entry
108
+ * points for the kinds it actually asks for.
199
109
  */
200
110
  export const Permissions = {
201
111
  check: checkPermission,
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { registerPermissionAdapter } from "./index.js";
4
+
5
+ /** The one place `expo-location` is named. Import only if you use location/locationAlways. */
6
+ const m = require('expo-location');
7
+ registerPermissionAdapter('location', {
8
+ check: m.getForegroundPermissionsAsync,
9
+ request: m.requestForegroundPermissionsAsync
10
+ });
11
+ registerPermissionAdapter('locationAlways', {
12
+ check: m.getBackgroundPermissionsAsync,
13
+ request: m.requestBackgroundPermissionsAsync
14
+ });
15
+ //# sourceMappingURL=location.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import { registerPermissionAdapter } from "./index.js";
4
+
5
+ /** The one place `expo-media-library` is named. Import only if you use mediaLibrary. */
6
+ const m = require('expo-media-library');
7
+ registerPermissionAdapter('mediaLibrary', {
8
+ check: m.getPermissionsAsync,
9
+ request: m.requestPermissionsAsync
10
+ });
11
+ //# sourceMappingURL=mediaLibrary.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import { registerPermissionAdapter } from "./index.js";
4
+
5
+ /** The one place `expo-notifications` is named. Import only if you use notifications. */
6
+ const m = require('expo-notifications');
7
+ registerPermissionAdapter('notifications', {
8
+ check: m.getPermissionsAsync,
9
+ request: m.requestPermissionsAsync
10
+ });
11
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { registerPermissionAdapter } from "./index.js";
4
+
5
+ /** The one place `expo-image-picker` is named. Import only if you use photos/photosAdd. */
6
+ const m = require('expo-image-picker');
7
+ registerPermissionAdapter('photos', {
8
+ check: () => m.getMediaLibraryPermissionsAsync(false),
9
+ request: () => m.requestMediaLibraryPermissionsAsync(false)
10
+ });
11
+ registerPermissionAdapter('photosAdd', {
12
+ check: () => m.getMediaLibraryPermissionsAsync(true),
13
+ request: () => m.requestMediaLibraryPermissionsAsync(true)
14
+ });
15
+ //# sourceMappingURL=photos.js.map
@@ -1,3 +1,4 @@
1
+ import '../permissions/location';
1
2
  export interface GeoCoordinates {
2
3
  latitude: number;
3
4
  longitude: number;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=camera.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contacts.d.ts.map
@@ -1,5 +1,17 @@
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
+ /** 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
+ }
3
15
  export interface PermissionsBackend {
4
16
  check: (kind: PermissionKind) => Promise<PermissionStatus>;
5
17
  request: (kind: PermissionKind) => Promise<PermissionStatus>;
@@ -13,13 +25,15 @@ export interface PermissionsBackend {
13
25
  * genuinely needs `bluetooth` or `storage`, which no Expo module covers.
14
26
  */
15
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;
16
30
  /**
17
31
  * Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
18
- * (camera, photos, location, notifications, …) to the Expo module that owns
19
- * it under the hood — expo-camera, expo-image-picker, expo-location,
20
- * expo-contacts, expo-calendar, expo-notifications, expo-media-library. Every
21
- * one is an optional peer, required lazily; an app installs only the modules
22
- * whose kinds it actually asks for.
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.
23
37
  */
24
38
  export declare const Permissions: {
25
39
  check: (kind: PermissionKind) => Promise<PermissionStatus>;
@@ -30,4 +44,5 @@ export declare const Permissions: {
30
44
  ensure: (kind: PermissionKind) => Promise<PermissionStatus>;
31
45
  openSettings: () => Promise<boolean>;
32
46
  };
47
+ export {};
33
48
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=location.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mediaLibrary.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=notifications.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=photos.d.ts.map
@@ -1,3 +1,4 @@
1
+ import '../permissions/location.js';
1
2
  export interface GeoCoordinates {
2
3
  latitude: number;
3
4
  longitude: number;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=camera.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contacts.d.ts.map
@@ -1,5 +1,17 @@
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
+ /** 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
+ }
3
15
  export interface PermissionsBackend {
4
16
  check: (kind: PermissionKind) => Promise<PermissionStatus>;
5
17
  request: (kind: PermissionKind) => Promise<PermissionStatus>;
@@ -13,13 +25,15 @@ export interface PermissionsBackend {
13
25
  * genuinely needs `bluetooth` or `storage`, which no Expo module covers.
14
26
  */
15
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;
16
30
  /**
17
31
  * Cross-platform permissions wrapper. Maps an abstract `PermissionKind`
18
- * (camera, photos, location, notifications, …) to the Expo module that owns
19
- * it under the hood — expo-camera, expo-image-picker, expo-location,
20
- * expo-contacts, expo-calendar, expo-notifications, expo-media-library. Every
21
- * one is an optional peer, required lazily; an app installs only the modules
22
- * whose kinds it actually asks for.
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.
23
37
  */
24
38
  export declare const Permissions: {
25
39
  check: (kind: PermissionKind) => Promise<PermissionStatus>;
@@ -30,4 +44,5 @@ export declare const Permissions: {
30
44
  ensure: (kind: PermissionKind) => Promise<PermissionStatus>;
31
45
  openSettings: () => Promise<boolean>;
32
46
  };
47
+ export {};
33
48
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=location.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mediaLibrary.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=notifications.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=photos.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority-technologies/mobile-core",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage and version checks. No UI.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -41,6 +41,76 @@
41
41
  "default": "./lib/commonjs/permissions/index.js"
42
42
  }
43
43
  },
44
+ "./permissions/camera": {
45
+ "import": {
46
+ "types": "./lib/typescript/module/permissions/camera.d.ts",
47
+ "default": "./lib/module/permissions/camera.js"
48
+ },
49
+ "require": {
50
+ "types": "./lib/typescript/commonjs/permissions/camera.d.ts",
51
+ "default": "./lib/commonjs/permissions/camera.js"
52
+ }
53
+ },
54
+ "./permissions/photos": {
55
+ "import": {
56
+ "types": "./lib/typescript/module/permissions/photos.d.ts",
57
+ "default": "./lib/module/permissions/photos.js"
58
+ },
59
+ "require": {
60
+ "types": "./lib/typescript/commonjs/permissions/photos.d.ts",
61
+ "default": "./lib/commonjs/permissions/photos.js"
62
+ }
63
+ },
64
+ "./permissions/mediaLibrary": {
65
+ "import": {
66
+ "types": "./lib/typescript/module/permissions/mediaLibrary.d.ts",
67
+ "default": "./lib/module/permissions/mediaLibrary.js"
68
+ },
69
+ "require": {
70
+ "types": "./lib/typescript/commonjs/permissions/mediaLibrary.d.ts",
71
+ "default": "./lib/commonjs/permissions/mediaLibrary.js"
72
+ }
73
+ },
74
+ "./permissions/location": {
75
+ "import": {
76
+ "types": "./lib/typescript/module/permissions/location.d.ts",
77
+ "default": "./lib/module/permissions/location.js"
78
+ },
79
+ "require": {
80
+ "types": "./lib/typescript/commonjs/permissions/location.d.ts",
81
+ "default": "./lib/commonjs/permissions/location.js"
82
+ }
83
+ },
84
+ "./permissions/contacts": {
85
+ "import": {
86
+ "types": "./lib/typescript/module/permissions/contacts.d.ts",
87
+ "default": "./lib/module/permissions/contacts.js"
88
+ },
89
+ "require": {
90
+ "types": "./lib/typescript/commonjs/permissions/contacts.d.ts",
91
+ "default": "./lib/commonjs/permissions/contacts.js"
92
+ }
93
+ },
94
+ "./permissions/calendar": {
95
+ "import": {
96
+ "types": "./lib/typescript/module/permissions/calendar.d.ts",
97
+ "default": "./lib/module/permissions/calendar.js"
98
+ },
99
+ "require": {
100
+ "types": "./lib/typescript/commonjs/permissions/calendar.d.ts",
101
+ "default": "./lib/commonjs/permissions/calendar.js"
102
+ }
103
+ },
104
+ "./permissions/notifications": {
105
+ "import": {
106
+ "types": "./lib/typescript/module/permissions/notifications.d.ts",
107
+ "default": "./lib/module/permissions/notifications.js"
108
+ },
109
+ "require": {
110
+ "types": "./lib/typescript/commonjs/permissions/notifications.d.ts",
111
+ "default": "./lib/commonjs/permissions/notifications.js"
112
+ }
113
+ },
44
114
  "./geolocation": {
45
115
  "import": {
46
116
  "types": "./lib/typescript/module/geolocation/index.d.ts",
@@ -89,6 +159,7 @@
89
159
  "types": "./lib/typescript/commonjs/index.d.ts",
90
160
  "files": [
91
161
  "lib",
162
+ "src/specs",
92
163
  "android",
93
164
  "!**/__tests__",
94
165
  "!**/*.test.*",
@@ -0,0 +1,16 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ /**
5
+ * Android-only — the Play Services SMS Retriever API has no iOS equivalent.
6
+ * The JS wrapper in `smsRetriever/index.ts` never touches this module on
7
+ * iOS, so `getEnforcing` only ever runs on Android, where autolinking has
8
+ * registered `SmsRetrieverPackage`.
9
+ */
10
+ export interface Spec extends TurboModule {
11
+ startSMSListener(): void;
12
+ stopSMSListener(): void;
13
+ getAppHash(): Promise<string>;
14
+ }
15
+
16
+ export default TurboModuleRegistry.getEnforcing<Spec>('WeborityMobileCoreSmsRetriever') as Spec;