Skip to content
Merged

Dev #20

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
pull_request:
branches: [dev, main]

concurrency:
group: pr-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: macos-latest
Expand All @@ -13,6 +17,9 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Generate nitrogen code
run: yarn nitrogen

- name: Install ktlint & swiftlint
run: |
brew install ktlint
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The [example app](/example/) demonstrates usage of the library. You need to run

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.

If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/GoogleMapsNitroExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-google-maps-plus`.
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/GoogleMapsPlusExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-google-maps-plus`.

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-google-maps-plus` under `Android`.

Expand All @@ -67,7 +67,7 @@ yarn example ios
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:

```sh
Running "GoogleMapsNitroExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
Running "GoogleMapsPlusExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
```

Note the `"fabric":true` and `"concurrentRoot":true` properties.
Expand Down
4 changes: 2 additions & 2 deletions GoogleMapsNitro.podspec → RNGoogleMapsPlus.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "GoogleMapsNitro"
s.name = "RNGoogleMapsPlus"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
Expand All @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
s.dependency 'GoogleMaps', '10.3.0'
s.dependency 'SVGKit', '3.0.0'

load 'nitrogen/generated/ios/GoogleMapsNitro+autolinking.rb'
load 'nitrogen/generated/ios/RNGoogleMapsPlus+autolinking.rb'
add_nitrogen_files(s)

install_modules_dependencies(s)
Expand Down
6 changes: 3 additions & 3 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(GoogleMapsNitro)
project(RNGoogleMapsPlus)
cmake_minimum_required(VERSION 3.9.0)

set (PACKAGE_NAME GoogleMapsNitro)
set (PACKAGE_NAME RNGoogleMapsPlus)
set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 20)

Expand All @@ -14,7 +14,7 @@ add_library(${PACKAGE_NAME} SHARED
)

# Add Nitrogen specs :)
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/GoogleMapsNitro+autolinking.cmake)
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/RNGoogleMapsPlus+autolinking.cmake)

# Set up local includes
include_directories(
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['GoogleMapsNitro_' + name]
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNGoogleMapsPlus_' + name]
}

repositories {
Expand All @@ -22,17 +22,17 @@ def reactNativeArchitectures() {

apply plugin: "com.android.library"
apply plugin: "kotlin-android"
apply from: '../nitrogen/generated/android/GoogleMapsNitro+autolinking.gradle'
apply from: '../nitrogen/generated/android/RNGoogleMapsPlus+autolinking.gradle'
apply from: "./fix-prefab.gradle"

apply plugin: "com.facebook.react"

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["GoogleMapsNitro_" + name]).toInteger()
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RNGoogleMapsPlus_" + name]).toInteger()
}

android {
namespace "com.googlemapsnitro"
namespace "com.rngooglemapsplus"

compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

Expand Down
16 changes: 8 additions & 8 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GoogleMapsNitro_kotlinVersion=2.0.21
GoogleMapsNitro_minSdkVersion=26
GoogleMapsNitro_targetSdkVersion=36
GoogleMapsNitro_compileSdkVersion=36
GoogleMapsNitro_ndkVersion=27.1.12297006
GoogleMapsNitro_googlePlayServicesBaseVersion=18.8.0
GoogleMapsNitro_googlePlayServicesMapsVersion=19.2.0
GoogleMapsNitro_googlePlayServicesLocationVersion=21.3.0
RNGoogleMapsPlus_kotlinVersion=2.0.21
RNGoogleMapsPlus_minSdkVersion=26
RNGoogleMapsPlus_targetSdkVersion=36
RNGoogleMapsPlus_compileSdkVersion=36
RNGoogleMapsPlus_ndkVersion=27.1.12297006
RNGoogleMapsPlus_googlePlayServicesBaseVersion=18.8.0
RNGoogleMapsPlus_googlePlayServicesMapsVersion=19.2.0
RNGoogleMapsPlus_googlePlayServicesLocationVersion=21.3.0
4 changes: 2 additions & 2 deletions android/src/main/cpp/cpp-adapter.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <jni.h>
#include "GoogleMapsNitroOnLoad.hpp"
#include "RNGoogleMapsPlusOnLoad.hpp"

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
return margelo::nitro::googlemapsnitro::initialize(vm);
return margelo::nitro::rngooglemapsplus::initialize(vm);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import android.graphics.Color
import androidx.core.graphics.toColorInt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import android.annotation.SuppressLint
import android.location.Location
Expand All @@ -23,11 +23,11 @@ import com.google.android.gms.maps.model.PolygonOptions
import com.google.android.gms.maps.model.Polyline
import com.google.android.gms.maps.model.PolylineOptions

class GoogleMapsNitroViewImpl(
class GoogleMapsViewImpl(
val reactContext: ThemedReactContext,
val locationHandler: LocationHandler,
val playServiceHandler: PlayServicesHandler,
val markerOptions: com.googlemapsnitro.MarkerOptions,
val markerOptions: com.rngooglemapsplus.MarkerOptions,
) : MapView(reactContext),
GoogleMap.OnCameraMoveStartedListener,
GoogleMap.OnCameraMoveListener,
Expand Down Expand Up @@ -104,7 +104,7 @@ class GoogleMapsNitroViewImpl(
}

onCreate(null)
getMapAsync(this@GoogleMapsNitroViewImpl)
getMapAsync(this@GoogleMapsViewImpl)
}

override fun onCameraMoveStarted(reason: Int) {
Expand Down Expand Up @@ -653,7 +653,7 @@ class GoogleMapsNitroViewImpl(
setOnMarkerClickListener(null)
setOnMapClickListener(null)
}
this@GoogleMapsNitroViewImpl.onDestroy()
this@GoogleMapsViewImpl.onDestroy()
googleMap = null
reactContext.removeLifecycleEventListener(this)
}
Expand Down Expand Up @@ -684,14 +684,14 @@ class GoogleMapsNitroViewImpl(
override fun onHostResume() {
onUi {
locationHandler.start()
this@GoogleMapsNitroViewImpl.onResume()
this@GoogleMapsViewImpl.onResume()
}
}

override fun onHostPause() {
onUi {
locationHandler.stop()
this@GoogleMapsNitroViewImpl.onPause()
this@GoogleMapsViewImpl.onPause()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import android.annotation.SuppressLint
import android.content.Intent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import android.graphics.Bitmap
import android.graphics.Canvas
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import com.facebook.react.uimanager.PixelUtil.dpToPx
import com.google.android.gms.maps.model.PolygonOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import com.facebook.react.uimanager.PixelUtil.dpToPx
import com.google.android.gms.maps.model.ButtCap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import android.Manifest
import android.content.pm.PackageManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import com.facebook.react.bridge.ReactContext
import com.google.android.gms.common.ConnectionResult
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import com.margelo.nitro.core.Promise

class HybridGoogleMapsNitroModule : HybridGoogleMapsNitroModuleSpec() {
val context = GoogleMapsNitroPackage.AppContextHolder.context
class RNGoogleMapsPlusModule : HybridRNGoogleMapsPlusModuleSpec() {
val context = RNGoogleMapsPlusPackage.AppContextHolder.context
private val locationHandler: LocationHandler = LocationHandler(context)
private val permissionHandler: PermissionHandler = PermissionHandler(context)
private val playServicesHandler: PlayServicesHandler = PlayServicesHandler(context)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import com.facebook.react.BaseReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfoProvider
import com.facebook.react.uimanager.ViewManager
import com.googlemapsnitro.GoogleMapsNitroPackage.AppContextHolder.context
import com.googlemapsnitro.views.HybridGoogleMapsNitroViewManager
import com.rngooglemapsplus.RNGoogleMapsPlusPackage.AppContextHolder.context
import com.rngooglemapsplus.views.HybridRNGoogleMapsPlusViewManager

class GoogleMapsNitroPackage : BaseReactPackage() {
class RNGoogleMapsPlusPackage : BaseReactPackage() {
override fun getModule(
name: String,
reactContext: ReactApplicationContext,
Expand All @@ -19,7 +19,7 @@ class GoogleMapsNitroPackage : BaseReactPackage() {
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
context = reactContext
return listOf(
HybridGoogleMapsNitroViewManager(),
HybridRNGoogleMapsPlusViewManager(),
)
}

Expand All @@ -29,7 +29,7 @@ class GoogleMapsNitroPackage : BaseReactPackage() {

companion object {
init {
GoogleMapsNitroOnLoad.initializeNative()
RNGoogleMapsPlusOnLoad.initializeNative()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.googlemapsnitro
package com.rngooglemapsplus

import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.bridge.UiThreadUtil
Expand All @@ -10,17 +10,17 @@ import com.google.android.gms.maps.model.MapStyleOptions
import com.margelo.nitro.core.Promise

@DoNotStrip
class HybridGoogleMapsNitroView(
class RNGoogleMapsPlusView(
val context: ThemedReactContext,
) : HybridGoogleMapsNitroViewSpec() {
) : HybridRNGoogleMapsPlusViewSpec() {
private var currentCustomMapStyle: String = ""
private var permissionHandler = PermissionHandler(context)
private var locationHandler = LocationHandler(context)
private var playServiceHandler = PlayServicesHandler(context)
private val markerOptions = MarkerOptions()

override val view =
GoogleMapsNitroViewImpl(context, locationHandler, playServiceHandler, markerOptions)
GoogleMapsViewImpl(context, locationHandler, playServiceHandler, markerOptions)

private val polylineOptions = MapPolylineOptions()
private val polygonOptions = MapPolygonOptions()
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace "googlemapsnitro.example"
namespace "rngooglemapsplus.example"
defaultConfig {
applicationId "googlemapsnitro.example"
applicationId "rngooglemapsplus.example"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package googlemapsnitro.example
package rngooglemapsplus.example

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
Expand All @@ -11,7 +11,7 @@ class MainActivity : ReactActivity() {
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "GoogleMapsNitroExample"
override fun getMainComponentName(): String = "GoogleMapsPlusExample"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package googlemapsnitro.example
package rngooglemapsplus.example

import android.app.Application
import com.facebook.react.PackageList
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">GoogleMapsNitroExample</string>
<string name="app_name">GoogleMapsPlusExample</string>
</resources>
2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'googlemapsnitro.example'
rootProject.name = 'rngooglemapsplus.example'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
4 changes: 2 additions & 2 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "GoogleMapsNitroExample",
"displayName": "GoogleMapsNitroExample"
"name": "GoogleMapsPlusExample",
"displayName": "GoogleMapsPlusExample"
}
2 changes: 0 additions & 2 deletions example/ios/GoogleMapsNitroExample/Debug.xcconfig

This file was deleted.

2 changes: 0 additions & 2 deletions example/ios/GoogleMapsNitroExample/Release.xcconfig

This file was deleted.

Loading
Loading