fix(camera): Allow cancelation of sheet in Web#2284
Open
OS-pedrogustavobilro wants to merge 3 commits intoionic-team:mainfrom
Open
fix(camera): Allow cancelation of sheet in Web#2284OS-pedrogustavobilro wants to merge 3 commits intoionic-team:mainfrom
OS-pedrogustavobilro wants to merge 3 commits intoionic-team:mainfrom
Conversation
To be aligned with Android and iOS platforms
alexgerardojacinto
approved these changes
Dec 16, 2024
OS-ricardomoreirasilva
approved these changes
Dec 17, 2024
Member
|
The reason why it's not cancelable on web is because pwa-elements action sheet doesn't provide any event to indicate the cancelation, so allowing to cancel the action sheet will make the camera plugin call to hang as it won't reject nor resolve. So for making the prompt cancelable, pwa-elements action sheet should be updated to emit an event on the cancellation and in camera plugin listen for that event to reject the call with an error as iOS and Android do. |
Contributor
Author
|
@jcesarmobile -> opened a PR for pwa-elements to add an event listener for when the action sheet is dismissed - ionic-team/pwa-elements#138 Then, in this PR, will add the equivalent cancelation that's already present on native Android and iOS. actionSheet.addEventListener('onCanceled', async () => {
reject(new CapacitorException('User cancelled photos app'));
}) |
alexgerardojacinto
approved these changes
Dec 18, 2024
OS-ricardomoreirasilva
approved these changes
Dec 18, 2024
This comment was marked as abuse.
This comment was marked as abuse.
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
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.
The
actionSheetprompt was previously not cancellable in Web, even though it is cancellablesetCancelable(false)not called, by default it is cancelableUIAlertActionwith stylecancelallows sheet to be canceled when clicking outside.This PR fixes that.
Addresses #2241 and ionic-team/pwa-elements#134