appcues / appcues-ios-sdk

The Appcues iOS SDK
https://www.appcues.com/mobile
MIT License
8 stars 2 forks source link

Determine push attachment file type using file mime type #522

Closed mmaatttt closed 5 months ago

mmaatttt commented 5 months ago

Removing the requirement for appcues_attachment_type.

URLSession.downloadTask(with:completionHandler:) is almost as easy as Data(contentsOf:). It creates a download task that saves the results to a file which we can copy to our attachment with the mime type of the URLResponse. Using UTType means we don't need a hardcoded map of mime types to file extensions (even if the pre-ios 14 fallback is a bit ugly).