diff --git a/DownTube/DownTube.xcodeproj/project.pbxproj b/DownTube/DownTube.xcodeproj/project.pbxproj
index fb2ea72..af362a0 100644
--- a/DownTube/DownTube.xcodeproj/project.pbxproj
+++ b/DownTube/DownTube.xcodeproj/project.pbxproj
@@ -296,8 +296,6 @@
6698ABC41D0910AF00985368 /* Sources */,
6698ABC51D0910AF00985368 /* Frameworks */,
6698ABC61D0910AF00985368 /* Resources */,
- 16CC81B11960E05F0AFE02B6 /* [CP] Embed Pods Frameworks */,
- 00F39E3F615D18A91C1E0F0D /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -319,7 +317,6 @@
660FDD8C1D06648C0015763F /* ShellScript */,
6698ABD61D0910B000985368 /* Embed App Extensions */,
DAFAFC4E5B66632F61E7DB8A /* [CP] Embed Pods Frameworks */,
- 5597FFD583F1359BBC1A31D0 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -339,7 +336,6 @@
66BF69C21CFD2AE3004FEFF7 /* Sources */,
66BF69C31CFD2AE3004FEFF7 /* Frameworks */,
66BF69C41CFD2AE3004FEFF7 /* Resources */,
- 9DA7977CA6E3DA35F0F9713A /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -357,14 +353,14 @@
66BF69A51CFD2AE3004FEFF7 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastSwiftUpdateCheck = 0730;
- LastUpgradeCheck = 0900;
+ LastSwiftUpdateCheck = 1100;
+ LastUpgradeCheck = 1100;
ORGANIZATIONNAME = Adam;
TargetAttributes = {
6698ABC71D0910AF00985368 = {
CreatedOnToolsVersion = 7.3.1;
- DevelopmentTeam = 6GHQ7P7EHA;
- LastSwiftMigration = 0900;
+ DevelopmentTeam = NK42ZNZZG9;
+ LastSwiftMigration = 1100;
SystemCapabilities = {
com.apple.ApplicationGroups.iOS = {
enabled = 1;
@@ -373,8 +369,8 @@
};
66BF69AC1CFD2AE3004FEFF7 = {
CreatedOnToolsVersion = 7.3.1;
- DevelopmentTeam = 6GHQ7P7EHA;
- LastSwiftMigration = 0900;
+ DevelopmentTeam = NK42ZNZZG9;
+ LastSwiftMigration = 1100;
SystemCapabilities = {
com.apple.ApplicationGroups.iOS = {
enabled = 1;
@@ -386,17 +382,18 @@
};
66BF69C51CFD2AE3004FEFF7 = {
CreatedOnToolsVersion = 7.3.1;
- LastSwiftMigration = 0900;
+ DevelopmentTeam = NK42ZNZZG9;
+ LastSwiftMigration = 1100;
+ ProvisioningStyle = Automatic;
TestTargetID = 66BF69AC1CFD2AE3004FEFF7;
};
};
};
buildConfigurationList = 66BF69A81CFD2AE3004FEFF7 /* Build configuration list for PBXProject "DownTube" */;
compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
+ developmentRegion = Base;
hasScannedForEncodings = 0;
knownRegions = (
- en,
Base,
);
mainGroup = 66BF69A41CFD2AE3004FEFF7;
@@ -441,64 +438,22 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
- 00F39E3F615D18A91C1E0F0D /* [CP] Copy Pods Resources */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- );
- name = "[CP] Copy Pods Resources";
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DownTubeShareExtension/Pods-DownTubeShareExtension-resources.sh\"\n";
- showEnvVarsInLog = 0;
- };
- 16CC81B11960E05F0AFE02B6 /* [CP] Embed Pods Frameworks */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- );
- name = "[CP] Embed Pods Frameworks";
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DownTubeShareExtension/Pods-DownTubeShareExtension-frameworks.sh\"\n";
- showEnvVarsInLog = 0;
- };
20DFF6F256332C1768AE99FA /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-DownTube-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
- showEnvVarsInLog = 0;
- };
- 5597FFD583F1359BBC1A31D0 /* [CP] Copy Pods Resources */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- );
- name = "[CP] Copy Pods Resources";
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DownTube/Pods-DownTube-resources.sh\"\n";
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
660FDD8C1D06648C0015763F /* ShellScript */ = {
@@ -520,28 +475,16 @@
files = (
);
inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-DownTubeUITests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
- showEnvVarsInLog = 0;
- };
- 9DA7977CA6E3DA35F0F9713A /* [CP] Copy Pods Resources */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- );
- name = "[CP] Copy Pods Resources";
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DownTubeUITests/Pods-DownTubeUITests-resources.sh\"\n";
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
D453489E573DCCD6931D734A /* [CP] Check Pods Manifest.lock */ = {
@@ -550,13 +493,16 @@
files = (
);
inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-DownTubeShareExtension-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
DAFAFC4E5B66632F61E7DB8A /* [CP] Embed Pods Frameworks */ = {
@@ -565,9 +511,14 @@
files = (
);
inputPaths = (
+ "${SRCROOT}/Pods/Target Support Files/Pods-DownTube/Pods-DownTube-frameworks.sh",
+ "${BUILT_PRODUCTS_DIR}/MMWormhole/MMWormhole.framework",
+ "${BUILT_PRODUCTS_DIR}/XCDYouTubeKit/XCDYouTubeKit.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MMWormhole.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/XCDYouTubeKit.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@@ -670,14 +621,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = DownTubeShareExtension/DownTubeShareExtension.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
+ DEVELOPMENT_TEAM = NK42ZNZZG9;
INFOPLIST_FILE = DownTubeShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = com.adam.DownTube.DownTubeShareExtension;
+ PRODUCT_BUNDLE_IDENTIFIER = com.nossa.DownTube.DownTubeShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -688,14 +640,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = DownTubeShareExtension/DownTubeShareExtension.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
+ DEVELOPMENT_TEAM = NK42ZNZZG9;
INFOPLIST_FILE = DownTubeShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = com.adam.DownTube.DownTubeShareExtension;
+ PRODUCT_BUNDLE_IDENTIFIER = com.nossa.DownTube.DownTubeShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -703,6 +656,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -712,12 +666,14 @@
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_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;
@@ -744,7 +700,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -757,6 +713,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -766,12 +723,14 @@
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_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;
@@ -792,7 +751,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -810,14 +769,15 @@
CODE_SIGN_ENTITLEMENTS = DownTube/DownTube.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ DEVELOPMENT_TEAM = NK42ZNZZG9;
INFOPLIST_FILE = DownTube/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = com.adam.DownTube;
+ PRODUCT_BUNDLE_IDENTIFIER = com.nossa.DownTube;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -829,14 +789,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = DownTube/DownTube.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
+ DEVELOPMENT_TEAM = NK42ZNZZG9;
INFOPLIST_FILE = DownTube/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- PRODUCT_BUNDLE_IDENTIFIER = com.adam.DownTube;
+ PRODUCT_BUNDLE_IDENTIFIER = com.nossa.DownTube;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -844,13 +805,19 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 3A6B45BABAC44A4F8E6AD455 /* Pods-DownTubeUITests.debug.xcconfig */;
buildSettings = {
+ CODE_SIGN_IDENTITY = "Apple Development";
+ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
+ CODE_SIGN_STYLE = Automatic;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ DEVELOPMENT_TEAM = NK42ZNZZG9;
INFOPLIST_FILE = DownTubeUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.adam.DownTubeUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE_SPECIFIER = "";
+ "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = DownTube;
};
name = Debug;
@@ -859,12 +826,18 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 75D529D50AF50393114AA8CE /* Pods-DownTubeUITests.release.xcconfig */;
buildSettings = {
+ CODE_SIGN_IDENTITY = "Apple Development";
+ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
+ CODE_SIGN_STYLE = Automatic;
+ DEVELOPMENT_TEAM = NK42ZNZZG9;
INFOPLIST_FILE = DownTubeUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.adam.DownTubeUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE_SPECIFIER = "";
+ "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = DownTube;
};
name = Release;
diff --git a/DownTube/DownTube.xcodeproj/xcshareddata/xcschemes/DownTube.xcscheme b/DownTube/DownTube.xcodeproj/xcshareddata/xcschemes/DownTube.xcscheme
new file mode 100644
index 0000000..0a69a28
--- /dev/null
+++ b/DownTube/DownTube.xcodeproj/xcshareddata/xcschemes/DownTube.xcscheme
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DownTube/DownTube.xcodeproj/xcshareddata/xcschemes/DownTubeShareExtension.xcscheme b/DownTube/DownTube.xcodeproj/xcshareddata/xcschemes/DownTubeShareExtension.xcscheme
new file mode 100644
index 0000000..dbdf608
--- /dev/null
+++ b/DownTube/DownTube.xcodeproj/xcshareddata/xcschemes/DownTubeShareExtension.xcscheme
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DownTube/DownTube/AppDelegate.swift b/DownTube/DownTube/AppDelegate.swift
index 65f967f..674f09a 100644
--- a/DownTube/DownTube/AppDelegate.swift
+++ b/DownTube/DownTube/AppDelegate.swift
@@ -9,6 +9,7 @@
import UIKit
import CoreData
import AVFoundation
+import MMWormhole
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -16,12 +17,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var backgroundSessionCompletionHandler: (() -> Void)? //For the background downloading
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
//Background playback
do {
- try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
+ try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
} catch {
print("Background audio not enabled")
}
@@ -55,4 +56,43 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
self.backgroundSessionCompletionHandler = completionHandler
}
+
+ func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
+ if let scheme = url.scheme,
+ scheme.localizedCaseInsensitiveCompare("downtube") == .orderedSame,
+ let view = url.host {
+
+ var parameters: [String: String] = [:]
+ URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems?.forEach {
+ parameters[$0.name] = $0.value
+ }
+
+ redirect(to: view, with: parameters)
+
+ return true
+ } else {
+ return false
+ }
+ }
+
+ func redirect(to view: String, with parms: [String: String]) {
+ switch view {
+ case "download":
+ guard let videoId = parms["videoId"], videoId.count == 11 else { return }
+ let youtubeUrl = URL(string: "https://www.youtube.com/watch?v=\(videoId)")!
+
+ //Just in case the app was't running in the background, write the URL to the shared NSUserDefaults
+ var existingItems = Constants.sharedDefaults.value(forKey: Constants.videosToAdd) as! [String]
+ existingItems.append(youtubeUrl.absoluteString)
+ Constants.sharedDefaults.set(existingItems, forKey: Constants.videosToAdd)
+ Constants.sharedDefaults.synchronize()
+
+ let wormhole = MMWormhole(applicationGroupIdentifier: "group.nossa.DownTube", optionalDirectory: nil)
+
+ //Passing YouTube URL
+ wormhole.passMessageObject(youtubeUrl.absoluteString as NSCoding?, identifier: "youTubeUrl")
+ default:
+ return
+ }
+ }
}
diff --git a/DownTube/DownTube/Base.lproj/Main.storyboard b/DownTube/DownTube/Base.lproj/Main.storyboard
index 42d394e..f8e8c17 100644
--- a/DownTube/DownTube/Base.lproj/Main.storyboard
+++ b/DownTube/DownTube/Base.lproj/Main.storyboard
@@ -1,13 +1,9 @@
-
-
-
-
+
+
-
-
-
+
@@ -16,10 +12,10 @@
-
+
-
+
@@ -34,7 +30,7 @@
-
+
@@ -100,30 +96,30 @@
-
+
-
+
-
+