-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Checking the pasteboard for dynamic links in ios14 #5905
Conversation
}]; | ||
|
||
} else { | ||
pasteboardContents = [UIPasteboard generalPasteboard].string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line alone will trigger the notification to be displayed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the line 306 will be executed only on iOS < 10 therefore no popup.
Still the line 303 will trigger a popup, but I guess the point was to just "reduce" the popups (check the Changelog
} | ||
dispatch_semaphore_signal(semaphore); | ||
}]; | ||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about using a completion handler for retrievePasteboardContents instead of waiting and returning a string from this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is a valid approach too but Im not sure how that would change the initial call here. It might require more refactoring for that method, which im not sure is worth it considering this proposal PR is not really a fix. Im not too sharp at handling async methods in objc c though so if you can make it cleaner, feel free! 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For proposal PR it should be fine. Otherwise as you can see, this method will get called from app start up and we don't want to freeze the app by waiting here to check the pasteboard.
This change LGTM - I tested myself that the |
Please wait for @eldhosembabu review before merging @ncooke3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes looks good to me
Please add the change log entry before merging. |
* Checking the first pasteboard item in ios14 * Cleaned up method and added ifdef * Renamed variable * Style * Refactored method * Using another url detecting api * Made sure pasteboardContents is initialized * Changelog * Update Changelog * Removed trailing space
In iOS14, a notification will be be displayed to the user whenever an app reads from the pasteboard. Since dynamic links reads from the pasteboard at launch, it will cause this notification. Using the UIPasteboard's new
detectPatternsForPatterns:
api, we can try detecting if the pasteboard contains a dynamic link as its first item so we don't trigger the notification needlessly.Draft PR following up on #5893