Manos Chorianopoulos

add pacing Goal Achieved popup

...@@ -4040,7 +4040,7 @@ public class swiftApi { ...@@ -4040,7 +4040,7 @@ public class swiftApi {
4040 } 4040 }
4041 4041
4042 4042
4043 - public func getPacingDetailsAsync(_ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void) -> Void { 4043 + public func getPacingDetailsAsync(_ controller: UIViewController, _ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void) -> Void {
4044 4044
4045 let instanceOfMyApi = MyApi() 4045 let instanceOfMyApi = MyApi()
4046 instanceOfMyApi.getPacingDetailsAsync(pacingCallback, failureBlock: pacingFailureCallback) 4046 instanceOfMyApi.getPacingDetailsAsync(pacingCallback, failureBlock: pacingFailureCallback)
...@@ -4053,6 +4053,10 @@ public class swiftApi { ...@@ -4053,6 +4053,10 @@ public class swiftApi {
4053 let pacingDataResult = (pacingDataDictionary["result"] as? [String: Any] ?? [String: Any]()) 4053 let pacingDataResult = (pacingDataDictionary["result"] as? [String: Any] ?? [String: Any]())
4054 4054
4055 let tempPacingDetails = PacingDetails(dictionary: pacingDataResult) 4055 let tempPacingDetails = PacingDetails(dictionary: pacingDataResult)
4056 +
4057 + if (tempPacingDetails._meters._month._value >= tempPacingDetails._meters._month._goal) {
4058 + self.pacingGoalDialog(controller)
4059 + }
4056 4060
4057 getPacingDetailsCallback(tempPacingDetails); 4061 getPacingDetailsCallback(tempPacingDetails);
4058 } 4062 }
...@@ -4070,6 +4074,26 @@ public class swiftApi { ...@@ -4070,6 +4074,26 @@ public class swiftApi {
4070 } 4074 }
4071 4075
4072 4076
4077 + func pacingGoalDialog(_ controller: UIViewController) -> Void {
4078 +
4079 + let alert = UIAlertController(title: "Συγχαρητήρια!", message: "Πέτυχες το στόχο του μήνα! Διάλεξε το δώρο που επιθυμείς να ενεργοποιήσεις!", preferredStyle: .alert)
4080 + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
4081 + switch action.style{
4082 + case .default:
4083 + print("default")
4084 +
4085 + case .cancel:
4086 + print("cancel")
4087 +
4088 + case .destructive:
4089 + print("destructive")
4090 +
4091 + }
4092 + }))
4093 + controller.present(alert, animated: true, completion: nil)
4094 + }
4095 +
4096 +
4073 public func setPacingDetailsAsync(_ steps: Int, _ date: String, _ setPacingDetailsCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { 4097 public func setPacingDetailsAsync(_ steps: Int, _ date: String, _ setPacingDetailsCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
4074 4098
4075 let instanceOfMyApi = MyApi() 4099 let instanceOfMyApi = MyApi()
......