Skip to content

Commit e82a3a2

Browse files
committed
Add Alpha for Age Range
1 parent a7aae31 commit e82a3a2

5 files changed

Lines changed: 217 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# ageRange
2+
3+
> --------------------- ------------------------------------------------------------------------------------------
4+
> __Type__ [Event][api.type.Event]
5+
> __Revision__ [REVISION_LABEL](REVISION_URL)
6+
> __Keywords__ age range, age verification, parental controls, Screen Time, ageRange
7+
> __See also__ [plugin.ageRange.init()][plugin.ageRange.init]
8+
> [plugin.ageRange.requestAgeRange()][plugin.ageRange.requestAgeRange]
9+
> [plugin.ageRange.*][plugin.ageRange]
10+
> --------------------- ------------------------------------------------------------------------------------------
11+
12+
## Overview
13+
14+
The following event properties are passed to the listener function specified in [plugin.ageRange.init()][plugin.ageRange.init].
15+
16+
17+
## Properties
18+
19+
#### event.name
20+
21+
_[String][api.type.String]._ The name of the event. Always `"ageRange"`.
22+
23+
#### event.isError
24+
25+
_[Boolean][api.type.Boolean]._ Indicates whether an error occurred. If `true`, check `event.errorMessage` for details.
26+
27+
#### event.errorMessage
28+
29+
_[String][api.type.String]._ Error message if `event.isError` is `true`.
30+
31+
#### event.isAvailable
32+
33+
_[Boolean][api.type.Boolean]._ Indicates whether the age range service is available on this device.
34+
35+
#### event.declined
36+
37+
_[Boolean][api.type.Boolean]._ Indicates whether the user declined to share their age range.
38+
39+
#### event.lowerBound
40+
41+
_[Number][api.type.Number]._ The lower bound of the user's age range (e.g., 13, 18, 21). Only present if age range was shared.
42+
43+
#### event.upperBound
44+
45+
_[Number][api.type.Number]._ The upper bound of the user's age range. Only present if age range was shared and there is an upper limit.
46+
47+
#### event.userStatus
48+
49+
_[String][api.type.String]._ The user's verification status. Possible values include:
50+
- `"verified"` — User is a verified adult (18+) with no parental controls
51+
- `"supervised"` — User has active parental controls
52+
- `"declined"` — User declined to share age range
53+
- `"notAvailable"` — Age range service not available
54+
- `"error"` — An error occurred
55+
56+
#### event.hasParentalControls
57+
58+
_[Boolean][api.type.Boolean]._ Indicates whether the user has active parental controls (Screen Time restrictions). Only present if age range was shared.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# ageRange.*
2+
3+
> --------------------- ------------------------------------------------------------------------------------------
4+
> __Type__ [Library][api.type.Library]
5+
> __Revision__ [REVISION_LABEL](REVISION_URL)
6+
> __Keywords__ utf8, UTF-8, Unicode, string
7+
> __Platforms__ Android, iOS
8+
> --------------------- ------------------------------------------------------------------------------------------
9+
10+
11+
## Overview
12+
13+
This plugin is stil in alpha but is used for getting age range and app approval for the new Apple and Google apis. Google and Apple are still refining these apis. This is designed to handle new state laws in Texas and other states for app permission.
14+
15+
16+
17+
18+
## Syntax
19+
20+
local ageRange = require("plugin.ageRange")
21+
22+
23+
## Functions
24+
25+
#### [ageRange.init()][plugin.ageRange.init]
26+
27+
#### [ageRange.requestAgeRange()][plugin.ageRange.requestAgeRange]
28+
29+
30+
31+
## Project Settings
32+
33+
To use this plugin, add an entry into the `plugins` table of `build.settings`. When added, the build server will integrate the plugin during the build phase.
34+
35+
``````{ brush="lua" gutter="false" first-line="1" highlight="[5,6,7,8]" }
36+
settings =
37+
{
38+
plugins =
39+
{
40+
["plugin.utf8"] =
41+
{
42+
publisherId = "com.solar2d"
43+
},
44+
},
45+
}
46+
``````
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ageRange.init()
2+
3+
> --------------------- ------------------------------------------------------------------------------------------
4+
> __Type__ [Function][api.type.Function]
5+
> __Library__ [plugin.ageRange.*][plugin.ageRange]
6+
> __Return value__ none
7+
> __Revision__ [REVISION_LABEL](REVISION_URL)
8+
> __Keywords__ age range, age verification, parental controls, Screen Time, iOS 18
9+
> __See also__ [plugin.ageRange.requestAgeRange()][plugin.ageRange.requestAgeRange]
10+
>
11+
> [ageRange][plugin.ageRange.event.ageRange]
12+
> --------------------- ------------------------------------------------------------------------------------------
13+
14+
15+
## Overview
16+
17+
Initializes the Age Range plugin and sets up the listener function to receive age verification events.
18+
19+
20+
## Syntax
21+
22+
plugin.ageRange.init( listener )
23+
24+
##### listener ~^(required)^~
25+
_[Listener][api.type.Listener]._ Function that will receive [ageRange][plugin.ageRange.event.ageRange] events.
26+
27+
28+
## Example
29+
30+
``````lua
31+
local ageRange = require( "plugin.ageRange" )
32+
33+
local function ageRangeListener( event )
34+
if event.isError then
35+
print( "Error:", event.errorMessage )
36+
elseif not event.isAvailable then
37+
print( "Age range not available" )
38+
elseif event.declined then
39+
print( "User declined to share age range" )
40+
else
41+
print( "Lower bound:", event.lowerBound )
42+
print( "Upper bound:", event.upperBound )
43+
print( "User status:", event.userStatus )
44+
print( "Has parental controls:", event.hasParentalControls )
45+
end
46+
end
47+
48+
-- Initialize the plugin
49+
ageRange.init( ageRangeListener )
50+
51+
-- Later, request age range
52+
ageRange.requestAgeRange( )
53+
``````
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# ageRange.requestAgeRange()
2+
3+
> --------------------- ------------------------------------------------------------------------------------------
4+
> __Type__ [Function][api.type.Function]
5+
> __Library__ [plugin.ageRange.*][plugin.ageRange]
6+
> __Return value__ none
7+
> __Revision__ [REVISION_LABEL](REVISION_URL)
8+
> __Keywords__ age range, age verification, parental controls, Screen Time, iOS 18
9+
> __See also__ [plugin.ageRange.init()][plugin.ageRange.init]
10+
>
11+
> [ageRange][plugin.ageRange.event.ageRange]
12+
> --------------------- ------------------------------------------------------------------------------------------
13+
14+
15+
## Overview
16+
17+
Requests the user's age range with custom age gates. The user will be prompted to share their age range through the iOS Screen Time system. Results are returned through the listener function set in [plugin.ageRange.init()][plugin.ageRange.init].
18+
19+
This feature requires iOS 26.0 or later.
20+
21+
22+
## Syntax
23+
24+
plugin.ageRange.requestAgeRange( )
25+
26+
27+
28+
## Example
29+
30+
``````lua
31+
local ageRange = require( "plugin.ageRange" )
32+
33+
local function ageRangeListener( event )
34+
if event.isError then
35+
print( "Error:", event.errorMessage )
36+
elseif not event.isAvailable then
37+
print( "Age range not available" )
38+
elseif event.declined then
39+
print( "User declined to share age range" )
40+
else
41+
print( "Lower bound:", event.lowerBound )
42+
print( "Upper bound:", event.upperBound )
43+
print( "User status:", event.userStatus )
44+
45+
-- Check user status
46+
if event.userStatus == "verified" then
47+
print( "User is a verified adult (18+)" )
48+
elseif event.userStatus == "supervised" then
49+
print( "User has parental controls active" )
50+
end
51+
end
52+
end
53+
54+
-- Initialize the plugin
55+
ageRange.init( ageRangeListener )
56+
57+
-- Request age range with custom gates
58+
ageRange.requestAgeRange( )
59+
``````

markdown/plugin/index.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ Interested in [creating a plugin][native.plugin]? Please see our [Plugins][nativ
369369
#### [Activity Popup][plugin.CoronaProvider_native_popup_activity]
370370
#### [Address Book][plugin.CoronaProvider_native_popup_addressbook]
371371
#### [Advertising ID][plugin.advertisingId]
372+
#### [Age Range][plugin.ageRange]
372373
#### [Animation][plugin.animation]
373374
#### [App Tracking Transparency][plugin.att]
374375
#### [Battery State][plugin.batteryState]

0 commit comments

Comments
 (0)