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-09-28 17:24:47 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4e3bd0e8a04263af33f960ec7875e975073ed58e
4e3bd0e8
1 parent
b83a7165
fix pacing on user logout, add oldDayMeters
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
4e3bd0e
...
...
@@ -121,6 +121,18 @@ public class swiftApi {
public
func
startTrackingSteps
(
_
getStepsCallback
:
@escaping
(
_
steps
:
Int
)
->
Void
)
->
Void
{
if
(
GlobalVariables
.
trackingStepsEnabled
==
false
)
{
// First get meters day value from database
swiftApi
()
.
getPacingDetailsAsync
(
getPacingCallback
)
func
getPacingCallback
(
_
pacingData
:
swiftApi
.
PacingDetails
?)
->
Void
{
if
(
pacingData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
let
oldDayMeters
:
Double
=
pacingData
?
.
_meters
.
_day
.
_value
??
0.0
print
(
"=== oldDayMeters ==="
)
print
(
oldDayMeters
)
GlobalVariables
.
trackingStepsEnabled
=
true
// Check if there are persistedSteps from previous app kill and save them
...
...
@@ -167,12 +179,15 @@ public class swiftApi {
swiftApi
()
.
setMetersCount
(
metersCount
)
let
pacingEvent
=
swiftApi
.
HealthEventModel
()
pacingEvent
.
_meters
=
metersCount
SwiftEventBus
.
post
(
"meters_sent"
,
sender
:
pacingEvent
)
pacingEvent
.
_meters
=
metersCount
+
oldDayMeters
//
SwiftEventBus.post("meters_sent", sender: pacingEvent)
print
(
"=== MetersCount ==="
)
print
(
metersCount
)
print
(
"=== Widget MetersCount ==="
)
print
(
metersCount
+
oldDayMeters
)
let
newStepsWebview
=
(
steps
as!
Int
)
-
GlobalVariables
.
savedStepsWebview
swiftApi
()
.
setStepsWebview
(
newStepsWebview
)
let
newMetersWebview
=
Double
(
newStepsWebview
)
*
0.762
...
...
@@ -186,6 +201,11 @@ public class swiftApi {
getStepsCallback
(
steps
as?
Int
??
0
)
}
}
}
}
}
}
...
...
@@ -5746,4 +5766,11 @@ public class swiftApi {
}
public
func
logoutUser
()
->
Void
{
if
(
GlobalVariables
.
trackingStepsEnabled
==
true
)
{
swiftApi
()
.
stopTrackingSteps
()
}
}
}
...
...
Please
register
or
login
to post a comment