-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from 2rabs/rt/add-app-shared-module
✨ :app:shared モジュールを追加
- Loading branch information
Showing
7 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Shared |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
plugins { | ||
id("nito.primitive.kmp") | ||
id("nito.primitive.kmp.android") | ||
id("nito.primitive.kmp.ios") | ||
id("nito.primitive.kmp.compose") | ||
id("nito.primitive.detekt") | ||
} | ||
|
||
android.namespace = "club.nito.app.shared" | ||
|
||
kotlin { | ||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
implementation(projects.core.common) | ||
implementation(projects.core.model) | ||
implementation(projects.core.domain) | ||
implementation(projects.core.ui) | ||
implementation(projects.core.designsystem) | ||
|
||
implementation(libs.kotlinxCoroutinesCore) | ||
|
||
implementation(libs.koin) | ||
implementation(libs.koinCompose) | ||
} | ||
} | ||
iosMain { | ||
dependencies { | ||
implementation(libs.koin) | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
app/shared/src/androidMain/kotlin/club/nito/app/shared/Platform.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package club.nito.core.common | ||
|
||
class AndroidPlatform : Platform { | ||
override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" | ||
} | ||
|
||
actual fun getPlatform(): Platform = AndroidPlatform() |
9 changes: 9 additions & 0 deletions
9
app/shared/src/commonMain/kotlin/club/nito/app/shared/Greeting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package club.nito.core.common | ||
|
||
class Greeting { | ||
private val platform: Platform = getPlatform() | ||
|
||
fun greet(): String { | ||
return "Hello, ${platform.name}!" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
app/shared/src/commonMain/kotlin/club/nito/app/shared/Platform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package club.nito.core.common | ||
|
||
interface Platform { | ||
val name: String | ||
} | ||
|
||
expect fun getPlatform(): Platform |
9 changes: 9 additions & 0 deletions
9
app/shared/src/iosMain/kotlin/club/nito/app/shared/Platform.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package club.nito.core.common | ||
|
||
import platform.UIKit.UIDevice | ||
|
||
class IOSPlatform: Platform { | ||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion | ||
} | ||
|
||
actual fun getPlatform(): Platform = IOSPlatform() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters