diff --git a/Examples/xx-messenger/Sources/RestoreFeature/RestoreFeature.swift b/Examples/xx-messenger/Sources/RestoreFeature/RestoreFeature.swift index 455f8989e6297422e938d700c396d1938ba194c3..4d372202180da8adbb37355e78739236b8ff7d6a 100644 --- a/Examples/xx-messenger/Sources/RestoreFeature/RestoreFeature.swift +++ b/Examples/xx-messenger/Sources/RestoreFeature/RestoreFeature.swift @@ -135,7 +135,7 @@ public let restoreReducer = Reducer<RestoreState, RestoreAction, RestoreEnvironm let facts = try env.messenger.ud.tryGet().getFacts() try env.db().saveContact(Contact( id: try env.messenger.e2e.tryGet().getContact().getId(), - username: result.restoredParams.username, + username: facts.get(.username)?.value, email: facts.get(.email)?.value, phone: facts.get(.phone)?.value, createdAt: env.now() diff --git a/Examples/xx-messenger/Tests/RestoreFeatureTests/RestoreFeatureTests.swift b/Examples/xx-messenger/Tests/RestoreFeatureTests/RestoreFeatureTests.swift index 8cfdb3d604192008ef478b9ea3c822e72c0a5b0d..716d7650255b277cad37fb40ad5a73c4aee5bace 100644 --- a/Examples/xx-messenger/Tests/RestoreFeatureTests/RestoreFeatureTests.swift +++ b/Examples/xx-messenger/Tests/RestoreFeatureTests/RestoreFeatureTests.swift @@ -80,11 +80,12 @@ final class RestoreFeatureTests: XCTestCase { let backupData = "backup-data".data(using: .utf8)! let backupPassphrase = "backup-passphrase" let restoredFacts = [ - Fact(type: .email, value: "restored-email"), - Fact(type: .phone, value: "restored-phone"), + Fact(type: .username, value: "restored-fact-username"), + Fact(type: .email, value: "restored-fact-email"), + Fact(type: .phone, value: "restored-fact-phone"), ] let restoreResult = MessengerRestoreBackup.Result( - restoredParams: BackupParams(username: "restored-username"), + restoredParams: BackupParams(username: "restored-param-username"), restoredContacts: [ "contact-1-id".data(using: .utf8)!, "contact-2-id".data(using: .utf8)!, @@ -162,7 +163,7 @@ final class RestoreFeatureTests: XCTestCase { XCTAssertNoDifference(didSaveContact, [ Contact( id: contactId, - username: restoreResult.restoredParams.username, + username: restoredFacts.get(.username)?.value, email: restoredFacts.get(.email)?.value, phone: restoredFacts.get(.phone)?.value, createdAt: now