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
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IOSFWSettingsPlugin.m
|
|
3
|
-
// HTML5_KERNEL_iOS
|
|
4
|
-
//
|
|
5
|
-
// Created by Srinidhi Anand Rao on 03/10/12.
|
|
6
|
-
// Copyright (c) 2012 Unvired Software India Pvt. Ltd. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import "IOSFWSettingsPlugin.h"
|
|
10
|
-
#import "FrameworkSettingsViewController.h"
|
|
11
|
-
#import "Logger.h"
|
|
12
|
-
#import "IDataManager.h"
|
|
13
|
-
#import "FrameworkManager.h"
|
|
14
|
-
#import "InfoMessage.h"
|
|
15
|
-
#import "FrameworkHelper.h"
|
|
16
|
-
#import "BusyIndicatorManager.h"
|
|
17
|
-
#import "UserSettingsManager.h"
|
|
18
|
-
#import "PluginConstants.h"
|
|
19
|
-
#import "FrameworkSettingsViewController.h"
|
|
20
|
-
#import "PluginHelper.h"
|
|
21
|
-
#import "SystemCredential.h"
|
|
22
|
-
#import "SystemCredentialManager.h"
|
|
23
|
-
#import "SyncEngine.h"
|
|
24
|
-
#import "ApplicationUtils.h"
|
|
25
|
-
#import "FrameworkVersion.h"
|
|
26
|
-
#import "UnviredFrameworkUtils.h"
|
|
27
|
-
#import "FrameworkSettingsManager.h"
|
|
28
|
-
|
|
29
|
-
@interface IOSFWSettingsPlugin () <SettingsDelegate>
|
|
30
|
-
@property (nonatomic, strong) FrameworkSettingsViewController *settingsController;
|
|
31
|
-
@property (nonatomic, strong) ServerLookUpManager *lookUpManager;
|
|
32
|
-
@property (nonatomic, strong) NSString *startDiscoveryServiceCallback;
|
|
33
|
-
@end
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@implementation IOSFWSettingsPlugin
|
|
37
|
-
|
|
38
|
-
- (void)getInfoMessages:(CDVInvokedUrlCommand *)command {
|
|
39
|
-
[self.commandDelegate runInBackground: ^{
|
|
40
|
-
NSError *error = NULL;
|
|
41
|
-
NSDictionary *dataObject = [command.arguments objectAtIndex:0];
|
|
42
|
-
NSString *lid = nil;
|
|
43
|
-
if (![dataObject[@"LID"] isKindOfClass:[NSNull class]]) {
|
|
44
|
-
lid = [dataObject[@"LID"] uppercaseString];
|
|
45
|
-
}
|
|
46
|
-
id <IDataManager> frameworkDataManager = [[FrameworkManager sharedInstance] getDataManager];
|
|
47
|
-
NSString *whereClause = nil;
|
|
48
|
-
if (lid.length > 0) {
|
|
49
|
-
whereClause = [NSString stringWithFormat:@"%@ = '%@'", INFO_MESSAGE_FIELD_BE_LID, lid];
|
|
50
|
-
}
|
|
51
|
-
NSArray *infoMessages = [frameworkDataManager getJSON:INFO_MESSAGE_TABLE_NAME whereClause:whereClause error:&error];
|
|
52
|
-
if (infoMessages == nil) {
|
|
53
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
54
|
-
callbackId:command.callbackId
|
|
55
|
-
type:error_result
|
|
56
|
-
data:@""
|
|
57
|
-
message:@""
|
|
58
|
-
error:[error localizedDescription]
|
|
59
|
-
errorDetail:@""];
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
63
|
-
callbackId:command.callbackId
|
|
64
|
-
type:success_result
|
|
65
|
-
data:infoMessages
|
|
66
|
-
message:@""
|
|
67
|
-
error:@""
|
|
68
|
-
errorDetail:@""];
|
|
69
|
-
}];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
- (void)getVersionNumbers:(CDVInvokedUrlCommand *)command {
|
|
73
|
-
|
|
74
|
-
[self.commandDelegate runInBackground: ^{
|
|
75
|
-
|
|
76
|
-
NSString *buildNumber = [ApplicationUtils getApplicationBuildNumber];
|
|
77
|
-
NSString *versionNumber = [ApplicationUtils getApplicationVersion];
|
|
78
|
-
NSString *revisionNumber = [ApplicationUtils getApplicationRevisionNumber];
|
|
79
|
-
|
|
80
|
-
NSDictionary *versions = @{
|
|
81
|
-
VERSION_APPLICATION: versionNumber,
|
|
82
|
-
VERSION_APP_BUILD_NO: buildNumber,
|
|
83
|
-
VERSION_APP_REVISION_NO: revisionNumber,
|
|
84
|
-
|
|
85
|
-
VERSION_FRAMEWORK: UNVIRED_FRAMEWORK_VERSION_NUMBER,
|
|
86
|
-
VERSION_FRAMEWORK_BUILD_NO: UNVIRED_FRAMEWORK_BUILD_NUMBER,
|
|
87
|
-
VERSION_FRAMEWORK_REVISION_NO: UNVIRED_FRAMEWORK_REVISION_NUMBER
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
91
|
-
callbackId:command.callbackId
|
|
92
|
-
type:success_result
|
|
93
|
-
data:versions
|
|
94
|
-
message:@""
|
|
95
|
-
error:@""
|
|
96
|
-
errorDetail:@""];
|
|
97
|
-
}];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
- (void)startSettingActivity:(CDVInvokedUrlCommand *)command {
|
|
101
|
-
// Push the Settings Screen
|
|
102
|
-
self.settingsController = [[FrameworkSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
|
|
103
|
-
[self.settingsController setDelegate:self];
|
|
104
|
-
|
|
105
|
-
// Wrap this in a UINavigation Controller
|
|
106
|
-
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self.settingsController];
|
|
107
|
-
[navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
|
|
108
|
-
[navigationController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
|
|
109
|
-
|
|
110
|
-
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:navigationController
|
|
111
|
-
animated:YES
|
|
112
|
-
completion:nil];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
- (void)clearData:(CDVInvokedUrlCommand *)command {
|
|
116
|
-
[self.commandDelegate runInBackground: ^{
|
|
117
|
-
[self clearApplicationDatabase];
|
|
118
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
119
|
-
[self.commandDelegate sendPluginResult:pluginResult
|
|
120
|
-
callbackId:command.callbackId];
|
|
121
|
-
}];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
- (void)getSystemCredentials:(CDVInvokedUrlCommand *)command {
|
|
125
|
-
[self.commandDelegate runInBackground: ^{
|
|
126
|
-
NSError *error = NULL;
|
|
127
|
-
NSArray *systemCredentials = [SystemCredentialManager getClientCredentialsWithError:&error];
|
|
128
|
-
if (systemCredentials == NULL) {
|
|
129
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
130
|
-
callbackId:command.callbackId
|
|
131
|
-
type:error_result
|
|
132
|
-
data:nil
|
|
133
|
-
message:@""
|
|
134
|
-
error:[error localizedDescription]
|
|
135
|
-
errorDetail:@""];
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
NSMutableArray *credentialJSONArray = [NSMutableArray array];
|
|
140
|
-
for (SystemCredential *credential in systemCredentials) {
|
|
141
|
-
NSDictionary *jsonObject = @{
|
|
142
|
-
SYSTEM_CREDENTIAL_PORT: [credential getPortName],
|
|
143
|
-
SYSTEM_CREDENTIAL_USERNAME: [credential getUserId],
|
|
144
|
-
SYSTEM_CREDENTIAL_PASSWORD: [credential getPassword]
|
|
145
|
-
};
|
|
146
|
-
[credentialJSONArray addObject:jsonObject];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
150
|
-
callbackId:command.callbackId
|
|
151
|
-
type:success_result
|
|
152
|
-
data:credentialJSONArray
|
|
153
|
-
message:@""
|
|
154
|
-
error:@""
|
|
155
|
-
errorDetail:@""];
|
|
156
|
-
}];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
- (void)updateSystemCredentials:(CDVInvokedUrlCommand *)command {
|
|
160
|
-
[self.commandDelegate runInBackground: ^{
|
|
161
|
-
NSError *error = NULL;
|
|
162
|
-
NSDictionary *dataObject = [command.arguments objectAtIndex:0];
|
|
163
|
-
NSString *portName = [dataObject[SYSTEM_CREDENTIAL_PORT] uppercaseString];
|
|
164
|
-
NSString *userName = [dataObject[SYSTEM_CREDENTIAL_USERNAME] uppercaseString];
|
|
165
|
-
NSString *password = dataObject[SYSTEM_CREDENTIAL_PASSWORD];
|
|
166
|
-
|
|
167
|
-
SystemCredential *credential = [[SystemCredential alloc] init];
|
|
168
|
-
[credential setUserId:userName];
|
|
169
|
-
[credential setPassword:password];
|
|
170
|
-
[credential setPortName:portName];
|
|
171
|
-
id <IDataManager> frameworkDataManager = [[FrameworkManager sharedInstance] getDataManager];
|
|
172
|
-
|
|
173
|
-
// replace so that update happens ver the primary key.
|
|
174
|
-
BOOL dbResult = [frameworkDataManager replace:credential error:&error];
|
|
175
|
-
if (dbResult) {
|
|
176
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
177
|
-
callbackId:command.callbackId
|
|
178
|
-
type:success_result
|
|
179
|
-
data:nil
|
|
180
|
-
message:@""
|
|
181
|
-
error:@""
|
|
182
|
-
errorDetail:@""];
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
NSString *errorString = [error localizedDescription];;
|
|
187
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
188
|
-
callbackId:command.callbackId
|
|
189
|
-
type:error_result
|
|
190
|
-
data:nil
|
|
191
|
-
message:@""
|
|
192
|
-
error:errorString
|
|
193
|
-
errorDetail:@""];
|
|
194
|
-
}];
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
- (void)userSettings:(CDVInvokedUrlCommand *)command {
|
|
198
|
-
[self.commandDelegate runInBackground: ^{
|
|
199
|
-
UserSettingsManager *userSettingsManager = [UserSettingsManager sharedInstance];
|
|
200
|
-
FrameworkSettingsManager *frameworkSettingsManager = [FrameworkSettingsManager sharedInstance];
|
|
201
|
-
|
|
202
|
-
NSError *error = nil;
|
|
203
|
-
NSString *firstName = [frameworkSettingsManager getFirstNameWithError:&error];
|
|
204
|
-
NSString *lastName = [frameworkSettingsManager getLastNameWithError:&error];
|
|
205
|
-
NSString *fullName = [NSString stringWithFormat:@"%@ %@", firstName, lastName];
|
|
206
|
-
|
|
207
|
-
NSString *SAPUserId = @"";
|
|
208
|
-
if ([LoginParameters sharedParameters].loginType == LoginTypeSAP) {
|
|
209
|
-
SAPUserId = [userSettingsManager getServerUserIdWithError:&error] != nil ? [userSettingsManager getServerUserIdWithError:&error] : @"";
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
NSDictionary *settingsDict = @{
|
|
213
|
-
UNVIRED_ID_CORDOVA : [userSettingsManager getUnviredUserIdWithError:&error] != nil ? [userSettingsManager getUnviredUserIdWithError:&error] : @"", // Deprecated. Need to be removed.
|
|
214
|
-
USER_ID : [userSettingsManager getUnviredUserIdWithError:&error] != nil ? [userSettingsManager getUnviredUserIdWithError:&error] : @"",
|
|
215
|
-
FULL_NAME : fullName,
|
|
216
|
-
EMAIL : [frameworkSettingsManager getEmailWithError:&error] ? [frameworkSettingsManager getEmailWithError:&error] : @"",
|
|
217
|
-
CORDOVA_SERVER_URL : [userSettingsManager getServerUrlWithError:&error] != nil ? [userSettingsManager getServerUrlWithError:&error] : @"",
|
|
218
|
-
SERVER_URL:[userSettingsManager getServerUrlWithError:&error] != nil ? [userSettingsManager getServerUrlWithError:&error] : @"", // Deprecated. Need to be removed.
|
|
219
|
-
SAP_USER_ID : SAPUserId,
|
|
220
|
-
SAP_PORT_NAME: [userSettingsManager getField:SAP_PORT_NAME error:&error] != nil ? [userSettingsManager getField:SAP_PORT_NAME error:&error] : @"",
|
|
221
|
-
LOGIN_TYPE : [userSettingsManager getLoginType:&error] != nil ? [userSettingsManager getLoginType:&error] : @"",
|
|
222
|
-
ADS_USER_ID : [userSettingsManager getField:ADS_USER_ID error:&error] != nil ? [userSettingsManager getField:ADS_USER_ID error:&error] : @"",
|
|
223
|
-
ADS_DOMAIN : [userSettingsManager getField:ADS_DOMAIN error:&error] != nil ? [userSettingsManager getField:ADS_DOMAIN error:&error] : @"",
|
|
224
|
-
SAML2_JWT_TOKEN : [userSettingsManager getField:SAML2_JWT_TOKEN error:&error] != nil ? [userSettingsManager getField:SAML2_JWT_TOKEN error:&error] : @""
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:success_result data:settingsDict message:@"" error:@"" errorDetail:@""];
|
|
228
|
-
}];
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
#pragma mark - Clear Data
|
|
232
|
-
|
|
233
|
-
- (void)clearApplicationDatabase {
|
|
234
|
-
NSError *error = nil;
|
|
235
|
-
BOOL resetApplicationStatus = [FrameworkHelper clearAllDataWithError:&error];
|
|
236
|
-
if (!resetApplicationStatus) {
|
|
237
|
-
[Logger loggerWithlog:LEVEL_ERROR
|
|
238
|
-
ClassName:[self class]
|
|
239
|
-
MethodName:NSStringFromSelector(_cmd)
|
|
240
|
-
msg:[NSString stringWithFormat:@"%@", [NSThread callStackSymbols]]];
|
|
241
|
-
|
|
242
|
-
// Display UIALert View showing the cause of the Error
|
|
243
|
-
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedStringFromTable(@"Error", @"UnviredStringsTable", nil)
|
|
244
|
-
message:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Error while clearing the data. %@", @"UnviredStringsTable", nil), [error localizedDescription]]
|
|
245
|
-
delegate:nil
|
|
246
|
-
cancelButtonTitle:NSLocalizedStringFromTable(@"OK", @"UnviredStringsTable", nil)
|
|
247
|
-
otherButtonTitles:nil];
|
|
248
|
-
|
|
249
|
-
[errorAlert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Alert Message
|
|
254
|
-
UIAlertView *deleteDataAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedStringFromTable(@"Alert", @"UnviredStringsTable", nil)
|
|
255
|
-
message:NSLocalizedStringFromTable(@"Deleted all the data for this application from the device. Please exit the application by pressing the 'Home' button in your device.", @"UnviredStringsTable", nil)
|
|
256
|
-
delegate:nil
|
|
257
|
-
cancelButtonTitle:nil
|
|
258
|
-
otherButtonTitles:nil];
|
|
259
|
-
|
|
260
|
-
[deleteDataAlert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
- (void)encrypt:(CDVInvokedUrlCommand *)command {
|
|
265
|
-
[self.commandDelegate runInBackground: ^{
|
|
266
|
-
CDVPluginResult *pluginResult = nil;
|
|
267
|
-
NSString *stringToBeEncrypted = [command.arguments objectAtIndex:0];
|
|
268
|
-
NSError *error = NULL;
|
|
269
|
-
NSString *encryptedString = [UnviredFrameworkUtils encrypt:stringToBeEncrypted error:&error];
|
|
270
|
-
if (error != nil) {
|
|
271
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
272
|
-
callbackId:command.callbackId
|
|
273
|
-
type:error_result
|
|
274
|
-
data:nil
|
|
275
|
-
message:@""
|
|
276
|
-
error:[error localizedDescription]
|
|
277
|
-
errorDetail:@""];
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
281
|
-
callbackId:command.callbackId
|
|
282
|
-
type:success_result
|
|
283
|
-
data:encryptedString
|
|
284
|
-
message:@""
|
|
285
|
-
error:@""
|
|
286
|
-
errorDetail:@""];
|
|
287
|
-
}
|
|
288
|
-
}];
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
- (void)decrypt:(CDVInvokedUrlCommand *)command {
|
|
292
|
-
[self.commandDelegate runInBackground: ^{
|
|
293
|
-
CDVPluginResult *pluginResult = nil;
|
|
294
|
-
NSString *encryptedString = [command.arguments objectAtIndex:0];
|
|
295
|
-
NSError *error = NULL;
|
|
296
|
-
NSString *decryptedString = [UnviredFrameworkUtils decrypt:encryptedString error:&error];
|
|
297
|
-
if (error != nil) {
|
|
298
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
299
|
-
callbackId:command.callbackId
|
|
300
|
-
type:error_result
|
|
301
|
-
data:nil
|
|
302
|
-
message:@""
|
|
303
|
-
error:[error localizedDescription]
|
|
304
|
-
errorDetail:@""];
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
308
|
-
callbackId:command.callbackId
|
|
309
|
-
type:success_result
|
|
310
|
-
data:decryptedString
|
|
311
|
-
message:@""
|
|
312
|
-
error:@""
|
|
313
|
-
errorDetail:@""];
|
|
314
|
-
}
|
|
315
|
-
}];
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
- (void)platform:(CDVInvokedUrlCommand *)command {
|
|
319
|
-
[self.commandDelegate runInBackground: ^{
|
|
320
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"ios"];
|
|
321
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
322
|
-
}];
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
- (void)testPushNotification:(CDVInvokedUrlCommand *)command {
|
|
326
|
-
[self.commandDelegate runInBackground: ^{
|
|
327
|
-
[UnviredFrameworkUtils testPushNotification];
|
|
328
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
329
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
330
|
-
}];
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
- (void)startDiscoveryService:(CDVInvokedUrlCommand *)command {
|
|
334
|
-
self.lookUpManager = [[ServerLookUpManager alloc] init];
|
|
335
|
-
self.lookUpManager.delegate = self;
|
|
336
|
-
[self.lookUpManager startLookingUpForNearbyServers];
|
|
337
|
-
self.startDiscoveryServiceCallback = command.callbackId;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
#pragma mark - Server Look Manager Delegate Implementation
|
|
341
|
-
|
|
342
|
-
- (void)didFindService:(NSDictionary *)serviceInfo {
|
|
343
|
-
[PluginHelper sendSuccessCallback:self.commandDelegate callbackId:self.startDiscoveryServiceCallback data:serviceInfo];
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
- (void)didNotFindService {
|
|
347
|
-
[PluginHelper sendErrorCallback:self.commandDelegate callbackId:self.startDiscoveryServiceCallback error:@"No UMP URLs found"];
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
- (void)didEncounterErrorWhileDoingLookup:(NSString *)error {
|
|
351
|
-
[Logger loggerWithlog:LEVEL_ERROR ClassName:[self class] MethodName:NSStringFromSelector(_cmd) msg:error];
|
|
352
|
-
[PluginHelper sendErrorCallback:self.commandDelegate callbackId:self.startDiscoveryServiceCallback error:error];
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
#pragma mark - Settings Delegate Implementation
|
|
356
|
-
|
|
357
|
-
- (void)doneButtonClicked {
|
|
358
|
-
// Fix done keeping in mind iOS 8. The earlier fix wasn't working.
|
|
359
|
-
[[[[UIApplication sharedApplication] keyWindow] rootViewController] dismissViewControllerAnimated:YES
|
|
360
|
-
completion:nil];
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
@end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IOSLoggerPlugin.h
|
|
3
|
-
// Unvired_Framework
|
|
4
|
-
//
|
|
5
|
-
// Created by Venkadesh P on 13/05/16.
|
|
6
|
-
// Copyright © 2016 Unvired Software India Pvt. Ltd. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import <Cordova/CDVPlugin.h>
|
|
10
|
-
#import <MessageUI/MFMailComposeViewController.h>
|
|
11
|
-
|
|
12
|
-
@interface IOSLoggerPlugin : CDVPlugin <MFMailComposeViewControllerDelegate>
|
|
13
|
-
|
|
14
|
-
- (void)logDebug:(CDVInvokedUrlCommand *)command;
|
|
15
|
-
|
|
16
|
-
- (void)logError:(CDVInvokedUrlCommand *)command;
|
|
17
|
-
|
|
18
|
-
- (void)logImportant:(CDVInvokedUrlCommand *)command;
|
|
19
|
-
|
|
20
|
-
- (void)getLogs:(CDVInvokedUrlCommand *)command;
|
|
21
|
-
|
|
22
|
-
- (void)deleteLogs:(CDVInvokedUrlCommand *)command;
|
|
23
|
-
|
|
24
|
-
- (void)sendViaServer:(CDVInvokedUrlCommand *)command;
|
|
25
|
-
|
|
26
|
-
- (void)sendViaEmail:(CDVInvokedUrlCommand *)command;
|
|
27
|
-
|
|
28
|
-
- (void)getLogLevel:(CDVInvokedUrlCommand *)command;
|
|
29
|
-
|
|
30
|
-
- (void)setLogLevel:(CDVInvokedUrlCommand *)command;
|
|
31
|
-
|
|
32
|
-
- (void)getLogFilePath:(CDVInvokedUrlCommand *)command;
|
|
33
|
-
|
|
34
|
-
@end
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IOSLoggerPlugin.m
|
|
3
|
-
// Unvired_Framework
|
|
4
|
-
//
|
|
5
|
-
// Created by Venkadesh P on 13/05/16.
|
|
6
|
-
// Copyright © 2016 Unvired Software India Pvt. Ltd. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#import "IOSLoggerPlugin.h"
|
|
10
|
-
#import "Logger.h"
|
|
11
|
-
#import "PluginConstants.h"
|
|
12
|
-
#import "LoginParameters.h"
|
|
13
|
-
#import "DSActivityView.h"
|
|
14
|
-
#import <UIKit/UIKit.h>
|
|
15
|
-
#import "PluginHelper.h"
|
|
16
|
-
|
|
17
|
-
@implementation IOSLoggerPlugin
|
|
18
|
-
|
|
19
|
-
- (void)getLogFilePath:(CDVInvokedUrlCommand *)command {
|
|
20
|
-
NSString *logFilePath = [Logger getLogFileURL];
|
|
21
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:logFilePath];
|
|
22
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
- (void)getLogLevel:(CDVInvokedUrlCommand *)command {
|
|
26
|
-
LEVEL logLevel = [Logger getDefaultLogLevel];
|
|
27
|
-
[PluginHelper sendListenerCallback:self.commandDelegate callbackId:command.callbackId type:success_result data:[NSNumber numberWithUnsignedInt:(int)logLevel] message:@"" error:@"" errorDetail:@""];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
- (void)setLogLevel:(CDVInvokedUrlCommand *)command {
|
|
31
|
-
NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
|
|
32
|
-
NSNumber *logLevel = dataObjects[LOG_LEVEL_PARAM];
|
|
33
|
-
[Logger setLogLevel:logLevel.unsignedIntegerValue];
|
|
34
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
35
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
- (void)logDebug:(CDVInvokedUrlCommand *)command {
|
|
39
|
-
[self.commandDelegate runInBackground:^{
|
|
40
|
-
NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
|
|
41
|
-
NSString *srcClass = dataObjects[LOG_SOURCE_CLASS];
|
|
42
|
-
NSString *srcMethod = dataObjects[LOG_SOURCE_METHOD];
|
|
43
|
-
NSString *message = dataObjects[LOG_MSG];
|
|
44
|
-
[Logger loggerWithLevel:LEVEL_DEBUG className:srcClass method:srcMethod message:message];
|
|
45
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
46
|
-
|
|
47
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
48
|
-
}];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
- (void)logError:(CDVInvokedUrlCommand *)command {
|
|
52
|
-
[self.commandDelegate runInBackground:^{
|
|
53
|
-
NSDictionary *dataObjects = [command.arguments objectAtIndex:0];
|
|
54
|
-
NSString *srcClass = dataObjects[LOG_SOURCE_CLASS];
|
|
55
|
-
NSString *srcMethod = dataObjects[LOG_SOURCE_METHOD];
|
|
56
|
-
NSString *message = dataObjects[LOG_MSG];
|
|
57
|
-
[Logger loggerWithLevel:LEVEL_ERROR className:srcClass method:srcMethod message:message];
|
|
58
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
59
|
-
|
|
60
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
61
|
-
}];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
- (void)logImportant:(CDVInvokedUrlCommand *)command {
|
|
65
|
-
[self.commandDelegate runInBackground:^{
|
|
66
|
-
NSDictionary *dataObjects = command.arguments[0];
|
|
67
|
-
NSString *srcClass = dataObjects[LOG_SOURCE_CLASS];
|
|
68
|
-
NSString *srcMethod = dataObjects[LOG_SOURCE_METHOD];
|
|
69
|
-
NSString *message = dataObjects[LOG_MSG];
|
|
70
|
-
[Logger loggerWithLevel:LEVEL_IMPORTANT className:srcClass method:srcMethod message:message];
|
|
71
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
72
|
-
|
|
73
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
74
|
-
}];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
- (void)getLogs:(CDVInvokedUrlCommand *)command {
|
|
78
|
-
[self.commandDelegate runInBackground:^{
|
|
79
|
-
[PluginHelper sendListenerCallback:self.commandDelegate
|
|
80
|
-
callbackId:command.callbackId
|
|
81
|
-
type:success_result
|
|
82
|
-
data:[Logger getLogs]
|
|
83
|
-
message:@""
|
|
84
|
-
error:@""
|
|
85
|
-
errorDetail:@""];
|
|
86
|
-
}];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
- (void)deleteLogs:(CDVInvokedUrlCommand *)command {
|
|
90
|
-
[self.commandDelegate runInBackground:^{
|
|
91
|
-
[Logger deleteLogs];
|
|
92
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
93
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
94
|
-
}];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
- (void)sendViaServer:(CDVInvokedUrlCommand *)command {
|
|
98
|
-
|
|
99
|
-
[self.commandDelegate runInBackground:^{
|
|
100
|
-
[Logger sendLogsToServer];
|
|
101
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
102
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
103
|
-
}];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
- (void)sendViaEmail:(CDVInvokedUrlCommand *)command {
|
|
107
|
-
[self emailLogs];
|
|
108
|
-
[self.commandDelegate runInBackground:^{
|
|
109
|
-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
110
|
-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
111
|
-
}];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
#pragma MARK - PRIVATE METHODS
|
|
115
|
-
|
|
116
|
-
- (void)displayAlertView:(NSArray *)messageDetails {
|
|
117
|
-
if (messageDetails.count != 2) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
NSString *alertViewTitle = messageDetails[0];
|
|
122
|
-
NSString *message = messageDetails[1];
|
|
123
|
-
|
|
124
|
-
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:alertViewTitle message:message preferredStyle:UIAlertControllerStyleAlert];
|
|
125
|
-
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"OK", @"UnviredStringsTable", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
|
126
|
-
[alertController dismissViewControllerAnimated:YES completion:nil];
|
|
127
|
-
}]];
|
|
128
|
-
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:alertController animated:YES completion:nil];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
//- (void)displayToast:(NSString *)toastMessage {
|
|
132
|
-
// [UnviredToast showWithText:toastMessage];
|
|
133
|
-
//}
|
|
134
|
-
|
|
135
|
-
- (void)displayBusyIndicator:(NSString *)busyIndicatorMessage {
|
|
136
|
-
[DSBezelActivityView newActivityViewForView:[[[UIApplication sharedApplication] keyWindow] rootViewController].view
|
|
137
|
-
withLabel:busyIndicatorMessage];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
- (void)hideBusyIndicator {
|
|
141
|
-
[DSBezelActivityView removeViewAnimated:YES];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
- (void)emailLogs {
|
|
145
|
-
|
|
146
|
-
// Check whether the device can send Mail
|
|
147
|
-
if ([MFMailComposeViewController canSendMail]) {
|
|
148
|
-
MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
|
|
149
|
-
|
|
150
|
-
// Set Subject: [Logs - Application Name]
|
|
151
|
-
NSString *applicationName = [LoginParameters sharedParameters].applicationTitle;
|
|
152
|
-
NSString *subject = NULL;
|
|
153
|
-
if (applicationName != NULL) {
|
|
154
|
-
subject = [NSString stringWithFormat:NSLocalizedStringFromTable(@"Logs - %@", @"UnviredStringsTable", nil), applicationName];
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
subject = NSLocalizedStringFromTable(@"Email Logs", @"UnviredStringsTable", nil);
|
|
158
|
-
}
|
|
159
|
-
[mailComposeViewController setSubject:subject];
|
|
160
|
-
|
|
161
|
-
//get file to be attached
|
|
162
|
-
NSString *fileURL = [Logger getLogFileURL];
|
|
163
|
-
NSData *data = [NSData dataWithContentsOfFile:fileURL];
|
|
164
|
-
[mailComposeViewController addAttachmentData:data mimeType:@"application/txt" fileName:@"ERROR_REPORT.txt"];
|
|
165
|
-
|
|
166
|
-
// Set Message Body
|
|
167
|
-
NSString *messageBody = [Logger getAdditionalInfo];
|
|
168
|
-
[mailComposeViewController setMessageBody:messageBody isHTML:NO];
|
|
169
|
-
|
|
170
|
-
// Set the Delegate
|
|
171
|
-
[mailComposeViewController setMailComposeDelegate:self];
|
|
172
|
-
|
|
173
|
-
// Prsent the View Modally
|
|
174
|
-
[mailComposeViewController setModalPresentationStyle:UIModalPresentationFormSheet];
|
|
175
|
-
[mailComposeViewController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
|
|
176
|
-
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:mailComposeViewController animated:YES completion:nil];
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
|
|
180
|
-
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"Error", @"UnviredStringsTable", nil) message:NSLocalizedStringFromTable(@"This device is not configured for sending email", @"UnviredStringsTable", nil) preferredStyle:UIAlertControllerStyleAlert];
|
|
181
|
-
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"OK", @"UnviredStringsTable", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
|
182
|
-
[alertController dismissViewControllerAnimated:YES completion:nil];
|
|
183
|
-
}]];
|
|
184
|
-
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:alertController animated:YES completion:nil];
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
#pragma mark - MFmailComposeViewController Delegate Implementation
|
|
190
|
-
|
|
191
|
-
- (void)mailComposeController:(MFMailComposeViewController *)controller
|
|
192
|
-
didFinishWithResult:(MFMailComposeResult)result
|
|
193
|
-
error:(NSError *)error {
|
|
194
|
-
[controller dismissViewControllerAnimated:YES completion:NULL];
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
@end
|
package/src/ios/IOSLoginPlugin.h
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// IOSLoginPlugin.h
|
|
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 <Cordova/CDV.h>
|
|
10
|
-
|
|
11
|
-
@interface IOSLoginPlugin : CDVPlugin
|
|
12
|
-
|
|
13
|
-
- (void)getAllAccount:(CDVInvokedUrlCommand *)command;
|
|
14
|
-
|
|
15
|
-
- (void)switchAccount:(CDVInvokedUrlCommand *)command;
|
|
16
|
-
|
|
17
|
-
- (void)deleteAccount:(CDVInvokedUrlCommand *)command;
|
|
18
|
-
|
|
19
|
-
- (void)login:(CDVInvokedUrlCommand *)command;
|
|
20
|
-
|
|
21
|
-
- (void)logout:(CDVInvokedUrlCommand *)command;
|
|
22
|
-
|
|
23
|
-
- (void)authenticateAndActivate:(CDVInvokedUrlCommand *)command;
|
|
24
|
-
|
|
25
|
-
- (void)authenticate:(CDVInvokedUrlCommand *)command;
|
|
26
|
-
|
|
27
|
-
- (void)authenticateLocal:(CDVInvokedUrlCommand *)command;
|
|
28
|
-
|
|
29
|
-
@end
|