@@ -34,6 +34,8 @@ type Msg
34 | ShowCipherPage Bridge.Sub_LoadCipher
34 | ShowCipherPage Bridge.Sub_LoadCipher
35 | RequestCipher CipherId
35 | RequestCipher CipherId
38+ | ChangeFilter CipherFilter
39type alias CipherId =
41type alias CipherId =
@@ -43,6 +45,9 @@ type alias CipherId =
43type alias Model =
45type alias Model =
44 { notifications : List Notification.Config
46 { notifications : List Notification.Config
45 , pageStack : Navigation.PageStack PageModel
47 , pageStack : Navigation.PageStack PageModel
49+ , email : Maybe String
50+ , filter : CipherFilter
@@ -132,27 +137,77 @@ subscriptions _ =
142+ | Specific Bridge.Sub_LoadCiphers_cipherType
145+applyCipherFilter : CipherFilter -> Bridge.Sub_LoadCiphers_List -> Bridge.Sub_LoadCiphers_List
146+applyCipherFilter filter list =
152+ list |> List.filter (.cipherType >> (==) t)
135init : ( Model, Cmd Msg )
155init : ( Model, Cmd Msg )
137 ( { notifications = []
157 ( { notifications = []
138 , pageStack = Nonempty.singleton LoadingPage
158 , pageStack = Nonempty.singleton LoadingPage
161+ , filter = AnyCipher
140 , FFI.sendBridge Bridge.Init
163 , FFI.sendBridge Bridge.Init
167+pageShouldShowMenu : PageModel -> Bool
168+pageShouldShowMenu page =
144view : Model -> Html Msg
177view : Model -> Html Msg
145view model =
178view model =
146− Navigation.showNavigationView { popStack = PopView }
179+ Navigation.showNavigationView
180+ { popStack = PopView
181+ , toggleMenu = ToggleMenu
147 model.pageStack
183 model.pageStack
148 (\page ->
184 (\page ->
150 ( title, body ) =
186 ( title, body ) =
189+ CiphersModel { m | ciphers = m.ciphers |> applyCipherFilter model.filter }
151− showPage page
193+ showPage page
153− ( title
195+ { title = title
154− , maybeList (List.head model.notifications) (Notification.notification CloseNotification) ++ body
196+ , body = maybeList (List.head model.notifications) (Notification.notification CloseNotification) ++ body
155− )
197+ , menuConfig =
198+ if pageShouldShowMenu page && model.menuShown then
200+ { title = Maybe.withDefault "" model.email
202+ [ { icons = "", name = "", trigger = ChangeFilter AnyCipher }
204+ , close = ToggleMenu
209+ , menuPossible = pageShouldShowMenu page
@@ -302,6 +357,9 @@ update msg model =
302 , Cmd.none
357 , Cmd.none
361+ ( { model | menuShown = not model.menuShown }, Cmd.none )
306loginCallbacks : Login.Callbacks Msg
364loginCallbacks : Login.Callbacks Msg
307loginCallbacks =
365loginCallbacks =