@@ -37,28 +37,31 @@ export function SimpleTab() {
3737
3838 const [ activities , refreshActivities ] = useActivities ( ) ;
3939
40- const onPressRequestCallback = useCallback ( async ( ) => {
41- if ( authorizationStatus === AuthorizationStatus . notDetermined ) {
42- await requestAuthorization ( ) ;
43- } else if ( authorizationStatus === AuthorizationStatus . denied ) {
44- Alert . alert (
45- "You didn't grant access" ,
46- "Please go to settings and enable it" ,
47- [
48- {
49- text : "Open settings" ,
50- onPress : ( ) => Linking . openSettings ( ) ,
51- } ,
52- {
53- text : "Cancel" ,
54- style : "cancel" ,
55- } ,
56- ] ,
57- ) ;
58- } else {
59- await revokeAuthorization ( ) ;
60- }
61- } , [ authorizationStatus ] ) ;
40+ const onPressRequestCallback = useCallback (
41+ async ( forIndividualOrChild : "individual" | "child" = "individual" ) => {
42+ if ( authorizationStatus === AuthorizationStatus . notDetermined ) {
43+ await requestAuthorization ( forIndividualOrChild ) ;
44+ } else if ( authorizationStatus === AuthorizationStatus . denied ) {
45+ Alert . alert (
46+ "You didn't grant access" ,
47+ "Please go to settings and enable it" ,
48+ [
49+ {
50+ text : "Open settings" ,
51+ onPress : ( ) => Linking . openSettings ( ) ,
52+ } ,
53+ {
54+ text : "Cancel" ,
55+ style : "cancel" ,
56+ } ,
57+ ] ,
58+ ) ;
59+ } else {
60+ await revokeAuthorization ( ) ;
61+ }
62+ } ,
63+ [ authorizationStatus ] ,
64+ ) ;
6265
6366 const [ showCreateActivityPopup , setShowCreateActivityPopup ] = useState ( false ) ;
6467
@@ -108,12 +111,21 @@ export function SimpleTab() {
108111 < Text style = { { flex : 1 } } >
109112 { authorizationStatusMap [ authorizationStatus ] }
110113 </ Text >
111-
112- < Button onPress = { onPressRequestCallback } mode = "contained" >
113- { authorizationStatus === AuthorizationStatus . approved
114- ? "Revoke authorization"
115- : "Request authorization" }
116- </ Button >
114+ < View style = { { gap : 10 } } >
115+ < Button onPress = { ( ) => onPressRequestCallback ( ) } mode = "contained" >
116+ { authorizationStatus === AuthorizationStatus . approved
117+ ? "Revoke authorization"
118+ : "Request authorization" }
119+ </ Button >
120+ < Button
121+ onPress = { ( ) => onPressRequestCallback ( "child" ) }
122+ mode = "contained"
123+ >
124+ { authorizationStatus === AuthorizationStatus . approved
125+ ? "Revoke child authorization"
126+ : "Request child authorization" }
127+ </ Button >
128+ </ View >
117129 </ View >
118130 < Title > Activities</ Title >
119131 { activities . map ( ( activity ) => (
0 commit comments