Skip to content

Commit ff34abe

Browse files
Merge pull request #4 from ionic-team/development
chore: prepare to release version `1.0.0`
2 parents 682ca98 + 99c5ac3 commit ff34abe

File tree

46 files changed

+4367
-14051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4367
-14051
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [1.0.0]
8+
9+
### 2025-01-10
10+
- Feat: Add implementation for `getCurrentPosition`, `watchPosition`, and `clearWatch` on both Android and iOS.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424

2525
This project has two packages:
2626

27-
1. the cordova plugin, `com.outsystems.plugins.osgeolocation`
27+
1. the cordova plugin, `com.outsystems.plugins.geolocation`
2828
2. a wrapper consumed by the OutSystems' low-code module, `outsystems-wrapper`
2929

packages/cordova-plugin/android/OSGeolocation.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.outsystems.plugins.osgeolocation
1+
package com.outsystems.plugins.geolocation
22

33
import com.google.android.gms.location.LocationServices
44
import com.google.gson.Gson
@@ -16,9 +16,9 @@ import org.json.JSONObject
1616
import android.Manifest
1717
import android.content.pm.PackageManager
1818
import androidx.activity.result.contract.ActivityResultContracts
19-
import com.outsystems.plugins.osgeolocation.controller.OSGLOCController
20-
import com.outsystems.plugins.osgeolocation.model.OSGLOCException
21-
import com.outsystems.plugins.osgeolocation.model.OSGLOCLocationOptions
19+
import io.ionic.libs.iongeolocationlib.controller.IONGLOCController
20+
import io.ionic.libs.iongeolocationlib.model.IONGLOCException
21+
import io.ionic.libs.iongeolocationlib.model.IONGLOCLocationOptions
2222
import kotlinx.coroutines.cancel
2323
import kotlinx.coroutines.flow.MutableSharedFlow
2424

@@ -27,7 +27,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow
2727
*/
2828
class OSGeolocation : CordovaPlugin() {
2929

30-
private lateinit var controller: OSGLOCController
30+
private lateinit var controller: IONGLOCController
3131
private val gson by lazy { Gson() }
3232

3333
// for permissions
@@ -54,7 +54,7 @@ class OSGeolocation : CordovaPlugin() {
5454
}
5555
}
5656

