feat: use username instead of displayname (MESSENGER-7565)

This commit is contained in:
Frank Rotermund
2025-09-24 08:22:14 +02:00
parent 3f124ef1ce
commit be743b6b23
2 changed files with 8 additions and 5 deletions

View File

@@ -1899,7 +1899,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
MigrationAssistant *migrationAssistant = [[MigrationAssistant alloc] init];
BOOL retVal = [migrationAssistant storeDisplaynameWithSession:session];
BOOL retVal = [migrationAssistant storeUsernameWithSession:session];
if ( retVal == false) {
MXLogError(@"[RecentsDataSource] shouldShowFeatureBanner could not store displaname for migration")
}

View File

@@ -22,13 +22,16 @@ import MatrixSDK
// reads user name and displayName from session and stores in shared keychain
@objcMembers class MigrationAssistant : NSObject {
func storeDisplayname( session: MXSession ) -> Bool {
func storeUsername( session: MXSession ) -> Bool {
var returnValue = false
if let displayname = session.myUser.displayName {
let ossStatus = SharedKeychain.save(account: "migration_displayname", value: displayname)
returnValue = ossStatus == errSecSuccess
if let fullID = session.myUser.userId {
let withoutAt = fullID.hasPrefix("@") ? String(fullID.dropFirst()) : fullID
if let username = withoutAt.split(separator: ":").first {
let ossStatus = SharedKeychain.save(account: "migration_username", value: String(username))
returnValue = ossStatus == errSecSuccess
}
}
return returnValue