Showing
2 changed files
with
47 additions
and
42 deletions
| ... | @@ -316,36 +316,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * | ... | @@ -316,36 +316,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * |
| 316 | AFNetworkReachabilityStatus oldstatus = self.networkStatus; | 316 | AFNetworkReachabilityStatus oldstatus = self.networkStatus; |
| 317 | _networkStatus = networkStatus; | 317 | _networkStatus = networkStatus; |
| 318 | 318 | ||
| 319 | - switch (networkStatus) { | 319 | +// switch (networkStatus) { |
| 320 | - case AFNetworkReachabilityStatusReachableViaWiFi: | 320 | +// case AFNetworkReachabilityStatusReachableViaWiFi: |
| 321 | - [_db executeUpdate:@"UPDATE netstats SET wifi = wifi + 1, wifistart_timestamp = (julianday('now') - 2440587.5)*86400.0, wifi_dirty = 1"]; | 321 | +// [_db executeUpdate:@"UPDATE netstats SET wifi = wifi + 1, wifistart_timestamp = (julianday('now') - 2440587.5)*86400.0, wifi_dirty = 1"]; |
| 322 | - [_db executeUpdate:@"UPDATE netstats SET overall = wifi + wwan;"]; | 322 | +// [_db executeUpdate:@"UPDATE netstats SET overall = wifi + wwan;"]; |
| 323 | - [self calculateNetworkReachabilityStatisticsForStatus:AFNetworkReachabilityStatusReachableViaWWAN]; | 323 | +// [self calculateNetworkReachabilityStatisticsForStatus:AFNetworkReachabilityStatusReachableViaWWAN]; |
| 324 | - break; | 324 | +// break; |
| 325 | - case AFNetworkReachabilityStatusReachableViaWWAN: | 325 | +// case AFNetworkReachabilityStatusReachableViaWWAN: |
| 326 | - [_db executeUpdate:@"UPDATE netstats SET wwan = wwan + 1, wwanstart_timestamp = (julianday('now') - 2440587.5)*86400.0, wwan_dirty = 1"]; | 326 | +// [_db executeUpdate:@"UPDATE netstats SET wwan = wwan + 1, wwanstart_timestamp = (julianday('now') - 2440587.5)*86400.0, wwan_dirty = 1"]; |
| 327 | - [_db executeUpdate:@"UPDATE netstats SET overall = wifi + wwan;"]; | 327 | +// [_db executeUpdate:@"UPDATE netstats SET overall = wifi + wwan;"]; |
| 328 | - [self calculateNetworkReachabilityStatisticsForStatus:AFNetworkReachabilityStatusReachableViaWiFi]; | 328 | +// [self calculateNetworkReachabilityStatisticsForStatus:AFNetworkReachabilityStatusReachableViaWiFi]; |
| 329 | - default: | 329 | +// default: |
| 330 | - [self calculateNetworkReachabilityStatisticsForStatus:oldstatus]; | 330 | +// [self calculateNetworkReachabilityStatisticsForStatus:oldstatus]; |
| 331 | - break; | 331 | +// break; |
| 332 | - } | 332 | +// } |
| 333 | 333 | ||
| 334 | WL_FMDBLogError | 334 | WL_FMDBLogError |
| 335 | 335 | ||
| 336 | double wifiPercentage = 0.0; | 336 | double wifiPercentage = 0.0; |
| 337 | double wwanPercentage = 0.0; | 337 | double wwanPercentage = 0.0; |
| 338 | 338 | ||
| 339 | - FMResultSet *rs = [_db executeQuery:@"SELECT * FROM netstats WHERE _id = 1"]; | 339 | +// FMResultSet *rs = [_db executeQuery:@"SELECT * FROM netstats WHERE _id = 1"]; |
| 340 | - while ([rs next]) { | 340 | +// while ([rs next]) { |
| 341 | - wifiPercentage = ([[rs resultDictionary][@"wifi"] doubleValue]/[[rs resultDictionary][@"overall"] doubleValue])*100; | 341 | +// wifiPercentage = ([[rs resultDictionary][@"wifi"] doubleValue]/[[rs resultDictionary][@"overall"] doubleValue])*100; |
| 342 | - wwanPercentage = ([[rs resultDictionary][@"wwan"] doubleValue]/[[rs resultDictionary][@"overall"] doubleValue])*100; | 342 | +// wwanPercentage = ([[rs resultDictionary][@"wwan"] doubleValue]/[[rs resultDictionary][@"overall"] doubleValue])*100; |
| 343 | - } | 343 | +// } |
| 344 | WL_FMDBLogError | 344 | WL_FMDBLogError |
| 345 | 345 | ||
| 346 | - NSDictionary *networkStatistics = @{@"wifi": @([[NSString stringWithFormat:@"%.2f",wifiPercentage] doubleValue]), @"wwan": @([[NSString stringWithFormat:@"%.2f",wwanPercentage] doubleValue])}; | 346 | +// NSDictionary *networkStatistics = @{@"wifi": @([[NSString stringWithFormat:@"%.2f",wifiPercentage] doubleValue]), @"wwan": @([[NSString stringWithFormat:@"%.2f",wwanPercentage] doubleValue])}; |
| 347 | - WLEventSimple *event = [[WLEventSimple alloc] initWithType:@"device_info" andContext:@{@"device_info": @{@"usage":networkStatistics}}]; | 347 | +// WLEventSimple *event = [[WLEventSimple alloc] initWithType:@"device_info" andContext:@{@"device_info": @{@"usage":networkStatistics}}]; |
| 348 | - [[Warply sharedService] addEvent:(WLEvent*)event priority:NO]; | 348 | +// [[Warply sharedService] addEvent:(WLEvent*)event priority:NO]; |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | #pragma mark - Public Methods | 351 | #pragma mark - Public Methods |
| ... | @@ -4235,11 +4235,11 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) | ... | @@ -4235,11 +4235,11 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) |
| 4235 | WL_FMDBLogError | 4235 | WL_FMDBLogError |
| 4236 | } | 4236 | } |
| 4237 | 4237 | ||
| 4238 | - if ([_db tableExists:@"netstats"] == NO) { | 4238 | +// if ([_db tableExists:@"netstats"] == NO) { |
| 4239 | - [_db executeUpdate:@"CREATE TABLE netstats (_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, wifi INTEGER, wwan INTEGER, overall INTEGER, wifistart_timestamp INTEGER, wifiend_timestamp INTEGER, wifi_totaltime INTEGER, wifi_dirty INTEGER, wwanstart_timestamp INTEGER, wwanend_timestamp INTEGER, wwan_totaltime INTEGER, wwan_dirty INTEGER)"]; | 4239 | +// [_db executeUpdate:@"CREATE TABLE netstats (_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, wifi INTEGER, wwan INTEGER, overall INTEGER, wifistart_timestamp INTEGER, wifiend_timestamp INTEGER, wifi_totaltime INTEGER, wifi_dirty INTEGER, wwanstart_timestamp INTEGER, wwanend_timestamp INTEGER, wwan_totaltime INTEGER, wwan_dirty INTEGER)"]; |
| 4240 | - [_db executeUpdate:@"INSERT INTO netstats (_id, wifi, wwan, overall, wifi_totaltime, wifi_dirty, wwan_totaltime, wwan_dirty) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)", @0, @0, @0, @0, @0, @0, @0]; | 4240 | +// [_db executeUpdate:@"INSERT INTO netstats (_id, wifi, wwan, overall, wifi_totaltime, wifi_dirty, wwan_totaltime, wwan_dirty) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)", @0, @0, @0, @0, @0, @0, @0]; |
| 4241 | - WL_FMDBLogError | 4241 | +// WL_FMDBLogError |
| 4242 | - } | 4242 | +// } |
| 4243 | 4243 | ||
| 4244 | if ([_db tableExists:@"pois"] == NO) { | 4244 | if ([_db tableExists:@"pois"] == NO) { |
| 4245 | [_db executeUpdate:@"CREATE TABLE pois (id INTEGER PRIMARY KEY NOT NULL UNIQUE, lat NUMERIC, lon NUMERIC, radius NUMERIC)"]; | 4245 | [_db executeUpdate:@"CREATE TABLE pois (id INTEGER PRIMARY KEY NOT NULL UNIQUE, lat NUMERIC, lon NUMERIC, radius NUMERIC)"]; |
| ... | @@ -4464,24 +4464,24 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg | ... | @@ -4464,24 +4464,24 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg |
| 4464 | { | 4464 | { |
| 4465 | NSTimeInterval wifiTotalTime = 0.0; | 4465 | NSTimeInterval wifiTotalTime = 0.0; |
| 4466 | NSTimeInterval wwanTotalTime = 0.0; | 4466 | NSTimeInterval wwanTotalTime = 0.0; |
| 4467 | - if (status == AFNetworkReachabilityStatusReachableViaWiFi) { | 4467 | +// if (status == AFNetworkReachabilityStatusReachableViaWiFi) { |
| 4468 | - [_db executeUpdate:@"UPDATE netstats SET wifiend_timestamp = (julianday('now') - 2440587.5)*86400.0 where wifi_dirty = 1"]; | 4468 | +// [_db executeUpdate:@"UPDATE netstats SET wifiend_timestamp = (julianday('now') - 2440587.5)*86400.0 where wifi_dirty = 1"]; |
| 4469 | - [_db executeUpdate:@"UPDATE netstats SET wifi_totaltime = wifi_totaltime + (wifiend_timestamp - wifistart_timestamp), wifi_dirty = 0 where wifi_dirty = 1"]; | 4469 | +// [_db executeUpdate:@"UPDATE netstats SET wifi_totaltime = wifi_totaltime + (wifiend_timestamp - wifistart_timestamp), wifi_dirty = 0 where wifi_dirty = 1"]; |
| 4470 | - } else if (status == AFNetworkReachabilityStatusReachableViaWWAN) { | 4470 | +// } else if (status == AFNetworkReachabilityStatusReachableViaWWAN) { |
| 4471 | - [_db executeUpdate:@"UPDATE netstats SET wwanend_timestamp = (julianday('now') - 2440587.5)*86400.0 where wwan_dirty = 1"]; | 4471 | +// [_db executeUpdate:@"UPDATE netstats SET wwanend_timestamp = (julianday('now') - 2440587.5)*86400.0 where wwan_dirty = 1"]; |
| 4472 | - [_db executeUpdate:@"UPDATE netstats SET wwan_totaltime = wwan_totaltime + (wwanend_timestamp - wwanstart_timestamp), wwan_dirty = 0 where wwan_dirty = 1"]; | 4472 | +// [_db executeUpdate:@"UPDATE netstats SET wwan_totaltime = wwan_totaltime + (wwanend_timestamp - wwanstart_timestamp), wwan_dirty = 0 where wwan_dirty = 1"]; |
| 4473 | - } | 4473 | +// } |
| 4474 | 4474 | ||
| 4475 | - FMResultSet *rs = [_db executeQuery:@"SELECT * FROM netstats WHERE _id = 1"]; | 4475 | +// FMResultSet *rs = [_db executeQuery:@"SELECT * FROM netstats WHERE _id = 1"]; |
| 4476 | - while ([rs next]) { | 4476 | +// while ([rs next]) { |
| 4477 | - wifiTotalTime = [[rs resultDictionary][@"wifi_totaltime"] doubleValue]; | 4477 | +// wifiTotalTime = [[rs resultDictionary][@"wifi_totaltime"] doubleValue]; |
| 4478 | - wwanTotalTime = [[rs resultDictionary][@"wwan_totaltime"] doubleValue]; | 4478 | +// wwanTotalTime = [[rs resultDictionary][@"wwan_totaltime"] doubleValue]; |
| 4479 | - } | 4479 | +// } |
| 4480 | 4480 | ||
| 4481 | 4481 | ||
| 4482 | - NSDictionary *networkStatistics = @{@"wifi": @(round(wifiTotalTime)), @"wwan": @(round(wwanTotalTime))}; | 4482 | +// NSDictionary *networkStatistics = @{@"wifi": @(round(wifiTotalTime)), @"wwan": @(round(wwanTotalTime))}; |
| 4483 | - WLEventSimple *event = [[WLEventSimple alloc] initWithType:@"device_info" andContext:@{@"device_info": @{@"time":networkStatistics}}]; | 4483 | +// WLEventSimple *event = [[WLEventSimple alloc] initWithType:@"device_info" andContext:@{@"device_info": @{@"time":networkStatistics}}]; |
| 4484 | - [[Warply sharedService] addEvent:(WLEvent*)event priority:NO]; | 4484 | +// [[Warply sharedService] addEvent:(WLEvent*)event priority:NO]; |
| 4485 | } | 4485 | } |
| 4486 | 4486 | ||
| 4487 | #pragma mark - Memory Management | 4487 | #pragma mark - Memory Management | ... | ... |
| ... | @@ -28,6 +28,11 @@ NSString *LANG; | ... | @@ -28,6 +28,11 @@ NSString *LANG; |
| 28 | [[Warply sharedService].pushManager resetBadge]; | 28 | [[Warply sharedService].pushManager resetBadge]; |
| 29 | MERCHANT_ID = merchantId; | 29 | MERCHANT_ID = merchantId; |
| 30 | LANG = lang; | 30 | LANG = lang; |
| 31 | + //removal of caching | ||
| 32 | + int cacheSizeMemory = 0; // 0MB | ||
| 33 | + int cacheSizeDisk = 0; // 0MB | ||
| 34 | + NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"]; | ||
| 35 | + [NSURLCache setSharedURLCache:sharedCache]; | ||
| 31 | } | 36 | } |
| 32 | 37 | ||
| 33 | - (void) setToStage { | 38 | - (void) setToStage { | ... | ... |
-
Please register or login to post a comment