diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj
index 5a5cea8..c84dd6a 100644
--- a/iosApp/iosApp.xcodeproj/project.pbxproj
+++ b/iosApp/iosApp.xcodeproj/project.pbxproj
@@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
- DEVELOPMENT_TEAM = N5F88VN4G4;
+ DEVELOPMENT_TEAM = Z57TWPQ3R6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
@@ -384,7 +384,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
- DEVELOPMENT_TEAM = N5F88VN4G4;
+ DEVELOPMENT_TEAM = Z57TWPQ3R6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
diff --git a/iosApp/iosApp/Biometric/BiometricUtil.swift b/iosApp/iosApp/Biometric/BiometricUtil.swift
index f62a7dc..93d995a 100644
--- a/iosApp/iosApp/Biometric/BiometricUtil.swift
+++ b/iosApp/iosApp/Biometric/BiometricUtil.swift
@@ -3,7 +3,6 @@ import shared
import LocalAuthentication
class BiometricUtilIosImpl: BioMetricUtil {
-
private let cipherUtil = CipherUtilIosImpl()
private var promptDescription: String = "Authenticate"
@@ -18,7 +17,7 @@ class BiometricUtilIosImpl: BioMetricUtil {
DispatchQueue.main.async {
if success {
- completionHandler(self?.generatePublicKey(), nil)
+ completionHandler(self?.getPublicKey(), nil)
} else {
completionHandler(nil, authenticationError)
}
@@ -43,9 +42,9 @@ class BiometricUtilIosImpl: BioMetricUtil {
}
- func generatePublicKey() -> String? {
- let keyPair = try? cipherUtil.generateKeyPair()
- return keyPair?.publicKey?.toPemFormat().toBase64()
+ func generatePublicKey() async throws -> String? {
+ let keyPair = try cipherUtil.generateKeyPair()
+ return keyPair.publicKey?.toPemFormat().toBase64()
}
func getPublicKey() -> String? {
diff --git a/iosApp/iosApp/Biometric/CipherUtil.swift b/iosApp/iosApp/Biometric/CipherUtil.swift
index 4eacf21..9d019de 100644
--- a/iosApp/iosApp/Biometric/CipherUtil.swift
+++ b/iosApp/iosApp/Biometric/CipherUtil.swift
@@ -2,8 +2,8 @@ import Foundation
import shared
class CipherUtilIosImpl: ICipherUtil {
- private let KEY_NAME = "my_biometric_key"
- private let tag: Data
+ private let KEY_NAME = "biometric_key"
+ private let tag: String
private lazy var key: SecKey? = {
let query: [String: Any] = [
@@ -19,7 +19,7 @@ class CipherUtilIosImpl: ICipherUtil {
}()
init() {
- self.tag = KEY_NAME.data(using: .utf8)!
+ self.tag = KEY_NAME
}
func generateKeyPair() throws -> CommonKeyPair {
@@ -35,7 +35,7 @@ class CipherUtilIosImpl: ICipherUtil {
kSecPrivateKeyAttrs as String: [
kSecAttrIsPermanent as String: true,
kSecAttrApplicationTag as String: tag,
- kSecAttrAccessControl as String: access,
+ kSecAttrAccessControl as String: access
]
]
diff --git a/iosApp/iosApp/ContentView.swift b/iosApp/iosApp/ContentView.swift
index b83d4f6..df5c5a3 100644
--- a/iosApp/iosApp/ContentView.swift
+++ b/iosApp/iosApp/ContentView.swift
@@ -3,30 +3,49 @@ import shared
let biometricUtil = BiometricUtilIosImpl()
struct ContentView: View {
- let greet = Greeting().greet()
+ let greet = Greeting().greet()
@State private var path = NavigationPath()
- var body: some View {
+ var body: some View {
ZStack {
- ComposeViewController()
+ ComposeViewController(onNavigateToNextScreen: {
+ path.append("NextScreen")
+ })
}
- }
+ .navigationDestination(for: String.self) { value in
+ if value == "NextScreen" {
+ NextScreen()
+ }
+ }
+ }
}
struct ComposeViewController: UIViewControllerRepresentable {
@StateObject var biometricAuthorizationViewModel: BiometricAuthorizationViewModel = BiometricAuthorizationViewModel()
+ var onNavigateToNextScreen: () -> Void
+
func makeUIViewController(context: Context) -> UIViewController {
- return App_iosKt.MainViewController(bioMetricUtil: biometricUtil, biometricViewModel: biometricAuthorizationViewModel)
+ return App_iosKt.MainViewController(
+ bioMetricUtil: biometricUtil,
+ biometricViewModel: biometricAuthorizationViewModel,
+ onPasscodeConfirm: onNavigateToNextScreen
+ )
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}
-struct ContentView_Previews: PreviewProvider {
- static var previews: some View {
- ContentView()
+struct NextScreen: View {
+ var body: some View {
+ Text("Next Screen")
}
}
+struct ContentView_Previews: PreviewProvider {
+ static var previews: some View {
+ ContentView()
+ }
+}
+
extension BiometricAuthorizationViewModel: ObservableObject {}
diff --git a/iosApp/iosApp/iOSApp.swift b/iosApp/iosApp/iOSApp.swift
index b7bf2f4..0648e86 100644
--- a/iosApp/iosApp/iOSApp.swift
+++ b/iosApp/iosApp/iOSApp.swift
@@ -7,4 +7,4 @@ struct iOSApp: App {
ContentView()
}
}
-}
+}
\ No newline at end of file
diff --git a/shared/src/androidMain/kotlin/com/mifos/shared/BiometricUtilAndroidImpl.kt b/shared/src/androidMain/kotlin/com/mifos/shared/BiometricUtilAndroidImpl.kt
index 5069f4c..99df724 100644
--- a/shared/src/androidMain/kotlin/com/mifos/shared/BiometricUtilAndroidImpl.kt
+++ b/shared/src/androidMain/kotlin/com/mifos/shared/BiometricUtilAndroidImpl.kt
@@ -36,7 +36,7 @@ class BiometricUtilAndroidImpl(
}
@RequiresApi(Build.VERSION_CODES.O)
- override fun generatePublicKey(): String? {
+ override suspend fun generatePublicKey(): String? {
return cipherUtil.generateKeyPair().public?.encoded?.toBase64Encoded()?.toPemFormat()?.toBase64Encoded()
}
diff --git a/shared/src/androidMain/kotlin/com/mifos/shared/Platform.android.kt b/shared/src/androidMain/kotlin/com/mifos/shared/Platform.android.kt
index cc23446..aa81cc7 100644
--- a/shared/src/androidMain/kotlin/com/mifos/shared/Platform.android.kt
+++ b/shared/src/androidMain/kotlin/com/mifos/shared/Platform.android.kt
@@ -1,8 +1,7 @@
package com.mifos.shared
class AndroidPlatform : Platform {
-// override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}"
- override val name: String = "Android"
+ override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}"
}
actual fun getPlatform(): Platform = AndroidPlatform()
\ No newline at end of file
diff --git a/shared/src/commonMain/composeResources/values/strings.xml b/shared/src/commonMain/composeResources/values/strings.xml
index dbb9bae..1620b69 100644
--- a/shared/src/commonMain/composeResources/values/strings.xml
+++ b/shared/src/commonMain/composeResources/values/strings.xml
@@ -21,7 +21,6 @@
Passcode do not match!
Are you sure you want to exit?
Use TouchId
- Use FaceIdh
Authentication failed
Authentication not set
Feature unavailable
diff --git a/shared/src/commonMain/kotlin/com/mifos/shared/component/PassCodeScreen.kt b/shared/src/commonMain/kotlin/com/mifos/shared/component/PassCodeScreen.kt
index 95784fc..4d79cd0 100644
--- a/shared/src/commonMain/kotlin/com/mifos/shared/component/PassCodeScreen.kt
+++ b/shared/src/commonMain/kotlin/com/mifos/shared/component/PassCodeScreen.kt
@@ -37,8 +37,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
-import com.mifos.shared.Platform
-import com.mifos.shared.getPlatform
import com.mifos.shared.utility.BioMetricUtil
import com.mifos.shared.utility.PreferenceManager
import com.mifos.shared.theme.blueTint
@@ -120,7 +118,7 @@ fun PasscodeScreen(
LaunchedEffect(true){
if(preferenceManager.hasPasscode)
- biometricAuthorizationViewModel.authorizeBiometric(bioMetricUtil)
+ biometricAuthorizationViewModel.authorizeBiometric(bioMetricUtil)
}
val snackBarHostState = remember {
diff --git a/shared/src/commonMain/kotlin/com/mifos/shared/component/PasscodeButton.kt b/shared/src/commonMain/kotlin/com/mifos/shared/component/PasscodeButton.kt
index ef45b2e..da84d03 100644
--- a/shared/src/commonMain/kotlin/com/mifos/shared/component/PasscodeButton.kt
+++ b/shared/src/commonMain/kotlin/com/mifos/shared/component/PasscodeButton.kt
@@ -9,15 +9,12 @@ import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
-import com.mifos.shared.Platform
-import com.mifos.shared.getPlatform
import com.mifos.shared.theme.forgotButtonStyle
import com.mifos.shared.theme.skipButtonStyle
import com.mifos.shared.theme.useTouchIdButtonStyle
import com.mifos.shared.resources.Res
import com.mifos.shared.resources.forgot_passcode_login_manually
import com.mifos.shared.resources.skip
-import com.mifos.shared.resources.use_faceId
import com.mifos.shared.resources.use_touchId
import org.jetbrains.compose.resources.stringResource
@@ -82,10 +79,7 @@ fun UseTouchIdButton(
TextButton(
onClick = onClick
) {
- if(getPlatform().name == "Android")
- Text(text = stringResource(Res.string.use_touchId), style = useTouchIdButtonStyle())
- else
- Text(text = stringResource(Res.string.use_faceId), style = useTouchIdButtonStyle())
+ Text(text = stringResource(Res.string.use_touchId), style = useTouchIdButtonStyle())
}
}
}
diff --git a/shared/src/commonMain/kotlin/com/mifos/shared/utility/BioMetricUtil.kt b/shared/src/commonMain/kotlin/com/mifos/shared/utility/BioMetricUtil.kt
index 09bd109..8e1bbd6 100644
--- a/shared/src/commonMain/kotlin/com/mifos/shared/utility/BioMetricUtil.kt
+++ b/shared/src/commonMain/kotlin/com/mifos/shared/utility/BioMetricUtil.kt
@@ -5,7 +5,7 @@ interface BioMetricUtil {
suspend fun setAndReturnPublicKey(): String?
suspend fun authenticate(): AuthenticationResult
fun canAuthenticate(): Boolean
- fun generatePublicKey(): String?
+ suspend fun generatePublicKey(): String?
fun signUserId(ucc: String): String
fun isBiometricSet(): Boolean
fun getPublicKey(): String?
diff --git a/shared/src/iosMain/kotlin/com/mifos/shared/App.ios.kt b/shared/src/iosMain/kotlin/com/mifos/shared/App.ios.kt
index 7070878..9ab3e9e 100644
--- a/shared/src/iosMain/kotlin/com/mifos/shared/App.ios.kt
+++ b/shared/src/iosMain/kotlin/com/mifos/shared/App.ios.kt
@@ -8,17 +8,22 @@ import platform.UIKit.UIViewController
fun MainViewController(
bioMetricUtil: BioMetricUtil,
- biometricViewModel: BiometricAuthorizationViewModel): UIViewController = ComposeUIViewController {
+ biometricViewModel: BiometricAuthorizationViewModel,
+ onPasscodeConfirm: () -> Unit,
+): UIViewController = ComposeUIViewController {
PasscodeScreen(
onPasscodeConfirm = {
+ onPasscodeConfirm()
},
onSkipButton = {
+ onPasscodeConfirm()
},
onForgotButton = {},
onPasscodeRejected = {},
bioMetricUtil = bioMetricUtil,
biometricAuthorizationViewModel = biometricViewModel,
onBiometricAuthSuccess = {
- }
+ onPasscodeConfirm()
+ }
)
}
\ No newline at end of file
diff --git a/shared/src/iosMain/kotlin/com/mifos/shared/Platform.ios.kt b/shared/src/iosMain/kotlin/com/mifos/shared/Platform.ios.kt
index a5dc26d..b8f4fce 100644
--- a/shared/src/iosMain/kotlin/com/mifos/shared/Platform.ios.kt
+++ b/shared/src/iosMain/kotlin/com/mifos/shared/Platform.ios.kt
@@ -3,8 +3,7 @@ package com.mifos.shared
import platform.UIKit.UIDevice
class IOSPlatform: Platform {
-// override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
- override val name: String = "Ios"
+ override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}
actual fun getPlatform(): Platform = IOSPlatform()
\ No newline at end of file