Showing
10 changed files
with
124 additions
and
2 deletions
| ... | @@ -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>0</integer> | 10 | + <integer>1</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>1</integer> | 10 | + <integer>0</integer> |
| 11 | </dict> | 11 | </dict> |
| 12 | </dict> | 12 | </dict> |
| 13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
| ... | @@ -333,6 +333,12 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -333,6 +333,12 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
| 333 | 333 | ||
| 334 | } else { | 334 | } else { |
| 335 | if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "") { | 335 | if (campaigns[indexPath.row].session_uuid != nil && campaigns[indexPath.row].session_uuid != "") { |
| 336 | + | ||
| 337 | + let status = swiftApi().getNetworkStatus() | ||
| 338 | + if (status == -1 || status == 0) { | ||
| 339 | + self.showDialog("Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | ||
| 340 | + } else { | ||
| 341 | + | ||
| 336 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 342 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 337 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | 343 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController |
| 338 | var url = "" | 344 | var url = "" |
| ... | @@ -388,6 +394,7 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -388,6 +394,7 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
| 388 | if let sessionUuid = campaigns[indexPath.row].session_uuid { | 394 | if let sessionUuid = campaigns[indexPath.row].session_uuid { |
| 389 | getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | 395 | getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) |
| 390 | } | 396 | } |
| 397 | + } | ||
| 391 | 398 | ||
| 392 | } else { | 399 | } else { |
| 393 | let seasonalEvent = swiftApi.LoyaltyGiftsForYouOfferClickEvent() | 400 | let seasonalEvent = swiftApi.LoyaltyGiftsForYouOfferClickEvent() |
| ... | @@ -418,4 +425,24 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -418,4 +425,24 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
| 418 | } | 425 | } |
| 419 | } | 426 | } |
| 420 | 427 | ||
| 428 | + | ||
| 429 | + func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void { | ||
| 430 | + | ||
| 431 | + let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert) | ||
| 432 | + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in | ||
| 433 | + switch action.style{ | ||
| 434 | + case .default: | ||
| 435 | + print("default") | ||
| 436 | + | ||
| 437 | + case .cancel: | ||
| 438 | + print("cancel") | ||
| 439 | + | ||
| 440 | + case .destructive: | ||
| 441 | + print("destructive") | ||
| 442 | + | ||
| 443 | + } | ||
| 444 | + })) | ||
| 445 | + self.present(alert, animated: true, completion: nil) | ||
| 446 | + } | ||
| 447 | + | ||
| 421 | } | 448 | } | ... | ... |
| ... | @@ -371,6 +371,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -371,6 +371,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | } else { | 373 | } else { |
| 374 | + let status = swiftApi().getNetworkStatus() | ||
| 375 | + if (status == -1 || status == 0) { | ||
| 376 | + self.showDialog("Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | ||
| 377 | + } else { | ||
| 374 | // let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 378 | // let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 375 | // let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | 379 | // let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController |
| 376 | // let url = swiftApi().constructCampaignUrl(campaign) | 380 | // let url = swiftApi().constructCampaignUrl(campaign) |
| ... | @@ -436,6 +440,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -436,6 +440,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
| 436 | } | 440 | } |
| 437 | } | 441 | } |
| 438 | } | 442 | } |
| 443 | + } | ||
| 439 | 444 | ||
| 440 | 445 | ||
| 441 | func getSingleCampaignAsyncRequest(sessionUuid: String) { | 446 | func getSingleCampaignAsyncRequest(sessionUuid: String) { |
| ... | @@ -450,4 +455,23 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -450,4 +455,23 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
| 450 | } | 455 | } |
| 451 | } | 456 | } |
| 452 | 457 | ||
| 458 | + func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void { | ||
| 459 | + | ||
| 460 | + let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert) | ||
| 461 | + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in | ||
| 462 | + switch action.style{ | ||
| 463 | + case .default: | ||
| 464 | + print("default") | ||
| 465 | + | ||
| 466 | + case .cancel: | ||
| 467 | + print("cancel") | ||
| 468 | + | ||
| 469 | + case .destructive: | ||
| 470 | + print("destructive") | ||
| 471 | + | ||
| 472 | + } | ||
| 473 | + })) | ||
| 474 | + self.present(alert, animated: true, completion: nil) | ||
| 475 | + } | ||
| 476 | + | ||
| 453 | } | 477 | } | ... | ... |
| ... | @@ -117,6 +117,7 @@ | ... | @@ -117,6 +117,7 @@ |
| 117 | - (void) sendEvent: (NSString *) eventName priority: (BOOL) priority; | 117 | - (void) sendEvent: (NSString *) eventName priority: (BOOL) priority; |
| 118 | - (void)updateRefreshTokenMA:(NSString*)access_token :(NSString*)refresh_token; | 118 | - (void)updateRefreshTokenMA:(NSString*)access_token :(NSString*)refresh_token; |
| 119 | - (NSString*)getAccessTokenM; | 119 | - (NSString*)getAccessTokenM; |
| 120 | +- (long)getNetworkStatusM; | ||
| 120 | 121 | ||
| 121 | @end | 122 | @end |
| 122 | #endif /* MyApi_h */ | 123 | #endif /* MyApi_h */ | ... | ... |
| ... | @@ -1841,4 +1841,10 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -1841,4 +1841,10 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
| 1841 | return [[Warply sharedService] getAccessToken2]; | 1841 | return [[Warply sharedService] getAccessToken2]; |
| 1842 | } | 1842 | } |
| 1843 | 1843 | ||
| 1844 | +- (long)getNetworkStatusM | ||
| 1845 | +{ | ||
| 1846 | + | ||
| 1847 | + return [[Warply sharedService] getNetworkStatus]; | ||
| 1848 | +} | ||
| 1849 | + | ||
| 1844 | @end | 1850 | @end | ... | ... |
| ... | @@ -471,6 +471,7 @@ WL_VERSION_INTERFACE() | ... | @@ -471,6 +471,7 @@ WL_VERSION_INTERFACE() |
| 471 | */ | 471 | */ |
| 472 | - (void)getInboxStatusWithSuccessBlock:(void (^)(int count, int newItems, int unread))success failureBlock:(void (^)(NSError *error))failure; | 472 | - (void)getInboxStatusWithSuccessBlock:(void (^)(int count, int newItems, int unread))success failureBlock:(void (^)(NSError *error))failure; |
| 473 | 473 | ||
| 474 | +- (long)getNetworkStatus; | ||
| 474 | 475 | ||
| 475 | /*! | 476 | /*! |
| 476 | @methodgroup Low Level API | 477 | @methodgroup Low Level API | ... | ... |
| ... | @@ -523,6 +523,12 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * | ... | @@ -523,6 +523,12 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * |
| 523 | // [[Warply sharedService] addEvent:(WLEvent*)event priority:NO]; | 523 | // [[Warply sharedService] addEvent:(WLEvent*)event priority:NO]; |
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | +//- (AFNetworkReachabilityStatus)getNetworkStatus | ||
| 527 | +- (long)getNetworkStatus | ||
| 528 | +{ | ||
| 529 | + return (long)self.networkStatus; | ||
| 530 | +} | ||
| 531 | + | ||
| 526 | #pragma mark - Public Methods | 532 | #pragma mark - Public Methods |
| 527 | /////////////////////////////////////////////////////////////////////////////// | 533 | /////////////////////////////////////////////////////////////////////////////// |
| 528 | WL_VERSION_IMPLEMENTATION(WL_VERSION) | 534 | WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | ... |
| ... | @@ -4031,7 +4031,32 @@ public class swiftApi { | ... | @@ -4031,7 +4031,32 @@ public class swiftApi { |
| 4031 | } | 4031 | } |
| 4032 | 4032 | ||
| 4033 | 4033 | ||
| 4034 | + func showDialog(_ controller: UIViewController,_ alertTitle: String, _ alertSubTitle: String) -> Void { | ||
| 4035 | + | ||
| 4036 | + let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert) | ||
| 4037 | + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in | ||
| 4038 | + switch action.style{ | ||
| 4039 | + case .default: | ||
| 4040 | + print("default") | ||
| 4041 | + | ||
| 4042 | + case .cancel: | ||
| 4043 | + print("cancel") | ||
| 4044 | + | ||
| 4045 | + case .destructive: | ||
| 4046 | + print("destructive") | ||
| 4047 | + | ||
| 4048 | + } | ||
| 4049 | + })) | ||
| 4050 | + controller.present(alert, animated: true, completion: nil) | ||
| 4051 | + } | ||
| 4052 | + | ||
| 4053 | + | ||
| 4034 | public func openQuestionnaire(_ controller: UIViewController) -> Void { | 4054 | public func openQuestionnaire(_ controller: UIViewController) -> Void { |
| 4055 | + let status = swiftApi().getNetworkStatus() | ||
| 4056 | + if (status == -1 || status == 0) { | ||
| 4057 | + swiftApi().showDialog(controller, "Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | ||
| 4058 | + | ||
| 4059 | + } else { | ||
| 4035 | for item in GlobalVariables.campaigns { | 4060 | for item in GlobalVariables.campaigns { |
| 4036 | if (item.offer_category == "questionnaire") { | 4061 | if (item.offer_category == "questionnaire") { |
| 4037 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 4062 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| ... | @@ -4046,9 +4071,15 @@ public class swiftApi { | ... | @@ -4046,9 +4071,15 @@ public class swiftApi { |
| 4046 | } | 4071 | } |
| 4047 | } | 4072 | } |
| 4048 | } | 4073 | } |
| 4074 | + } | ||
| 4049 | 4075 | ||
| 4050 | 4076 | ||
| 4051 | public func openPacing(_ controller: UIViewController) -> Void { | 4077 | public func openPacing(_ controller: UIViewController) -> Void { |
| 4078 | + let status = swiftApi().getNetworkStatus() | ||
| 4079 | + if (status == -1 || status == 0) { | ||
| 4080 | + swiftApi().showDialog(controller, "Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | ||
| 4081 | + | ||
| 4082 | + } else { | ||
| 4052 | for item in GlobalVariables.campaigns { | 4083 | for item in GlobalVariables.campaigns { |
| 4053 | if (item.offer_category == "pacing") { | 4084 | if (item.offer_category == "pacing") { |
| 4054 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 4085 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| ... | @@ -4064,6 +4095,7 @@ public class swiftApi { | ... | @@ -4064,6 +4095,7 @@ public class swiftApi { |
| 4064 | } | 4095 | } |
| 4065 | } | 4096 | } |
| 4066 | } | 4097 | } |
| 4098 | + } | ||
| 4067 | 4099 | ||
| 4068 | 4100 | ||
| 4069 | public func openCouponset(_ controller: UIViewController) -> Void { | 4101 | public func openCouponset(_ controller: UIViewController) -> Void { |
| ... | @@ -5936,6 +5968,11 @@ public class swiftApi { | ... | @@ -5936,6 +5968,11 @@ public class swiftApi { |
| 5936 | } | 5968 | } |
| 5937 | 5969 | ||
| 5938 | } else { | 5970 | } else { |
| 5971 | + let status = swiftApi().getNetworkStatus() | ||
| 5972 | + if (status == -1 || status == 0) { | ||
| 5973 | + swiftApi().showDialog(controller, "Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | ||
| 5974 | + | ||
| 5975 | + } else { | ||
| 5939 | swiftApi().logTrackersEvent("click", ("Loyalty:" + (campaign.session_uuid ?? ""))) | 5976 | swiftApi().logTrackersEvent("click", ("Loyalty:" + (campaign.session_uuid ?? ""))) |
| 5940 | 5977 | ||
| 5941 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 5978 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| ... | @@ -5949,6 +5986,7 @@ public class swiftApi { | ... | @@ -5949,6 +5986,7 @@ public class swiftApi { |
| 5949 | getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | 5986 | getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) |
| 5950 | } | 5987 | } |
| 5951 | } | 5988 | } |
| 5989 | + } | ||
| 5952 | 5990 | ||
| 5953 | func getSingleCampaignAsyncRequest(sessionUuid: String) { | 5991 | func getSingleCampaignAsyncRequest(sessionUuid: String) { |
| 5954 | swiftApi().getSingleCampaignAsync(sessionUuid: sessionUuid, getSingleCampaignCallback) | 5992 | swiftApi().getSingleCampaignAsync(sessionUuid: sessionUuid, getSingleCampaignCallback) |
| ... | @@ -5993,6 +6031,12 @@ public class swiftApi { | ... | @@ -5993,6 +6031,12 @@ public class swiftApi { |
| 5993 | 6031 | ||
| 5994 | if (isCcmsOffer && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { | 6032 | if (isCcmsOffer && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { |
| 5995 | 6033 | ||
| 6034 | + let status = swiftApi().getNetworkStatus() | ||
| 6035 | + if (status == -1 || status == 0) { | ||
| 6036 | + swiftApi().showDialog(controller, "Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | ||
| 6037 | + | ||
| 6038 | + } else { | ||
| 6039 | + | ||
| 5996 | swiftApi().logTrackersEvent("click", ("Contextual:" + (ccms._sessionId))) | 6040 | swiftApi().logTrackersEvent("click", ("Contextual:" + (ccms._sessionId))) |
| 5997 | 6041 | ||
| 5998 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 6042 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| ... | @@ -6005,6 +6049,7 @@ public class swiftApi { | ... | @@ -6005,6 +6049,7 @@ public class swiftApi { |
| 6005 | getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | 6049 | getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) |
| 6006 | } | 6050 | } |
| 6007 | break; | 6051 | break; |
| 6052 | + } | ||
| 6008 | 6053 | ||
| 6009 | } else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { | 6054 | } else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { |
| 6010 | 6055 | ||
| ... | @@ -7242,4 +7287,16 @@ public class swiftApi { | ... | @@ -7242,4 +7287,16 @@ public class swiftApi { |
| 7242 | } | 7287 | } |
| 7243 | 7288 | ||
| 7244 | 7289 | ||
| 7290 | + /* | ||
| 7291 | + AFNetworkReachabilityStatusUnknown = -1, | ||
| 7292 | + AFNetworkReachabilityStatusNotReachable = 0, | ||
| 7293 | + AFNetworkReachabilityStatusReachableViaWWAN = 1, | ||
| 7294 | + AFNetworkReachabilityStatusReachableViaWiFi = 2, | ||
| 7295 | + */ | ||
| 7296 | + public func getNetworkStatus() -> Int { | ||
| 7297 | + let instanceOfMyApi = MyApi() | ||
| 7298 | + return instanceOfMyApi.getNetworkStatusM() | ||
| 7299 | + } | ||
| 7300 | + | ||
| 7301 | + | ||
| 7245 | } | 7302 | } | ... | ... |
-
Please register or login to post a comment