Skip to content

Commit

Permalink
Persist user after login (IOS-192)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Dec 31, 2023
1 parent 6aea178 commit e7c1edb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 0 additions & 8 deletions Mastodon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1883,13 +1883,6 @@
path = Localization;
sourceTree = "<group>";
};
D8AC98742B0F615E0045EC2B /* Persistence */ = {
isa = PBXGroup;
children = (
);
path = Persistence;
sourceTree = "<group>";
};
D8E5C347296DB896007E76A7 /* Edit History */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2175,7 +2168,6 @@
DB427DD425BAA00100D1B89D /* Mastodon */ = {
isa = PBXGroup;
children = (
D8AC98742B0F615E0045EC2B /* Persistence */,
DB89BA1025C10FF5008580ED /* Mastodon.entitlements */,
DB427DE325BAA00100D1B89D /* Info.plist */,
2D76319C25C151DE00929FB9 /* Diffable */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {

authenticationViewModel
.authenticated
.asyncMap { domain, user -> Result<Bool, Error> in
.asyncMap { domain, user -> Result<Mastodon.Entity.Account, Error> in
do {
let result = try await self.context.authenticationService.activeMastodonUser(domain: domain, userID: user.id)
return .success(result)
return .success(user)
} catch {
return .failure(error)
}
Expand All @@ -156,8 +156,8 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {
switch result {
case .failure(let error):
assertionFailure(error.localizedDescription)
case .success(let isActived):
assert(isActived)
case .success(let account):
FileManager.default.store(account: account, forUserID: account.id)
self.coordinator.setup()
}
}
Expand Down

0 comments on commit e7c1edb

Please sign in to comment.