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-09 13:54:07 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b06912d53480b06dfc883dfbb848d04cb3672842
b06912d5
1 parent
93bf14c5
fix pacing already enabled
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
b06912d
...
...
@@ -206,7 +206,10 @@ var timer2: DispatchSourceTimer?
let
pacingEvent
=
swiftApi
.
WarplyPacingEventModel
()
pacingEvent
.
_isVisible
=
true
SwiftEventBus
.
post
(
"pacing"
,
sender
:
pacingEvent
)
if
(
swiftApi
()
.
getTrackingStepsEnabled
()
==
false
)
{
self
.
startTrackingSteps
()
}
}
else
if
(
eventArray
[
1
]
==
"steps"
&&
eventArray
[
2
]
==
"shortcutDisabled"
)
{
let
pacingEvent
=
swiftApi
.
WarplyPacingEventModel
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
b06912d
...
...
@@ -27,6 +27,7 @@ public struct GlobalVariables {
static
var
savedStepsWebview
:
Int
=
0
static
var
metersWebview
:
Double
=
0.0
static
var
merchantList
:
Array
<
swiftApi
.
MerchantModel
>
=
[]
static
var
trackingStepsEnabled
:
Bool
=
false
}
var
timer
:
DispatchSourceTimer
?
...
...
@@ -85,9 +86,20 @@ public class swiftApi {
GlobalVariables
.
metersWebview
=
newValue
}
public
func
getTrackingStepsEnabled
()
->
Bool
{
return
GlobalVariables
.
trackingStepsEnabled
}
public
func
setTrackingStepsEnabled
(
_
newValue
:
Bool
)
->
Void
{
GlobalVariables
.
trackingStepsEnabled
=
newValue
}
public
func
startTrackingSteps
(
_
getStepsCallback
:
@escaping
(
_
steps
:
Int
)
->
Void
)
->
Void
{
if
(
GlobalVariables
.
trackingStepsEnabled
==
false
)
{
GlobalVariables
.
trackingStepsEnabled
=
true
// Check if there are persistedSteps from previous app kill and save them
let
persistedSteps
=
swiftApi
()
.
getSteps
()
if
(
persistedSteps
>
0
)
{
...
...
@@ -104,6 +116,7 @@ public class swiftApi {
if
(
responseData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
if
(
responseData
?
.
getStatus
==
1
)
{
GlobalVariables
.
savedSteps
=
0
}
}
}
else
{
...
...
@@ -150,7 +163,7 @@ public class swiftApi {
getStepsCallback
(
steps
as?
Int
??
0
)
}
}
}
public
func
stopTrackingSteps
()
->
Void
{
...
...
@@ -159,6 +172,8 @@ public class swiftApi {
stopTimer
()
GlobalVariables
.
trackingStepsEnabled
=
false
GlobalVariables
.
savedSteps
=
0
swiftApi
()
.
setMetersCount
(
0.0
)
...
...
Please
register
or
login
to post a comment