cordova-plugin-mserviceinterface-2.0 1.0.97 → 1.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/ios/mInterface.m +31 -21
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
3
|
-
xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.
|
|
3
|
+
xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.98">
|
|
4
4
|
<name>mserviceinterface-2.0</name>
|
|
5
5
|
<description>This plugin establishes the connection to the native interface and performs the requested task.</description>
|
|
6
6
|
<author>selfservit@gmail.com</author>
|
package/src/ios/mInterface.m
CHANGED
|
@@ -3275,33 +3275,43 @@
|
|
|
3275
3275
|
|
|
3276
3276
|
- (void)OpenFileWithViewer:(CDVInvokedUrlCommand *)command {
|
|
3277
3277
|
self.fileOpenCallbackId = command.callbackId;
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3278
|
+
|
|
3279
|
+
CDVPluginResult *commandResult = nil;
|
|
3280
|
+
NSString *filePath = [command.arguments objectAtIndex:0];
|
|
3281
|
+
|
|
3282
|
+
if (filePath != nil && [filePath length] > 0) {
|
|
3283
|
+
NSURL *url = [NSURL URLWithString:filePath];
|
|
3284
|
+
|
|
3285
|
+
NSError *err = nil;
|
|
3286
|
+
if (url.isFileURL && [url checkResourceIsReachableAndReturnError:&err]) {
|
|
3287
|
+
self.fileUrl = url;
|
|
3288
|
+
|
|
3289
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
3286
3290
|
QLPreviewController *previewCtrl = [[QLPreviewController alloc] init];
|
|
3287
3291
|
previewCtrl.delegate = self;
|
|
3288
3292
|
previewCtrl.dataSource = self;
|
|
3289
3293
|
[previewCtrl.navigationItem setRightBarButtonItem:nil];
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3294
|
+
|
|
3295
|
+
[self.viewController presentViewController:previewCtrl
|
|
3296
|
+
animated:YES
|
|
3297
|
+
completion:nil];
|
|
3298
|
+
});
|
|
3299
|
+
|
|
3300
|
+
commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
|
|
3301
|
+
messageAsString:@"Success"];
|
|
3302
|
+
[commandResult setKeepCallback:@(YES)];
|
|
3299
3303
|
} else {
|
|
3300
|
-
NSLog(@"
|
|
3301
|
-
commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
|
|
3304
|
+
NSLog(@"Invalid file URL: %@", err);
|
|
3305
|
+
commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
|
|
3306
|
+
messageAsString:@"Invalid file URL"];
|
|
3302
3307
|
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3308
|
+
} else {
|
|
3309
|
+
NSLog(@"Missing URL argument");
|
|
3310
|
+
commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
|
|
3311
|
+
messageAsString:@"Missing URL argument"];
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3314
|
+
[self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
|
|
3305
3315
|
}
|
|
3306
3316
|
|
|
3307
3317
|
#pragma - QLPreviewControllerDataSource Protocol
|