Manos Chorianopoulos

save steps on campaign back button press

...@@ -35,6 +35,28 @@ var timer2: DispatchSourceTimer? ...@@ -35,6 +35,28 @@ var timer2: DispatchSourceTimer?
35 } 35 }
36 36
37 stopTimer() 37 stopTimer()
38 +
39 + let persistedSteps = swiftApi().getSteps()
40 + if (persistedSteps > 0) {
41 +
42 + let currentDateTime = Date()
43 + let dateFormatter = DateFormatter()
44 + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
45 + let dateString = dateFormatter.string(from: currentDateTime)
46 +
47 + swiftApi().setPacingDetailsAsync(persistedSteps, dateString, setPacingDetailsAsyncCallback)
48 + }
49 +
50 + func setPacingDetailsAsyncCallback (_ responseData: swiftApi.GenericResponseModel?) -> Void {
51 + if (responseData != nil) {
52 + DispatchQueue.main.async {
53 + if (responseData?.getStatus == 1) {
54 + print("===== steps sent on back button press ====")
55 + }
56 + }
57 + } else {
58 + }
59 + }
38 } 60 }
39 61
40 public override func viewDidLoad() { 62 public override func viewDidLoad() {
......