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
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b700022
Merge pull request #2 from sindresorhus/master
Sep 8, 2019
5e29232
Merge pull request #3 from sindresorhus/master
Sep 11, 2019
87cabf2
Initial share work
Oct 30, 2019
4514204
Merge branch 'master' of https://github.com/sindresorhus/Gifski
Oct 30, 2019
6fe466b
Finish share extension
Oct 30, 2019
f24a533
Remove non used error
Oct 31, 2019
b51dcc2
Update loadingHtml.html
sindresorhus Nov 1, 2019
5852d4a
Update Share with Gifski/Info.plist
Nov 1, 2019
d9e5a64
Remove WebView, use NSWorkspace
Nov 1, 2019
f77bbb7
Move FileManager calls out of synced queue
Nov 1, 2019
541a7ff
Only allow certain types of videos to be shared
Nov 1, 2019
6aec5b2
Development team
Nov 1, 2019
38f362d
Only allow one item to be shared
Nov 1, 2019
47f1ac2
Add Share extension to readme
Nov 8, 2019
bad4483
Update util.swift
sindresorhus Nov 9, 2019
c34f0b2
Update readme.md
sindresorhus Nov 9, 2019
89e309f
Update Info.plist
sindresorhus Nov 9, 2019
57c859c
Update ShareViewController.swift
sindresorhus Nov 9, 2019
2ac5789
Update project.pbxproj
sindresorhus Nov 9, 2019
8b5c497
Change deployment target to 10.13
Nov 9, 2019
e3a281f
Tab indentation for Info.plis
Nov 9, 2019
9300ba8
Pass error message to main app
Nov 9, 2019
f113f1e
Update error function name
Nov 9, 2019
241ac74
Remove force unwraps
Nov 9, 2019
28ec17a
Remove default icon
Nov 9, 2019
865cd35
Remove force unwrappings
Nov 9, 2019
55c110e
Change bundle identifier for share extension
Nov 9, 2019
02cd095
Rename Share with Gifski to ShareExtension
Nov 9, 2019
e1dbec8
Remove network entitlement from share extension
Nov 9, 2019
c487d05
Remove security entitlement
Nov 9, 2019
afd5816
Change Shared to The shared
Nov 9, 2019
61f6755
Change url with query generation
Nov 9, 2019
dd184c9
Change entitlements file name
Nov 9, 2019
103aa72
Update project.pbxproj
sindresorhus Nov 9, 2019
3028755
Update ShareExtension/ShareViewController.swift
Nov 9, 2019
870380a
Swiftlint disable false positive
Nov 9, 2019
457ac5c
Merge branch 'master' of github.com:Ybrin/Gifski
Nov 9, 2019
46922a5
Handle share extension error in the extension
Nov 9, 2019
b349fcd
Change ununsed error handling from main app
Nov 9, 2019
dd9b369
Update ShareViewController.swift
sindresorhus Nov 9, 2019
e964bcf
Update project.pbxproj
sindresorhus Nov 10, 2019
df0d4e2
Update Info.plist
sindresorhus Nov 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
181 changes: 180 additions & 1 deletion Gifski.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,11 @@
objects = {

/* Begin PBXBuildFile section */
0E79251E2329BDBE00058B94 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 0E79251D2329BDBE00058B94 /* icon.icns */; };
0E7925202329BDBE00058B94 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E79251F2329BDBE00058B94 /* ShareViewController.swift */; };
0E7925232329BDBE00058B94 /* ShareViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E7925212329BDBE00058B94 /* ShareViewController.xib */; };
0E7925282329BDBE00058B94 /* Share with Gifski.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 0E79251B2329BDBE00058B94 /* Share with Gifski.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
0EE30AA4236A41CA0083B745 /* loadingHtml.html in Resources */ = {isa = PBXBuildFile; fileRef = 0EE30AA3236A41CA0083B745 /* loadingHtml.html */; };
6D86841721FD283B0044F6FE /* ConversionCompletedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D86841121FD283B0044F6FE /* ConversionCompletedViewController.swift */; };
6D86841821FD283B0044F6FE /* DraggableFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D86841621FD283B0044F6FE /* DraggableFile.swift */; };
8548806522B78E8300E97401 /* IntTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8548806422B78E8300E97401 /* IntTextField.swift */; };
Expand Down Expand Up @@ -46,6 +51,13 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
0E7925262329BDBE00058B94 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E3AE627B1E5CD2F300035A2F /* Project object */;
proxyType = 1;
remoteGlobalIDString = 0E79251A2329BDBE00058B94;
remoteInfo = "Share with Gifski";
};
E3807B5A22BE315A00388F50 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5A7524AD20D085FB00F12C99 /* gifski.xcodeproj */;
Expand All @@ -70,6 +82,17 @@
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
0E7925292329BDBE00058B94 /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
0E7925282329BDBE00058B94 /* Share with Gifski.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
E34798D21F882FB3003F9142 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -83,6 +106,13 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0E79251B2329BDBE00058B94 /* Share with Gifski.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Share with Gifski.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
0E79251D2329BDBE00058B94 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = "<group>"; };
0E79251F2329BDBE00058B94 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
0E7925222329BDBE00058B94 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ShareViewController.xib; sourceTree = "<group>"; };
0E7925242329BDBE00058B94 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0E7925252329BDBE00058B94 /* Share_with_Gifski.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Share_with_Gifski.entitlements; sourceTree = "<group>"; };
0EE30AA3236A41CA0083B745 /* loadingHtml.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = loadingHtml.html; sourceTree = "<group>"; };
5A7524AD20D085FB00F12C99 /* gifski.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = gifski.xcodeproj; path = "gifski-api/gifski.xcodeproj"; sourceTree = "<group>"; };
6D86841121FD283B0044F6FE /* ConversionCompletedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConversionCompletedViewController.swift; sourceTree = "<group>"; usesTabs = 1; };
6D86841621FD283B0044F6FE /* DraggableFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DraggableFile.swift; sourceTree = "<group>"; usesTabs = 1; };
Expand Down Expand Up @@ -127,6 +157,13 @@
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
0E7925182329BDBE00058B94 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
E3AE62801E5CD2F300035A2F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -140,6 +177,19 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
0E79251C2329BDBE00058B94 /* Share with Gifski */ = {
isa = PBXGroup;
children = (
0E79251D2329BDBE00058B94 /* icon.icns */,
0E79251F2329BDBE00058B94 /* ShareViewController.swift */,
0E7925212329BDBE00058B94 /* ShareViewController.xib */,
0EE30AA3236A41CA0083B745 /* loadingHtml.html */,
0E7925242329BDBE00058B94 /* Info.plist */,
0E7925252329BDBE00058B94 /* Share_with_Gifski.entitlements */,
);
path = "Share with Gifski";
sourceTree = "<group>";
};
5A7524AE20D085FB00F12C99 /* Products */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -189,6 +239,7 @@
isa = PBXGroup;
children = (
E3AE62851E5CD2F300035A2F /* Gifski */,
0E79251C2329BDBE00058B94 /* Share with Gifski */,
E3AE62841E5CD2F300035A2F /* Products */,
E317EE121F88305800359C57 /* Frameworks */,
5A7524AD20D085FB00F12C99 /* gifski.xcodeproj */,
Expand All @@ -200,6 +251,7 @@
isa = PBXGroup;
children = (
E3AE62831E5CD2F300035A2F /* Gifski.app */,
0E79251B2329BDBE00058B94 /* Share with Gifski.appex */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -241,6 +293,23 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
0E79251A2329BDBE00058B94 /* Share with Gifski */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0E7925302329BDBE00058B94 /* Build configuration list for PBXNativeTarget "Share with Gifski" */;
buildPhases = (
0E7925172329BDBE00058B94 /* Sources */,
0E7925182329BDBE00058B94 /* Frameworks */,
0E7925192329BDBE00058B94 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Share with Gifski";
productName = "Share with Gifski";
productReference = 0E79251B2329BDBE00058B94 /* Share with Gifski.appex */;
productType = "com.apple.product-type.app-extension";
};
E3AE62821E5CD2F300035A2F /* Gifski */ = {
isa = PBXNativeTarget;
buildConfigurationList = E3AE62901E5CD2F300035A2F /* Build configuration list for PBXNativeTarget "Gifski" */;
Expand All @@ -251,10 +320,12 @@
E3AE62811E5CD2F300035A2F /* Resources */,
E34798D21F882FB3003F9142 /* Embed Frameworks */,
E3A9400C2182D718006981D5 /* Crashlytics */,
0E7925292329BDBE00058B94 /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
0E7925272329BDBE00058B94 /* PBXTargetDependency */,
);
name = Gifski;
productName = "HEIC Converter";
Expand All @@ -267,10 +338,13 @@
E3AE627B1E5CD2F300035A2F /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Sindre Sorhus";
TargetAttributes = {
0E79251A2329BDBE00058B94 = {
CreatedOnToolsVersion = 11.0;
};
E3AE62821E5CD2F300035A2F = {
CreatedOnToolsVersion = 8.2.1;
LastSwiftMigration = 1020;
Expand Down Expand Up @@ -305,6 +379,7 @@
projectRoot = "";
targets = (
E3AE62821E5CD2F300035A2F /* Gifski */,
0E79251A2329BDBE00058B94 /* Share with Gifski */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -334,6 +409,16 @@
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
0E7925192329BDBE00058B94 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0E7925232329BDBE00058B94 /* ShareViewController.xib in Resources */,
0E79251E2329BDBE00058B94 /* icon.icns in Resources */,
0EE30AA4236A41CA0083B745 /* loadingHtml.html in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
E3AE62811E5CD2F300035A2F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -387,6 +472,14 @@
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
0E7925172329BDBE00058B94 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0E7925202329BDBE00058B94 /* ShareViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
E3AE627F1E5CD2F300035A2F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -424,7 +517,23 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
0E7925272329BDBE00058B94 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 0E79251A2329BDBE00058B94 /* Share with Gifski */;
targetProxy = 0E7925262329BDBE00058B94 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
0E7925212329BDBE00058B94 /* ShareViewController.xib */ = {
isa = PBXVariantGroup;
children = (
0E7925222329BDBE00058B94 /* Base */,
);
name = ShareViewController.xib;
sourceTree = "<group>";
};
E3AE628A1E5CD2F300035A2F /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
Expand All @@ -436,6 +545,65 @@
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
0E79252A2329BDBE00058B94 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Share with Gifski/Share_with_Gifski.entitlements";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = YG56YK5RN5;
ENABLE_HARDENED_RUNTIME = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share with Gifski/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
koraykoska marked this conversation as resolved.
Show resolved Hide resolved
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.sindresorhus.Gifski.Share-with-Gifski";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
0E79252B2329BDBE00058B94 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "Share with Gifski/Share_with_Gifski.entitlements";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = YG56YK5RN5;
ENABLE_HARDENED_RUNTIME = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "Share with Gifski/Info.plist";
koraykoska marked this conversation as resolved.
Show resolved Hide resolved
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.sindresorhus.Gifski.Share-with-Gifski";
koraykoska marked this conversation as resolved.
Show resolved Hide resolved
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
E3AE628E1E5CD2F300035A2F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -551,6 +719,7 @@
E3AE62911E5CD2F300035A2F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Gifski/Gifski.entitlements;
Expand Down Expand Up @@ -590,6 +759,7 @@
E3AE62921E5CD2F300035A2F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Gifski/Gifski.entitlements;
Expand Down Expand Up @@ -627,6 +797,15 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
0E7925302329BDBE00058B94 /* Build configuration list for PBXNativeTarget "Share with Gifski" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0E79252A2329BDBE00058B94 /* Debug */,
0E79252B2329BDBE00058B94 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E3AE627E1E5CD2F300035A2F /* Build configuration list for PBXProject "Gifski" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
11 changes: 9 additions & 2 deletions Gifski/AppDelegate.swift
Expand Up @@ -54,13 +54,20 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
return
}

var sharedVideoUrl = videoUrl
if videoUrl.queryParameters["shareExtension"] == "true" {
let appIdentifierPrefix = Bundle.main.infoDictionary!["AppIdentifierPrefix"] as! String
let appGroupShareVideUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "\(appIdentifierPrefix).gifski_video_share_group")?.appendingPathComponent(videoUrl.host!.removingPercentEncoding!)
sharedVideoUrl = appGroupShareVideUrl!
}

// TODO: Simplify this. Make a function that calls the input when the app finished launching, or right away if it already has.
if hasFinishedLaunching {
mainWindowController.convert(videoUrl)
mainWindowController.convert(sharedVideoUrl.absoluteURL)
} else {
// This method is called before `applicationDidFinishLaunching`,
// so we buffer it up a video is "Open with" this app
urlToConvertOnLaunch = videoUrl
urlToConvertOnLaunch = sharedVideoUrl.absoluteURL
}
}

Expand Down
4 changes: 4 additions & 0 deletions Gifski/Gifski.entitlements
Expand Up @@ -4,6 +4,10 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(TeamIdentifierPrefix).gifski_video_share_group</string>
</array>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
Expand Down
15 changes: 15 additions & 0 deletions Gifski/Info.plist
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppIdentifierPrefix</key>
<string>$(AppIdentifierPrefix)</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDocumentTypes</key>
Expand Down Expand Up @@ -37,6 +39,19 @@
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>com.sindresorhus.Gifski</string>
<key>CFBundleURLSchemes</key>
<array>
<string>gifski</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>Fabric</key>
Expand Down