mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Implement new ClientBuilder pattern for login (#120)
* Implement new ClientBuilder pattern for login * Add changelog
This commit is contained in:
parent
7bd4763662
commit
dd739d4766
@ -2472,8 +2472,8 @@
|
|||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift.git";
|
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
branch = main;
|
kind = exactVersion;
|
||||||
kind = branch;
|
version = "1.0.11-alpha";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
61916C63E3F5BD900F08DA0C /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
|
61916C63E3F5BD900F08DA0C /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
|
||||||
|
@ -50,8 +50,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/onevcat/Kingfisher",
|
"location" : "https://github.com/onevcat/Kingfisher",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "59eb199fdb8dd47733624e8b0277822d0232579e",
|
"revision" : "022e4eeb79f817748544b318b991d9a70036bbf8",
|
||||||
"version" : "7.2.2"
|
"version" : "7.2.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -59,8 +59,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift.git",
|
"location" : "https://github.com/matrix-org/matrix-rust-components-swift.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"branch" : "main",
|
"revision" : "4605577f5604b4f2bb1938eb06d69d996eb32a28",
|
||||||
"revision" : "43c88a4b0912a1589c2a28cc9bb2df45c70cdcad"
|
"version" : "1.0.11-alpha"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -68,8 +68,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/getsentry/sentry-cocoa.git",
|
"location" : "https://github.com/getsentry/sentry-cocoa.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "b34ce9048e6b8b082ea6b15e6b50583d46c936ea",
|
"revision" : "f906913c14eadb6fd31988db1ea9ff10aec9f198",
|
||||||
"version" : "7.16.0"
|
"version" : "7.18.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1200"
|
LastUpgradeVersion = "1200"
|
||||||
version = "1.7">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES"
|
buildImplicitDependencies = "YES"
|
||||||
|
@ -108,10 +108,14 @@ class AuthenticationCoordinator: Coordinator {
|
|||||||
delegate?.authenticationCoordinatorDidStartLoading(self)
|
delegate?.authenticationCoordinatorDidStartLoading(self)
|
||||||
|
|
||||||
let basePath = userSessionStore.baseDirectoryPath(for: username)
|
let basePath = userSessionStore.baseDirectoryPath(for: username)
|
||||||
let loginTask = Task.detached {
|
let builder = ClientBuilder()
|
||||||
try loginNewClient(basePath: basePath,
|
.basePath(path: basePath)
|
||||||
username: username,
|
.username(username: username)
|
||||||
password: password)
|
|
||||||
|
let loginTask: Task<Client, Error> = Task.detached {
|
||||||
|
let client = try builder.build()
|
||||||
|
try client.login(username: username, password: password)
|
||||||
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
switch await loginTask.result {
|
switch await loginTask.result {
|
||||||
|
@ -78,9 +78,14 @@ class UserSessionStore: UserSessionStoreProtocol {
|
|||||||
Benchmark.startTrackingForIdentifier("Login", message: "Started restoring previous login")
|
Benchmark.startTrackingForIdentifier("Login", message: "Started restoring previous login")
|
||||||
|
|
||||||
let basePath = baseDirectoryPath(for: usernameTokenTuple.username)
|
let basePath = baseDirectoryPath(for: usernameTokenTuple.username)
|
||||||
let loginTask = Task.detached {
|
let builder = ClientBuilder()
|
||||||
try loginWithToken(basePath: basePath,
|
.basePath(path: basePath)
|
||||||
restoreToken: usernameTokenTuple.accessToken)
|
.username(username: usernameTokenTuple.username)
|
||||||
|
|
||||||
|
let loginTask: Task<Client, Error> = Task.detached {
|
||||||
|
let client = try builder.build()
|
||||||
|
try client.restoreLogin(restoreToken: usernameTokenTuple.accessToken)
|
||||||
|
return client
|
||||||
}
|
}
|
||||||
|
|
||||||
switch await loginTask.result {
|
switch await loginTask.result {
|
||||||
|
1
changelog.d/pr-120.change
Normal file
1
changelog.d/pr-120.change
Normal file
@ -0,0 +1 @@
|
|||||||
|
Implement new ClientBuilder pattern for login
|
@ -31,7 +31,7 @@ include:
|
|||||||
packages:
|
packages:
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/matrix-org/matrix-rust-components-swift.git
|
url: https://github.com/matrix-org/matrix-rust-components-swift.git
|
||||||
branch: main
|
exactVersion: 1.0.11-alpha
|
||||||
DesignKit:
|
DesignKit:
|
||||||
path: ./
|
path: ./
|
||||||
DTCoreText:
|
DTCoreText:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user