Skip to content

Commit d6b74b5

Browse files
author
deepsandhya
committed
fully KMP
0 parents  commit d6b74b5

File tree

121 files changed

+6384
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+6384
-0
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.iml
2+
.kotlin
3+
.gradle
4+
**/build/
5+
xcuserdata
6+
!src/**/build/
7+
local.properties
8+
.idea
9+
.DS_Store
10+
captures
11+
.externalNativeBuild
12+
.cxx
13+
*.xcodeproj/*
14+
!*.xcodeproj/project.pbxproj
15+
!*.xcodeproj/xcshareddata/
16+
!*.xcodeproj/project.xcworkspace/
17+
!*.xcworkspace/contents.xcworkspacedata
18+
**/xcshareddata/WorkspaceSettings.xcsettings
19+
/kotlin-js-store/

Makefile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# === CONFIG ===
2+
GRADLEW=./gradlew
3+
4+
# clear terminal
5+
clear:
6+
clear
7+
8+
# clear build
9+
cleanBuild: clear
10+
$(GRADLEW) clean
11+
12+
# clear Build manually
13+
manualClean: cleanBuild
14+
@echo "Clean build manually"
15+
rm -rf .idea
16+
rm -rf .gradle
17+
rm -rf build
18+
rm -rf */build
19+
rm -rf iosApp/iosApp.xcworkspace
20+
rm -rf iosApp/Pods
21+
rm -rf iosApp/iosApp.xcodeproj/project.xcworkspace
22+
rm -rf iosApp/iosApp.xcodeproj/xcuserdata
23+
rm -rf kotlin-js-store
24+
@echo "✅ Done!"
25+
26+
# Run unit test
27+
taskList: cleanBuild
28+
@echo "Task List"
29+
$(GRADLEW) task
30+
@echo "✅ Done!"
31+
32+
# Generate compose stability report
33+
reportCompose: manualClean
34+
@echo "Compose Compiler Report"
35+
$(GRADLEW) assembleDebug -PcomposeCompilerReports=true --rerun-tasks
36+
@echo "✅ Done!"
37+
38+
# Run Android build
39+
buildAndroid: cleanBuild
40+
@echo "Android build"
41+
$(GRADLEW) androidApp:app:installDebug
42+
@echo "✅ Done!"
43+
44+
# Run Desktop build
45+
buildDesktop: cleanBuild
46+
@echo "Desktop build"
47+
$(GRADLEW) :desktopapp:run
48+
@echo "✅ Done!"
49+
50+
# Run web build
51+
buildWeb: cleanBuild
52+
@echo "Web build"
53+
$(GRADLEW) webApp:js:wasmJsBrowserDevelopmentRun
54+
@echo "✅ Done!"
55+
56+
# Run All test
57+
allTest: cleanBuild

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## 📐 Architecture Diagram
2+
3+
```
4+
┌─────────────┐
5+
│ Composable │
6+
│ (UI Layer) │◄───── Collects ─────┐
7+
└────┬────────┘ │
8+
│ │
9+
▼ │
10+
┌───────────────┐ Emits │
11+
│ ViewModel │─────────────────► SideEffect (e.g., NavigateToDetail)
12+
│ (MVI entry) │ │
13+
└────┬──────────┘ │
14+
│ dispatches ▼
15+
▼ ┌─────────────┐
16+
┌───────────────┐ │NavController│
17+
│ Delegate │ └─────────────┘
18+
│ (MVI Engine) │
19+
└────┬──────┬───┘
20+
│ │
21+
│ │
22+
▼ ▼
23+
┌────────┐ ┌────────────────────────────┐
24+
│Reducer │ │ Middleware │
25+
│(Sync) │ │(Async: API, Storage, etc.) │
26+
└────────┘ └────────────────────────────┘
27+
```
28+
29+
30+
This is a Kotlin Multiplatform project targeting Android, iOS, Web, Desktop.
31+
32+
33+
* `/composeApp` is for code that will be shared across your Compose Multiplatform applications.
34+
It contains several subfolders:
35+
- `commonMain` is for code that’s common for all targets.
36+
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
37+
For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
38+
`iosMain` would be the right folder for such calls.
39+
40+
* `/iosApp` contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform,
41+
you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.
42+
43+
44+
Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html),
45+
[Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform/#compose-multiplatform),
46+
[Kotlin/Wasm](https://kotl.in/wasm/)
47+
48+
We would appreciate your feedback on Compose/Web and Kotlin/Wasm in the public Slack channel [#compose-web](https://slack-chats.kotlinlang.org/c/compose-web).
49+
If you face any issues, please report them on [YouTrack](https://youtrack.jetbrains.com/newIssue?project=CMP).
50+
51+
You can open the web application by running the `:composeApp:wasmJsBrowserDevelopmentRun` Gradle task.

androidApp/app/build.gradle.kts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
3+
plugins {
4+
alias(libs.plugins.android.application)
5+
alias(libs.plugins.kotlin.android)
6+
alias(libs.plugins.compose.compiler)
7+
alias(libs.plugins.compose.multiplatform)
8+
}
9+
10+
android {
11+
namespace = "dev.reprator.github"
12+
compileSdk = libs.versions.android.compileSdk.get().toInt()
13+
14+
defaultConfig {
15+
applicationId = "dev.reprator.github"
16+
minSdk = libs.versions.android.minSdk.get().toInt()
17+
targetSdk = libs.versions.android.targetSdk.get().toInt()
18+
versionCode = 1
19+
versionName = "1.0"
20+
}
21+
packaging {
22+
resources {
23+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
24+
}
25+
}
26+
buildTypes {
27+
getByName("release") {
28+
isMinifyEnabled = false
29+
}
30+
}
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_21
33+
targetCompatibility = JavaVersion.VERSION_21
34+
}
35+
36+
kotlin {
37+
compilerOptions {
38+
jvmTarget = JvmTarget.JVM_21
39+
}
40+
}
41+
}
42+
43+
composeCompiler {
44+
reportsDestination = layout.buildDirectory.dir("andorid_compose_compiler")
45+
metricsDestination = layout.buildDirectory.dir("android_compose_metric")
46+
stabilityConfigurationFile.set(rootProject.file("compose-stability.conf"))
47+
}
48+
49+
dependencies {
50+
implementation(projects.sharedCode)
51+
implementation(libs.androidx.activity.compose)
52+
}

androidApp/app/proguard-rules.pro

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This is a configuration file for R8
2+
3+
-verbose
4+
-allowaccessmodification
5+
-repackageclasses
6+
7+
# Note that you cannot just include these flags in your own
8+
# configuration file; if you are including this file, optimization
9+
# will be turned off. You'll need to either edit this file, or
10+
# duplicate the contents of this file and remove the include of this
11+
# file from your project's proguard.config path property.
12+
13+
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
14+
-keepclasseswithmembernames class * {
15+
native <methods>;
16+
}
17+
18+
# We only need to keep ComposeView
19+
-keep public class androidx.compose.ui.platform.ComposeView {
20+
public <init>(android.content.Context, android.util.AttributeSet);
21+
}
22+
23+
# For enumeration classes
24+
-keepclassmembers enum * {
25+
public static **[] values();
26+
public static ** valueOf(java.lang.String);
27+
}
28+
29+
-keep class * implements android.os.Parcelable {
30+
public static final android.os.Parcelable$Creator *;
31+
}
32+
33+
# AndroidX + support library contains references to newer platform versions.
34+
# Don't warn about those in case this app is linking against an older
35+
# platform version. We know about them, and they are safe.
36+
-dontwarn android.support.**
37+
-dontwarn androidx.**
38+
39+
-keepattributes SourceFile,
40+
LineNumberTable,
41+
RuntimeVisibleAnnotations,
42+
RuntimeVisibleParameterAnnotations,
43+
RuntimeVisibleTypeAnnotations,
44+
AnnotationDefault
45+
46+
-renamesourcefileattribute SourceFile
47+
48+
# Dagger
49+
-dontwarn com.google.errorprone.annotations.*
50+
51+
# Retain the generic signature of retrofit2.Call until added to Retrofit.
52+
# Issue: https://github.com/square/retrofit/issues/3580.
53+
# Pull request: https://github.com/square/retrofit/pull/3579.
54+
-keep,allowobfuscation,allowshrinking class retrofit2.Call
55+
56+
# See https://issuetracker.google.com/issues/265188224
57+
-keep,allowshrinking class * extends androidx.compose.ui.node.ModifierNodeElement {}
58+
59+
# Using ktor client in Android has missing proguard rule
60+
# See https://youtrack.jetbrains.com/issue/KTOR-5528
61+
-dontwarn org.slf4j.**
62+
-dontwarn org.slf4j.impl.StaticLoggerBinder
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<uses-permission android:name="android.permission.INTERNET" />
5+
6+
<application
7+
android:name=".GithubApp"
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:networkSecurityConfig="@xml/network_security_config"
14+
android:theme="@android:style/Theme.Material.Light.NoActionBar">
15+
<activity
16+
android:exported="true"
17+
android:name=".MainActivity">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
</application>
25+
26+
</manifest>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package dev.reprator.github
2+
3+
import android.app.Application
4+
import dev.reprator.github.di.inject.component.AndroidApplicationComponent
5+
import dev.reprator.github.di.inject.component.create
6+
7+
class GithubApp : Application() {
8+
9+
val component: AndroidApplicationComponent by lazy {
10+
AndroidApplicationComponent.create(this)
11+
}
12+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package dev.reprator.github
2+
3+
import android.content.Context
4+
import android.os.Bundle
5+
import androidx.activity.ComponentActivity
6+
import androidx.activity.compose.setContent
7+
import androidx.activity.enableEdgeToEdge
8+
import dev.reprator.github.di.inject.component.AndroidActivityComponent
9+
import dev.reprator.github.di.inject.component.AndroidApplicationComponent
10+
import dev.reprator.github.di.inject.component.create
11+
import dev.reprator.github.root.App
12+
13+
class MainActivity : ComponentActivity() {
14+
override fun onCreate(savedInstanceState: Bundle?) {
15+
enableEdgeToEdge()
16+
super.onCreate(savedInstanceState)
17+
18+
val applicationComponent = AndroidApplicationComponent.from(this)
19+
val component = AndroidActivityComponent.create(this, applicationComponent)
20+
21+
setContent {
22+
App(component.routeFactories)
23+
}
24+
}
25+
}
26+
27+
private fun AndroidApplicationComponent.Companion.from(context: Context): AndroidApplicationComponent {
28+
return (context.applicationContext as GithubApp).component
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="108"
6+
android:viewportHeight="108">
7+
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
8+
<aapt:attr name="android:fillColor">
9+
<gradient
10+
android:endX="85.84757"
11+
android:endY="92.4963"
12+
android:startX="42.9492"
13+
android:startY="49.59793"
14+
android:type="linear">
15+
<item
16+
android:color="#44000000"
17+
android:offset="0.0" />
18+
<item
19+
android:color="#00000000"
20+
android:offset="1.0" />
21+
</gradient>
22+
</aapt:attr>
23+
</path>
24+
<path
25+
android:fillColor="#FFFFFF"
26+
android:fillType="nonZero"
27+
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
28+
android:strokeWidth="1"
29+
android:strokeColor="#00000000" />
30+
</vector>

0 commit comments

Comments
 (0)