Skip to content

Commit 78e39c9

Browse files
committed
Age Range Updates
1 parent 10c5249 commit 78e39c9

9 files changed

Lines changed: 1171 additions & 75 deletions
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# event.ageRange
2+
3+
> --------------------- ------------------------------------------------------------------------------------------
4+
> __Type__ [Event][api.type.Event]
5+
> __Revision__ [REVISION_LABEL](__REVISION_URL__)
6+
> __Keywords__ age range, age verification, parental controls, ageRangeEvent
7+
> __See also__ [plugin.ageRange.requestAgeRange()][plugin.ageRange.requestAgeRange]
8+
> [plugin.ageRange.*][plugin.ageRange]
9+
> --------------------- ------------------------------------------------------------------------------------------
10+
11+
## Overview
12+
13+
Age range event dispatched in response to [plugin.ageRange.requestAgeRange()][plugin.ageRange.requestAgeRange].
14+
15+
## Properties
16+
17+
#### [event.name][plugin.ageRange.event.ageRange.name]
18+
#### [event.isError][plugin.ageRange.event.ageRange.isError]
19+
#### [event.isAvailable][plugin.ageRange.event.ageRange.isAvailable]
20+
#### [event.declined][plugin.ageRange.event.ageRange.declined]
21+
#### [event.lowerBound][plugin.ageRange.event.ageRange.lowerBound]
22+
#### [event.upperBound][plugin.ageRange.event.ageRange.upperBound]
23+
#### [event.userStatus][plugin.ageRange.event.ageRange.userStatus]
24+
#### [event.hasParentalControls][plugin.ageRange.event.ageRange.hasParentalControls]
25+
#### [event.errorMessage][plugin.ageRange.event.ageRange.errorMessage]
26+
#### [event.errorCode][plugin.ageRange.event.ageRange.errorCode]
27+
#### [event.installId][plugin.ageRange.event.ageRange.installId]
28+
#### [event.mostRecentApprovalDate][plugin.ageRange.event.ageRange.mostRecentApprovalDate]
29+
30+
---
31+
32+
## Property Details
33+
34+
### event.name
35+
36+
_[String][api.type.String]._ The string `"ageRangeEvent"`.
37+
38+
---
39+
40+
### event.isError
41+
42+
_[Boolean][api.type.Boolean]._ `true` if an error occurred, `false` otherwise.
43+
44+
---
45+
46+
### event.isAvailable
47+
48+
_[Boolean][api.type.Boolean]._ `true` if age range service is available on this device, `false` otherwise.
49+
50+
**Platform Notes:**
51+
- **iOS:** Available on iOS 26.0+ devices
52+
- **Android:** Available if Google Play Services is installed and up-to-date
53+
54+
---
55+
56+
### event.declined
57+
58+
_[Boolean][api.type.Boolean]._ `true` if user declined to share age range, `false` otherwise.
59+
60+
**iOS Only:** User explicitly chose not to share their age range through the system dialog.
61+
62+
---
63+
64+
### event.lowerBound
65+
66+
_[Number][api.type.Number]._ Minimum age in the user's age range. May be `nil`.
67+
68+
**Examples:**
69+
- `13` - User is at least 13 years old
70+
- `18` - User is at least 18 years old (verified adult)
71+
- `nil` - No age range provided or user is under minimum age gate
72+
73+
---
74+
75+
### event.upperBound
76+
77+
_[Number][api.type.Number]._ Maximum age in the user's age range. May be `nil`.
78+
79+
**Examples:**
80+
- `17` - User is between lowerBound and 17 years old
81+
- `nil` - No upper limit (typically for verified adults 18+)
82+
83+
---
84+
85+
### event.userStatus
86+
87+
_[String][api.type.String]._ User verification status. Possible values:
88+
89+
**iOS & Android:**
90+
- `"verified"` - Verified adult (18+), no parental controls
91+
- `"supervised"` - User with active parental controls (iOS) or Family Link supervision (Android)
92+
- `"declined"` - User declined to share age range (iOS)
93+
- `"notAvailable"` - Age range service not available
94+
- `"error"` - Error occurred
95+
96+
**Android Only:**
97+
- `"approvalPending"` - Waiting for parental approval
98+
- `"approvalDenied"` - Parental approval was denied
99+
- `"unknown"` - Age status unknown, user needs to verify in Play Store
100+
- `"empty"` - No age data available
101+
102+
---
103+
104+
### event.hasParentalControls
105+
106+
_[Boolean][api.type.Boolean]._ `true` if user has active parental controls or supervision.
107+
108+
**Platform Details:**
109+
- **iOS:** Screen Time restrictions are active
110+
- **Android:** Family Link supervision is enabled
111+
112+
---
113+
114+
### event.errorMessage
115+
116+
_[String][api.type.String]._ Human-readable error message if `isError` is `true`.
117+
118+
**Common Error Messages:**
119+
120+
**iOS:**
121+
- `"Age range service not available"` - Device doesn't support the API
122+
- `"User declined to share age range"` - User chose not to share
123+
124+
**Android:**
125+
- `"Age Signals API not available. Please update Play Store."`
126+
- `"Play Store not found. Please install or enable Play Store."`
127+
- `"Network error. Please check connection."`
128+
- `"User age status unknown. Please verify in Play Store."`
129+
130+
---
131+
132+
### event.errorCode
133+
134+
_[Number][api.type.Number]._ Numeric error code. **Android only.**
135+
136+
Error codes:
137+
- `-1` - API not available (Play Services outdated)
138+
- `-2` - Play Store not found or disabled
139+
- `-3` - Network error
140+
141+
---
142+
143+
### event.installId
144+
145+
_[String][api.type.String]._ Unique install identifier for supervised users. **Android only.**
146+
147+
Used to track individual app installations under Family Link supervision. Useful for:
148+
- Tracking approval requests across app reinstalls
149+
- Associating permissions with specific device installations
150+
151+
---
152+
153+
### event.mostRecentApprovalDate
154+
155+
_[Number][api.type.Number]._ Timestamp (milliseconds since Unix epoch) of most recent parental approval. **Android only.**
156+
157+
Convert to readable date:
158+
``````lua
159+
if event.mostRecentApprovalDate then
160+
local dateStr = os.date("%c", event.mostRecentApprovalDate/1000)
161+
print("Last approved:", dateStr)
162+
end
163+
``````
164+
165+
---
166+
167+
## Example
168+
``````lua
169+
local function ageRangeListener(event)
170+
if event.name == "ageRangeEvent" then
171+
print("Event name:", event.name)
172+
print("Is error:", event.isError)
173+
print("Is available:", event.isAvailable)
174+
print("Declined:", event.declined)
175+
176+
if event.lowerBound then
177+
print("Lower bound:", event.lowerBound)
178+
end
179+
180+
if event.upperBound then
181+
print("Upper bound:", event.upperBound)
182+
end
183+
184+
print("User status:", event.userStatus)
185+
print("Has parental controls:", event.hasParentalControls)
186+
187+
-- Android-specific
188+
if event.installId then
189+
print("Install ID:", event.installId)
190+
end
191+
192+
if event.mostRecentApprovalDate then
193+
local date = os.date("%c", event.mostRecentApprovalDate/1000)
194+
print("Last approval:", date)
195+
end
196+
197+
if event.errorCode then
198+
print("Error code:", event.errorCode)
199+
end
200+
end
201+
end
202+
``````
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# event.communication
2+
3+
> --------------------- ------------------------------------------------------------------------------------------
4+
> __Type__ [Event][api.type.Event]
5+
> __Revision__ [REVISION_LABEL](__REVISION_URL__)
6+
> __Keywords__ communication, parental approval, contact permissions, communicationEvent
7+
> __See also__ [plugin.ageRange.requestCommunicationPermission()][plugin.ageRange.requestCommunicationPermission]
8+
> [plugin.ageRange.*][plugin.ageRange]
9+
> --------------------- ------------------------------------------------------------------------------------------
10+
11+
## Overview
12+
13+
Communication permission event dispatched in response to [plugin.ageRange.requestCommunicationPermission()][plugin.ageRange.requestCommunicationPermission] and background responses.
14+
15+
## Properties
16+
17+
### event.name
18+
19+
_[String][api.type.String]._ The string `"communicationEvent"`.
20+
21+
---
22+
23+
### event.isError
24+
25+
_[Boolean][api.type.Boolean]._ `true` if an error occurred, `false` otherwise.
26+
27+
---
28+
29+
### event.handle
30+
31+
_[String][api.type.String]._ The contact handle (phone, email, or custom ID) from the request.
32+
33+
---
34+
35+
### event.handleKind
36+
37+
_[String][api.type.String]._ Type of handle: `"phone"`, `"email"`, or `"custom"`. **Android only** in responses.
38+
39+
---
40+
41+
### event.questionSent
42+
43+
_[Boolean][api.type.Boolean]._ `true` if the permission request was successfully sent to the parent/guardian. **iOS only.**
44+
45+
---
46+
47+
### event.isBackgroundResponse
48+
49+
_[Boolean][api.type.Boolean]._ `true` if this is an asynchronous response from a parent/guardian. **iOS only.**
50+
51+
---
52+
53+
### event.approved
54+
55+
_[Boolean][api.type.Boolean]._ `true` if the parent/guardian approved communication, `false` if denied.
56+
57+
**iOS:** Present when `isBackgroundResponse` is `true`
58+
59+
---
60+
61+
### event.isSupervised
62+
63+
_[Boolean][api.type.Boolean]._ `true` if user is under supervision (Family Link). **Android only.**
64+
65+
---
66+
67+
### event.requiresParentalApproval
68+
69+
_[Boolean][api.type.Boolean]._ `true` if communication requires parental approval. **Android only.**
70+
71+
---
72+
73+
### event.userStatus
74+
75+
_[String][api.type.String]._ Supervision status. **Android only.**
76+
77+
Values:
78+
- `"supervised"` - User is supervised
79+
- `"approvalPending"` - Approval pending
80+
- `"approvalDenied"` - Approval denied
81+
82+
---
83+
84+
### event.platform
85+
86+
_[String][api.type.String]._ Platform identifier: `"android"` or `"ios"`.
87+
88+
---
89+
90+
### event.store
91+
92+
_[String][api.type.String]._ App store identifier. Currently only `"google"` for Android.
93+
94+
---
95+
96+
### event.message
97+
98+
_[String][api.type.String]._ Platform-specific informational message.
99+
100+
**Android:** Explains that Android doesn't have direct communication approval equivalent.
101+
102+
---
103+
104+
### event.errorMessage
105+
106+
_[String][api.type.String]._ Error description if `isError` is `true`.
107+
108+
---
109+
110+
## Example
111+
``````lua
112+
local function ageRangeListener(event)
113+
if event.name == "communicationEvent" then
114+
print("Handle:", event.handle)
115+
116+
if event.platform == "android" then
117+
print("Platform:", event.platform)
118+
print("Message:", event.message)
119+
120+
if event.isSupervised then
121+
print("User is supervised")
122+
print("Requires approval:", event.requiresParentalApproval)
123+
print("Status:", event.userStatus)
124+
else
125+
print("User not supervised")
126+
end
127+
128+
else
129+
-- iOS
130+
if event.questionSent then
131+
print("Request sent to parent")
132+
133+
elseif event.isBackgroundResponse then
134+
if event.approved then
135+
print("Communication approved")
136+
else
137+
print("Communication denied")
138+
end
139+
end
140+
end
141+
142+
if event.isError then
143+
print("Error:", event.errorMessage)
144+
end
145+
end
146+
end
147+
``````

0 commit comments

Comments
 (0)