cordova-plugin-unvired-universal-sdk 1.0.6 → 1.0.9
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 +2 -14
- package/www/kernel.js +38344 -1243
- package/aar/README.md +0 -3
- package/aar/Unvired_Kernel_Android.aar +0 -0
- package/aar/Unvired_Kernel_HTML5_Android.aar +0 -0
- package/src/android/build.gradle +0 -35
- package/src/android/xml/provider_paths.xml +0 -21
- package/src/browser/UnviredPluginProxy.js +0 -2430
- package/src/browser/bootstrap.min.js +0 -17
- package/src/browser/codemirror.js +0 -9755
- package/src/browser/jquery-3.2.1.js +0 -10253
- package/src/browser/sql-wasm.wasm +0 -0
- package/src/browser/sql.js +0 -203
- package/src/browser/src_index_worker_js.unvired-db-worker.js +0 -231
- package/src/browser/unvired-db-worker.js +0 -166
- package/src/browser/vendors-node_modules_comlink_dist_esm_comlink_mjs.unvired-db-worker.js +0 -22
- package/src/ios/AttachmentPlugin.h +0 -21
- package/src/ios/AttachmentPlugin.m +0 -180
- package/src/ios/DataStructureHelper.h +0 -28
- package/src/ios/DataStructureHelper.m +0 -188
- package/src/ios/IOSAuthPlugin.h +0 -14
- package/src/ios/IOSAuthPlugin.m +0 -13
- package/src/ios/IOSDatabasePlugin.h +0 -28
- package/src/ios/IOSDatabasePlugin.m +0 -253
- package/src/ios/IOSFWSettingsPlugin.h +0 -65
- package/src/ios/IOSFWSettingsPlugin.m +0 -363
- package/src/ios/IOSLoggerPlugin.h +0 -34
- package/src/ios/IOSLoggerPlugin.m +0 -198
- package/src/ios/IOSLoginPlugin.h +0 -29
- package/src/ios/IOSLoginPlugin.m +0 -480
- package/src/ios/IOSProxyPlugin.h +0 -21
- package/src/ios/IOSProxyPlugin.m +0 -172
- package/src/ios/IOSSyncEnginePlugin.h +0 -54
- package/src/ios/IOSSyncEnginePlugin.m +0 -847
- package/src/ios/PluginConstants.h +0 -195
- package/src/ios/PluginHelper.h +0 -29
- package/src/ios/PluginHelper.m +0 -74
- package/src/ios/SyncHTML5Response.h +0 -50
- package/src/ios/SyncHTML5Response.m +0 -68
- package/www/applicationMeta/applicationMetadataParser.ts +0 -285
- package/www/applicationMeta/fieldConstants.ts +0 -92
- package/www/attachment/attachmentHelper.ts +0 -326
- package/www/attachment/attachmentQHelper.ts +0 -158
- package/www/attachment/attachmentService.ts +0 -259
- package/www/authenticationService.ts +0 -751
- package/www/database/appDatabaseManager.ts +0 -54
- package/www/database/databaseManager.ts +0 -616
- package/www/helper/dbCreateTablesManager.ts +0 -354
- package/www/helper/frameworkHelper.ts +0 -127
- package/www/helper/frameworkSettingsManager.ts +0 -287
- package/www/helper/getMessageTimerManager.ts +0 -81
- package/www/helper/httpConnection.ts +0 -1051
- package/www/helper/logger.ts +0 -312
- package/www/helper/notificationListnerHelper.ts +0 -56
- package/www/helper/passcodeGenerator.ts +0 -61
- package/www/helper/reconciler.ts +0 -1062
- package/www/helper/serverResponseHandler.ts +0 -677
- package/www/helper/serviceConstants.ts +0 -254
- package/www/helper/settingsHelper.ts +0 -386
- package/www/helper/status.ts +0 -83
- package/www/helper/syncInputDataManager.ts +0 -205
- package/www/helper/unviredAccount.ts +0 -104
- package/www/helper/unviredAccountManager.ts +0 -120
- package/www/helper/urlService.ts +0 -43
- package/www/helper/userSettingsManager.ts +0 -172
- package/www/helper/utils.ts +0 -110
- package/www/inbox/downloadMessageService.ts +0 -270
- package/www/inbox/inboxHelper.ts +0 -132
- package/www/inbox/inboxService.ts +0 -223
- package/www/outbox/outboxAttachmentManager.ts +0 -152
- package/www/outbox/outboxHelper.ts +0 -67
- package/www/outbox/outboxService.ts +0 -519
- package/www/subtract.ts +0 -5
- package/www/sum.ts +0 -4
- package/www/syncEngine.ts +0 -687
package/src/ios/IOSLoginPlugin.m
DELETED
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IOSLoginPlugin.m
|
|
3
|
-
// iOS HTML5 Kernel
|
|
4
|
-
//
|
|
5
|
-
// Created by Srinidhi on 09/09/14.
|
|
6
|
-
// Copyright (c) 2014 Unvired Software India Pvt. Ltd. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import "IOSLoginPlugin.h"
|
|
10
|
-
#import "LoginParameters.h"
|
|
11
|
-
#import "Logger.h"
|
|
12
|
-
#import "FrameworkHelper.h"
|
|
13
|
-
#import "CredentialsKeyChainManager.h"
|
|
14
|
-
#import "RuntimeEngine.h"
|
|
15
|
-
#import "UserSettingsManager.h"
|
|
16
|
-
#import "SyncEngine.h"
|
|
17
|
-
#import "PluginConstants.h"
|
|
18
|
-
#import "UnviredAuthenticationService.h"
|
|
19
|
-
#import "AuthenticationService.h"
|
|
20
|
-
#import "UnviredFrameworkUtils.h"
|
|
21
|
-
#import "PathManager.h"
|
|
22
|
-
#import "PluginConstants.h"
|
|
23
|
-
#import "UnviredAccount.h"
|
|
24
|
-
#import "PluginHelper.h"
|
|
25
|
-
#import "UnviredAccount.h"
|
|
26
|
-
#import "UnviredAccountUtils.h"
|
|
27
|
-
#import "HTML5Utils.h"
|
|
28
|
-
#import "ServerTrustEvaluator.h"
|
|
29
|
-
|
|
30
|
-
@interface IOSLoginPlugin () <LoginActivityListener, DemoModeListener>
|
|
31
|
-
|
|
32
|
-
@property (nonatomic, strong) NSString *loginCallbackId;
|
|
33
|
-
@property (nonatomic, strong) ServerTrustEvaluator *evaluater;
|
|
34
|
-
@end
|
|
35
|
-
|
|
36
|
-
@implementation IOSLoginPlugin
|
|
37
|
-
|
|
38
|
-
- (void)authenticateLocal:(CDVInvokedUrlCommand *)command {
|
|
39
|
-
|
|
40
|
-
[self.commandDelegate runInBackground: ^{
|
|
41
|
-
|
|
42
|
-
NSString *userid = NULL;
|
|
43
|
-
NSString *password = NULL;
|
|
44
|
-
NSError *error = NULL;
|
|
45
|
-
|
|
46
|
-
NSDictionary *jsonDictionary = command.arguments[0];
|
|
47
|
-
|
|
48
|
-
if (jsonDictionary) {
|
|
49
|
-
if ([jsonDictionary isKindOfClass:[NSDictionary class]]) {
|
|
50
|
-
userid = jsonDictionary[USER_NAME] ? jsonDictionary[USER_NAME] : @"";
|
|
51
|
-
password = jsonDictionary[PLUGIN_PASSWORD] ? jsonDictionary[PLUGIN_PASSWORD] : @"";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
BOOL authenticationSuccessfull = [UnviredAuthenticationService authenticateLocalWithUserID:userid password:password error:&error];
|
|
56
|
-
if (authenticationSuccessfull) {
|
|
57
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:login_success data:nil message:@"" error:@"" errorDetail:@""];
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
61
|
-
ClassName:[self class]
|
|
62
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
63
|
-
msg:[NSString stringWithFormat:@"ERROR: %@", [error localizedDescription]]];
|
|
64
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:login_error data:nil message:@"" error:[error localizedDescription] errorDetail:@""];
|
|
65
|
-
}
|
|
66
|
-
}];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
- (void)getAllAccount:(CDVInvokedUrlCommand *)command {
|
|
70
|
-
[self.commandDelegate runInBackground: ^{
|
|
71
|
-
|
|
72
|
-
NSArray <UnviredAccount*> *accountsArray = [[PathManager sharedManager] getAllAccounts];
|
|
73
|
-
NSMutableArray *accounts = [NSMutableArray array];
|
|
74
|
-
|
|
75
|
-
for (UnviredAccount *account in accountsArray) {
|
|
76
|
-
NSDictionary *accountDict = @{
|
|
77
|
-
ACC_COMPANY : account.company,
|
|
78
|
-
ACC_USERNAME : account.username,
|
|
79
|
-
ACC_SERVER_URL : account.serverURL,
|
|
80
|
-
ACC_ACCOUNT_ID : account.accountId,
|
|
81
|
-
ACC_FRIENDLY_NAME : account.friendlyName
|
|
82
|
-
};
|
|
83
|
-
[accounts addObject:accountDict];
|
|
84
|
-
}
|
|
85
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:success_result data:accounts message:@"" error:@"" errorDetail:@""];
|
|
86
|
-
}];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
- (void)switchAccount:(CDVInvokedUrlCommand *)command {
|
|
90
|
-
[self.commandDelegate runInBackground: ^{
|
|
91
|
-
NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
|
|
92
|
-
NSString *company = dataObjects[ACC_COMPANY];
|
|
93
|
-
NSString *userName = dataObjects[ACC_USERNAME];
|
|
94
|
-
NSString *serverURL = dataObjects[ACC_SERVER_URL];
|
|
95
|
-
NSString *accountId = dataObjects[ACC_ACCOUNT_ID];
|
|
96
|
-
NSString *friendlyName = dataObjects[ACC_FRIENDLY_NAME];
|
|
97
|
-
|
|
98
|
-
if (company == nil || userName == nil || serverURL == nil || accountId == nil || friendlyName == nil || company.length == 0 || userName.length == 0 || serverURL.length == 0 || accountId.length == 0 || friendlyName.length == 0) {
|
|
99
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
100
|
-
ClassName:[self class]
|
|
101
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
102
|
-
msg:[NSString stringWithFormat:@"Invalid Account Object. Account : %@", dataObjects.description]];
|
|
103
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:error_result data:nil message:@"" error:[NSString stringWithFormat:@"Invalid Account Object. Account : %@", dataObjects.description] errorDetail:@""];
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
UnviredAccount *account = [[UnviredAccount alloc] initWithUsername:userName company:company serverURL:serverURL friendlyName:friendlyName accountId:accountId];
|
|
107
|
-
[AuthenticationService prepareToSwitchAccount:account];
|
|
108
|
-
}
|
|
109
|
-
}];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
- (void)deleteAccount:(CDVInvokedUrlCommand *)command {
|
|
113
|
-
[self.commandDelegate runInBackground: ^{
|
|
114
|
-
NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
|
|
115
|
-
NSString *company = dataObjects[ACC_COMPANY];
|
|
116
|
-
NSString *userName = dataObjects[ACC_USERNAME];
|
|
117
|
-
NSString *serverURL = dataObjects[ACC_SERVER_URL];
|
|
118
|
-
NSString *accountId = dataObjects[ACC_ACCOUNT_ID];
|
|
119
|
-
NSString *friendlyName = dataObjects[ACC_FRIENDLY_NAME];
|
|
120
|
-
|
|
121
|
-
if (company == nil || userName == nil || serverURL == nil || accountId == nil || friendlyName == nil || company.length == 0 || userName.length == 0 || serverURL.length == 0 || accountId.length == 0 || friendlyName.length == 0) {
|
|
122
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
123
|
-
ClassName:[self class]
|
|
124
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
125
|
-
msg:[NSString stringWithFormat:@"Invalid Account Object. Account : %@", dataObjects.description]];
|
|
126
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:error_result data:nil message:@"" error:[NSString stringWithFormat:@"Invalid Account Object. Account : %@", dataObjects.description] errorDetail:@""];
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
UnviredAccount *account = [[UnviredAccount alloc] initWithUsername:userName company:company serverURL:serverURL friendlyName:friendlyName accountId:accountId];
|
|
130
|
-
|
|
131
|
-
NSError *error = nil;
|
|
132
|
-
|
|
133
|
-
BOOL isSuccess = [AuthenticationService deleteAccount:account error:&error];
|
|
134
|
-
|
|
135
|
-
if (!isSuccess && error != nil) {
|
|
136
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
137
|
-
ClassName:[self class]
|
|
138
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
139
|
-
msg:[NSString stringWithFormat:@"Error while deleting the Account. Error : %@", [error localizedDescription]]];
|
|
140
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:error_result data:nil message:@"" error:[error localizedDescription] errorDetail:@""];
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
}];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
- (void)login:(CDVInvokedUrlCommand *)command {
|
|
148
|
-
|
|
149
|
-
self.loginCallbackId = command.callbackId;
|
|
150
|
-
|
|
151
|
-
[LoginParameters sharedParameters].hideGetMessageStatusInformation = true;
|
|
152
|
-
[LoginParameters sharedParameters].hideMessageProcessingStatusInformation = true;
|
|
153
|
-
[LoginParameters sharedParameters].usesCordova = true;
|
|
154
|
-
[LoginParameters sharedParameters].demoModeRequired = false;
|
|
155
|
-
[LoginParameters sharedParameters].useCusomizedLoginScreen = true;
|
|
156
|
-
[LoginParameters sharedParameters].applicationWindow = [UIApplication sharedApplication].keyWindow;
|
|
157
|
-
[LoginParameters sharedParameters].loginActivityListener = self;
|
|
158
|
-
[LoginParameters sharedParameters].demoModeListener = self;
|
|
159
|
-
|
|
160
|
-
// Read the metadata.json here
|
|
161
|
-
NSDictionary *jsonDictionary = command.arguments[0];
|
|
162
|
-
[self setLoginParameters:jsonDictionary];
|
|
163
|
-
|
|
164
|
-
// For all login types, we require URL, App Name, Metadata path and Company
|
|
165
|
-
if ([LoginParameters sharedParameters].url.length == 0) {
|
|
166
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"LoginParameters: url empty or null."];
|
|
167
|
-
}
|
|
168
|
-
if ([LoginParameters sharedParameters].applicationName.length == 0) {
|
|
169
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"LoginParameters: Application name empty or null."];
|
|
170
|
-
}
|
|
171
|
-
if ([LoginParameters sharedParameters].defaultCompany.length == 0) {
|
|
172
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"LoginParameters: Company empty or null."];
|
|
173
|
-
}
|
|
174
|
-
if ([LoginParameters sharedParameters].metadataJSON.length == 0) {
|
|
175
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"LoginParameters: metadata JSON empty or null."];
|
|
176
|
-
}
|
|
177
|
-
if (![LoginParameters sharedParameters].loginType) {
|
|
178
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"LoginParameters: Login Type empty or null."];
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// For SAML Login, we require JWTOptions and Redirect URL
|
|
182
|
-
if ([LoginParameters sharedParameters].loginType == LoginTypeSAML2) {
|
|
183
|
-
if ([LoginParameters sharedParameters].SAMLRedirectURL.length == 0) {
|
|
184
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"LoginParameters: SAML redirect URL empty or null."];
|
|
185
|
-
}
|
|
186
|
-
if ([LoginParameters sharedParameters].jwtOptions.length == 0) {
|
|
187
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"LoginParameters: JWT options empty or null."];
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
[AuthenticationService login];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
- (void)sendLoginCallback:(LISTENER_TYPE)type error:(NSError *)error {
|
|
195
|
-
[self.commandDelegate runInBackground: ^{
|
|
196
|
-
NSString *lastLoggedInUserName = @"";
|
|
197
|
-
if (type == show_subsequent_login) {
|
|
198
|
-
// Send tbe Last Logged in User Information.
|
|
199
|
-
NSString *lastLoggedInAccountId = [[CredentialsKeyChainManager sharedManager] getStoredCredentialWithKey:LAST_ACTIVE_ACCOUNT];
|
|
200
|
-
UnviredAccount *lastActiveAccount = [UnviredAccountUtils extractAccountFromKeyChainAccessWith:lastLoggedInAccountId];
|
|
201
|
-
if (lastActiveAccount) {
|
|
202
|
-
lastLoggedInUserName = [lastActiveAccount.username uppercaseString];
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
NSString *errorMessage = @"";
|
|
206
|
-
if (error != NULL) {
|
|
207
|
-
errorMessage = [error localizedDescription];
|
|
208
|
-
}
|
|
209
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:self.loginCallbackId type:type data:lastLoggedInUserName message:@"" error:errorMessage errorDetail:@""];
|
|
210
|
-
}];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
- (void)loginWithDemoData:(CDVInvokedUrlCommand *)command {
|
|
214
|
-
[LoginParameters sharedParameters].usesCordova = true;
|
|
215
|
-
[LoginParameters sharedParameters].demoModeRequired = true;
|
|
216
|
-
[LoginParameters sharedParameters].demoModeListener = self;
|
|
217
|
-
|
|
218
|
-
// Read the metadata.json here
|
|
219
|
-
NSDictionary *jsonDictionary = command.arguments[0];
|
|
220
|
-
NSString *metadataJSON = jsonDictionary[METADATA_JSON] ? jsonDictionary[METADATA_JSON] : @"";
|
|
221
|
-
if (metadataJSON.length > 0) {
|
|
222
|
-
[LoginParameters sharedParameters].metadataJSON = metadataJSON;
|
|
223
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"Using metadata.json"];
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
NSString *demoDataString = jsonDictionary[DEMO_DATA] ? jsonDictionary[DEMO_DATA] : @"";
|
|
227
|
-
|
|
228
|
-
if (demoDataString.length == 0 || ![demoDataString hasPrefix:@"<"]) {
|
|
229
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:demo_data_error data:@"" message:@"" error:@"" errorDetail:@""];
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
LISTENER_TYPE type = [AuthenticationService loginWithDemoData:demoDataString];
|
|
233
|
-
[self.commandDelegate runInBackground: ^{
|
|
234
|
-
NSString *lastLoggedInUserName = @"";
|
|
235
|
-
|
|
236
|
-
// Send tbe Last Logged in User Information.
|
|
237
|
-
NSString *lastLoggedInAccountId = [[CredentialsKeyChainManager sharedManager] getStoredCredentialWithKey:LAST_ACTIVE_ACCOUNT];
|
|
238
|
-
if (type == show_subsequent_login) {
|
|
239
|
-
|
|
240
|
-
UnviredAccount *lastActiveAccount = [UnviredAccountUtils extractAccountFromKeyChainAccessWith:lastLoggedInAccountId];
|
|
241
|
-
if (lastActiveAccount) {
|
|
242
|
-
lastLoggedInUserName = [lastActiveAccount.username uppercaseString];
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:type data:lastLoggedInUserName message:@"" error:@"" errorDetail:@""];
|
|
247
|
-
}];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
- (void)logout:(CDVInvokedUrlCommand *)command {
|
|
251
|
-
[AuthenticationService logout];
|
|
252
|
-
[self.commandDelegate runInBackground: ^{
|
|
253
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
254
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
255
|
-
}];
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
- (void)authenticate:(CDVInvokedUrlCommand *)command {
|
|
259
|
-
[self.commandDelegate runInBackground: ^{
|
|
260
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT
|
|
261
|
-
ClassName:[self class]
|
|
262
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
263
|
-
msg:@"Authenticate Method Called"];
|
|
264
|
-
|
|
265
|
-
NSDictionary *jsonDictionary = command.arguments[0];
|
|
266
|
-
|
|
267
|
-
NSString *userName = jsonDictionary[USER_NAME] ? jsonDictionary[USER_NAME] : @"";;
|
|
268
|
-
NSString *password = jsonDictionary[PLUGIN_PASSWORD] ? jsonDictionary[PLUGIN_PASSWORD] : @"";
|
|
269
|
-
|
|
270
|
-
NSError *error = NULL;
|
|
271
|
-
BOOL authenticationSuccessfull = [UnviredAuthenticationService authenticateWithUserID:userName serverPassword:password error:&error];
|
|
272
|
-
|
|
273
|
-
if (authenticationSuccessfull) {
|
|
274
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:auth_success data:nil message:@"" error:@"" errorDetail:@""];
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
278
|
-
ClassName:[self class]
|
|
279
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
280
|
-
msg:[NSString stringWithFormat:@"ERROR: %@", [error localizedDescription]]];
|
|
281
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
282
|
-
callbackId:command.callbackId
|
|
283
|
-
type:auth_error
|
|
284
|
-
data:nil
|
|
285
|
-
message:@""
|
|
286
|
-
error:[error localizedDescription]
|
|
287
|
-
errorDetail:@""];
|
|
288
|
-
}
|
|
289
|
-
}];
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
- (void)authenticateAndActivate:(CDVInvokedUrlCommand *)command {
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
Need to reset the loginCallbackId to that of ths method.
|
|
296
|
-
If user has already called this function, then most likely he/she will be dealing with the new set of methods.
|
|
297
|
-
*/
|
|
298
|
-
self.loginCallbackId = command.callbackId;
|
|
299
|
-
|
|
300
|
-
[self.commandDelegate runInBackground: ^{
|
|
301
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT
|
|
302
|
-
ClassName:[self class]
|
|
303
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
304
|
-
msg:@"Authenticate And Activate Method Called"];
|
|
305
|
-
|
|
306
|
-
NSDictionary *jsonDictionary = command.arguments[0];
|
|
307
|
-
|
|
308
|
-
if (jsonDictionary) {
|
|
309
|
-
if ([jsonDictionary isKindOfClass:[NSDictionary class]]) {
|
|
310
|
-
[self setLoginParameters:jsonDictionary];
|
|
311
|
-
|
|
312
|
-
NSString *userId = jsonDictionary[USER_NAME] ? jsonDictionary[USER_NAME] : @"";
|
|
313
|
-
NSString *password = jsonDictionary[PLUGIN_PASSWORD] ? jsonDictionary[PLUGIN_PASSWORD] : @"";
|
|
314
|
-
|
|
315
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT
|
|
316
|
-
ClassName:[self class]
|
|
317
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
318
|
-
msg:[NSString stringWithFormat:@"Logging in with Login Module: %lu", (unsigned long)[LoginParameters sharedParameters].loginType]];
|
|
319
|
-
|
|
320
|
-
dispatch_async(dispatch_get_main_queue(), ^{
|
|
321
|
-
|
|
322
|
-
NSString *loginType = jsonDictionary[LOGIN_TYPE];
|
|
323
|
-
if ([LoginParameters sharedParameters].loginType == LoginTypeSAML2) {
|
|
324
|
-
NSLog(@"Logging Via SAML SSO. ");
|
|
325
|
-
[AuthenticationService loginViaSSO];
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
self.evaluater = [[ServerTrustEvaluator alloc] init];
|
|
330
|
-
__weak IOSLoginPlugin *weakSelf = self;
|
|
331
|
-
self.evaluater.onTrustSuccess = ^{
|
|
332
|
-
NSError *loginError = NULL;
|
|
333
|
-
BOOL result = [AuthenticationService authenticateAndActivate:[LoginParameters sharedParameters].url
|
|
334
|
-
serverUserId:userId
|
|
335
|
-
serverPassword:password
|
|
336
|
-
companyAlias:[LoginParameters sharedParameters].defaultCompany
|
|
337
|
-
customDeviceIdentifier:[LoginParameters sharedParameters].customDeviceID
|
|
338
|
-
andApplicationName:[LoginParameters sharedParameters].applicationName
|
|
339
|
-
error:&loginError];
|
|
340
|
-
|
|
341
|
-
if (result) {
|
|
342
|
-
[PluginHelper sendListenerCallback:weakSelf.commandDelegate callbackId:command.callbackId type:auth_success data:nil message:@"" error:@"" errorDetail:@""];
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
|
|
346
|
-
NSString *errorInformation = [loginError localizedDescription];
|
|
347
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
348
|
-
ClassName:[weakSelf class]
|
|
349
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
350
|
-
msg:errorInformation];
|
|
351
|
-
|
|
352
|
-
[PluginHelper sendListenerCallback:weakSelf.commandDelegate callbackId:command.callbackId type:auth_error data:nil message:@"" error: errorInformation errorDetail:@""];
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
self.evaluater.onTrustFailure = ^{
|
|
356
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT
|
|
357
|
-
ClassName:[weakSelf class]
|
|
358
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
359
|
-
msg:@"User rejected the certificate. Maintain the status quo."];
|
|
360
|
-
};
|
|
361
|
-
[self.evaluater evaluate];
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
366
|
-
ClassName:[self class]
|
|
367
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
368
|
-
msg:[NSString stringWithFormat:@"Error while getting dictionary from the command. Command: %@ ", [command description]]];
|
|
369
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:auth_error data:nil message:@"" error:[command description] errorDetail:@""];
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}];
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
-(void)setLoginParameters:(NSDictionary *)jsonDictionary {
|
|
376
|
-
NSError *error = nil;
|
|
377
|
-
|
|
378
|
-
NSString *url = jsonDictionary[URL] ? jsonDictionary[URL] : @"";
|
|
379
|
-
[LoginParameters sharedParameters].url = url;
|
|
380
|
-
|
|
381
|
-
NSString *companyAlias = jsonDictionary[COMPANY] ? jsonDictionary[COMPANY] : @"";
|
|
382
|
-
[[LoginParameters sharedParameters] setCompany:companyAlias];
|
|
383
|
-
[[LoginParameters sharedParameters] setDefaultCompany:companyAlias];
|
|
384
|
-
|
|
385
|
-
NSString *customDeviceId = jsonDictionary[FEUSRID] ? jsonDictionary[FEUSRID] : @"";
|
|
386
|
-
[[LoginParameters sharedParameters] setCustomDeviceID:customDeviceId];
|
|
387
|
-
|
|
388
|
-
NSString *appName = jsonDictionary[APPL_NAME] ? jsonDictionary[APPL_NAME] : @"";
|
|
389
|
-
[[LoginParameters sharedParameters] setApplicationName:appName];
|
|
390
|
-
|
|
391
|
-
NSString *redirectURL = jsonDictionary[SAML_REDIRECT_URL] ? jsonDictionary[SAML_REDIRECT_URL] : @"";
|
|
392
|
-
[[LoginParameters sharedParameters] setSAMLRedirectURL:redirectURL];
|
|
393
|
-
|
|
394
|
-
NSString *loginLanguage = jsonDictionary[LOGIN_LANGUAGE] ? jsonDictionary[LOGIN_LANGUAGE] : @"";
|
|
395
|
-
[[LoginParameters sharedParameters] setLoginLanguage:loginLanguage];
|
|
396
|
-
|
|
397
|
-
NSString *domainName = jsonDictionary[LOGIN_DOMAIN] ? jsonDictionary[LOGIN_DOMAIN] : @"";
|
|
398
|
-
[LoginParameters sharedParameters].domainName = domainName;
|
|
399
|
-
|
|
400
|
-
NSString *loginType = jsonDictionary[LOGIN_TYPE] ? jsonDictionary[LOGIN_TYPE] : LOGIN_MODULE_UNVIRED;
|
|
401
|
-
if ([loginType caseInsensitiveCompare:LOGIN_MODULE_UNVIRED] == NSOrderedSame) {
|
|
402
|
-
[LoginParameters sharedParameters].loginType = LoginTypeUnviredId;
|
|
403
|
-
}
|
|
404
|
-
else if ([loginType caseInsensitiveCompare:LOGIN_MODULE_ADS] == NSOrderedSame) {
|
|
405
|
-
[LoginParameters sharedParameters].loginType = LoginTypeADS;
|
|
406
|
-
}
|
|
407
|
-
else if ([loginType caseInsensitiveCompare:LOGIN_MODULE_EMAIL] == NSOrderedSame) {
|
|
408
|
-
[LoginParameters sharedParameters].loginType = LoginTypeEmail;
|
|
409
|
-
}
|
|
410
|
-
else if ([loginType caseInsensitiveCompare:LOGIN_MODULE_SAP] == NSOrderedSame) {
|
|
411
|
-
[LoginParameters sharedParameters].loginType = LoginTypeSAP;
|
|
412
|
-
}
|
|
413
|
-
else if ([loginType caseInsensitiveCompare:LOGIN_MODULE_CUSTOM] == NSOrderedSame) {
|
|
414
|
-
[LoginParameters sharedParameters].loginType = LoginTypeCustom;
|
|
415
|
-
}
|
|
416
|
-
else if ([loginType caseInsensitiveCompare:LOGIN_MODULE_SAML2] == NSOrderedSame) {
|
|
417
|
-
[LoginParameters sharedParameters].loginType = LoginTypeSAML2;
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
[LoginParameters sharedParameters].loginType = loginType.integerValue;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
NSDictionary *jwtOptions = jsonDictionary[JWT_OPTIONS];
|
|
424
|
-
if (jwtOptions != nil) {
|
|
425
|
-
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jwtOptions options:NSJSONWritingPrettyPrinted error:&error];
|
|
426
|
-
if (jsonData != NULL) {
|
|
427
|
-
[[LoginParameters sharedParameters] setJwtOptions:[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]];
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
NSString *metadataJSON = jsonDictionary[METADATA_JSON] ? jsonDictionary[METADATA_JSON] : @"";
|
|
432
|
-
if (metadataJSON.length > 0) {
|
|
433
|
-
[LoginParameters sharedParameters].metadataJSON = metadataJSON;
|
|
434
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:@"Using metadata.json"];
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
#pragma mark - Demo mode Delegate
|
|
439
|
-
-(void)applicationStartedInDemoMode {
|
|
440
|
-
[self sendLoginCallback:login_demo error:NULL];
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
#pragma mark - Login Delegate
|
|
444
|
-
|
|
445
|
-
- (void)displayCustomizedLoginScreenForAuthenticateAndActivate {
|
|
446
|
-
[self sendLoginCallback:show_login error:NULL];
|
|
447
|
-
}
|
|
448
|
-
- (void)displayCustomizedLoginScreenForAuthenticatication {
|
|
449
|
-
[self sendLoginCallback:show_subsequent_login error:NULL];
|
|
450
|
-
}
|
|
451
|
-
- (void)didFindMultipleAccounts:(NSArray<UnviredAccount*> *)accounts withLastLoggedInAccount:(UnviredAccount *)unviredAccount {
|
|
452
|
-
// TODO
|
|
453
|
-
}
|
|
454
|
-
- (void)userDidLogout:(UnviredAccount *)loggedOutAccount {
|
|
455
|
-
// TODO
|
|
456
|
-
}
|
|
457
|
-
- (void)userDidClearData:(UnviredAccount *)deletedAccount {
|
|
458
|
-
// TODO:
|
|
459
|
-
}
|
|
460
|
-
- (void)userDidUpdatePassword:(NSString *)password forUnviredAccount:(UnviredAccount *)account {
|
|
461
|
-
// TODO:
|
|
462
|
-
}
|
|
463
|
-
- (void)didInitiatePasswordChangeForUnviredAccount:(UnviredAccount *)account {
|
|
464
|
-
// TODO:
|
|
465
|
-
}
|
|
466
|
-
- (void)loginSuccessful {
|
|
467
|
-
[self sendLoginCallback:login_success error:NULL];
|
|
468
|
-
}
|
|
469
|
-
- (void)loginFailedWithError:(NSError *)error {
|
|
470
|
-
[self sendLoginCallback:login_error error:error];
|
|
471
|
-
}
|
|
472
|
-
- (void)authenticationAndActivationSuccessful {
|
|
473
|
-
[self sendLoginCallback:auth_success error:NULL];
|
|
474
|
-
}
|
|
475
|
-
- (void)authenticationAndActivationFailedWithError:(NSError *)error {
|
|
476
|
-
[self sendLoginCallback:auth_error error:error];
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
@end
|
package/src/ios/IOSProxyPlugin.h
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IOSProxyPlugin.h
|
|
3
|
-
// Unvired_Framework
|
|
4
|
-
//
|
|
5
|
-
// Created by Srinidhi Rao on 15/05/18.
|
|
6
|
-
// Copyright © 2018 Unvired Software India Pvt. Ltd. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import <Cordova/CDVPlugin.h>
|
|
10
|
-
#import <QuickLook/QuickLook.h>
|
|
11
|
-
#import "UnviredPreviewItem.h"
|
|
12
|
-
|
|
13
|
-
@interface IOSProxyPlugin : CDVPlugin <QLPreviewControllerDataSource>
|
|
14
|
-
|
|
15
|
-
- (void)launchBase64:(CDVInvokedUrlCommand *)command;
|
|
16
|
-
|
|
17
|
-
- (void)launchFile:(CDVInvokedUrlCommand *)command;
|
|
18
|
-
|
|
19
|
-
- (void)unzip:(CDVInvokedUrlCommand *)command;
|
|
20
|
-
|
|
21
|
-
@end
|
package/src/ios/IOSProxyPlugin.m
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IOSProxyPlugin.m
|
|
3
|
-
// Unvired_Framework
|
|
4
|
-
//
|
|
5
|
-
// Created by Srinidhi Rao on 15/05/18.
|
|
6
|
-
// Copyright © 2018 Unvired Software India Pvt. Ltd. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import "IOSProxyPlugin.h"
|
|
10
|
-
#import "PluginHelper.h"
|
|
11
|
-
#import "AuthenticationService.h"
|
|
12
|
-
#import "NSData+Base64.h"
|
|
13
|
-
#import "Logger.h"
|
|
14
|
-
|
|
15
|
-
@interface IOSProxyPlugin ()
|
|
16
|
-
@property (nonatomic, strong) NSURL *currentFileURL;
|
|
17
|
-
@property (nonatomic, strong) NSString *currentFileName;
|
|
18
|
-
@end
|
|
19
|
-
|
|
20
|
-
@implementation IOSProxyPlugin
|
|
21
|
-
|
|
22
|
-
- (void)openFile:(NSString *)fileURL withCommand:(CDVInvokedUrlCommand *)command {
|
|
23
|
-
self.currentFileURL = [NSURL fileURLWithPath:fileURL];
|
|
24
|
-
if (self.currentFileURL == nil) {
|
|
25
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
26
|
-
callbackId:command.callbackId
|
|
27
|
-
type:error_result
|
|
28
|
-
data:nil
|
|
29
|
-
message:@""
|
|
30
|
-
error:[NSString stringWithFormat:@"Error while creating a NSURL from a file URL: %@\n", fileURL]
|
|
31
|
-
errorDetail:@""];
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Open the file in QLPreviewViewController.
|
|
36
|
-
QLPreviewController *previewController = [[QLPreviewController alloc] init];
|
|
37
|
-
[previewController setDataSource:self];
|
|
38
|
-
[previewController setCurrentPreviewItemIndex:0];
|
|
39
|
-
[previewController setModalPresentationStyle:UIModalPresentationFullScreen];
|
|
40
|
-
|
|
41
|
-
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:previewController animated:true completion:^{
|
|
42
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT
|
|
43
|
-
ClassName:[self class]
|
|
44
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
45
|
-
msg:[NSString stringWithFormat:@"Presented the QLPreview Controller for the File @ URL: %@", self.currentFileURL]];
|
|
46
|
-
}];
|
|
47
|
-
|
|
48
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
49
|
-
callbackId:command.callbackId
|
|
50
|
-
type:success_result
|
|
51
|
-
data:@""
|
|
52
|
-
message:@""
|
|
53
|
-
error:@""
|
|
54
|
-
errorDetail:@""];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
- (void)launchBase64:(CDVInvokedUrlCommand *)command {
|
|
58
|
-
|
|
59
|
-
CDVPluginResult *pluginResult = nil;
|
|
60
|
-
NSError *error = NULL;
|
|
61
|
-
NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
|
|
62
|
-
NSString *base64String = dataObjects[@"base64"];
|
|
63
|
-
NSString *fileName = dataObjects[@"fileName"];
|
|
64
|
-
NSString *extension = dataObjects[@"extension"];
|
|
65
|
-
|
|
66
|
-
if (base64String.length == 0) {
|
|
67
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
68
|
-
callbackId:command.callbackId
|
|
69
|
-
type:error_result
|
|
70
|
-
data:nil
|
|
71
|
-
message:@""
|
|
72
|
-
error:@"Base64 String is Null or empty"
|
|
73
|
-
errorDetail:@""];
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
NSData *data = [NSData dataFromBase64String:base64String];
|
|
78
|
-
if (data.length == 0) {
|
|
79
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
80
|
-
callbackId:command.callbackId
|
|
81
|
-
type:error_result
|
|
82
|
-
data:nil
|
|
83
|
-
message:@""
|
|
84
|
-
error:[NSString stringWithFormat:@"Invalid Base64 String. Unable to get NSData out of it. Base64 String: %@\n", base64String]
|
|
85
|
-
errorDetail:@""];
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (fileName.length == 0) {
|
|
90
|
-
NSString *tempFileName = @"MyDocument";
|
|
91
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT
|
|
92
|
-
ClassName:[self class]
|
|
93
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
94
|
-
msg:[NSString stringWithFormat:@"Invalid File Name specified. File Name: %@. Using the file Name: %@", fileName, tempFileName]];
|
|
95
|
-
fileName = tempFileName;
|
|
96
|
-
}
|
|
97
|
-
if (extension.length == 0) {
|
|
98
|
-
NSString *tempExtension = @"pdf";
|
|
99
|
-
[Logger loggerWithlog:LEVEL_IMPORTANT
|
|
100
|
-
ClassName:[self class]
|
|
101
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
102
|
-
msg:[NSString stringWithFormat:@"Invalid File Extension specified. Extension: %@. Using the default extension: %@", extension, tempExtension]];
|
|
103
|
-
extension = tempExtension;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Clean up Extension
|
|
107
|
-
NSRange range = [extension rangeOfString:@"." options: NSBackwardsSearch];
|
|
108
|
-
if (range.location != NSNotFound) {
|
|
109
|
-
extension = [extension substringFromIndex:range.location + 1];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Create a File
|
|
113
|
-
NSArray *location = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
114
|
-
NSString *documentsDirectoryPath = location[0];
|
|
115
|
-
NSString *fileURL = [NSString stringWithFormat:@"%@/%@.%@", documentsDirectoryPath, fileName, extension];
|
|
116
|
-
|
|
117
|
-
BOOL fileWriteStatus = [data writeToFile:fileURL atomically:YES];
|
|
118
|
-
if (!fileWriteStatus) {
|
|
119
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
120
|
-
callbackId:command.callbackId
|
|
121
|
-
type:error_result
|
|
122
|
-
data:nil
|
|
123
|
-
message:@""
|
|
124
|
-
error:[NSString stringWithFormat:@"Error while writing to file URL: %@\n", fileURL]
|
|
125
|
-
errorDetail:@""];
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
[self openFile:fileURL withCommand:command];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
- (void)launchFile:(CDVInvokedUrlCommand *)command {
|
|
133
|
-
|
|
134
|
-
CDVPluginResult *pluginResult = nil;
|
|
135
|
-
NSError *error = NULL;
|
|
136
|
-
NSString *filePath = [command.arguments objectAtIndex:0];
|
|
137
|
-
|
|
138
|
-
if (filePath.length == 0) {
|
|
139
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
140
|
-
callbackId:command.callbackId
|
|
141
|
-
type:error_result
|
|
142
|
-
data:nil
|
|
143
|
-
message:@""
|
|
144
|
-
error:[NSString stringWithFormat:@"Invalid File Path: %@\n", filePath]
|
|
145
|
-
errorDetail:@""];
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
[self openFile:filePath withCommand:command];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
- (void)unzip:(CDVInvokedUrlCommand *)command {
|
|
152
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
153
|
-
callbackId:command.callbackId
|
|
154
|
-
type:error_result
|
|
155
|
-
data:nil
|
|
156
|
-
message:@""
|
|
157
|
-
error:@"Use the Cordova Native Plugin: https://ionicframework.com/docs/native/zip/ to unzip files for iOS & Android"
|
|
158
|
-
errorDetail:@""];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
#pragma mark - QLPreviewController Delegate Implementation
|
|
162
|
-
|
|
163
|
-
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
|
|
164
|
-
return 1;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
|
|
168
|
-
UnviredPreviewItem *previewItem = [[UnviredPreviewItem alloc] initWithURL:self.currentFileURL title:self.currentFileName];
|
|
169
|
-
return previewItem;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
@end
|