Manos Chorianopoulos

add campaign url params at constructCampaignUrl

......@@ -189,9 +189,11 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
- (NSDictionary *) provideInfoForCampaign {
NSMutableDictionary* info = [[NSMutableDictionary alloc] init];
info[@"web_id"] = [Warply sharedService].webId;
// info[@"web_id"] = [Warply sharedService].webId;
info[@"web_id"] = [WLKeychain getStringForKey:@"NBWebID"];
info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"];
info[@"api_key"] = self.warply.apiKey;
// info[@"api_key"] = self.warply.apiKey;
info[@"api_key"] = [WLKeychain getStringForKey:@"NBAPIKey"];
Warply* warplyInstance = [[Warply alloc] init];
info[@"access_token"] = [warplyInstance getAccessToken];
info[@"refresh_token"] = [warplyInstance getRefreshToken];
......
......@@ -544,7 +544,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
- (NSString*)getClientId {
NSString *clientId = [NSString alloc];
if ([_db tableExists:@"requestVariables"] == YES) {
FMResultSet *clientIdSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"];
FMResultSet *clientIdSet = [_db executeQuery:@"SELECT client_id FROM requestVariables WHERE id = 1;"];
while ([clientIdSet next]) {
clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
}
......
......@@ -1270,8 +1270,19 @@ public class swiftApi {
public func constructCampaignUrl(_ campaign: CampaignItemModel) -> String {
// TODO: Pending functionality
return campaign.index_url ?? ""
let instanceOfMyApi = MyApi()
let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
let finalUrl = (campaign.index_url ?? "")
+ "?web_id=" + (campaignInfo?["web_id"] as! String)
+ "&app_uuid=" + (campaignInfo?["app_uuid"] as! String)
+ "&api_key=" + (campaignInfo?["api_key"] as! String)
+ "&session_uuid=" + (campaign.session_uuid ?? "")
+ "&access_token=" + (campaignInfo?["access_token"] as! String)
+ "&refresh_token=" + (campaignInfo?["refresh_token"] as! String)
+ "&client_id=" + (campaignInfo?["client_id"] as! String)
+ "&client_secret=" + (campaignInfo?["client_secret"] as! String);
return finalUrl
}
public func constructCcmsUrl(_ campaign: LoyaltyContextualOfferModel) -> String {
......@@ -1279,8 +1290,19 @@ public class swiftApi {
}
public func constructCampaignUrlForShare(_ campaign: CampaignItemModel, _ deeplink: String) -> String {
// TODO: Pending functionality
return campaign.index_url ?? ""
let instanceOfMyApi = MyApi()
let campaignInfo = instanceOfMyApi.provideInfoForCampaign()
let finalUrl = (campaign.index_url ?? "")
+ "?web_id=" + (campaignInfo?["web_id"] as! String)
+ "&app_uuid=" + (campaignInfo?["app_uuid"] as! String)
+ "&api_key=" + (campaignInfo?["api_key"] as! String)
+ "&session_uuid=" + (campaign.session_uuid ?? "")
+ "&access_token=" + (campaignInfo?["access_token"] as! String)
+ "&refresh_token=" + (campaignInfo?["refresh_token"] as! String)
+ "&client_id=" + (campaignInfo?["client_id"] as! String)
+ "&client_secret=" + (campaignInfo?["client_secret"] as! String);
return finalUrl
}
......