57-
this.controller = OSGLOCController(
57+
this.controller = IONGLOCController(
5858
LocationServices.getFusedLocationProviderClient(cordova.context),
5959
activityLauncher
6060
)
@@ -100,7 +100,7 @@ class OSGeolocation : CordovaPlugin() {
100100

101101
coroutineScope.launch {
102102
handleLocationPermission(callbackContext) {
103-
val locationOptions = OSGLOCLocationOptions(
103+
val locationOptions = IONGLOCLocationOptions(
104104
options.getLong(TIMEOUT),
105105
options.getLong(MAXIMUM_AGE),
106106
options.getBoolean(ENABLE_HIGH_ACCURACY))
@@ -133,7 +133,7 @@ class OSGeolocation : CordovaPlugin() {
133133

134134
coroutineScope.launch {
135135
handleLocationPermission(callbackContext) {
136-
val locationOptions = OSGLOCLocationOptions(
136+
val locationOptions = IONGLOCLocationOptions(
137137
timeout = options.getLong(TIMEOUT),
138138
maximumAge = options.getLong(MAXIMUM_AGE),
139139
enableHighAccuracy = options.getBoolean(ENABLE_HIGH_ACCURACY),
@@ -167,32 +167,32 @@ class OSGeolocation : CordovaPlugin() {
167167
callbackContext: CallbackContext
168168
) {
169169
when (exception) {
170-
is OSGLOCException.OSGLOCRequestDeniedException -> {
170+
is IONGLOCException.IONGLOCRequestDeniedException -> {
171171
callbackContext.sendError(OSGeolocationErrors.LOCATION_ENABLE_REQUEST_DENIED)
172172
}
173173

174-
is OSGLOCException.OSGLOCSettingsException -> {
174+
is IONGLOCException.IONGLOCSettingsException -> {
175175
callbackContext.sendError(OSGeolocationErrors.LOCATION_SETTINGS_ERROR)
176176
}
177177

178-
is OSGLOCException.OSGLOCInvalidTimeoutException -> {
178+
is IONGLOCException.IONGLOCInvalidTimeoutException -> {
179179
callbackContext.sendError(OSGeolocationErrors.INVALID_TIMEOUT)
180180
}
181181

182-
is OSGLOCException.OSGLOCGoogleServicesException -> {
182+
is IONGLOCException.IONGLOCGoogleServicesException -> {
183183
if (exception.resolvable) {
184184
callbackContext.sendError(OSGeolocationErrors.GOOGLE_SERVICES_RESOLVABLE)
185185
} else {
186186
callbackContext.sendError(OSGeolocationErrors.GOOGLE_SERVICES_ERROR)
187187
}
188188
}
189189

190-
is OSGLOCException.OSGLOCLocationRetrievalTimeoutException -> {
190+
is IONGLOCException.IONGLOCLocationRetrievalTimeoutException -> {
191191
callbackContext.sendError(OSGeolocationErrors.GET_LOCATION_TIMEOUT)
192192
}
193193

194194
else -> {
195-
callbackContext.sendError(OSGeolocationErrors.GET_LOCATION_GENERAL)
195+
callbackContext.sendError(OSGeolocationErrors.POSITION_UNAVAILABLE)
196196
}
197197
}
198198
}
Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.outsystems.plugins.osgeolocation
1+
package com.outsystems.plugins.geolocation
22

33
/**
44
* Object with plugin errors
@@ -14,54 +14,39 @@ object OSGeolocationErrors {
1414
val message: String
1515
)
1616

17-
val GOOGLE_SERVICES_RESOLVABLE = ErrorInfo(
18-
code = formatErrorCode(1),
19-
message = "Google Play Services error user resolvable."
20-
)
21-
22-
val GOOGLE_SERVICES_ERROR = ErrorInfo(
17+
val POSITION_UNAVAILABLE = ErrorInfo(
2318
code = formatErrorCode(2),
24-
message = "Google Play Services error."
19+
message = "There was en error trying to obtain the location."
2520
)
2621

27-
val INVALID_INPUT_GET_POSITION = ErrorInfo(
22+
val LOCATION_PERMISSIONS_DENIED = ErrorInfo(
2823
code = formatErrorCode(3),
29-
message = "The input parameters for GetLocation aren't valid."
24+
message = "Location permission request was denied."
3025
)
3126

32-
val INVALID_INPUT_WATCH_POSITION = ErrorInfo(
27+
val INVALID_INPUT_GET_POSITION = ErrorInfo(
3328
code = formatErrorCode(4),
34-
message = "The input parameters for WatchPosition aren't valid."
29+
message = "The 'GetLocation' input parameters aren't valid."
3530
)
3631

37-
val INVALID_INPUT_CLEAR_WATCH = ErrorInfo(
32+
val INVALID_INPUT_WATCH_POSITION = ErrorInfo(
3833
code = formatErrorCode(5),
39-
message = "The input parameters for ClearWatch aren't valid."
34+
message = "The 'WatchPosition' input parameters aren't valid."
4035
)
4136

42-
val GET_LOCATION_TIMEOUT = ErrorInfo(
37+
val INVALID_INPUT_CLEAR_WATCH = ErrorInfo(
4338
code = formatErrorCode(6),
44-
message = "Could not obtain location in time. Try with a higher timeout."
45-
)
46-
47-
val GET_LOCATION_GENERAL = ErrorInfo(
48-
code = formatErrorCode(7),
49-
message = "There was en error trying to obtain the location."
39+
message = "The 'ClearWatch' input parameters aren't valid."
5040
)
51-
52-
val LOCATION_PERMISSIONS_DENIED = ErrorInfo(
53-
code = formatErrorCode(8),
54-
message = "Location permission request was denied."
55-
)
56-
41+
5742
val LOCATION_ENABLE_REQUEST_DENIED = ErrorInfo(
5843
code = formatErrorCode(9),
59-
message = "Request to enable location denied."
44+
message = "Request to enable location was denied."
6045
)
6146

62-
val LOCATION_SETTINGS_ERROR = ErrorInfo(
47+
val GET_LOCATION_TIMEOUT = ErrorInfo(
6348
code = formatErrorCode(10),
64-
message = "Location settings error."
49+
message = "Could not obtain location in time. Try with a higher timeout."
6550
)
6651

6752
val INVALID_TIMEOUT = ErrorInfo(
@@ -71,12 +56,26 @@ object OSGeolocationErrors {
7156

7257
val WATCH_ID_NOT_FOUND = ErrorInfo(
7358
code = formatErrorCode(12),
74-
message = "WatchId not found"
59+
message = "WatchId not found."
7560
)
7661

7762
val WATCH_ID_NOT_PROVIDED = ErrorInfo(
7863
code = formatErrorCode(13),
7964
message = "WatchId needs to be provided."
8065
)
8166

67+
val GOOGLE_SERVICES_RESOLVABLE = ErrorInfo(
68+
code = formatErrorCode(14),
69+
message = "Google Play Services error user resolvable."
70+
)
71+
72+
val GOOGLE_SERVICES_ERROR = ErrorInfo(
73+
code = formatErrorCode(15),
74+
message = "Google Play Services error."
75+
)
76+
77+
val LOCATION_SETTINGS_ERROR = ErrorInfo(
78+
code = formatErrorCode(16),
79+
message = "Location settings error."
80+
)
8281
}

packages/cordova-plugin/android/OSGeolocationPermissionEvents.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.outsystems.plugins.osgeolocation
1+
package com.outsystems.plugins.geolocation
22

33
/**
44
* Sealed class containing the Location permission events
Binary file not shown.

packages/cordova-plugin/android/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ allprojects {
1717
}
1818

1919
dependencies{
20-
21-
//implementation "com.github.outsystems:osgeolocationlib-android:1.0.0@aar"
22-
implementation (files("libs/android-lib-debug.aar"))
23-
20+
implementation("io.ionic.libs:iongeolocation-android:1.0.0")
2421
implementation("androidx.browser:browser:1.8.0")
2522
implementation("com.google.android.gms:play-services-auth:21.2.0")
2623
implementation("com.google.android.gms:play-services-location:21.3.0")

packages/cordova-plugin/ios/OSGLOCConfigurationModel+Accuracy.swift renamed to packages/cordova-plugin/ios/IONGLOCConfigurationModel+Accuracy.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import OSGeolocationLib
1+
import IONGeolocationLib
22

3-
extension OSGLOCConfigurationModel {
4-
static func createWithAccuracy(_ isHighAccuracyEnabled: Bool) -> OSGLOCConfigurationModel {
3+
extension IONGLOCConfigurationModel {
4+
static func createWithAccuracy(_ isHighAccuracyEnabled: Bool) -> IONGLOCConfigurationModel {
55
let minimumDistance = isHighAccuracyEnabled ?
66
Constants.MinimumDistance.highAccuracy :
77
Constants.MinimumDistance.lowAccuracy

packages/cordova-plugin/ios/OSGLOCPositionModel+JSONTransformer.swift renamed to packages/cordova-plugin/ios/IONGLOCPositionModel+JSONTransformer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import OSGeolocationLib
1+
import IONGeolocationLib
22

3-
extension OSGLOCPositionModel {
3+
extension IONGLOCPositionModel {
44
func toResultDictionary() -> [String: Double] {
55
[
66
Constants.Position.altitude: altitude,

packages/cordova-plugin/ios/OSGeolocationCallbackManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import OSGeolocationLib
1+
import IONGeolocationLib
22

33
private enum OSGeolocationCallbackType {
44
case location
@@ -56,7 +56,7 @@ final class OSGeolocationCallbackManager {
5656
commandDelegate.send(result, callbackId: callbackId)
5757
}
5858

59-
func sendSuccess(with position: OSGLOCPositionModel) {
59+
func sendSuccess(with position: IONGLOCPositionModel) {
6060
createPluginResult(status: .ok, message: position.toResultDictionary())
6161
}
6262

0 commit comments

Comments
 (0)