Thank you! A topic which I'd love to see as well, would be KMP with a multi-module app structure :) Would be super helpful, seeing this explained by you
In this example we create a controller object in a composable and then pass it to the viewmodel, whose lifecycle is longer living that the activity one. In a pure Android application that is a bad practice, since a configuration change can lead to problems. Am I missing something? Maybe in KMP the rules in this scenario are different than in pure Android?
Greetings from Brazil. Do you really think KMP is the future? I am speciallizing on it, very disciplined, programing everyday, but struggling to find remote jobs as I live in a small city. Should I keep trying?
Yeah main question, since the controller was bounded to the screen. Or we can do is using a Launched effect an providing an object of controller to the ViewModel. Hoping this would work.
@@PhilippLackner Consistency in project. Because in real projects we mostly use DI frameworks, and what if we need to inject some repositories or use cases as well to our ViewModel class?
Hi dude, I wanted to know which operating system is the best to use linux or windows? and after KMP, you write app for ios using swift or objective-c or you only Android dev?
you are the only reason i am learning kotlin instead of flutter
No kidding. My android journey started because of Philipp. My first project was inspired (basically copied) from his Running tracker app.
Thank you! Will you create video with firebase crashlytics and may be firebase push notification? Camera functionality is also interesting :)
Thank you! A topic which I'd love to see as well, would be KMP with a multi-module app structure :)
Would be super helpful, seeing this explained by you
Great video Philipppp! Should be great to find how to solve to manage multilang iOS param string from the kmp project instead xcode hardcoding :)
Amazing like always, ty ❤🙏
do the notification in CMP please
This is my way of handling the permission with the same library.
Inside the composable screen where you want to ask permission
val permissionHandler = rememberPermissionHandler()
when(permissionHandler.permissionState) {
PermissionState.Granted -> {}
PermissionState.DeniedAlways -> {
PermissionDeniedDialog(
onDismissRequest = {
},
onConfirmation = {
permissionHandler.openAppSetting()
}
)
}
else -> {
permissionHandler.requestPermission()
}
}
@Composable
fun rememberPermissionHandler(): PermissionHandler {
val scope = rememberCoroutineScope()
val factory = rememberPermissionsControllerFactory()
val controller = remember(factory) {
factory.createPermissionsController()
}
BindEffect(controller)
return remember(controller) {
PermissionHandler(
controller,
scope
)
}
}
@Stable
class PermissionHandler(
private val _controller: PermissionsController,
private val _scope: CoroutineScope,
) {
var permissionState by mutableStateOf(PermissionState.NotDetermined)
init {
_scope.launch {
permissionState = _controller.getPermissionState(Permission.LOCATION)
}
}
fun openAppSetting() {
_scope.launch {
_controller.openAppSettings()
}
}
fun requestPermission() {
_scope.launch {
try {
_controller.providePermission(Permission.LOCATION)
permissionState = PermissionState.Granted
} catch (e: DeniedAlwaysException) {
permissionState = PermissionState.DeniedAlways
} catch (e: DeniedException) {
permissionState = PermissionState.Denied
} catch (e: RequestCanceledException) {
e.printStackTrace()
}
}
}
}
In this example we create a controller object in a composable and then pass it to the viewmodel, whose lifecycle is longer living that the activity one. In a pure Android application that is a bad practice, since a configuration change can lead to problems. Am I missing something? Maybe in KMP the rules in this scenario are different than in pure Android?
Greetings from Brazil. Do you really think KMP is the future? I am speciallizing on it, very disciplined, programing everyday, but struggling to find remote jobs as I live in a small city. Should I keep trying?
Can this be implemented using DI koin?
Yeah main question, since the controller was bounded to the screen. Or we can do is using a Launched effect an providing an object of controller to the ViewModel. Hoping this would work.
What would be the benefit of doing that?
@@PhilippLackner Consistency in project. Because in real projects we mostly use DI frameworks, and what if we need to inject some repositories or use cases as well to our ViewModel class?
@PhilippLackner i already create my ViewModel in Koin because of other dependencies, that would be the benefit
Is it necessary for app to be relaunched on IOS for it to get permission acceptance changes?
Hi dude, I wanted to know which operating system is the best to use linux or windows? and after KMP, you write app for ios using swift or objective-c or you only Android dev?
And yes, thank you for the video
Can you do front lever?
The button don't get hidden when we back from setting to the app we have to relaunch the app to update state.
How can we take multiple permission on single click: like for Location and Storage?
Dispointed when got to know No ConstraintLayout in CMP.
@@swapniljadhav1296 I don't think I ever used that in compose in my life 😅
@@PhilippLackner ConstraintLayout reduces layers and gives more control.
first
Thank You , I Think it`s Time To Local Database And Show Notifications so all the basics is covered 🫶