Skip to content
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
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ AGENTS.md
react-native/src/generated/*
iosApp/iosApp/assets/images/*
composeApp/src/androidMain/assets/*
composeApp/src/androidMain/res/drawable-mdpi/*
composeApp/src/androidMain/res/drawable-mdpi/*

reactNativeApp/.vscode
reactNativeApp/ios
reactNativeApp/.expo
reactNativeApp/android
reactNativeApp/node_modules
reactNativeApp/artifacts
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ apk-dev:
./gradlew assembleDebug -Pbuildkonfig.flavor=dev

apk-release:
make rn && ./gradlew :composeApp:bundleAndroidReleaseJs && ./gradlew assembleRelease -Pbuildkonfig.flavor=release
cd $(CURRENT) && npx expo export -p android && cd .. && ./gradlew assembleRelease -Pbuildkonfig.flavor=release

appbundle-dev:
./gradlew :composeApp:bundleDebug -Pbuildkonfig.flavor=dev

appbundle-release:
make rn && ./gradlew :composeApp:bundleAndroidReleaseJs && ./gradlew :composeApp:bundleRelease -Pbuildkonfig.flavor=release
cd $(CURRENT) && npx expo export -p android && cd .. && ./gradlew :composeApp:bundleRelease -Pbuildkonfig.flavor=release

gen-privacy:
cd composeApp && python3 ../script/required_reason_finder.py
Expand All @@ -24,11 +24,10 @@ bridge:
adb-proxy:
~/Library/Android/sdk/platform-tools/adb reverse tcp:8081 tcp:8081

rn:
./gradlew :composeApp:generateCodegenArtifactsFromSchema
./gradlew kspCommonMainKotlinMetadata
mkdir -p build/generated/autolinking && cd react-native && npx react-native config > ../build/generated/autolinking/autolinking.json
CURRENT := ./reactNativeApp

rn-bundle:
./gradlew :composeApp:bundleAndroidReleaseJs
./gradlew :composeApp:bundleIOSReleaseJs
rn-debug:
cd $(CURRENT) && npx expo prebuild --platform android --clean
cd $(CURRENT) && npx expo prebuild --platform ios --clean
cd $(CURRENT) && npx expo-brownfield build:ios --debug
cd $(CURRENT) && npx expo-brownfield build:android --all --repository MavenLocal
115 changes: 11 additions & 104 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ plugins {
id("com.codingfeline.buildkonfig") version "0.17.1"
id("org.jetbrains.kotlinx.atomicfu") version "0.31.0"
id("io.github.ttypic.swiftklib") version "0.6.4"
id("com.facebook.react")
id("com.google.devtools.ksp") version "2.3.4"
}

repositories {
Expand Down Expand Up @@ -88,10 +86,10 @@ kotlin {
val main by getting {
cinterops {
create("StoreKitWrapper")
create("ReactNativeBridge")
create("nskeyvalueobserving")
create("firebaseBridge")
create("googleSignInBridge")
create("RNBridge")
}
}
}
Expand All @@ -106,11 +104,6 @@ kotlin {
implementation(libs.androidx.browser)
implementation(libs.sketch.animated.gif.koral)

// React Native
implementation(libs.react.android)
implementation(libs.hermes.android)
implementation(libs.soloader)

// firebase
implementation(libs.firebase.analytics.ktx)
implementation(libs.firebase.crashlytics.ktx)
Expand All @@ -120,7 +113,9 @@ kotlin {
implementation(libs.android.credentials.play.services.auth)
implementation(libs.googleid)

implementation(project (":react-native-get-random-values"))
implementation(libs.reactnativeapp)
implementation(libs.bridge.api)
implementation(libs.expo.core)
}
iosMain.dependencies {
implementation(libs.ktor.client.darwin)
Expand Down Expand Up @@ -178,9 +173,6 @@ kotlin {
implementation(libs.connectivity.compose.device)

implementation(libs.markdown.renderer.m3)

// reakt-native-toolkit
implementation(libs.reakt.native.toolkit)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
Expand Down Expand Up @@ -208,6 +200,9 @@ android {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
jniLibs {
pickFirsts += "lib/*/libworklets.so"
}
}
signingConfigs {
register("release") {
Expand Down Expand Up @@ -237,94 +232,6 @@ android {
}
}

react {
root = rootProject.file("react-native")
reactNativeDir = rootProject.file("react-native/node_modules/react-native")
codegenDir = rootProject.file("react-native/node_modules/@react-native/codegen")
cliFile = rootProject.file("react-native/node_modules/react-native/cli.js")
}

val bundleAndroidReleaseJs = tasks.register<Exec>("bundleAndroidReleaseJs") {
group = "react"
description = "Bundle React Native JavaScript for Android Release"

workingDir = rootProject.file("react-native")

val bundleFile = project.file("src/androidMain/assets/index.android.bundle")
val assetsDir = project.file("src/androidMain/res")

doFirst {
bundleFile.parentFile.mkdirs()
println("📦 Bundling React Native JavaScript for Android...")
}

commandLine(
"npx", "react-native", "bundle",
"--platform", "android",
"--dev", "false",
"--entry-file", "index.js",
"--bundle-output", bundleFile.absolutePath,
"--assets-dest", assetsDir.absolutePath,
"--reset-cache"
)

doLast {
println("✅ Android bundle created: ${bundleFile.absolutePath}")
}
}

val bundleIOSReleaseJs = tasks.register<Exec>("bundleIOSReleaseJs") {
group = "react"
description = "Bundle React Native JavaScript for iOS Release"

workingDir = rootProject.file("react-native")

val bundleFile = rootProject.file("iosApp/iosApp/main.jsbundle")
val assetsDir = rootProject.file("iosApp/iosApp")

doFirst {
bundleFile.parentFile.mkdirs()
println("📦 Bundling React Native JavaScript for iOS...")
}

commandLine(
"npx", "react-native", "bundle",
"--platform", "ios",
"--dev", "false",
"--entry-file", "index.js",
"--bundle-output", bundleFile.absolutePath,
"--assets-dest", assetsDir.absolutePath
)
}

dependencies {
debugImplementation(compose.uiTooling)

add("kspCommonMainMetadata", "de.voize:reakt-native-toolkit-ksp:0.22.1-SNAPSHOT")
add("kspAndroid", "de.voize:reakt-native-toolkit-ksp:0.22.1-SNAPSHOT")
add("kspIosArm64", "de.voize:reakt-native-toolkit-ksp:0.22.1-SNAPSHOT")
add("kspIosSimulatorArm64", "de.voize:reakt-native-toolkit-ksp:0.22.1-SNAPSHOT")
}

ksp {
arg("reakt.native.toolkit.kmpFrameworkName", "ComposeApp")
}

tasks.register<Copy>("copyGeneratedTsFiles") {
from("build/generated/ksp/metadata/commonMain/resources/reaktNativeToolkit/typescript")
into(rootProject.file("react-native/src/generated/reaktNativeToolkit/typescript"))
}

tasks.configureEach {
if (name.startsWith("ksp") && name.contains("Kotlin")) {
finalizedBy("copyGeneratedTsFiles")
}
}

kotlin.sourceSets.commonMain {
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
}

fun minifyHtml(html: String): String {
return html
}
Expand Down Expand Up @@ -417,9 +324,9 @@ swiftklib {
packageName("app.slax.reader.storekit")
minIos = 14
}
create("ReactNativeBridge") {
path = file("src/nativeInterop/reactnative")
packageName("app.slax.reader.reactnative.bridge")
create("RNBridge") {
path = file("src/nativeInterop/rnbridge")
packageName("app.slax.reader.rnbridge")
minIos = 14
}
}
}
2 changes: 1 addition & 1 deletion composeApp/composeApp.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'ComposeApp'
spec.version = '1.0.6'
spec.version = '1.0.7'
spec.homepage = 'https://github.com/slax-lab/slax-reader-client'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down
12 changes: 12 additions & 0 deletions composeApp/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@
-dontwarn com.facebook.jni.**

-dontwarn kotlinx.serialization.**

-keep class expo.modules.** { *; }
-dontwarn expo.modules.**

-keep class * implements com.facebook.react.turbomodule.core.interfaces.TurboModule { *; }
-keep class * implements com.facebook.react.ReactPackage { *; }

-keep class com.slax.reactnativeapp.** { *; }

-keep class com.facebook.react.defaults.** { *; }
-keep class com.facebook.react.config.** { *; }
-keep class com.facebook.react.internal.** { *; }
11 changes: 5 additions & 6 deletions composeApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
<activity
android:name=".RNActivity"
android:exported="false"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity android:name=".reactnative.ReactNativeActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustResize"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"/>
</application>
</manifest>
19 changes: 14 additions & 5 deletions composeApp/src/androidMain/kotlin/com/slax/reader/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.ComposeFoundationFlags
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.navigation.compose.rememberNavController
import com.slax.reader.di.configureKoin
import com.slax.reader.domain.auth.GoogleSignInProvider
import com.slax.reader.reactnative.setCurrentActivity
import com.slax.reader.ui.SlaxNavigation
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.GlobalContext
import org.koin.core.context.startKoin
import org.koin.core.logger.Level

class MainActivity : ComponentActivity() {
@OptIn(ExperimentalFoundationApi::class)
Expand All @@ -22,8 +27,6 @@ class MainActivity : ComponentActivity() {

GoogleSignInProvider.setActivity(this)

setCurrentActivity(this)

enableEdgeToEdge(
statusBarStyle = SystemBarStyle.light(
scrim = Color.TRANSPARENT,
Expand All @@ -35,6 +38,14 @@ class MainActivity : ComponentActivity() {
)
)

if (GlobalContext.getOrNull() == null) {
startKoin {
androidLogger(Level.INFO)
androidContext(this@MainActivity.applicationContext)
configureKoin()
}
}

setContent {
val ctrl = rememberNavController()
SlaxNavigation(ctrl)
Expand All @@ -43,11 +54,9 @@ class MainActivity : ComponentActivity() {

override fun onResume() {
super.onResume()
setCurrentActivity(this)
}

override fun onDestroy() {
setCurrentActivity(null)
super.onDestroy()
}
}
Loading