-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Koin and compose dependencies added (#2677)
koin modules added and dependencies updated Koin initialized for AndroidMain and IOSMain AndroidMain and IOSMain implemented
- Loading branch information
1 parent
de3eb47
commit 96ae816
Showing
11 changed files
with
141 additions
and
10 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
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
23 changes: 23 additions & 0 deletions
23
shared/src/androidMain/kotlin/org/mifos/mobile/shared/MainActivity.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,23 @@ | ||
package org.mifos.mobile.shared | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.tooling.preview.Preview | ||
|
||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
setContent { | ||
App() | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun AppAndroidPreview() { | ||
App() | ||
} |
15 changes: 15 additions & 0 deletions
15
shared/src/androidMain/kotlin/org/mifos/mobile/shared/MyApplication.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,15 @@ | ||
package org.mifos.mobile.shared | ||
|
||
import android.app.Application | ||
import org.koin.android.ext.koin.androidContext | ||
import org.mifos.mobile.shared.di.initKoin | ||
|
||
class MyApplication: Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
initKoin { | ||
androidContext(this@MyApplication) | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
shared/src/androidMain/kotlin/org/mifos/mobile/shared/di/Modules.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,6 @@ | ||
package org.mifos.mobile.shared.di | ||
|
||
import org.koin.core.module.Module | ||
|
||
actual val platformModule: Module | ||
get() = TODO("Not yet implemented") |
29 changes: 29 additions & 0 deletions
29
shared/src/commonMain/kotlin/org/mifos/mobile/shared/App.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,29 @@ | ||
package org.mifos.mobile.shared | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import org.koin.compose.KoinContext | ||
|
||
@Composable | ||
fun App() { | ||
KoinContext { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize(), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Text( | ||
text = "Mifos Mobile", | ||
style = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold, | ||
color = MaterialTheme.colorScheme.onSurface) | ||
) | ||
} | ||
} | ||
} | ||
|
9 changes: 0 additions & 9 deletions
9
shared/src/commonMain/kotlin/org/mifos/mobile/shared/Greeting.kt
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
shared/src/commonMain/kotlin/org/mifos/mobile/shared/di/Modules.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,10 @@ | ||
package org.mifos.mobile.shared.di | ||
|
||
import org.koin.core.module.Module | ||
import org.koin.dsl.module | ||
|
||
expect val platformModule: Module | ||
|
||
val sharedModule = module { | ||
single { } | ||
} |
11 changes: 11 additions & 0 deletions
11
shared/src/commonMain/kotlin/org/mifos/mobile/shared/di/initKoin.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,11 @@ | ||
package org.mifos.mobile.shared.di | ||
|
||
import org.koin.core.context.startKoin | ||
import org.koin.dsl.KoinAppDeclaration | ||
|
||
fun initKoin(config: KoinAppDeclaration? = null) { | ||
startKoin { | ||
config?.invoke(this) | ||
modules(sharedModule, platformModule) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
shared/src/iosMain/kotlin/org/mifos/mobile/shared/MainViewController.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,12 @@ | ||
package org.mifos.mobile.shared | ||
|
||
import androidx.compose.ui.window.ComposeUIViewController | ||
import org.mifos.mobile.shared.di.initKoin | ||
|
||
fun MainViewController() = ComposeUIViewController( | ||
configure = { | ||
initKoin() | ||
} | ||
) { | ||
App() | ||
} |
6 changes: 6 additions & 0 deletions
6
shared/src/iosMain/kotlin/org/mifos/mobile/shared/di/Modules.native.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,6 @@ | ||
package org.mifos.mobile.shared.di | ||
|
||
import org.koin.core.module.Module | ||
|
||
actual val platformModule: Module | ||
get() = TODO("Not yet implemented") |