Skip to content
Merged
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
14 changes: 7 additions & 7 deletions cmp-android/dependencies/demoDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions cmp-android/dependencies/demoReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions cmp-android/dependencies/prodDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions cmp-android/dependencies/prodReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
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
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2024 Mifos Initiative
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
-->
<manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -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)
},
)
}
Original file line number Diff line number Diff line change
@@ -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)
}
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,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,
)
Original file line number Diff line number Diff line change
@@ -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?)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -82,26 +76,25 @@ 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 -> {
navigateToPrivacyPolicy()
}

AboutUsListItemId.SOURCE_CODE -> {
startActivity(context, Constants.SOURCE_CODE_LINK)
openUrl(Constants.SOURCE_CODE_LINK)
}

AboutUsListItemId.LICENSES_STRING_WITH_VALUE -> {
Expand All @@ -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)))
}
Loading