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

[NO ISSUE] Replaced deprecated onActivityResult method with the new activity result launcher #352

Merged
merged 5 commits into from
Aug 30, 2022

Conversation

ferranpons
Copy link
Member

ISSUE

No Issue

Description

We have replaced the deprecated "startActivityForResult" method with the new activity result launcher.

Screenshots

No screens

Mandatory GIF

mandatory

@ferranpons ferranpons self-assigned this Aug 30, 2022
@ferranpons ferranpons changed the title No issue replaced old on activity result [NO ISSUE] Replaced deprecated onActivityResult method with the new activity result launcher Aug 30, 2022
Comment on lines 77 to 82
lekuActivityResultLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
if (result.resultCode == Activity.RESULT_OK) {
onResult(result.resultCode, result.data)
} else {
Log.d("RESULT****", "CANCELLED")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActivityResultLaunchers are usually initialized on the property definition, so you can avoid using late init var and use a val.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. Applied the changes. Many thanks!

@ferranpons ferranpons merged commit 9df9769 into master Aug 30, 2022
@delete-merged-branch delete-merged-branch bot deleted the NO-ISSUE-replaced-old-onActivityResult branch August 30, 2022 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants