diff --git a/YouTube Direct Lite for iOS/Images.xcassets/AppIcon.appiconset/Contents.json b/YouTube Direct Lite for iOS/Images.xcassets/AppIcon.appiconset/Contents.json index a396706..118c98f 100644 --- a/YouTube Direct Lite for iOS/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/YouTube Direct Lite for iOS/Images.xcassets/AppIcon.appiconset/Contents.json @@ -5,15 +5,30 @@ "size" : "29x29", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" } ], "info" : { diff --git a/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Contents.json b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Contents.json index c79ebd3..2b7ef0e 100644 --- a/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -1,18 +1,38 @@ { "images" : [ { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-Portrait@3x.png", + "minimum-system-version" : "8.0", "orientation" : "portrait", + "scale" : "3x" + }, + { + "extent" : "full-screen", "idiom" : "iphone", + "subtype" : "667h", + "filename" : "Default-667h@2x.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default@2x.png", "extent" : "full-screen", "minimum-system-version" : "7.0", "scale" : "2x" }, { - "orientation" : "portrait", + "extent" : "full-screen", "idiom" : "iphone", "subtype" : "retina4", - "extent" : "full-screen", + "filename" : "Default-568h@2x.png", "minimum-system-version" : "7.0", + "orientation" : "portrait", "scale" : "2x" } ], diff --git a/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png new file mode 100644 index 0000000..4040750 Binary files /dev/null and b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png differ diff --git a/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png new file mode 100644 index 0000000..a5eb199 Binary files /dev/null and b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png differ diff --git a/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-Portrait@3x.png b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-Portrait@3x.png new file mode 100644 index 0000000..ad07093 Binary files /dev/null and b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default-Portrait@3x.png differ diff --git a/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default@2x.png b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default@2x.png new file mode 100644 index 0000000..b3139f7 Binary files /dev/null and b/YouTube Direct Lite for iOS/Images.xcassets/LaunchImage.launchimage/Default@2x.png differ diff --git a/YouTube Direct Lite for iOS/Utils.m b/YouTube Direct Lite for iOS/Utils.m index 3a79e7d..8bcb99d 100644 --- a/YouTube Direct Lite for iOS/Utils.m +++ b/YouTube Direct Lite for iOS/Utils.m @@ -43,26 +43,41 @@ + (void)showAlert:(NSString *)title message:(NSString *)message { } + (NSString *)humanReadableFromYouTubeTime:(NSString *)youTubeTimeFormat { - NSRange range = NSMakeRange(0, youTubeTimeFormat.length); - NSError *error = NULL; - NSRegularExpression *regex = - [NSRegularExpression regularExpressionWithPattern:@"PT(\\d*)M(\\d+)S" - options:NSRegularExpressionCaseInsensitive - error:&error]; - NSArray *matches = [regex matchesInString:youTubeTimeFormat options:0 range:range]; - NSString *humanReadable = @"(Unknown)"; - for (NSTextCheckingResult *match in matches) { - NSRange minuteRange = [match rangeAtIndex:1]; - NSString *minuteString = [youTubeTimeFormat substringWithRange:minuteRange]; - NSRange secRange = [match rangeAtIndex:2]; - NSString *secString = [youTubeTimeFormat substringWithRange:secRange]; - humanReadable = - [NSString stringWithFormat:@"%01d:%02d", [minuteString intValue], [secString intValue]]; - } + NSRange range = NSMakeRange(0, youTubeTimeFormat.length); + NSError *error = NULL; - NSLog(@"Translated %@ to %@", youTubeTimeFormat, humanReadable); - return humanReadable; + // PT(((\d+)H)?(\d+)M)?(\d+)S + NSRegularExpression *regex = + [NSRegularExpression regularExpressionWithPattern:@"PT(((\\d+)H)?(\\d+)M)?(\\d+)S" + options:NSRegularExpressionCaseInsensitive + error:&error]; + NSArray *matches = [regex matchesInString:youTubeTimeFormat options:0 range:range]; + NSString *humanReadable = @"(Unknown)"; + for (NSTextCheckingResult *match in matches) { + NSRange hourRange = [match rangeAtIndex:3]; + NSString *hourString=@""; + if(hourRange.location!=NSNotFound){ + hourString = [youTubeTimeFormat substringWithRange:hourRange]; + } + + + NSRange minuteRange = [match rangeAtIndex:4]; + NSString *minuteString=@""; + if(minuteRange.location!=NSNotFound){ + minuteString = [youTubeTimeFormat substringWithRange:minuteRange]; + } + NSRange secRange = [match rangeAtIndex:5]; + NSString *secString = [youTubeTimeFormat substringWithRange:secRange]; + humanReadable = + [NSString stringWithFormat:@"%d:%02d:%02d",[hourString intValue], [minuteString intValue], [secString intValue]]; + + + } + + NSLog(@"Translated %@ to %@", youTubeTimeFormat, humanReadable); + return humanReadable; + } @end