2017-05-07 12:31:51 +00:00
|
|
|
module Init exposing (init)
|
|
|
|
|
|
|
|
import Command
|
|
|
|
import Navigation
|
|
|
|
import Types exposing (..)
|
2017-05-29 14:28:01 +00:00
|
|
|
import Update.AccountInfo
|
2017-05-07 12:31:51 +00:00
|
|
|
import Update.Draft
|
2017-05-29 14:28:01 +00:00
|
|
|
import Update.Route
|
2017-05-07 12:31:51 +00:00
|
|
|
import Update.Timeline
|
|
|
|
import Util
|
|
|
|
|
|
|
|
|
|
|
|
init : Flags -> Navigation.Location -> ( Model, Cmd Msg )
|
2017-05-09 16:43:12 +00:00
|
|
|
init { registration, clients } location =
|
2017-05-29 14:28:01 +00:00
|
|
|
let
|
|
|
|
( model, commands ) =
|
|
|
|
Update.Route.update
|
|
|
|
{ server = ""
|
|
|
|
, currentTime = 0
|
|
|
|
, registration = registration
|
|
|
|
, clients = clients
|
|
|
|
, homeTimeline = Update.Timeline.empty "home-timeline"
|
|
|
|
, localTimeline = Update.Timeline.empty "local-timeline"
|
|
|
|
, globalTimeline = Update.Timeline.empty "global-timeline"
|
|
|
|
, favoriteTimeline = Update.Timeline.empty "favorite-timeline"
|
|
|
|
, hashtagTimeline = Update.Timeline.empty "hashtag-timeline"
|
|
|
|
, mutes = Update.Timeline.empty "mutes-timeline"
|
|
|
|
, blocks = Update.Timeline.empty "blocks-timeline"
|
|
|
|
, accountInfo = Update.AccountInfo.empty
|
|
|
|
, notifications = Update.Timeline.empty "notifications"
|
|
|
|
, draft = Update.Draft.empty
|
|
|
|
, errors = []
|
|
|
|
, location = location
|
|
|
|
, viewer = Nothing
|
|
|
|
, currentView = LocalTimelineView
|
|
|
|
, currentUser = Nothing
|
|
|
|
, notificationFilter = NotificationAll
|
|
|
|
, confirm = Nothing
|
2017-05-30 22:27:30 +00:00
|
|
|
, search = Search "" Nothing
|
2017-05-29 14:28:01 +00:00
|
|
|
}
|
|
|
|
in
|
|
|
|
model
|
|
|
|
! [ commands, Command.initCommands registration (List.head clients) (Util.extractAuthCode location) ]
|