Skip to content

Commit 92c55cd

Browse files
committed
feat: added ability to specify the activity type if needed
1 parent f8269ce commit 92c55cd

File tree

7 files changed

+288
-46
lines changed

7 files changed

+288
-46
lines changed

LocationManager/INTULocationManager/INTULocationManager.h

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,43 @@ NS_ASSUME_NONNULL_BEGIN
5555

5656
/**
5757
Asynchronously requests the current location of the device using location services.
58-
58+
5959
@param desiredAccuracy The accuracy level desired (refers to the accuracy and recency of the location).
60-
@param timeout The maximum amount of time (in seconds) to wait for a location with the desired accuracy before completing. If
60+
@param timeout The maximum amount of time (in seconds) to wait for a location with the desired accuracy before completing. If
6161
this value is 0.0, no timeout will be set (will wait indefinitely for success, unless request is force completed or canceled).
6262
@param block The block to execute upon success, failure, or timeout.
63+
64+
@return The location request ID, which can be used to force early completion or cancel the request while it is in progress.
65+
*/
66+
- (INTULocationRequestID)requestLocationWithDesiredAccuracy:(INTULocationAccuracy)desiredAccuracy
67+
timeout:(NSTimeInterval)timeout
68+
block:(INTULocationRequestBlock)block;
69+
70+
/**
71+
Asynchronously requests the current location of the device using location services, optionally delaying the timeout countdown until the user has
72+
responded to the dialog requesting permission for this app to access location services.
73+
74+
@param desiredAccuracy The accuracy level desired (refers to the accuracy and recency of the location).
75+
@param timeout The maximum amount of time (in seconds) to wait for a location with the desired accuracy before completing. If
76+
this value is 0.0, no timeout will be set (will wait indefinitely for success, unless request is force completed or canceled).
77+
@param delayUntilAuthorized A flag specifying whether the timeout should only take effect after the user responds to the system prompt requesting
78+
permission for this app to access location services. If YES, the timeout countdown will not begin until after the
79+
app receives location services permissions. If NO, the timeout countdown begins immediately when calling this method.
80+
@param block The block to execute upon success, failure, or timeout.
6381
6482
@return The location request ID, which can be used to force early completion or cancel the request while it is in progress.
6583
*/
6684
- (INTULocationRequestID)requestLocationWithDesiredAccuracy:(INTULocationAccuracy)desiredAccuracy
6785
timeout:(NSTimeInterval)timeout
86+
delayUntilAuthorized:(BOOL)delayUntilAuthorized
6887
block:(INTULocationRequestBlock)block;
6988

7089
/**
7190
Asynchronously requests the current location of the device using location services, optionally delaying the timeout countdown until the user has
7291
responded to the dialog requesting permission for this app to access location services.
7392
7493
@param desiredAccuracy The accuracy level desired (refers to the accuracy and recency of the location).
94+
@param desiredActivityType The activity type desired, which controls when/if pausing occurs.
7595
@param timeout The maximum amount of time (in seconds) to wait for a location with the desired accuracy before completing. If
7696
this value is 0.0, no timeout will be set (will wait indefinitely for success, unless request is force completed or canceled).
7797
@param delayUntilAuthorized A flag specifying whether the timeout should only take effect after the user responds to the system prompt requesting
@@ -82,6 +102,7 @@ NS_ASSUME_NONNULL_BEGIN
82102
@return The location request ID, which can be used to force early completion or cancel the request while it is in progress.
83103
*/
84104
- (INTULocationRequestID)requestLocationWithDesiredAccuracy:(INTULocationAccuracy)desiredAccuracy
105+
desiredActivityType:(CLActivityType)desiredActivityType
85106
timeout:(NSTimeInterval)timeout
86107
delayUntilAuthorized:(BOOL)delayUntilAuthorized
87108
block:(INTULocationRequestBlock)block;
@@ -102,15 +123,32 @@ NS_ASSUME_NONNULL_BEGIN
102123
Creates a subscription for location updates that will execute the block once per update indefinitely (until canceled), regardless of the accuracy of each location.
103124
The specified desired accuracy is passed along to location services, and controls how much power is used, with higher accuracies using more power.
104125
If an error occurs, the block will execute with a status other than INTULocationStatusSuccess, and the subscription will be canceled automatically.
105-
126+
106127
@param desiredAccuracy The accuracy level desired, which controls how much power is used by the device's location services.
107128
@param block The block to execute every time an updated location is available. Note that this block runs for every update, regardless of
108129
whether the achievedAccuracy is at least the desiredAccuracy.
109130
The status will be INTULocationStatusSuccess unless an error occurred; it will never be INTULocationStatusTimedOut.
131+
132+
@return The location request ID, which can be used to cancel the subscription of location updates to this block.
133+
*/
134+
- (INTULocationRequestID)subscribeToLocationUpdatesWithDesiredAccuracy:(INTULocationAccuracy)desiredAccuracy
135+
block:(INTULocationRequestBlock)block;
136+
137+
/**
138+
Creates a subscription for location updates that will execute the block once per update indefinitely (until canceled), regardless of the accuracy of each location.
139+
The specified desired accuracy is passed along to location services, and controls how much power is used, with higher accuracies using more power.
140+
If an error occurs, the block will execute with a status other than INTULocationStatusSuccess, and the subscription will be canceled automatically.
141+
142+
@param desiredAccuracy The accuracy level desired, which controls how much power is used by the device's location services.
143+
@param desiredActivityType The activity type desired, which controls when/if pausing occurs.
144+
@param block The block to execute every time an updated location is available. Note that this block runs for every update, regardless of
145+
whether the achievedAccuracy is at least the desiredAccuracy.
146+
The status will be INTULocationStatusSuccess unless an error occurred; it will never be INTULocationStatusTimedOut.
110147
111148
@return The location request ID, which can be used to cancel the subscription of location updates to this block.
112149
*/
113150
- (INTULocationRequestID)subscribeToLocationUpdatesWithDesiredAccuracy:(INTULocationAccuracy)desiredAccuracy
151+
desiredActivityType:(CLActivityType)desiredActivityType
114152
block:(INTULocationRequestBlock)block;
115153

116154
/**

0 commit comments

Comments
 (0)