Skip to content
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

Add share extension #156

Merged
merged 42 commits into from Nov 10, 2019
Merged

Add share extension #156

merged 42 commits into from Nov 10, 2019

Conversation

koraykoska
Copy link
Contributor

@koraykoska koraykoska commented Oct 30, 2019

Fixes #81

I am using a "hack" by saving the shared video in an app container and opening the main application with the help of a WebView in the share extension view.
The share extension is closed once Gifski is opened. This is a little bit ugly right now as you can see the empty share extension for a few moments. I don't see another workaround as the WebView needs some time to open Gifski.
I added a simple CSS loading animation into the WebView so it doesn't look too ugly while loading, especially if the file shared is rather big and the copy process takes a few more moments.

The rest is handled by Gifski as it was always. The URL is opened and Gifski starts the Edit process.


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@koraykoska
Copy link
Contributor Author

@sindresorhus @sunshinejr

@koraykoska
Copy link
Contributor Author

Btw, I am using the hack because share extensions are actually not made for things like opening the main application. They are more like for messenger apps sharing posts or something...

I saw that most non-messenger apps solve it like that so I guess it should be fine. Even if it is technically a hack...

Share with Gifski/loadingHtml.html Outdated Show resolved Hide resolved
Share with Gifski/loadingHtml.html Outdated Show resolved Hide resolved
Share with Gifski/Share_with_Gifski.entitlements Outdated Show resolved Hide resolved
Share with Gifski/Info.plist Outdated Show resolved Hide resolved
Share with Gifski/Info.plist Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Co-Authored-By: Sindre Sorhus <sindresorhus@gmail.com>
@koraykoska
Copy link
Contributor Author

@sindresorhus The open function of NSExtensionContext cannot be used from a share extension. It's stated in the docs that only some extensions are allowed to use it. That's the reason for the WebView workaround

@sindresorhus
Copy link
Owner

@koraykoska
Copy link
Contributor Author

Ok NSWorkspace.shared.open works...i will delete the WebView stuff then...

@koraykoska
Copy link
Contributor Author

@sindresorhus Done. I guess I got everything you mentioned.

@sindresorhus
Copy link
Owner

Can you mention the feature in the readme here: https://github.com/sindresorhus/Gifski#features

And also a quick guide on how to use it for screen recording purposes? As described in #81. Maybe in a Tips section.

Describes how to use the share extension. Especially for screen
recordings.
@koraykoska
Copy link
Contributor Author

@sindresorhus Done. I included the tip for the screen recordings directly into the features section. This is quite on the top of the readme, which is a great place for this feature.

@koraykoska
Copy link
Contributor Author

@sindresorhus I am done with your suggestions. I think I didn't forget anything.

@sindresorhus
Copy link
Owner

Regarding #156 (comment), you could just present a simple error view with a text field and a OK button in ShareViewController.

@koraykoska
Copy link
Contributor Author

@sindresorhus I changed it. The error will now be shown directly in the extension view and not redirected to the main app.

@sindresorhus sindresorhus merged commit 3771fc0 into sindresorhus:master Nov 10, 2019
@sindresorhus
Copy link
Owner

Looks good to me now. Really nice work, @Ybrin 👍

sindresorhus added a commit that referenced this pull request Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Share extension
2 participants