Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2022-11-24 10:25:14 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d1c6cf1ac18febcd5ad47d4b8282ecee20cb33d3
d1c6cf1a
1 parent
5569bbe8
comment out webview logs
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
35 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
d1c6cf1
...
...
@@ -51,7 +51,7 @@ var timer2: DispatchSourceTimer?
if
(
responseData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
if
(
responseData
?
.
getStatus
==
1
)
{
print
(
"===== steps sent on back button press ===="
)
//
print("===== steps sent on back button press ====")
}
}
}
else
{
...
...
@@ -82,14 +82,14 @@ var timer2: DispatchSourceTimer?
// MARK: - Functions
func
startTimer
()
{
print
(
"========= Webview Timer Started! ========="
)
//
print("========= Webview Timer Started! =========")
let
queue
=
DispatchQueue
(
label
:
Bundle
.
main
.
bundleIdentifier
!
+
".webview.timer"
)
timer2
=
DispatchSource
.
makeTimerSource
(
queue
:
queue
)
timer2
!.
schedule
(
deadline
:
.
now
(),
repeating
:
.
seconds
(
1
))
timer2
!.
setEventHandler
{
[
weak
self
]
in
// do whatever stuff you want on the background queue here here
print
(
"========= Webview interval! ========="
)
//
print("========= Webview interval! =========")
DispatchQueue
.
main
.
async
{
// update your model objects and/or UI here
...
...
@@ -97,17 +97,17 @@ var timer2: DispatchSourceTimer?
let
scriptSource
=
"passMeters(
\(
metersParam
)
);"
self
?
.
webview
.
evaluateJavaScript
(
scriptSource
,
completionHandler
:
{
(
object
,
error
)
in
print
(
"==== object ===="
)
print
(
object
)
print
(
"==== error ===="
)
print
(
error
)
//
print("==== object ====")
//
print(object)
//
print("==== error ====")
//
print(error)
swiftApi
()
.
setSavedStepsWebview
(
swiftApi
()
.
getSavedStepsWebview
()
+
swiftApi
()
.
getStepsWebview
())
swiftApi
()
.
setStepsWebview
(
0
)
swiftApi
()
.
setMetersWebview
(
0.0
)
print
(
"==== SavedStepsWebview ===="
)
print
(
swiftApi
()
.
getSavedStepsWebview
())
//
print("==== SavedStepsWebview ====")
//
print(swiftApi().getSavedStepsWebview())
})
}
}
...
...
@@ -115,7 +115,7 @@ var timer2: DispatchSourceTimer?
}
func
stopTimer
()
{
print
(
"========= Webview Timer Stopped! ========="
)
//
print("========= Webview Timer Stopped! =========")
timer2
?
.
cancel
()
timer2
=
nil
}
...
...
@@ -136,10 +136,10 @@ var timer2: DispatchSourceTimer?
let
scriptSource
=
"passParams(
\(
params
)
);"
webView
.
evaluateJavaScript
(
scriptSource
,
completionHandler
:
{
(
object
,
error
)
in
print
(
"==== object ===="
)
print
(
object
)
print
(
"==== error ===="
)
print
(
error
)
//
print("==== object ====")
//
print(object)
//
print("==== error ====")
//
print(error)
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
3.0
)
{
self
.
startTimer
()
...
...
@@ -205,13 +205,13 @@ var timer2: DispatchSourceTimer?
DispatchQueue
.
main
.
async
{
SwiftEventBus
.
post
(
"coupons_fetched"
)
print
(
"========= getCouponsRequest SUCCESSSS CampaignVC ========="
)
//
print("========= getCouponsRequest SUCCESSSS CampaignVC =========")
print
(
"========= getCouponsRequest count CampaignVC ========="
)
print
(
swiftApi
()
.
getCouponList
()
.
count
)
//
print("========= getCouponsRequest count CampaignVC =========")
//
print(swiftApi().getCouponList().count)
}
}
else
{
print
(
"========= getCouponsRequest ERROR CampaignVC ========="
)
//
print("========= getCouponsRequest ERROR CampaignVC =========")
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
d1c6cf1
...
...
@@ -154,8 +154,8 @@ public class swiftApi {
let
oldDayMeters
:
Double
=
pacingData
?
.
_meters
.
_day
.
_value
??
0.0
print
(
"=== oldDayMeters ==="
)
print
(
oldDayMeters
)
//
print("=== oldDayMeters ===")
//
print(oldDayMeters)
GlobalVariables
.
trackingStepsEnabled
=
true
...
...
@@ -190,13 +190,13 @@ public class swiftApi {
func
startTrackingCallback
(
_
steps
:
NSNumber
?)
->
Void
{
print
(
"=== steps ==="
)
print
(
steps
as?
Int
??
0
)
//
print("=== steps ===")
//
print(steps as? Int ?? 0)
if
(
steps
!=
nil
)
{
print
(
"=== steps to save ==="
)
//
print("=== steps to save ===")
print
((
steps
as!
Int
)
-
GlobalVariables
.
savedSteps
)
//
print((steps as! Int) - GlobalVariables.savedSteps)
swiftApi
()
.
setSteps
((
steps
as!
Int
)
-
GlobalVariables
.
savedSteps
)
let
metersCount
=
(
steps
as?
Double
??
0.0
)
*
0.762
...
...
@@ -206,21 +206,21 @@ public class swiftApi {
pacingEvent
.
_meters
=
metersCount
+
oldDayMeters
SwiftEventBus
.
post
(
"meters_sent"
,
sender
:
pacingEvent
)
print
(
"=== MetersCount ==="
)
print
(
metersCount
)
//
print("=== MetersCount ===")
//
print(metersCount)
print
(
"=== Widget MetersCount ==="
)
print
(
metersCount
+
oldDayMeters
)
//
print("=== Widget MetersCount ===")
//
print(metersCount + oldDayMeters)
let
newStepsWebview
=
(
steps
as!
Int
)
-
GlobalVariables
.
savedStepsWebview
swiftApi
()
.
setStepsWebview
(
newStepsWebview
)
let
newMetersWebview
=
Double
(
newStepsWebview
)
*
0.762
swiftApi
()
.
setMetersWebview
(
newMetersWebview
)
print
(
"=== StepsWebview ==="
)
print
(
newStepsWebview
)
print
(
"=== MetersWebview ==="
)
print
(
newMetersWebview
)
//
print("=== StepsWebview ===")
//
print(newStepsWebview)
//
print("=== MetersWebview ===")
//
print(newMetersWebview)
}
getStepsCallback
(
steps
as?
Int
??
0
)
...
...
@@ -272,14 +272,14 @@ public class swiftApi {
}
func
startTimer
()
{
print
(
"========= Timer Started! ========="
)
//
print("========= Timer Started! =========")
let
queue
=
DispatchQueue
(
label
:
Bundle
.
main
.
bundleIdentifier
!
+
".timer"
)
timer
=
DispatchSource
.
makeTimerSource
(
queue
:
queue
)
timer
!.
schedule
(
deadline
:
.
now
(),
repeating
:
.
seconds
(
60
*
15
))
timer
!.
setEventHandler
{
[
weak
self
]
in
// do whatever stuff you want on the background queue here here
print
(
"========= interval! ========="
)
//
print("========= interval! =========")
let
persistedSteps
=
swiftApi
()
.
getSteps
()
if
(
persistedSteps
>
0
)
{
...
...
@@ -310,7 +310,7 @@ public class swiftApi {
}
func
stopTimer
()
{
print
(
"========= Timer Stopped! ========="
)
//
print("========= Timer Stopped! =========")
timer
?
.
cancel
()
timer
=
nil
}
...
...
Please
register
or
login
to post a comment