@symbiote-native/application 0.0.1
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 +21 -0
- package/README.md +223 -0
- package/build/angular/index.d.ts +1 -0
- package/build/angular/index.js +4 -0
- package/build/core/application.d.ts +77 -0
- package/build/core/application.js +119 -0
- package/build/core/index.d.ts +2 -0
- package/build/core/index.js +2 -0
- package/build/core/native-module.d.ts +15 -0
- package/build/core/native-module.js +3 -0
- package/build/core/types.d.ts +17 -0
- package/build/core/types.js +16 -0
- package/build/react/index.d.ts +1 -0
- package/build/react/index.js +5 -0
- package/build/vue/index.d.ts +1 -0
- package/build/vue/index.js +4 -0
- package/build-ngc/angular/index.d.ts +1 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/core/application.d.ts +77 -0
- package/build-ngc/core/application.js +120 -0
- package/build-ngc/core/application.js.map +1 -0
- package/build-ngc/core/index.d.ts +2 -0
- package/build-ngc/core/index.js +3 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +15 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/types.d.ts +17 -0
- package/build-ngc/core/types.js +17 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +12 -0
- package/package.json +107 -0
- package/src/angular/index.ts +4 -0
- package/src/core/application.test.ts +150 -0
- package/src/core/application.ts +134 -0
- package/src/core/index.ts +14 -0
- package/src/core/native-module.ts +26 -0
- package/src/core/types.ts +22 -0
- package/src/react/index.ts +5 -0
- package/src/vue/index.ts +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 A. Prokopenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# @symbiote-native/application
|
|
2
|
+
|
|
3
|
+
A wrapper package for [SymbioteNative](../../README.md) that makes
|
|
4
|
+
[`expo-application`](https://github.com/expo/expo/tree/main/packages/expo-application)
|
|
5
|
+
— native app version/build/name/ID, the Android ID, install-referrer and install/update-time
|
|
6
|
+
lookups, and the iOS vendor ID / release type / push-notification-service environment — usable
|
|
7
|
+
from **every** adapter, React, Vue, and Angular, not just React. Like
|
|
8
|
+
[`@symbiote-native/local-auth`](../local-auth) (and unlike `@symbiote-native/sensors`'s
|
|
9
|
+
`EventEmitter` + live-subscription surface), everything here is either a plain constant resolved
|
|
10
|
+
once at import time or a one-shot async call with no per-instance state, so there is no hook/
|
|
11
|
+
composable/service to wrap — the React, Vue, and Angular entry points are plain re-exports of
|
|
12
|
+
the same `core`.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @symbiote-native/application
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`expo-application` and `expo-modules-core` come along as regular dependencies, pinned to exact
|
|
21
|
+
versions — never install either yourself, and never add the `expo` meta-package to your project
|
|
22
|
+
(it bundles its own Metro/Babel pipeline, which conflicts with this project's own).
|
|
23
|
+
|
|
24
|
+
## Required one-time step: native autolinking wiring
|
|
25
|
+
|
|
26
|
+
Unlike a plain RN native module, `expo-application`'s native code is discovered by
|
|
27
|
+
`expo-modules-autolinking`, not RN's own `react-native.config.cjs` mechanism — this needs wiring
|
|
28
|
+
into the native host app **once**, covering this package and every other `expo-modules-core`
|
|
29
|
+
package with zero further changes:
|
|
30
|
+
|
|
31
|
+
| Platform | Touches |
|
|
32
|
+
|---|---|
|
|
33
|
+
| iOS | `ios/Podfile` — add `use_expo_modules!` |
|
|
34
|
+
| iOS | `AppDelegate.swift` — Expo's runtime-bootstrap hook |
|
|
35
|
+
| Android | `settings.gradle` / `app/build.gradle` — resolve and include the Expo Gradle projects |
|
|
36
|
+
| Android | `MainApplication.kt` — Expo's bootstrap hook, plus a hand-written native-module name map (there's no `expo` meta-package here to auto-generate one) |
|
|
37
|
+
|
|
38
|
+
Full mechanics live in the `symbiote-expo-native-module` project skill. Reference
|
|
39
|
+
implementation: `examples/expo-react/ios/Podfile` and
|
|
40
|
+
`examples/expo-react/android/app/src/main/java/com/canaryexpo/MainApplication.kt`.
|
|
41
|
+
|
|
42
|
+
No app-level permission strings are needed — every function here reads app/device metadata that
|
|
43
|
+
carries no runtime or manifest permission.
|
|
44
|
+
|
|
45
|
+
## Shape
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
src/core/ nativeApplicationVersion / nativeBuildVersion / applicationName / applicationId
|
|
49
|
+
constants, getAndroidId, getInstallReferrerAsync, getIosIdForVendorAsync,
|
|
50
|
+
getIosApplicationReleaseTypeAsync, getIosPushNotificationServiceEnvironmentAsync,
|
|
51
|
+
getInstallationTimeAsync, getLastUpdateTimeAsync, plus ApplicationReleaseType and
|
|
52
|
+
PushNotificationServiceEnvironment. native-module.ts resolves the native module via
|
|
53
|
+
expo-modules-core's requireNativeModule.
|
|
54
|
+
src/react/ @symbiote-native/application/react — export * from '../core'
|
|
55
|
+
src/vue/ @symbiote-native/application/vue — export * from '../core'
|
|
56
|
+
src/angular/ @symbiote-native/application/angular — export * from '../core'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
No per-adapter lifecycle wrapper exists because there's nothing to subscribe to or clean up —
|
|
60
|
+
each adapter entry is a single-file re-export.
|
|
61
|
+
|
|
62
|
+
## Use it
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
// React
|
|
66
|
+
import { useEffect, useState } from 'react';
|
|
67
|
+
import { Platform, Text, View } from '@symbiote-native/react';
|
|
68
|
+
import {
|
|
69
|
+
applicationId,
|
|
70
|
+
applicationName,
|
|
71
|
+
getInstallationTimeAsync,
|
|
72
|
+
nativeApplicationVersion,
|
|
73
|
+
nativeBuildVersion,
|
|
74
|
+
} from '@symbiote-native/application/react';
|
|
75
|
+
|
|
76
|
+
function ApplicationScreen() {
|
|
77
|
+
const [installedAt, setInstalledAt] = useState<Date | null>(null);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
getInstallationTimeAsync().then(setInstalledAt);
|
|
81
|
+
}, []);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<View>
|
|
85
|
+
<Text>{applicationName} ({applicationId})</Text>
|
|
86
|
+
<Text>v{nativeApplicationVersion} (build {nativeBuildVersion})</Text>
|
|
87
|
+
{Platform.OS === 'android' && installedAt && (
|
|
88
|
+
<Text>Installed {installedAt.toLocaleDateString()}</Text>
|
|
89
|
+
)}
|
|
90
|
+
</View>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<!-- Vue -->
|
|
97
|
+
<script setup lang="ts">
|
|
98
|
+
import { onMounted, ref } from 'vue';
|
|
99
|
+
import { Platform, Text, View } from '@symbiote-native/vue';
|
|
100
|
+
import {
|
|
101
|
+
applicationId,
|
|
102
|
+
applicationName,
|
|
103
|
+
getInstallationTimeAsync,
|
|
104
|
+
nativeApplicationVersion,
|
|
105
|
+
nativeBuildVersion,
|
|
106
|
+
} from '@symbiote-native/application/vue';
|
|
107
|
+
|
|
108
|
+
const installedAt = ref<Date | null>(null);
|
|
109
|
+
|
|
110
|
+
onMounted(() => {
|
|
111
|
+
void getInstallationTimeAsync().then(value => (installedAt.value = value));
|
|
112
|
+
});
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<template>
|
|
116
|
+
<View>
|
|
117
|
+
<Text>{{ applicationName }} ({{ applicationId }})</Text>
|
|
118
|
+
<Text>v{{ nativeApplicationVersion }} (build {{ nativeBuildVersion }})</Text>
|
|
119
|
+
<Text v-if="Platform.OS === 'android' && installedAt">
|
|
120
|
+
Installed {{ installedAt?.toLocaleDateString() }}
|
|
121
|
+
</Text>
|
|
122
|
+
</View>
|
|
123
|
+
</template>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
// Angular
|
|
128
|
+
import { Component, signal } from '@angular/core';
|
|
129
|
+
import { Platform, Text, View } from '@symbiote-native/angular';
|
|
130
|
+
import {
|
|
131
|
+
applicationId,
|
|
132
|
+
applicationName,
|
|
133
|
+
getInstallationTimeAsync,
|
|
134
|
+
nativeApplicationVersion,
|
|
135
|
+
nativeBuildVersion,
|
|
136
|
+
} from '@symbiote-native/application/angular';
|
|
137
|
+
|
|
138
|
+
@Component({
|
|
139
|
+
standalone: true,
|
|
140
|
+
imports: [Text, View],
|
|
141
|
+
template: `
|
|
142
|
+
<View>
|
|
143
|
+
<Text>{{ applicationName }} ({{ applicationId }})</Text>
|
|
144
|
+
<Text>v{{ nativeApplicationVersion }} (build {{ nativeBuildVersion }})</Text>
|
|
145
|
+
@if (Platform.OS === 'android' && installedAt(); as date) {
|
|
146
|
+
<Text>Installed {{ date.toLocaleDateString() }}</Text>
|
|
147
|
+
}
|
|
148
|
+
</View>
|
|
149
|
+
`,
|
|
150
|
+
})
|
|
151
|
+
export class ApplicationScreen {
|
|
152
|
+
readonly Platform = Platform;
|
|
153
|
+
readonly installedAt = signal<Date | null>(null);
|
|
154
|
+
|
|
155
|
+
constructor() {
|
|
156
|
+
getInstallationTimeAsync().then(value => this.installedAt.set(value));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
There's no per-instance service to `inject()` in the Angular case — every function is a plain
|
|
162
|
+
free function off the core package, called straight from the constructor. Not yet demoed in any
|
|
163
|
+
of the `examples/expo-*` canary apps — the code above is realistic, hand-written usage of the
|
|
164
|
+
real API, not trimmed from an existing screen.
|
|
165
|
+
|
|
166
|
+
## API
|
|
167
|
+
|
|
168
|
+
Plain constants plus one-shot async functions, no event stream, no per-instance state — upstream
|
|
169
|
+
ships app/device metadata reads, not a subscribable resource, so the React/Vue/Angular entry
|
|
170
|
+
points above are plain re-exports of `core` with nothing adapter-specific to add.
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
nativeApplicationVersion: string | null
|
|
174
|
+
nativeBuildVersion: string | null
|
|
175
|
+
applicationName: string | null
|
|
176
|
+
applicationId: string | null
|
|
177
|
+
|
|
178
|
+
getAndroidId(): string // android only, throws off android
|
|
179
|
+
getInstallReferrerAsync(): Promise<string> // android only
|
|
180
|
+
getIosIdForVendorAsync(): Promise<string | null> // ios only
|
|
181
|
+
getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType> // ios only
|
|
182
|
+
getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment> // ios only
|
|
183
|
+
getInstallationTimeAsync(): Promise<Date>
|
|
184
|
+
getLastUpdateTimeAsync(): Promise<Date> // android only
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Plus `ApplicationReleaseType` and `PushNotificationServiceEnvironment` — ported from upstream's
|
|
188
|
+
`Application.types.ts`, renamed with this repo's `I`-prefix convention where applicable
|
|
189
|
+
(`PushNotificationServiceEnvironment` stays a plain string-literal union, not a struct, so it
|
|
190
|
+
carries no `I` prefix; `ts-js-best-practices`).
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { getInstallationTimeAsync, nativeApplicationVersion } from '@symbiote-native/application';
|
|
194
|
+
// or the framework-scoped entry points — identical surface, re-exported verbatim:
|
|
195
|
+
import { getInstallationTimeAsync } from '@symbiote-native/application/react';
|
|
196
|
+
import { getInstallationTimeAsync } from '@symbiote-native/application/vue';
|
|
197
|
+
import { getInstallationTimeAsync } from '@symbiote-native/application/angular';
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Notes
|
|
201
|
+
|
|
202
|
+
- **Every async function throws `UnavailabilityError` when its native method is absent** —
|
|
203
|
+
e.g. calling an iOS-only function on Android, or vice versa. `getAndroidId()` is the one
|
|
204
|
+
synchronous exception: it checks `Platform.OS` up front and throws immediately off Android,
|
|
205
|
+
never touching the native module at all.
|
|
206
|
+
- **`getInstallationTimeAsync`/`getLastUpdateTimeAsync` wrap a native epoch-ms number into a
|
|
207
|
+
`Date`** — the native side returns a plain number, not a serialized date string.
|
|
208
|
+
- The four constants (`nativeApplicationVersion`, `nativeBuildVersion`, `applicationName`,
|
|
209
|
+
`applicationId`) resolve once, eagerly, at import time — reading them repeatedly never
|
|
210
|
+
re-queries the native module.
|
|
211
|
+
|
|
212
|
+
## Test it
|
|
213
|
+
|
|
214
|
+
No Fabric/Descriptor angle at all — every export here is a plain constant or a pure async-function
|
|
215
|
+
surface, never a view or per-instance state. Tests inject a fake native-module object in place of
|
|
216
|
+
the real `requireNativeModule` resolution (`src/core/application.test.ts`, `vitest`) — no
|
|
217
|
+
`installFabric()`, no ViewConfig. Native rendering itself is verified on-device (see the parent
|
|
218
|
+
[README](../../README.md) for the project's testing model).
|
|
219
|
+
|
|
220
|
+
Native autolinking wiring is shared with `@symbiote-native/local-auth` and every other
|
|
221
|
+
`expo-modules-core` package in this repo's `examples/expo-*` canaries — this package itself isn't
|
|
222
|
+
yet demoed in any of them (no `ApplicationScreen`/equivalent exists yet), so the "Use it" section
|
|
223
|
+
above is realistic example code, not a trimmed-down copy of a running demo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ApplicationReleaseType, PushNotificationServiceEnvironment } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The human-readable version of the native application that may be displayed in the app store.
|
|
4
|
+
* On Android, this is the version name set by `version` in the app config; on iOS, the
|
|
5
|
+
* `Info.plist` value for `CFBundleShortVersionString`.
|
|
6
|
+
* @example `"2.11.0"`
|
|
7
|
+
*/
|
|
8
|
+
export declare const nativeApplicationVersion: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* The internal build version of the native application that the app stores may use to
|
|
11
|
+
* distinguish between different binaries. On Android, this is `android.versionCode`; on iOS,
|
|
12
|
+
* the `Info.plist` value for `CFBundleVersion` (`ios.buildNumber` in the app config).
|
|
13
|
+
* @example `"114"`
|
|
14
|
+
*/
|
|
15
|
+
export declare const nativeBuildVersion: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* The human-readable name of the application, displayed with the app's icon on the device's
|
|
18
|
+
* home screen.
|
|
19
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
20
|
+
*/
|
|
21
|
+
export declare const applicationName: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The ID of the application. On Android, this is the application ID. On iOS, this is the
|
|
24
|
+
* bundle ID.
|
|
25
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
26
|
+
*/
|
|
27
|
+
export declare const applicationId: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the value of `Settings.Secure.ANDROID_ID` — a hexadecimal string unique to each
|
|
30
|
+
* combination of app-signing key, user, and device. The value may change if a factory reset is
|
|
31
|
+
* performed on the device or if an APK signing key changes.
|
|
32
|
+
* @example `Application.getAndroidId(); // "dd96dec43fb81c97"`
|
|
33
|
+
* @platform android
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAndroidId(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the referrer URL of the installed app with the Install Referrer API from the Google Play
|
|
38
|
+
* Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
39
|
+
* @example `await Application.getInstallReferrerAsync(); // "utm_source=google-play&utm_medium=organic"`
|
|
40
|
+
* @platform android
|
|
41
|
+
*/
|
|
42
|
+
export declare function getInstallReferrerAsync(): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the iOS "identifier for vendor" (IDFV) — a string ID that uniquely identifies a device to
|
|
45
|
+
* the app's vendor. May resolve `null`, in which case wait and call again later (this can happen
|
|
46
|
+
* when the device was restarted before the user unlocked it). The OS changes the vendor
|
|
47
|
+
* identifier once every app from the current vendor has been uninstalled.
|
|
48
|
+
* @example `await Application.getIosIdForVendorAsync(); // "68753A44-4D6F-1226-9C60-0050E4C00067"`
|
|
49
|
+
* @platform ios
|
|
50
|
+
*/
|
|
51
|
+
export declare function getIosIdForVendorAsync(): Promise<string | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the iOS application release type.
|
|
54
|
+
* @platform ios
|
|
55
|
+
*/
|
|
56
|
+
export declare function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType>;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the current Apple Push Notification (APN) service environment.
|
|
59
|
+
* @return Either `'development'` or `'production'`, or `null` on the simulator (which does not
|
|
60
|
+
* support registering with APNs).
|
|
61
|
+
* @platform ios
|
|
62
|
+
*/
|
|
63
|
+
export declare function getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment>;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the time the app was installed onto the device, not counting subsequent updates. If the
|
|
66
|
+
* app is uninstalled and reinstalled, this returns the time of the reinstall.
|
|
67
|
+
* - Android: `PackageInfo.firstInstallTime`.
|
|
68
|
+
* - iOS: the `NSFileCreationDate` of the app's document root directory.
|
|
69
|
+
* @example `await Application.getInstallationTimeAsync(); // 2019-07-18T18:08:26.121Z`
|
|
70
|
+
*/
|
|
71
|
+
export declare function getInstallationTimeAsync(): Promise<Date>;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
74
|
+
* @example `await Application.getLastUpdateTimeAsync(); // 2019-07-18T21:20:16.887Z`
|
|
75
|
+
* @platform android
|
|
76
|
+
*/
|
|
77
|
+
export declare function getLastUpdateTimeAsync(): Promise<Date>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Platform, UnavailabilityError } from 'expo-modules-core';
|
|
2
|
+
import { expoApplication } from './native-module';
|
|
3
|
+
const NATIVE_MODULE_NAME = 'expo-application';
|
|
4
|
+
/**
|
|
5
|
+
* The human-readable version of the native application that may be displayed in the app store.
|
|
6
|
+
* On Android, this is the version name set by `version` in the app config; on iOS, the
|
|
7
|
+
* `Info.plist` value for `CFBundleShortVersionString`.
|
|
8
|
+
* @example `"2.11.0"`
|
|
9
|
+
*/
|
|
10
|
+
export const nativeApplicationVersion = expoApplication.nativeApplicationVersion ?? null;
|
|
11
|
+
/**
|
|
12
|
+
* The internal build version of the native application that the app stores may use to
|
|
13
|
+
* distinguish between different binaries. On Android, this is `android.versionCode`; on iOS,
|
|
14
|
+
* the `Info.plist` value for `CFBundleVersion` (`ios.buildNumber` in the app config).
|
|
15
|
+
* @example `"114"`
|
|
16
|
+
*/
|
|
17
|
+
export const nativeBuildVersion = expoApplication.nativeBuildVersion ?? null;
|
|
18
|
+
/**
|
|
19
|
+
* The human-readable name of the application, displayed with the app's icon on the device's
|
|
20
|
+
* home screen.
|
|
21
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
22
|
+
*/
|
|
23
|
+
export const applicationName = expoApplication.applicationName ?? null;
|
|
24
|
+
/**
|
|
25
|
+
* The ID of the application. On Android, this is the application ID. On iOS, this is the
|
|
26
|
+
* bundle ID.
|
|
27
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
28
|
+
*/
|
|
29
|
+
export const applicationId = expoApplication.applicationId ?? null;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the value of `Settings.Secure.ANDROID_ID` — a hexadecimal string unique to each
|
|
32
|
+
* combination of app-signing key, user, and device. The value may change if a factory reset is
|
|
33
|
+
* performed on the device or if an APK signing key changes.
|
|
34
|
+
* @example `Application.getAndroidId(); // "dd96dec43fb81c97"`
|
|
35
|
+
* @platform android
|
|
36
|
+
*/
|
|
37
|
+
export function getAndroidId() {
|
|
38
|
+
if (Platform.OS !== 'android') {
|
|
39
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'androidId');
|
|
40
|
+
}
|
|
41
|
+
if (!expoApplication.androidId) {
|
|
42
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'androidId');
|
|
43
|
+
}
|
|
44
|
+
return expoApplication.androidId;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets the referrer URL of the installed app with the Install Referrer API from the Google Play
|
|
48
|
+
* Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
49
|
+
* @example `await Application.getInstallReferrerAsync(); // "utm_source=google-play&utm_medium=organic"`
|
|
50
|
+
* @platform android
|
|
51
|
+
*/
|
|
52
|
+
export async function getInstallReferrerAsync() {
|
|
53
|
+
if (!expoApplication.getInstallReferrerAsync) {
|
|
54
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getInstallReferrerAsync');
|
|
55
|
+
}
|
|
56
|
+
return expoApplication.getInstallReferrerAsync();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets the iOS "identifier for vendor" (IDFV) — a string ID that uniquely identifies a device to
|
|
60
|
+
* the app's vendor. May resolve `null`, in which case wait and call again later (this can happen
|
|
61
|
+
* when the device was restarted before the user unlocked it). The OS changes the vendor
|
|
62
|
+
* identifier once every app from the current vendor has been uninstalled.
|
|
63
|
+
* @example `await Application.getIosIdForVendorAsync(); // "68753A44-4D6F-1226-9C60-0050E4C00067"`
|
|
64
|
+
* @platform ios
|
|
65
|
+
*/
|
|
66
|
+
export async function getIosIdForVendorAsync() {
|
|
67
|
+
if (!expoApplication.getIosIdForVendorAsync) {
|
|
68
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getIosIdForVendorAsync');
|
|
69
|
+
}
|
|
70
|
+
return expoApplication.getIosIdForVendorAsync();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Gets the iOS application release type.
|
|
74
|
+
* @platform ios
|
|
75
|
+
*/
|
|
76
|
+
export async function getIosApplicationReleaseTypeAsync() {
|
|
77
|
+
if (!expoApplication.getApplicationReleaseTypeAsync) {
|
|
78
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getApplicationReleaseTypeAsync');
|
|
79
|
+
}
|
|
80
|
+
return expoApplication.getApplicationReleaseTypeAsync();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets the current Apple Push Notification (APN) service environment.
|
|
84
|
+
* @return Either `'development'` or `'production'`, or `null` on the simulator (which does not
|
|
85
|
+
* support registering with APNs).
|
|
86
|
+
* @platform ios
|
|
87
|
+
*/
|
|
88
|
+
export async function getIosPushNotificationServiceEnvironmentAsync() {
|
|
89
|
+
if (!expoApplication.getPushNotificationServiceEnvironmentAsync) {
|
|
90
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getPushNotificationServiceEnvironmentAsync');
|
|
91
|
+
}
|
|
92
|
+
return expoApplication.getPushNotificationServiceEnvironmentAsync();
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets the time the app was installed onto the device, not counting subsequent updates. If the
|
|
96
|
+
* app is uninstalled and reinstalled, this returns the time of the reinstall.
|
|
97
|
+
* - Android: `PackageInfo.firstInstallTime`.
|
|
98
|
+
* - iOS: the `NSFileCreationDate` of the app's document root directory.
|
|
99
|
+
* @example `await Application.getInstallationTimeAsync(); // 2019-07-18T18:08:26.121Z`
|
|
100
|
+
*/
|
|
101
|
+
export async function getInstallationTimeAsync() {
|
|
102
|
+
if (!expoApplication.getInstallationTimeAsync) {
|
|
103
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getInstallationTimeAsync');
|
|
104
|
+
}
|
|
105
|
+
const installationTime = await expoApplication.getInstallationTimeAsync();
|
|
106
|
+
return new Date(installationTime);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
110
|
+
* @example `await Application.getLastUpdateTimeAsync(); // 2019-07-18T21:20:16.887Z`
|
|
111
|
+
* @platform android
|
|
112
|
+
*/
|
|
113
|
+
export async function getLastUpdateTimeAsync() {
|
|
114
|
+
if (!expoApplication.getLastUpdateTimeAsync) {
|
|
115
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getLastUpdateTimeAsync');
|
|
116
|
+
}
|
|
117
|
+
const lastUpdateTime = await expoApplication.getLastUpdateTimeAsync();
|
|
118
|
+
return new Date(lastUpdateTime);
|
|
119
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { nativeApplicationVersion, nativeBuildVersion, applicationName, applicationId, getAndroidId, getInstallReferrerAsync, getIosIdForVendorAsync, getIosApplicationReleaseTypeAsync, getIosPushNotificationServiceEnvironmentAsync, getInstallationTimeAsync, getLastUpdateTimeAsync, } from './application';
|
|
2
|
+
export { ApplicationReleaseType, type PushNotificationServiceEnvironment } from './types';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { nativeApplicationVersion, nativeBuildVersion, applicationName, applicationId, getAndroidId, getInstallReferrerAsync, getIosIdForVendorAsync, getIosApplicationReleaseTypeAsync, getIosPushNotificationServiceEnvironmentAsync, getInstallationTimeAsync, getLastUpdateTimeAsync, } from './application';
|
|
2
|
+
export { ApplicationReleaseType } from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ApplicationReleaseType, PushNotificationServiceEnvironment } from './types';
|
|
2
|
+
export type INativeApplicationModule = {
|
|
3
|
+
nativeApplicationVersion?: string | null;
|
|
4
|
+
nativeBuildVersion?: string | null;
|
|
5
|
+
applicationName?: string | null;
|
|
6
|
+
applicationId?: string | null;
|
|
7
|
+
androidId?: string;
|
|
8
|
+
getInstallReferrerAsync?(): Promise<string>;
|
|
9
|
+
getIosIdForVendorAsync?(): Promise<string | null>;
|
|
10
|
+
getApplicationReleaseTypeAsync?(): Promise<ApplicationReleaseType>;
|
|
11
|
+
getPushNotificationServiceEnvironmentAsync?(): Promise<PushNotificationServiceEnvironment>;
|
|
12
|
+
getInstallationTimeAsync?(): Promise<number>;
|
|
13
|
+
getLastUpdateTimeAsync?(): Promise<number>;
|
|
14
|
+
};
|
|
15
|
+
export declare const expoApplication: INativeApplicationModule;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type of release for the app that is currently running.
|
|
3
|
+
* @platform ios
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ApplicationReleaseType {
|
|
6
|
+
UNKNOWN = 0,
|
|
7
|
+
SIMULATOR = 1,
|
|
8
|
+
ENTERPRISE = 2,
|
|
9
|
+
DEVELOPMENT = 3,
|
|
10
|
+
AD_HOC = 4,
|
|
11
|
+
APP_STORE = 5
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Maps to the `aps-environment` key in the native target's registered entitlements.
|
|
15
|
+
* @platform ios
|
|
16
|
+
*/
|
|
17
|
+
export type PushNotificationServiceEnvironment = 'development' | 'production' | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Upstream ships two iOS-only types describing the shape of a running app build — the
|
|
2
|
+
// release channel it was built through and the current APN environment. Ported verbatim
|
|
3
|
+
// from expo-application's Application.types.ts (sdk-57).
|
|
4
|
+
/**
|
|
5
|
+
* The type of release for the app that is currently running.
|
|
6
|
+
* @platform ios
|
|
7
|
+
*/
|
|
8
|
+
export var ApplicationReleaseType;
|
|
9
|
+
(function (ApplicationReleaseType) {
|
|
10
|
+
ApplicationReleaseType[ApplicationReleaseType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
11
|
+
ApplicationReleaseType[ApplicationReleaseType["SIMULATOR"] = 1] = "SIMULATOR";
|
|
12
|
+
ApplicationReleaseType[ApplicationReleaseType["ENTERPRISE"] = 2] = "ENTERPRISE";
|
|
13
|
+
ApplicationReleaseType[ApplicationReleaseType["DEVELOPMENT"] = 3] = "DEVELOPMENT";
|
|
14
|
+
ApplicationReleaseType[ApplicationReleaseType["AD_HOC"] = 4] = "AD_HOC";
|
|
15
|
+
ApplicationReleaseType[ApplicationReleaseType["APP_STORE"] = 5] = "APP_STORE";
|
|
16
|
+
})(ApplicationReleaseType || (ApplicationReleaseType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/application/react: the React entry over the framework-agnostic core.
|
|
2
|
+
// Upstream ships plain constants and one-shot async functions, no per-instance state and no
|
|
3
|
+
// event stream — there is nothing for a hook to wrap, so this is a plain re-export, mirroring
|
|
4
|
+
// packages/local-auth/src/react/index.ts.
|
|
5
|
+
export * from '../core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/application/angular: the Angular entry over the framework-agnostic core.
|
|
2
|
+
// Same reasoning as the React/Vue entries — no per-instance state or event stream to wrap in a
|
|
3
|
+
// service, so this is a plain re-export.
|
|
4
|
+
export * from '../core';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,+FAA+F;AAC/F,yCAAyC;AACzC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ApplicationReleaseType, PushNotificationServiceEnvironment } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The human-readable version of the native application that may be displayed in the app store.
|
|
4
|
+
* On Android, this is the version name set by `version` in the app config; on iOS, the
|
|
5
|
+
* `Info.plist` value for `CFBundleShortVersionString`.
|
|
6
|
+
* @example `"2.11.0"`
|
|
7
|
+
*/
|
|
8
|
+
export declare const nativeApplicationVersion: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* The internal build version of the native application that the app stores may use to
|
|
11
|
+
* distinguish between different binaries. On Android, this is `android.versionCode`; on iOS,
|
|
12
|
+
* the `Info.plist` value for `CFBundleVersion` (`ios.buildNumber` in the app config).
|
|
13
|
+
* @example `"114"`
|
|
14
|
+
*/
|
|
15
|
+
export declare const nativeBuildVersion: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* The human-readable name of the application, displayed with the app's icon on the device's
|
|
18
|
+
* home screen.
|
|
19
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
20
|
+
*/
|
|
21
|
+
export declare const applicationName: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The ID of the application. On Android, this is the application ID. On iOS, this is the
|
|
24
|
+
* bundle ID.
|
|
25
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
26
|
+
*/
|
|
27
|
+
export declare const applicationId: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the value of `Settings.Secure.ANDROID_ID` — a hexadecimal string unique to each
|
|
30
|
+
* combination of app-signing key, user, and device. The value may change if a factory reset is
|
|
31
|
+
* performed on the device or if an APK signing key changes.
|
|
32
|
+
* @example `Application.getAndroidId(); // "dd96dec43fb81c97"`
|
|
33
|
+
* @platform android
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAndroidId(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the referrer URL of the installed app with the Install Referrer API from the Google Play
|
|
38
|
+
* Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
39
|
+
* @example `await Application.getInstallReferrerAsync(); // "utm_source=google-play&utm_medium=organic"`
|
|
40
|
+
* @platform android
|
|
41
|
+
*/
|
|
42
|
+
export declare function getInstallReferrerAsync(): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the iOS "identifier for vendor" (IDFV) — a string ID that uniquely identifies a device to
|
|
45
|
+
* the app's vendor. May resolve `null`, in which case wait and call again later (this can happen
|
|
46
|
+
* when the device was restarted before the user unlocked it). The OS changes the vendor
|
|
47
|
+
* identifier once every app from the current vendor has been uninstalled.
|
|
48
|
+
* @example `await Application.getIosIdForVendorAsync(); // "68753A44-4D6F-1226-9C60-0050E4C00067"`
|
|
49
|
+
* @platform ios
|
|
50
|
+
*/
|
|
51
|
+
export declare function getIosIdForVendorAsync(): Promise<string | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the iOS application release type.
|
|
54
|
+
* @platform ios
|
|
55
|
+
*/
|
|
56
|
+
export declare function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType>;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the current Apple Push Notification (APN) service environment.
|
|
59
|
+
* @return Either `'development'` or `'production'`, or `null` on the simulator (which does not
|
|
60
|
+
* support registering with APNs).
|
|
61
|
+
* @platform ios
|
|
62
|
+
*/
|
|
63
|
+
export declare function getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment>;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the time the app was installed onto the device, not counting subsequent updates. If the
|
|
66
|
+
* app is uninstalled and reinstalled, this returns the time of the reinstall.
|
|
67
|
+
* - Android: `PackageInfo.firstInstallTime`.
|
|
68
|
+
* - iOS: the `NSFileCreationDate` of the app's document root directory.
|
|
69
|
+
* @example `await Application.getInstallationTimeAsync(); // 2019-07-18T18:08:26.121Z`
|
|
70
|
+
*/
|
|
71
|
+
export declare function getInstallationTimeAsync(): Promise<Date>;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
74
|
+
* @example `await Application.getLastUpdateTimeAsync(); // 2019-07-18T21:20:16.887Z`
|
|
75
|
+
* @platform android
|
|
76
|
+
*/
|
|
77
|
+
export declare function getLastUpdateTimeAsync(): Promise<Date>;
|