Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newversion #35

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions .fleet/receipt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Project generated by Kotlin Multiplatform Wizard
{
"spec": {
"template_id": "kmt",
"targets": {
"android": {
"ui": [
"compose"
]
},
"ios": {
"ui": [
"compose"
]
}
}
},
"timestamp": "2024-04-15T08:24:49.936562548Z"
}
19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
*.iml
.gradle
/local.properties
/.idea
**/build/
xcuserdata
!src/**/build/
local.properties
.idea
.DS_Store
build/
/captures
captures
.externalNativeBuild
.cxx
iosApp/iosApp.xcworkspace/*
iosApp/iosApp.xcodeproj/*
!iosApp/iosApp.xcodeproj/project.pbxproj
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
# DecomposeNavigation
Compose Multiplatform Bottom Navigation with Decompose<br>
libraries
#Decompose<br>
What is Decompose?¶<br>
Decompose is a Kotlin Multiplatform library for breaking down your code into lifecycle-aware business logic components (aka BLoC), with routing functionality and pluggable UI (Jetpack Compose, Android Views, SwiftUI, JS React, etc.).<br>
https://arkivanov.github.io/Decompose/getting-started/quick-start/<br>
https://github.com/arkivanov/Decompose<br>
Also includes Depedency injection with Koin and examples of how to access Device Specific APIs
This is a Kotlin Multiplatform project targeting Android, iOS.

<table>
<tr>
<td><img src="https://github.com/Lilytreasure/DecomposeNavigation/assets/78819932/bd46da3d-6953-4b5e-be84-653f6975d536.png" alt="Home" style="width:250px;height:500px;"></td>
<td><img src="https://github.com/Lilytreasure/DecomposeNavigation/assets/78819932/c1a4567e-c22b-4553-b0ec-aea90278731e.png" alt="Buy" style="width:250px;height:500px;"></td>
</tr>
<tr>
<td><img src="https://github.com/Lilytreasure/DecomposeNavigation/assets/78819932/a109ae4c-158a-4946-9be7-7742d8c315dc.png" alt="About" style="width:250px;height:500px;"></td>
<td><img src="https://github.com/Lilytreasure/DecomposeNavigation/assets/78819932/614aada6-a79b-46bb-907b-0dfe4137a9d0.png" alt="About" style="width:250px;height:500px;"></td>
</tr>
<tr>
<td><img src="https://github.com/Lilytreasure/DecomposeNavigation/assets/78819932/41ee27df-1d3a-4bde-a229-3c2690d69569.png" alt="Call" style="width:250px;height:500px;"></td>
</tr>
</table><br>
* `/composeApp` is for code that will be shared across your Compose Multiplatform applications.
It contains several subfolders:
- `commonMain` is for code that’s common for all targets.
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
`iosMain` would be the right folder for such calls.

* `/iosApp` contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform,
you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.


Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)…
25 changes: 5 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
buildscript {
dependencies {
classpath(deps.jetbrains.kotlinx.binaryCompatibilityValidator)
classpath(deps.parcelizeDarwin.gradlePlug)
classpath(deps.kotlin.kotlinGradlePlug)
classpath("com.android.tools.build:gradle:8.1.1")
//classpath(deps.plugins.spotless)
// classpath(deps.plugins.ktlint)
//classpath(deps.plugins.detekt)
}
}

plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("multiplatform").apply(false)
id("com.android.application").apply(false)
id("com.android.library").apply(false)
id("org.jetbrains.compose").apply(false)

}


alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
}
180 changes: 180 additions & 0 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
id("com.arkivanov.parcelize.darwin") version "0.2.3"
id("kotlin-parcelize")
id("app.cash.sqldelight") version "2.0.0"
kotlin("plugin.serialization") version "1.9.21"
}

kotlin {
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "17"
}
}
}

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
export(libs.decompose)

export(libs.essenty.lifecycle)

// Optional, only if you need state preservation on Darwin (Apple) targets
export(libs.essenty.stateKeeper)

// Optional, only if you need state preservation on Darwin (Apple) targets
export(libs.parcelizeDarwin.runtime)

}
}

sourceSets {

androidMain.dependencies {
implementation(libs.compose.ui.tooling.preview)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat.appcompat)

// Ktor
implementation(libs.ktor.clientAndroid)

// SqlDelight
implementation(libs.sqlDelight.androidDriver)

// Koin
implementation(libs.koin.android)

implementation("com.google.android.gms:play-services-auth:21.0.0")

implementation("com.google.android.gms:play-services-auth-api-phone:18.0.2")

implementation("androidx.biometric:biometric:1.2.0-alpha05")
//Firebase
implementation ("com.google.firebase:firebase-bom:32.1.1")
implementation (libs.analytics.firebase)
implementation (libs.crashlytics.firebase)
implementation("com.googlecode.libphonenumber:libphonenumber:8.2.0")
// This dependency is downloaded from the Google’s Maven repository.
// So, make sure you also include that repository in your project's build.gradle file.
implementation("com.google.android.play:app-update:2.1.0")

// For Kotlin users also import the Kotlin extensions library for Play In-App Update:
implementation("com.google.android.play:app-update-ktx:2.1.0")

api ("com.github.atwa:filepicker:1.0.7")

}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(compose.material3)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.materialIconsExtended)

implementation(libs.decompose)
implementation(libs.decompose.jetbrains)
api(libs.essenty.lifecycle)
api(libs.essenty.stateKeeper)

api(libs.ktor.clientCore)
api(libs.ktor.serializationKotlinxJson)
api(libs.ktor.clientContentNegotiation)
api(libs.ktor.clientLogging)

// Logback for ktor logging
implementation(libs.logbackClassic)

//sqldelight
api(libs.sqlDelight.coroutinesExtensions)
api(libs.sqlDelight.primitiveAdapters)

//Koin
api(libs.koin.core)
api(libs.koin.test)

// // KotlinX Serialization Json
implementation(libs.jetbrains.kotlinx.kotlinxSerializationJson)
//
// // Coroutines
implementation(libs.jetbrains.kotlinx.kotlinxCoroutinesCore)
//
// // MVIKotlin
api(libs.mvikotlin)
api(libs.mviKotlin.mvikotlinMain)
api(libs.mviKotlin.mvikotlinExtensionsCoroutines)
// // settings
implementation(libs.russhwolf.settings.core)
implementation(libs.russhwolf.settings.serialization)
//insets
implementation("com.moriatsushi.insetsx:insetsx:0.1.0-alpha10")

}

iosMain.dependencies {
//ios dependencies
// Ktor
implementation(libs.ktor.clientDarwin)

// SqlDelight
implementation(libs.sqlDelight.nativeDriver)

api(libs.decompose)

api(libs.essenty.lifecycle)
//Modified
api(libs.parcelizeDarwin.runtime)



}
}
}

android {
namespace = "org.example.project"
compileSdk = libs.versions.android.compileSdk.get().toInt()

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")

defaultConfig {
applicationId = "org.example.project"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dependencies {
debugImplementation(libs.compose.ui.tooling)
}
}

29 changes: 29 additions & 0 deletions composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode"
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
13 changes: 13 additions & 0 deletions composeApp/src/androidMain/kotlin/Platform.android.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import android.os.Build
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import rootBottomStack.RootBottomComponent

class AndroidPlatform : Platform {
override val name: String = "Android ${Build.VERSION.SDK_INT}"
}

@Composable
fun MainView(component: RootBottomComponent, modifier: Modifier = Modifier) = App(component, modifier)

actual fun getPlatform(): Platform = AndroidPlatform()
Loading
Loading