Skip to content

Commit

Permalink
feat: google-maps cap7 ready
Browse files Browse the repository at this point in the history
- upgrades plugin's dependencies to google maps
- iOS: removes deprecated code && fixes a bug where iOS location permissions weren't being requested
  • Loading branch information
OS-martacarlos committed Oct 29, 2024
1 parent 3281142 commit 1856867
Show file tree
Hide file tree
Showing 9 changed files with 3,126 additions and 3,900 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"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"
},
"devDependencies": {
"@capacitor/ios": "^6.1.0",
"@capacitor/ios": "next",
"@types/node": "^20.11.25",
"husky": "^9.0.1",
"lerna": "^8.1.2",
Expand Down
14 changes: 7 additions & 7 deletions plugin/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ext {
capacitorVersion = System.getenv('CAPACITOR_VERSION')
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.12.0'
googleMapsPlayServicesVersion = project.hasProperty('googleMapsPlayServicesVersion') ? rootProject.ext.googleMapsPlayServicesVersion : '19.0.0'
googleMapsUtilsVersion = project.hasProperty('googleMapsUtilsVersion') ? rootProject.ext.googleMapsUtilsVersion : '3.8.2'
Expand All @@ -22,7 +22,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.1'
classpath 'com.android.tools.build:gradle:8.7.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
Expand All @@ -40,10 +40,10 @@ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {

android {
namespace "com.capacitorjs.plugins.googlemaps"
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion plugin/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 6 additions & 6 deletions plugin/e2e-tests/android/variables.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
ext {
minSdkVersion = 22
compileSdkVersion = 34
targetSdkVersion = 34
minSdkVersion = 23
compileSdkVersion = 35
targetSdkVersion = 35
androidxActivityVersion = '1.8.0'
androidxAppCompatVersion = '1.6.1'
androidxAppCompatVersion = '1.7.0'
androidxCoordinatorLayoutVersion = '1.2.0'
androidxCoreVersion = '1.12.0'
androidxFragmentVersion = '1.6.2'
androidxWebkitVersion = '1.9.0'
androidxJunitVersion = '1.1.5'
androidxEspressoCoreVersion = '3.5.1'
androidxJunitVersion = '1.2.1'
androidxEspressoCoreVersion = '3.6.1'
cordovaAndroidVersion = '10.1.1'
coreSplashScreenVersion = '1.0.1'
junitVersion = '4.13.2'
Expand Down
4 changes: 4 additions & 0 deletions plugin/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
"@capacitor/android": "^6.0.0",
"@capacitor/app": "^6.0.0",
"@capacitor/core": "^6.0.0",
"@capacitor/android": "next",
"@capacitor/core": "next",
"@capacitor/google-maps": "file:..",
"@capacitor/haptics": "^6.0.0",
"@capacitor/ios": "^6.0.0",
"@capacitor/keyboard": "^6.0.0",
"@capacitor/status-bar": "^6.0.0",
"@capacitor/ios": "next",
"@ionic/react": "^6.0.0",
"@ionic/react-router": "^6.0.0",
"@testing-library/jest-dom": "^5.11.9",
Expand Down Expand Up @@ -80,6 +83,7 @@
"@capacitor/cli": "^6.0.0",
"@ionic/e2e": "0.2.0-next.6",
"@ionic/e2e-components-ionic": "0.2.0-next.6",
"@capacitor/cli": "next",
"appium": "^1.22.1"
},
"description": "An Ionic project"
Expand Down
10 changes: 7 additions & 3 deletions plugin/ios/Plugin/CapacitorGoogleMapsPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ extension CGRect {
public class CapacitorGoogleMapsPlugin: CAPPlugin, GMSMapViewDelegate {
private var maps = [String: Map]()
private var isInitialized = false

private var locationManager = CLLocationManager()


func checkLocationPermission() -> String {
let locationState: String

switch CLLocationManager.authorizationStatus() {
switch self.locationManager.authorizationStatus {
case .notDetermined:
locationState = "prompt"
case .restricted, .denied:
Expand Down Expand Up @@ -682,8 +684,10 @@ public class CapacitorGoogleMapsPlugin: CAPPlugin, GMSMapViewDelegate {
guard let enabled = call.getBool("enabled") else {
throw GoogleMapErrors.invalidArguments("enabled is missing")
}

let locationStatus = checkLocationPermission()

if enabled && checkLocationPermission() != "granted" {
if enabled && !(locationStatus == "granted" || locationStatus == "prompt") {
throw GoogleMapErrors.permissionsDeniedLocation
}

Expand Down
10 changes: 5 additions & 5 deletions plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@capacitor/google-maps",
"version": "6.0.1",
"version": "7.0.0-alpha.0",
"description": "Google maps on Capacitor",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -54,10 +54,10 @@
"unittest:android": "cd ./unit-tests/android && ./gradlew testDebugUnitTest"
},
"devDependencies": {
"@capacitor/android": "^6.1.0",
"@capacitor/core": "^6.1.0",
"@capacitor/android": "next",
"@capacitor/core": "next",
"@capacitor/docgen": "0.2.2",
"@capacitor/ios": "^6.1.0",
"@capacitor/ios": "next",
"@ionic/prettier-config": "^1.0.1",
"@types/resize-observer-browser": "^0.1.7",
"@types/supercluster": "^7.1.0",
Expand All @@ -75,7 +75,7 @@
"typescript": "^5.4.2"
},
"peerDependencies": {
"@capacitor/core": "^6.1.0"
"@capacitor/core": "next"
},
"capacitor": {
"ios": {
Expand Down
Loading

0 comments on commit 1856867

Please sign in to comment.