Skip to content

Commit da40e4f

Browse files
HekmatullahAminNagarjuna0033
authored andcommitted
feat(feature:about): Migrate about module to CMP (openMF#2761)
1 parent f683e57 commit da40e4f

File tree

34 files changed

+599
-279
lines changed

34 files changed

+599
-279
lines changed

cmp-android/dependencies/demoDebugRuntimeClasspath.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ androidx.core:core:1.15.0
6060
androidx.cursoradapter:cursoradapter:1.0.0
6161
androidx.customview:customview-poolingcontainer:1.0.0
6262
androidx.customview:customview:1.1.0
63-
androidx.databinding:databinding-adapters:8.7.3
64-
androidx.databinding:databinding-common:8.7.3
65-
androidx.databinding:databinding-ktx:8.7.3
66-
androidx.databinding:databinding-runtime:8.7.3
67-
androidx.databinding:viewbinding:8.7.3
63+
androidx.databinding:databinding-adapters:8.8.0
64+
androidx.databinding:databinding-common:8.8.0
65+
androidx.databinding:databinding-ktx:8.8.0
66+
androidx.databinding:databinding-runtime:8.8.0
67+
androidx.databinding:viewbinding:8.8.0
6868
androidx.documentfile:documentfile:1.0.0
6969
androidx.drawerlayout:drawerlayout:1.0.0
7070
androidx.emoji2:emoji2-views-helper:1.3.0
@@ -304,8 +304,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
304304
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
305305
org.jetbrains.kotlin:kotlin-reflect:2.1.0
306306
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
307-
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20
308-
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20
307+
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21
308+
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21
309309
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
310310
org.jetbrains.kotlinx:atomicfu-jvm:0.23.2
311311
org.jetbrains.kotlinx:atomicfu:0.23.2

cmp-android/dependencies/demoReleaseRuntimeClasspath.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ androidx.core:core:1.15.0
5656
androidx.cursoradapter:cursoradapter:1.0.0
5757
androidx.customview:customview-poolingcontainer:1.0.0
5858
androidx.customview:customview:1.1.0
59-
androidx.databinding:databinding-adapters:8.7.3
60-
androidx.databinding:databinding-common:8.7.3
61-
androidx.databinding:databinding-ktx:8.7.3
62-
androidx.databinding:databinding-runtime:8.7.3
63-
androidx.databinding:viewbinding:8.7.3
59+
androidx.databinding:databinding-adapters:8.8.0
60+
androidx.databinding:databinding-common:8.8.0
61+
androidx.databinding:databinding-ktx:8.8.0
62+
androidx.databinding:databinding-runtime:8.8.0
63+
androidx.databinding:viewbinding:8.8.0
6464
androidx.documentfile:documentfile:1.0.0
6565
androidx.drawerlayout:drawerlayout:1.0.0
6666
androidx.emoji2:emoji2-views-helper:1.3.0
@@ -300,8 +300,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
300300
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
301301
org.jetbrains.kotlin:kotlin-reflect:2.1.0
302302
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
303-
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20
304-
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20
303+
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21
304+
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21
305305
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
306306
org.jetbrains.kotlinx:atomicfu-jvm:0.23.2
307307
org.jetbrains.kotlinx:atomicfu:0.23.2

cmp-android/dependencies/prodDebugRuntimeClasspath.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ androidx.core:core:1.15.0
6060
androidx.cursoradapter:cursoradapter:1.0.0
6161
androidx.customview:customview-poolingcontainer:1.0.0
6262
androidx.customview:customview:1.1.0
63-
androidx.databinding:databinding-adapters:8.7.3
64-
androidx.databinding:databinding-common:8.7.3
65-
androidx.databinding:databinding-ktx:8.7.3
66-
androidx.databinding:databinding-runtime:8.7.3
67-
androidx.databinding:viewbinding:8.7.3
63+
androidx.databinding:databinding-adapters:8.8.0
64+
androidx.databinding:databinding-common:8.8.0
65+
androidx.databinding:databinding-ktx:8.8.0
66+
androidx.databinding:databinding-runtime:8.8.0
67+
androidx.databinding:viewbinding:8.8.0
6868
androidx.documentfile:documentfile:1.0.0
6969
androidx.drawerlayout:drawerlayout:1.0.0
7070
androidx.emoji2:emoji2-views-helper:1.3.0
@@ -304,8 +304,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
304304
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
305305
org.jetbrains.kotlin:kotlin-reflect:2.1.0
306306
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
307-
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20
308-
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20
307+
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21
308+
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21
309309
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
310310
org.jetbrains.kotlinx:atomicfu-jvm:0.23.2
311311
org.jetbrains.kotlinx:atomicfu:0.23.2

cmp-android/dependencies/prodReleaseRuntimeClasspath.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ androidx.core:core:1.15.0
5656
androidx.cursoradapter:cursoradapter:1.0.0
5757
androidx.customview:customview-poolingcontainer:1.0.0
5858
androidx.customview:customview:1.1.0
59-
androidx.databinding:databinding-adapters:8.7.3
60-
androidx.databinding:databinding-common:8.7.3
61-
androidx.databinding:databinding-ktx:8.7.3
62-
androidx.databinding:databinding-runtime:8.7.3
63-
androidx.databinding:viewbinding:8.7.3
59+
androidx.databinding:databinding-adapters:8.8.0
60+
androidx.databinding:databinding-common:8.8.0
61+
androidx.databinding:databinding-ktx:8.8.0
62+
androidx.databinding:databinding-runtime:8.8.0
63+
androidx.databinding:viewbinding:8.8.0
6464
androidx.documentfile:documentfile:1.0.0
6565
androidx.drawerlayout:drawerlayout:1.0.0
6666
androidx.emoji2:emoji2-views-helper:1.3.0
@@ -300,8 +300,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0
300300
org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0
301301
org.jetbrains.kotlin:kotlin-reflect:2.1.0
302302
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0
303-
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20
304-
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20
303+
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21
304+
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21
305305
org.jetbrains.kotlin:kotlin-stdlib:2.1.0
306306
org.jetbrains.kotlinx:atomicfu-jvm:0.23.2
307307
org.jetbrains.kotlinx:atomicfu:0.23.2

feature/about/build.gradle.kts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@
88
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
99
*/
1010
plugins {
11-
alias(libs.plugins.mifos.android.feature)
12-
alias(libs.plugins.mifos.android.library.compose)
11+
alias(libs.plugins.mifos.cmp.feature)
1312
}
1413

1514
android {
1615
namespace = "org.mifos.mobile.feature.about"
1716
}
1817

19-
dependencies {
20-
18+
kotlin {
19+
sourceSets{
20+
commonMain.dependencies {
21+
implementation(compose.material3)
22+
implementation(compose.components.resources)
23+
implementation(compose.ui)
24+
api(projects.core.common)
25+
}
26+
}
2127
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
3-
Copyright 2024 Mifos Initiative
3+
Copyright 2025 Mifos Initiative
44
55
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
66
If a copy of the MPL was not distributed with this file,
77
You can obtain one at https://mozilla.org/MPL/2.0/.
88
99
See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
1010
-->
11-
<manifest>
11+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1212

1313
</manifest>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
9+
*/
10+
package org.mifos.mobile.feature.about
11+
12+
import android.graphics.Bitmap
13+
import android.webkit.WebResourceRequest
14+
import android.webkit.WebView
15+
import android.webkit.WebViewClient
16+
import androidx.compose.runtime.Composable
17+
import androidx.compose.ui.Modifier
18+
import androidx.compose.ui.viewinterop.AndroidView
19+
20+
@Composable
21+
actual fun MifosWebView(
22+
htmlContent: String,
23+
onLoadingChange: (isLoading: Boolean) -> Unit,
24+
modifier: Modifier,
25+
) {
26+
AndroidView(
27+
modifier = modifier,
28+
factory = { context ->
29+
WebView(context).apply {
30+
settings.javaScriptEnabled = true
31+
settings.domStorageEnabled = true
32+
overScrollMode = WebView.OVER_SCROLL_NEVER
33+
this.webViewClient = object : WebViewClient() {
34+
@Deprecated("Deprecated in Java")
35+
override fun shouldOverrideUrlLoading(
36+
view: WebView,
37+
request: WebResourceRequest?,
38+
): Boolean {
39+
return if (request?.url.toString().contains("jpg") ||
40+
request?.url.toString().contains("png") ||
41+
request?.url.toString().contains("attachment_id")
42+
) {
43+
true
44+
} else {
45+
openUrl(request?.url.toString())
46+
true
47+
}
48+
}
49+
50+
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
51+
onLoadingChange(true)
52+
}
53+
54+
override fun onPageFinished(view: WebView?, url: String?) {
55+
onLoadingChange(false)
56+
}
57+
}
58+
loadUrl(htmlContent)
59+
}
60+
},
61+
update = { webView ->
62+
webView.loadUrl(htmlContent)
63+
},
64+
)
65+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
9+
*/
10+
package org.mifos.mobile.feature.about
11+
12+
internal actual fun openUrl(url: String?) {
13+
// val uri = url?.let { Uri.parse(url) } ?: return
14+
// val intent = Intent().apply {
15+
// action = Intent.ACTION_VIEW
16+
// data = uri
17+
// addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
18+
// }
19+
// AndroidApp.instance.startActivity(intent)
20+
}

feature/about/src/main/res/drawable/feature_about_privacy_policy.xml renamed to feature/about/src/commonMain/composeResources/drawable/feature_about_privacy_policy.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
android:viewportWidth="24"
1515
android:viewportHeight="24">
1616
<path
17-
android:fillColor="@android:color/white"
17+
android:fillColor="#FFFFFF"
1818
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" />
1919
</vector>

0 commit comments

Comments
 (0)