@capawesome/capacitor-age-signals 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -1,13 +1,17 @@
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 retrieve age-related signals for users.
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-deploy-real-time-app-updates.png?t=1" />
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
+
11
15
  ## Installation
12
16
 
13
17
  ```bash
@@ -21,10 +25,23 @@ npx cap sync
21
25
 
22
26
  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
27
 
24
- - `$androidPlayAgeSignalsVersion` version of `com.google.android.play:age-signals` (default: `0.0.1-beta01`)
28
+ - `$androidPlayAgeSignalsVersion` version of `com.google.android.play:age-signals` (default: `0.0.1-beta02`)
25
29
 
26
30
  This can be useful if you encounter dependency conflicts with other plugins in your project.
27
31
 
32
+ ### iOS
33
+
34
+ #### Entitlements
35
+
36
+ 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:
37
+
38
+ ```xml
39
+ <key>com.apple.developer.declared-age-range</key>
40
+ <true/>
41
+ ```
42
+
43
+ Check out the [Apple documentation](https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.contacts.notes) for more information.
44
+
28
45
  ## Configuration
29
46
 
30
47
  No configuration required for this plugin.
@@ -46,7 +63,7 @@ const checkAgeSignals = async () => {
46
63
 
47
64
  <docgen-index>
48
65
 
49
- * [`checkAgeSignals()`](#checkagesignals)
66
+ * [`checkAgeSignals(...)`](#checkagesignals)
50
67
  * [Interfaces](#interfaces)
51
68
  * [Enums](#enums)
52
69
 
@@ -55,15 +72,17 @@ const checkAgeSignals = async () => {
55
72
  <docgen-api>
56
73
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
57
74
 
58
- ### checkAgeSignals()
75
+ ### checkAgeSignals(...)
59
76
 
60
77
  ```typescript
61
- checkAgeSignals() => Promise<CheckAgeSignalsResult>
78
+ checkAgeSignals(options?: CheckAgeSignalsOptions | undefined) => Promise<CheckAgeSignalsResult>
62
79
  ```
63
80
 
64
- Request the user's age signals from Google Play.
81
+ Request the user's age signals.
65
82
 
66
- Only available on Android.
83
+ | Param | Type |
84
+ | ------------- | ------------------------------------------------------------------------- |
85
+ | **`options`** | <code><a href="#checkagesignalsoptions">CheckAgeSignalsOptions</a></code> |
67
86
 
68
87
  **Returns:** <code>Promise&lt;<a href="#checkagesignalsresult">CheckAgeSignalsResult</a>&gt;</code>
69
88
 
@@ -77,13 +96,20 @@ Only available on Android.
77
96
 
78
97
  #### CheckAgeSignalsResult
79
98
 
80
- | Prop | Type | Description | Since |
81
- | ---------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
82
- | **`userStatus`** | <code><a href="#userstatus">UserStatus</a></code> | The user's verification status. | 0.0.1 |
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`. | 0.0.1 |
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. | 0.0.1 |
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 |
99
+ | Prop | Type | Description | Since |
100
+ | ---------------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
101
+ | **`userStatus`** | <code><a href="#userstatus">UserStatus</a></code> | The user's verification status. | 0.0.1 |
102
+ | **`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 |
103
+ | **`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 |
104
+ | **`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 |
105
+ | **`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 |
106
+
107
+
108
+ #### CheckAgeSignalsOptions
109
+
110
+ | Prop | Type | Description | Default | Since |
111
+ | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------- | ----- |
112
+ | **`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
113
 
88
114
 
89
115
  ### Enums
@@ -3,7 +3,7 @@ ext {
3
3
  androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
4
4
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
5
5
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
6
- androidPlayAgeSignalsVersion = project.hasProperty('androidPlayAgeSignalsVersion') ? rootProject.ext.androidPlayAgeSignalsVersion : '0.0.1-beta01'
6
+ androidPlayAgeSignalsVersion = project.hasProperty('androidPlayAgeSignalsVersion') ? rootProject.ext.androidPlayAgeSignalsVersion : '0.0.1-beta02'
7
7
  }
8
8
 
9
9
  buildscript {
@@ -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().toString());
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(@NonNull String status) {
58
- switch (status) {
59
- case "VERIFIED":
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 from Google Play.\n\nOnly available on Android.",
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 from Google Play.
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":"AA+DA;;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 from Google Play.\n *\n * Only available on Android.\n *\n * @since 0.0.1\n */\n checkAgeSignals(): Promise<CheckAgeSignalsResult>;\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 * @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 * @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"]}
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
@@ -1,6 +1,6 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  export class AgeSignalsWeb extends WebPlugin {
3
- async checkAgeSignals() {
3
+ async checkAgeSignals(_options) {
4
4
  throw this.unimplemented('Not implemented on web.');
5
5
  }
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AgeSignalsPlugin, CheckAgeSignalsResult } from './definitions';\n\nexport class AgeSignalsWeb extends WebPlugin implements AgeSignalsPlugin {\n async checkAgeSignals(): Promise<CheckAgeSignalsResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
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"]}
@@ -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
  }
@@ -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,GAAG;AAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA;;;;;;;;;"}
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;AACA;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -121,7 +121,7 @@ var capacitorAgeSignals = (function (exports, core) {
121
121
  });
122
122
 
123
123
  class AgeSignalsWeb extends core.WebPlugin {
124
- async checkAgeSignals() {
124
+ async checkAgeSignals(_options) {
125
125
  throw this.unimplemented('Not implemented on web.');
126
126
  }
127
127
  }
@@ -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,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA;;;;;;;;;;;;;;;"}
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;IACA;;;;;;;;;;;;;;;"}
@@ -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
- call.unimplemented("Not implemented on iOS.")
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,11 @@
1
+ import Capacitor
2
+
3
+ @objc class CheckAgeSignalsOptions: NSObject {
4
+ var ageGates = [13, 15, 18]
5
+
6
+ init(_ call: CAPPluginCall) {
7
+ if let ageGates = call.getArray("ageGates") as? [Int] {
8
+ self.ageGates = ageGates
9
+ }
10
+ }
11
+ }
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ import Capacitor
2
+
3
+ @objc public protocol Result {
4
+ @objc func toJSObject() -> AnyObject
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/capacitor-age-signals",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
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",