-
Notifications
You must be signed in to change notification settings - Fork 4
Improved navigation and permissions #7
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
Closed
Closed
Conversation
This file contains hidden or 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
Member
Author
|
TODO:
|
Member
Author
|
Latest changes:
Questions:
|
navigation/src/main/java/no/nordicsemi/android/common/navigation/NavigationDestination.kt
Outdated
Show resolved
Hide resolved
navigation/src/main/java/no/nordicsemi/android/common/navigation/Navigator.kt
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains redesigned implementation of Navigation module and improvements in Permissions module.
Navigation
The navigation module has been redesigned with the same principles in mind:
NavigationView.DestinationId.Issues in the old implementation
DestinationId.The issue was, that sometimes destinations were defined in separate modules and were independent from each other.
ViewModel.The issue was, that although the
route(ID) of the destination was saved byNavHostControllerinSavedStateHandleand recreated after the app was killed, the arguments and results were not.New implementation
DestinationId. A new helper method is added to make it easier:Router, which takes the ID of the current destination and an optional hint, and returns the nextDestinationId:NavigationView:navigator.navigate(hint, args)are saved inSavedStateHandleof the target destination and are preserved in configuration changes, or when the app is killed by the system to release resources. They are also available inViewModels created in the target destination when Hilt dependency injection is used, usingSavedStateHandle.Navigatorobject in the view models. This object allows to navigate to another destination (which is determined by theRouter) passing an argument. It also allows to suspend for result.Permissions
These are the main changes:
RequireBluetooth(scanning: Bool, ...)was split into 2:RequireBluetoothRequireLocation- this is required for scanning for Bluetooth LE devices. On Android 12+ it always assumes the location is granted, as it is no longer required for scanning. At least for most of the devices (it is needed for iBeacons and Eddystone).RequireBluetoothand disabling displaying default "No Bluetooth" views by settingcontentWithoutBluetoothparameter to an empty composable. by default it will showNoBluetoothView.RequireLocationandRequireInternet.