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:39:01 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3379848dbe1afdf693d46b4aa9fc31d161e08f59
3379848d
1 parent
94eed680
fix startTrackingSteps
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
3379848
...
...
@@ -51,6 +51,29 @@ public class swiftApi {
public
func
startTrackingSteps
(
_
getStepsCallback
:
@escaping
(
_
steps
:
Int
)
->
Void
)
->
Void
{
// Check if there are persistedSteps from previous app kill and save them
let
persistedSteps
=
swiftApi
()
.
getSteps
()
if
(
persistedSteps
>
0
)
{
let
currentDateTime
=
Date
()
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
let
dateString
=
dateFormatter
.
string
(
from
:
currentDateTime
)
swiftApi
()
.
setPacingDetailsAsync
(
persistedSteps
,
dateString
,
setPacingDetailsAsyncCallback
)
}
func
setPacingDetailsAsyncCallback
(
_
responseData
:
swiftApi
.
GenericResponseModel
?)
->
Void
{
if
(
responseData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
if
(
responseData
?
.
getStatus
==
1
)
{
}
}
}
else
{
}
}
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
startTrackingSteps
(
startTrackingCallback
)
...
...
@@ -107,7 +130,7 @@ public class swiftApi {
let
queue
=
DispatchQueue
(
label
:
Bundle
.
main
.
bundleIdentifier
!
+
".timer"
)
timer
=
DispatchSource
.
makeTimerSource
(
queue
:
queue
)
timer
!.
schedule
(
deadline
:
.
now
(),
repeating
:
.
seconds
(
10
))
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! ========="
)
...
...
Please
register
or
login
to post a comment