Manos Chorianopoulos

add spinner at CouponVC

...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
24 1EB236AF28816CAC0063777A /* NumbersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */; }; 24 1EB236AF28816CAC0063777A /* NumbersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */; };
25 1EB5F4C828536FD60016F36E /* StepsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C728536FD60016F36E /* StepsViewController.swift */; }; 25 1EB5F4C828536FD60016F36E /* StepsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C728536FD60016F36E /* StepsViewController.swift */; };
26 1EB5F4CA285370C90016F36E /* LoyaltyAnalysisViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */; }; 26 1EB5F4CA285370C90016F36E /* LoyaltyAnalysisViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */; };
27 + 1EBC75432922829D004FBE75 /* SpinnerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBC75422922829D004FBE75 /* SpinnerViewController.swift */; };
27 1EBE97212865EE460080EFF7 /* MFYInboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */; }; 28 1EBE97212865EE460080EFF7 /* MFYInboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */; };
28 1EBF5F072840E13F00B8B17F /* SwiftEventBus in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBF5F062840E13F00B8B17F /* SwiftEventBus */; }; 29 1EBF5F072840E13F00B8B17F /* SwiftEventBus in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBF5F062840E13F00B8B17F /* SwiftEventBus */; };
29 1ECA079128D9E3BA00D2BDE0 /* CSMButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */; }; 30 1ECA079128D9E3BA00D2BDE0 /* CSMButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */; };
...@@ -187,6 +188,7 @@ ...@@ -187,6 +188,7 @@
187 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersTableViewCell.swift; sourceTree = "<group>"; }; 188 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersTableViewCell.swift; sourceTree = "<group>"; };
188 1EB5F4C728536FD60016F36E /* StepsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsViewController.swift; sourceTree = "<group>"; }; 189 1EB5F4C728536FD60016F36E /* StepsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsViewController.swift; sourceTree = "<group>"; };
189 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyAnalysisViewController.swift; sourceTree = "<group>"; }; 190 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyAnalysisViewController.swift; sourceTree = "<group>"; };
191 + 1EBC75422922829D004FBE75 /* SpinnerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpinnerViewController.swift; sourceTree = "<group>"; };
190 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFYInboxTableViewCell.swift; sourceTree = "<group>"; }; 192 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFYInboxTableViewCell.swift; sourceTree = "<group>"; };
191 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CSMButton.swift; sourceTree = "<group>"; }; 193 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CSMButton.swift; sourceTree = "<group>"; };
192 1ECA079228D9E53F00D2BDE0 /* MapsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapsViewController.swift; sourceTree = "<group>"; }; 194 1ECA079228D9E53F00D2BDE0 /* MapsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapsViewController.swift; sourceTree = "<group>"; };
...@@ -444,6 +446,7 @@ ...@@ -444,6 +446,7 @@
444 E6A77850282933340045BBA8 /* SwiftWarplyFramework */ = { 446 E6A77850282933340045BBA8 /* SwiftWarplyFramework */ = {
445 isa = PBXGroup; 447 isa = PBXGroup;
446 children = ( 448 children = (
449 + 1EBC75422922829D004FBE75 /* SpinnerViewController.swift */,
447 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */, 450 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */,
448 1E108A9728A3FA9B0008B8E7 /* Info.plist */, 451 1E108A9728A3FA9B0008B8E7 /* Info.plist */,
449 1E108A8B28A3F8FF0008B8E7 /* Resources */, 452 1E108A8B28A3F8FF0008B8E7 /* Resources */,
...@@ -927,6 +930,7 @@ ...@@ -927,6 +930,7 @@
927 A07936702885D95600064122 /* AnalysisItemViewCell.swift in Sources */, 930 A07936702885D95600064122 /* AnalysisItemViewCell.swift in Sources */,
928 E6A77956282933E70045BBA8 /* GiftsViewController.swift in Sources */, 931 E6A77956282933E70045BBA8 /* GiftsViewController.swift in Sources */,
929 1ECA079728D9E66200D2BDE0 /* MerchantAnnotation.swift in Sources */, 932 1ECA079728D9E66200D2BDE0 /* MerchantAnnotation.swift in Sources */,
933 + 1EBC75432922829D004FBE75 /* SpinnerViewController.swift in Sources */,
930 E6A778F1282933E60045BBA8 /* WLNativeAdTableViewCell.m in Sources */, 934 E6A778F1282933E60045BBA8 /* WLNativeAdTableViewCell.m in Sources */,
931 E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */, 935 E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */,
932 E6A77938282933E70045BBA8 /* AFImageDownloader.m in Sources */, 936 E6A77938282933E70045BBA8 /* AFImageDownloader.m in Sources */,
......
...@@ -32,6 +32,8 @@ import SwiftEventBus ...@@ -32,6 +32,8 @@ import SwiftEventBus
32 32
33 public var couponset: swiftApi.CouponSetItemModel? 33 public var couponset: swiftApi.CouponSetItemModel?
34 public var campaign: swiftApi.CampaignItemModel? 34 public var campaign: swiftApi.CampaignItemModel?
35 +
36 + let spinner = SpinnerViewController()
35 37
36 public override func viewDidLoad() { 38 public override func viewDidLoad() {
37 super.viewDidLoad() 39 super.viewDidLoad()
...@@ -160,7 +162,24 @@ import SwiftEventBus ...@@ -160,7 +162,24 @@ import SwiftEventBus
160 } 162 }
161 } 163 }
162 164
165 + func showSpinner() {
166 + // add the spinner view controller
167 + addChild(spinner)
168 + spinner.view.frame = view.frame
169 + view.addSubview(spinner.view)
170 + spinner.didMove(toParent: self)
171 + }
172 +
173 + func hideSpinner() {
174 + // remove the spinner view controller
175 + spinner.willMove(toParent: nil)
176 + spinner.view.removeFromSuperview()
177 + spinner.removeFromParent()
178 + }
179 +
163 func redeemCouponSetRequest(uuid: String, communication_uuid: String) { 180 func redeemCouponSetRequest(uuid: String, communication_uuid: String) {
181 + showSpinner()
182 +
164 if (ccms == nil) { 183 if (ccms == nil) {
165 swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback) 184 swiftApi().redeemCouponSetAsync(uuid: uuid, communication_uuid: communication_uuid, redeemCouponSetCallback)
166 } else { 185 } else {
...@@ -170,6 +189,8 @@ import SwiftEventBus ...@@ -170,6 +189,8 @@ import SwiftEventBus
170 } 189 }
171 190
172 func redeemCouponSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void { 191 func redeemCouponSetCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
192 + hideSpinner()
193 +
173 if (response != nil) { 194 if (response != nil) {
174 DispatchQueue.main.async { 195 DispatchQueue.main.async {
175 if (response?.getStatus == 1) { 196 if (response?.getStatus == 1) {
......
1 +//
2 +// SpinnerViewController.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 14/11/22.
6 +//
7 +
8 +import UIKit
9 +
10 +@objc public class SpinnerViewController: UIViewController {
11 + var spinner = UIActivityIndicatorView()
12 +
13 + public override func loadView() {
14 + if #available(iOS 13.0, *) {
15 + spinner = UIActivityIndicatorView(style: .large)
16 + spinner.color = .white
17 +
18 + } else {
19 + spinner = UIActivityIndicatorView(style: .whiteLarge)
20 + }
21 +
22 + view = UIView()
23 + view.backgroundColor = UIColor(white: 0, alpha: 0.7)
24 +
25 + spinner.translatesAutoresizingMaskIntoConstraints = false
26 + spinner.startAnimating()
27 + view.addSubview(spinner)
28 +
29 + spinner.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
30 + spinner.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
31 + }
32 +
33 + public override func viewDidLoad() {
34 + super.viewDidLoad()
35 +
36 + // Do any additional setup after loading the view.
37 + }
38 +
39 +}