@capawesome/capacitor-age-signals 0.1.0 → 0.2.0-dev.1765885034
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/CapawesomeCapacitorAgeSignals.podspec +1 -1
- package/Package.swift +2 -2
- package/README.md +48 -15
- package/android/build.gradle +10 -10
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/agesignals/classes/results/CheckAgeSignalsResult.java +12 -15
- package/dist/docs.json +43 -6
- package/dist/esm/definitions.d.ts +21 -4
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/AgeSignals.swift +103 -0
- package/ios/Plugin/AgeSignalsPlugin.swift +37 -1
- package/ios/Plugin/Classes/Options/CheckAgeSignalsOptions.swift +11 -0
- package/ios/Plugin/Classes/Results/CheckAgeSignalsResult.swift +33 -0
- package/ios/Plugin/Enums/CustomError.swift +26 -0
- package/ios/Plugin/Enums/UserStatus.swift +8 -0
- package/ios/Plugin/Protocols/Result.swift +5 -0
- package/package.json +10 -10
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/Package.swift
CHANGED
|
@@ -3,14 +3,14 @@ import PackageDescription
|
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
5
|
name: "CapawesomeCapacitorAgeSignals",
|
|
6
|
-
platforms: [.iOS(.
|
|
6
|
+
platforms: [.iOS(.v15)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
9
|
name: "CapawesomeCapacitorAgeSignals",
|
|
10
10
|
targets: ["AgeSignalsPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
package/README.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
# @capawesome/capacitor-age-signals
|
|
2
2
|
|
|
3
|
-
Capacitor plugin to use the [Play Age Signals API](https://developer.android.com/google/play/age-signals/overview) to
|
|
3
|
+
Capacitor plugin to use the [Play Age Signals API](https://developer.android.com/google/play/age-signals/overview) (Android) and [DeclaredAgeRange](https://developer.apple.com/documentation/declaredagerange/) (iOS) to request age signals about the user.
|
|
4
4
|
|
|
5
5
|
<div class="capawesome-z29o10a">
|
|
6
6
|
<a href="https://cloud.capawesome.io/" target="_blank">
|
|
7
|
-
<img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-
|
|
7
|
+
<img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1" />
|
|
8
8
|
</a>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
+
???+ info "Important Notice"
|
|
12
|
+
|
|
13
|
+
The **Play Age Signals API** is returning "Not yet implemented" because its live functionality is scheduled to begin on January 1, 2026.
|
|
14
|
+
|
|
15
|
+
## Compatibility
|
|
16
|
+
|
|
17
|
+
| Plugin Version | Capacitor Version | Status |
|
|
18
|
+
| -------------- | ----------------- | -------------- |
|
|
19
|
+
| 0.3.x | >=8.x.x | Active support |
|
|
20
|
+
| 0.2.x | 7.x.x | Deprecated |
|
|
21
|
+
|
|
11
22
|
## Installation
|
|
12
23
|
|
|
13
24
|
```bash
|
|
@@ -21,10 +32,23 @@ npx cap sync
|
|
|
21
32
|
|
|
22
33
|
If needed, you can define the following project variable in your app's `variables.gradle` file to change the default version of the dependency:
|
|
23
34
|
|
|
24
|
-
- `$androidPlayAgeSignalsVersion` version of `com.google.android.play:age-signals` (default: `0.0.
|
|
35
|
+
- `$androidPlayAgeSignalsVersion` version of `com.google.android.play:age-signals` (default: `0.0.2`)
|
|
25
36
|
|
|
26
37
|
This can be useful if you encounter dependency conflicts with other plugins in your project.
|
|
27
38
|
|
|
39
|
+
### iOS
|
|
40
|
+
|
|
41
|
+
#### Entitlements
|
|
42
|
+
|
|
43
|
+
To use the DeclaredAgeRange API, you must enable the `com.apple.developer.declared-age-range` entitlement in your app's entitlements file by adding the following key:
|
|
44
|
+
|
|
45
|
+
```xml
|
|
46
|
+
<key>com.apple.developer.declared-age-range</key>
|
|
47
|
+
<true/>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Check out the [Apple documentation](https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.contacts.notes) for more information.
|
|
51
|
+
|
|
28
52
|
## Configuration
|
|
29
53
|
|
|
30
54
|
No configuration required for this plugin.
|
|
@@ -46,7 +70,7 @@ const checkAgeSignals = async () => {
|
|
|
46
70
|
|
|
47
71
|
<docgen-index>
|
|
48
72
|
|
|
49
|
-
* [`checkAgeSignals()`](#checkagesignals)
|
|
73
|
+
* [`checkAgeSignals(...)`](#checkagesignals)
|
|
50
74
|
* [Interfaces](#interfaces)
|
|
51
75
|
* [Enums](#enums)
|
|
52
76
|
|
|
@@ -55,15 +79,17 @@ const checkAgeSignals = async () => {
|
|
|
55
79
|
<docgen-api>
|
|
56
80
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
57
81
|
|
|
58
|
-
### checkAgeSignals()
|
|
82
|
+
### checkAgeSignals(...)
|
|
59
83
|
|
|
60
84
|
```typescript
|
|
61
|
-
checkAgeSignals() => Promise<CheckAgeSignalsResult>
|
|
85
|
+
checkAgeSignals(options?: CheckAgeSignalsOptions | undefined) => Promise<CheckAgeSignalsResult>
|
|
62
86
|
```
|
|
63
87
|
|
|
64
|
-
Request the user's age signals
|
|
88
|
+
Request the user's age signals.
|
|
65
89
|
|
|
66
|
-
|
|
90
|
+
| Param | Type |
|
|
91
|
+
| ------------- | ------------------------------------------------------------------------- |
|
|
92
|
+
| **`options`** | <code><a href="#checkagesignalsoptions">CheckAgeSignalsOptions</a></code> |
|
|
67
93
|
|
|
68
94
|
**Returns:** <code>Promise<<a href="#checkagesignalsresult">CheckAgeSignalsResult</a>></code>
|
|
69
95
|
|
|
@@ -77,13 +103,20 @@ Only available on Android.
|
|
|
77
103
|
|
|
78
104
|
#### CheckAgeSignalsResult
|
|
79
105
|
|
|
80
|
-
| Prop | Type | Description
|
|
81
|
-
| ---------------------------- | ------------------------------------------------- |
|
|
82
|
-
| **`userStatus`** | <code><a href="#userstatus">UserStatus</a></code> | The user's verification status.
|
|
83
|
-
| **`ageLower`** | <code>number</code> | The (inclusive) lower bound of a supervised user's age range. Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.
|
|
84
|
-
| **`ageUpper`** | <code>number</code> | The (inclusive) upper bound of a supervised user's age range. Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED` and the user's age is under 18.
|
|
85
|
-
| **`mostRecentApprovalDate`** | <code>string</code> | The effective from date of the most recent significant change that was approved. When an app is installed, the date of the most recent significant change prior to install is used. Only available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`. | 0.0.1 |
|
|
86
|
-
| **`installId`** | <code>string</code> | An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval. Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`. | 0.0.1 |
|
|
106
|
+
| Prop | Type | Description | Since |
|
|
107
|
+
| ---------------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
108
|
+
| **`userStatus`** | <code><a href="#userstatus">UserStatus</a></code> | The user's verification status. | 0.0.1 |
|
|
109
|
+
| **`ageLower`** | <code>number</code> | The (inclusive) lower bound of a supervised user's age range. Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`. | 0.0.1 |
|
|
110
|
+
| **`ageUpper`** | <code>number</code> | The (inclusive) upper bound of a supervised user's age range. Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED` and the user's age is under 18. | 0.0.1 |
|
|
111
|
+
| **`mostRecentApprovalDate`** | <code>string</code> | The effective from date of the most recent significant change that was approved. When an app is installed, the date of the most recent significant change prior to install is used. Only available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`. Only available on Android. | 0.0.1 |
|
|
112
|
+
| **`installId`** | <code>string</code> | An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval. Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`. Only available on Android. | 0.0.1 |
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
#### CheckAgeSignalsOptions
|
|
116
|
+
|
|
117
|
+
| Prop | Type | Description | Default | Since |
|
|
118
|
+
| -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------- | ----- |
|
|
119
|
+
| **`ageGates`** | <code>number[]</code> | The age ranges that the user falls into. The provided array must contain at least 2 and at most 3 ages. Only available on iOS. | <code>[13, 15, 18]</code> | 0.0.2 |
|
|
87
120
|
|
|
88
121
|
|
|
89
122
|
### Enums
|
package/android/build.gradle
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
6
|
-
androidPlayAgeSignalsVersion = project.hasProperty('androidPlayAgeSignalsVersion') ? rootProject.ext.androidPlayAgeSignalsVersion : '0.0.
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
6
|
+
androidPlayAgeSignalsVersion = project.hasProperty('androidPlayAgeSignalsVersion') ? rootProject.ext.androidPlayAgeSignalsVersion : '0.0.2'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
buildscript {
|
|
@@ -12,18 +12,18 @@ buildscript {
|
|
|
12
12
|
mavenCentral()
|
|
13
13
|
}
|
|
14
14
|
dependencies {
|
|
15
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
15
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
apply plugin: 'com.android.library'
|
|
20
20
|
|
|
21
21
|
android {
|
|
22
|
-
namespace "io.capawesome.capacitorjs.plugins.agesignals"
|
|
23
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
22
|
+
namespace = "io.capawesome.capacitorjs.plugins.agesignals"
|
|
23
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
24
24
|
defaultConfig {
|
|
25
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
26
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
25
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
26
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
27
27
|
versionCode 1
|
|
28
28
|
versionName "1.0"
|
|
29
29
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -35,7 +35,7 @@ android {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
lintOptions {
|
|
38
|
-
abortOnError false
|
|
38
|
+
abortOnError = false
|
|
39
39
|
}
|
|
40
40
|
compileOptions {
|
|
41
41
|
sourceCompatibility JavaVersion.VERSION_21
|
|
@@ -25,7 +25,7 @@ public class CheckAgeSignalsResult implements Result {
|
|
|
25
25
|
private final String installId;
|
|
26
26
|
|
|
27
27
|
public CheckAgeSignalsResult(@NonNull AgeSignalsResult ageSignalsResult) {
|
|
28
|
-
this.userStatus = mapUserStatus(ageSignalsResult.userStatus()
|
|
28
|
+
this.userStatus = mapUserStatus(ageSignalsResult.userStatus());
|
|
29
29
|
this.ageLower = ageSignalsResult.ageLower();
|
|
30
30
|
this.ageUpper = ageSignalsResult.ageUpper();
|
|
31
31
|
this.mostRecentApprovalDate = ageSignalsResult.mostRecentApprovalDate() != null
|
|
@@ -54,20 +54,17 @@ public class CheckAgeSignalsResult implements Result {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
@NonNull
|
|
57
|
-
private UserStatus mapUserStatus(@
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return UserStatus.VERIFIED;
|
|
61
|
-
case "SUPERVISED":
|
|
62
|
-
return UserStatus.SUPERVISED;
|
|
63
|
-
case "SUPERVISED_APPROVAL_PENDING":
|
|
64
|
-
return UserStatus.SUPERVISED_APPROVAL_PENDING;
|
|
65
|
-
case "SUPERVISED_APPROVAL_DENIED":
|
|
66
|
-
return UserStatus.SUPERVISED_APPROVAL_DENIED;
|
|
67
|
-
case "UNKNOWN":
|
|
68
|
-
return UserStatus.UNKNOWN;
|
|
69
|
-
default:
|
|
70
|
-
return UserStatus.EMPTY;
|
|
57
|
+
private UserStatus mapUserStatus(@Nullable Integer status) {
|
|
58
|
+
if (status == null) {
|
|
59
|
+
return UserStatus.EMPTY;
|
|
71
60
|
}
|
|
61
|
+
|
|
62
|
+
UserStatus[] values = UserStatus.values();
|
|
63
|
+
|
|
64
|
+
if (status < 0 || status >= values.length) {
|
|
65
|
+
throw new IllegalArgumentException("Invalid UserStatus: " + status);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return values[status];
|
|
72
69
|
}
|
|
73
70
|
}
|
package/dist/docs.json
CHANGED
|
@@ -12,8 +12,14 @@
|
|
|
12
12
|
"methods": [
|
|
13
13
|
{
|
|
14
14
|
"name": "checkAgeSignals",
|
|
15
|
-
"signature": "() => Promise<CheckAgeSignalsResult>",
|
|
16
|
-
"parameters": [
|
|
15
|
+
"signature": "(options?: CheckAgeSignalsOptions | undefined) => Promise<CheckAgeSignalsResult>",
|
|
16
|
+
"parameters": [
|
|
17
|
+
{
|
|
18
|
+
"name": "options",
|
|
19
|
+
"docs": "",
|
|
20
|
+
"type": "CheckAgeSignalsOptions | undefined"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
17
23
|
"returns": "Promise<CheckAgeSignalsResult>",
|
|
18
24
|
"tags": [
|
|
19
25
|
{
|
|
@@ -21,9 +27,10 @@
|
|
|
21
27
|
"text": "0.0.1"
|
|
22
28
|
}
|
|
23
29
|
],
|
|
24
|
-
"docs": "Request the user's age signals
|
|
30
|
+
"docs": "Request the user's age signals.",
|
|
25
31
|
"complexTypes": [
|
|
26
|
-
"CheckAgeSignalsResult"
|
|
32
|
+
"CheckAgeSignalsResult",
|
|
33
|
+
"CheckAgeSignalsOptions"
|
|
27
34
|
],
|
|
28
35
|
"slug": "checkagesignals"
|
|
29
36
|
}
|
|
@@ -101,7 +108,7 @@
|
|
|
101
108
|
"name": "example"
|
|
102
109
|
}
|
|
103
110
|
],
|
|
104
|
-
"docs": "The effective from date of the most recent significant change that was approved.\nWhen an app is installed, the date of the most recent significant change prior to install is used.\n\nOnly available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED
|
|
111
|
+
"docs": "The effective from date of the most recent significant change that was approved.\nWhen an app is installed, the date of the most recent significant change prior to install is used.\n\nOnly available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`.\n\nOnly available on Android.",
|
|
105
112
|
"complexTypes": [],
|
|
106
113
|
"type": "string | undefined"
|
|
107
114
|
},
|
|
@@ -117,11 +124,41 @@
|
|
|
117
124
|
"name": "example"
|
|
118
125
|
}
|
|
119
126
|
],
|
|
120
|
-
"docs": "An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval.\n\nOnly available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED
|
|
127
|
+
"docs": "An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval.\n\nOnly available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.\n\nOnly available on Android.",
|
|
121
128
|
"complexTypes": [],
|
|
122
129
|
"type": "string | undefined"
|
|
123
130
|
}
|
|
124
131
|
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "CheckAgeSignalsOptions",
|
|
135
|
+
"slug": "checkagesignalsoptions",
|
|
136
|
+
"docs": "",
|
|
137
|
+
"tags": [
|
|
138
|
+
{
|
|
139
|
+
"text": "0.0.2",
|
|
140
|
+
"name": "since"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"methods": [],
|
|
144
|
+
"properties": [
|
|
145
|
+
{
|
|
146
|
+
"name": "ageGates",
|
|
147
|
+
"tags": [
|
|
148
|
+
{
|
|
149
|
+
"text": "0.0.2",
|
|
150
|
+
"name": "since"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"text": "[13, 15, 18]",
|
|
154
|
+
"name": "default"
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"docs": "The age ranges that the user falls into.\nThe provided array must contain at least 2 and at most 3 ages.\n\nOnly available on iOS.",
|
|
158
|
+
"complexTypes": [],
|
|
159
|
+
"type": "number[] | undefined"
|
|
160
|
+
}
|
|
161
|
+
]
|
|
125
162
|
}
|
|
126
163
|
],
|
|
127
164
|
"enums": [
|
|
@@ -3,13 +3,26 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface AgeSignalsPlugin {
|
|
5
5
|
/**
|
|
6
|
-
* Request the user's age signals
|
|
7
|
-
*
|
|
8
|
-
* Only available on Android.
|
|
6
|
+
* Request the user's age signals.
|
|
9
7
|
*
|
|
10
8
|
* @since 0.0.1
|
|
11
9
|
*/
|
|
12
|
-
checkAgeSignals(): Promise<CheckAgeSignalsResult>;
|
|
10
|
+
checkAgeSignals(options?: CheckAgeSignalsOptions): Promise<CheckAgeSignalsResult>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.0.2
|
|
14
|
+
*/
|
|
15
|
+
export interface CheckAgeSignalsOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The age ranges that the user falls into.
|
|
18
|
+
* The provided array must contain at least 2 and at most 3 ages.
|
|
19
|
+
*
|
|
20
|
+
* Only available on iOS.
|
|
21
|
+
*
|
|
22
|
+
* @since 0.0.2
|
|
23
|
+
* @default [13, 15, 18]
|
|
24
|
+
*/
|
|
25
|
+
ageGates?: number[];
|
|
13
26
|
}
|
|
14
27
|
/**
|
|
15
28
|
* @since 0.0.1
|
|
@@ -45,6 +58,8 @@ export interface CheckAgeSignalsResult {
|
|
|
45
58
|
*
|
|
46
59
|
* Only available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`.
|
|
47
60
|
*
|
|
61
|
+
* Only available on Android.
|
|
62
|
+
*
|
|
48
63
|
* @since 0.0.1
|
|
49
64
|
* @example "2024-01-15"
|
|
50
65
|
*/
|
|
@@ -54,6 +69,8 @@ export interface CheckAgeSignalsResult {
|
|
|
54
69
|
*
|
|
55
70
|
* Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.
|
|
56
71
|
*
|
|
72
|
+
* Only available on Android.
|
|
73
|
+
*
|
|
57
74
|
* @since 0.0.1
|
|
58
75
|
* @example "abc123xyz"
|
|
59
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAmFA;;GAEG;AACH,MAAM,CAAN,IAAY,UA2CX;AA3CD,WAAY,UAAU;IACpB;;;;OAIG;IACH,mCAAqB,CAAA;IACrB;;;;;OAKG;IACH,uCAAyB,CAAA;IACzB;;;;;;OAMG;IACH,uEAAyD,CAAA;IACzD;;;;;;OAMG;IACH,qEAAuD,CAAA;IACvD;;;;;OAKG;IACH,iCAAmB,CAAA;IACnB;;;;OAIG;IACH,6BAAe,CAAA;AACjB,CAAC,EA3CW,UAAU,KAAV,UAAU,QA2CrB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,SA6DX;AA7DD,WAAY,SAAS;IACnB;;;;OAIG;IACH,kDAAqC,CAAA;IACrC;;;;OAIG;IACH,uDAA0C,CAAA;IAC1C;;;;OAIG;IACH,2CAA8B,CAAA;IAC9B;;;;OAIG;IACH,6DAAgD,CAAA;IAChD;;;;OAIG;IACH,2DAA8C,CAAA;IAC9C;;;;OAIG;IACH,qEAAwD,CAAA;IACxD;;;;OAIG;IACH,2EAA8D,CAAA;IAC9D;;;;OAIG;IACH,4DAA+C,CAAA;IAC/C;;;;OAIG;IACH,0CAA6B,CAAA;IAC7B;;;;OAIG;IACH,6CAAgC,CAAA;AAClC,CAAC,EA7DW,SAAS,KAAT,SAAS,QA6DpB","sourcesContent":["/**\n * @since 0.0.1\n */\nexport interface AgeSignalsPlugin {\n /**\n * Request the user's age signals.\n *\n * @since 0.0.1\n */\n checkAgeSignals(\n options?: CheckAgeSignalsOptions,\n ): Promise<CheckAgeSignalsResult>;\n}\n\n/**\n * @since 0.0.2\n */\nexport interface CheckAgeSignalsOptions {\n /**\n * The age ranges that the user falls into.\n * The provided array must contain at least 2 and at most 3 ages.\n *\n * Only available on iOS.\n *\n * @since 0.0.2\n * @default [13, 15, 18]\n */\n ageGates?: number[];\n}\n\n/**\n * @since 0.0.1\n */\nexport interface CheckAgeSignalsResult {\n /**\n * The user's verification status.\n *\n * @since 0.0.1\n */\n userStatus: UserStatus;\n /**\n * The (inclusive) lower bound of a supervised user's age range.\n *\n * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.\n *\n * @since 0.0.1\n * @example 13\n */\n ageLower?: number;\n /**\n * The (inclusive) upper bound of a supervised user's age range.\n *\n * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED` and the user's age is under 18.\n *\n * @since 0.0.1\n * @example 15\n */\n ageUpper?: number;\n /**\n * The effective from date of the most recent significant change that was approved.\n * When an app is installed, the date of the most recent significant change prior to install is used.\n *\n * Only available when `userStatus` is `SUPERVISED_APPROVAL_PENDING` or `SUPERVISED_APPROVAL_DENIED`.\n *\n * Only available on Android.\n *\n * @since 0.0.1\n * @example \"2024-01-15\"\n */\n mostRecentApprovalDate?: string;\n /**\n * An ID assigned to supervised user installs by Google Play, used for the purposes of notifying you of revoked app approval.\n *\n * Only available when `userStatus` is `SUPERVISED`, `SUPERVISED_APPROVAL_PENDING`, or `SUPERVISED_APPROVAL_DENIED`.\n *\n * Only available on Android.\n *\n * @since 0.0.1\n * @example \"abc123xyz\"\n */\n installId?: string;\n}\n\n/**\n * @since 0.0.1\n */\nexport enum UserStatus {\n /**\n * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.\n *\n * @since 0.0.1\n */\n Verified = 'VERIFIED',\n /**\n * The user has a supervised Google Account managed by a parent who sets their age.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n Supervised = 'SUPERVISED',\n /**\n * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n SupervisedApprovalPending = 'SUPERVISED_APPROVAL_PENDING',\n /**\n * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n SupervisedApprovalDenied = 'SUPERVISED_APPROVAL_DENIED',\n /**\n * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.\n * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.\n *\n * @since 0.0.1\n */\n Unknown = 'UNKNOWN',\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n Empty = 'EMPTY',\n}\n\n/**\n * @since 0.0.1\n */\nexport enum ErrorCode {\n /**\n * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.\n *\n * @since 0.0.1\n */\n ApiNotAvailable = 'API_NOT_AVAILABLE',\n /**\n * No Play Store app is found on the device.\n *\n * @since 0.0.1\n */\n PlayStoreNotFound = 'PLAY_STORE_NOT_FOUND',\n /**\n * No available network is found.\n *\n * @since 0.0.1\n */\n NetworkError = 'NETWORK_ERROR',\n /**\n * Play Services is not available or its version is too old.\n *\n * @since 0.0.1\n */\n PlayServicesNotFound = 'PLAY_SERVICES_NOT_FOUND',\n /**\n * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.\n *\n * @since 0.0.1\n */\n CannotBindToService = 'CANNOT_BIND_TO_SERVICE',\n /**\n * The Play Store app needs to be updated.\n *\n * @since 0.0.1\n */\n PlayStoreVersionOutdated = 'PLAY_STORE_VERSION_OUTDATED',\n /**\n * Play Services needs to be updated.\n *\n * @since 0.0.1\n */\n PlayServicesVersionOutdated = 'PLAY_SERVICES_VERSION_OUTDATED',\n /**\n * There was a transient error in the client device.\n *\n * @since 0.0.1\n */\n ClientTransientError = 'CLIENT_TRANSIENT_ERROR',\n /**\n * The app was not installed by Google Play.\n *\n * @since 0.0.1\n */\n AppNotOwned = 'APP_NOT_OWNED',\n /**\n * Unknown internal error.\n *\n * @since 0.0.1\n */\n InternalError = 'INTERNAL_ERROR',\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { AgeSignalsPlugin, CheckAgeSignalsResult } from './definitions';
|
|
2
|
+
import type { AgeSignalsPlugin, CheckAgeSignalsOptions, CheckAgeSignalsResult } from './definitions';
|
|
3
3
|
export declare class AgeSignalsWeb extends WebPlugin implements AgeSignalsPlugin {
|
|
4
|
-
checkAgeSignals(): Promise<CheckAgeSignalsResult>;
|
|
4
|
+
checkAgeSignals(_options: CheckAgeSignalsOptions): Promise<CheckAgeSignalsResult>;
|
|
5
5
|
}
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,KAAK,CAAC,eAAe,CACnB,QAAgC;QAEhC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AgeSignalsPlugin,\n CheckAgeSignalsOptions,\n CheckAgeSignalsResult,\n} from './definitions';\n\nexport class AgeSignalsWeb extends WebPlugin implements AgeSignalsPlugin {\n async checkAgeSignals(\n _options: CheckAgeSignalsOptions,\n ): Promise<CheckAgeSignalsResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -122,7 +122,7 @@ const AgeSignals = core.registerPlugin('AgeSignals', {
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
class AgeSignalsWeb extends core.WebPlugin {
|
|
125
|
-
async checkAgeSignals() {
|
|
125
|
+
async checkAgeSignals(_options) {
|
|
126
126
|
throw this.unimplemented('Not implemented on web.');
|
|
127
127
|
}
|
|
128
128
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.0.1\n */\nexport var UserStatus;\n(function (UserStatus) {\n /**\n * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.\n *\n * @since 0.0.1\n */\n UserStatus[\"Verified\"] = \"VERIFIED\";\n /**\n * The user has a supervised Google Account managed by a parent who sets their age.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n UserStatus[\"Supervised\"] = \"SUPERVISED\";\n /**\n * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalPending\"] = \"SUPERVISED_APPROVAL_PENDING\";\n /**\n * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalDenied\"] = \"SUPERVISED_APPROVAL_DENIED\";\n /**\n * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.\n * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.\n *\n * @since 0.0.1\n */\n UserStatus[\"Unknown\"] = \"UNKNOWN\";\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n UserStatus[\"Empty\"] = \"EMPTY\";\n})(UserStatus || (UserStatus = {}));\n/**\n * @since 0.0.1\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ApiNotAvailable\"] = \"API_NOT_AVAILABLE\";\n /**\n * No Play Store app is found on the device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreNotFound\"] = \"PLAY_STORE_NOT_FOUND\";\n /**\n * No available network is found.\n *\n * @since 0.0.1\n */\n ErrorCode[\"NetworkError\"] = \"NETWORK_ERROR\";\n /**\n * Play Services is not available or its version is too old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesNotFound\"] = \"PLAY_SERVICES_NOT_FOUND\";\n /**\n * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.\n *\n * @since 0.0.1\n */\n ErrorCode[\"CannotBindToService\"] = \"CANNOT_BIND_TO_SERVICE\";\n /**\n * The Play Store app needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreVersionOutdated\"] = \"PLAY_STORE_VERSION_OUTDATED\";\n /**\n * Play Services needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesVersionOutdated\"] = \"PLAY_SERVICES_VERSION_OUTDATED\";\n /**\n * There was a transient error in the client device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ClientTransientError\"] = \"CLIENT_TRANSIENT_ERROR\";\n /**\n * The app was not installed by Google Play.\n *\n * @since 0.0.1\n */\n ErrorCode[\"AppNotOwned\"] = \"APP_NOT_OWNED\";\n /**\n * Unknown internal error.\n *\n * @since 0.0.1\n */\n ErrorCode[\"InternalError\"] = \"INTERNAL_ERROR\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst AgeSignals = registerPlugin('AgeSignals', {\n web: () => import('./web').then(m => new m.AgeSignalsWeb()),\n});\nexport * from './definitions';\nexport { AgeSignals };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AgeSignalsWeb extends WebPlugin {\n async checkAgeSignals() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["UserStatus","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACWA;AACX,CAAC,UAAU,UAAU,EAAE;AACvB;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,2BAA2B,CAAC,GAAG,6BAA6B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,0BAA0B,CAAC,GAAG,4BAA4B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;AACjC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;AACnC;AACA;AACA;AACWC;AACX,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,mBAAmB;AACtD;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,mBAAmB,CAAC,GAAG,sBAAsB;AAC3D;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,eAAe;AAC/C;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,yBAAyB;AACjE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,qBAAqB,CAAC,GAAG,wBAAwB;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,0BAA0B,CAAC,GAAG,6BAA6B;AACzE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,6BAA6B,CAAC,GAAG,gCAAgC;AAC/E;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,wBAAwB;AAChE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,eAAe;AAC9C;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,eAAe,CAAC,GAAG,gBAAgB;AACjD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;AChH5B,MAAC,UAAU,GAAGC,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/D,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.0.1\n */\nexport var UserStatus;\n(function (UserStatus) {\n /**\n * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.\n *\n * @since 0.0.1\n */\n UserStatus[\"Verified\"] = \"VERIFIED\";\n /**\n * The user has a supervised Google Account managed by a parent who sets their age.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n UserStatus[\"Supervised\"] = \"SUPERVISED\";\n /**\n * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalPending\"] = \"SUPERVISED_APPROVAL_PENDING\";\n /**\n * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalDenied\"] = \"SUPERVISED_APPROVAL_DENIED\";\n /**\n * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.\n * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.\n *\n * @since 0.0.1\n */\n UserStatus[\"Unknown\"] = \"UNKNOWN\";\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n UserStatus[\"Empty\"] = \"EMPTY\";\n})(UserStatus || (UserStatus = {}));\n/**\n * @since 0.0.1\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ApiNotAvailable\"] = \"API_NOT_AVAILABLE\";\n /**\n * No Play Store app is found on the device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreNotFound\"] = \"PLAY_STORE_NOT_FOUND\";\n /**\n * No available network is found.\n *\n * @since 0.0.1\n */\n ErrorCode[\"NetworkError\"] = \"NETWORK_ERROR\";\n /**\n * Play Services is not available or its version is too old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesNotFound\"] = \"PLAY_SERVICES_NOT_FOUND\";\n /**\n * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.\n *\n * @since 0.0.1\n */\n ErrorCode[\"CannotBindToService\"] = \"CANNOT_BIND_TO_SERVICE\";\n /**\n * The Play Store app needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreVersionOutdated\"] = \"PLAY_STORE_VERSION_OUTDATED\";\n /**\n * Play Services needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesVersionOutdated\"] = \"PLAY_SERVICES_VERSION_OUTDATED\";\n /**\n * There was a transient error in the client device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ClientTransientError\"] = \"CLIENT_TRANSIENT_ERROR\";\n /**\n * The app was not installed by Google Play.\n *\n * @since 0.0.1\n */\n ErrorCode[\"AppNotOwned\"] = \"APP_NOT_OWNED\";\n /**\n * Unknown internal error.\n *\n * @since 0.0.1\n */\n ErrorCode[\"InternalError\"] = \"INTERNAL_ERROR\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst AgeSignals = registerPlugin('AgeSignals', {\n web: () => import('./web').then(m => new m.AgeSignalsWeb()),\n});\nexport * from './definitions';\nexport { AgeSignals };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AgeSignalsWeb extends WebPlugin {\n async checkAgeSignals(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["UserStatus","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACWA;AACX,CAAC,UAAU,UAAU,EAAE;AACvB;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,2BAA2B,CAAC,GAAG,6BAA6B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,0BAA0B,CAAC,GAAG,4BAA4B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;AACjC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;AACnC;AACA;AACA;AACWC;AACX,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,mBAAmB;AACtD;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,mBAAmB,CAAC,GAAG,sBAAsB;AAC3D;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,eAAe;AAC/C;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,yBAAyB;AACjE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,qBAAqB,CAAC,GAAG,wBAAwB;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,0BAA0B,CAAC,GAAG,6BAA6B;AACzE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,6BAA6B,CAAC,GAAG,gCAAgC;AAC/E;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,wBAAwB;AAChE;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,eAAe;AAC9C;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,eAAe,CAAC,GAAG,gBAAgB;AACjD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;AChH5B,MAAC,UAAU,GAAGC,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/D,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;AACpC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.0.1\n */\nexport var UserStatus;\n(function (UserStatus) {\n /**\n * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.\n *\n * @since 0.0.1\n */\n UserStatus[\"Verified\"] = \"VERIFIED\";\n /**\n * The user has a supervised Google Account managed by a parent who sets their age.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n UserStatus[\"Supervised\"] = \"SUPERVISED\";\n /**\n * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalPending\"] = \"SUPERVISED_APPROVAL_PENDING\";\n /**\n * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalDenied\"] = \"SUPERVISED_APPROVAL_DENIED\";\n /**\n * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.\n * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.\n *\n * @since 0.0.1\n */\n UserStatus[\"Unknown\"] = \"UNKNOWN\";\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n UserStatus[\"Empty\"] = \"EMPTY\";\n})(UserStatus || (UserStatus = {}));\n/**\n * @since 0.0.1\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ApiNotAvailable\"] = \"API_NOT_AVAILABLE\";\n /**\n * No Play Store app is found on the device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreNotFound\"] = \"PLAY_STORE_NOT_FOUND\";\n /**\n * No available network is found.\n *\n * @since 0.0.1\n */\n ErrorCode[\"NetworkError\"] = \"NETWORK_ERROR\";\n /**\n * Play Services is not available or its version is too old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesNotFound\"] = \"PLAY_SERVICES_NOT_FOUND\";\n /**\n * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.\n *\n * @since 0.0.1\n */\n ErrorCode[\"CannotBindToService\"] = \"CANNOT_BIND_TO_SERVICE\";\n /**\n * The Play Store app needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreVersionOutdated\"] = \"PLAY_STORE_VERSION_OUTDATED\";\n /**\n * Play Services needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesVersionOutdated\"] = \"PLAY_SERVICES_VERSION_OUTDATED\";\n /**\n * There was a transient error in the client device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ClientTransientError\"] = \"CLIENT_TRANSIENT_ERROR\";\n /**\n * The app was not installed by Google Play.\n *\n * @since 0.0.1\n */\n ErrorCode[\"AppNotOwned\"] = \"APP_NOT_OWNED\";\n /**\n * Unknown internal error.\n *\n * @since 0.0.1\n */\n ErrorCode[\"InternalError\"] = \"INTERNAL_ERROR\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst AgeSignals = registerPlugin('AgeSignals', {\n web: () => import('./web').then(m => new m.AgeSignalsWeb()),\n});\nexport * from './definitions';\nexport { AgeSignals };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AgeSignalsWeb extends WebPlugin {\n async checkAgeSignals() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["UserStatus","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;AACWA;IACX,CAAC,UAAU,UAAU,EAAE;IACvB;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;IACvC;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,2BAA2B,CAAC,GAAG,6BAA6B;IAC3E;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,0BAA0B,CAAC,GAAG,4BAA4B;IACzE;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;IACrC;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;IACjC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;IACnC;IACA;IACA;AACWC;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,mBAAmB;IACtD;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,mBAAmB,CAAC,GAAG,sBAAsB;IAC3D;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,eAAe;IAC/C;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,yBAAyB;IACjE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,qBAAqB,CAAC,GAAG,wBAAwB;IAC/D;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,0BAA0B,CAAC,GAAG,6BAA6B;IACzE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,6BAA6B,CAAC,GAAG,gCAAgC;IAC/E;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,wBAAwB;IAChE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,eAAe;IAC9C;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,eAAe,CAAC,GAAG,gBAAgB;IACjD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;AChH5B,UAAC,UAAU,GAAGC,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.0.1\n */\nexport var UserStatus;\n(function (UserStatus) {\n /**\n * The user is over 18. Google verified the user's age using a commercially reasonable method such as a government-issued ID, credit card, or facial age estimation.\n *\n * @since 0.0.1\n */\n UserStatus[\"Verified\"] = \"VERIFIED\";\n /**\n * The user has a supervised Google Account managed by a parent who sets their age.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n *\n * @since 0.0.1\n */\n UserStatus[\"Supervised\"] = \"SUPERVISED\";\n /**\n * The user has a supervised Google Account, and their supervising parent has not yet approved one or more pending significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalPending\"] = \"SUPERVISED_APPROVAL_PENDING\";\n /**\n * The user has a supervised Google Account, and their supervising parent denied approval for one or more significant changes.\n * Use `ageLower` and `ageUpper` to determine the user's age range.\n * Use `mostRecentApprovalDate` to determine the last significant change that was approved.\n *\n * @since 0.0.1\n */\n UserStatus[\"SupervisedApprovalDenied\"] = \"SUPERVISED_APPROVAL_DENIED\";\n /**\n * The user is not verified or supervised in applicable jurisdictions and regions. These users could be over or under 18.\n * To obtain an age signal from Google Play, ask the user to visit the Play Store to resolve their status.\n *\n * @since 0.0.1\n */\n UserStatus[\"Unknown\"] = \"UNKNOWN\";\n /**\n * All other users return this value.\n *\n * @since 0.0.1\n */\n UserStatus[\"Empty\"] = \"EMPTY\";\n})(UserStatus || (UserStatus = {}));\n/**\n * @since 0.0.1\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Age Signals API is not available. The Play Store app version installed on the device might be old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ApiNotAvailable\"] = \"API_NOT_AVAILABLE\";\n /**\n * No Play Store app is found on the device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreNotFound\"] = \"PLAY_STORE_NOT_FOUND\";\n /**\n * No available network is found.\n *\n * @since 0.0.1\n */\n ErrorCode[\"NetworkError\"] = \"NETWORK_ERROR\";\n /**\n * Play Services is not available or its version is too old.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesNotFound\"] = \"PLAY_SERVICES_NOT_FOUND\";\n /**\n * Binding to the service in the Play Store has failed. This can be due to having an old Play Store version installed on the device or device memory is overloaded.\n *\n * @since 0.0.1\n */\n ErrorCode[\"CannotBindToService\"] = \"CANNOT_BIND_TO_SERVICE\";\n /**\n * The Play Store app needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayStoreVersionOutdated\"] = \"PLAY_STORE_VERSION_OUTDATED\";\n /**\n * Play Services needs to be updated.\n *\n * @since 0.0.1\n */\n ErrorCode[\"PlayServicesVersionOutdated\"] = \"PLAY_SERVICES_VERSION_OUTDATED\";\n /**\n * There was a transient error in the client device.\n *\n * @since 0.0.1\n */\n ErrorCode[\"ClientTransientError\"] = \"CLIENT_TRANSIENT_ERROR\";\n /**\n * The app was not installed by Google Play.\n *\n * @since 0.0.1\n */\n ErrorCode[\"AppNotOwned\"] = \"APP_NOT_OWNED\";\n /**\n * Unknown internal error.\n *\n * @since 0.0.1\n */\n ErrorCode[\"InternalError\"] = \"INTERNAL_ERROR\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst AgeSignals = registerPlugin('AgeSignals', {\n web: () => import('./web').then(m => new m.AgeSignalsWeb()),\n});\nexport * from './definitions';\nexport { AgeSignals };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AgeSignalsWeb extends WebPlugin {\n async checkAgeSignals(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["UserStatus","ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;AACWA;IACX,CAAC,UAAU,UAAU,EAAE;IACvB;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;IACvC;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,2BAA2B,CAAC,GAAG,6BAA6B;IAC3E;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,0BAA0B,CAAC,GAAG,4BAA4B;IACzE;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;IACrC;IACA;IACA;IACA;IACA;IACA,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;IACjC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;IACnC;IACA;IACA;AACWC;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,iBAAiB,CAAC,GAAG,mBAAmB;IACtD;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,mBAAmB,CAAC,GAAG,sBAAsB;IAC3D;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,eAAe;IAC/C;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,yBAAyB;IACjE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,qBAAqB,CAAC,GAAG,wBAAwB;IAC/D;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,0BAA0B,CAAC,GAAG,6BAA6B;IACzE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,6BAA6B,CAAC,GAAG,gCAAgC;IAC/E;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,sBAAsB,CAAC,GAAG,wBAAwB;IAChE;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,eAAe;IAC9C;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,eAAe,CAAC,GAAG,gBAAgB;IACjD,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;AChH5B,UAAC,UAAU,GAAGC,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;IACpC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
#if canImport(DeclaredAgeRange)
|
|
4
|
+
import DeclaredAgeRange
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
@objc public class AgeSignals: NSObject {
|
|
8
|
+
let plugin: AgeSignalsPlugin
|
|
9
|
+
|
|
10
|
+
init(plugin: AgeSignalsPlugin) {
|
|
11
|
+
self.plugin = plugin
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@objc func checkAgeSignals(_ options: CheckAgeSignalsOptions, completion: @escaping (CheckAgeSignalsResult?, Error?) -> Void) {
|
|
15
|
+
#if canImport(DeclaredAgeRange)
|
|
16
|
+
if #available(iOS 26.0, *) {
|
|
17
|
+
Task { @MainActor in
|
|
18
|
+
do {
|
|
19
|
+
guard let viewController = self.plugin.bridge?.viewController else {
|
|
20
|
+
completion(nil, CustomError.presentationContextUnavailable)
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let response: AgeRangeService.Response
|
|
25
|
+
|
|
26
|
+
switch options.ageGates.count {
|
|
27
|
+
case 2:
|
|
28
|
+
response = try await AgeRangeService.shared.requestAgeRange(
|
|
29
|
+
ageGates: options.ageGates[0], options.ageGates[1],
|
|
30
|
+
in: viewController
|
|
31
|
+
)
|
|
32
|
+
case 3:
|
|
33
|
+
response = try await AgeRangeService.shared.requestAgeRange(
|
|
34
|
+
ageGates: options.ageGates[0], options.ageGates[1], options.ageGates[2],
|
|
35
|
+
in: viewController
|
|
36
|
+
)
|
|
37
|
+
default:
|
|
38
|
+
completion(nil, CustomError.illegalAgeGates)
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let result = Self.mapResponseToResult(response)
|
|
43
|
+
completion(result, nil)
|
|
44
|
+
} catch {
|
|
45
|
+
completion(nil, error)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
completion(nil, CustomError.apiNotAvailable)
|
|
50
|
+
}
|
|
51
|
+
#else
|
|
52
|
+
completion(nil, CustomError.apiNotAvailable)
|
|
53
|
+
#endif
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#if canImport(DeclaredAgeRange)
|
|
57
|
+
@available(iOS 26.0, *)
|
|
58
|
+
private static func mapResponseToResult(
|
|
59
|
+
_ response: AgeRangeService.Response
|
|
60
|
+
) -> CheckAgeSignalsResult {
|
|
61
|
+
switch response {
|
|
62
|
+
case .declinedSharing:
|
|
63
|
+
return CheckAgeSignalsResult(
|
|
64
|
+
userStatus: .unknown,
|
|
65
|
+
ageLower: nil,
|
|
66
|
+
ageUpper: nil,
|
|
67
|
+
mostRecentApprovalDate: nil,
|
|
68
|
+
installId: nil
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
case .sharing(let range):
|
|
72
|
+
let lower = range.lowerBound
|
|
73
|
+
let upper = range.upperBound
|
|
74
|
+
|
|
75
|
+
let status: UserStatus
|
|
76
|
+
if let lower, lower >= 18 {
|
|
77
|
+
status = .verified
|
|
78
|
+
} else if let upper, upper < 18 {
|
|
79
|
+
status = .supervised
|
|
80
|
+
} else {
|
|
81
|
+
status = .unknown
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return CheckAgeSignalsResult(
|
|
85
|
+
userStatus: status,
|
|
86
|
+
ageLower: lower,
|
|
87
|
+
ageUpper: upper,
|
|
88
|
+
mostRecentApprovalDate: nil,
|
|
89
|
+
installId: nil
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
@unknown default:
|
|
93
|
+
return CheckAgeSignalsResult(
|
|
94
|
+
userStatus: .empty,
|
|
95
|
+
ageLower: nil,
|
|
96
|
+
ageUpper: nil,
|
|
97
|
+
mostRecentApprovalDate: nil,
|
|
98
|
+
installId: nil
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
#endif
|
|
103
|
+
}
|
|
@@ -9,7 +9,43 @@ public class AgeSignalsPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
9
9
|
CAPPluginMethod(name: "checkAgeSignals", returnType: CAPPluginReturnPromise)
|
|
10
10
|
]
|
|
11
11
|
|
|
12
|
+
public static let tag = "AgeSignalsPlugin"
|
|
13
|
+
|
|
14
|
+
var implementation: AgeSignals?
|
|
15
|
+
|
|
16
|
+
override public func load() {
|
|
17
|
+
self.implementation = AgeSignals(plugin: self)
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
@objc func checkAgeSignals(_ call: CAPPluginCall) {
|
|
13
|
-
|
|
21
|
+
do {
|
|
22
|
+
let options = CheckAgeSignalsOptions(call)
|
|
23
|
+
implementation?.checkAgeSignals(options) { result, error in
|
|
24
|
+
if let error = error {
|
|
25
|
+
self.rejectCall(call, error)
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
self.resolveCall(call, result)
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
rejectCall(call, error)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private func rejectCall(_ call: CAPPluginCall, _ error: Error) {
|
|
36
|
+
CAPLog.print("[", AgeSignalsPlugin.tag, "] ", error)
|
|
37
|
+
call.reject(error.localizedDescription)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private func resolveCall(_ call: CAPPluginCall) {
|
|
41
|
+
call.resolve()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private func resolveCall(_ call: CAPPluginCall, _ result: Result?) {
|
|
45
|
+
if let result = result?.toJSObject() as? JSObject {
|
|
46
|
+
call.resolve(result)
|
|
47
|
+
} else {
|
|
48
|
+
call.resolve()
|
|
49
|
+
}
|
|
14
50
|
}
|
|
15
51
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Capacitor
|
|
2
|
+
|
|
3
|
+
@objc class CheckAgeSignalsResult: NSObject, Result {
|
|
4
|
+
let userStatus: UserStatus
|
|
5
|
+
let ageLower: Int?
|
|
6
|
+
let ageUpper: Int?
|
|
7
|
+
let mostRecentApprovalDate: String?
|
|
8
|
+
let installId: String?
|
|
9
|
+
|
|
10
|
+
init(
|
|
11
|
+
userStatus: UserStatus,
|
|
12
|
+
ageLower: Int? = nil,
|
|
13
|
+
ageUpper: Int? = nil,
|
|
14
|
+
mostRecentApprovalDate: String? = nil,
|
|
15
|
+
installId: String? = nil
|
|
16
|
+
) {
|
|
17
|
+
self.userStatus = userStatus
|
|
18
|
+
self.ageLower = ageLower
|
|
19
|
+
self.ageUpper = ageUpper
|
|
20
|
+
self.mostRecentApprovalDate = mostRecentApprovalDate
|
|
21
|
+
self.installId = installId
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
func toJSObject() -> AnyObject {
|
|
25
|
+
var result = JSObject()
|
|
26
|
+
result["userStatus"] = userStatus.rawValue
|
|
27
|
+
result["ageLower"] = ageLower
|
|
28
|
+
result["ageUpper"] = ageUpper
|
|
29
|
+
result["mostRecentApprovalDate"] = mostRecentApprovalDate
|
|
30
|
+
result["installId"] = installId
|
|
31
|
+
return result as AnyObject
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
public enum CustomError: Error {
|
|
4
|
+
case apiNotAvailable
|
|
5
|
+
case illegalAgeGates
|
|
6
|
+
case presentationContextUnavailable
|
|
7
|
+
case declinedSharing
|
|
8
|
+
case unknown
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
extension CustomError: LocalizedError {
|
|
12
|
+
public var errorDescription: String? {
|
|
13
|
+
switch self {
|
|
14
|
+
case .apiNotAvailable:
|
|
15
|
+
return NSLocalizedString("Age range service is not available on this device or iOS version.", comment: "apiNotAvailable")
|
|
16
|
+
case .illegalAgeGates:
|
|
17
|
+
return NSLocalizedString("Age gates must contain at least 2 and at most 3 ages.", comment: "illegalAgeGates")
|
|
18
|
+
case .presentationContextUnavailable:
|
|
19
|
+
return NSLocalizedString("Unable to find a view controller to present the age range dialog.", comment: "presentationContextUnavailable")
|
|
20
|
+
case .declinedSharing:
|
|
21
|
+
return NSLocalizedString("The user or guardian declined to share their age range.", comment: "declinedSharing")
|
|
22
|
+
case .unknown:
|
|
23
|
+
return NSLocalizedString("An unknown error occurred.", comment: "unknown")
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
enum UserStatus: String {
|
|
2
|
+
case verified = "VERIFIED"
|
|
3
|
+
case supervised = "SUPERVISED"
|
|
4
|
+
case supervisedApprovalPending = "SUPERVISED_APPROVAL_PENDING"
|
|
5
|
+
case supervisedApprovalDenied = "SUPERVISED_APPROVAL_DENIED"
|
|
6
|
+
case unknown = "UNKNOWN"
|
|
7
|
+
case empty = "EMPTY"
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-age-signals",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-dev.1765885034",
|
|
4
4
|
"description": "Capacitor plugin to use the Play Age Signals API to retrieve age-related signals for users.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -57,23 +57,23 @@
|
|
|
57
57
|
"prepublishOnly": "npm run build"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@capacitor/android": "
|
|
61
|
-
"@capacitor/cli": "
|
|
62
|
-
"@capacitor/core": "
|
|
63
|
-
"@capacitor/docgen": "0.3.
|
|
64
|
-
"@capacitor/ios": "
|
|
60
|
+
"@capacitor/android": "8.0.0",
|
|
61
|
+
"@capacitor/cli": "8.0.0",
|
|
62
|
+
"@capacitor/core": "8.0.0",
|
|
63
|
+
"@capacitor/docgen": "0.3.1",
|
|
64
|
+
"@capacitor/ios": "8.0.0",
|
|
65
65
|
"@ionic/eslint-config": "0.4.0",
|
|
66
66
|
"@ionic/swiftlint-config": "2.0.0",
|
|
67
67
|
"eslint": "8.57.0",
|
|
68
68
|
"prettier": "3.4.2",
|
|
69
69
|
"prettier-plugin-java": "2.6.7",
|
|
70
|
-
"rimraf": "6.
|
|
71
|
-
"rollup": "4.
|
|
70
|
+
"rimraf": "6.1.2",
|
|
71
|
+
"rollup": "4.53.3",
|
|
72
72
|
"swiftlint": "2.0.0",
|
|
73
|
-
"typescript": "
|
|
73
|
+
"typescript": "5.9.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@capacitor/core": ">=
|
|
76
|
+
"@capacitor/core": ">=8.0.0"
|
|
77
77
|
},
|
|
78
78
|
"swiftlint": "@ionic/swiftlint-config",
|
|
79
79
|
"eslintConfig": {
|