File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
RiotSwiftUI/Modules/UserSessions/UserSessionsOverview/Service/MatrixSDK Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,15 @@ class UserSessionsDataProvider: UserSessionsDataProviderProtocol {
7777}
7878
7979extension UserSessionsDataProvider {
80+ private func deleteAccountDataIfNeeded( deviceList: [ MXDevice ] ) {
81+ let obsoletedDeviceAccountDataKeys = obsoletedDeviceAccountData ( deviceList: deviceList,
82+ accountDataEvents: session. accountData. allAccountDataEvents ( ) )
83+
84+ for accountDataKey in obsoletedDeviceAccountDataKeys {
85+ session. deleteAccountData ( withType: accountDataKey, success: { } , failure: { _ in } )
86+ }
87+ }
88+
8089 // internal just to facilitate tests
8190 func obsoletedDeviceAccountData( deviceList: [ MXDevice ] , accountDataEvents: [ String : Any ] ) -> Set < String > {
8291 let deviceAccountDataKeys = Set (
@@ -91,13 +100,4 @@ extension UserSessionsDataProvider {
91100
92101 return deviceAccountDataKeys. subtracting ( expectedDeviceAccountDataKeys)
93102 }
94-
95- private func deleteAccountDataIfNeeded( deviceList: [ MXDevice ] ) {
96- let obsoletedDeviceAccountDataKeys = obsoletedDeviceAccountData ( deviceList: deviceList,
97- accountDataEvents: session. accountData. allAccountDataEvents ( ) )
98-
99- for accountDataKey in obsoletedDeviceAccountDataKeys {
100- session. deleteAccountData ( withType: accountDataKey, success: { } , failure: { _ in } )
101- }
102- }
103103}
Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ class UserSessionCardViewDataTests: XCTestCase {
106106 let dataProvider = UserSessionsDataProvider ( session: mxSession)
107107
108108 let accountDataEvents : [ String : Any ] = [
109- " io.element.matrix_client_information.D " : " "
109+ " io.element.matrix_client_information.D " : " " ,
110+ " foo " : " "
110111 ]
111112
112113 let expectedObsoletedEvents : Set = [
@@ -123,7 +124,8 @@ class UserSessionCardViewDataTests: XCTestCase {
123124 let dataProvider = UserSessionsDataProvider ( session: mxSession)
124125
125126 let accountDataEvents : [ String : Any ] = [
126- " io.element.matrix_client_information.C " : " "
127+ " io.element.matrix_client_information.C " : " " ,
128+ " foo " : " "
127129 ]
128130
129131 let expectedObsoletedEvents : Set < String > = [ ]
@@ -138,7 +140,7 @@ class UserSessionCardViewDataTests: XCTestCase {
138140
139141 let expectedObsoletedEvents = Set ( [ " D " , " E " , " F " ] . map { " io.element.matrix_client_information. \( $0) " } )
140142
141- let accountDataEvents : [ String : Any ] = expectedObsoletedEvents. reduce ( into: [ : ] ) { partialResult, value in
143+ let accountDataEvents : [ String : Any ] = expectedObsoletedEvents. reduce ( into: [ " foo " : " " ] ) { partialResult, value in
142144 partialResult [ value] = " "
143145 }
144146
You can’t perform that action at this time.
0 commit comments