Skip to content

Commit

Permalink
Fixes element-hq/element-meta/issues/2525 - Display a warning when a …
Browse files Browse the repository at this point in the history
…user's pinned identity changes
  • Loading branch information
stefanceriu committed Oct 7, 2024
1 parent 70652ed commit 794d0ee
Show file tree
Hide file tree
Showing 30 changed files with 678 additions and 131 deletions.
6 changes: 5 additions & 1 deletion ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,7 @@
E82E13CC3EB923CCB8F8273C /* TimelineProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9E543072DE58E751F028998 /* TimelineProxy.swift */; };
E84ADFE9696936C18C2424B5 /* SecureBackupScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A00BB9CD12CF6AC98D5485 /* SecureBackupScreen.swift */; };
E89536FC8C0E4B79E9842A78 /* RoomTimelineControllerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C0197EAE9D45A662B8847B6 /* RoomTimelineControllerProtocol.swift */; };
E8C65C19F7C40EE545172DD6 /* RoomScreenFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4137900E28201C314C835C11 /* RoomScreenFooterView.swift */; };
E9347F56CF0683208F4D9249 /* RoomNotificationSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81A9B5225D0881CEFA2CF7C9 /* RoomNotificationSettingsScreenViewModel.swift */; };
E9560744F7B0292E20ECE5F2 /* RoomDetailsScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E8A1E8EE094F570573B6E8 /* RoomDetailsScreenViewModelProtocol.swift */; };
E96005321849DBD7C72A28F2 /* UITestsAppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C208DA43CE25D13E670F40 /* UITestsAppCoordinator.swift */; };
Expand Down Expand Up @@ -1488,6 +1489,7 @@
406C90AF8C3E98DF5D4E5430 /* ElementCallServiceConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementCallServiceConstants.swift; sourceTree = "<group>"; };
40B21E611DADDEF00307E7AC /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
4100DDE6BF3C566AB66B80CC /* MentionSuggestionItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MentionSuggestionItemView.swift; sourceTree = "<group>"; };
4137900E28201C314C835C11 /* RoomScreenFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomScreenFooterView.swift; sourceTree = "<group>"; };
4176C3E20C772DE8D182863C /* LegalInformationScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegalInformationScreen.swift; sourceTree = "<group>"; };
419957D7B1C983D7B3B93678 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
41BB37D96C3EA18F3CE8675D /* RoomDirectorySearchScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchScreenModels.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4018,6 +4020,7 @@
children = (
422724361B6555364C43281E /* RoomHeaderView.swift */,
5221DFDF809142A2D6AC82B9 /* RoomScreen.swift */,
4137900E28201C314C835C11 /* RoomScreenFooterView.swift */,
4552D3466B1453F287223ADA /* SwipeRightAction.swift */,
464C6BFAA853DC755B9C1F60 /* PinnedItemsBanner */,
);
Expand Down Expand Up @@ -6788,6 +6791,7 @@
F8F47CE757EE656905F01F2C /* RoomRolesAndPermissionsScreenViewModelProtocol.swift in Sources */,
C55A44C99F64A479ABA85B46 /* RoomScreen.swift in Sources */,
A851635B3255C6DC07034A12 /* RoomScreenCoordinator.swift in Sources */,
E8C65C19F7C40EE545172DD6 /* RoomScreenFooterView.swift in Sources */,
352C439BE0F75E101EF11FB1 /* RoomScreenModels.swift in Sources */,
7BB31E67648CF32D2AB5E502 /* RoomScreenViewModel.swift in Sources */,
617624A97BDBB75ED3DD8156 /* RoomScreenViewModelProtocol.swift in Sources */,
Expand Down Expand Up @@ -7785,7 +7789,7 @@
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = 1.0.53;
version = 1.0.55;
};
};
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "83abbdc8485340c20f27148153ff62f690ca210b",
"version" : "1.0.53"
"revision" : "8ee63edc76bccd12c17a22eaf4eddae69e5f1303",
"version" : "1.0.55"
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions ElementX/Sources/Application/AppSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ final class AppSettings {
let encryptionURL: URL = "https://element.io/help#encryption"
/// A URL where users can go read more about the chat backup.
let chatBackupDetailsURL: URL = "https://element.io/help#encryption5"
/// A URL where users can go read more about identity pinning violations
let identityPinningViolationDetailsURL: URL = "https://element.io/help#18"
/// Any domains that Element web may be hosted on - used for handling links.
let elementWebHosts = ["app.element.io", "staging.element.io", "develop.element.io"]

Expand Down
3 changes: 2 additions & 1 deletion ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {

let composerDraftService = ComposerDraftService(roomProxy: roomProxy, timelineItemfactory: timelineItemFactory)

let parameters = RoomScreenCoordinatorParameters(roomProxy: roomProxy,
let parameters = RoomScreenCoordinatorParameters(clientProxy: userSession.clientProxy,
roomProxy: roomProxy,
focussedEvent: focussedEvent,
timelineController: timelineController,
mediaProvider: userSession.mediaProvider,
Expand Down
76 changes: 76 additions & 0 deletions ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4426,6 +4426,76 @@ class ClientProxyMock: ClientProxyProtocol {
return curve25519Base64ReturnValue
}
}
//MARK: - pinUserIdentity

var pinUserIdentityUnderlyingCallsCount = 0
var pinUserIdentityCallsCount: Int {
get {
if Thread.isMainThread {
return pinUserIdentityUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = pinUserIdentityUnderlyingCallsCount
}

return returnValue!
}
}
set {
if Thread.isMainThread {
pinUserIdentityUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
pinUserIdentityUnderlyingCallsCount = newValue
}
}
}
}
var pinUserIdentityCalled: Bool {
return pinUserIdentityCallsCount > 0
}
var pinUserIdentityReceivedUserID: String?
var pinUserIdentityReceivedInvocations: [String] = []

var pinUserIdentityUnderlyingReturnValue: Result<Void, ClientProxyError>!
var pinUserIdentityReturnValue: Result<Void, ClientProxyError>! {
get {
if Thread.isMainThread {
return pinUserIdentityUnderlyingReturnValue
} else {
var returnValue: Result<Void, ClientProxyError>? = nil
DispatchQueue.main.sync {
returnValue = pinUserIdentityUnderlyingReturnValue
}

return returnValue!
}
}
set {
if Thread.isMainThread {
pinUserIdentityUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
pinUserIdentityUnderlyingReturnValue = newValue
}
}
}
}
var pinUserIdentityClosure: ((String) async -> Result<Void, ClientProxyError>)?

