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-08-04 18:22:54 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
94eed680a1fd140dbe24b6442fc2a47115373d2f
94eed680
1 parent
e12a1d61
add logs to steps
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
94eed68
...
...
@@ -59,7 +59,13 @@ public class swiftApi {
func
startTrackingCallback
(
_
steps
:
NSNumber
?)
->
Void
{
print
(
"=== steps ==="
)
print
(
steps
as?
Int
??
0
)
if
(
steps
!=
nil
)
{
print
(
"=== steps to save ==="
)
print
((
steps
as!
Int
)
-
GlobalVariables
.
savedSteps
)
swiftApi
()
.
setSteps
((
steps
as!
Int
)
-
GlobalVariables
.
savedSteps
)
}
...
...
@@ -97,11 +103,14 @@ public class swiftApi {
}
func
startTimer
()
{
print
(
"========= Timer Started! ========="
)
let
queue
=
DispatchQueue
(
label
:
Bundle
.
main
.
bundleIdentifier
!
+
".timer"
)
timer
=
DispatchSource
.
makeTimerSource
(
queue
:
queue
)
timer
!.
schedule
(
deadline
:
.
now
(),
repeating
:
.
seconds
(
10
))
timer
!.
setEventHandler
{
[
weak
self
]
in
// do whatever stuff you want on the background queue here here
print
(
"========= interval! ========="
)
let
persistedSteps
=
swiftApi
()
.
getSteps
()
if
(
persistedSteps
>
0
)
{
...
...
@@ -132,6 +141,7 @@ public class swiftApi {
}
func
stopTimer
()
{
print
(
"========= Timer Stopped! ========="
)
timer
?
.
cancel
()
timer
=
nil
}
...
...
Please
register
or
login
to post a comment