Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
fenix
Commits
e3df9f09
Unverified
Commit
e3df9f09
authored
Feb 07, 2020
by
Gabriel Luong
Committed by
GitHub
Feb 07, 2020
Browse files
For #8167: Don't show the add-ons permission dialog if installation is in progress (#8230)
parent
12091467
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt
View file @
e3df9f09
...
...
@@ -30,7 +30,12 @@ import org.mozilla.fenix.ext.showToolbar
* Fragment use for managing add-ons.
*/
@Suppress
(
"TooManyFunctions"
)
class
AddonsManagementFragment
:
Fragment
(
R
.
layout
.
fragment_add_ons_management
),
AddonsManagerAdapterDelegate
{
class
AddonsManagementFragment
:
Fragment
(
R
.
layout
.
fragment_add_ons_management
),
AddonsManagerAdapterDelegate
{
/**
* Whether or not an add-on installation is in progress.
*/
private
var
isInstallationInProgress
=
false
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
...
...
@@ -85,7 +90,10 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management),
}
}
catch
(
e
:
AddonManagerException
)
{
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
showSnackBar
(
view
,
getString
(
R
.
string
.
mozac_feature_addons_failed_to_query_add_ons
))
showSnackBar
(
view
,
getString
(
R
.
string
.
mozac_feature_addons_failed_to_query_add_ons
)
)
view
.
add_ons_progress_bar
.
isVisible
=
false
view
.
add_ons_empty_message
.
isVisible
=
true
}
...
...
@@ -126,7 +134,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management),
}
private
fun
showPermissionDialog
(
addon
:
Addon
)
{
if
(!
hasExistingPermissionDialogFragment
())
{
if
(
!
isInstallationInProgress
&&
!
hasExistingPermissionDialogFragment
())
{
val
dialog
=
PermissionsDialogFragment
.
newInstance
(
addon
=
addon
,
onPositiveButtonClicked
=
onPositiveButtonClicked
...
...
@@ -137,6 +145,8 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management),
private
val
onPositiveButtonClicked
:
((
Addon
)
->
Unit
)
=
{
addon
->
addonProgressOverlay
.
visibility
=
View
.
VISIBLE
isInstallationInProgress
=
true
requireContext
().
components
.
addonManager
.
installAddon
(
addon
,
onSuccess
=
{
...
...
@@ -150,12 +160,20 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management),
)
bindRecyclerView
(
view
)
addonProgressOverlay
?.
visibility
=
View
.
GONE
isInstallationInProgress
=
false
}
},
onError
=
{
_
,
_
->
this
@AddonsManagementFragment
.
view
?.
let
{
view
->
showSnackBar
(
view
,
getString
(
R
.
string
.
mozac_feature_addons_failed_to_install
,
addon
.
translatedName
))
showSnackBar
(
view
,
getString
(
R
.
string
.
mozac_feature_addons_failed_to_install
,
addon
.
translatedName
)
)
addonProgressOverlay
?.
visibility
=
View
.
GONE
isInstallationInProgress
=
false
}
}
)
...
...
Write
Preview
Supports
Markdown
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