Skip to content

Commit 3b8ea50

Browse files
deepsandhyaDeep Sandhya
authored andcommitted
Tv and JS variant added (#2)
* tv added * js support added
1 parent d6b74b5 commit 3b8ea50

File tree

62 files changed

+1129
-58
lines changed

Some content is hidden

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

62 files changed

+1129
-58
lines changed

Makefile

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ taskList: cleanBuild
3232
# Generate compose stability report
3333
reportCompose: manualClean
3434
@echo "Compose Compiler Report"
35-
$(GRADLEW) assembleDebug -PcomposeCompilerReports=true --rerun-tasks
35+
$(GRADLEW) assembleDebug -PenableComposeCompilerMetrics=true -PenableComposeCompilerReports=true
3636
@echo "✅ Done!"
3737

3838
# Run Android build
@@ -41,16 +41,66 @@ buildAndroid: cleanBuild
4141
$(GRADLEW) androidApp:app:installDebug
4242
@echo "✅ Done!"
4343

44+
# Run IOS build
45+
buildIOS: cleanBuild
46+
@echo "IOS build"
47+
chmod +x ./scripts/ios_script.sh
48+
./scripts/ios_script.sh
49+
@echo "✅ Done!"
50+
51+
# Run Android Ui test
52+
testUiAndroid: cleanBuild
53+
@echo "Android UI test"
54+
$(GRADLEW) androidApp:app:connectedDebugAndroidTest
55+
@echo "✅ Done!"
56+
4457
# Run Desktop build
4558
buildDesktop: cleanBuild
4659
@echo "Desktop build"
4760
$(GRADLEW) :desktopapp:run
4861
@echo "✅ Done!"
4962

50-
# Run web build
51-
buildWeb: cleanBuild
52-
@echo "Web build"
53-
$(GRADLEW) webApp:js:wasmJsBrowserDevelopmentRun
63+
# Run Desktop Ui test
64+
testUiDesktop: cleanBuild
65+
@echo "Desktop UI test"
66+
$(GRADLEW) :desktopapp:jvmTest
67+
@echo "✅ Done!"
68+
69+
# Run Desktop hot reload build
70+
buildHotDesktop: clear
71+
@echo "Desktop Hot reload build"
72+
$(GRADLEW) :desktopapp:hotRunJvm --auto
73+
@echo "✅ Done!"
74+
75+
# Run wasm build
76+
buildWasmWeb: cleanBuild
77+
@echo "Web Wasm build"
78+
$(GRADLEW) webApp:wasm:wasmJsBrowserDevelopmentRun
79+
@echo "✅ Done!"
80+
81+
# Run wasm UI test
82+
testUiWasmWeb: cleanBuild
83+
@echo "Web wasm UI test"
84+
$(GRADLEW) webApp:wasm:wasmJsBrowserTest
85+
@echo "✅ Done!"
86+
87+
# Run js build
88+
buildJsWeb: cleanBuild
89+
@echo "Web JS build"
90+
$(GRADLEW) webApp:js:jsBrowserDevelopmentRun
91+
@echo "✅ Done!"
92+
93+
# Run JS UI test
94+
testUiJsWeb: cleanBuild
95+
@echo "Web Js UI test"
96+
$(GRADLEW) webApp:wasm:jsBrowserTest
97+
@echo "✅ Done!"
98+
99+
100+
# Run wasm UI test
101+
testUiJsWeb: cleanBuild
102+
@echo "Web Js UI test"
103+
$(GRADLEW) iosApp:iosSimulatorArm64Test
54104
@echo "✅ Done!"
55105

56106
# Run All test

README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,4 @@
3030
This is a Kotlin Multiplatform project targeting Android, iOS, Web, Desktop.
3131

3232

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.
33+
Run the command from Makefile to run the respective Platform

androidApp/app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,7 @@ composeCompiler {
4949
dependencies {
5050
implementation(projects.sharedCode)
5151
implementation(libs.androidx.activity.compose)
52+
53+
androidTestImplementation(libs.androidx.uitest.junit4)
54+
debugImplementation(libs.androidx.uitest.testManifest)
5255
}

androidApp/tv/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_tv_compose_compiler")
45+
metricsDestination = layout.buildDirectory.dir("android_tv_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/tv/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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
<uses-feature
7+
android:name="android.hardware.touchscreen"
8+
android:required="false" />
9+
10+
<uses-feature
11+
android:name="android.software.leanback"
12+
android:required="false" />
13+
14+
<application
15+
android:name=".GithubApp"
16+
android:allowBackup="true"
17+
android:banner="@mipmap/ic_launcher"
18+
android:icon="@mipmap/ic_launcher"
19+
android:label="@string/app_name"
20+
android:supportsRtl="true"
21+
android:networkSecurityConfig="@xml/network_security_config"
22+
android:theme="@android:style/Theme.Material.Light.NoActionBar">
23+
<activity
24+
android:exported="true"
25+
android:name=".MainActivity">
26+
<intent-filter>
27+
<action android:name="android.intent.action.MAIN" />
28+
29+
<category android:name="android.intent.category.LAUNCHER" />
30+
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
31+
</intent-filter>
32+
</activity>
33+
</application>
34+
35+
</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)