func pinUserIdentity(_ userID: String) async -> Result<Void, ClientProxyError> {
pinUserIdentityCallsCount += 1
pinUserIdentityReceivedUserID = userID
DispatchQueue.main.async {
self.pinUserIdentityReceivedInvocations.append(userID)
}
if let pinUserIdentityClosure = pinUserIdentityClosure {
return await pinUserIdentityClosure(userID)
} else {
return pinUserIdentityReturnValue
}
}
//MARK: - resetIdentity

var resetIdentityUnderlyingCallsCount = 0
Expand Down Expand Up @@ -5791,6 +5861,11 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
set(value) { underlyingTypingMembersPublisher = value }
}
var underlyingTypingMembersPublisher: CurrentValuePublisher<[String], Never>!
var identityStatusChangesPublisher: CurrentValuePublisher<[IdentityStatusChange], Never> {
get { return underlyingIdentityStatusChangesPublisher }
set(value) { underlyingIdentityStatusChangesPublisher = value }
}
var underlyingIdentityStatusChangesPublisher: CurrentValuePublisher<[IdentityStatusChange], Never>!
var actionsPublisher: AnyPublisher<JoinedRoomProxyAction, Never> {
get { return underlyingActionsPublisher }
set(value) { underlyingActionsPublisher = value }
Expand Down Expand Up @@ -12495,6 +12570,7 @@ class RoomMemberProxyMock: RoomMemberProxyProtocol {
}
var underlyingUserID: String!
var displayName: String?
var disambiguatedDisplayName: String?
var avatarURL: URL?
var membership: MembershipState {
get { return underlyingMembership }
Expand Down
Loading

0 comments on commit 794d0ee

Please sign in to comment.