Manos Chorianopoulos

add initializeWithCallback

No preview for this file type
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>0</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>0</integer> 10 + <integer>1</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
16 @property (nonatomic, weak) Warply *warply; 16 @property (nonatomic, weak) Warply *warply;
17 17
18 - (void) initialize:(NSDictionary *)launchOptions uuid:(NSString*)uuid merchantId:(NSString*)merchantId lang:(NSString*)lang; 18 - (void) initialize:(NSDictionary *)launchOptions uuid:(NSString*)uuid merchantId:(NSString*)merchantId lang:(NSString*)lang;
19 +- (void) initializeWithCallback:(NSDictionary *)launchOptions uuid:(NSString*)uuid merchantId:(NSString*)merchantId lang:(NSString*)lang successBlock:(void(^)(NSDictionary *successBlock))success failureBlock:(void(^)(NSError *error))failure;
19 - (void) setToStage; 20 - (void) setToStage;
20 - (void) setLang:(NSString*) lang; 21 - (void) setLang:(NSString*) lang;
21 - (void) getSteps:(void(^)(CMPedometerData* stepsData)) completion; 22 - (void) getSteps:(void(^)(CMPedometerData* stepsData)) completion;
......
...@@ -51,6 +51,36 @@ CMPedometer *pedometer; ...@@ -51,6 +51,36 @@ CMPedometer *pedometer;
51 // } 51 // }
52 } 52 }
53 53
54 +- (void)initializeWithCallback:(NSDictionary *)launchOptions uuid:(NSString*)uuid merchantId:(NSString*)merchantId lang:(NSString*)lang successBlock:(void(^)(NSDictionary *successBlock))success failureBlock:(void(^)(NSError *error))failure{
55 + #if (DEBUG == 1)
56 + [Warply launchWithAppUUIDWithCallback:uuid launchOptions:launchOptions andSuccessBlock:success andFailureBlock:failure];
57 + #else
58 + [Warply launchWithAppUUIDWithCallback:uuid launchOptions:launchOptions andSuccessBlock:success andFailureBlock:failure];
59 + #endif
60 + [[Warply sharedService].pushManager registerForRemoteNotifications];
61 + [[Warply sharedService].pushManager resetBadge];
62 + MERCHANT_ID = merchantId;
63 + LANG = lang;
64 + //removal of caching
65 + int cacheSizeMemory = 0; // 0MB
66 + int cacheSizeDisk = 0; // 0MB
67 + NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];
68 + [NSURLCache setSharedURLCache:sharedCache];
69 +
70 +// date = [NSDate date];
71 +// if ([CMPedometer isStepCountingAvailable]) {
72 +// pedometer = [[CMPedometer alloc] init];
73 +// [NSTimer scheduledTimerWithTimeInterval:0.5f
74 +// target:self
75 +// selector:@selector(recursiveQuery)
76 +// userInfo:nil
77 +// repeats:YES];
78 +// } else {
79 +// NSLog(@"Nothing available");
80 +//
81 +// }
82 +}
83 +
54 - (void)queryDataFrom:(NSDate *)startDate toDate:(NSDate *)endDate { 84 - (void)queryDataFrom:(NSDate *)startDate toDate:(NSDate *)endDate {
55 [pedometer queryPedometerDataFromDate:startDate 85 [pedometer queryPedometerDataFromDate:startDate
56 toDate:endDate 86 toDate:endDate
......
...@@ -145,6 +145,7 @@ typedef enum { ...@@ -145,6 +145,7 @@ typedef enum {
145 empty if application launched by user. 145 empty if application launched by user.
146 */ 146 */
147 + (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions; 147 + (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions;
148 ++ (void)launchWithAppUUIDWithCallback:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions andSuccessBlock:(void (^)(NSDictionary *))success andFailureBlock:(void (^)(NSError *error))failure;
148 149
149 /*! 150 /*!
150 @abstract Launching the Warply service. 151 @abstract Launching the Warply service.
...@@ -157,6 +158,7 @@ typedef enum { ...@@ -157,6 +158,7 @@ typedef enum {
157 @param customPushDelegate an class conforming to the WLCustomPushDelegate protocol responsible for handling the push notification. 158 @param customPushDelegate an class conforming to the WLCustomPushDelegate protocol responsible for handling the push notification.
158 */ 159 */
159 + (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushHandler:(id <WLCustomPushHandler>)customPushHandler; 160 + (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushHandler:(id <WLCustomPushHandler>)customPushHandler;
161 ++ (void)launchWithAppUUIDWithCallback:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushHandler:(id <WLCustomPushHandler>)customPushHandler andSuccessBlock:(void (^)(NSDictionary *))success andFailureBlock:(void (^)(NSError *error))failure;
160 162
161 /*! 163 /*!
162 @abstract Launching the Warply service. 164 @abstract Launching the Warply service.
...@@ -170,6 +172,7 @@ typedef enum { ...@@ -170,6 +172,7 @@ typedef enum {
170 @param baseUrl: A NSString parameter for defining the base url. 172 @param baseUrl: A NSString parameter for defining the base url.
171 */ 173 */
172 + (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushDelegate:(id <WLCustomPushHandler>)customPushDelegate serverBaseUrl:(NSString *)baseUrl; 174 + (void)launchWithAppUUID:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushDelegate:(id <WLCustomPushHandler>)customPushDelegate serverBaseUrl:(NSString *)baseUrl;
175 ++ (void)launchWithAppUUIDWithCallback:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushDelegate:(id <WLCustomPushHandler>)customPushDelegate serverBaseUrl:(NSString *)baseUrl andSuccessBlock:(void (^)(NSDictionary *))success andFailureBlock:(void (^)(NSError *error))failure;
173 176
174 177
175 /*! 178 /*!
......