Fix Elm warnings

pull/1/head
Bram van den Heuvel 2023-02-17 11:20:54 +01:00
parent 885da04383
commit 3bdcba13bc
3 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,5 @@
module Internal.Values.Credentials exposing (..)
import Dict exposing (Dict)
import Internal.Tools.Hashdict as Hashdict exposing (Hashdict)
import Internal.Values.Room as Room exposing (Room)
@ -14,6 +13,7 @@ type AccessToken
| NoAccess
| UsernameAndPassword { username : String, password : String, accessToken : Maybe String }
defaultCredentials : String -> Credentials
defaultCredentials homeserver =
Credentials
@ -22,18 +22,21 @@ defaultCredentials homeserver =
, rooms = Hashdict.empty Room.roomId
}
fromAccessToken : { accessToken : String, homeserver : String } -> Credentials
fromAccessToken { accessToken, homeserver } =
case defaultCredentials homeserver of
Credentials c ->
Credentials { c | access = AccessToken accessToken }
fromLoginCredentials : { username : String, password : String, homeserver : String } -> Credentials
fromLoginCredentials { username, password, homeserver } =
case defaultCredentials homeserver of
Credentials c ->
Credentials { c | access = UsernameAndPassword { username = username, password = password, accessToken = Nothing } }
getRoomById : String -> Credentials -> Maybe Room
getRoomById roomId (Credentials cred) =
Hashdict.get roomId cred.rooms

View File

@ -1,10 +1,9 @@
module Internal.Values.Room exposing (..)
import Dict exposing (Dict)
import Internal.Tools.Fold as Fold
import Internal.Tools.SpecEnums exposing (SessionDescriptionType(..))
import Internal.Values.Event as Event exposing (BlindEvent, Event)
import Internal.Values.StateManager as StateManager exposing (StateManager)
import Internal.Values.StateManager exposing (StateManager)
import Internal.Values.Timeline as Timeline exposing (Timeline)
import Json.Encode as E

View File

@ -6,7 +6,6 @@ module Internal.Values.Timeline exposing (..)
import Internal.Config.Leaking as Leaking
import Internal.Tools.Fold as Fold
import Internal.Values.Event as Event exposing (Event)
import Internal.Values.Room exposing (stateAtEvent)
import Internal.Values.StateManager as StateManager exposing (StateManager)