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
Matthew Finkel
fenix
Commits
3c848074
Commit
3c848074
authored
May 23, 2019
by
Jonathan Almeida
Committed by
Stefan Arentz
May 23, 2019
Browse files
Add connect another device dialog (#2803)
parent
2ad3a72f
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/share/AccountDevicesShareView.kt
View file @
3c848074
...
...
@@ -65,7 +65,6 @@ class AccountDevicesShareAdapter(
if
(
shareableDevices
.
isEmpty
())
{
list
.
add
(
SyncShareOption
.
AddNewDevice
)
actionEmitter
.
onNext
(
ShareAction
.
HideSendTab
)
}
val
shareOptions
=
shareableDevices
.
map
{
...
...
app/src/main/java/org/mozilla/fenix/share/ShareComponent.kt
View file @
3c848074
...
...
@@ -23,7 +23,6 @@ sealed class ShareAction : Action {
object
Close
:
ShareAction
()
object
SignInClicked
:
ShareAction
()
object
AddNewDeviceClicked
:
ShareAction
()
object
HideSendTab
:
ShareAction
()
data class
ShareDeviceClicked
(
val
device
:
Device
)
:
ShareAction
()
data class
SendAllClicked
(
val
devices
:
List
<
Device
>)
:
ShareAction
()
data class
ShareAppClicked
(
val
packageName
:
String
)
:
ShareAction
()
...
...
app/src/main/java/org/mozilla/fenix/share/ShareFragment.kt
View file @
3c848074
...
...
@@ -9,12 +9,13 @@ import android.content.Intent.ACTION_SEND
import
android.content.Intent.EXTRA_TEXT
import
android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import
android.os.Bundle
import
android.view.ContextThemeWrapper
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.appcompat.app.AlertDialog
import
androidx.appcompat.app.AppCompatDialogFragment
import
androidx.navigation.fragment.NavHostFragment.findNavController
import
kotlinx.android.synthetic.main.component_share.*
import
kotlinx.android.synthetic.main.fragment_share.view.*
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
...
...
@@ -81,12 +82,19 @@ class ShareFragment : AppCompatDialogFragment(), CoroutineScope {
ShareAction
.
SignInClicked
->
{
val
directions
=
ShareFragmentDirections
.
actionShareFragmentToTurnOnSyncFragment
()
findNavController
(
this
@ShareFragment
).
navigate
(
directions
)
dismiss
()
}
ShareAction
.
AddNewDeviceClicked
->
{
requireComponents
.
useCases
.
tabsUseCases
.
addTab
.
invoke
(
ADD_NEW_DEVICES_URL
,
true
)
}
ShareAction
.
HideSendTab
->
{
send_tab_group
.
visibility
=
View
.
GONE
AlertDialog
.
Builder
(
ContextThemeWrapper
(
context
,
R
.
style
.
DialogStyle
)
).
apply
{
setMessage
(
R
.
string
.
sync_connect_device_dialog
)
setPositiveButton
(
R
.
string
.
sync_confirmation_button
)
{
dialog
,
_
->
dialog
.
cancel
()
}
create
()
}.
show
()
}
is
ShareAction
.
ShareDeviceClicked
->
{
val
authAccount
=
requireComponents
.
backgroundServices
.
accountManager
.
authenticatedAccount
()
...
...
@@ -96,6 +104,7 @@ class ShareFragment : AppCompatDialogFragment(), CoroutineScope {
DeviceEventOutgoing
.
SendTab
(
title
,
url
)
)
}
dismiss
()
}
is
ShareAction
.
SendAllClicked
->
{
val
authAccount
=
requireComponents
.
backgroundServices
.
accountManager
.
authenticatedAccount
()
...
...
@@ -107,6 +116,7 @@ class ShareFragment : AppCompatDialogFragment(), CoroutineScope {
)
}
}
dismiss
()
}
is
ShareAction
.
ShareAppClicked
->
{
val
intent
=
Intent
(
ACTION_SEND
).
apply
{
...
...
@@ -116,14 +126,9 @@ class ShareFragment : AppCompatDialogFragment(), CoroutineScope {
`package`
=
it
.
packageName
}
startActivity
(
intent
)
dismiss
()
}
}
dismiss
()
}
}
companion
object
{
// TODO Replace this link with the correct one when provided.
const
val
ADD_NEW_DEVICES_URL
=
"https://accounts.firefox.com/connect_another_device"
}
}
app/src/main/res/values/strings.xml
View file @
3c848074
...
...
@@ -508,6 +508,10 @@
<string
name=
"sync_offline"
>
Offline
</string>
<!-- An option to connect additional devices -->
<string
name=
"sync_connect_device"
>
Connect another device
</string>
<!-- The dialog text shown when additional devices are not available -->
<string
name=
"sync_connect_device_dialog"
>
To send a tab, sign in to Firefox on at least one other device.
</string>
<!-- Confirmation dialog button -->
<string
name=
"sync_confirmation_button"
>
Got it
</string>
<!-- Notifications -->
<!-- Text shown in snackbar when user deletes a collection -->
...
...
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