Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| b187b63195 |
8 changed files with 73 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import java.net.URI
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
|
|
@ -8,6 +9,7 @@ plugins {
|
|||
alias(libs.plugins.composeMultiplatform)
|
||||
alias(libs.plugins.composeCompiler)
|
||||
alias(libs.plugins.secretsGradle)
|
||||
alias(libs.plugins.spm)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
|
@ -27,10 +29,17 @@ kotlin {
|
|||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
).forEach { iosTarget ->
|
||||
iosTarget.compilations {
|
||||
getByName("main") {
|
||||
cinterops.create("spmMaplibre")
|
||||
}
|
||||
}
|
||||
iosTarget.binaries.framework {
|
||||
baseName = "ComposeApp"
|
||||
isStatic = true
|
||||
}
|
||||
// iosTarget.swiftPackageConfig(cinteropName = "banksia") {
|
||||
// }
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
|
@ -109,3 +118,15 @@ compose.resources {
|
|||
publicResClass = true
|
||||
packageOfResClass = "moe.lava.banksia.resources"
|
||||
}
|
||||
|
||||
swiftPackageConfig {
|
||||
create("spmMaplibre") {
|
||||
dependency {
|
||||
remotePackageVersion(
|
||||
url = URI("https://github.com/maplibre/maplibre-gl-native-distribution.git"),
|
||||
products = { add("MapLibre") },
|
||||
version = "6.17.1",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
15
composeApp/src/swift/spmMaplibre/StartYourBridgeHere.swift
Normal file
15
composeApp/src/swift/spmMaplibre/StartYourBridgeHere.swift
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import Foundation
|
||||
/**
|
||||
This is a starting class to set up your bridge.
|
||||
Ensure that your class is public and has the @objcMembers / @objc annotation.
|
||||
This file has been created because the folder is empty.
|
||||
Ignore this file if you don't need it or set "spmforkmp.disableStartupFile=true" inside your gradle file
|
||||
**/
|
||||
|
||||
/**
|
||||
@objcMembers public class StartHere: NSObject {
|
||||
public override init() {
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
**/
|
||||
|
|
@ -12,3 +12,5 @@ android.useAndroidX=true
|
|||
|
||||
#Ktor
|
||||
io.ktor.development=true
|
||||
|
||||
kotlin.mpp.enableCInteropCommonization=true
|
||||
|
|
@ -29,9 +29,10 @@ material = "1.7.3"
|
|||
material3 = "1.11.0-alpha02"
|
||||
okio = "3.16.4"
|
||||
playServicesLocation = "21.3.0"
|
||||
sqlite = "2.6.2"
|
||||
room = "2.8.4"
|
||||
secretsGradlePlugin = "2.0.1"
|
||||
spm = "1.4.9"
|
||||
sqlite = "2.6.2"
|
||||
wire = "5.5.0"
|
||||
|
||||
[libraries]
|
||||
|
|
@ -95,4 +96,5 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
|||
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
|
||||
room = { id = "androidx.room", version.ref = "room" }
|
||||
secretsGradle = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin" }
|
||||
spm = { id = "io.github.frankois944.spmForKmp", version.ref = "spm" }
|
||||
wire = { id = "com.squareup.wire", version.ref = "wire" }
|
||||
|
|
|
|||
|
|
@ -46,5 +46,7 @@
|
|||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>This permission is required to display your current location</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package moe.lava.banksia.room
|
||||
|
||||
import androidx.room.AutoMigration
|
||||
import androidx.room.ConstructedBy
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.RoomDatabaseConstructor
|
||||
import androidx.room.TypeConverters
|
||||
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
|
@ -37,6 +39,7 @@ import androidx.room.Database as DatabaseAnnotation
|
|||
]
|
||||
)
|
||||
@TypeConverters(RouteTypeConverter::class)
|
||||
@ConstructedBy(DatabaseConstructor::class)
|
||||
abstract class Database : RoomDatabase() {
|
||||
abstract val versionMetadataDao: VersionMetadataDao
|
||||
abstract val routeDao: RouteDao
|
||||
|
|
@ -54,3 +57,8 @@ abstract class Database : RoomDatabase() {
|
|||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("KotlinNoActualForExpect")
|
||||
expect object DatabaseConstructor : RoomDatabaseConstructor<Database> {
|
||||
override fun initialize(): Database
|
||||
}
|
||||
|
|
@ -1,14 +1,30 @@
|
|||
package moe.lava.banksia.di
|
||||
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import kotlinx.cinterop.ExperimentalForeignApi
|
||||
import moe.lava.banksia.room.Database
|
||||
import org.koin.core.parameter.ParametersHolder
|
||||
import org.koin.core.scope.Scope
|
||||
import org.koin.dsl.module
|
||||
import platform.Foundation.NSDocumentDirectory
|
||||
import platform.Foundation.NSFileManager
|
||||
import platform.Foundation.NSUserDomainMask
|
||||
|
||||
class IosDatabaseBuilder() : PlatformDatabaseBuilder {
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
override fun getBuilder(): RoomDatabase.Builder<Database> {
|
||||
TODO("Not yet implemented")
|
||||
val path = NSFileManager.defaultManager.URLForDirectory(
|
||||
directory = NSDocumentDirectory,
|
||||
inDomain = NSUserDomainMask,
|
||||
appropriateForURL = null,
|
||||
create = false,
|
||||
error = null,
|
||||
)
|
||||
val dbPath = path!!.path + "/room.db"
|
||||
return Room.databaseBuilder<Database>(
|
||||
name = dbPath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package moe.lava.banksia.util
|
||||
|
||||
import platform.Foundation.NSLog
|
||||
|
||||
// TODO: use better logging functions maybe(?)
|
||||
actual fun log(tag: String, msg: String) {
|
||||
TODO("Not yet implemented")
|
||||
NSLog("$tag: $msg")
|
||||
}
|
||||
|
||||
actual fun error(tag: String, msg: String, throwable: Throwable?) {
|
||||
TODO("Not yet implemented")
|
||||
NSLog("$tag: $msg: ${throwable?.stackTraceToString()}")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue