Improvements to urlFilePath so that it only does a /Documents/ folder check if the file does not exist; improvements to full-screen options for iOS to default autorotate, and to respect landscape / portrait masks
This commit is contained in:
parent
3b0d459230
commit
37c31a3c92
@ -370,15 +370,17 @@ static int const RCTVideoUnset = -1;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL*) urlFilePath:(NSString*) filepath {
|
- (NSURL*) urlFilePath:(NSString*) filepath {
|
||||||
if ([filepath containsString:@"file://"] && ![filepath containsString:@"/Documents/"]) {
|
|
||||||
return [NSURL URLWithString:filepath];
|
// check if the file exists at the specified location
|
||||||
|
if ([[NSFileManager defaultManager] fileExistsAtPath:filepath]) {
|
||||||
|
return [NSURL fileURLWithPath:filepath];
|
||||||
}
|
}
|
||||||
|
|
||||||
// code to support local caching
|
// if no file found, check if the file exists in the Document directory
|
||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
NSString* relativeFilePath = [filepath lastPathComponent];
|
NSString* relativeFilePath = [filepath lastPathComponent];
|
||||||
// the file may be multiple levels below the documents directory
|
// the file may be multiple levels below the documents directory
|
||||||
NSArray* fileComponents = [filepath componentsSeparatedByString:@"Documents/"];
|
NSArray* fileComponents = [filepath componentsSeparatedByString:@"/Documents/"];
|
||||||
if (fileComponents.count>1) {
|
if (fileComponents.count>1) {
|
||||||
relativeFilePath = [fileComponents objectAtIndex:1];
|
relativeFilePath = [fileComponents objectAtIndex:1];
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
- (id)init {
|
- (id)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
self.autorotate = false;
|
self.autorotate = true; // autorotate should be true by default
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -27,12 +27,18 @@
|
|||||||
|
|
||||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
||||||
|
|
||||||
|
if ([self.preferredOrientation.lowercaseString isEqualToString:@"landscape"]) {
|
||||||
|
return UIInterfaceOrientationMaskLandscape;
|
||||||
|
}
|
||||||
|
else if ([self.preferredOrientation.lowercaseString isEqualToString:@"portrait"]) {
|
||||||
|
return UIInterfaceOrientationMaskPortrait;
|
||||||
|
}
|
||||||
return UIInterfaceOrientationMaskAll;
|
return UIInterfaceOrientationMaskAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
|
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
|
||||||
if ([self.preferredOrientation.lowercaseString isEqualToString:@"landscape"]) {
|
if ([self.preferredOrientation.lowercaseString isEqualToString:@"landscape"]) {
|
||||||
return UIInterfaceOrientationLandscapeLeft;
|
return UIInterfaceOrientationLandscapeRight;
|
||||||
}
|
}
|
||||||
else if ([self.preferredOrientation.lowercaseString isEqualToString:@"portrait"]) {
|
else if ([self.preferredOrientation.lowercaseString isEqualToString:@"portrait"]) {
|
||||||
return UIInterfaceOrientationPortrait;
|
return UIInterfaceOrientationPortrait;
|
||||||
|
Loading…
Reference in New Issue
Block a user