From 3bdcba13bce9f5551c5e0bb1c5f2722e3d9b6b89 Mon Sep 17 00:00:00 2001 From: Bram van den Heuvel Date: Fri, 17 Feb 2023 11:20:54 +0100 Subject: [PATCH] Fix Elm warnings --- src/Internal/Values/Credentials.elm | 5 ++++- src/Internal/Values/Room.elm | 3 +-- src/Internal/Values/Timeline.elm | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Internal/Values/Credentials.elm b/src/Internal/Values/Credentials.elm index c145f58..b78827a 100644 --- a/src/Internal/Values/Credentials.elm +++ b/src/Internal/Values/Credentials.elm @@ -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 diff --git a/src/Internal/Values/Room.elm b/src/Internal/Values/Room.elm index c83a91f..6948715 100644 --- a/src/Internal/Values/Room.elm +++ b/src/Internal/Values/Room.elm @@ -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 diff --git a/src/Internal/Values/Timeline.elm b/src/Internal/Values/Timeline.elm index cdbdb72..05a5b68 100644 --- a/src/Internal/Values/Timeline.elm +++ b/src/Internal/Values/Timeline.elm @@ -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)