Manos Chorianopoulos

add pacing Goal Achieved popup

......@@ -4040,7 +4040,7 @@ public class swiftApi {
}
public func getPacingDetailsAsync(_ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void) -> Void {
public func getPacingDetailsAsync(_ controller: UIViewController, _ getPacingDetailsCallback: @escaping (_ pacingData: PacingDetails?) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.getPacingDetailsAsync(pacingCallback, failureBlock: pacingFailureCallback)
......@@ -4054,6 +4054,10 @@ public class swiftApi {
let tempPacingDetails = PacingDetails(dictionary: pacingDataResult)
if (tempPacingDetails._meters._month._value >= tempPacingDetails._meters._month._goal) {
self.pacingGoalDialog(controller)
}
getPacingDetailsCallback(tempPacingDetails);
}
......@@ -4070,6 +4074,26 @@ public class swiftApi {
}
func pacingGoalDialog(_ controller: UIViewController) -> Void {
let alert = UIAlertController(title: "Συγχαρητήρια!", message: "Πέτυχες το στόχο του μήνα! Διάλεξε το δώρο που επιθυμείς να ενεργοποιήσεις!", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
switch action.style{
case .default:
print("default")
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}
}))
controller.present(alert, animated: true, completion: nil)
}
public func setPacingDetailsAsync(_ steps: Int, _ date: String, _ setPacingDetailsCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
let instanceOfMyApi = MyApi()
......