Showing
2 changed files
with
35 additions
and
35 deletions
... | @@ -51,7 +51,7 @@ var timer2: DispatchSourceTimer? | ... | @@ -51,7 +51,7 @@ var timer2: DispatchSourceTimer? |
51 | if (responseData != nil) { | 51 | if (responseData != nil) { |
52 | DispatchQueue.main.async { | 52 | DispatchQueue.main.async { |
53 | if (responseData?.getStatus == 1) { | 53 | if (responseData?.getStatus == 1) { |
54 | - print("===== steps sent on back button press ====") | 54 | + // print("===== steps sent on back button press ====") |
55 | } | 55 | } |
56 | } | 56 | } |
57 | } else { | 57 | } else { |
... | @@ -82,14 +82,14 @@ var timer2: DispatchSourceTimer? | ... | @@ -82,14 +82,14 @@ var timer2: DispatchSourceTimer? |
82 | 82 | ||
83 | // MARK: - Functions | 83 | // MARK: - Functions |
84 | func startTimer() { | 84 | func startTimer() { |
85 | - print("========= Webview Timer Started! =========") | 85 | + // print("========= Webview Timer Started! =========") |
86 | 86 | ||
87 | let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".webview.timer") | 87 | let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".webview.timer") |
88 | timer2 = DispatchSource.makeTimerSource(queue: queue) | 88 | timer2 = DispatchSource.makeTimerSource(queue: queue) |
89 | timer2!.schedule(deadline: .now(), repeating: .seconds(1)) | 89 | timer2!.schedule(deadline: .now(), repeating: .seconds(1)) |
90 | timer2!.setEventHandler { [weak self] in | 90 | timer2!.setEventHandler { [weak self] in |
91 | // do whatever stuff you want on the background queue here here | 91 | // do whatever stuff you want on the background queue here here |
92 | - print("========= Webview interval! =========") | 92 | + // print("========= Webview interval! =========") |
93 | 93 | ||
94 | DispatchQueue.main.async { | 94 | DispatchQueue.main.async { |
95 | // update your model objects and/or UI here | 95 | // update your model objects and/or UI here |
... | @@ -97,17 +97,17 @@ var timer2: DispatchSourceTimer? | ... | @@ -97,17 +97,17 @@ var timer2: DispatchSourceTimer? |
97 | let scriptSource = "passMeters(\(metersParam));" | 97 | let scriptSource = "passMeters(\(metersParam));" |
98 | 98 | ||
99 | self?.webview.evaluateJavaScript(scriptSource, completionHandler: { (object, error) in | 99 | self?.webview.evaluateJavaScript(scriptSource, completionHandler: { (object, error) in |
100 | - print("==== object ====") | 100 | + // print("==== object ====") |
101 | - print(object) | 101 | + // print(object) |
102 | - print("==== error ====") | 102 | + // print("==== error ====") |
103 | - print(error) | 103 | + // print(error) |
104 | 104 | ||
105 | swiftApi().setSavedStepsWebview(swiftApi().getSavedStepsWebview() + swiftApi().getStepsWebview()) | 105 | swiftApi().setSavedStepsWebview(swiftApi().getSavedStepsWebview() + swiftApi().getStepsWebview()) |
106 | swiftApi().setStepsWebview(0) | 106 | swiftApi().setStepsWebview(0) |
107 | swiftApi().setMetersWebview(0.0) | 107 | swiftApi().setMetersWebview(0.0) |
108 | 108 | ||
109 | - print("==== SavedStepsWebview ====") | 109 | + // print("==== SavedStepsWebview ====") |
110 | - print(swiftApi().getSavedStepsWebview()) | 110 | + // print(swiftApi().getSavedStepsWebview()) |
111 | }) | 111 | }) |
112 | } | 112 | } |
113 | } | 113 | } |
... | @@ -115,7 +115,7 @@ var timer2: DispatchSourceTimer? | ... | @@ -115,7 +115,7 @@ var timer2: DispatchSourceTimer? |
115 | } | 115 | } |
116 | 116 | ||
117 | func stopTimer() { | 117 | func stopTimer() { |
118 | - print("========= Webview Timer Stopped! =========") | 118 | + // print("========= Webview Timer Stopped! =========") |
119 | timer2?.cancel() | 119 | timer2?.cancel() |
120 | timer2 = nil | 120 | timer2 = nil |
121 | } | 121 | } |
... | @@ -136,10 +136,10 @@ var timer2: DispatchSourceTimer? | ... | @@ -136,10 +136,10 @@ var timer2: DispatchSourceTimer? |
136 | let scriptSource = "passParams(\(params));" | 136 | let scriptSource = "passParams(\(params));" |
137 | 137 | ||
138 | webView.evaluateJavaScript(scriptSource, completionHandler: { (object, error) in | 138 | webView.evaluateJavaScript(scriptSource, completionHandler: { (object, error) in |
139 | - print("==== object ====") | 139 | + // print("==== object ====") |
140 | - print(object) | 140 | + // print(object) |
141 | - print("==== error ====") | 141 | + // print("==== error ====") |
142 | - print(error) | 142 | + // print(error) |
143 | 143 | ||
144 | DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { | 144 | DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) { |
145 | self.startTimer() | 145 | self.startTimer() |
... | @@ -205,13 +205,13 @@ var timer2: DispatchSourceTimer? | ... | @@ -205,13 +205,13 @@ var timer2: DispatchSourceTimer? |
205 | DispatchQueue.main.async { | 205 | DispatchQueue.main.async { |
206 | SwiftEventBus.post("coupons_fetched") | 206 | SwiftEventBus.post("coupons_fetched") |
207 | 207 | ||
208 | - print("========= getCouponsRequest SUCCESSSS CampaignVC =========") | 208 | + // print("========= getCouponsRequest SUCCESSSS CampaignVC =========") |
209 | 209 | ||
210 | - print("========= getCouponsRequest count CampaignVC =========") | 210 | + // print("========= getCouponsRequest count CampaignVC =========") |
211 | - print(swiftApi().getCouponList().count) | 211 | + // print(swiftApi().getCouponList().count) |
212 | } | 212 | } |
213 | } else { | 213 | } else { |
214 | - print("========= getCouponsRequest ERROR CampaignVC =========") | 214 | + // print("========= getCouponsRequest ERROR CampaignVC =========") |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ... | ... |
... | @@ -154,8 +154,8 @@ public class swiftApi { | ... | @@ -154,8 +154,8 @@ public class swiftApi { |
154 | 154 | ||
155 | let oldDayMeters: Double = pacingData?._meters._day._value ?? 0.0 | 155 | let oldDayMeters: Double = pacingData?._meters._day._value ?? 0.0 |
156 | 156 | ||
157 | - print("=== oldDayMeters ===") | 157 | + // print("=== oldDayMeters ===") |
158 | - print(oldDayMeters) | 158 | + // print(oldDayMeters) |
159 | 159 | ||
160 | GlobalVariables.trackingStepsEnabled = true | 160 | GlobalVariables.trackingStepsEnabled = true |
161 | 161 | ||
... | @@ -190,13 +190,13 @@ public class swiftApi { | ... | @@ -190,13 +190,13 @@ public class swiftApi { |
190 | 190 | ||
191 | func startTrackingCallback(_ steps: NSNumber?) -> Void { | 191 | func startTrackingCallback(_ steps: NSNumber?) -> Void { |
192 | 192 | ||
193 | - print("=== steps ===") | 193 | + // print("=== steps ===") |
194 | - print(steps as? Int ?? 0) | 194 | + // print(steps as? Int ?? 0) |
195 | 195 | ||
196 | if (steps != nil) { | 196 | if (steps != nil) { |
197 | - print("=== steps to save ===") | 197 | + // print("=== steps to save ===") |
198 | 198 | ||
199 | - print((steps as! Int) - GlobalVariables.savedSteps) | 199 | + // print((steps as! Int) - GlobalVariables.savedSteps) |
200 | swiftApi().setSteps((steps as! Int) - GlobalVariables.savedSteps) | 200 | swiftApi().setSteps((steps as! Int) - GlobalVariables.savedSteps) |
201 | 201 | ||
202 | let metersCount = (steps as? Double ?? 0.0) * 0.762 | 202 | let metersCount = (steps as? Double ?? 0.0) * 0.762 |
... | @@ -206,21 +206,21 @@ public class swiftApi { | ... | @@ -206,21 +206,21 @@ public class swiftApi { |
206 | pacingEvent._meters = metersCount + oldDayMeters | 206 | pacingEvent._meters = metersCount + oldDayMeters |
207 | SwiftEventBus.post("meters_sent", sender: pacingEvent) | 207 | SwiftEventBus.post("meters_sent", sender: pacingEvent) |
208 | 208 | ||
209 | - print("=== MetersCount ===") | 209 | + // print("=== MetersCount ===") |
210 | - print(metersCount) | 210 | + // print(metersCount) |
211 | 211 | ||
212 | - print("=== Widget MetersCount ===") | 212 | + // print("=== Widget MetersCount ===") |
213 | - print(metersCount + oldDayMeters) | 213 | + // print(metersCount + oldDayMeters) |
214 | 214 | ||
215 | let newStepsWebview = (steps as! Int) - GlobalVariables.savedStepsWebview | 215 | let newStepsWebview = (steps as! Int) - GlobalVariables.savedStepsWebview |
216 | swiftApi().setStepsWebview(newStepsWebview) | 216 | swiftApi().setStepsWebview(newStepsWebview) |
217 | let newMetersWebview = Double(newStepsWebview) * 0.762 | 217 | let newMetersWebview = Double(newStepsWebview) * 0.762 |
218 | swiftApi().setMetersWebview(newMetersWebview) | 218 | swiftApi().setMetersWebview(newMetersWebview) |
219 | 219 | ||
220 | - print("=== StepsWebview ===") | 220 | + // print("=== StepsWebview ===") |
221 | - print(newStepsWebview) | 221 | + // print(newStepsWebview) |
222 | - print("=== MetersWebview ===") | 222 | + // print("=== MetersWebview ===") |
223 | - print(newMetersWebview) | 223 | + // print(newMetersWebview) |
224 | } | 224 | } |
225 | 225 | ||
226 | getStepsCallback(steps as? Int ?? 0) | 226 | getStepsCallback(steps as? Int ?? 0) |
... | @@ -272,14 +272,14 @@ public class swiftApi { | ... | @@ -272,14 +272,14 @@ public class swiftApi { |
272 | } | 272 | } |
273 | 273 | ||
274 | func startTimer() { | 274 | func startTimer() { |
275 | - print("========= Timer Started! =========") | 275 | + // print("========= Timer Started! =========") |
276 | 276 | ||
277 | let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".timer") | 277 | let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".timer") |
278 | timer = DispatchSource.makeTimerSource(queue: queue) | 278 | timer = DispatchSource.makeTimerSource(queue: queue) |
279 | timer!.schedule(deadline: .now(), repeating: .seconds(60 * 15)) | 279 | timer!.schedule(deadline: .now(), repeating: .seconds(60 * 15)) |
280 | timer!.setEventHandler { [weak self] in | 280 | timer!.setEventHandler { [weak self] in |
281 | // do whatever stuff you want on the background queue here here | 281 | // do whatever stuff you want on the background queue here here |
282 | - print("========= interval! =========") | 282 | + // print("========= interval! =========") |
283 | 283 | ||
284 | let persistedSteps = swiftApi().getSteps() | 284 | let persistedSteps = swiftApi().getSteps() |
285 | if (persistedSteps > 0) { | 285 | if (persistedSteps > 0) { |
... | @@ -310,7 +310,7 @@ public class swiftApi { | ... | @@ -310,7 +310,7 @@ public class swiftApi { |
310 | } | 310 | } |
311 | 311 | ||
312 | func stopTimer() { | 312 | func stopTimer() { |
313 | - print("========= Timer Stopped! =========") | 313 | + // print("========= Timer Stopped! =========") |
314 | timer?.cancel() | 314 | timer?.cancel() |
315 | timer = nil | 315 | timer = nil |
316 | } | 316 | } | ... | ... |
-
Please register or login to post a comment