Manos Chorianopoulos

revert sdk db changes

...@@ -574,17 +574,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -574,17 +574,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
574 }]; 574 }];
575 } failureBlock:^(NSError *error) { 575 } failureBlock:^(NSError *error) {
576 if (failure) { 576 if (failure) {
577 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 577 + [_db executeUpdate:@"DROP TABLE requestVariables"];
578 - if ([_db tableExists:@"requestVariables"] == NO) {
579 -
580 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
581 - WL_FMDBLogError
582 -
583 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
584 -
585 - } else {
586 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
587 - }
588 failure(error); 578 failure(error);
589 } 579 }
590 NSLog(@"Error at token %@", error ); 580 NSLog(@"Error at token %@", error );
...@@ -830,17 +820,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -830,17 +820,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
830 - (NSDictionary*)logout 820 - (NSDictionary*)logout
831 { 821 {
832 822
833 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 823 + [_db executeUpdate:@"DROP TABLE requestVariables"];
834 - if ([_db tableExists:@"requestVariables"] == NO) {
835 -
836 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
837 - WL_FMDBLogError
838 -
839 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
840 -
841 - } else {
842 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
843 - }
844 NSDictionary *successResponse = @{@"result": @"success", @"status":@1}; 824 NSDictionary *successResponse = @{@"result": @"success", @"status":@1};
845 NSLog(@"**************** WARPLY Logout *****************" ); 825 NSLog(@"**************** WARPLY Logout *****************" );
846 return successResponse; 826 return successResponse;
...@@ -923,7 +903,6 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -923,7 +903,6 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
923 }]; 903 }];
924 } 904 }
925 905
926 -// TODO: ADD NEW SDK
927 - (void)refreshToken:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure 906 - (void)refreshToken:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
928 { 907 {
929 FMResultSet *refreshTokenSet = [_db executeQuery:@"SELECT refresh_token FROM requestVariables WHERE id = 1;"]; 908 FMResultSet *refreshTokenSet = [_db executeQuery:@"SELECT refresh_token FROM requestVariables WHERE id = 1;"];
...@@ -962,17 +941,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -962,17 +941,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
962 success(successResponse); 941 success(successResponse);
963 } failureBlock:^(NSError *error) { 942 } failureBlock:^(NSError *error) {
964 if (failure) { 943 if (failure) {
965 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 944 + [_db executeUpdate:@"DROP TABLE requestVariables"];
966 - if ([_db tableExists:@"requestVariables"] == NO) {
967 -
968 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
969 - WL_FMDBLogError
970 -
971 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
972 -
973 - } else {
974 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
975 - }
976 failure(error); 945 failure(error);
977 } 946 }
978 NSLog(@"Error at token %@", error ); 947 NSLog(@"Error at token %@", error );
...@@ -1021,17 +990,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1021,17 +990,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1021 success(successResponse); 990 success(successResponse);
1022 } failureBlock:^(NSError *error) { 991 } failureBlock:^(NSError *error) {
1023 if (failure) { 992 if (failure) {
1024 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 993 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1025 - if ([_db tableExists:@"requestVariables"] == NO) {
1026 -
1027 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1028 - WL_FMDBLogError
1029 -
1030 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1031 -
1032 - } else {
1033 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1034 - }
1035 failure(error); 994 failure(error);
1036 } 995 }
1037 NSLog(@"Error at token %@", error ); 996 NSLog(@"Error at token %@", error );
...@@ -1074,21 +1033,17 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1074,21 +1033,17 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1074 dict = [error userInfo]; 1033 dict = [error userInfo];
1075 NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; 1034 NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
1076 if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { 1035 if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
1036 +// [self refreshToken:^(NSDictionary *response) {
1037 +// // [_db executeUpdate:@"UPDATE requestVariables SET access_token = ?, refresh_token = ? WHERE id = 1", [response objectForKey:@"access_token"], [response objectForKey:@"refresh_token"]];
1038 +// NSDictionary *successResponse = @{@"result": @"success", @"status":@1};
1039 +// success(successResponse);
1040 +// } failureBlock:^(NSError *error) {
1077 if (failure) { 1041 if (failure) {
1078 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1042 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1079 - if ([_db tableExists:@"requestVariables"] == NO) {
1080 -
1081 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1082 - WL_FMDBLogError
1083 -
1084 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1085 -
1086 - } else {
1087 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1088 - }
1089 failure(error); 1043 failure(error);
1090 } 1044 }
1091 NSLog(@"Error at token %@", error ); 1045 NSLog(@"Error at token %@", error );
1046 + // }];
1092 } 1047 }
1093 NSLog(@"Error at token %@", error ); 1048 NSLog(@"Error at token %@", error );
1094 } 1049 }
...@@ -1121,17 +1076,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1121,17 +1076,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1121 }]; 1076 }];
1122 } failureBlock:^(NSError *error) { 1077 } failureBlock:^(NSError *error) {
1123 if (failure) { 1078 if (failure) {
1124 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1079 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1125 - if ([_db tableExists:@"requestVariables"] == NO) {
1126 -
1127 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1128 - WL_FMDBLogError
1129 -
1130 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1131 -
1132 - } else {
1133 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1134 - }
1135 failure(error); 1080 failure(error);
1136 } 1081 }
1137 NSLog(@"Error at token %@", error ); 1082 NSLog(@"Error at token %@", error );
...@@ -1174,17 +1119,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1174,17 +1119,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1174 }]; 1119 }];
1175 } failureBlock:^(NSError *error) { 1120 } failureBlock:^(NSError *error) {
1176 if (failure) { 1121 if (failure) {
1177 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1122 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1178 - if ([_db tableExists:@"requestVariables"] == NO) {
1179 -
1180 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1181 - WL_FMDBLogError
1182 -
1183 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1184 -
1185 - } else {
1186 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1187 - }
1188 failure(error); 1123 failure(error);
1189 } 1124 }
1190 NSLog(@"Error at token %@", error ); 1125 NSLog(@"Error at token %@", error );
...@@ -1245,17 +1180,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1245,17 +1180,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1245 }]; 1180 }];
1246 } failureBlock:^(NSError *error) { 1181 } failureBlock:^(NSError *error) {
1247 if (failure) { 1182 if (failure) {
1248 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1183 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1249 - if ([_db tableExists:@"requestVariables"] == NO) {
1250 -
1251 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1252 - WL_FMDBLogError
1253 -
1254 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1255 -
1256 - } else {
1257 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1258 - }
1259 failure(error); 1184 failure(error);
1260 } 1185 }
1261 NSLog(@"Error at token %@", error ); 1186 NSLog(@"Error at token %@", error );
...@@ -1361,17 +1286,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1361,17 +1286,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1361 }]; 1286 }];
1362 } failureBlock:^(NSError *error) { 1287 } failureBlock:^(NSError *error) {
1363 if (failure) { 1288 if (failure) {
1364 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1289 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1365 - if ([_db tableExists:@"requestVariables"] == NO) {
1366 -
1367 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1368 - WL_FMDBLogError
1369 -
1370 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1371 -
1372 - } else {
1373 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1374 - }
1375 failure(error); 1290 failure(error);
1376 } 1291 }
1377 NSLog(@"Error at token %@", error ); 1292 NSLog(@"Error at token %@", error );
...@@ -1412,17 +1327,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1412,17 +1327,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1412 }]; 1327 }];
1413 } failureBlock:^(NSError *error) { 1328 } failureBlock:^(NSError *error) {
1414 if (failure) { 1329 if (failure) {
1415 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1330 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1416 - if ([_db tableExists:@"requestVariables"] == NO) {
1417 -
1418 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1419 - WL_FMDBLogError
1420 -
1421 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1422 -
1423 - } else {
1424 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1425 - }
1426 failure(error); 1331 failure(error);
1427 } 1332 }
1428 NSLog(@"Error at token %@", error ); 1333 NSLog(@"Error at token %@", error );
...@@ -1463,17 +1368,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1463,17 +1368,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1463 }]; 1368 }];
1464 } failureBlock:^(NSError *error) { 1369 } failureBlock:^(NSError *error) {
1465 if (failure) { 1370 if (failure) {
1466 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1371 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1467 - if ([_db tableExists:@"requestVariables"] == NO) {
1468 -
1469 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1470 - WL_FMDBLogError
1471 -
1472 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1473 -
1474 - } else {
1475 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1476 - }
1477 failure(error); 1372 failure(error);
1478 } 1373 }
1479 NSLog(@"Error at token %@", error ); 1374 NSLog(@"Error at token %@", error );
...@@ -1551,17 +1446,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1551,17 +1446,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1551 }]; 1446 }];
1552 } failureBlock:^(NSError *error) { 1447 } failureBlock:^(NSError *error) {
1553 if (failure) { 1448 if (failure) {
1554 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1449 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1555 - if ([_db tableExists:@"requestVariables"] == NO) {
1556 -
1557 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1558 - WL_FMDBLogError
1559 -
1560 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1561 -
1562 - } else {
1563 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1564 - }
1565 failure(error); 1450 failure(error);
1566 } 1451 }
1567 NSLog(@"Error at token %@", error ); 1452 NSLog(@"Error at token %@", error );
...@@ -1598,17 +1483,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1598,17 +1483,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1598 }]; 1483 }];
1599 } failureBlock:^(NSError *error) { 1484 } failureBlock:^(NSError *error) {
1600 if (failure) { 1485 if (failure) {
1601 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1486 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1602 - if ([_db tableExists:@"requestVariables"] == NO) {
1603 -
1604 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1605 - WL_FMDBLogError
1606 -
1607 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1608 -
1609 - } else {
1610 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1611 - }
1612 failure(error); 1487 failure(error);
1613 } 1488 }
1614 NSLog(@"Error at token %@", error ); 1489 NSLog(@"Error at token %@", error );
...@@ -1645,17 +1520,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1645,17 +1520,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1645 }]; 1520 }];
1646 } failureBlock:^(NSError *error) { 1521 } failureBlock:^(NSError *error) {
1647 if (failure) { 1522 if (failure) {
1648 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1523 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1649 - if ([_db tableExists:@"requestVariables"] == NO) {
1650 -
1651 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1652 - WL_FMDBLogError
1653 -
1654 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1655 -
1656 - } else {
1657 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1658 - }
1659 failure(error); 1524 failure(error);
1660 } 1525 }
1661 NSLog(@"Error at token %@", error ); 1526 NSLog(@"Error at token %@", error );
...@@ -1692,17 +1557,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1692,17 +1557,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1692 }]; 1557 }];
1693 } failureBlock:^(NSError *error) { 1558 } failureBlock:^(NSError *error) {
1694 if (failure) { 1559 if (failure) {
1695 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1560 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1696 - if ([_db tableExists:@"requestVariables"] == NO) {
1697 -
1698 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1699 - WL_FMDBLogError
1700 -
1701 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1702 -
1703 - } else {
1704 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1705 - }
1706 failure(error); 1561 failure(error);
1707 } 1562 }
1708 NSLog(@"Error at token %@", error ); 1563 NSLog(@"Error at token %@", error );
...@@ -1739,17 +1594,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1739,17 +1594,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1739 }]; 1594 }];
1740 } failureBlock:^(NSError *error) { 1595 } failureBlock:^(NSError *error) {
1741 if (failure) { 1596 if (failure) {
1742 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1597 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1743 - if ([_db tableExists:@"requestVariables"] == NO) {
1744 -
1745 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1746 - WL_FMDBLogError
1747 -
1748 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1749 -
1750 - } else {
1751 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1752 - }
1753 failure(error); 1598 failure(error);
1754 } 1599 }
1755 NSLog(@"Error at token %@", error ); 1600 NSLog(@"Error at token %@", error );
...@@ -1760,7 +1605,6 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1760,7 +1605,6 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1760 }]; 1605 }];
1761 } 1606 }
1762 1607
1763 -// TODO: ADD NEW SDK
1764 - (void)verifyTicketWithSuccessBlock:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure 1608 - (void)verifyTicketWithSuccessBlock:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
1765 { 1609 {
1766 NSString* appUuid = [NSString alloc]; 1610 NSString* appUuid = [NSString alloc];
...@@ -1778,21 +1622,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1778,21 +1622,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1778 accessToken = [tokens objectForKey:@"access_token"]; 1622 accessToken = [tokens objectForKey:@"access_token"];
1779 NSString* clientSecret = [NSString alloc]; 1623 NSString* clientSecret = [NSString alloc];
1780 clientSecret = [tokens objectForKey:@"client_secret"]; 1624 clientSecret = [tokens objectForKey:@"client_secret"];
1781 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1625 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1782 -// [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1783 -// WL_FMDBLogError
1784 -//
1785 -// [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken];
1786 -
1787 -// [_db executeUpdate:@"DROP TABLE requestVariables"];
1788 - if ([_db tableExists:@"requestVariables"] == NO) {
1789 [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"]; 1626 [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1790 WL_FMDBLogError 1627 WL_FMDBLogError
1791 1628
1792 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, refreshToken, accessToken]; 1629 + [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken];
1793 - } else {
1794 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", clientId, clientSecret, refreshToken, accessToken];
1795 - }
1796 1630
1797 NSDictionary *successResponse = @{@"result": @"success", @"status":@1}; 1631 NSDictionary *successResponse = @{@"result": @"success", @"status":@1};
1798 if (success) { 1632 if (success) {
...@@ -1825,22 +1659,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1825,22 +1659,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1825 accessToken = [tokens objectForKey:@"access_token"]; 1659 accessToken = [tokens objectForKey:@"access_token"];
1826 NSString* clientSecret = [NSString alloc]; 1660 NSString* clientSecret = [NSString alloc];
1827 clientSecret = [tokens objectForKey:@"client_secret"]; 1661 clientSecret = [tokens objectForKey:@"client_secret"];
1828 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1662 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1829 -// [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1830 -// WL_FMDBLogError
1831 -//
1832 -// [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken];
1833 -
1834 - // TODO: ADD NEW SDK
1835 -// [_db executeUpdate:@"DROP TABLE requestVariables"];
1836 - if ([_db tableExists:@"requestVariables"] == NO) {
1837 [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"]; 1663 [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1838 WL_FMDBLogError 1664 WL_FMDBLogError
1839 1665
1840 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, refreshToken, accessToken]; 1666 + [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken];
1841 - } else {
1842 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", clientId, clientSecret, refreshToken, accessToken];
1843 - }
1844 1667
1845 NSDictionary *successResponse = @{@"result": @"success", @"status":@1}; 1668 NSDictionary *successResponse = @{@"result": @"success", @"status":@1};
1846 if (success) { 1669 if (success) {
...@@ -1886,17 +1709,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1886,17 +1709,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1886 }]; 1709 }];
1887 } failureBlock:^(NSError *error) { 1710 } failureBlock:^(NSError *error) {
1888 if (failure) { 1711 if (failure) {
1889 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1712 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1890 - if ([_db tableExists:@"requestVariables"] == NO) {
1891 -
1892 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1893 - WL_FMDBLogError
1894 -
1895 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1896 -
1897 - } else {
1898 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1899 - }
1900 failure(error); 1713 failure(error);
1901 } 1714 }
1902 NSLog(@"Error at token %@", error ); 1715 NSLog(@"Error at token %@", error );
...@@ -1933,17 +1746,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1933,17 +1746,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1933 }]; 1746 }];
1934 } failureBlock:^(NSError *error) { 1747 } failureBlock:^(NSError *error) {
1935 if (failure) { 1748 if (failure) {
1936 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1749 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1937 - if ([_db tableExists:@"requestVariables"] == NO) {
1938 -
1939 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1940 - WL_FMDBLogError
1941 -
1942 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1943 -
1944 - } else {
1945 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1946 - }
1947 failure(error); 1750 failure(error);
1948 } 1751 }
1949 NSLog(@"Error at token %@", error ); 1752 NSLog(@"Error at token %@", error );
...@@ -1980,17 +1783,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -1980,17 +1783,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
1980 }]; 1783 }];
1981 } failureBlock:^(NSError *error) { 1784 } failureBlock:^(NSError *error) {
1982 if (failure) { 1785 if (failure) {
1983 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1786 + [_db executeUpdate:@"DROP TABLE requestVariables"];
1984 - if ([_db tableExists:@"requestVariables"] == NO) {
1985 -
1986 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
1987 - WL_FMDBLogError
1988 -
1989 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
1990 -
1991 - } else {
1992 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
1993 - }
1994 failure(error); 1787 failure(error);
1995 } 1788 }
1996 NSLog(@"Error at token %@", error ); 1789 NSLog(@"Error at token %@", error );
...@@ -2031,17 +1824,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2031,17 +1824,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2031 }]; 1824 }];
2032 } failureBlock:^(NSError *error) { 1825 } failureBlock:^(NSError *error) {
2033 if (failure) { 1826 if (failure) {
2034 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1827 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2035 - if ([_db tableExists:@"requestVariables"] == NO) {
2036 -
2037 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2038 - WL_FMDBLogError
2039 -
2040 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2041 -
2042 - } else {
2043 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2044 - }
2045 failure(error); 1828 failure(error);
2046 } 1829 }
2047 NSLog(@"Error at token %@", error ); 1830 NSLog(@"Error at token %@", error );
...@@ -2078,17 +1861,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2078,17 +1861,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2078 }]; 1861 }];
2079 } failureBlock:^(NSError *error) { 1862 } failureBlock:^(NSError *error) {
2080 if (failure) { 1863 if (failure) {
2081 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1864 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2082 - if ([_db tableExists:@"requestVariables"] == NO) {
2083 -
2084 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2085 - WL_FMDBLogError
2086 -
2087 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2088 -
2089 - } else {
2090 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2091 - }
2092 failure(error); 1865 failure(error);
2093 } 1866 }
2094 NSLog(@"Error at token %@", error ); 1867 NSLog(@"Error at token %@", error );
...@@ -2125,17 +1898,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2125,17 +1898,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2125 }]; 1898 }];
2126 } failureBlock:^(NSError *error) { 1899 } failureBlock:^(NSError *error) {
2127 if (failure) { 1900 if (failure) {
2128 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1901 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2129 - if ([_db tableExists:@"requestVariables"] == NO) {
2130 -
2131 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2132 - WL_FMDBLogError
2133 -
2134 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2135 -
2136 - } else {
2137 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2138 - }
2139 failure(error); 1902 failure(error);
2140 } 1903 }
2141 NSLog(@"Error at token %@", error ); 1904 NSLog(@"Error at token %@", error );
...@@ -2217,17 +1980,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2217,17 +1980,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2217 }]; 1980 }];
2218 } failureBlock:^(NSError *error) { 1981 } failureBlock:^(NSError *error) {
2219 if (failure) { 1982 if (failure) {
2220 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 1983 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2221 - if ([_db tableExists:@"requestVariables"] == NO) {
2222 -
2223 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2224 - WL_FMDBLogError
2225 -
2226 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2227 -
2228 - } else {
2229 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2230 - }
2231 failure(error); 1984 failure(error);
2232 } 1985 }
2233 NSLog(@"Error at token %@", error ); 1986 NSLog(@"Error at token %@", error );
...@@ -2264,17 +2017,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2264,17 +2017,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2264 }]; 2017 }];
2265 } failureBlock:^(NSError *error) { 2018 } failureBlock:^(NSError *error) {
2266 if (failure) { 2019 if (failure) {
2267 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2020 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2268 - if ([_db tableExists:@"requestVariables"] == NO) {
2269 -
2270 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2271 - WL_FMDBLogError
2272 -
2273 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2274 -
2275 - } else {
2276 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2277 - }
2278 failure(error); 2021 failure(error);
2279 } 2022 }
2280 NSLog(@"Error at token %@", error ); 2023 NSLog(@"Error at token %@", error );
...@@ -2311,17 +2054,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2311,17 +2054,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2311 }]; 2054 }];
2312 } failureBlock:^(NSError *error) { 2055 } failureBlock:^(NSError *error) {
2313 if (failure) { 2056 if (failure) {
2314 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2057 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2315 - if ([_db tableExists:@"requestVariables"] == NO) {
2316 -
2317 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2318 - WL_FMDBLogError
2319 -
2320 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2321 -
2322 - } else {
2323 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2324 - }
2325 failure(error); 2058 failure(error);
2326 } 2059 }
2327 NSLog(@"Error at token %@", error ); 2060 NSLog(@"Error at token %@", error );
...@@ -2533,17 +2266,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2533,17 +2266,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2533 }]; 2266 }];
2534 } failureBlock:^(NSError *error) { 2267 } failureBlock:^(NSError *error) {
2535 if (failure) { 2268 if (failure) {
2536 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2269 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2537 - if ([_db tableExists:@"requestVariables"] == NO) {
2538 -
2539 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2540 - WL_FMDBLogError
2541 -
2542 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2543 -
2544 - } else {
2545 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2546 - }
2547 failure(error); 2270 failure(error);
2548 } 2271 }
2549 NSLog(@"Error at token %@", error ); 2272 NSLog(@"Error at token %@", error );
...@@ -2603,17 +2326,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2603,17 +2326,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2603 }]; 2326 }];
2604 } failureBlock:^(NSError *error) { 2327 } failureBlock:^(NSError *error) {
2605 if (failure) { 2328 if (failure) {
2606 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2329 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2607 - if ([_db tableExists:@"requestVariables"] == NO) {
2608 -
2609 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2610 - WL_FMDBLogError
2611 -
2612 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2613 -
2614 - } else {
2615 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2616 - }
2617 failure(error); 2330 failure(error);
2618 } 2331 }
2619 NSLog(@"Error at token %@", error ); 2332 NSLog(@"Error at token %@", error );
...@@ -2654,17 +2367,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2654,17 +2367,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2654 }]; 2367 }];
2655 } failureBlock:^(NSError *error) { 2368 } failureBlock:^(NSError *error) {
2656 if (failure) { 2369 if (failure) {
2657 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2370 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2658 - if ([_db tableExists:@"requestVariables"] == NO) {
2659 -
2660 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2661 - WL_FMDBLogError
2662 -
2663 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2664 -
2665 - } else {
2666 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2667 - }
2668 failure(error); 2371 failure(error);
2669 } 2372 }
2670 NSLog(@"Error at token %@", error ); 2373 NSLog(@"Error at token %@", error );
...@@ -2705,17 +2408,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2705,17 +2408,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2705 }]; 2408 }];
2706 } failureBlock:^(NSError *error) { 2409 } failureBlock:^(NSError *error) {
2707 if (failure) { 2410 if (failure) {
2708 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2411 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2709 - if ([_db tableExists:@"requestVariables"] == NO) {
2710 -
2711 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2712 - WL_FMDBLogError
2713 -
2714 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2715 -
2716 - } else {
2717 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2718 - }
2719 failure(error); 2412 failure(error);
2720 } 2413 }
2721 NSLog(@"Error at token %@", error ); 2414 NSLog(@"Error at token %@", error );
...@@ -2756,17 +2449,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2756,17 +2449,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2756 }]; 2449 }];
2757 } failureBlock:^(NSError *error) { 2450 } failureBlock:^(NSError *error) {
2758 if (failure) { 2451 if (failure) {
2759 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2452 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2760 - if ([_db tableExists:@"requestVariables"] == NO) {
2761 -
2762 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2763 - WL_FMDBLogError
2764 -
2765 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2766 -
2767 - } else {
2768 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2769 - }
2770 failure(error); 2453 failure(error);
2771 } 2454 }
2772 NSLog(@"Error at token %@", error ); 2455 NSLog(@"Error at token %@", error );
...@@ -2826,17 +2509,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2826,17 +2509,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2826 }]; 2509 }];
2827 } failureBlock:^(NSError *error) { 2510 } failureBlock:^(NSError *error) {
2828 if (failure) { 2511 if (failure) {
2829 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2512 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2830 - if ([_db tableExists:@"requestVariables"] == NO) {
2831 -
2832 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2833 - WL_FMDBLogError
2834 -
2835 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2836 -
2837 - } else {
2838 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2839 - }
2840 failure(error); 2513 failure(error);
2841 } 2514 }
2842 NSLog(@"Error at token %@", error ); 2515 NSLog(@"Error at token %@", error );
...@@ -2873,17 +2546,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2873,17 +2546,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2873 }]; 2546 }];
2874 } failureBlock:^(NSError *error) { 2547 } failureBlock:^(NSError *error) {
2875 if (failure) { 2548 if (failure) {
2876 -// [_db executeUpdate:@"DROP TABLE requestVariables"]; 2549 + [_db executeUpdate:@"DROP TABLE requestVariables"];
2877 - if ([_db tableExists:@"requestVariables"] == NO) {
2878 -
2879 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
2880 - WL_FMDBLogError
2881 -
2882 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
2883 -
2884 - } else {
2885 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
2886 - }
2887 failure(error); 2550 failure(error);
2888 } 2551 }
2889 NSLog(@"Error at token %@", error ); 2552 NSLog(@"Error at token %@", error );
...@@ -6133,18 +5796,6 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) ...@@ -6133,18 +5796,6 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
6133 [_db executeUpdate:@"CREATE TABLE pois (id INTEGER PRIMARY KEY NOT NULL UNIQUE, lat NUMERIC, lon NUMERIC, radius NUMERIC)"]; 5796 [_db executeUpdate:@"CREATE TABLE pois (id INTEGER PRIMARY KEY NOT NULL UNIQUE, lat NUMERIC, lon NUMERIC, radius NUMERIC)"];
6134 } 5797 }
6135 5798
6136 - // TODO: ADD NEW SDK
6137 -// [_db executeUpdate:@"DROP TABLE requestVariables"];
6138 - if ([_db tableExists:@"requestVariables"] == NO) {
6139 - [_db executeUpdate:@"CREATE TABLE requestVariables (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, client_id INTEGER, client_secret VARCHAR(255), access_token VARCHAR(255), refresh_token VARCHAR(255))"];
6140 - WL_FMDBLogError
6141 -
6142 - [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, refresh_token, access_token) VALUES (1, ?, ?, ?, ?)", @0, @"", @"", @""];
6143 -
6144 - } else {
6145 - [_db executeUpdate:@"UPDATE requestVariables SET client_id = ? , client_secret = ?, refresh_token = ?, access_token = ? WHERE id = 1", @0, @"", @"", @""];
6146 - }
6147 -
6148 [_db makeFunctionNamed:@"DISTANCE" maximumArguments:4 withBlock:^(sqlite3_context *context, int argc, sqlite3_value **argv) { 5799 [_db makeFunctionNamed:@"DISTANCE" maximumArguments:4 withBlock:^(sqlite3_context *context, int argc, sqlite3_value **argv) {
6149 distanceFunc(context, argc, argv); 5800 distanceFunc(context, argc, argv);
6150 }]; 5801 }];
......