From b075c4e7d258111b9b0c82c1137b5a84307e4131 Mon Sep 17 00:00:00 2001 From: Zeus Date: Fri, 21 Apr 2023 09:53:55 +0200 Subject: [PATCH] Renaming --- Demos/ALGeoPositionSensor/_Source/Main.pas | 6 +- README.md | 12 +-- Source/Alcinoe.FMX.GeoPosition.Sensor.pas | 96 +++++++++++----------- Tests/_Source/ALTests.dpr | 2 +- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Demos/ALGeoPositionSensor/_Source/Main.pas b/Demos/ALGeoPositionSensor/_Source/Main.pas index 8be245f93..8673f5bfb 100644 --- a/Demos/ALGeoPositionSensor/_Source/Main.pas +++ b/Demos/ALGeoPositionSensor/_Source/Main.pas @@ -215,7 +215,7 @@ procedure TForm1.Button7Click(Sender: TObject); Memo1.SelLength := 0; end; -{****************************************************************************************} +{**********************************************************************************************} procedure TForm1.OnGeoPositionSensorActivateGpsAndGrantGeoPositionAccessResult(Sender: TObject); begin var LRestricted: boolean; @@ -240,7 +240,7 @@ procedure TForm1.OnGeoPositionSensorActivateGpsAndGrantGeoPositionAccessResult(S Memo1.SelLength := 0; end; -{**********************************************} +{****************************************************} procedure TForm1.OnGeoPositionSensorGeoPositionUpdate( const Sender: TObject; const ALatitude: Double; @@ -262,7 +262,7 @@ procedure TForm1.OnGeoPositionSensorGeoPositionUpdate( Memo1.SelLength := 0; end; -{**************************************************************} +{*****************************************************************} procedure TForm1.OnGeoPositionSensorShowRequestPermissionRationale( const Sender: TObject; const AToActivateGPS: Boolean; diff --git a/README.md b/README.md index 69fefb35e..5a2d1a4c8 100644 --- a/README.md +++ b/README.md @@ -326,23 +326,23 @@ Android and iOS. Learn more at [{alcinoe}\Demos\ALFirebaseMessaging](https://github.com/MagicFoundation/Alcinoe/tree/master/Demos/ALFirebaseMessaging) -Location Sensor for Android/iOS -------------------------------- +GeoPositioning for Android/iOS +------------------------------ -The TALLocationSensor component is a Delphi component that grants access to +The TALGeoPositionSensor component is a Delphi component that grants access to location services on iOS and Android devices. It enables the retrieval of the device's current location, and can provide location updates as the device's location changes. It supports a range of location providers, including GPS, cellular network triangulation, and Wi-Fi positioning. -Aside from granting access to location services, TALLocationSensor also +Aside from granting access to location services, TALGeoPositionSensor also automates the process of acquiring the user's permission to use the location sensor on both iOS and Android devices. The component can handle situations where the user has previously refused access to their location. The -TALLocationSensor component provides a comprehensive solution for developers +TALGeoPositionSensor component provides a comprehensive solution for developers seeking to integrate location-based functionality into their apps without having to worry about low-level implementation details. Learn more at -[{alcinoe}\Demos\ALLocationSensor](https://github.com/MagicFoundation/Alcinoe/tree/master/Demos/ALLocationSensor) +[{alcinoe}\Demos\ALGeoPositionSensor](https://github.com/MagicFoundation/Alcinoe/tree/master/Demos/ALGeoPositionSensor) Google OAuth 2.0 Access Token diff --git a/Source/Alcinoe.FMX.GeoPosition.Sensor.pas b/Source/Alcinoe.FMX.GeoPosition.Sensor.pas index 0aeb66996..c348ef688 100644 --- a/Source/Alcinoe.FMX.GeoPosition.Sensor.pas +++ b/Source/Alcinoe.FMX.GeoPosition.Sensor.pas @@ -303,7 +303,7 @@ implementation Alcinoe.stringutils, ALcinoe.common; -{********************************************************************************************} +{***********************************************************************************************} constructor TALGeoPositionSensor.Create(Const AUseGooglePlayServicesIfAvailable: Boolean = True); begin @@ -364,7 +364,7 @@ constructor TALGeoPositionSensor.Create(Const AUseGooglePlayServicesIfAvailable: end; -{***********************************} +{**************************************} destructor TALGeoPositionSensor.Destroy; begin @@ -398,7 +398,7 @@ destructor TALGeoPositionSensor.Destroy; end; -{***********************************************} +{**************************************************} function TALGeoPositionSensor.IsGpsEnabled: Boolean; begin @@ -444,7 +444,7 @@ function TALGeoPositionSensor.IsGpsEnabled: Boolean; end; -{*************************************************} +{****************************************************} procedure TALGeoPositionSensor.GetPermissionsGranted( out ARestricted: boolean; // This app is not authorized to use location services. The user cannot change this app’s status, possibly due to active restrictions such as parental controls being in place. out ACoarseGeoPosition: Boolean; // If you have granted the app access to your coarse geoposition @@ -560,7 +560,7 @@ procedure TALGeoPositionSensor.GetPermissionsGranted( end; -{**********************************************************} +{****************************************************************} function TALGeoPositionSensor.IsGeoPositionAccessGranted: Boolean; begin var LRestricted: boolean; @@ -575,13 +575,13 @@ function TALGeoPositionSensor.IsGeoPositionAccessGranted: Boolean; result := LCoarseGeoPosition or LPreciseGeoPosition; end; -{***********************************************************************} +{*****************************************************************************} function TALGeoPositionSensor.IsGpsEnabledAndGeoPositionAccessGranted: Boolean; begin result := IsGpsEnabled and IsGeoPositionAccessGranted; end; -{**************************************************************} +{*****************************************************************} function TALGeoPositionSensor.ShouldShowRequestPermissionRationale( const ACoarseGeoPosition: Boolean; const APreciseGeoPosition: Boolean; @@ -655,7 +655,7 @@ function TALGeoPositionSensor.ShouldShowRequestPermissionRationale( end; -{***********************************************************} +{**************************************************************} procedure TALGeoPositionSensor.DoShowRequestPermissionRationale( const AToActivateGPS: Boolean; const AToRequestCoarseGeoPositionPermission: Boolean; @@ -692,7 +692,7 @@ procedure TALGeoPositionSensor.DoShowRequestPermissionRationale( DoActivateGpsAndGrantGeoPositionAccessResult; end; -{*********************************************} +{************************************************} procedure TALGeoPositionSensor.requestPermissions( const ACoarseGeoPosition: Boolean; const APreciseGeoPosition: Boolean; @@ -762,13 +762,13 @@ procedure TALGeoPositionSensor.requestPermissions( end; -{****************************************************************} +{**********************************************************************} function TALGeoPositionSensor.GetIsListeningGeoPositionUpdates: boolean; begin result := FGeoPositionUpdatesDelayed or FGeoPositionUpdatesActive; end; -{***************************************************************************************************************************} +{*********************************************************************************************************************************} procedure TALGeoPositionSensor.DoActivateGpsAndGrantGeoPositionAccess(Const AForceShowRequestPermissionRationale: Boolean = False); begin @@ -943,7 +943,7 @@ procedure TALGeoPositionSensor.DoActivateGpsAndGrantGeoPositionAccess(Const AFor end; -{********************************************************************} +{**************************************************************************} procedure TALGeoPositionSensor.DoActivateGpsAndGrantGeoPositionAccessResult; begin {$IF defined(ANDROID)} @@ -968,7 +968,7 @@ procedure TALGeoPositionSensor.DoActivateGpsAndGrantGeoPositionAccessResult; DoStartGeoPositionUpdates; end; -{************************************************************} +{******************************************************************} procedure TALGeoPositionSensor.ActivateGpsAndGrantGeoPositionAccess( const ACoarseGeoPosition: boolean = True; const APreciseGeoPosition: boolean = True; @@ -983,7 +983,7 @@ procedure TALGeoPositionSensor.ActivateGpsAndGrantGeoPositionAccess( DoActivateGpsAndGrantGeoPositionAccess; end; -{*************************************************} +{*******************************************************} procedure TALGeoPositionSensor.DoStartGeoPositionUpdates; begin @@ -1074,7 +1074,7 @@ procedure TALGeoPositionSensor.DoStartGeoPositionUpdates; end; -{***********************************************} +{*****************************************************} procedure TALGeoPositionSensor.StartGeoPositionUpdates( const aMinDistance: Integer; // minimum distance between geoposition updates in meters const ACoarseGeoPosition: boolean = true; // when ACoarseGeoPosition = true and APreciseGeoPosition = true @@ -1095,7 +1095,7 @@ procedure TALGeoPositionSensor.StartGeoPositionUpdates( AAlwaysAuthorization); end; -{**********************************************} +{****************************************************} procedure TALGeoPositionSensor.StopGeoPositionUpdates; begin @@ -1121,7 +1121,7 @@ procedure TALGeoPositionSensor.StopGeoPositionUpdates; end; -{********************************************************************************************} +{***********************************************************************************************} procedure TALGeoPositionSensor.ApplicationEventHandler(const Sender: TObject; const M: TMessage); begin if not FApplicationEventHandlerEnabled then exit; @@ -1182,14 +1182,14 @@ procedure TALGeoPositionSensor.ApplicationEventHandler(const Sender: TObject; co {$REGION ' ANDROID'} {$IF defined(android)} -{************************************************************************************************} +{*********************************************************************************************************} constructor TALGeoPositionSensor.TAndroidLocationListener.Create(AGeoPositionSensor: TALGeoPositionSensor); begin inherited Create; FGeoPositionSensor := AGeoPositionSensor; end; -{*****************************************************************************************} +{********************************************************************************************} procedure TALGeoPositionSensor.TAndroidLocationListener.onFlushComplete(requestCode: Integer); begin {$IFDEF DEBUG} @@ -1197,7 +1197,7 @@ procedure TALGeoPositionSensor.TAndroidLocationListener.onFlushComplete(requestC {$ENDIF} end; -{******************************************************************************************} +{*********************************************************************************************} procedure TALGeoPositionSensor.TAndroidLocationListener.onLocationChanged(location: JLocation); begin if location = nil then exit; @@ -1215,14 +1215,14 @@ procedure TALGeoPositionSensor.TAndroidLocationListener.onLocationChanged(locati end; end; -{***************************************************************************************} +{******************************************************************************************} procedure TALGeoPositionSensor.TAndroidLocationListener.onLocationChanged(locations: JList); begin for var I := 0 to locations.size - 1 do onLocationChanged(TJLocation.Wrap(locations.get(I))); end; -{*****************************************************************************************} +{********************************************************************************************} procedure TALGeoPositionSensor.TAndroidLocationListener.onProviderDisabled(provider: JString); begin {$IFDEF DEBUG} @@ -1230,7 +1230,7 @@ procedure TALGeoPositionSensor.TAndroidLocationListener.onProviderDisabled(provi {$ENDIF} end; -{****************************************************************************************} +{*******************************************************************************************} procedure TALGeoPositionSensor.TAndroidLocationListener.onProviderEnabled(provider: JString); begin {$IFDEF DEBUG} @@ -1238,7 +1238,7 @@ procedure TALGeoPositionSensor.TAndroidLocationListener.onProviderEnabled(provid {$ENDIF} end; -{************************************************************************************************************************} +{***************************************************************************************************************************} procedure TALGeoPositionSensor.TAndroidLocationListener.onStatusChanged(provider: JString; status: Integer; extras: JBundle); begin {$IFDEF DEBUG} @@ -1246,14 +1246,14 @@ procedure TALGeoPositionSensor.TAndroidLocationListener.onStatusChanged(provider {$ENDIF} end; -{********************************************************************************************} +{*****************************************************************************************************} constructor TALGeoPositionSensor.TGMSLocationListener.Create(AGeoPositionSensor: TALGeoPositionSensor); begin inherited Create; FGeoPositionSensor := AGeoPositionSensor; end; -{**************************************************************************************} +{*****************************************************************************************} procedure TALGeoPositionSensor.TGMSLocationListener.onLocationChanged(location: JLocation); begin if location = nil then exit; @@ -1271,7 +1271,7 @@ procedure TALGeoPositionSensor.TGMSLocationListener.onLocationChanged(location: end; end; -{****************************************************************************************************} +{*******************************************************************************************************} procedure TALGeoPositionSensor.PermissionsRequestResultHandler(const Sender: TObject; const M: TMessage); {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} @@ -1372,14 +1372,14 @@ procedure TALGeoPositionSensor.PermissionsRequestResultHandler(const Sender: TOb {$REGION ' IOS'} {$IF defined(IOS)} -{************************************************************************************************} +{*********************************************************************************************************} constructor TALGeoPositionSensor.TLocationManagerDelegate.Create(AGeoPositionSensor: TALGeoPositionSensor); begin inherited Create; FGeoPositionSensor := AGeoPositionSensor; end; -{**************************************************************************************************************************} +{*****************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: CLLocationManager; didFailWithError: NSError); begin @@ -1416,7 +1416,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: end; -{****************************************************************************************************************************} +{*******************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: CLLocationManager; didUpdateHeading: CLHeading); begin @@ -1436,7 +1436,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: {$ENDIF} end; -{**********************************************************************************************************************************************************} +{*************************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: CLLocationManager; didUpdateToLocation: CLLocation; fromLocation: CLLocation); begin @@ -1450,7 +1450,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: end; -{*********************************************************************************************************************************************************} +{************************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: CLLocationManager; monitoringDidFailForRegion: CLRegion; withError: NSError); begin @@ -1477,7 +1477,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: end; -{****************************************************************************************************************************************************} +{*******************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: CLLocationManager; didChangeAuthorizationStatus: CLAuthorizationStatus); begin @@ -1490,7 +1490,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManager(manager: end; -{*********************************************************************************************************************} +{************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidChangeAuthorization(manager: CLLocationManager); begin @@ -1602,7 +1602,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidChange end; -{*************************************************************************************************************************************} +{****************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidUpdateLocations(manager: CLLocationManager; locations: NSArray); begin @@ -1638,7 +1638,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidUpdate end; -{**************************************************************************************************************************************} +{*****************************************************************************************************************************************} function TALGeoPositionSensor.TLocationManagerDelegate.locationManagerShouldDisplayHeadingCalibration(manager: CLLocationManager): Boolean; begin @@ -1686,7 +1686,7 @@ function TALGeoPositionSensor.TLocationManagerDelegate.locationManagerShouldDisp end; -{*****************************************************************************************************************************************************************} +{********************************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidDetermineStateForRegion(manager: CLLocationManager; state: CLRegionState; region: CLRegion); begin @@ -1704,7 +1704,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidDeterm end; -{**************************************************************************************************************************************************************************************************************} +{*****************************************************************************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidRangeBeaconsSatisfyingConstraint(manager: CLLocationManager; didRangeBeacons: NSArray; satisfyingConstraint: CLBeaconIdentityConstraint); begin @@ -1717,7 +1717,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidRangeB end; -{**********************************************************************************************************************************************************************************************************************} +{*************************************************************************************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidFailRangingBeaconsForConstraintError(manager: CLLocationManager; didFailRangingBeaconsForConstraint: CLBeaconIdentityConstraint; error: NSError); begin @@ -1730,7 +1730,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidFailRa end; -{****************************************************************************************************************************************************************} +{*******************************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidRangeBeaconsInRegion(manager: CLLocationManager; beacons: NSArray; region: CLBeaconRegion); begin @@ -1749,7 +1749,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidRangeB end; -{******************************************************************************************************************************************************************************} +{*********************************************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerRangingBeaconsDidFailForRegionWithError(manager: CLLocationManager; region: CLBeaconRegion; error: NSError); begin @@ -1775,7 +1775,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerRangingBe end; -{*******************************************************************************************************************************} +{**********************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidEnterRegion(manager: CLLocationManager; region: CLRegion); begin @@ -1798,7 +1798,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidEnterR end; -{******************************************************************************************************************************} +{*********************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidExitRegion(manager: CLLocationManager; region: CLRegion); begin @@ -1822,7 +1822,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidExitRe end; -{********************************************************************************************************************************************} +{***********************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidStartMonitoringForRegion(manager: CLLocationManager; region: CLRegion); begin @@ -1834,7 +1834,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidStartM end; -{**********************************************************************************************************************} +{*************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidPauseLocationUpdates(manager: CLLocationManager); begin @@ -1860,7 +1860,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidPauseL end; -{***********************************************************************************************************************} +{**************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidResumeLocationUpdates(manager: CLLocationManager); begin @@ -1887,7 +1887,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidResume end; -{************************************************************************************************************************************************} +{***************************************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidFinishDeferredUpdatesWithError(manager: CLLocationManager; error: NSError); begin @@ -1913,7 +1913,7 @@ procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidFinish end; -{***********************************************************************************************************************} +{**************************************************************************************************************************} procedure TALGeoPositionSensor.TLocationManagerDelegate.locationManagerDidVisit(manager: CLLocationManager; visit: CLVisit); begin diff --git a/Tests/_Source/ALTests.dpr b/Tests/_Source/ALTests.dpr index d5a72798b..f60cadbb9 100644 --- a/Tests/_Source/ALTests.dpr +++ b/Tests/_Source/ALTests.dpr @@ -134,7 +134,7 @@ uses Alcinoe.FMX.Graphics, Alcinoe.FMX.InertialMovement, Alcinoe.FMX.Layouts, - Alcinoe.FMX.Location.Sensor, + Alcinoe.FMX.GeoPosition.Sensor, Alcinoe.FMX.Memo, Alcinoe.FMX.Objects, Alcinoe.FMX.StdCtrls,