Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple permission #122

Open
fjr619 opened this issue Jul 1, 2024 · 3 comments
Open

Multiple permission #122

fjr619 opened this issue Jul 1, 2024 · 3 comments

Comments

@fjr619
Copy link

fjr619 commented Jul 1, 2024

Hi may i get example how to handle multiple permissions with moko? do i need create multiple controller for that too?

@Alex009
Copy link
Member

Alex009 commented Jul 1, 2024

just call providePermission multiple times

class ViewModel(val permissionsController: PermissionsController): ViewModel() {
    fun onPhotoPressed() {
        viewModelScope.launch {
            try {
                permissionsController.providePermission(Permission.GALLERY)
                permissionsController.providePermission(Permission.CAMERA)
                // Permission has been granted successfully.
            } catch(deniedAlways: DeniedAlwaysException) {
                // Permission is always denied.
            } catch(denied: DeniedException) {
                // Permission was denied.
            }
        }
    }
}

@andiosdev
Copy link

@Alex009
Is the same applies if its for location permission?

@Alex009
Copy link
Member

Alex009 commented Jul 22, 2024

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants