Skip to content

Commit 1856867

Browse files
feat: google-maps cap7 ready
- upgrades plugin's dependencies to google maps - iOS: removes deprecated code && fixes a bug where iOS location permissions weren't being requested
1 parent 3281142 commit 1856867

File tree

9 files changed

+3126
-3900
lines changed

9 files changed

+3126
-3900
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"ci:publish:dev": "lerna publish prerelease --conventional-commits --conventional-prerelease --preid dev-$(date +\"%Y%m%dT%H%M%S\") --force-publish --no-changelog --no-git-tag-version --dist-tag dev --no-push --yes"
1717
},
1818
"devDependencies": {
19-
"@capacitor/ios": "^6.1.0",
19+
"@capacitor/ios": "next",
2020
"@types/node": "^20.11.25",
2121
"husky": "^9.0.1",
2222
"lerna": "^8.1.2",

plugin/android/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ext {
22
capacitorVersion = System.getenv('CAPACITOR_VERSION')
33
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
4-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
5-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
6-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
4+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
5+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
6+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
77
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.12.0'
88
googleMapsPlayServicesVersion = project.hasProperty('googleMapsPlayServicesVersion') ? rootProject.ext.googleMapsPlayServicesVersion : '19.0.0'
99
googleMapsUtilsVersion = project.hasProperty('googleMapsUtilsVersion') ? rootProject.ext.googleMapsUtilsVersion : '3.8.2'
@@ -22,7 +22,7 @@ buildscript {
2222
}
2323
}
2424
dependencies {
25-
classpath 'com.android.tools.build:gradle:8.2.1'
25+
classpath 'com.android.tools.build:gradle:8.7.0'
2626
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
2727
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
2828
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
@@ -40,10 +40,10 @@ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
4040

4141
android {
4242
namespace "com.capacitorjs.plugins.googlemaps"
43-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
43+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
4444
defaultConfig {
45-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
46-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
45+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
46+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
4747
versionCode 1
4848
versionName "1.0"
4949
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

plugin/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

plugin/e2e-tests/android/variables.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
ext {
2-
minSdkVersion = 22
3-
compileSdkVersion = 34
4-
targetSdkVersion = 34
2+
minSdkVersion = 23
3+
compileSdkVersion = 35
4+
targetSdkVersion = 35
55
androidxActivityVersion = '1.8.0'
6-
androidxAppCompatVersion = '1.6.1'
6+
androidxAppCompatVersion = '1.7.0'
77
androidxCoordinatorLayoutVersion = '1.2.0'
88
androidxCoreVersion = '1.12.0'
99
androidxFragmentVersion = '1.6.2'
1010
androidxWebkitVersion = '1.9.0'
11-
androidxJunitVersion = '1.1.5'
12-
androidxEspressoCoreVersion = '3.5.1'
11+
androidxJunitVersion = '1.2.1'
12+
androidxEspressoCoreVersion = '3.6.1'
1313
cordovaAndroidVersion = '10.1.1'
1414
coreSplashScreenVersion = '1.0.1'
1515
junitVersion = '4.13.2'

plugin/e2e-tests/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
"@capacitor/android": "^6.0.0",
77
"@capacitor/app": "^6.0.0",
88
"@capacitor/core": "^6.0.0",
9+
"@capacitor/android": "next",
10+
"@capacitor/core": "next",
911
"@capacitor/google-maps": "file:..",
1012
"@capacitor/haptics": "^6.0.0",
1113
"@capacitor/ios": "^6.0.0",
1214
"@capacitor/keyboard": "^6.0.0",
1315
"@capacitor/status-bar": "^6.0.0",
16+
"@capacitor/ios": "next",
1417
"@ionic/react": "^6.0.0",
1518
"@ionic/react-router": "^6.0.0",
1619
"@testing-library/jest-dom": "^5.11.9",
@@ -80,6 +83,7 @@
8083
"@capacitor/cli": "^6.0.0",
8184
"@ionic/e2e": "0.2.0-next.6",
8285
"@ionic/e2e-components-ionic": "0.2.0-next.6",
86+
"@capacitor/cli": "next",
8387
"appium": "^1.22.1"
8488
},
8589
"description": "An Ionic project"

plugin/ios/Plugin/CapacitorGoogleMapsPlugin.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ extension CGRect {
6767
public class CapacitorGoogleMapsPlugin: CAPPlugin, GMSMapViewDelegate {
6868
private var maps = [String: Map]()
6969
private var isInitialized = false
70-
70+
private var locationManager = CLLocationManager()
71+
72+
7173
func checkLocationPermission() -> String {
7274
let locationState: String
7375

74-
switch CLLocationManager.authorizationStatus() {
76+
switch self.locationManager.authorizationStatus {
7577
case .notDetermined:
7678
locationState = "prompt"
7779
case .restricted, .denied:
@@ -682,8 +684,10 @@ public class CapacitorGoogleMapsPlugin: CAPPlugin, GMSMapViewDelegate {
682684
guard let enabled = call.getBool("enabled") else {
683685
throw GoogleMapErrors.invalidArguments("enabled is missing")
684686
}
687+
688+
let locationStatus = checkLocationPermission()
685689

686-
if enabled && checkLocationPermission() != "granted" {
690+
if enabled && !(locationStatus == "granted" || locationStatus == "prompt") {
687691
throw GoogleMapErrors.permissionsDeniedLocation
688692
}
689693

plugin/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@capacitor/google-maps",
3-
"version": "6.0.1",
3+
"version": "7.0.0-alpha.0",
44
"description": "Google maps on Capacitor",
55
"main": "dist/plugin.cjs.js",
66
"module": "dist/esm/index.js",
@@ -54,10 +54,10 @@
5454
"unittest:android": "cd ./unit-tests/android && ./gradlew testDebugUnitTest"
5555
},
5656
"devDependencies": {
57-
"@capacitor/android": "^6.1.0",
58-
"@capacitor/core": "^6.1.0",
57+
"@capacitor/android": "next",
58+
"@capacitor/core": "next",
5959
"@capacitor/docgen": "0.2.2",
60-
"@capacitor/ios": "^6.1.0",
60+
"@capacitor/ios": "next",
6161
"@ionic/prettier-config": "^1.0.1",
6262
"@types/resize-observer-browser": "^0.1.7",
6363
"@types/supercluster": "^7.1.0",
@@ -75,7 +75,7 @@
7575
"typescript": "^5.4.2"
7676
},
7777
"peerDependencies": {
78-
"@capacitor/core": "^6.1.0"
78+
"@capacitor/core": "next"
7979
},
8080
"capacitor": {
8181
"ios": {

0 commit comments

Comments
 (0)