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
10 changes: 8 additions & 2 deletions example-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
id("org.jlleitschuh.gradle.ktlint")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") version "2.0.1"
}

ktlint {
Expand All @@ -13,6 +14,11 @@ ktlint {
}
}

secrets {
propertiesFileName = "secrets.properties"
defaultPropertiesFileName = "local.defaults.properties"
}

android {
namespace = "com.mapconductor.example"
compileSdk = project.property("compileSdk").toString().toInt()
Expand All @@ -28,8 +34,8 @@ android {
useSupportLibrary = true
}

versionCode = 5
versionName = "1.0.4"
versionCode = 6
versionName = "1.0.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
16 changes: 16 additions & 0 deletions example-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@
android:theme="@style/Theme.OverlayTest"
tools:targetApi="35">

<meta-data
android:name="HERE_ACCESS_KEY_ID"
android:value="${HERE_ACCESS_KEY_ID}" />
<meta-data
android:name="HERE_ACCESS_KEY_SECRET"
android:value="${HERE_ACCESS_KEY_SECRET}" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${GOOGLE_MAPS_API_KEY}" />

<meta-data
android:name="ARCGIS_API_KEY"
android:value="${ARCGIS_API_KEY}" />

<meta-data
android:name="MAPBOX_ACCESS_TOKEN"
android:value="${MAPBOX_ACCESS_TOKEN}" />
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import com.mapconductor.example.ui.DemoMapPageScaffold
import com.mapconductor.googlemaps.GoogleMapActualMarker
import com.mapconductor.here.HereActualMarker
import com.mapconductor.mapbox.MapboxActualMarker
import com.mapconductor.marker.nativestrategy.NativeSpatialMarkerStrategy
import com.mapconductor.marker.nativestrategy.spatial.NativeRemoteSpatialMarkerStrategy
import com.mapconductor.marker.nativestrategy.NativeParallelMarkerStrategy
import com.mapconductor.marker.nativestrategy.NativeSpatialMarkerRenderingStrategy

@Composable
fun PostOfficeMapPage(
Expand All @@ -31,12 +31,12 @@ fun PostOfficeMapPage(
val dataLoader = remember { PostOfficeDataLoader(context) }
val strategies =
remember {
val google = NativeRemoteSpatialMarkerStrategy<GoogleMapActualMarker>(context)
val google = NativeParallelMarkerStrategy<GoogleMapActualMarker>()
// val google = NativeSpatialMarkerStrategy<GoogleMapActualMarker>()
// val google = NativeParallelMarkerStrategy<GoogleMapActualMarker>()
val mapbox = NativeSpatialMarkerStrategy<MapboxActualMarker>()
val here = NativeSpatialMarkerStrategy<HereActualMarker>()
val arcgis = NativeSpatialMarkerStrategy<ArcGISActualMarker>()
val mapbox = NativeParallelMarkerStrategy<MapboxActualMarker>()
val here = NativeParallelMarkerStrategy<HereActualMarker>()
val arcgis = NativeSpatialMarkerRenderingStrategy<ArcGISActualMarker>()
Strategies(
google = google,
mapbox = mapbox,
Expand Down
1 change: 1 addition & 0 deletions mapconductor-bom/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libraryVersion=1.0.1
2 changes: 1 addition & 1 deletion mapconductor-core/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libraryVersion=1.0.0
libraryVersion=1.0.1
81 changes: 3 additions & 78 deletions mapconductor-for-arcgis/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,74 +15,6 @@ ktlint {
}
}

// Task to create secrets.properties in root project if it doesn't exist
tasks.register("ensureSecretsFiles") {
doFirst {
val secretsFile = rootProject.file("secrets.properties")
val defaultsFile = rootProject.file("local.defaults.properties")

// Create secrets.properties if it doesn't exist
if (!secretsFile.exists()) {
secretsFile.createNewFile()
println("Created secrets.properties in root project")
}

// Create local.defaults.properties if it doesn't exist
if (!defaultsFile.exists()) {
defaultsFile.createNewFile()
println("Created local.defaults.properties in root project")
}

// Ensure ARCGIS_API_KEY exists in secrets.properties
val secretsContent = secretsFile.readText()
if (!secretsContent.contains("ARCGIS_API_KEY=")) {
secretsFile.appendText("ARCGIS_API_KEY=ARCGIS_API_KEY\n")
println("Added ARCGIS_API_KEY to secrets.properties")
}

// Ensure ARCGIS_API_KEY exists in local.defaults.properties
val defaultsContent = defaultsFile.readText()
if (!defaultsContent.contains("ARCGIS_API_KEY=")) {
defaultsFile.appendText("ARCGIS_API_KEY=ARCGIS_API_KEY\n")
println("Added ARCGIS_API_KEY to local.defaults.properties")
}
}
}

// Function to read API key from secrets.properties
fun getArcgisApiKey(): String {
val secretsFile = rootProject.file("secrets.properties")
val defaultsFile = rootProject.file("local.defaults.properties")

// Try to read from secrets.properties first
if (secretsFile.exists()) {
val content = secretsFile.readText()
content.lines().forEach { line ->
if (line.startsWith("ARCGIS_API_KEY=")) {
val value = line.substringAfter("=").trim()
if (value.isNotEmpty() && value != "ARCGIS_API_KEY") {
return value
}
}
}
}

// Fallback to local.defaults.properties
if (defaultsFile.exists()) {
val content = defaultsFile.readText()
content.lines().forEach { line ->
if (line.startsWith("ARCGIS_API_KEY=")) {
val value = line.substringAfter("=").trim()
if (value.isNotEmpty()) {
return value
}
}
}
}

// Return placeholder if no valid key found
return "ARCGIS_API_KEY"
}
android {
namespace = "com.mapconductor.arcgis"
compileSdk = project.property("compileSdk").toString().toInt()
Expand All @@ -92,9 +24,6 @@ android {

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")

// Set the ArcGIS API key from secrets.properties
manifestPlaceholders["ARCGIS_API_KEY"] = getArcgisApiKey()
}

buildFeatures {
Expand Down Expand Up @@ -123,10 +52,6 @@ android {
}
}

// Run ensureSecretsFiles before processing manifests
tasks.matching { it.name.contains("process") && it.name.contains("Manifest") }.configureEach {
dependsOn("ensureSecretsFiles")
}
compileOptions {
sourceCompatibility = JavaVersion.toVersion(project.property("javaVersion").toString())
targetCompatibility = JavaVersion.toVersion(project.property("javaVersion").toString())
Expand All @@ -142,10 +67,10 @@ dependencies {
compileOnly(libs.androidx.ui)
compileOnly(libs.androidx.ui.tooling.preview)
compileOnly(libs.androidx.core.ktx)
compileOnly(platform(libs.androidx.compose.bom)) // ← bomでバージョン合わせる
implementation(platform(libs.androidx.compose.bom)) // ← bomでバージョン合わせる
// Lifecycle(MapView用)
compileOnly(libs.androidx.lifecycle.runtime.ktx)
compileOnly(libs.androidx.lifecycle.common.java8)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.common.java8)

// ArcGIS SDK
compileOnly(libs.arcgis.maps.kotlin)
Expand Down
2 changes: 1 addition & 1 deletion mapconductor-for-arcgis/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libraryVersion=1.0.0
libraryVersion=1.0.1
10 changes: 1 addition & 9 deletions mapconductor-for-arcgis/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<meta-data
android:name="ARCGIS_API_KEY"
android:value="${ARCGIS_API_KEY}" />

</application>
</manifest>
<manifest></manifest>
84 changes: 4 additions & 80 deletions mapconductor-for-googlemaps/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,75 +15,6 @@ ktlint {
}
}

// Task to create secrets.properties in root project if it doesn't exist
tasks.register("ensureSecretsFiles") {
doFirst {
val secretsFile = rootProject.file("secrets.properties")
val defaultsFile = rootProject.file("local.defaults.properties")

// Create secrets.properties if it doesn't exist
if (!secretsFile.exists()) {
secretsFile.createNewFile()
println("Created secrets.properties in root project")
}

// Create local.defaults.properties if it doesn't exist
if (!defaultsFile.exists()) {
defaultsFile.createNewFile()
println("Created local.defaults.properties in root project")
}

// Ensure GOOGLE_MAPS_API_KEY exists in secrets.properties
val secretsContent = secretsFile.readText()
if (!secretsContent.contains("GOOGLE_MAPS_API_KEY=")) {
secretsFile.appendText("GOOGLE_MAPS_API_KEY=GOOGLE_MAPS_API_KEY\n")
println("Added GOOGLE_MAPS_API_KEY to secrets.properties")
}

// Ensure GOOGLE_MAPS_API_KEY exists in local.defaults.properties
val defaultsContent = defaultsFile.readText()
if (!defaultsContent.contains("GOOGLE_MAPS_API_KEY=")) {
defaultsFile.appendText("GOOGLE_MAPS_API_KEY=GOOGLE_MAPS_API_KEY\n")
println("Added GOOGLE_MAPS_API_KEY to local.defaults.properties")
}
}
}

// Function to read API key from secrets.properties
fun getGoogleMapsApiKey(): String {
val secretsFile = rootProject.file("secrets.properties")
val defaultsFile = rootProject.file("local.defaults.properties")

// Try to read from secrets.properties first
if (secretsFile.exists()) {
val content = secretsFile.readText()
content.lines().forEach { line ->
if (line.startsWith("GOOGLE_MAPS_API_KEY=")) {
val value = line.substringAfter("=").trim()
if (value.isNotEmpty() && value != "GOOGLE_MAPS_API_KEY") {
return value
}
}
}
}

// Fallback to local.defaults.properties
if (defaultsFile.exists()) {
val content = defaultsFile.readText()
content.lines().forEach { line ->
if (line.startsWith("GOOGLE_MAPS_API_KEY=")) {
val value = line.substringAfter("=").trim()
if (value.isNotEmpty()) {
return value
}
}
}
}

// Return placeholder if no valid key found
return "GOOGLE_MAPS_API_KEY"
}

android {
namespace = "com.mapconductor.googlemaps"
compileSdk = project.property("compileSdk").toString().toInt()
Expand All @@ -93,9 +24,6 @@ android {

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")

// Set the Google Maps API key from secrets.properties
manifestPlaceholders["GOOGLE_MAPS_API_KEY"] = getGoogleMapsApiKey()
}

buildFeatures {
Expand Down Expand Up @@ -124,10 +52,6 @@ android {
}
}

// Run ensureSecretsFiles before processing manifests
tasks.matching { it.name.contains("process") && it.name.contains("Manifest") }.configureEach {
dependsOn("ensureSecretsFiles")
}
compileOptions {
sourceCompatibility = JavaVersion.toVersion(project.property("javaVersion").toString())
targetCompatibility = JavaVersion.toVersion(project.property("javaVersion").toString())
Expand All @@ -139,10 +63,10 @@ android {

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.ui)
implementation(libs.androidx.foundation)
implementation(libs.androidx.ui.tooling.preview)
compileOnly(libs.androidx.core.ktx)
compileOnly(libs.androidx.ui)
compileOnly(libs.androidx.foundation)
compileOnly(libs.androidx.ui.tooling.preview)
implementation(platform(libs.androidx.compose.bom)) // ← bomでバージョン合わせる
// Lifecycle(MapView用)
implementation(libs.androidx.lifecycle.runtime.ktx)
Expand Down
2 changes: 1 addition & 1 deletion mapconductor-for-googlemaps/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libraryVersion=1.0.0
libraryVersion=1.0.1
9 changes: 1 addition & 8 deletions mapconductor-for-googlemaps/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${GOOGLE_MAPS_API_KEY}" />
</application>
</manifest>
<manifest></manifest>
Loading