2018-12-07 23:03:16 -08:00
|
|
|
import Browser exposing (application)
|
|
|
|
import Browser.Navigation as Nav
|
2018-12-08 13:49:30 -08:00
|
|
|
import Scylla.Sync exposing (..)
|
|
|
|
import Scylla.Model exposing (..)
|
|
|
|
import Scylla.Http exposing (..)
|
2018-12-07 23:03:16 -08:00
|
|
|
import Url exposing (Url)
|
2018-12-08 13:49:30 -08:00
|
|
|
import Html exposing (div, text)
|
2018-12-07 23:03:16 -08:00
|
|
|
|
|
|
|
type alias Flags =
|
|
|
|
{ token : Maybe String
|
|
|
|
}
|
|
|
|
|
|
|
|
init : Flags -> Url -> Nav.Key -> (Model, Cmd Msg)
|
|
|
|
init flags url key =
|
|
|
|
let
|
|
|
|
model =
|
|
|
|
{ key = key
|
|
|
|
, token = flags.token
|
2018-12-08 13:49:30 -08:00
|
|
|
, apiUrl = "https://matrix.org"
|
2018-12-07 23:03:16 -08:00
|
|
|
}
|
|
|
|
cmd = case flags.token of
|
|
|
|
Just _ -> Cmd.none
|
|
|
|
Nothing -> Cmd.none
|
|
|
|
in
|
|
|
|
(model, cmd)
|
|
|
|
|
|
|
|
view : Model -> Browser.Document Msg
|
|
|
|
view m =
|
|
|
|
{ title = "Scylla"
|
|
|
|
, body = []
|
|
|
|
}
|
|
|
|
|
|
|
|
update : Msg -> Model -> (Model, Cmd Msg)
|
|
|
|
update msg model = (model, Cmd.none)
|
|
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
|
|
subscriptions m = Sub.none
|
|
|
|
|
|
|
|
onUrlRequest : Browser.UrlRequest -> Msg
|
|
|
|
onUrlRequest = TryUrl
|
|
|
|
|
|
|
|
onUrlChange : Url -> Msg
|
|
|
|
onUrlChange = ChangeUrl
|
|
|
|
|
|
|
|
main = application
|
|
|
|
{ init = init
|
|
|
|
, view = view
|
|
|
|
, update = update
|
|
|
|
, subscriptions = subscriptions
|
|
|
|
, onUrlRequest = onUrlRequest
|
|
|
|
, onUrlChange = onUrlChange
|
|
|
|
}
|