Manos Chorianopoulos

add campaign url params at constructCampaignUrl

...@@ -189,9 +189,11 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; ...@@ -189,9 +189,11 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
189 189
190 - (NSDictionary *) provideInfoForCampaign { 190 - (NSDictionary *) provideInfoForCampaign {
191 NSMutableDictionary* info = [[NSMutableDictionary alloc] init]; 191 NSMutableDictionary* info = [[NSMutableDictionary alloc] init];
192 - info[@"web_id"] = [Warply sharedService].webId; 192 + // info[@"web_id"] = [Warply sharedService].webId;
193 + info[@"web_id"] = [WLKeychain getStringForKey:@"NBWebID"];
193 info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"]; 194 info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"];
194 - info[@"api_key"] = self.warply.apiKey; 195 + // info[@"api_key"] = self.warply.apiKey;
196 + info[@"api_key"] = [WLKeychain getStringForKey:@"NBAPIKey"];
195 Warply* warplyInstance = [[Warply alloc] init]; 197 Warply* warplyInstance = [[Warply alloc] init];
196 info[@"access_token"] = [warplyInstance getAccessToken]; 198 info[@"access_token"] = [warplyInstance getAccessToken];
197 info[@"refresh_token"] = [warplyInstance getRefreshToken]; 199 info[@"refresh_token"] = [warplyInstance getRefreshToken];
......
...@@ -544,7 +544,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -544,7 +544,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
544 - (NSString*)getClientId { 544 - (NSString*)getClientId {
545 NSString *clientId = [NSString alloc]; 545 NSString *clientId = [NSString alloc];
546 if ([_db tableExists:@"requestVariables"] == YES) { 546 if ([_db tableExists:@"requestVariables"] == YES) {
547 - FMResultSet *clientIdSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"]; 547 + FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
548 while ([clientIdSet next]) { 548 while ([clientIdSet next]) {
549 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue]; 549 clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
550 } 550 }
......
...@@ -1270,8 +1270,19 @@ public class swiftApi { ...@@ -1270,8 +1270,19 @@ public class swiftApi {
1270 1270
1271 1271
1272 public func constructCampaignUrl(_ campaign: CampaignItemModel) -> String { 1272 public func constructCampaignUrl(_ campaign: CampaignItemModel) -> String {
1273 - // TODO: Pending functionality 1273 + let instanceOfMyApi = MyApi()
1274 - return campaign.index_url ?? "" 1274 + let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
1275 + let finalUrl = (campaign.index_url ?? "")
1276 + + "?web_id=" + (campaignInfo?["web_id"] as! String)
1277 + + "&app_uuid=" + (campaignInfo?["app_uuid"] as! String)
1278 + + "&api_key=" + (campaignInfo?["api_key"] as! String)
1279 + + "&session_uuid=" + (campaign.session_uuid ?? "")
1280 + + "&access_token=" + (campaignInfo?["access_token"] as! String)
1281 + + "&refresh_token=" + (campaignInfo?["refresh_token"] as! String)
1282 + + "&client_id=" + (campaignInfo?["client_id"] as! String)
1283 + + "&client_secret=" + (campaignInfo?["client_secret"] as! String);
1284 +
1285 + return finalUrl
1275 } 1286 }
1276 1287
1277 public func constructCcmsUrl(_ campaign: LoyaltyContextualOfferModel) -> String { 1288 public func constructCcmsUrl(_ campaign: LoyaltyContextualOfferModel) -> String {
...@@ -1279,8 +1290,19 @@ public class swiftApi { ...@@ -1279,8 +1290,19 @@ public class swiftApi {
1279 } 1290 }
1280 1291
1281 public func constructCampaignUrlForShare(_ campaign: CampaignItemModel, _ deeplink: String) -> String { 1292 public func constructCampaignUrlForShare(_ campaign: CampaignItemModel, _ deeplink: String) -> String {
1282 - // TODO: Pending functionality 1293 + let instanceOfMyApi = MyApi()
1283 - return campaign.index_url ?? "" 1294 + let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
1295 + let finalUrl = (campaign.index_url ?? "")
1296 + + "?web_id=" + (campaignInfo?["web_id"] as! String)
1297 + + "&app_uuid=" + (campaignInfo?["app_uuid"] as! String)
1298 + + "&api_key=" + (campaignInfo?["api_key"] as! String)
1299 + + "&session_uuid=" + (campaign.session_uuid ?? "")
1300 + + "&access_token=" + (campaignInfo?["access_token"] as! String)
1301 + + "&refresh_token=" + (campaignInfo?["refresh_token"] as! String)
1302 + + "&client_id=" + (campaignInfo?["client_id"] as! String)
1303 + + "&client_secret=" + (campaignInfo?["client_secret"] as! String);
1304 +
1305 + return finalUrl
1284 } 1306 }
1285 1307
1286 1308
......