mirror of
https://gitee.com/shuto/cordova-plugin-file-opener2.git
synced 2025-01-31 12:02:49 +08:00
Improve formatting
This commit is contained in:
parent
eabe4a1e16
commit
012ca186e8
@ -30,7 +30,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
@synthesize controller = docController;
|
@synthesize controller = docController;
|
||||||
|
|
||||||
- (void) open: (CDVInvokedUrlCommand*)command {
|
- (void) open: (CDVInvokedUrlCommand*)command {
|
||||||
|
|
||||||
NSString *path = [command.arguments objectAtIndex:0];
|
NSString *path = [command.arguments objectAtIndex:0];
|
||||||
NSString *contentType = [command.arguments objectAtIndex:1];
|
NSString *contentType = [command.arguments objectAtIndex:1];
|
||||||
BOOL showPreview = YES;
|
BOOL showPreview = YES;
|
||||||
@ -55,6 +54,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
NSURL *fileURL = NULL;
|
NSURL *fileURL = NULL;
|
||||||
NSString *decodedPath = [path stringByRemovingPercentEncoding];
|
NSString *decodedPath = [path stringByRemovingPercentEncoding];
|
||||||
|
|
||||||
if ([path isEqualToString:decodedPath]) {
|
if ([path isEqualToString:decodedPath]) {
|
||||||
NSLog(@"Path parameter not encoded. Building file URL encoding it...");
|
NSLog(@"Path parameter not encoded. Building file URL encoding it...");
|
||||||
fileURL = [NSURL fileURLWithPath:[path stringByReplacingOccurrencesOfString:@"file://" withString:@""]];;
|
fileURL = [NSURL fileURLWithPath:[path stringByReplacingOccurrencesOfString:@"file://" withString:@""]];;
|
||||||
@ -67,6 +67,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
NSLog(@"looking for file at %@", fileURL);
|
NSLog(@"looking for file at %@", fileURL);
|
||||||
NSFileManager *fm = [NSFileManager defaultManager];
|
NSFileManager *fm = [NSFileManager defaultManager];
|
||||||
|
|
||||||
if(![fm fileExistsAtPath:localFile]) {
|
if(![fm fileExistsAtPath:localFile]) {
|
||||||
NSDictionary *jsonObj = @{@"status" : @"9",
|
NSDictionary *jsonObj = @{@"status" : @"9",
|
||||||
@"message" : @"File does not exist"};
|
@"message" : @"File does not exist"};
|
||||||
@ -116,6 +117,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
];
|
];
|
||||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:jsonObj];
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:jsonObj];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user