Skip to content
Merged
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
11 changes: 10 additions & 1 deletion .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ on:
jobs:
build:
runs-on: macOS-latest

env:
MAPBOX_SECRET_TOKEN: ${{ secrets.MAPBOX_SECRET_TOKEN }}
MAPBOX_PUBLIC_TOKEN: ${{ secrets.MAPBOX_PUBLIC_TOKEN }}
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up netrc
uses: extractions/netrc@v1
with:
machine: api.mapbox.com
username: mapbox
password: ${{ secrets.MAPBOX_SECRET_TOKEN }}
- name: Cocoapods install
run: (cd sample/ios-app && pod install)
- name: Check library
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ jobs:
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEYID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.GPG_KEY_CONTENTS }}

MAPBOX_SECRET_TOKEN: ${{ secrets.MAPBOX_SECRET_TOKEN }}
MAPBOX_PUBLIC_TOKEN: ${{ secrets.MAPBOX_PUBLIC_TOKEN }}
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up netrc
uses: extractions/netrc@v1
with:
machine: api.mapbox.com
username: mapbox
password: ${{ secrets.MAPBOX_SECRET_TOKEN }}
- name: Cocoapods install
run: (cd sample/ios-app && pod install)
- name: Publish library
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,29 @@ class MarkerViewModel(
## Samples
Please see more examples in the [sample directory](sample).

## Set Up Locally
## Set Up Locally
Before open project need to setup `gradle.properties` with tokens:
```
# mapbox tokens by guide https://docs.mapbox.com/android/maps/guides/install/
mapbox.secretToken=YOUR_SECRET_MAPBOX_KEY
mapbox.publicToken=YOUR_PUBLIC_MAPBOX_KEY

# google maps api key by guide https://developers.google.com/maps/documentation/android-sdk/get-api-key
googleMaps.apiKey=YOUR_API_KEY
```

# ios info.plist setup with tokens:
```
MGLMapboxAccessToken=YOUR_PUBLIC_MAPBOX_KEY
GoogleAPIkey=YOUR_API_KEY
```
add the following entry to your `.netrc` file:
```
machine api.mapbox.com
login mapbox
password YOUR_SECRET_MAPBOX_KEY
```

- The [maps directory](maps) contains the base classes for all maps providers;
- The [maps-google directory](maps-google) contains the Google Maps implementation;
- The [maps-mapbox directory](maps-mapbox) contains the mapbox implementation;
Expand Down
8 changes: 5 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ testExtJunitVersion = "1.1.1"
playServicesLocationVersion = "18.0.0"
playServicesMapsVersion = "17.0.0"
googleMapsServicesVersion = "0.2.11"
mapboxVersion = "9.2.1"
mapboxNavigationVersion = "0.42.6"
mapboxVersion = "9.6.1"
mapboxNavigationVersion = "1.5.1"
mapboxAnnotationVersion = "0.9.0"
mapboxServicesVersion = "5.8.0"
multidexVersion = "2.0.1"
kotlinxSerializationVersion = "1.2.1"
coroutinesVersion = "1.5.0-native-mt"
Expand All @@ -30,8 +31,9 @@ playServicesLocation = { module = "com.google.android.gms:play-services-location
playServicesMaps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMapsVersion" }
googleMapsServices = { module = "com.google.maps:google-maps-services", version.ref = "googleMapsServicesVersion" }
mapbox = { module = "com.mapbox.mapboxsdk:mapbox-android-sdk", version.ref = "mapboxVersion" }
mapboxNavigation = { module = "com.mapbox.mapboxsdk:mapbox-android-navigation", version.ref = "mapboxNavigationVersion" }
mapboxNavigation = { module = "com.mapbox.navigation:core", version.ref = "mapboxNavigationVersion" }
mapboxAnnotation = { module = "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9", version.ref = "mapboxAnnotationVersion" }
mapboxServices = { module = "com.mapbox.mapboxsdk:mapbox-sdk-services", version.ref = "mapboxServicesVersion" }
multidex = { module = "androidx.multidex:multidex", version.ref = "multidexVersion" }
ktorClientOkHttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktorClientVersion" }
kotlinSerialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationVersion" }
Expand Down
4 changes: 2 additions & 2 deletions maps-google/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ dependencies {

"androidMainImplementation"(libs.appCompat)
"androidMainImplementation"(libs.lifecycle)
"androidMainImplementation"(libs.playServicesLocation)
"androidMainImplementation"(libs.playServicesMaps)
"androidMainApi"(libs.playServicesLocation)
"androidMainApi"(libs.playServicesMaps)
"androidMainImplementation"(libs.googleMapsServices)
"androidMainImplementation"(libs.ktorClientOkHttp)

Expand Down
5 changes: 3 additions & 2 deletions maps-mapbox/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ dependencies {
"androidMainImplementation"(libs.appCompat)
"androidMainImplementation"(libs.lifecycle)
"androidMainImplementation"(libs.playServicesLocation)
"androidMainImplementation"(libs.mapbox)
"androidMainImplementation"(libs.mapboxAnnotation)
"androidMainImplementation"(libs.mapboxNavigation)
"androidMainImplementation"(libs.mapboxServices)
"androidMainApi"(libs.mapbox)
"androidMainApi"(libs.mapboxNavigation)
}

cocoaPods {
Expand Down
8 changes: 7 additions & 1 deletion sample/android-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ android {
versionName = "0.1.0"

multiDexEnabled = true

val googleMapsApiKey: String = (System.getenv("GOOGLE_MAPS_API_KEY") ?: extra["googleMaps.apiKey"] as? String).orEmpty()
val mapboxPublicToken: String = (System.getenv("MAPBOX_PUBLIC_TOKEN") ?: extra["mapbox.publicToken"] as? String).orEmpty()

manifestPlaceholders["googleMapsApiKey"] = googleMapsApiKey
buildConfigField("String", "GOOGLE_MAPS_API_KEY", "\"$googleMapsApiKey\"")
buildConfigField("String", "MAPBOX_PUBLIC_TOKEN", "\"$mapboxPublicToken\"")
}
}

Expand All @@ -23,7 +30,6 @@ dependencies {
implementation(libs.playServicesMaps)
implementation(libs.googleMapsServices)
implementation(libs.mapbox)
implementation(libs.mapboxAnnotation)

implementation(libs.multidex)

Expand Down
3 changes: 1 addition & 2 deletions sample/android-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<activity android:name=".GoogleMapsActivity" />
<activity android:name=".MapboxActivity" />

<!-- TODO: Replace with your API Key from https://developers.google.com/maps/documentation/ios-sdk/ -->
<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR-API-KEY"/>
<meta-data android:name="com.google.android.geo.API_KEY" android:value="${googleMapsApiKey}"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class GoogleMapsActivity : MvvmActivity<ActivityGoogleMapsBinding, GoogleMapView
applicationContext = applicationContext
),
googleMapController = GoogleMapController(
// TODO: Replace with your API Key from https://developers.google.com/maps/documentation/android-sdk/
geoApiKey = "YOUR-API-KEY"
geoApiKey = BuildConfig.GOOGLE_MAPS_API_KEY
)
).apply { start() }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MapboxActivity : MvvmActivity<ActivityMapboxBinding, MapboxViewModel>() {
override val viewModelVariableId: Int = BR.viewModel
override val viewModelClass: Class<MapboxViewModel> = MapboxViewModel::class.java

private val mapboxToken = "YOUR-ACCESS-TOKEN"
private val mapboxToken = BuildConfig.MAPBOX_PUBLIC_TOKEN

override fun viewModelFactory(): ViewModelProvider.Factory {
return createViewModelFactory {
Expand Down
6 changes: 3 additions & 3 deletions sample/ios-app/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ platform :ios, '11.0'
target 'TestProj' do
# MultiPlatformLibrary
pod 'MultiPlatformLibrary', :path => '../mpp-library'
pod 'Mapbox-iOS-SDK', '5.6.0'
pod 'MapboxNavigation', '0.40.0'
pod 'GoogleMaps', '3.7.0'
pod 'Mapbox-iOS-SDK', '6.3.0'
pod 'MapboxNavigation', '1.4.1'
pod 'GoogleMaps', '5.1.0'
end

# GoogleMaps is static library that already linked in moko-maps-google. Remove duplicated linking.
Expand Down
2 changes: 2 additions & 0 deletions sample/ios-app/TestProj.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 4VU932NX78;
INFOPLIST_FILE = src/Info.plist;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = dev.icerock.moko.sample.maps;
PRODUCT_NAME = "moko-maps";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -307,6 +308,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 4VU932NX78;
INFOPLIST_FILE = src/Info.plist;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = dev.icerock.moko.sample.maps;
PRODUCT_NAME = "moko-maps";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
3 changes: 1 addition & 2 deletions sample/ios-app/src/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
// TODO: Replace with your API Key from https://developers.google.com/maps/documentation/ios-sdk/
GMSServices.provideAPIKey("YOUR-API-KEY")
GMSServices.provideAPIKey(Bundle.main.object(forInfoDictionaryKey: "GoogleAPIkey") as! String)

// For Mapbox add key "MGLMapboxAccessToken" in Info.plist
return true
Expand Down
2 changes: 1 addition & 1 deletion sample/ios-app/src/GoogleMapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GoogleMapViewController: UIViewController {
permissionsController: PermissionsController(),
googleMapController: GoogleMapController(
mapView: mapView,
geoApiKey: "YOUR-API-KEY"
geoApiKey: Bundle.main.object(forInfoDictionaryKey: "GoogleAPIkey") as! String
)
)

Expand Down
4 changes: 3 additions & 1 deletion sample/ios-app/src/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>MGLMapboxAccessToken</key>
<string>YOUR-ACCESS-TOKEN</string>
<string>YOUR_PUBLIC_MAPBOX_KEY</string>
<key>GoogleAPIkey</key>
<string>YOUR_API_KEY</string>
<key>MGLMapboxMetricsEnabledSettingShownInApp</key>
<true/>
</dict>
Expand Down
2 changes: 0 additions & 2 deletions sample/mpp-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ dependencies {
commonMainApi(projects.mapsGoogle)
commonMainApi(projects.mapsMapbox)
"androidMainImplementation"(libs.lifecycle)
"androidMainImplementation"(libs.playServicesLocation)
"androidMainImplementation"(libs.mapbox)
}

multiplatformResources {
Expand Down
15 changes: 14 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ dependencyResolutionManagement {
mavenCentral()
google()

maven { url = uri("https://mapbox.bintray.com/mapbox") }
maven {
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
authentication {
create("basic", org.gradle.authentication.http.BasicAuthentication::class)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = System.getenv("MAPBOX_SECRET_TOKEN")
?: extra["mapbox.secretToken"] as? String
}
}

jcenter {
content {
Expand Down