1module UI.Syncing.Common exposing (..)
2
3import Chunky exposing (..)
4import Html
5import Svg
6import UI.Svg.Elements
7import UI.Syncing.Types exposing (..)
8import UI.Types exposing (Msg(..))
9import User.Layer exposing (Method, dropboxMethod, remoteStorageMethod)
10
11
12
13-- 🚀
14
15
16startDropbox : Msg
17startDropbox =
18 SyncingMsg (TriggerExternalAuth dropboxMethod "")
19
20
21startIpfs : Msg
22startIpfs =
23 SyncingMsg PingIpfs
24
25
26startRemoteStorage : Msg
27startRemoteStorage =
28 { icon = \size _ -> Svg.map never (UI.Svg.Elements.remoteStorageLogo size)
29 , placeholder = "example@5apps.com"
30 , question =
31 { question =
32 "What's your user address?"
33 , info =
34 [ Html.text "The format is "
35 , inline
36 []
37 [ Html.text "username@server.domain" ]
38 ]
39 }
40 , value = ""
41 }
42 |> AskForInput remoteStorageMethod
43 |> SyncingMsg
44
45
46
47-- 🛠
48
49
50extractMethod : State -> Maybe Method
51extractMethod state =
52 case state of
53 Synced method ->
54 Just method
55
56 Syncing { method } ->
57 Just method
58
59 InputScreen method _ ->
60 Just method
61
62 NewEncryptionKeyScreen method _ ->
63 Just method
64
65 UpdateEncryptionKeyScreen method _ ->
66 Just method
67
68 NotSynced ->
69 Nothing