Skip to content

Commit

Permalink
Merge branch 'release/2.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Feb 10, 2016
2 parents cced510 + dc9d348 commit 190b177
Show file tree
Hide file tree
Showing 21 changed files with 128 additions and 69 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#### Version 2.5.1

* Adaptation to YouTube API change. (#231)
* Fixed compilation issue with Xcode 7.3 beta. (#228)
* Properly annotated the `preferredVideoQualities` property as `null_resettable`.

#### Version 2.5.0

* Logging is fully configurable with the new `XCDYouTubeLogger` class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.5.0;
CURRENT_PROJECT_VERSION = 2.5.1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down Expand Up @@ -805,7 +805,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 2.5.0;
CURRENT_PROJECT_VERSION = 2.5.1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForAnalyzing = "YES"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2428ACF191C3C1400065504"
Expand Down Expand Up @@ -39,15 +40,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2428ACF191C3C1400065504"
BuildableName = "XCDYouTubeKit OS X Demo.app"
BlueprintName = "XCDYouTubeKit OS X Demo"
ReferencedContainer = "container:XCDYouTubeKit Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "XCDYouTubeKitLogLevel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForAnalyzing = "YES"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C274159D17F491230026834B"
Expand Down Expand Up @@ -39,15 +40,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C274159D17F491230026834B"
BuildableName = "XCDYouTubeKit iOS Demo.app"
BlueprintName = "XCDYouTubeKit iOS Demo"
ReferencedContainer = "container:XCDYouTubeKit Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "XCDYouTubeKitLogLevel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForAnalyzing = "YES"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2D627581BE3C648005367FF"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<string></string>
<!--
Once you have entered your API Key, use the following command to ignore the local change:
git update-index --skip-worktree YouTube-API-Key.plist
git update-index --skip-worktree "XCDYouTubeKit Demo/tvOS Demo/Supporting Files/YouTube-API-Key.plist"
-->
</plist>
2 changes: 1 addition & 1 deletion XCDYouTubeKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "XCDYouTubeKit"
s.version = "2.5.0"
s.version = "2.5.1"
s.summary = "YouTube video player for iOS and OS X."
s.homepage = "https://github.com/0xced/XCDYouTubeKit"
s.screenshot = "https://raw.github.com/0xced/XCDYouTubeKit/#{s.version}/Screenshots/XCDYouTubeVideoPlayerViewController.png"
Expand Down
12 changes: 6 additions & 6 deletions XCDYouTubeKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1157,10 +1157,10 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.5.0;
DYLIB_CURRENT_VERSION = 2.5.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -1223,10 +1223,10 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.5.0;
DYLIB_CURRENT_VERSION = 2.5.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -1296,10 +1296,10 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.0.0;
DYLIB_CURRENT_VERSION = 2.5.0;
DYLIB_CURRENT_VERSION = 2.5.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2DD4DA1191FFDE100AF6F85"
BuildableName = "XCDYouTubeKit OS X Tests.xctest"
BlueprintName = "XCDYouTubeKit OS X Tests"
ReferencedContainer = "container:XCDYouTubeKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForAnalyzing = "YES"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2623179191D741700D23900"
Expand Down Expand Up @@ -42,9 +43,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2DD4DA1191FFDE100AF6F85"
BuildableName = "XCDYouTubeKit OS X Tests.xctest"
BlueprintName = "XCDYouTubeKit OS X Tests"
BlueprintIdentifier = "C2623179191D741700D23900"
BuildableName = "XCDYouTubeKit.framework"
BlueprintName = "XCDYouTubeKit OS X"
ReferencedContainer = "container:XCDYouTubeKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand Down Expand Up @@ -96,6 +97,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2623179191D741700D23900"
BuildableName = "XCDYouTubeKit.framework"
BlueprintName = "XCDYouTubeKit OS X"
ReferencedContainer = "container:XCDYouTubeKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForAnalyzing = "YES"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2F0E5721944F10E00D8EBA8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForAnalyzing = "YES"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2A3F2CC17F4827800AC1C3B"
Expand Down Expand Up @@ -96,6 +97,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C2A3F2CC17F4827800AC1C3B"
BuildableName = "libXCDYouTubeKit.a"
BlueprintName = "XCDYouTubeKit iOS Static Library"
ReferencedContainer = "container:XCDYouTubeKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C20F579A18817D5400EDBFB0"
BuildableName = "XCDYouTubeKit iOS Tests.xctest"
BlueprintName = "XCDYouTubeKit iOS Tests"
ReferencedContainer = "container:XCDYouTubeKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Code Coverage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C215BE9F1BE2E36600F9783B"
BuildableName = "XCDYouTubeKit tvOS Tests.xctest"
BlueprintName = "XCDYouTubeKit tvOS Tests"
ReferencedContainer = "container:XCDYouTubeKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
buildForAnalyzing = "YES"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C215BE961BE2E36600F9783B"
Expand All @@ -25,7 +26,8 @@
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
buildForAnalyzing = "NO"
hideIssues = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C215BE9F1BE2E36600F9783B"
Expand Down
21 changes: 8 additions & 13 deletions XCDYouTubeKit/XCDYouTubeClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,21 @@ - (instancetype) initWithLanguageIdentifier:(NSString *)languageIdentifier
if (!(self = [super init]))
return nil; // LCOV_EXCL_LINE

_languageIdentifier = languageIdentifier;
_languageIdentifier = ^{
return languageIdentifier ?: ^{
NSArray *preferredLocalizations = [[NSBundle mainBundle] preferredLocalizations];
NSString *preferredLocalization = preferredLocalizations.firstObject ?: @"en";
return [NSLocale canonicalLanguageIdentifierFromString:preferredLocalization] ?: @"en";
}();
}();

_queue = [NSOperationQueue new];
_queue.maxConcurrentOperationCount = 6; // paul_irish: Chrome re-confirmed that the 6 connections-per-host limit is the right magic number: https://code.google.com/p/chromium/issues/detail?id=285567#c14 [https://twitter.com/paul_irish/status/422808635698212864]
_queue.name = NSStringFromClass(self.class);

return self;
}

- (NSString *) languageIdentifier
{
if (!_languageIdentifier)
{
_languageIdentifier = @"en";
NSArray *preferredLocalizations = [[NSBundle mainBundle] preferredLocalizations];
if (preferredLocalizations.count > 0)
_languageIdentifier = [NSLocale canonicalLanguageIdentifierFromString:preferredLocalizations[0]];
}
return _languageIdentifier;
}

- (id<XCDYouTubeOperation>) getVideoWithIdentifier:(NSString *)videoIdentifier completionHandler:(void (^)(XCDYouTubeVideo * __nullable video, NSError * __nullable error))completionHandler
{
if (!completionHandler)
Expand Down
18 changes: 7 additions & 11 deletions XCDYouTubeKit/XCDYouTubeLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ @protocol XCDYouTubeLogger_DDLog
+ (void) log:(BOOL)asynchronous message:(NSString *)message level:(NSUInteger)level flag:(NSUInteger)flag context:(NSInteger)context file:(const char *)file function:(const char *)function line:(NSUInteger)line tag:(id)tag;
@end

static void (^const DefaultLogHandler)(NSString * (^)(void), XCDLogLevel, const char *, const char *, NSUInteger) = ^(NSString *(^message)(void), XCDLogLevel level, const char *file, const char *function, NSUInteger line)
{
char *logLevelString = getenv("XCDYouTubeKitLogLevel");
NSUInteger logLevelMask = logLevelString ? strtoul(logLevelString, NULL, 0) : (1 << XCDLogLevelError) | (1 << XCDLogLevelWarning);
if ((1 << level) & logLevelMask)
NSLog(@"[XCDYouTubeKit] %@", message());
};

static Class DDLogClass = Nil;

static void (^const CocoaLumberjackLogHandler)(NSString * (^)(void), XCDLogLevel, const char *, const char *, NSUInteger) = ^(NSString *(^message)(void), XCDLogLevel level, const char *file, const char *function, NSUInteger line)
Expand All @@ -29,16 +21,20 @@ static void (^const CocoaLumberjackLogHandler)(NSString * (^)(void), XCDLogLevel
[DDLogClass log:YES message:message() level:NSUIntegerMax flag:(1 << level) context:XCDYouTubeKitLumberjackContext file:file function:function line:line tag:nil];
};

static void (^LogHandler)(NSString * (^)(void), XCDLogLevel, const char *, const char *, NSUInteger);
static void (^LogHandler)(NSString * (^)(void), XCDLogLevel, const char *, const char *, NSUInteger) = ^(NSString *(^message)(void), XCDLogLevel level, const char *file, const char *function, NSUInteger line)
{
char *logLevelString = getenv("XCDYouTubeKitLogLevel");
NSUInteger logLevelMask = logLevelString ? strtoul(logLevelString, NULL, 0) : (1 << XCDLogLevelError) | (1 << XCDLogLevelWarning);
if ((1 << level) & logLevelMask)
NSLog(@"[XCDYouTubeKit] %@", message());
};

@implementation XCDYouTubeLogger

+ (void) initialize
{
static dispatch_once_t once;
dispatch_once(&once, ^{
LogHandler = DefaultLogHandler;

DDLogClass = objc_lookUpClass("DDLog");
if (DDLogClass)
{
Expand Down
4 changes: 3 additions & 1 deletion XCDYouTubeKit/XCDYouTubePlayerScript.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ - (instancetype) initWithString:(NSString *)string
@"location": @{
@"hash": @""
},
@"navigator": @{},
@"navigator": @{
@"userAgent": @""
},
};
_context[@"window"] = @{};
for (NSString *propertyName in environment)
Expand Down
Loading

0 comments on commit 190b177

Please sign in to comment.