Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cwa App Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Foertsch
Cwa App Android
Commits
2db640ba
Unverified
Commit
2db640ba
authored
4 years ago
by
harambasicluka
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Tracing start/stop fix due to missing handling inside tracing (#99)
Co-authored-by:
Jakob Möller
<
jakob.moeller@sap.com
>
parent
d965427f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt
+6
-22
6 additions, 22 deletions
.../rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt
with
6 additions
and
22 deletions
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt
+
6
−
22
View file @
2db640ba
...
@@ -89,27 +89,16 @@ class SettingsTracingFragment : BaseFragment(),
...
@@ -89,27 +89,16 @@ class SettingsTracingFragment : BaseFragment(),
exception
?.
localizedMessage
?:
"Unknown Error"
,
exception
?.
localizedMessage
?:
"Unknown Error"
,
Toast
.
LENGTH_SHORT
Toast
.
LENGTH_SHORT
).
show
()
).
show
()
tracingViewModel
.
refreshIsTracingEnabled
()
}
}
private
fun
setButtonOnClickListener
()
{
private
fun
setButtonOnClickListener
()
{
val
switch
=
binding
.
settingsTracingSwitchRow
.
settingsSwitchRowSwitch
val
switch
=
binding
.
settingsTracingSwitchRow
.
settingsSwitchRowSwitch
val
row
=
binding
.
settingsTracingSwitchRow
.
settingsSwitchRow
internalExposureNotificationPermissionHelper
=
internalExposureNotificationPermissionHelper
=
InternalExposureNotificationPermissionHelper
(
this
,
this
)
InternalExposureNotificationPermissionHelper
(
this
,
this
)
switch
.
setOnCheckedChangeListener
{
_
,
_
->
switch
.
setOnCheckedChangeListener
{
_
,
_
->
// android calls this listener also on start, so it has to be verified if the user pressed the switch
// android calls this listener also on start, so it has to be verified if the user pressed the switch
if
(
switch
.
isPressed
)
{
if
(
switch
.
isPressed
)
{
ViewBlocker
.
runAndBlockInteraction
(
arrayOf
(
row
,
switch
))
{
ViewBlocker
.
runAndBlockInteraction
(
arrayOf
(
switch
))
{
startStopTracing
()
}
}
}
row
.
setOnClickListener
{
ViewBlocker
.
runAndBlockInteraction
(
arrayOf
(
row
,
switch
))
{
// only if the switch is enabled the user is allowed to toggle it, this implements the
// same behaviour if he clicks on the row
if
(
switch
.
isEnabled
)
{
startStopTracing
()
startStopTracing
()
}
}
}
}
...
@@ -126,10 +115,9 @@ class SettingsTracingFragment : BaseFragment(),
...
@@ -126,10 +115,9 @@ class SettingsTracingFragment : BaseFragment(),
}
}
private
fun
startStopTracing
()
{
private
fun
startStopTracing
()
{
if
(
tracingViewModel
.
isTracingEnabled
.
value
!=
null
)
{
// if tracing is enabled when listener is activated it should be disabled
// if tracing is enabled when listener is activated it should be disabled
lifecycleScope
.
launch
{
if
(
tracingViewModel
.
isTracingEnabled
.
value
!!
)
{
if
(
InternalExposureNotificationClient
.
asyncIsEnabled
())
{
lifecycleScope
.
launch
{
try
{
try
{
Toast
.
makeText
(
Toast
.
makeText
(
requireContext
(),
requireContext
(),
...
@@ -137,24 +125,20 @@ class SettingsTracingFragment : BaseFragment(),
...
@@ -137,24 +125,20 @@ class SettingsTracingFragment : BaseFragment(),
Toast
.
LENGTH_SHORT
Toast
.
LENGTH_SHORT
)
)
.
show
()
.
show
()
tracingViewModel
.
refreshIsTracingEnabled
()
InternalExposureNotificationClient
.
asyncStop
()
}
catch
(
exception
:
Exception
)
{
}
catch
(
exception
:
Exception
)
{
exception
.
report
(
exception
.
report
(
ExceptionCategory
.
EXPOSURENOTIFICATION
,
ExceptionCategory
.
EXPOSURENOTIFICATION
,
TAG
,
TAG
,
null
null
)
)
tracingViewModel
.
refreshIsTracingEnabled
()
}
}
InternalExposureNotificationClient
.
asyncStop
()
tracingViewModel
.
refreshIsTracingEnabled
()
tracingViewModel
.
refreshIsTracingEnabled
()
BackgroundWorkScheduler
.
stopWorkScheduler
()
BackgroundWorkScheduler
.
stopWorkScheduler
()
}
}
else
{
}
else
{
internalExposureNotificationPermissionHelper
.
requestPermissionToStartTracing
()
internalExposureNotificationPermissionHelper
.
requestPermissionToStartTracing
()
}
}
}
}
tracingViewModel
.
refreshIsTracingEnabled
()
settingsViewModel
.
refreshBluetoothEnabled
()
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment