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

feat(feature:about): Migrate about module to CMP #2761

Open
wants to merge 1 commit into
base: kmp-impl
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
7 changes: 6 additions & 1 deletion androidApp/dependencies/demoDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ androidx.core:core-splashscreen:1.0.1
androidx.core:core:1.15.0
androidx.cursoradapter:cursoradapter:1.0.0
androidx.customview:customview-poolingcontainer:1.0.0
androidx.customview:customview:1.0.0
androidx.customview:customview:1.1.0
androidx.databinding:viewbinding:7.4.2
androidx.documentfile:documentfile:1.0.0
androidx.drawerlayout:drawerlayout:1.0.0
Expand Down Expand Up @@ -106,6 +106,8 @@ androidx.multidex:multidex:2.0.1
androidx.navigation:navigation-common-ktx:2.8.5
androidx.navigation:navigation-common:2.8.5
androidx.navigation:navigation-compose:2.8.5
androidx.navigation:navigation-fragment-ktx:2.8.5
androidx.navigation:navigation-fragment:2.8.5
androidx.navigation:navigation-runtime-ktx:2.8.5
androidx.navigation:navigation-runtime:2.8.5
androidx.print:print:1.0.0
Expand All @@ -120,6 +122,7 @@ androidx.room:room-runtime-android:2.7.0-alpha12
androidx.room:room-runtime:2.7.0-alpha12
androidx.savedstate:savedstate-ktx:1.2.1
androidx.savedstate:savedstate:1.2.1
androidx.slidingpanelayout:slidingpanelayout:1.2.0
androidx.sqlite:sqlite-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled:2.5.0-alpha12
Expand All @@ -129,6 +132,7 @@ androidx.sqlite:sqlite:2.5.0-alpha12
androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing-ktx:1.2.0
androidx.tracing:tracing:1.2.0
androidx.transition:transition:1.4.1
androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
Expand Down Expand Up @@ -244,6 +248,7 @@ io.github.vinceglb:filekit-core-android:0.8.7
io.github.vinceglb:filekit-core:0.8.7
io.insert-koin:koin-android:4.0.1-RC1
io.insert-koin:koin-androidx-compose:4.0.1-RC1
io.insert-koin:koin-androidx-navigation:4.0.1-RC1
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
io.insert-koin:koin-annotations:1.4.0-RC4
io.insert-koin:koin-bom:4.0.1-RC1
Expand Down
7 changes: 6 additions & 1 deletion androidApp/dependencies/demoReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ androidx.core:core-splashscreen:1.0.1
androidx.core:core:1.15.0
androidx.cursoradapter:cursoradapter:1.0.0
androidx.customview:customview-poolingcontainer:1.0.0
androidx.customview:customview:1.0.0
androidx.customview:customview:1.1.0
androidx.databinding:viewbinding:7.4.2
androidx.documentfile:documentfile:1.0.0
androidx.drawerlayout:drawerlayout:1.0.0
Expand Down Expand Up @@ -101,6 +101,8 @@ androidx.multidex:multidex:2.0.1
androidx.navigation:navigation-common-ktx:2.8.5
androidx.navigation:navigation-common:2.8.5
androidx.navigation:navigation-compose:2.8.5
androidx.navigation:navigation-fragment-ktx:2.8.5
androidx.navigation:navigation-fragment:2.8.5
androidx.navigation:navigation-runtime-ktx:2.8.5
androidx.navigation:navigation-runtime:2.8.5
androidx.print:print:1.0.0
Expand All @@ -115,6 +117,7 @@ androidx.room:room-runtime-android:2.7.0-alpha12
androidx.room:room-runtime:2.7.0-alpha12
androidx.savedstate:savedstate-ktx:1.2.1
androidx.savedstate:savedstate:1.2.1
androidx.slidingpanelayout:slidingpanelayout:1.2.0
androidx.sqlite:sqlite-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled:2.5.0-alpha12
Expand All @@ -124,6 +127,7 @@ androidx.sqlite:sqlite:2.5.0-alpha12
androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing-ktx:1.2.0
androidx.tracing:tracing:1.2.0
androidx.transition:transition:1.4.1
androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
Expand Down Expand Up @@ -239,6 +243,7 @@ io.github.vinceglb:filekit-core-android:0.8.7
io.github.vinceglb:filekit-core:0.8.7
io.insert-koin:koin-android:4.0.1-RC1
io.insert-koin:koin-androidx-compose:4.0.1-RC1
io.insert-koin:koin-androidx-navigation:4.0.1-RC1
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
io.insert-koin:koin-annotations:1.4.0-RC4
io.insert-koin:koin-bom:4.0.1-RC1
Expand Down
7 changes: 6 additions & 1 deletion androidApp/dependencies/prodDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ androidx.core:core-splashscreen:1.0.1
androidx.core:core:1.15.0
androidx.cursoradapter:cursoradapter:1.0.0
androidx.customview:customview-poolingcontainer:1.0.0
androidx.customview:customview:1.0.0
androidx.customview:customview:1.1.0
androidx.databinding:viewbinding:7.4.2
androidx.documentfile:documentfile:1.0.0
androidx.drawerlayout:drawerlayout:1.0.0
Expand Down Expand Up @@ -106,6 +106,8 @@ androidx.multidex:multidex:2.0.1
androidx.navigation:navigation-common-ktx:2.8.5
androidx.navigation:navigation-common:2.8.5
androidx.navigation:navigation-compose:2.8.5
androidx.navigation:navigation-fragment-ktx:2.8.5
androidx.navigation:navigation-fragment:2.8.5
androidx.navigation:navigation-runtime-ktx:2.8.5
androidx.navigation:navigation-runtime:2.8.5
androidx.print:print:1.0.0
Expand All @@ -120,6 +122,7 @@ androidx.room:room-runtime-android:2.7.0-alpha12
androidx.room:room-runtime:2.7.0-alpha12
androidx.savedstate:savedstate-ktx:1.2.1
androidx.savedstate:savedstate:1.2.1
androidx.slidingpanelayout:slidingpanelayout:1.2.0
androidx.sqlite:sqlite-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled:2.5.0-alpha12
Expand All @@ -129,6 +132,7 @@ androidx.sqlite:sqlite:2.5.0-alpha12
androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing-ktx:1.2.0
androidx.tracing:tracing:1.2.0
androidx.transition:transition:1.4.1
androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
Expand Down Expand Up @@ -244,6 +248,7 @@ io.github.vinceglb:filekit-core-android:0.8.7
io.github.vinceglb:filekit-core:0.8.7
io.insert-koin:koin-android:4.0.1-RC1
io.insert-koin:koin-androidx-compose:4.0.1-RC1
io.insert-koin:koin-androidx-navigation:4.0.1-RC1
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
io.insert-koin:koin-annotations:1.4.0-RC4
io.insert-koin:koin-bom:4.0.1-RC1
Expand Down
7 changes: 6 additions & 1 deletion androidApp/dependencies/prodReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ androidx.core:core-splashscreen:1.0.1
androidx.core:core:1.15.0
androidx.cursoradapter:cursoradapter:1.0.0
androidx.customview:customview-poolingcontainer:1.0.0
androidx.customview:customview:1.0.0
androidx.customview:customview:1.1.0
androidx.databinding:viewbinding:7.4.2
androidx.documentfile:documentfile:1.0.0
androidx.drawerlayout:drawerlayout:1.0.0
Expand Down Expand Up @@ -101,6 +101,8 @@ androidx.multidex:multidex:2.0.1
androidx.navigation:navigation-common-ktx:2.8.5
androidx.navigation:navigation-common:2.8.5
androidx.navigation:navigation-compose:2.8.5
androidx.navigation:navigation-fragment-ktx:2.8.5
androidx.navigation:navigation-fragment:2.8.5
androidx.navigation:navigation-runtime-ktx:2.8.5
androidx.navigation:navigation-runtime:2.8.5
androidx.print:print:1.0.0
Expand All @@ -115,6 +117,7 @@ androidx.room:room-runtime-android:2.7.0-alpha12
androidx.room:room-runtime:2.7.0-alpha12
androidx.savedstate:savedstate-ktx:1.2.1
androidx.savedstate:savedstate:1.2.1
androidx.slidingpanelayout:slidingpanelayout:1.2.0
androidx.sqlite:sqlite-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled-android:2.5.0-alpha12
androidx.sqlite:sqlite-bundled:2.5.0-alpha12
Expand All @@ -124,6 +127,7 @@ androidx.sqlite:sqlite:2.5.0-alpha12
androidx.startup:startup-runtime:1.1.1
androidx.tracing:tracing-ktx:1.2.0
androidx.tracing:tracing:1.2.0
androidx.transition:transition:1.4.1
androidx.vectordrawable:vectordrawable-animated:1.1.0
androidx.vectordrawable:vectordrawable:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
Expand Down Expand Up @@ -239,6 +243,7 @@ io.github.vinceglb:filekit-core-android:0.8.7
io.github.vinceglb:filekit-core:0.8.7
io.insert-koin:koin-android:4.0.1-RC1
io.insert-koin:koin-androidx-compose:4.0.1-RC1
io.insert-koin:koin-androidx-navigation:4.0.1-RC1
io.insert-koin:koin-annotations-jvm:1.4.0-RC4
io.insert-koin:koin-annotations:1.4.0-RC4
io.insert-koin:koin-bom:4.0.1-RC1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ class AndroidFeatureConventionPlugin : Plugin<Project> {
add("androidTestImplementation", libs.findLibrary("androidx.lifecycle.runtimeTesting").get())

add("testImplementation", kotlin("test"))
add("testImplementation", project(":core:testing"))
// add("testImplementation", project(":core:testing"))
add("testImplementation", libs.findLibrary("hilt.android.testing").get())
add("testImplementation", libs.findLibrary("squareup.okhttp").get())

add("debugImplementation", libs.findLibrary("androidx.compose.ui.test.manifest").get())

add("androidTestImplementation", project(":core:testing"))
// add("androidTestImplementation", project(":core:testing"))
add("androidTestImplementation", libs.findLibrary("androidx.navigation.testing").get())
add("androidTestImplementation", libs.findLibrary("androidx.compose.ui.test").get())
add("androidTestImplementation", libs.findLibrary("hilt.android.testing").get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CMPFeatureConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("mifos.kmp.libray")
apply("mifos.kmp.library")
apply("mifos.kmp.koin")
apply("org.jetbrains.kotlin.plugin.compose")
apply("org.jetbrains.compose")
Expand All @@ -17,7 +17,7 @@ class CMPFeatureConventionPlugin : Plugin<Project> {
dependencies {
add("commonMainImplementation", project(":core:ui"))
add("commonMainImplementation", project(":core:designsystem"))
add("commonMainImplementation", project(":core:testing"))
// add("commonMainImplementation", project(":core:testing"))
add("commonMainImplementation", project(":core:data"))

add("commonMainImplementation", libs.findLibrary("koin.compose").get())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import com.google.devtools.ksp.gradle.KspExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.mifos.mobile.libs

class KMPKoinConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target){
with(pluginManager){
with(target) {
with(pluginManager) {
apply("com.google.devtools.ksp")
}

Expand All @@ -19,6 +21,9 @@ class KMPKoinConventionPlugin : Plugin<Project> {
add("kspCommonMainMetadata", libs.findLibrary("koin.ksp.compiler").get())
add("commonTestImplementation", libs.findLibrary("koin.test").get())
}
extensions.configure<KspExtension> {
arg("KOIN_CONFIG_CHECK", "true")
}
}
}

Expand Down
14 changes: 10 additions & 4 deletions feature/about/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
plugins {
alias(libs.plugins.mifos.android.feature)
alias(libs.plugins.mifos.android.library.compose)
alias(libs.plugins.mifos.cmp.feature)
}

android {
namespace = "org.mifos.mobile.feature.about"
}

dependencies {

kotlin {
sourceSets{
commonMain.dependencies {
implementation(compose.material3)
implementation(compose.components.resources)
implementation(compose.ui)
api(projects.core.common)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.feature.about

import android.graphics.Bitmap
import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView

@Composable
actual fun MyWebView(
htmlContent: String,
isLoading: (isLoading: Boolean) -> Unit,
onUrlClicked: (url: String) -> Unit,
modifier: Modifier,
) {
AndroidView(
modifier = modifier,
factory = { context ->
WebView(context).apply {
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
overScrollMode = WebView.OVER_SCROLL_NEVER
this.webViewClient = object : WebViewClient() {
@Deprecated("Deprecated in Java")
override fun shouldOverrideUrlLoading(
view: WebView,
request: WebResourceRequest?,
): Boolean {
return if (request?.url.toString().contains("jpg") ||
request?.url.toString().contains("png") ||
request?.url.toString().contains("attachment_id")
) {
true
} else {
onUrlClicked(request?.url.toString())
true
}
}

override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
isLoading(true)
}

override fun onPageFinished(view: WebView?, url: String?) {
isLoading(false)
}
}
loadUrl(htmlContent)
}
},
update = { webView ->
webView.loadUrl(htmlContent)
},
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.feature.about

import android.content.Intent
import android.net.Uri

actual fun openUrl(url: String?) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:fillColor="#FFFFFF"
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM9,6c0,-1.66 1.34,-3 3,-3s3,1.34 3,3v2L9,8L9,6zM18,20L6,20L6,10h12v10zM12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2z" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.feature.about

import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.StringResource
import org.mifos.mobile.core.model.enums.AboutUsListItemId

internal data class AboutUsItem(
val title: StringResource,
val subtitle: StringResource? = null,
val iconUrl: DrawableResource? = null,
val itemId: AboutUsListItemId,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.feature.about

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier

@Composable
expect fun MyWebView(
htmlContent: String,
isLoading: (isLoading: Boolean) -> Unit,
onUrlClicked: (url: String) -> Unit,
modifier: Modifier,
)
Loading