-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf43d35
commit 46f92d0
Showing
142 changed files
with
884 additions
and
893 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../src/androidMain/kotlin/org/michaelbel/movies/common/biometric/di/BiometricKoinModule2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.di | ||
|
||
import org.koin.core.module.dsl.bind | ||
import org.koin.core.module.dsl.singleOf | ||
import org.koin.dsl.module | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
import org.michaelbel.movies.common.biometric.impl.BiometricControllerImpl2 | ||
|
||
actual val biometricKoinModule2 = module { | ||
singleOf(::BiometricControllerImpl2) { bind<BiometricController2>() } | ||
} |
19 changes: 19 additions & 0 deletions
19
...ndroidMain/kotlin/org/michaelbel/movies/common/biometric/impl/BiometricControllerImpl2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.michaelbel.movies.common.biometric.impl | ||
|
||
import android.content.Context | ||
import androidx.biometric.BiometricManager | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flowOf | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
|
||
internal class BiometricControllerImpl2( | ||
private val context: Context | ||
): BiometricController2 { | ||
|
||
override val isBiometricAvailable: Flow<Boolean> | ||
get() { | ||
val biometricManager = BiometricManager.from(context) | ||
val authenticators = biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG or BiometricManager.Authenticators.DEVICE_CREDENTIAL) | ||
return flowOf(authenticators == BiometricManager.BIOMETRIC_SUCCESS) | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
core/common/src/androidMain/kotlin/org/michaelbel/movies/common/ktx/LogKtx.kt
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
core/common/src/androidMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...mmon/src/commonMain/kotlin/org/michaelbel/movies/common/biometric/BiometricController2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.michaelbel.movies.common.biometric | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface BiometricController2 { | ||
|
||
val isBiometricAvailable: Flow<Boolean> | ||
} |
5 changes: 5 additions & 0 deletions
5
...n/src/commonMain/kotlin/org/michaelbel/movies/common/biometric/di/BiometricKoinModule2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.michaelbel.movies.common.biometric.di | ||
|
||
import org.koin.core.module.Module | ||
|
||
expect val biometricKoinModule2: Module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...mmon/src/iosMain/kotlin/org/michaelbel/movies/common/biometric/di/BiometricKoinModule2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.di | ||
|
||
import org.koin.core.module.dsl.bind | ||
import org.koin.core.module.dsl.singleOf | ||
import org.koin.dsl.module | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
import org.michaelbel.movies.common.biometric.impl.BiometricControllerImpl2 | ||
|
||
actual val biometricKoinModule2 = module { | ||
singleOf(::BiometricControllerImpl2) { bind<BiometricController2>() } | ||
} |
11 changes: 11 additions & 0 deletions
11
...rc/iosMain/kotlin/org/michaelbel/movies/common/biometric/impl/BiometricControllerImpl2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.impl | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flowOf | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
|
||
internal class BiometricControllerImpl2: BiometricController2 { | ||
|
||
override val isBiometricAvailable: Flow<Boolean> | ||
get() = flowOf(false) | ||
} |
18 changes: 0 additions & 18 deletions
18
core/common/src/iosMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
...ommon/src/jsMain/kotlin/org/michaelbel/movies/common/biometric/di/BiometricKoinModule2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.di | ||
|
||
import org.koin.core.module.dsl.bind | ||
import org.koin.core.module.dsl.singleOf | ||
import org.koin.dsl.module | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
import org.michaelbel.movies.common.biometric.impl.BiometricControllerImpl2 | ||
|
||
actual val biometricKoinModule2 = module { | ||
singleOf(::BiometricControllerImpl2) { bind<BiometricController2>() } | ||
} |
11 changes: 11 additions & 0 deletions
11
...src/jsMain/kotlin/org/michaelbel/movies/common/biometric/impl/BiometricControllerImpl2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.impl | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flowOf | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
|
||
internal class BiometricControllerImpl2: BiometricController2 { | ||
|
||
override val isBiometricAvailable: Flow<Boolean> | ||
get() = flowOf(false) | ||
} |
18 changes: 0 additions & 18 deletions
18
core/common/src/jsMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
...mmon/src/jvmMain/kotlin/org/michaelbel/movies/common/biometric/di/BiometricKoinModule2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.di | ||
|
||
import org.koin.core.module.dsl.bind | ||
import org.koin.core.module.dsl.singleOf | ||
import org.koin.dsl.module | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
import org.michaelbel.movies.common.biometric.impl.BiometricControllerImpl2 | ||
|
||
actual val biometricKoinModule2 = module { | ||
singleOf(::BiometricControllerImpl2) { bind<BiometricController2>() } | ||
} |
11 changes: 11 additions & 0 deletions
11
...rc/jvmMain/kotlin/org/michaelbel/movies/common/biometric/impl/BiometricControllerImpl2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.impl | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flowOf | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
|
||
internal class BiometricControllerImpl2: BiometricController2 { | ||
|
||
override val isBiometricAvailable: Flow<Boolean> | ||
get() = flowOf(false) | ||
} |
11 changes: 11 additions & 0 deletions
11
...n/src/wasmJsMain/kotlin/org/michaelbel/movies/common/biometric/di/BiometricKoinModule2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.di | ||
|
||
import org.koin.core.module.dsl.bind | ||
import org.koin.core.module.dsl.singleOf | ||
import org.koin.dsl.module | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
import org.michaelbel.movies.common.biometric.impl.BiometricControllerImpl2 | ||
|
||
actual val biometricKoinModule2 = module { | ||
singleOf(::BiometricControllerImpl2) { bind<BiometricController2>() } | ||
} |
11 changes: 11 additions & 0 deletions
11
...wasmJsMain/kotlin/org/michaelbel/movies/common/biometric/impl/BiometricControllerImpl2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.michaelbel.movies.common.biometric.impl | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flowOf | ||
import org.michaelbel.movies.common.biometric.BiometricController2 | ||
|
||
internal class BiometricControllerImpl2: BiometricController2 { | ||
|
||
override val isBiometricAvailable: Flow<Boolean> | ||
get() = flowOf(false) | ||
} |
18 changes: 0 additions & 18 deletions
18
core/common/src/wasmJsMain/kotlin/org/michaelbel/movies/common/viewmodel/BaseViewModel.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...cations/src/androidMain/kotlin/org/michaelbel/movies/notifications/ktx/NotificationKtx.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.michaelbel.movies.notifications.ktx | ||
|
||
import android.Manifest | ||
import android.app.Activity | ||
import android.os.Build | ||
import androidx.activity.compose.rememberLauncherForActivityResult | ||
import androidx.activity.result.contract.ActivityResultContracts | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.LocalContext | ||
import org.michaelbel.movies.ui.ktx.appNotificationSettingsIntent | ||
|
||
@Composable | ||
fun rememberPostNotificationsPermissionHandler( | ||
areNotificationsEnabled: Boolean, | ||
onPermissionGranted: () -> Unit, | ||
onPermissionDenied: () -> Unit | ||
): () -> Unit { | ||
val context = LocalContext.current | ||
val postNotificationsPermissionLauncher = rememberLauncherForActivityResult( | ||
ActivityResultContracts.RequestPermission() | ||
) { granted -> | ||
when { | ||
granted -> onPermissionGranted() | ||
else -> { | ||
if (Build.VERSION.SDK_INT >= 33) { | ||
val shouldRequest = (context as Activity).shouldShowRequestPermissionRationale( | ||
Manifest.permission.POST_NOTIFICATIONS) | ||
if (!shouldRequest) { | ||
onPermissionDenied() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
val resultContract = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) {} | ||
return { | ||
if (areNotificationsEnabled) { | ||
val intent = context.appNotificationSettingsIntent | ||
resultContract.launch(intent) | ||
} else if (Build.VERSION.SDK_INT >= 33) { | ||
postNotificationsPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.