brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.97k stars 2.35k forks source link

Handle `data` scheme URLs for calendar invites #36595

Open kylehickinson opened 12 months ago

kylehickinson commented 12 months ago

Description:

Some sites use data:text/calendar urls to handle calendar invites.

Brave currently does not support data URLs in general (brave/brave-ios#666) but to add to that, we currently handle calendar invites by presenting a SFSafariViewController to handle the load and present the appropriate UI. This is unfortunately not possible to handle with data URLs as SFSafariViewController only supports http/https schemes.

~One possible workaround is write the data in the URL (after the data:text/calendar prefix) to disk as a ics file and presenting it via QuickLook or the share sheet, at which point iOS may be able to show the appropriate flow for the calendar invite.~ This has been tested and does not work.

Another possible way would be to parse the actual invite and present an EKEventEditViewController. This will require a write-only permission prompt on iOS 16 and below, but on iOS 17 will be permission-free

soner-yuksel commented 11 months ago

Just curious is NSContactsUsageDescription and NSCalendarsUsageDescription is not necessary on iOS17?

kylehickinson commented 11 months ago

We would only need NSCalendarsWriteOnlyAccessUsageDescription and it would only actually be used on iOS 15 & 16, the reason being that EKEventEditViewController runs in a separate process in iOS 17 and no longer requires a permission prompt. Described here: https://developer.apple.com/videos/play/wwdc2023/10052/?time=296

More info here: https://developer.apple.com/documentation/eventkit/accessing_the_event_store