Merge branch 'develop' into 4-transfer-api
commit
8a3b7efbf6
|
@ -18,8 +18,9 @@ supported for which spec versions.
|
||||||
- ✅ **One way to do things** instead of having multiple functions that are
|
- ✅ **One way to do things** instead of having multiple functions that are
|
||||||
considered deprecated.
|
considered deprecated.
|
||||||
|
|
||||||
Follow us on [Mastodon](https://social.noordstar.me/@elm_matrix_sdk) at
|
Follow us on [Mastodon](https://social.noordstar.me/@elm_matrix_sdk) or join the
|
||||||
@elm_matrix_sdk@social.noordstar.me to stay up-to-date on the latest changes.
|
conversation on [Matrix](https://matrix.to/#/#elm-sdk:matrix.org) to stay
|
||||||
|
up-to-date on the latest changes.
|
||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
|
|
||||||
|
|
2
elm.json
2
elm.json
|
@ -3,7 +3,7 @@
|
||||||
"name": "noordstar/elm-matrix-sdk-beta",
|
"name": "noordstar/elm-matrix-sdk-beta",
|
||||||
"summary": "Matrix SDK for instant communication. Unstable beta version for testing only.",
|
"summary": "Matrix SDK for instant communication. Unstable beta version for testing only.",
|
||||||
"license": "EUPL-1.1",
|
"license": "EUPL-1.1",
|
||||||
"version": "3.2.0",
|
"version": "3.3.1",
|
||||||
"exposed-modules": [
|
"exposed-modules": [
|
||||||
"Matrix",
|
"Matrix",
|
||||||
"Matrix.Event",
|
"Matrix.Event",
|
||||||
|
|
|
@ -36,9 +36,10 @@ import Internal.Api.SendMessageEvent.Api
|
||||||
import Internal.Api.Sync.Api
|
import Internal.Api.Sync.Api
|
||||||
import Internal.Api.Versions.Api
|
import Internal.Api.Versions.Api
|
||||||
import Internal.Config.Log exposing (Log, log)
|
import Internal.Config.Log exposing (Log, log)
|
||||||
|
import Internal.Config.Text as Text
|
||||||
import Internal.Tools.Json as Json
|
import Internal.Tools.Json as Json
|
||||||
import Internal.Values.Context as Context exposing (APIContext)
|
import Internal.Values.Context as Context exposing (APIContext)
|
||||||
import Internal.Values.Envelope exposing (EnvelopeUpdate(..))
|
import Internal.Values.Envelope as E exposing (EnvelopeUpdate(..))
|
||||||
import Internal.Values.Room exposing (RoomUpdate(..))
|
import Internal.Values.Room exposing (RoomUpdate(..))
|
||||||
import Internal.Values.Vault exposing (VaultUpdate(..))
|
import Internal.Values.Vault exposing (VaultUpdate(..))
|
||||||
import Task
|
import Task
|
||||||
|
@ -112,7 +113,20 @@ getBaseUrl c =
|
||||||
Nothing ->
|
Nothing ->
|
||||||
Internal.Api.BaseUrl.Api.baseUrl
|
Internal.Api.BaseUrl.Api.baseUrl
|
||||||
{ url = Context.fromApiFormat c |> .serverName }
|
{ url = Context.fromApiFormat c |> .serverName }
|
||||||
c
|
|> C.catchWith
|
||||||
|
(\_ ->
|
||||||
|
let
|
||||||
|
url : String
|
||||||
|
url =
|
||||||
|
Context.fromApiFormat c
|
||||||
|
|> .serverName
|
||||||
|
in
|
||||||
|
{ contextChange = Context.setBaseUrl url
|
||||||
|
, logs = [ log.warn (Text.logs.baseUrlFailed url) ]
|
||||||
|
, messages = [ E.SetBaseUrl url ]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|> (|>) c
|
||||||
|
|
||||||
|
|
||||||
{-| Get the current timestamp
|
{-| Get the current timestamp
|
||||||
|
|
|
@ -29,7 +29,7 @@ will assume until overriden by the user.
|
||||||
-}
|
-}
|
||||||
currentVersion : String
|
currentVersion : String
|
||||||
currentVersion =
|
currentVersion =
|
||||||
"beta 3.2.0"
|
"beta 3.3.1"
|
||||||
|
|
||||||
|
|
||||||
{-| The default device name that is being communicated with the Matrix API.
|
{-| The default device name that is being communicated with the Matrix API.
|
||||||
|
|
|
@ -636,7 +636,8 @@ happened. Most of these unexpected results, are taken account of by the Elm SDK,
|
||||||
but logged so that the programmer can do something about it.
|
but logged so that the programmer can do something about it.
|
||||||
-}
|
-}
|
||||||
logs :
|
logs :
|
||||||
{ baseUrlFound : String -> String -> String
|
{ baseUrlFailed : String -> String
|
||||||
|
, baseUrlFound : String -> String -> String
|
||||||
, getEventId : String -> String
|
, getEventId : String -> String
|
||||||
, getNow : Int -> String
|
, getNow : Int -> String
|
||||||
, httpRequest : String -> String -> String
|
, httpRequest : String -> String -> String
|
||||||
|
@ -649,7 +650,9 @@ logs :
|
||||||
, syncAccountDataFound : Int -> String
|
, syncAccountDataFound : Int -> String
|
||||||
}
|
}
|
||||||
logs =
|
logs =
|
||||||
{ baseUrlFound =
|
{ baseUrlFailed =
|
||||||
|
(++) "Failed to find .well-known, using default server address: "
|
||||||
|
, baseUrlFound =
|
||||||
\url baseUrl ->
|
\url baseUrl ->
|
||||||
String.concat [ "Found baseURL of ", url, " at address ", baseUrl ]
|
String.concat [ "Found baseURL of ", url, " at address ", baseUrl ]
|
||||||
, getEventId = (++) "Received event with id = "
|
, getEventId = (++) "Received event with id = "
|
||||||
|
|
|
@ -142,22 +142,16 @@ apiContext =
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
json : Test
|
|
||||||
json =
|
-- json : Test
|
||||||
describe "JSON encode + JSON decode"
|
-- json =
|
||||||
[ test "Empty is {}"
|
-- describe "JSON encode + JSON decode"
|
||||||
(Context.init ""
|
-- [ fuzz fuzzer
|
||||||
|> Context.encode
|
-- "JSON recode"
|
||||||
|> E.encode 0
|
-- (\context ->
|
||||||
|> Expect.equal "{}"
|
-- context
|
||||||
|> always
|
-- |> Context.encode
|
||||||
)
|
-- |> D.decodeValue Context.decoder
|
||||||
, fuzz fuzzer
|
-- |> Expect.equal (Ok ( context, [] ))
|
||||||
"JSON recode"
|
-- )
|
||||||
(\context ->
|
-- ]
|
||||||
context
|
|
||||||
|> Context.encode
|
|
||||||
|> D.decodeValue Context.decoder
|
|
||||||
|> Expect.equal (Ok ( context, [] ))
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
|
@ -51,16 +51,17 @@ suite =
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, describe "JSON"
|
|
||||||
[ fuzz2 (fuzzer Fuzz.string)
|
-- , describe "JSON"
|
||||||
Fuzz.int
|
-- [ fuzz2 (fuzzer Fuzz.string)
|
||||||
"JSON encode -> JSON decode"
|
-- Fuzz.int
|
||||||
(\envelope indent ->
|
-- "JSON encode -> JSON decode"
|
||||||
envelope
|
-- (\envelope indent ->
|
||||||
|> Envelope.encode Json.string
|
-- envelope
|
||||||
|> E.encode indent
|
-- |> Envelope.encode Json.string
|
||||||
|> D.decodeString (Envelope.decoder Json.string)
|
-- |> E.encode indent
|
||||||
|> Expect.equal (Ok ( envelope, [] ))
|
-- |> D.decodeString (Envelope.decoder Json.string)
|
||||||
)
|
-- |> Expect.equal (Ok ( envelope, [] ))
|
||||||
]
|
-- )
|
||||||
|
-- ]
|
||||||
]
|
]
|
||||||
|
|
|
@ -18,23 +18,26 @@ fuzzer =
|
||||||
Fuzz.string
|
Fuzz.string
|
||||||
|> Fuzz.map Room.init
|
|> Fuzz.map Room.init
|
||||||
|> addAFewTimes Fuzz.string (\key -> Room.setAccountData key placeholderValue)
|
|> addAFewTimes Fuzz.string (\key -> Room.setAccountData key placeholderValue)
|
||||||
|> addAFewTimes (Fuzz.list TestEvent.fuzzer) Room.addEvents
|
|
||||||
|> add4AFewTimes (Fuzz.list TestEvent.fuzzer)
|
|
||||||
TestFilter.fuzzer
|
|
||||||
(Fuzz.maybe Fuzz.string)
|
-- |> addAFewTimes (Fuzz.list TestEvent.fuzzer) Room.addEvents
|
||||||
Fuzz.string
|
-- |> add4AFewTimes (Fuzz.list TestEvent.fuzzer)
|
||||||
(\a b c d ->
|
-- TestFilter.fuzzer
|
||||||
Room.Batch a b c d
|
-- (Fuzz.maybe Fuzz.string)
|
||||||
|> Room.addBatch
|
-- Fuzz.string
|
||||||
)
|
-- (\a b c d ->
|
||||||
|> add4AFewTimes (Fuzz.list TestEvent.fuzzer)
|
-- Room.Batch a b c d
|
||||||
TestFilter.fuzzer
|
-- |> Room.addBatch
|
||||||
(Fuzz.maybe Fuzz.string)
|
-- )
|
||||||
Fuzz.string
|
-- |> add4AFewTimes (Fuzz.list TestEvent.fuzzer)
|
||||||
(\a b c d ->
|
-- TestFilter.fuzzer
|
||||||
Room.Batch a b c d
|
-- (Fuzz.maybe Fuzz.string)
|
||||||
|> Room.addSync
|
-- Fuzz.string
|
||||||
)
|
-- (\a b c d ->
|
||||||
|
-- Room.Batch a b c d
|
||||||
|
-- |> Room.addSync
|
||||||
|
-- )
|
||||||
|
|
||||||
|
|
||||||
addAFewTimes : Fuzzer a -> (a -> Room -> Room) -> Fuzzer Room -> Fuzzer Room
|
addAFewTimes : Fuzzer a -> (a -> Room -> Room) -> Fuzzer Room -> Fuzzer Room
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Test exposing (..)
|
||||||
|
|
||||||
fuzzer : Fuzzer Settings
|
fuzzer : Fuzzer Settings
|
||||||
fuzzer =
|
fuzzer =
|
||||||
Fuzz.map3 Settings
|
Fuzz.map4 Settings
|
||||||
(Fuzz.oneOf
|
(Fuzz.oneOf
|
||||||
[ Fuzz.constant Default.currentVersion
|
[ Fuzz.constant Default.currentVersion
|
||||||
, Fuzz.string
|
, Fuzz.string
|
||||||
|
@ -22,6 +22,11 @@ fuzzer =
|
||||||
, Fuzz.string
|
, Fuzz.string
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
(Fuzz.oneOf
|
||||||
|
[ Fuzz.constant Default.removePasswordOnLogin
|
||||||
|
, Fuzz.bool
|
||||||
|
]
|
||||||
|
)
|
||||||
(Fuzz.oneOf
|
(Fuzz.oneOf
|
||||||
[ Fuzz.constant Default.syncTime
|
[ Fuzz.constant Default.syncTime
|
||||||
, Fuzz.int
|
, Fuzz.int
|
||||||
|
@ -45,6 +50,12 @@ suite =
|
||||||
|> Expect.equal Default.deviceName
|
|> Expect.equal Default.deviceName
|
||||||
|> always
|
|> always
|
||||||
)
|
)
|
||||||
|
, test "Remove password on login"
|
||||||
|
(Settings.init
|
||||||
|
|> .removePasswordOnLogin
|
||||||
|
|> Expect.equal Default.removePasswordOnLogin
|
||||||
|
|> always
|
||||||
|
)
|
||||||
, test "Sync time"
|
, test "Sync time"
|
||||||
(Settings.init
|
(Settings.init
|
||||||
|> .syncTime
|
|> .syncTime
|
||||||
|
|
Loading…
Reference in New Issue