-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Share Extension] Move away from deprecated API, implement JS side of things #5509
Conversation
while responder != nil { | ||
if let application = responder as? UIApplication { | ||
return application.perform(#selector(openURL(_:)), with: url) != nil | ||
application.open(url) | ||
return true | ||
} | ||
responder = responder?.next |
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.
openURL
is deprecated now, we'll just use application.open()
instead.
|
|
||
const selectVideo = (asset: ImagePickerAsset) => { | ||
// compression step on native converts to mp4, so no need to check there | ||
if (isWeb) { | ||
const mimeType = getMimeType(asset) | ||
if (!SUPPORTED_MIME_TYPES.includes(mimeType as SupportedMimeTypes)) { | ||
throw new Error(_(msg`Unsupported video type: ${mimeType}`)) | ||
const selectVideo = React.useCallback( | ||
(asset: ImagePickerAsset) => { | ||
// compression step on native converts to mp4, so no need to check there | ||
if (isWeb) { | ||
const mimeType = getMimeType(asset) | ||
if (!SUPPORTED_MIME_TYPES.includes(mimeType as SupportedMimeTypes)) { | ||
throw new Error(_(msg`Unsupported video type: ${mimeType}`)) | ||
} | ||
} | ||
} | ||
|
||
dispatch({ | ||
type: 'SetAsset', | ||
asset, | ||
}) | ||
onSelectVideo(asset) | ||
} | ||
dispatch({ | ||
type: 'SetAsset', | ||
asset, | ||
}) | ||
onSelectVideo(asset) | ||
}, | ||
[_, onSelectVideo], | ||
) |
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.
No change here, just wrapping in useCallback
for the effect below
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.
Not tested but read through it and seems ok
No description provided.