Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TousAntiCovid sources
TousAntiCovid Android
Commits
67199bfb
Commit
67199bfb
authored
Jun 15, 2020
by
stopcovid@lunabee.com
Browse files
Update to 1.0.4
parent
bfed9529
Changes
3
Hide whitespace changes
Inline
Side-by-side
framework/src/main/java/com/lunabeestudio/framework/ble/service/RobertProximityService.kt
View file @
67199bfb
...
...
@@ -134,6 +134,7 @@ abstract class RobertProximityService : ProximityNotificationService() {
notifyProximityPayloadUpdated
()
}
}
catch
(
e
:
Exception
)
{
Timber
.
e
(
e
)
if
(
e
is
RobertException
)
{
onError
(
e
)
}
else
{
...
...
stopcovid/build.gradle
View file @
67199bfb
...
...
@@ -42,8 +42,8 @@ android {
applicationId
"fr.gouv.android.stopcovid"
minSdkVersion
21
targetSdkVersion
29
versionCode
3
5
versionName
"1.0.
3
"
versionCode
3
6
versionName
"1.0.
4
"
testInstrumentationRunner
=
'com.lunabeestudio.stopcovid.TestRunner'
...
...
stopcovid/src/main/java/com/lunabeestudio/stopcovid/service/ProximityService.kt
View file @
67199bfb
...
...
@@ -25,20 +25,12 @@ import com.lunabeestudio.framework.ble.service.RobertProximityService
import
com.lunabeestudio.robert.RobertApplication
import
com.lunabeestudio.robert.RobertManager
import
com.lunabeestudio.robert.model.RobertException
import
com.lunabeestudio.stopcovid.StopCovid
import
com.lunabeestudio.stopcovid.activity.MainActivity
import
com.lunabeestudio.stopcovid.coreui.R
import
com.lunabeestudio.stopcovid.coreui.UiConstants
import
com.lunabeestudio.stopcovid.coreui.manager.StringsManager
import
com.lunabeestudio.stopcovid.extension.robertManager
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.cancel
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.isActive
import
kotlinx.coroutines.launch
import
timber.log.Timber
import
java.util.concurrent.TimeUnit
class
ProximityService
:
RobertProximityService
()
{
...
...
@@ -55,8 +47,6 @@ class ProximityService : RobertProximityService() {
StringsManager
.
getStrings
()
}
private
var
statusUpdateSchedulerScope
:
CoroutineScope
=
CoroutineScope
(
Dispatchers
.
IO
)
override
val
robertManager
:
RobertManager
by
lazy
{
robertManager
()
}
...
...
@@ -96,28 +86,11 @@ class ProximityService : RobertProximityService() {
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
scheduleNextStatusUpdate
()
return
START_STICKY
}
private
fun
scheduleNextStatusUpdate
()
{
statusUpdateSchedulerScope
.
launch
{
val
nextStatusUpdateDelay
=
TimeUnit
.
HOURS
.
toMillis
(
1L
)
Timber
.
d
(
"Next status update in ${nextStatusUpdateDelay}ms"
)
delay
(
nextStatusUpdateDelay
)
if
(
isActive
)
{
(
applicationContext
as
StopCovid
).
refreshStatusIfNeeded
()
}
}.
invokeOnCompletion
{
if
(
isActive
)
{
scheduleNextStatusUpdate
()
}
}
}
override
fun
onDestroy
()
{
robertManager
.
deactivateProximity
(
applicationContext
as
RobertApplication
)
statusUpdateSchedulerScope
.
cancel
()
super
.
onDestroy
()
}
...
...
@@ -127,7 +100,6 @@ class ProximityService : RobertProximityService() {
robertManager
.
deactivateProximity
(
applicationContext
as
RobertApplication
)
lastError
=
error
onError
?.
invoke
(
error
)
statusUpdateSchedulerScope
.
cancel
()
}
fun
consumeLastError
():
RobertException
?
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment