diff --git a/.gitignore b/.gitignore index b517252..18e7881 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,4 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output +chrome-extension/test.html diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/PIP.framework/PIP b/PIP.framework/PIP new file mode 120000 index 0000000..f8a9503 --- /dev/null +++ b/PIP.framework/PIP @@ -0,0 +1 @@ +Versions/Current/PIP \ No newline at end of file diff --git a/PIP.framework/Resources b/PIP.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/PIP.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/PIP.framework/Versions/A/PIP b/PIP.framework/Versions/A/PIP new file mode 100755 index 0000000..ba278af Binary files /dev/null and b/PIP.framework/Versions/A/PIP differ diff --git a/PIP.framework/Versions/A/Resources/Info.plist b/PIP.framework/Versions/A/Resources/Info.plist new file mode 100755 index 0000000..cb62195 --- /dev/null +++ b/PIP.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,46 @@ + + + + + BuildMachineOSBuild + 15A284 + CFBundleDevelopmentRegion + en + CFBundleExecutable + PIP + CFBundleIdentifier + com.apple.PIP + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + PIP + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 50 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 8R174l + DTPlatformVersion + GM + DTSDKBuild + 16A299 + DTSDKName + macosx10.12internal + DTXcode + 0800 + DTXcodeBuild + 8R174l + NSHumanReadableCopyright + Copyright © 2015 Apple Inc. All rights reserved. + + diff --git a/PIP.framework/Versions/A/Resources/framework.sb b/PIP.framework/Versions/A/Resources/framework.sb new file mode 100755 index 0000000..6109e24 --- /dev/null +++ b/PIP.framework/Versions/A/Resources/framework.sb @@ -0,0 +1,12 @@ +;; +;; PIP - sandbox profile +;; Copyright (c) 2015 Apple Inc. All Rights reserved. +;; +;; WARNING: The sandbox rules in this file currently constitute +;; Apple System Private Interface and are subject to change at any time and +;; without notice. The contents of this file are also auto-generated and not +;; user editable; it may be overwritten at any time. +;; + +(allow mach-lookup + (global-name "com.apple.PIPAgent")) diff --git a/PIP.framework/Versions/A/Resources/version.plist b/PIP.framework/Versions/A/Resources/version.plist new file mode 100755 index 0000000..f97e600 --- /dev/null +++ b/PIP.framework/Versions/A/Resources/version.plist @@ -0,0 +1,18 @@ + + + + + BuildAliasOf + PIPAgent + BuildVersion + 2 + CFBundleShortVersionString + 1.0 + CFBundleVersion + 50 + ProjectName + PIPFramework + SourceVersion + 50000000000000 + + diff --git a/PIP.framework/Versions/A/_CodeSignature/CodeResources b/PIP.framework/Versions/A/_CodeSignature/CodeResources new file mode 100755 index 0000000..b5ef167 --- /dev/null +++ b/PIP.framework/Versions/A/_CodeSignature/CodeResources @@ -0,0 +1,131 @@ + + + + + files + + Resources/Info.plist + + j3i1EyUrGox8WSRK8vxC15iur8E6DgvgfK8zyhPphNA= + + Resources/framework.sb + + BrLJvMrNp6g7Kgk7vXm7KJLgQcUJp45Fh8OaPh3rizU= + + Resources/version.plist + + oeFO/xLw56FfEC5GToj5LytsjW37zDqxNUIIGS7EOx8= + + + files2 + + Resources/Info.plist + + j3i1EyUrGox8WSRK8vxC15iur8E6DgvgfK8zyhPphNA= + + Resources/framework.sb + + BrLJvMrNp6g7Kgk7vXm7KJLgQcUJp45Fh8OaPh3rizU= + + Resources/version.plist + + oeFO/xLw56FfEC5GToj5LytsjW37zDqxNUIIGS7EOx8= + + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/PIP.framework/Versions/Current b/PIP.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/PIP.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/chrome-extension/.gitignore b/chrome-extension/.gitignore old mode 100644 new mode 100755 diff --git a/chrome-extension/package-lock.json b/chrome-extension/package-lock.json old mode 100644 new mode 100755 diff --git a/chrome-extension/package.json b/chrome-extension/package.json old mode 100644 new mode 100755 diff --git a/chrome-extension/src/background.html b/chrome-extension/src/background.html old mode 100644 new mode 100755 diff --git a/chrome-extension/src/background.js b/chrome-extension/src/background.js old mode 100644 new mode 100755 index 703114d..25adb7b --- a/chrome-extension/src/background.js +++ b/chrome-extension/src/background.js @@ -1,6 +1,14 @@ function onClick(tab) { - chrome.tabs.sendMessage(tab.id, { type: 'get_video' }, function(response) { - if (response && !response.success) { + chrome.tabs.sendMessage(tab.id, {type: 'get_video'}, function(response) { + + if (response.success) { + chrome.notifications.create(null, { + type: "basic", + title: "Response", + message: response.url, + iconUrl: "new_icon.png" + }); + } else { chrome.notifications.create(null, { type: "basic", title: "Unable to use Picture-in-Picture", @@ -12,6 +20,7 @@ function onClick(tab) { } + chrome.browserAction.onClicked.addListener(onClick); if (chrome.runtime && chrome.runtime.onStartup) { diff --git a/chrome-extension/src/content.js b/chrome-extension/src/content.js old mode 100644 new mode 100755 index f056d8f..8193533 --- a/chrome-extension/src/content.js +++ b/chrome-extension/src/content.js @@ -10,7 +10,15 @@ chrome.runtime.onMessage.addListener(async function(request, sender, sendRespons videoData = getDefaultVideoData(); } - if (videoData) + if (videoData) { openUrl(videoData); + sendResponse({url: pageUrl, + success: true}); + } else { + sendResponse({url: pageUrl, + success: false}); + } + } + }); \ No newline at end of file diff --git a/chrome-extension/src/icon.png b/chrome-extension/src/icon.png old mode 100644 new mode 100755 diff --git a/chrome-extension/src/icon.psd b/chrome-extension/src/icon.psd old mode 100644 new mode 100755 diff --git a/chrome-extension/src/manifest.json b/chrome-extension/src/manifest.json old mode 100644 new mode 100755 index 8910a13..77c461a --- a/chrome-extension/src/manifest.json +++ b/chrome-extension/src/manifest.json @@ -3,11 +3,13 @@ "persistent": false, "page": "background.html" }, - "content_scripts": [{ - "matches": [""], - "js": ["utils.js", "youtube.js", "content.js"], - "run_at": "document_end" - }], + "content_scripts": [ + { + "matches": [""], + "js": ["utils.js", "youtube.js", "content.js"], + "run_at": "document_end" + } +], "browser_action": { "default_icon": "new_icon.png" }, @@ -23,6 +25,6 @@ "webNavigation", "notifications" ], - "version": "4.4.0", - "manifest_version": 2 + "version": "4.5.0", + "manifest_version": 3 } diff --git a/chrome-extension/src/new_icon.png b/chrome-extension/src/new_icon.png old mode 100644 new mode 100755 diff --git a/chrome-extension/src/utils.js b/chrome-extension/src/utils.js old mode 100644 new mode 100755 index 5456efa..b7ffd32 --- a/chrome-extension/src/utils.js +++ b/chrome-extension/src/utils.js @@ -29,8 +29,8 @@ function openUrl(videoData) { if (f ) {f.parentNode.removeChild(f);} var a = d.createElement('a'); a.href = 'betterpip://open?url=' + encodeURIComponent(videoData.url) + '&time=' + encodeURIComponent(videoData.time); - alert(a.href); - a.innerHTML = "Link" + //alert(a.href); + a.innerHTML = "Link" a.setAttribute('id','customUrlLink'); a.setAttribute("style", "display:none; "); d.body.appendChild(a); diff --git a/chrome-extension/src/youtube.js b/chrome-extension/src/youtube.js old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP.xcodeproj/project.pbxproj b/xcode/BetterPiP.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 96b47c8..d3403a8 --- a/xcode/BetterPiP.xcodeproj/project.pbxproj +++ b/xcode/BetterPiP.xcodeproj/project.pbxproj @@ -12,12 +12,37 @@ 80F0F1F51F75805E00EC5A7A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 80F0F1F41F75805E00EC5A7A /* Assets.xcassets */; }; 80F0F1F81F75805E00EC5A7A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 80F0F1F61F75805E00EC5A7A /* Main.storyboard */; }; 80F0F2021F75808200EC5A7A /* PIP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 80F0F2001F75808200EC5A7A /* PIP.framework */; }; - 80F0F2051F7580E300EC5A7A /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 80F0F2041F7580E300EC5A7A /* AVKit.framework */; }; - 80F0F2071F75811100EC5A7A /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 80F0F2061F75811100EC5A7A /* AVFoundation.framework */; }; 80F0F2131F75874D00EC5A7A /* PiPControlWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F0F2121F75874D00EC5A7A /* PiPControlWindowController.swift */; }; - 80F0F2151F758CD100EC5A7A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 80F0F2141F758CD100EC5A7A /* Foundation.framework */; }; + D20D206C206FC1FC002D2F01 /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = D20D206B206FC1FC002D2F01 /* icon.icns */; }; + D20D206E206FC1FC002D2F01 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20D206D206FC1FC002D2F01 /* ShareViewController.swift */; }; + D20D2071206FC1FC002D2F01 /* ShareViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D20D206F206FC1FC002D2F01 /* ShareViewController.xib */; }; + D20D2076206FC1FC002D2F01 /* BetterPiPShare.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = D20D2069206FC1FB002D2F01 /* BetterPiPShare.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + D20D2074206FC1FC002D2F01 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 80F0F1E51F75805E00EC5A7A /* Project object */; + proxyType = 1; + remoteGlobalIDString = D20D2068206FC1FB002D2F01; + remoteInfo = BetterPiPShare; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D20D207A206FC1FC002D2F01 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + D20D2076206FC1FC002D2F01 /* BetterPiPShare.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 80F0F1ED1F75805E00EC5A7A /* BetterPiP.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BetterPiP.app; sourceTree = BUILT_PRODUCTS_DIR; }; 80F0F1F01F75805E00EC5A7A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -26,8 +51,6 @@ 80F0F1F71F75805E00EC5A7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 80F0F1F91F75805E00EC5A7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 80F0F2001F75808200EC5A7A /* PIP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PIP.framework; sourceTree = ""; }; - 80F0F2041F7580E300EC5A7A /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = System/Library/Frameworks/AVKit.framework; sourceTree = SDKROOT; }; - 80F0F2061F75811100EC5A7A /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 80F0F20A1F75820400EC5A7A /* BetterPiP-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BetterPiP-Bridging-Header.h"; sourceTree = ""; }; 80F0F20B1F75829200EC5A7A /* PIPViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIPViewController.h; sourceTree = ""; }; 80F0F20C1F7582B500EC5A7A /* PIPViewControllerDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIPViewControllerDelegate.h; sourceTree = ""; }; @@ -37,7 +60,12 @@ 80F0F2101F75832800EC5A7A /* NSEvent-PIPExtensions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSEvent-PIPExtensions.h"; sourceTree = ""; }; 80F0F2111F75833600EC5A7A /* CDStructures.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDStructures.h; sourceTree = ""; }; 80F0F2121F75874D00EC5A7A /* PiPControlWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PiPControlWindowController.swift; sourceTree = ""; }; - 80F0F2141F758CD100EC5A7A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D20D2069206FC1FB002D2F01 /* BetterPiPShare.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = BetterPiPShare.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + D20D206B206FC1FC002D2F01 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = ""; }; + D20D206D206FC1FC002D2F01 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; + D20D2070206FC1FC002D2F01 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ShareViewController.xib; sourceTree = ""; }; + D20D2072206FC1FC002D2F01 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D20D2073206FC1FC002D2F01 /* BetterPiPShare.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = BetterPiPShare.entitlements; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -45,13 +73,17 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 80F0F2151F758CD100EC5A7A /* Foundation.framework in Frameworks */, - 80F0F2071F75811100EC5A7A /* AVFoundation.framework in Frameworks */, - 80F0F2051F7580E300EC5A7A /* AVKit.framework in Frameworks */, 80F0F2021F75808200EC5A7A /* PIP.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; + D20D2066206FC1FB002D2F01 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -74,8 +106,8 @@ isa = PBXGroup; children = ( 80F0F1EF1F75805E00EC5A7A /* BetterPiP */, + D20D206A206FC1FC002D2F01 /* BetterPiPShare */, 80F0F1EE1F75805E00EC5A7A /* Products */, - 80F0F2031F7580E300EC5A7A /* Frameworks */, ); sourceTree = ""; }; @@ -83,6 +115,7 @@ isa = PBXGroup; children = ( 80F0F1ED1F75805E00EC5A7A /* BetterPiP.app */, + D20D2069206FC1FB002D2F01 /* BetterPiPShare.appex */, ); name = Products; sourceTree = ""; @@ -102,14 +135,16 @@ path = BetterPiP; sourceTree = ""; }; - 80F0F2031F7580E300EC5A7A /* Frameworks */ = { + D20D206A206FC1FC002D2F01 /* BetterPiPShare */ = { isa = PBXGroup; children = ( - 80F0F2141F758CD100EC5A7A /* Foundation.framework */, - 80F0F2061F75811100EC5A7A /* AVFoundation.framework */, - 80F0F2041F7580E300EC5A7A /* AVKit.framework */, + D20D206B206FC1FC002D2F01 /* icon.icns */, + D20D206D206FC1FC002D2F01 /* ShareViewController.swift */, + D20D206F206FC1FC002D2F01 /* ShareViewController.xib */, + D20D2072206FC1FC002D2F01 /* Info.plist */, + D20D2073206FC1FC002D2F01 /* BetterPiPShare.entitlements */, ); - name = Frameworks; + path = BetterPiPShare; sourceTree = ""; }; /* End PBXGroup section */ @@ -122,29 +157,54 @@ 80F0F1E91F75805E00EC5A7A /* Sources */, 80F0F1EA1F75805E00EC5A7A /* Frameworks */, 80F0F1EB1F75805E00EC5A7A /* Resources */, + D20D207A206FC1FC002D2F01 /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( + D20D2075206FC1FC002D2F01 /* PBXTargetDependency */, ); name = BetterPiP; productName = BetterPiP; productReference = 80F0F1ED1F75805E00EC5A7A /* BetterPiP.app */; productType = "com.apple.product-type.application"; }; + D20D2068206FC1FB002D2F01 /* BetterPiPShare */ = { + isa = PBXNativeTarget; + buildConfigurationList = D20D2079206FC1FC002D2F01 /* Build configuration list for PBXNativeTarget "BetterPiPShare" */; + buildPhases = ( + D20D2065206FC1FB002D2F01 /* Sources */, + D20D2066206FC1FB002D2F01 /* Frameworks */, + D20D2067206FC1FB002D2F01 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BetterPiPShare; + productName = BetterPiPShare; + productReference = D20D2069206FC1FB002D2F01 /* BetterPiPShare.appex */; + productType = "com.apple.product-type.app-extension"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 80F0F1E51F75805E00EC5A7A /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0830; + LastSwiftUpdateCheck = 0930; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Lukas von Mateffy"; TargetAttributes = { 80F0F1EC1F75805E00EC5A7A = { CreatedOnToolsVersion = 8.3.3; - DevelopmentTeam = C6DMLW3W5B; + DevelopmentTeam = VWP2ERD75S; + LastSwiftMigration = 0930; + ProvisioningStyle = Automatic; + }; + D20D2068206FC1FB002D2F01 = { + CreatedOnToolsVersion = 9.3; + DevelopmentTeam = VWP2ERD75S; ProvisioningStyle = Automatic; }; }; @@ -163,6 +223,7 @@ projectRoot = ""; targets = ( 80F0F1EC1F75805E00EC5A7A /* BetterPiP */, + D20D2068206FC1FB002D2F01 /* BetterPiPShare */, ); }; /* End PBXProject section */ @@ -177,6 +238,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D20D2067206FC1FB002D2F01 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D20D2071206FC1FC002D2F01 /* ShareViewController.xib in Resources */, + D20D206C206FC1FC002D2F01 /* icon.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -190,8 +260,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + D20D2065206FC1FB002D2F01 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D20D206E206FC1FC002D2F01 /* ShareViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + D20D2075206FC1FC002D2F01 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D20D2068206FC1FB002D2F01 /* BetterPiPShare */; + targetProxy = D20D2074206FC1FC002D2F01 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 80F0F1F61F75805E00EC5A7A /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -201,6 +287,14 @@ name = Main.storyboard; sourceTree = ""; }; + D20D206F206FC1FC002D2F01 /* ShareViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + D20D2070206FC1FC002D2F01 /* Base */, + ); + name = ShareViewController.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -214,15 +308,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -251,6 +353,7 @@ SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; }; name = Debug; }; @@ -264,15 +367,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -293,15 +404,17 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; }; name = Release; }; 80F0F1FD1F75805E00EC5A7A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = C6DMLW3W5B; + DEVELOPMENT_TEAM = VWP2ERD75S; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/BetterPiP", @@ -311,16 +424,18 @@ PRODUCT_BUNDLE_IDENTIFIER = me.mateffy.BetterPiP; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "BetterPiP/PIP/BetterPiP-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; 80F0F1FE1F75805E00EC5A7A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = C6DMLW3W5B; + DEVELOPMENT_TEAM = VWP2ERD75S; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/BetterPiP", @@ -330,7 +445,50 @@ PRODUCT_BUNDLE_IDENTIFIER = me.mateffy.BetterPiP; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "BetterPiP/PIP/BetterPiP-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; + D20D2077206FC1FC002D2F01 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = BetterPiPShare/BetterPiPShare.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = VWP2ERD75S; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = BetterPiPShare/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.13; + PRODUCT_BUNDLE_IDENTIFIER = me.mateffy.BetterPiP.BetterPiPShare; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + D20D2078206FC1FC002D2F01 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = BetterPiPShare/BetterPiPShare.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = VWP2ERD75S; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = BetterPiPShare/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.13; + PRODUCT_BUNDLE_IDENTIFIER = me.mateffy.BetterPiP.BetterPiPShare; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -355,6 +513,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + D20D2079206FC1FC002D2F01 /* Build configuration list for PBXNativeTarget "BetterPiPShare" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D20D2077206FC1FC002D2F01 /* Debug */, + D20D2078206FC1FC002D2F01 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 80F0F1E51F75805E00EC5A7A /* Project object */; diff --git a/xcode/BetterPiP.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/xcode/BetterPiP.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/xcode/BetterPiP.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/xcode/BetterPiP.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/xcode/BetterPiP/AppDelegate.swift b/xcode/BetterPiP/AppDelegate.swift old mode 100644 new mode 100755 index 60d8333..4079825 --- a/xcode/BetterPiP/AppDelegate.swift +++ b/xcode/BetterPiP/AppDelegate.swift @@ -12,59 +12,98 @@ import Cocoa class AppDelegate: NSObject, NSApplicationDelegate { var main: PiPControlWindowController! - let statusItem = NSStatusBar.system().statusItem(withLength:NSSquareStatusItemLength) + let statusItem = NSStatusBar.system.statusItem(withLength:NSStatusItem.squareLength) + let menu = NSMenu() + var launchedWithUrl = false - func applicationDidFinishLaunching(_ aNotification: Notification) { - // Insert code here to initialize your application + func application(_ application: NSApplication, open urls: [URL]) { + print("launched with url") + + launchedWithUrl = true let appleEventManager = NSAppleEventManager.shared() appleEventManager.setEventHandler(self, andSelector: #selector(handleURL), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL)) if let button = statusItem.button { - button.image = NSImage(named: NSImage.Name(string: "StatusBarButtonImage") as String) + button.image = NSImage(named: NSImage.Name("StatusBarButtonImage")) } - let menu = NSMenu() + //let menu = NSMenu() + + // menu.addItem(NSMenuItem(title: "Install Chrome Extension", action: #selector(openChromeExtensionPage), keyEquivalent: "")) + // menu.addItem(NSMenuItem.separator()) - menu.addItem(NSMenuItem(title: "Install Chrome Extension", action: #selector(openChromeExtensionPage), keyEquivalent: "")) - menu.addItem(NSMenuItem.separator()) menu.addItem(NSMenuItem(title: "Quit BetterPiP", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q")) statusItem.menu = menu - } - - func handleURL(event: NSAppleEventDescriptor, reply: NSAppleEventDescriptor) { - let window = NSStoryboard(name : "Main", bundle: nil).instantiateController(withIdentifier: "mainWindow") as! PiPControlWindowController - let url = URL(string: (event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue)!) - let queryUrl: String = ((url?.queryParameters?["url"]!)!).removingPercentEncoding! - let startTimeString: String = (url?.queryParameters?["time"])! + if urls.count == 0 { return } + + let url = urls[0] + guard let queryUrl: String = ((url.queryParameters?["url"]!)!).removingPercentEncoding else { return } + guard let startTimeString: String = (url.queryParameters?["time"]) else { return } + var startTime: Float = 0.0; if (startTimeString != "" || startTimeString != "undefined") { startTime = Float(startTimeString)! } - print("Received URL: \(queryUrl)") - print("Start at: \(startTime)") + guard let window = NSStoryboard(name : NSStoryboard.Name(rawValue: "Main"), bundle: nil).instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "mainWindow")) as? PiPControlWindowController else { return } + + //print("Received URL: \(queryUrl)") + //print("Start at: \(startTime)") window.showVideo(url: URL(string: queryUrl)!, seconds: startTime) } + + func applicationDidFinishLaunching(_ aNotification: Notification) { + // Insert code here to initialize your application - func notify(message: String) { - let notification = NSUserNotification() - notification.title = "BetterPiP" - notification.informativeText = message - notification.soundName = NSUserNotificationDefaultSoundName - NSUserNotificationCenter.default.deliver(notification) + print("launched") + + if !launchedWithUrl { + print("no launch url found") + NSApplication.shared.terminate(nil) + } + } - func openChromeExtensionPage() { - if let url = URL(string: "https://www.google.com"), NSWorkspace.shared().open(url) { - print("default browser was successfully opened") + @objc func handleURL(event: NSAppleEventDescriptor, reply: NSAppleEventDescriptor) { + + let window = NSStoryboard(name : NSStoryboard.Name(rawValue: "Main"), bundle: nil).instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "mainWindow")) as! PiPControlWindowController + + let url = URL(string: (event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue)!) + let queryUrl: String = ((url?.queryParameters?["url"]!)!).removingPercentEncoding! + let startTimeString: String = (url?.queryParameters?["time"])! + var startTime: Float = 0.0; + + if (startTimeString != "" || startTimeString != "undefined") { + startTime = Float(startTimeString)! } + //print("Received URL: \(queryUrl)") + //print("Start at: \(startTime)") + + window.showVideo(url: URL(string: queryUrl)!, seconds: startTime) } + + +// func notify(message: String) { +// let notification = NSUserNotification() +// notification.title = "BetterPiP" +// notification.informativeText = message +// notification.soundName = NSUserNotificationDefaultSoundName +// NSUserNotificationCenter.default.deliver(notification) +// } + +// func openChromeExtensionPage() { +// if let url = URL(string: "https://www.google.com"), NSWorkspace.shared().open(url) { +// print("default browser was successfully opened") +// } +// +// } + } extension URL { diff --git a/xcode/BetterPiP/Assets.xcassets/AppIcon.appiconset/Contents.json b/xcode/BetterPiP/Assets.xcassets/AppIcon.appiconset/Contents.json old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/Assets.xcassets/AppIcon.appiconset/full icon.png b/xcode/BetterPiP/Assets.xcassets/AppIcon.appiconset/full icon.png old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/Assets.xcassets/Contents.json b/xcode/BetterPiP/Assets.xcassets/Contents.json old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/Assets.xcassets/StatusBarButtonImage.imageset/Contents.json b/xcode/BetterPiP/Assets.xcassets/StatusBarButtonImage.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/Assets.xcassets/StatusBarButtonImage.imageset/icon.png b/xcode/BetterPiP/Assets.xcassets/StatusBarButtonImage.imageset/icon.png old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/Base.lproj/Main.storyboard b/xcode/BetterPiP/Base.lproj/Main.storyboard old mode 100644 new mode 100755 index c48cc42..c75f7c0 --- a/xcode/BetterPiP/Base.lproj/Main.storyboard +++ b/xcode/BetterPiP/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + - - + + + @@ -663,8 +664,8 @@ - - + + @@ -673,6 +674,9 @@ + + + @@ -703,7 +707,7 @@ - + diff --git a/xcode/BetterPiP/Info.plist b/xcode/BetterPiP/Info.plist old mode 100644 new mode 100755 index 2dc1a05..c62c85a --- a/xcode/BetterPiP/Info.plist +++ b/xcode/BetterPiP/Info.plist @@ -8,6 +8,8 @@ NSAllowsArbitraryLoads + NSAllowsArbitraryLoadsInWebContent + CFBundleURLTypes @@ -32,6 +34,8 @@ 6.0 CFBundleName $(PRODUCT_NAME) + LSApplicationCategoryType + public.app-category.entertainment CFBundlePackageType APPL CFBundleShortVersionString @@ -44,6 +48,14 @@ Copyright © 2017 Lukas von Mateffy. All rights reserved. NSMainStoryboardFile Main + NSExtension + + NSExtensionPointIdentifier +NSExtensionPointIdentifier +NSExtensionPointIdentifier + com.apple.share-services +com.apple.share-services + NSPrincipalClass NSApplication diff --git a/xcode/BetterPiP/PIP.framework/Versions/A/PIP b/xcode/BetterPiP/PIP.framework/Versions/A/PIP index ba278af..741653e 100755 Binary files a/xcode/BetterPiP/PIP.framework/Versions/A/PIP and b/xcode/BetterPiP/PIP.framework/Versions/A/PIP differ diff --git a/xcode/BetterPiP/PIP.framework/Versions/A/Resources/Info.plist b/xcode/BetterPiP/PIP.framework/Versions/A/Resources/Info.plist old mode 100755 new mode 100644 index cb62195..13b815a --- a/xcode/BetterPiP/PIP.framework/Versions/A/Resources/Info.plist +++ b/xcode/BetterPiP/PIP.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15A284 + 16B2657 CFBundleDevelopmentRegion en CFBundleExecutable @@ -25,21 +25,21 @@ MacOSX CFBundleVersion - 50 + 83.1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 8R174l + 9C16 DTPlatformVersion GM DTSDKBuild - 16A299 + 17E78 DTSDKName - macosx10.12internal + macosx10.13internal DTXcode - 0800 + 0920 DTXcodeBuild - 8R174l + 9C16 NSHumanReadableCopyright Copyright © 2015 Apple Inc. All rights reserved. diff --git a/xcode/BetterPiP/PIP.framework/Versions/A/Resources/framework.sb b/xcode/BetterPiP/PIP.framework/Versions/A/Resources/framework.sb old mode 100755 new mode 100644 diff --git a/xcode/BetterPiP/PIP.framework/Versions/A/Resources/version.plist b/xcode/BetterPiP/PIP.framework/Versions/A/Resources/version.plist old mode 100755 new mode 100644 index f97e600..d67e292 --- a/xcode/BetterPiP/PIP.framework/Versions/A/Resources/version.plist +++ b/xcode/BetterPiP/PIP.framework/Versions/A/Resources/version.plist @@ -5,14 +5,14 @@ BuildAliasOf PIPAgent BuildVersion - 2 + 3 CFBundleShortVersionString 1.0 CFBundleVersion - 50 + 83.1 ProjectName PIPFramework SourceVersion - 50000000000000 + 83001000000000 diff --git a/xcode/BetterPiP/PIP.framework/Versions/A/_CodeSignature/CodeResources b/xcode/BetterPiP/PIP.framework/Versions/A/_CodeSignature/CodeResources old mode 100755 new mode 100644 index b5ef167..3c9b9ea --- a/xcode/BetterPiP/PIP.framework/Versions/A/_CodeSignature/CodeResources +++ b/xcode/BetterPiP/PIP.framework/Versions/A/_CodeSignature/CodeResources @@ -6,31 +6,40 @@ Resources/Info.plist - j3i1EyUrGox8WSRK8vxC15iur8E6DgvgfK8zyhPphNA= + laZIqb1Bf1PWi2zJHqq9nC2DvXA= Resources/framework.sb - BrLJvMrNp6g7Kgk7vXm7KJLgQcUJp45Fh8OaPh3rizU= + Z/b8b31rZtYnxiCBn98yq2ZaQIE= Resources/version.plist - oeFO/xLw56FfEC5GToj5LytsjW37zDqxNUIIGS7EOx8= + jB3Dpp/muEHm6o65kDzSWdzGv+Y= files2 Resources/Info.plist - - j3i1EyUrGox8WSRK8vxC15iur8E6DgvgfK8zyhPphNA= - + + hash2 + + kQtRZbk7o9eJVr5pQ0EeUoVRfW2lxys0Lpw6+87usOg= + + Resources/framework.sb - - BrLJvMrNp6g7Kgk7vXm7KJLgQcUJp45Fh8OaPh3rizU= - + + hash2 + + BrLJvMrNp6g7Kgk7vXm7KJLgQcUJp45Fh8OaPh3rizU= + + Resources/version.plist - - oeFO/xLw56FfEC5GToj5LytsjW37zDqxNUIIGS7EOx8= - + + hash2 + + VHCkDNOoAgXBVcnQCrBHXrNatmvZOJ9E64dhkL0Ds8Q= + + rules @@ -50,6 +59,11 @@ weight 1100 + ^Resources/Base\.lproj/ + + weight + 1010 + ^version.plist$ @@ -109,6 +123,11 @@ weight 1100 + ^Resources/Base\.lproj/ + + weight + 1010 + ^[^/]+$ nested diff --git a/xcode/BetterPiP/PIP/BetterPiP-Bridging-Header.h b/xcode/BetterPiP/PIP/BetterPiP-Bridging-Header.h old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/PIP/CDStructures.h b/xcode/BetterPiP/PIP/CDStructures.h old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/PIP/NSEvent-PIPExtensions.h b/xcode/BetterPiP/PIP/NSEvent-PIPExtensions.h old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/PIP/NSObject-Protocol.h b/xcode/BetterPiP/PIP/NSObject-Protocol.h old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/PIP/NSViewControllerPresentationAnimator-Protocol.h b/xcode/BetterPiP/PIP/NSViewControllerPresentationAnimator-Protocol.h old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/PIP/PIPPanel.h b/xcode/BetterPiP/PIP/PIPPanel.h old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/PIP/PIPViewController.h b/xcode/BetterPiP/PIP/PIPViewController.h old mode 100644 new mode 100755 index b73bc4c..f7e349a --- a/xcode/BetterPiP/PIP/PIPViewController.h +++ b/xcode/BetterPiP/PIP/PIPViewController.h @@ -44,6 +44,7 @@ @property(copy, nonatomic) NSString *name; // @synthesize name=_name; @property(nonatomic) __weak NSView *replacementView; // @synthesize replacementView=_replacementView; @property(nonatomic) __weak id delegate; // @synthesize delegate=_delegate; +- (void)cxx_destruct; - (unsigned int)copyActiveFencePort; - (void)animateDismissalOfViewController:(id)arg1 fromViewController:(id)arg2; - (void)animatePresentationOfViewController:(id)arg1 fromViewController:(id)arg2; diff --git a/xcode/BetterPiP/PIP/PIPViewControllerDelegate.h b/xcode/BetterPiP/PIP/PIPViewControllerDelegate.h old mode 100644 new mode 100755 diff --git a/xcode/BetterPiP/PiPControlViewController.swift b/xcode/BetterPiP/PiPControlViewController.swift old mode 100644 new mode 100755 index 929186c..f2bc724 --- a/xcode/BetterPiP/PiPControlViewController.swift +++ b/xcode/BetterPiP/PiPControlViewController.swift @@ -10,10 +10,11 @@ import Cocoa import AVKit import AVFoundation -class PiPControlViewController: NSViewController { +final class PiPControlViewController: NSViewController { @IBOutlet weak var playerView: AVPlayerView! + var timeObserverToken:Any? var player: AVPlayer? = nil var pipIsActive = false lazy var pip: PIPViewController! = { @@ -42,6 +43,7 @@ class PiPControlViewController: NSViewController { playerView.player = player; openPIP() + } override func viewDidLoad() { @@ -53,35 +55,47 @@ class PiPControlViewController: NSViewController { /// We also keep an instance of the current view so when the PIPPanel closes we can return it back to its original state. func openPIP() { if !pipIsActive { + guard let player = self.player else { return } + pip.presentAsPicture(inPicture: self) - pip.setPlaying(true) - pipIsActive = true + // pipIsActive = true + + player.play() + + if player.isPlaying { + pip.setPlaying(true) + } } } - - + } extension PiPControlViewController: PIPViewControllerDelegate { /// Called when the PIPPanel closes func pipDidClose(_ pip: PIPViewController!) { + print("pipDidClose") player?.pause() } /// Called when the PIPPanel stops playing func pipActionStop(_ pip: PIPViewController!) { + print("pipActionStop") player?.pause() + NSApplication.shared.terminate(nil) } /// Called when the play button in the PIPPanel is clicked func pipActionPlay(_ pip: PIPViewController!) { + print("pipActionPlay") player?.play() } /// Called when the pause button in the PIPPanel is clicked func pipActionPause(_ pip: PIPViewController!) { + print("pipActionPause") player?.pause() } + } extension AVPlayer { diff --git a/xcode/BetterPiP/PiPControlWindowController.swift b/xcode/BetterPiP/PiPControlWindowController.swift old mode 100644 new mode 100755 index f94d2f2..a31f240 --- a/xcode/BetterPiP/PiPControlWindowController.swift +++ b/xcode/BetterPiP/PiPControlWindowController.swift @@ -9,25 +9,24 @@ import Cocoa import Foundation -class PiPControlWindowController: NSWindowController { +final class PiPControlWindowController: NSWindowController { var mainVC: PiPControlViewController! = nil override func windowDidLoad() { super.windowDidLoad() - self.window?.makeKeyAndOrderFront(nil) - self.window?.close() +// self.window?.makeKeyAndOrderFront(nil) +// self.window?.close() } func showVideo(url: URL, seconds: Float) { if (mainVC !== nil) { - mainVC.dismiss(nil) - } - - mainVC = NSStoryboard(name:"Main", bundle: nil).instantiateController(withIdentifier: "mainWindowVC") as! PiPControlViewController +// mainVC.dismiss(nil) + } else { + mainVC = NSStoryboard(name:NSStoryboard.Name(rawValue: "Main"), bundle: nil).instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "mainWindowVC")) as! PiPControlViewController self.window?.contentViewController = mainVC - + } mainVC.playVideo(videoUrl: url, seconds: seconds) } diff --git a/xcode/BetterPiP/test.scpt b/xcode/BetterPiP/test.scpt old mode 100644 new mode 100755 diff --git a/xcode/BetterPiPShare/Base.lproj/ShareViewController.xib b/xcode/BetterPiPShare/Base.lproj/ShareViewController.xib new file mode 100644 index 0000000..20f86fc --- /dev/null +++ b/xcode/BetterPiPShare/Base.lproj/ShareViewController.xib @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xcode/BetterPiPShare/BetterPiPShare.entitlements b/xcode/BetterPiPShare/BetterPiPShare.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/xcode/BetterPiPShare/BetterPiPShare.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/xcode/BetterPiPShare/Info.plist b/xcode/BetterPiPShare/Info.plist new file mode 100644 index 0000000..ea103ad --- /dev/null +++ b/xcode/BetterPiPShare/Info.plist @@ -0,0 +1,42 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + BetterPiP + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + icon + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSExtension + + NSExtensionAttributes + + NSExtensionActivationRule + TRUEPREDICATE + + NSExtensionPointIdentifier + com.apple.share-services + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).ShareViewController + + NSHumanReadableCopyright + Copyright © 2018 Lukas von Mateffy. All rights reserved. + + diff --git a/xcode/BetterPiPShare/ShareViewController.swift b/xcode/BetterPiPShare/ShareViewController.swift new file mode 100644 index 0000000..692be6b --- /dev/null +++ b/xcode/BetterPiPShare/ShareViewController.swift @@ -0,0 +1,42 @@ +// +// ShareViewController.swift +// BetterPiPShare +// +// Created by Tobias Dunkel on 31.03.18. +// Copyright © 2018 Lukas von Mateffy. All rights reserved. +// + +import Cocoa + +class ShareViewController: NSViewController { + + override var nibName: NSNib.Name? { + return NSNib.Name("ShareViewController") + } + + override func loadView() { + super.loadView() + + // Insert code here to customize the view + let item = self.extensionContext!.inputItems[0] as! NSExtensionItem + if let attachments = item.attachments { + NSLog("Attachments = %@", attachments as NSArray) + } else { + NSLog("No Attachments") + } + } + + @IBAction func send(_ sender: AnyObject?) { + let outputItem = NSExtensionItem() + // Complete implementation by setting the appropriate value on the output item + + let outputItems = [outputItem] + self.extensionContext!.completeRequest(returningItems: outputItems, completionHandler: nil) +} + + @IBAction func cancel(_ sender: AnyObject?) { + let cancelError = NSError(domain: NSCocoaErrorDomain, code: NSUserCancelledError, userInfo: nil) + self.extensionContext!.cancelRequest(withError: cancelError) + } + +} diff --git a/xcode/BetterPiPShare/icon.icns b/xcode/BetterPiPShare/icon.icns new file mode 100644 index 0000000..84ae85c Binary files /dev/null and b/xcode/BetterPiPShare/icon.icns differ