Project: titanium
Issue TIMOB-19850: iOS: Permissions (Geolocation) Bugs in implementation & documentation
While working on the permissions sample app I ran into some irregularities: * The API reference for [hasLocationPermissions|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Geolocation-method-hasLocationPermissions] lists all {{AUTHORIZATION_*}} constants as possible values, while only {{AUTHORIZATION_ALWAYS}} and {{AUTHORIZATION_WHEN_IN_USE}} are valid. * The API reference for [requestLocationPermissions|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Geolocation-method-requestLocationPermissions] lists all {{AUTHORIZATION_*}} constants as possible values, while only {{AUTHORIZATION_ALWAYS}} and {{AUTHORIZATION_WHEN_IN_USE}} are valid. * The implementation of [requestLocationPermissions|https://github.com/appcelerator/titanium_mobile/blob/1607237763f9e490e41d98b8d711ac49eeb01043/iphone/Classes/GeolocationModule.m#L879-L884] seems to call the {{locationPermissionManager}} twice if the first statement is false: {code} if (currentPermissionLevel == kCLAuthorizationStatusAuthorizedWhenInUse) { NSLog(@"[ERROR] cannot change already granted permission from AUTHORIZATION_WHEN_IN_USE to AUTHORIZATION_ALWAYS"); } else { [[self locationPermissionManager] requestAlwaysAuthorization]; } [[self locationPermissionManager] requestAlwaysAuthorization]; {code} * On Android {{Ti.Calendar.requestCalendarPermissions}}, {{Ti.Contacts.requestContactsPermissions}} and {{Ti.Media.requestCameraPermissions}} will call back with {{success:false}} if the required permission is missing in {{tiapp.xml}} but on iOS {{Ti.Geolocation.requestLocationPermissions}} will not call back at all when the required {{NSLocation*UsageDescription}} key is missing in {{tiapp.xml}}. It should call back with {{success:false}} as well. * If you don't allow permission when asked by {{Ti.Calendar.requestCalendarPermissions}} or {{Ti.Contacts.requestContactsPermissions}} it will call back with {{success:false}} but {{Ti.Geolocation.requestLocationPermissions}} does not call back at all. * For both {{hasLocationPermissions}} and {{requestLocationPermissions}} wouldn't the expected behaviour be that if {{AUTHORIZATION_ALWAYS}} was granted then {{AUTHORIZATION_WHEN_IN_USE}} would be seen as granted as well since always > when in use?
Story points: 3