@@ -288,4 +288,107 @@ - (NSDictionary*)executeQueryInDatabase:(NSString*)database tableName:(NSString*
288288 }
289289}
290290
291+ - (NSDictionary *)userDefaultData {
292+
293+ NSMutableDictionary *tableData = [NSMutableDictionary dictionary ];
294+ [tableData safe_setObject: @(1 ) forKey: @" isSelectQuery" ];
295+ [tableData safe_setObject: @(1 ) forKey: @" isSuccessful" ];
296+
297+ NSMutableArray *tableInfoResult = [NSMutableArray array ];
298+ [tableInfoResult safe_addObject: @{@" title" : @" key" , @" isPrimary" : @(1 ), @" dataType" : @" text" }];
299+ [tableInfoResult safe_addObject: @{@" title" : @" value" , @" isPrimary" : @(0 ), @" dataType" : @" text" }];
300+
301+ [tableData safe_setObject: tableInfoResult forKey: @" tableInfos" ];
302+
303+ [tableData safe_setObject: @(NO ) forKey: @" isEditable" ];
304+
305+ NSMutableArray *rows = @[].mutableCopy ;
306+
307+ NSDictionary *userData = [[NSUserDefaults standardUserDefaults ]dictionaryRepresentation];
308+
309+ for (NSString *key in userData.allKeys ) {
310+ NSMutableArray *row = @[].mutableCopy ;
311+
312+ [row safe_addObject: @{@" dataType" : @" text" , @" value" : key?key:@" " }];
313+
314+ id value = [userData objectForKey: key];
315+
316+ if ([value isKindOfClass: [NSString class ]] || [value isKindOfClass: [NSNumber class ]]) {
317+ [row safe_addObject: @{@" dataType" : @" text" , @" value" : yy_dicGetStringSafe (userData, key)}];
318+ }else {
319+ [row safe_addObject: @{@" dataType" : @" text" , @" value" : [value description ]?:@" " }];
320+ }
321+
322+ [rows addObject: row];
323+ }
324+ [tableData safe_setObject: rows forKey: @" rows" ];
325+
326+ return tableData;
327+ }
328+
329+ - (NSDictionary *)getAppInfoData {
330+ NSMutableDictionary *tableData = [NSMutableDictionary dictionary ];
331+ [tableData safe_setObject: @(1 ) forKey: @" isSelectQuery" ];
332+ [tableData safe_setObject: @(1 ) forKey: @" isSuccessful" ];
333+
334+ NSMutableArray *tableInfoResult = [NSMutableArray array ];
335+ [tableInfoResult safe_addObject: @{@" title" : @" property name" , @" isPrimary" : @(1 ), @" dataType" : @" text" }];
336+ [tableInfoResult safe_addObject: @{@" title" : @" property value" , @" isPrimary" : @(0 ), @" dataType" : @" text" }];
337+
338+ [tableData safe_setObject: tableInfoResult forKey: @" tableInfos" ];
339+
340+ [tableData safe_setObject: @(NO ) forKey: @" isEditable" ];
341+
342+ NSMutableArray *rows = @[].mutableCopy ;
343+
344+ NSDictionary *infoDic = [[NSBundle mainBundle ] infoDictionary ];
345+ // app name
346+ NSString *displayName = yy_dicGetStringSafe (infoDic, @" CFBundleDisplayName" );
347+ NSMutableArray *displayRow = @[].mutableCopy ;
348+ [displayRow safe_addObject: @{@" dataType" : @" text" , @" value" : @" Display Name" }];
349+ [displayRow safe_addObject: @{@" dataType" : @" text" , @" value" : displayName}];
350+ [rows safe_addObject: displayRow];
351+
352+ // app bundle identifier
353+ NSString *bundleIdentifer = yy_dicGetStringSafe (infoDic, kCFBundleIdentifierKey );
354+ NSMutableArray *bundleRow = @[].mutableCopy ;
355+ [bundleRow safe_addObject: @{@" dataType" : @" text" , @" value" : @" Bundle Identifer" }];
356+ [bundleRow safe_addObject: @{@" dataType" : @" text" , @" value" : bundleIdentifer}];
357+ [rows safe_addObject: bundleRow];
358+
359+ // app version
360+ NSString *version = yy_dicGetStringSafe (infoDic, @" CFBundleShortVersionString" );
361+ NSMutableArray *versionRow = @[].mutableCopy ;
362+ [versionRow safe_addObject: @{@" dataType" : @" text" , @" value" : @" Version" }];
363+ [versionRow safe_addObject: @{@" dataType" : @" text" , @" value" : version}];
364+ [rows safe_addObject: versionRow];
365+
366+ // app build number
367+ NSString *build = yy_dicGetStringSafe (infoDic, kCFBundleVersionKey );
368+ NSMutableArray *buildRow = @[].mutableCopy ;
369+ [buildRow safe_addObject: @{@" dataType" : @" text" , @" value" : @" Build" }];
370+ [buildRow safe_addObject: @{@" dataType" : @" text" , @" value" : build}];
371+ [rows safe_addObject: buildRow];
372+
373+ // document path
374+ NSArray *pathSearch = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
375+ NSString *documentsPath = [pathSearch objectAtIndex: 0 ];
376+ NSMutableArray *documentRow = @[].mutableCopy ;
377+ [documentRow safe_addObject: @{@" dataType" : @" text" , @" value" : @" Documents" }];
378+ [documentRow safe_addObject: @{@" dataType" : @" text" , @" value" : documentsPath?documentsPath:@" " }];
379+ [rows safe_addObject: documentRow];
380+
381+ // cache path
382+ NSArray *pathSearchCache = NSSearchPathForDirectoriesInDomains (NSCachesDirectory, NSUserDomainMask, YES );
383+ NSString *cachePath = [pathSearchCache objectAtIndex: 0 ];
384+ NSMutableArray *cacheRow = @[].mutableCopy ;
385+ [cacheRow safe_addObject: @{@" dataType" : @" text" , @" value" : @" Cache" }];
386+ [cacheRow safe_addObject: @{@" dataType" : @" text" , @" value" : cachePath?cachePath:@" " }];
387+ [rows safe_addObject: cacheRow];
388+
389+ [tableData safe_setObject: rows forKey: @" rows" ];
390+
391+ return tableData;
392+ }
393+
291394@end
0 commit comments