diff --git a/cmp-android/dependencies/demoDebugRuntimeClasspath.txt b/cmp-android/dependencies/demoDebugRuntimeClasspath.txt index c03ae1d2f5..dd39549c18 100644 --- a/cmp-android/dependencies/demoDebugRuntimeClasspath.txt +++ b/cmp-android/dependencies/demoDebugRuntimeClasspath.txt @@ -60,11 +60,11 @@ androidx.core:core:1.15.0 androidx.cursoradapter:cursoradapter:1.0.0 androidx.customview:customview-poolingcontainer:1.0.0 androidx.customview:customview:1.1.0 -androidx.databinding:databinding-adapters:8.7.3 -androidx.databinding:databinding-common:8.7.3 -androidx.databinding:databinding-ktx:8.7.3 -androidx.databinding:databinding-runtime:8.7.3 -androidx.databinding:viewbinding:8.7.3 +androidx.databinding:databinding-adapters:8.8.0 +androidx.databinding:databinding-common:8.8.0 +androidx.databinding:databinding-ktx:8.8.0 +androidx.databinding:databinding-runtime:8.8.0 +androidx.databinding:viewbinding:8.8.0 androidx.documentfile:documentfile:1.0.0 androidx.drawerlayout:drawerlayout:1.0.0 androidx.emoji2:emoji2-views-helper:1.3.0 @@ -304,8 +304,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-reflect:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 org.jetbrains.kotlinx:atomicfu:0.23.2 diff --git a/cmp-android/dependencies/demoReleaseRuntimeClasspath.txt b/cmp-android/dependencies/demoReleaseRuntimeClasspath.txt index 578710c391..3574903eb6 100644 --- a/cmp-android/dependencies/demoReleaseRuntimeClasspath.txt +++ b/cmp-android/dependencies/demoReleaseRuntimeClasspath.txt @@ -56,11 +56,11 @@ androidx.core:core:1.15.0 androidx.cursoradapter:cursoradapter:1.0.0 androidx.customview:customview-poolingcontainer:1.0.0 androidx.customview:customview:1.1.0 -androidx.databinding:databinding-adapters:8.7.3 -androidx.databinding:databinding-common:8.7.3 -androidx.databinding:databinding-ktx:8.7.3 -androidx.databinding:databinding-runtime:8.7.3 -androidx.databinding:viewbinding:8.7.3 +androidx.databinding:databinding-adapters:8.8.0 +androidx.databinding:databinding-common:8.8.0 +androidx.databinding:databinding-ktx:8.8.0 +androidx.databinding:databinding-runtime:8.8.0 +androidx.databinding:viewbinding:8.8.0 androidx.documentfile:documentfile:1.0.0 androidx.drawerlayout:drawerlayout:1.0.0 androidx.emoji2:emoji2-views-helper:1.3.0 @@ -300,8 +300,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-reflect:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 org.jetbrains.kotlinx:atomicfu:0.23.2 diff --git a/cmp-android/dependencies/prodDebugRuntimeClasspath.txt b/cmp-android/dependencies/prodDebugRuntimeClasspath.txt index c03ae1d2f5..dd39549c18 100644 --- a/cmp-android/dependencies/prodDebugRuntimeClasspath.txt +++ b/cmp-android/dependencies/prodDebugRuntimeClasspath.txt @@ -60,11 +60,11 @@ androidx.core:core:1.15.0 androidx.cursoradapter:cursoradapter:1.0.0 androidx.customview:customview-poolingcontainer:1.0.0 androidx.customview:customview:1.1.0 -androidx.databinding:databinding-adapters:8.7.3 -androidx.databinding:databinding-common:8.7.3 -androidx.databinding:databinding-ktx:8.7.3 -androidx.databinding:databinding-runtime:8.7.3 -androidx.databinding:viewbinding:8.7.3 +androidx.databinding:databinding-adapters:8.8.0 +androidx.databinding:databinding-common:8.8.0 +androidx.databinding:databinding-ktx:8.8.0 +androidx.databinding:databinding-runtime:8.8.0 +androidx.databinding:viewbinding:8.8.0 androidx.documentfile:documentfile:1.0.0 androidx.drawerlayout:drawerlayout:1.0.0 androidx.emoji2:emoji2-views-helper:1.3.0 @@ -304,8 +304,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-reflect:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 org.jetbrains.kotlinx:atomicfu:0.23.2 diff --git a/cmp-android/dependencies/prodReleaseRuntimeClasspath.txt b/cmp-android/dependencies/prodReleaseRuntimeClasspath.txt index 578710c391..3574903eb6 100644 --- a/cmp-android/dependencies/prodReleaseRuntimeClasspath.txt +++ b/cmp-android/dependencies/prodReleaseRuntimeClasspath.txt @@ -56,11 +56,11 @@ androidx.core:core:1.15.0 androidx.cursoradapter:cursoradapter:1.0.0 androidx.customview:customview-poolingcontainer:1.0.0 androidx.customview:customview:1.1.0 -androidx.databinding:databinding-adapters:8.7.3 -androidx.databinding:databinding-common:8.7.3 -androidx.databinding:databinding-ktx:8.7.3 -androidx.databinding:databinding-runtime:8.7.3 -androidx.databinding:viewbinding:8.7.3 +androidx.databinding:databinding-adapters:8.8.0 +androidx.databinding:databinding-common:8.8.0 +androidx.databinding:databinding-ktx:8.8.0 +androidx.databinding:databinding-runtime:8.8.0 +androidx.databinding:viewbinding:8.8.0 androidx.documentfile:documentfile:1.0.0 androidx.drawerlayout:drawerlayout:1.0.0 androidx.emoji2:emoji2-views-helper:1.3.0 @@ -300,8 +300,8 @@ org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-reflect:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20 -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 org.jetbrains.kotlinx:atomicfu:0.23.2 diff --git a/feature/about/build.gradle.kts b/feature/about/build.gradle.kts index 71087e7cb1..e483e6ab8d 100644 --- a/feature/about/build.gradle.kts +++ b/feature/about/build.gradle.kts @@ -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) + } + } } \ No newline at end of file diff --git a/feature/about/src/main/AndroidManifest.xml b/feature/about/src/androidMain/AndroidManifest.xml similarity index 76% rename from feature/about/src/main/AndroidManifest.xml rename to feature/about/src/androidMain/AndroidManifest.xml index 4ee22a4fb1..e60d7f7451 100644 --- a/feature/about/src/main/AndroidManifest.xml +++ b/feature/about/src/androidMain/AndroidManifest.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/feature/about/src/androidMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.android.kt b/feature/about/src/androidMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.android.kt new file mode 100644 index 0000000000..58dcbe7a45 --- /dev/null +++ b/feature/about/src/androidMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.android.kt @@ -0,0 +1,65 @@ +/* + * 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 MifosWebView( + htmlContent: String, + onLoadingChange: (isLoading: Boolean) -> 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 { + openUrl(request?.url.toString()) + true + } + } + + override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { + onLoadingChange(true) + } + + override fun onPageFinished(view: WebView?, url: String?) { + onLoadingChange(false) + } + } + loadUrl(htmlContent) + } + }, + update = { webView -> + webView.loadUrl(htmlContent) + }, + ) +} diff --git a/feature/about/src/androidMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.android.kt b/feature/about/src/androidMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.android.kt new file mode 100644 index 0000000000..dc235b7a69 --- /dev/null +++ b/feature/about/src/androidMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.android.kt @@ -0,0 +1,20 @@ +/* + * 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 + +internal actual fun openUrl(url: String?) { +// val uri = url?.let { Uri.parse(url) } ?: return +// val intent = Intent().apply { +// action = Intent.ACTION_VIEW +// data = uri +// addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) +// } +// AndroidApp.instance.startActivity(intent) +} diff --git a/feature/about/src/main/res/drawable/feature_about_law_icon.xml b/feature/about/src/commonMain/composeResources/drawable/feature_about_law_icon.xml similarity index 100% rename from feature/about/src/main/res/drawable/feature_about_law_icon.xml rename to feature/about/src/commonMain/composeResources/drawable/feature_about_law_icon.xml diff --git a/feature/about/src/main/res/drawable/feature_about_privacy_policy.xml b/feature/about/src/commonMain/composeResources/drawable/feature_about_privacy_policy.xml similarity index 94% rename from feature/about/src/main/res/drawable/feature_about_privacy_policy.xml rename to feature/about/src/commonMain/composeResources/drawable/feature_about_privacy_policy.xml index ebde7240c7..39d5dca579 100644 --- a/feature/about/src/main/res/drawable/feature_about_privacy_policy.xml +++ b/feature/about/src/commonMain/composeResources/drawable/feature_about_privacy_policy.xml @@ -14,6 +14,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/feature/about/src/main/res/drawable/feature_about_source_code.xml b/feature/about/src/commonMain/composeResources/drawable/feature_about_source_code.xml similarity index 100% rename from feature/about/src/main/res/drawable/feature_about_source_code.xml rename to feature/about/src/commonMain/composeResources/drawable/feature_about_source_code.xml diff --git a/feature/about/src/main/res/drawable/feature_about_website.xml b/feature/about/src/commonMain/composeResources/drawable/feature_about_website.xml similarity index 100% rename from feature/about/src/main/res/drawable/feature_about_website.xml rename to feature/about/src/commonMain/composeResources/drawable/feature_about_website.xml diff --git a/feature/about/src/main/res/drawable/mifos_logo.png b/feature/about/src/commonMain/composeResources/drawable/mifos_logo.png similarity index 100% rename from feature/about/src/main/res/drawable/mifos_logo.png rename to feature/about/src/commonMain/composeResources/drawable/mifos_logo.png diff --git a/feature/about/src/main/res/values/strings.xml b/feature/about/src/commonMain/composeResources/values/strings.xml similarity index 100% rename from feature/about/src/main/res/values/strings.xml rename to feature/about/src/commonMain/composeResources/values/strings.xml diff --git a/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/AboutUsItem.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/AboutUsItem.kt new file mode 100644 index 0000000000..653b96f36d --- /dev/null +++ b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/AboutUsItem.kt @@ -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, +) diff --git a/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.kt new file mode 100644 index 0000000000..535c97e739 --- /dev/null +++ b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.kt @@ -0,0 +1,20 @@ +/* + * 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 MifosWebView( + htmlContent: String, + onLoadingChange: (isLoading: Boolean) -> Unit, + modifier: Modifier = Modifier, +) diff --git a/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.kt new file mode 100644 index 0000000000..90285e00e2 --- /dev/null +++ b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.kt @@ -0,0 +1,12 @@ +/* + * 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 + +internal expect fun openUrl(url: String?) diff --git a/feature/about/src/main/java/org/mifos/mobile/feature/about/navigation/AboutNavGraph.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/navigation/AboutNavGraph.kt similarity index 83% rename from feature/about/src/main/java/org/mifos/mobile/feature/about/navigation/AboutNavGraph.kt rename to feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/navigation/AboutNavGraph.kt index c0d4669628..cba0def126 100644 --- a/feature/about/src/main/java/org/mifos/mobile/feature/about/navigation/AboutNavGraph.kt +++ b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/navigation/AboutNavGraph.kt @@ -9,16 +9,13 @@ */ package org.mifos.mobile.feature.about.navigation -import android.content.Context -import android.content.Intent -import android.net.Uri -import androidx.compose.ui.platform.LocalContext import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.compose.navigation import org.mifos.mobile.core.common.Constants import org.mifos.mobile.core.model.enums.AboutUsListItemId +import org.mifos.mobile.feature.about.openUrl import org.mifos.mobile.feature.about.ui.AboutUsScreen import org.mifos.mobile.feature.about.ui.PrivacyPolicyScreen @@ -54,12 +51,9 @@ fun NavGraphBuilder.aboutUsScreenRoute( composable( route = AboutUsNavigation.AboutUsScreen.route, ) { - val context = LocalContext.current - AboutUsScreen( navigateToItem = { navigateToItem( - context = context, aboutUsItem = it.itemId, navigateToOssLicense = navigateToOssLicense, navigateToPrivacyPolicy = navigateToPrivacyPolicy, @@ -82,18 +76,17 @@ fun NavGraphBuilder.privacyPolicyScreenRoute( } private fun navigateToItem( - context: Context, aboutUsItem: AboutUsListItemId, navigateToPrivacyPolicy: () -> Unit, navigateToOssLicense: () -> Unit, ) { when (aboutUsItem) { AboutUsListItemId.OFFICE_WEBSITE -> { - startActivity(context, Constants.WEBSITE_LINK) + openUrl(Constants.WEBSITE_LINK) } AboutUsListItemId.LICENSES -> { - startActivity(context, Constants.LICENSE_LINK) + openUrl(Constants.LICENSE_LINK) } AboutUsListItemId.PRIVACY_POLICY -> { @@ -101,7 +94,7 @@ private fun navigateToItem( } AboutUsListItemId.SOURCE_CODE -> { - startActivity(context, Constants.SOURCE_CODE_LINK) + openUrl(Constants.SOURCE_CODE_LINK) } AboutUsListItemId.LICENSES_STRING_WITH_VALUE -> { @@ -111,7 +104,3 @@ private fun navigateToItem( AboutUsListItemId.APP_VERSION_TEXT -> Unit } } - -fun startActivity(context: Context, uri: String) { - context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(uri))) -} diff --git a/feature/about/src/main/java/org/mifos/mobile/feature/about/navigation/AboutNavigation.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/navigation/AboutNavigation.kt similarity index 100% rename from feature/about/src/main/java/org/mifos/mobile/feature/about/navigation/AboutNavigation.kt rename to feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/navigation/AboutNavigation.kt diff --git a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsHeader.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/AboutUsHeader.kt similarity index 72% rename from feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsHeader.kt rename to feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/AboutUsHeader.kt index 2b24dcda97..ded3dd4c44 100644 --- a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsHeader.kt +++ b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/AboutUsHeader.kt @@ -19,21 +19,24 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import org.mifos.mobile.core.ui.utils.DevicePreviews -import org.mifos.mobile.feature.about.R +import mifos_mobile.feature.about.generated.resources.Res +import mifos_mobile.feature.about.generated.resources.feature_about_app_name +import mifos_mobile.feature.about.generated.resources.feature_about_description +import mifos_mobile.feature.about.generated.resources.mifos_logo +import org.jetbrains.compose.resources.painterResource +import org.jetbrains.compose.resources.stringResource +import org.mifos.mobile.core.ui.utils.DevicePreview -@DevicePreviews +@DevicePreview @Composable internal fun AboutUsHeader( modifier: Modifier = Modifier, ) { Column(modifier) { Image( - painter = painterResource(id = R.drawable.mifos_logo), + painter = painterResource(resource = Res.drawable.mifos_logo), contentDescription = null, modifier = Modifier .size(100.dp) @@ -42,7 +45,7 @@ internal fun AboutUsHeader( ) Text( - text = stringResource(id = R.string.feature_about_app_name), + text = stringResource(resource = Res.string.feature_about_app_name), style = MaterialTheme.typography.headlineMedium, color = MaterialTheme.colorScheme.onSurface, textAlign = TextAlign.Center, @@ -52,7 +55,7 @@ internal fun AboutUsHeader( ) Text( - text = stringResource(id = R.string.feature_about_description), + text = stringResource(resource = Res.string.feature_about_description), style = MaterialTheme.typography.titleSmall.copy(), color = MaterialTheme.colorScheme.onSurface, textAlign = TextAlign.Center, diff --git a/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt new file mode 100644 index 0000000000..af1a22a107 --- /dev/null +++ b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt @@ -0,0 +1,121 @@ +/* + * Copyright 2024 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.ui + +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import mifos_mobile.feature.about.generated.resources.Res +import mifos_mobile.feature.about.generated.resources.feature_about_app_version +import mifos_mobile.feature.about.generated.resources.feature_about_copyright_mifos +import mifos_mobile.feature.about.generated.resources.feature_about_law_icon +import mifos_mobile.feature.about.generated.resources.feature_about_license +import mifos_mobile.feature.about.generated.resources.feature_about_licenses +import mifos_mobile.feature.about.generated.resources.feature_about_official_website +import mifos_mobile.feature.about.generated.resources.feature_about_privacy_policy +import mifos_mobile.feature.about.generated.resources.feature_about_source_code +import mifos_mobile.feature.about.generated.resources.feature_about_sources +import mifos_mobile.feature.about.generated.resources.feature_about_website +import org.jetbrains.compose.resources.stringResource +import org.mifos.mobile.core.common.DateHelper +import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme +import org.mifos.mobile.core.model.enums.AboutUsListItemId +import org.mifos.mobile.core.ui.component.AboutUsItemCard +import org.mifos.mobile.core.ui.component.MifosItemCard +import org.mifos.mobile.core.ui.utils.DevicePreview +import org.mifos.mobile.feature.about.AboutUsItem + +@Composable +internal fun AboutUsScreen( + navigateToItem: (AboutUsItem) -> Unit, + modifier: Modifier = Modifier, +) { + val currentYear = remember { DateHelper.currentDate.year } + val aboutUsItems = remember { getAboutUsItems() } + + LazyColumn( + modifier = modifier + .fillMaxSize() + .padding(16.dp), + ) { + item { + Spacer(modifier = Modifier.height(48.dp)) + AboutUsHeader() + } + + items(items = aboutUsItems, key = { item -> item.itemId }) { item -> + MifosItemCard( + modifier = Modifier.padding(bottom = 8.dp), + onClick = { navigateToItem(item) }, + ) { + AboutUsItemCard( + title = if (item.itemId == AboutUsListItemId.LICENSES_STRING_WITH_VALUE) { + stringResource(item.title).replace("%1\$s", currentYear.toString()) + } else { + stringResource(item.title) + }, + subtitle = item.subtitle, + iconUrl = item.iconUrl, + ) + } + } + } +} + +private fun getAboutUsItems(): List { + return listOf( + AboutUsItem( + title = Res.string.feature_about_app_version, + itemId = AboutUsListItemId.APP_VERSION_TEXT, + ), + AboutUsItem( + title = Res.string.feature_about_official_website, + iconUrl = Res.drawable.feature_about_website, + itemId = AboutUsListItemId.OFFICE_WEBSITE, + ), + AboutUsItem( + title = Res.string.feature_about_licenses, + iconUrl = Res.drawable.feature_about_law_icon, + itemId = AboutUsListItemId.LICENSES, + ), + AboutUsItem( + title = Res.string.feature_about_privacy_policy, + iconUrl = Res.drawable.feature_about_privacy_policy, + itemId = AboutUsListItemId.PRIVACY_POLICY, + ), + AboutUsItem( + title = Res.string.feature_about_sources, + iconUrl = Res.drawable.feature_about_source_code, + itemId = AboutUsListItemId.SOURCE_CODE, + ), + AboutUsItem( + title = Res.string.feature_about_copyright_mifos, + subtitle = Res.string.feature_about_license, + itemId = AboutUsListItemId.LICENSES_STRING_WITH_VALUE, + ), + ) +} + +@DevicePreview +@Composable +fun AboutScreenPreview() { + MifosMobileTheme { + AboutUsScreen( + navigateToItem = {}, + ) + } +} diff --git a/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/PrivacyPolicyScreen.kt b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/PrivacyPolicyScreen.kt new file mode 100644 index 0000000000..842bbd827f --- /dev/null +++ b/feature/about/src/commonMain/kotlin/org/mifos/mobile/feature/about/ui/PrivacyPolicyScreen.kt @@ -0,0 +1,70 @@ +/* + * Copyright 2024 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.ui + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import mifos_mobile.feature.about.generated.resources.Res +import mifos_mobile.feature.about.generated.resources.feature_about_policy_url +import mifos_mobile.feature.about.generated.resources.feature_about_privacy_policy +import org.jetbrains.compose.resources.stringResource +import org.mifos.mobile.core.designsystem.component.MifosScaffold +import org.mifos.mobile.core.ui.component.MifosProgressIndicator +import org.mifos.mobile.feature.about.MifosWebView + +@Composable +internal fun PrivacyPolicyScreen( + navigateBack: () -> Unit, + modifier: Modifier = Modifier, +) { + var isLoading by remember { mutableStateOf(true) } + + MifosScaffold( + topBarTitle = stringResource(Res.string.feature_about_privacy_policy), + backPress = navigateBack, + modifier = modifier, + content = { + WebView( + url = stringResource(Res.string.feature_about_policy_url), + isLoading = isLoading, + onLoadingChange = { isLoading = it }, + ) + }, + ) +} + +@Composable +private fun WebView( + url: String, + isLoading: Boolean, + onLoadingChange: (isLoading: Boolean) -> Unit, + modifier: Modifier = Modifier, +) { + Column(modifier = modifier) { + Spacer(modifier = Modifier.height(20.dp)) + MifosWebView( + htmlContent = url, + onLoadingChange = onLoadingChange, + modifier = Modifier.fillMaxWidth(), + ) + if (isLoading) { + MifosProgressIndicator() + } + } +} diff --git a/feature/about/src/desktopMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.desktop.kt b/feature/about/src/desktopMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.desktop.kt new file mode 100644 index 0000000000..35439594f1 --- /dev/null +++ b/feature/about/src/desktopMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.desktop.kt @@ -0,0 +1,34 @@ +/* + * 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.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign + +@Composable +actual fun MifosWebView( + htmlContent: String, + onLoadingChange: (isLoading: Boolean) -> Unit, + modifier: Modifier, +) { + onLoadingChange(false) + Box(modifier = modifier.fillMaxSize()) { + Text( + text = "Implement platform specific WebView for Desktop", + textAlign = TextAlign.Center, + modifier = Modifier.align(Alignment.Center), + ) + } +} diff --git a/feature/about/src/desktopMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.desktop.kt b/feature/about/src/desktopMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.desktop.kt new file mode 100644 index 0000000000..de7ae5592d --- /dev/null +++ b/feature/about/src/desktopMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.desktop.kt @@ -0,0 +1,18 @@ +/* + * 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 java.awt.Desktop +import java.net.URI + +actual fun openUrl(url: String?) { + val uri = url?.let { URI.create(it) } ?: return + Desktop.getDesktop().browse(uri) +} diff --git a/feature/about/src/jsMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.js.kt b/feature/about/src/jsMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.js.kt new file mode 100644 index 0000000000..4ad665f701 --- /dev/null +++ b/feature/about/src/jsMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.js.kt @@ -0,0 +1,34 @@ +/* + * 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.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign + +@Composable +actual fun MifosWebView( + htmlContent: String, + onLoadingChange: (isLoading: Boolean) -> Unit, + modifier: Modifier, +) { + onLoadingChange(false) + Box(modifier = modifier.fillMaxSize()) { + Text( + text = "Implement platform specific WebView for WasmJs", + textAlign = TextAlign.Center, + modifier = Modifier.align(Alignment.Center), + ) + } +} diff --git a/feature/about/src/jsMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.js.kt b/feature/about/src/jsMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.js.kt new file mode 100644 index 0000000000..51e5e9a53e --- /dev/null +++ b/feature/about/src/jsMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.js.kt @@ -0,0 +1,18 @@ +/* + * 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 kotlinx.browser.window + +actual fun openUrl(url: String?) { + if (url != null) { + window.open(url, "_blank") // Opens in a new tab + } +} diff --git a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt b/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt deleted file mode 100644 index f8c6aff83d..0000000000 --- a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/AboutUsScreen.kt +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2024 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.ui - -import android.content.Context -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.items -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.unit.dp -import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme -import org.mifos.mobile.core.model.entity.AboutUsItem -import org.mifos.mobile.core.model.enums.AboutUsListItemId -import org.mifos.mobile.core.ui.component.AboutUsItemCard -import org.mifos.mobile.core.ui.component.MifosItemCard -import org.mifos.mobile.core.ui.utils.DevicePreviews -import org.mifos.mobile.feature.about.R -import java.util.Calendar - -@Composable -internal fun AboutUsScreen( - navigateToItem: (AboutUsItem) -> Unit, - modifier: Modifier = Modifier, -) { - val context = LocalContext.current - LazyColumn( - modifier = modifier - .fillMaxSize() - .padding(16.dp), - ) { - item { - Spacer(modifier = Modifier.height(48.dp)) - AboutUsHeader() - } - items(getAboutUsItem(context)) { item -> - MifosItemCard( - modifier = Modifier.padding(bottom = 8.dp), - onClick = { navigateToItem(item) }, - ) { - item.title?.let { - AboutUsItemCard( - title = it, - subtitle = item.subtitle, - iconUrl = item.iconUrl, - ) - } - } - } - } -} - -private fun getAboutUsItem(context: Context): List { - val currentYear = Calendar.getInstance().get(Calendar.YEAR) - val copyrightText = context.getString(R.string.feature_about_copyright_mifos) - .replace("%1\$s", currentYear.toString()) - - return listOf( - AboutUsItem( - title = context.getString(R.string.feature_about_app_version), - itemId = AboutUsListItemId.APP_VERSION_TEXT, - ), - AboutUsItem( - title = context.getString(R.string.feature_about_official_website), - iconUrl = R.drawable.feature_about_website, - itemId = AboutUsListItemId.OFFICE_WEBSITE, - ), - AboutUsItem( - title = context.getString(R.string.feature_about_licenses), - iconUrl = R.drawable.feature_about_law_icon, - itemId = AboutUsListItemId.LICENSES, - ), - AboutUsItem( - title = context.getString(R.string.feature_about_privacy_policy), - iconUrl = R.drawable.feature_about_privacy_policy, - itemId = AboutUsListItemId.PRIVACY_POLICY, - ), - AboutUsItem( - title = context.getString(R.string.feature_about_sources), - iconUrl = R.drawable.feature_about_source_code, - itemId = AboutUsListItemId.SOURCE_CODE, - ), - AboutUsItem( - title = copyrightText, - subtitle = R.string.feature_about_license, - itemId = AboutUsListItemId.LICENSES_STRING_WITH_VALUE, - ), - ) -} - -@DevicePreviews -@Composable -fun AboutScreenPreview() { - MifosMobileTheme { - AboutUsScreen( - navigateToItem = {}, - ) - } -} diff --git a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/PrivacyPolicyScreen.kt b/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/PrivacyPolicyScreen.kt deleted file mode 100644 index 77a1dcc80e..0000000000 --- a/feature/about/src/main/java/org/mifos/mobile/feature/about/ui/PrivacyPolicyScreen.kt +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2024 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.ui - -import android.annotation.SuppressLint -import android.content.Context -import android.content.Intent -import android.graphics.Bitmap -import android.net.Uri -import android.webkit.WebView -import android.webkit.WebViewClient -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.unit.dp -import androidx.compose.ui.viewinterop.AndroidView -import org.mifos.mobile.core.designsystem.components.MifosScaffold -import org.mifos.mobile.core.ui.component.MifosProgressIndicator -import org.mifos.mobile.feature.about.R - -@Composable -internal fun PrivacyPolicyScreen( - navigateBack: () -> Unit, - modifier: Modifier = Modifier, -) { - val context = LocalContext.current - MifosScaffold( - topBarTitleResId = R.string.feature_about_privacy_policy, - navigateBack = navigateBack, - modifier = modifier, - content = { - WebView( - url = context.getString(R.string.feature_about_policy_url), - ) - }, - ) -} - -@SuppressLint("SetJavaScriptEnabled") -@Composable -private fun WebView( - url: String, - modifier: Modifier = Modifier, -) { - var isLoading by remember { mutableStateOf(true) } - - Column(modifier) { - Spacer(modifier = Modifier.height(20.dp)) - AndroidView( - 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, - url: String, - ): Boolean { - return if (context.checkUri(url)) { - false - } else { - context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) - true - } - } - - override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { - isLoading = true - } - - override fun onPageFinished(view: WebView?, url: String?) { - isLoading = false - } - } - loadUrl(url) - } - }, - update = { webView -> - webView.loadUrl(url) - }, - ) - if (isLoading) { - MifosProgressIndicator() - } - } -} - -private fun Context.checkUri(uri: String): Boolean { - return Uri.parse(uri)?.host?.endsWith(this.getString(R.string.feature_about_policy_host)) == true -} diff --git a/feature/about/src/nativeMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.native.kt b/feature/about/src/nativeMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.native.kt new file mode 100644 index 0000000000..d9cabb7931 --- /dev/null +++ b/feature/about/src/nativeMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.native.kt @@ -0,0 +1,34 @@ +/* + * 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.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign + +@Composable +actual fun MifosWebView( + htmlContent: String, + onLoadingChange: (isLoading: Boolean) -> Unit, + modifier: Modifier, +) { + onLoadingChange(false) + Box(modifier = modifier.fillMaxSize()) { + Text( + text = "Implement platform specific WebView for IOS", + textAlign = TextAlign.Center, + modifier = Modifier.align(Alignment.Center), + ) + } +} diff --git a/feature/about/src/nativeMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.native.kt b/feature/about/src/nativeMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.native.kt new file mode 100644 index 0000000000..3be4803184 --- /dev/null +++ b/feature/about/src/nativeMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.native.kt @@ -0,0 +1,22 @@ +/* + * 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 platform.Foundation.NSURL +import platform.UIKit.UIApplication + +internal actual fun openUrl(url: String?) { + val nsUrl = url?.let { NSURL.URLWithString(it) } ?: return + UIApplication.sharedApplication.openURL(nsUrl, options = emptyMap()) { success -> + if (!success) { + println("Failed to open URL: $url") + } + } +} diff --git a/feature/about/src/wasmJsMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.wasmJs.kt b/feature/about/src/wasmJsMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.wasmJs.kt new file mode 100644 index 0000000000..4ad665f701 --- /dev/null +++ b/feature/about/src/wasmJsMain/kotlin/org/mifos/mobile/feature/about/MifosWebView.wasmJs.kt @@ -0,0 +1,34 @@ +/* + * 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.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign + +@Composable +actual fun MifosWebView( + htmlContent: String, + onLoadingChange: (isLoading: Boolean) -> Unit, + modifier: Modifier, +) { + onLoadingChange(false) + Box(modifier = modifier.fillMaxSize()) { + Text( + text = "Implement platform specific WebView for WasmJs", + textAlign = TextAlign.Center, + modifier = Modifier.align(Alignment.Center), + ) + } +} diff --git a/feature/about/src/wasmJsMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.wasmJs.kt b/feature/about/src/wasmJsMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.wasmJs.kt new file mode 100644 index 0000000000..51e5e9a53e --- /dev/null +++ b/feature/about/src/wasmJsMain/kotlin/org/mifos/mobile/feature/about/OpenUrl.wasmJs.kt @@ -0,0 +1,18 @@ +/* + * 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 kotlinx.browser.window + +actual fun openUrl(url: String?) { + if (url != null) { + window.open(url, "_blank") // Opens in a new tab + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dd9440bf4c..a8f3bcf4e0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ accompanistVersion = "0.34.0" activityVersion = "1.9.3" androidDesugarJdkLibs = "2.1.4" -androidGradlePlugin = "8.7.3" +androidGradlePlugin = "8.8.0" androidTools = "31.7.3" androidx-test-ext-junit = "1.2.1" androidxActivity = "1.9.3" diff --git a/settings.gradle.kts b/settings.gradle.kts index 8d3b1b7aae..577d08c341 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -70,7 +70,7 @@ include(":core:qrcode") //include(":feature:help") //include(":feature:notification") //include(":feature:location") -//include(":feature:about") +include(":feature:about") //include(":feature:settings") include(":feature:auth") //include(":feature:update-password")