Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

- Fix viewcontroller's being shrink down in large screen by adding so… #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
{
"images" : [
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "[email protected]",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "[email protected]",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "[email protected]",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"extent" : "full-screen",
"filename" : "[email protected]",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 33 additions & 18 deletions YouTube Direct Lite for iOS/Utils.m
Original file line number Diff line number Diff line change
Expand Up @@ -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