From b0c46d4378d62ae0bd95c1d191cb7f219762c2aa Mon Sep 17 00:00:00 2001 From: Mike Summerfeldt <20338451+IT-MikeS@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:45:26 -0400 Subject: [PATCH 1/4] chore(ci): create dev releases for non-draft PRs (#1828) --- .github/workflows/dev-releases-for-pr.yml | 89 +++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/dev-releases-for-pr.yml diff --git a/.github/workflows/dev-releases-for-pr.yml b/.github/workflows/dev-releases-for-pr.yml new file mode 100644 index 000000000..d162ec77d --- /dev/null +++ b/.github/workflows/dev-releases-for-pr.yml @@ -0,0 +1,89 @@ +name: Release Dev Build for PR + +on: + pull_request: + types: + - opened + - synchronize + +jobs: + setup: + if: github.event.pull_request.draft == false + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-12] + timeout-minutes: 30 + outputs: + plugins: ${{ steps.packages.outputs.paths }} + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@ce177499ccf9fd2aded3b0426c97e5434c2e8a73 + with: + access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Get Latest + uses: actions/setup-node@v3 + with: + node-version: 18.18.0 + - uses: actions/checkout@v3 + - name: Restore Dependency Cache + id: cache-modules + uses: actions/cache@v3 + with: + path: | + node_modules + */node_modules + key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} + - run: npm install + - id: files + uses: tj-actions/changed-files@v37 + with: + json: true + write_output_files: true + - id: catjson + run: | + echo "FILES_JSON=$(cat .github/outputs/all_changed_files.json)" >> $GITHUB_OUTPUT + - id: packages + uses: ./.github/actions/changed-packages + with: + files: ${{ steps.catjson.outputs.FILES_JSON }} + + release-dev-of-plugins: + runs-on: macos-12 + timeout-minutes: 30 + permissions: + pull-requests: write + needs: + - setup + strategy: + matrix: + plugin: ${{ fromJson(needs.setup.outputs.plugins) }} + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18.18.0 + - uses: actions/checkout@v3 + - name: Restore Dependency Cache + id: cache-modules + uses: actions/cache@v3 + with: + path: | + node_modules + */node_modules + key: ${{ runner.os }}-dependency-caching-${{ hashFiles('package.json', '*/package.json') }} + - run: npm install + - env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date +\"%Y%m%dT%H%M%S\") + npm publish --tag dev --dry-run + working-directory: ${{ matrix.plugin }} + - name: get-npm-version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 + with: + path: ${{ matrix.plugin }} + - uses: mshick/add-pr-comment@v2 + with: + message: | + Released dev build of ${{ matrix.plugin }} with dev version: ${{ steps.package-version.outputs.current-version }} From 940156c3f01f7fa9b6c3145574e9e6759e7d571f Mon Sep 17 00:00:00 2001 From: Mike Summerfeldt <20338451+IT-MikeS@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:59:44 -0400 Subject: [PATCH 2/4] chore: ci release dev for non-draft PR's (#1853) --- .github/workflows/dev-releases-for-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-releases-for-pr.yml b/.github/workflows/dev-releases-for-pr.yml index d162ec77d..e96682c03 100644 --- a/.github/workflows/dev-releases-for-pr.yml +++ b/.github/workflows/dev-releases-for-pr.yml @@ -75,7 +75,7 @@ jobs: - env: PR_NUMBER: ${{ github.event.pull_request.number }} run: | - npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date +\"%Y%m%dT%H%M%S\") + npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date + %Y%m%dT%H%M%S) npm publish --tag dev --dry-run working-directory: ${{ matrix.plugin }} - name: get-npm-version From 88a633ccab6753fe2559a9b8b55a697022fe327c Mon Sep 17 00:00:00 2001 From: Joey Pender Date: Mon, 23 Oct 2023 11:47:42 -0500 Subject: [PATCH 3/4] feat(google-maps): Separate mapId for Google Maps Cloud IDs (#1750) --- google-maps/README.md | 3 ++ .../googlemaps/CapacitorGoogleMapsPlugin.kt | 13 ++++++-- .../plugins/googlemaps/GoogleMapConfig.kt | 9 +++++- google-maps/ios/Plugin/GoogleMapConfig.swift | 3 ++ google-maps/ios/Plugin/Map.swift | 10 ++++++- google-maps/src/definitions.ts | 30 +++++++++++++++++++ google-maps/src/web.ts | 1 + 7 files changed, 65 insertions(+), 4 deletions(-) diff --git a/google-maps/README.md b/google-maps/README.md index e63385591..bfbcdba5f 100644 --- a/google-maps/README.md +++ b/google-maps/README.md @@ -900,6 +900,9 @@ For iOS and Android only the config options declared on Logger.debug("Capacitor Google Maps", "Latest Google Maps renderer enabled") + MapsInitializer.Renderer.LEGACY -> Logger.debug("Capacitor Google Maps", "Legacy Google Maps renderer enabled - Cloud based map styling and advanced drawing not available") + } + } + override fun handleOnStart() { super.handleOnStart() maps.forEach { it.value.onStart() } diff --git a/google-maps/android/src/main/java/com/capacitorjs/plugins/googlemaps/GoogleMapConfig.kt b/google-maps/android/src/main/java/com/capacitorjs/plugins/googlemaps/GoogleMapConfig.kt index 6f27d10ab..bc29ae08f 100644 --- a/google-maps/android/src/main/java/com/capacitorjs/plugins/googlemaps/GoogleMapConfig.kt +++ b/google-maps/android/src/main/java/com/capacitorjs/plugins/googlemaps/GoogleMapConfig.kt @@ -16,6 +16,7 @@ class GoogleMapConfig(fromJSONObject: JSONObject) { var liteMode: Boolean = false var devicePixelRatio: Float = 1.00f var styles: String? = null + var mapId: String? = null init { if (!fromJSONObject.has("width")) { @@ -81,8 +82,14 @@ class GoogleMapConfig(fromJSONObject: JSONObject) { center = LatLng(lat, lng) val cameraPosition = CameraPosition(center, zoom.toFloat(), 0.0F, 0.0F) - googleMapOptions = GoogleMapOptions().camera(cameraPosition).liteMode(liteMode) styles = fromJSONObject.getString("styles") + + mapId = fromJSONObject.getString("androidMapId") + + googleMapOptions = GoogleMapOptions().camera(cameraPosition).liteMode(liteMode) + if (mapId != null) { + googleMapOptions?.mapId(mapId!!) + } } } diff --git a/google-maps/ios/Plugin/GoogleMapConfig.swift b/google-maps/ios/Plugin/GoogleMapConfig.swift index 4905b18e3..ef97fe77b 100644 --- a/google-maps/ios/Plugin/GoogleMapConfig.swift +++ b/google-maps/ios/Plugin/GoogleMapConfig.swift @@ -9,6 +9,7 @@ public struct GoogleMapConfig: Codable { let center: LatLng let zoom: Double let styles: String? + var mapId: String? init(fromJSObject: JSObject) throws { guard let width = fromJSObject["width"] as? Double else { @@ -50,5 +51,7 @@ public struct GoogleMapConfig: Codable { } else { self.styles = nil } + + self.mapId = fromJSObject["iOSMapId"] as? String } } diff --git a/google-maps/ios/Plugin/Map.swift b/google-maps/ios/Plugin/Map.swift index d7315f0e9..71e4a7de9 100644 --- a/google-maps/ios/Plugin/Map.swift +++ b/google-maps/ios/Plugin/Map.swift @@ -13,6 +13,7 @@ class GMViewController: UIViewController { var GMapView: GMSMapView! var cameraPosition: [String: Double]! var minimumClusterSize: Int? + var mapId: String? private var clusterManager: GMUClusterManager? @@ -25,7 +26,13 @@ class GMViewController: UIViewController { let camera = GMSCameraPosition.camera(withLatitude: cameraPosition["latitude"] ?? 0, longitude: cameraPosition["longitude"] ?? 0, zoom: Float(cameraPosition["zoom"] ?? 12)) let frame = CGRect(x: mapViewBounds["x"] ?? 0, y: mapViewBounds["y"] ?? 0, width: mapViewBounds["width"] ?? 0, height: mapViewBounds["height"] ?? 0) - self.GMapView = GMSMapView.map(withFrame: frame, camera: camera) + if let id = mapId { + let gmsId = GMSMapID(identifier: id) + self.GMapView = GMSMapView(frame: frame, mapID: gmsId, camera: camera) + } else { + self.GMapView = GMSMapView(frame: frame, camera: camera) + } + self.view = GMapView } @@ -85,6 +92,7 @@ public class Map { self.config = config self.delegate = delegate self.mapViewController = GMViewController() + self.mapViewController.mapId = config.mapId self.render() } diff --git a/google-maps/src/definitions.ts b/google-maps/src/definitions.ts index 0c2c92328..57f331c83 100644 --- a/google-maps/src/definitions.ts +++ b/google-maps/src/definitions.ts @@ -191,6 +191,36 @@ export interface GoogleMapConfig extends google.maps.MapOptions { * @since 4.3.0 */ styles?: google.maps.MapTypeStyle[] | null; + /** + * A map id associated with a specific map style or feature. + * + * [Use Map IDs](https://developers.google.com/maps/documentation/get-map-id) + * + * Only for Web. + * + * @since 6.0.0 + */ + mapId?: string; + /** + * A map id associated with a specific map style or feature. + * + * [Use Map IDs](https://developers.google.com/maps/documentation/get-map-id) + * + * Only for Android. + * + * @since 6.0.0 + */ + androidMapId?: string; + /** + * A map id associated with a specific map style or feature. + * + * [Use Map IDs](https://developers.google.com/maps/documentation/get-map-id) + * + * Only for iOS. + * + * @since 6.0.0 + */ + iOSMapId?: string; } /** diff --git a/google-maps/src/web.ts b/google-maps/src/web.ts index b8c6467b8..5b82addec 100644 --- a/google-maps/src/web.ts +++ b/google-maps/src/web.ts @@ -436,6 +436,7 @@ export class CapacitorGoogleMapsWeb async create(_args: CreateMapArgs): Promise { console.log(`Create map: ${_args.id}`); await this.importGoogleLib(_args.apiKey, _args.region, _args.language); + this.maps[_args.id] = { map: new window.google.maps.Map(_args.element, { ..._args.config }), element: _args.element, From 1ca3fbf04de3df4e4ef2855ad352c2460c735cae Mon Sep 17 00:00:00 2001 From: Mike Summerfeldt <20338451+IT-MikeS@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:03:15 -0400 Subject: [PATCH 4/4] chore: ci release dev for non-draft PR's (#1854) --- .github/workflows/dev-releases-for-pr.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-releases-for-pr.yml b/.github/workflows/dev-releases-for-pr.yml index e96682c03..c7dbe7dfa 100644 --- a/.github/workflows/dev-releases-for-pr.yml +++ b/.github/workflows/dev-releases-for-pr.yml @@ -9,10 +9,7 @@ on: jobs: setup: if: github.event.pull_request.draft == false - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-12] + runs-on: ubuntu-latest timeout-minutes: 30 outputs: plugins: ${{ steps.packages.outputs.paths }} @@ -49,7 +46,7 @@ jobs: files: ${{ steps.catjson.outputs.FILES_JSON }} release-dev-of-plugins: - runs-on: macos-12 + runs-on: ubuntu-latest timeout-minutes: 30 permissions: pull-requests: write @@ -75,7 +72,7 @@ jobs: - env: PR_NUMBER: ${{ github.event.pull_request.number }} run: | - npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date + %Y%m%dT%H%M%S) + npm version prerelease --no-git-tag-version -f --preid dev-$PR_NUMBER-$(date +%Y%m%dT%H%M%S) npm publish --tag dev --dry-run working-directory: ${{ matrix.plugin }} - name: get-npm-version