classViewModel(val permissionsController: PermissionsController): ViewModel() {
funonPhotoPressed() {
viewModelScope.launch {
try {
permissionsController.providePermission(Permission.GALLERY)
// Permission has been granted successfully.
} catch(deniedAlways: DeniedAlwaysException) {
// Permission is always denied.
} catch(denied: DeniedException) {
// Permission was denied.
}
}
}
}
Android:
overridefunonCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val viewModel = getViewModel {
// Pass the platform implementation of the permission controller to a common code.
ViewModel(PermissionsController())
}
// Binds the permissions controller to the activity lifecycle.
viewModel.permissionsController.bind(activity)
}
Compose:
@ComposablefunTestScreen() {
val viewModel = getViewModel {
// Pass the platform implementation of the permission controller to a common code.
ViewModel(PermissionsController())
}
// Binds the permissions controller to the LocalLifecycleOwner lifecycle.
BindEffect(viewModel.permissionsController)
}
iOS:
// Just pass the platform implementation of the permission controller to a common code.let viewModel =ViewModel(permissionsController: PermissionsController())
In sample directory contains samples on android, ios & mpp-library connected to apps.
Contributing
All development (both new features and bug fixes) is performed in develop branch. This way master sources always contain sources of the most recently released version. Please send PRs with bug fixes to develop branch. Fixes to documentation in markdown files are an exception to this rule. They are updated directly in master.
The develop branch is pushed to master during release.
Copyright 2019 IceRock MAG Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
Unknown package
We found that dev.icerock.moko:permissions-compose demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 0 open source maintainers collaborating on the project.
Package last updated on 17 Oct 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.