mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Switch to Xcode 14 and handle the UICollectionView-backed List. (#229)
* Fix Timeline on Xcode 14/iOS 16
Raise requirement to iOS 16+
Reduce pagination jumping.
Sonarcloud fixes.
Fix verification test.
Adopt if let optional { syntax.
* Remove unused ScrollViewReader
The ScrollViewReader didn't appear to change the behaviour.
* Fix warnings on Run Scripts.
Run script build phase 'SwiftLint' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.
This commit is contained in:
@@ -85,7 +85,7 @@ public struct BorderedInputFieldStyle: TextFieldStyle {
|
|||||||
.clipShape(rect)
|
.clipShape(rect)
|
||||||
.overlay(rect.stroke(borderColor, lineWidth: borderWidth))
|
.overlay(rect.stroke(borderColor, lineWidth: borderWidth))
|
||||||
.introspectTextField { textField in
|
.introspectTextField { textField in
|
||||||
if let returnKey = returnKey {
|
if let returnKey {
|
||||||
textField.returnKeyType = returnKey
|
textField.returnKeyType = returnKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public struct ElementTextFieldStyle: TextFieldStyle {
|
|||||||
|
|
||||||
public func _body(configuration: TextField<_Label>) -> some View {
|
public func _body(configuration: TextField<_Label>) -> some View {
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
if let labelText = labelText {
|
if let labelText {
|
||||||
Text(labelText)
|
Text(labelText)
|
||||||
.font(.element.subheadline)
|
.font(.element.subheadline)
|
||||||
.foregroundColor(labelColor)
|
.foregroundColor(labelColor)
|
||||||
@@ -63,7 +63,7 @@ public struct ElementTextFieldStyle: TextFieldStyle {
|
|||||||
.textFieldStyle(BorderedInputFieldStyle(isEditing: isFocused, isError: isError, returnKey: nil))
|
.textFieldStyle(BorderedInputFieldStyle(isEditing: isFocused, isError: isError, returnKey: nil))
|
||||||
.focused($isFocused)
|
.focused($isFocused)
|
||||||
|
|
||||||
if let footerText = footerText {
|
if let footerText {
|
||||||
Text(footerText)
|
Text(footerText)
|
||||||
.font(.element.footnote)
|
.font(.element.footnote)
|
||||||
.foregroundColor(footerColor)
|
.foregroundColor(footerColor)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
1555A7643D85187D4851040C /* TemplateScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4549FCB53F43DB0B278374BC /* TemplateScreen.swift */; };
|
1555A7643D85187D4851040C /* TemplateScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4549FCB53F43DB0B278374BC /* TemplateScreen.swift */; };
|
||||||
157E5FDDF419C0B2CA7E2C28 /* TimelineItemBubbledStylerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A2932515EA11D3DD8A3506 /* TimelineItemBubbledStylerView.swift */; };
|
157E5FDDF419C0B2CA7E2C28 /* TimelineItemBubbledStylerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A2932515EA11D3DD8A3506 /* TimelineItemBubbledStylerView.swift */; };
|
||||||
15D1F9C415D9C921643BA82E /* UserIndicatorRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B73D5E21F524A9BE44448D /* UserIndicatorRequest.swift */; };
|
15D1F9C415D9C921643BA82E /* UserIndicatorRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B73D5E21F524A9BE44448D /* UserIndicatorRequest.swift */; };
|
||||||
|
15D867E638BFD0E5E71DB1EF /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AFEF3AC64B1358083F76B8B /* List.swift */; };
|
||||||
165A883C29998EC779465068 /* SoftLogoutViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BC38904A9663F7FAFD47457 /* SoftLogoutViewModelProtocol.swift */; };
|
165A883C29998EC779465068 /* SoftLogoutViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BC38904A9663F7FAFD47457 /* SoftLogoutViewModelProtocol.swift */; };
|
||||||
1702981A8085BE4FB0EC001B /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33116993D54FADC0C721C1F /* Application.swift */; };
|
1702981A8085BE4FB0EC001B /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33116993D54FADC0C721C1F /* Application.swift */; };
|
||||||
172E6E9A612ADCF10A62CF13 /* BugReportServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A68BCE6438873D2661D93D0 /* BugReportServiceProtocol.swift */; };
|
172E6E9A612ADCF10A62CF13 /* BugReportServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A68BCE6438873D2661D93D0 /* BugReportServiceProtocol.swift */; };
|
||||||
@@ -310,7 +311,6 @@
|
|||||||
D0619D2E6B9C511190FBEB95 /* RoomMessageProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607974D08BD2AF83725D817A /* RoomMessageProtocol.swift */; };
|
D0619D2E6B9C511190FBEB95 /* RoomMessageProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607974D08BD2AF83725D817A /* RoomMessageProtocol.swift */; };
|
||||||
D5EA4C6C80579279770D5804 /* ImageRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A45283CF1DB96E583BECA6 /* ImageRoomTimelineView.swift */; };
|
D5EA4C6C80579279770D5804 /* ImageRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A45283CF1DB96E583BECA6 /* ImageRoomTimelineView.swift */; };
|
||||||
D6417E5A799C3C7F14F9EC0A /* SessionVerificationViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3069ADED46D063202FE7698 /* SessionVerificationViewModelProtocol.swift */; };
|
D6417E5A799C3C7F14F9EC0A /* SessionVerificationViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3069ADED46D063202FE7698 /* SessionVerificationViewModelProtocol.swift */; };
|
||||||
D826154612415D2A3BB6EBF3 /* ListTableViewAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E854E7CF531DAC5CBEBDC75 /* ListTableViewAdapter.swift */; };
|
|
||||||
D8359F67AF3A83516E9083C1 /* MockUserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4756C5A8C8649AD6C10C615 /* MockUserSession.swift */; };
|
D8359F67AF3A83516E9083C1 /* MockUserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4756C5A8C8649AD6C10C615 /* MockUserSession.swift */; };
|
||||||
D85D4FA590305180B4A41795 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3073CCD77D906B330BC1D6 /* Tests.swift */; };
|
D85D4FA590305180B4A41795 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3073CCD77D906B330BC1D6 /* Tests.swift */; };
|
||||||
D876EC0FED3B6D46C806912A /* AvatarSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24B88AD3D1599E8CB1376E0 /* AvatarSize.swift */; };
|
D876EC0FED3B6D46C806912A /* AvatarSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24B88AD3D1599E8CB1376E0 /* AvatarSize.swift */; };
|
||||||
@@ -331,6 +331,7 @@
|
|||||||
E481C8FDCB6C089963C95344 /* DTCoreText in Frameworks */ = {isa = PBXBuildFile; productRef = 527578916BD388A09F5A8036 /* DTCoreText */; };
|
E481C8FDCB6C089963C95344 /* DTCoreText in Frameworks */ = {isa = PBXBuildFile; productRef = 527578916BD388A09F5A8036 /* DTCoreText */; };
|
||||||
E5895C74615CBE8462FB840F /* SessionVerificationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCF86010A0A719A9A50EEC59 /* SessionVerificationCoordinator.swift */; };
|
E5895C74615CBE8462FB840F /* SessionVerificationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCF86010A0A719A9A50EEC59 /* SessionVerificationCoordinator.swift */; };
|
||||||
E81EEC1675F2371D12A880A3 /* MockRoomTimelineController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61ADFB893DEF81E58DF3FAB9 /* MockRoomTimelineController.swift */; };
|
E81EEC1675F2371D12A880A3 /* MockRoomTimelineController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61ADFB893DEF81E58DF3FAB9 /* MockRoomTimelineController.swift */; };
|
||||||
|
E8AFB40CC7C3DF1930DA89E2 /* ListCollectionViewAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C923DD8D9946257D46806 /* ListCollectionViewAdapter.swift */; };
|
||||||
E96005321849DBD7C72A28F2 /* UITestsAppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C208DA43CE25D13E670F40 /* UITestsAppCoordinator.swift */; };
|
E96005321849DBD7C72A28F2 /* UITestsAppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46C208DA43CE25D13E670F40 /* UITestsAppCoordinator.swift */; };
|
||||||
EA1E7949533E19C6D862680A /* MediaProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 885D8C42DD17625B5261BEFF /* MediaProvider.swift */; };
|
EA1E7949533E19C6D862680A /* MediaProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 885D8C42DD17625B5261BEFF /* MediaProvider.swift */; };
|
||||||
EA31DD9043B91ECB8E45A9A6 /* ScreenshotDetectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F03C9D319676F3C0DC6B0203 /* ScreenshotDetectorTests.swift */; };
|
EA31DD9043B91ECB8E45A9A6 /* ScreenshotDetectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F03C9D319676F3C0DC6B0203 /* ScreenshotDetectorTests.swift */; };
|
||||||
@@ -460,6 +461,7 @@
|
|||||||
2A5C6FBF97B6EED3D4FA5EFF /* AttributedStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringBuilder.swift; sourceTree = "<group>"; };
|
2A5C6FBF97B6EED3D4FA5EFF /* AttributedStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringBuilder.swift; sourceTree = "<group>"; };
|
||||||
2AE83A3DD63BCFBB956FE5CB /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = nl; path = nl.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
2AE83A3DD63BCFBB956FE5CB /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = nl; path = nl.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||||
2AEA20A6B4883E60469ACF8F /* SoftLogoutCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoftLogoutCoordinator.swift; sourceTree = "<group>"; };
|
2AEA20A6B4883E60469ACF8F /* SoftLogoutCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoftLogoutCoordinator.swift; sourceTree = "<group>"; };
|
||||||
|
2AFEF3AC64B1358083F76B8B /* List.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = List.swift; sourceTree = "<group>"; };
|
||||||
2B80895CE021B49847BD7D74 /* TemplateViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateViewModelProtocol.swift; sourceTree = "<group>"; };
|
2B80895CE021B49847BD7D74 /* TemplateViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||||
2B9BCACD0CC4CB8E37F17732 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = lt; path = lt.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
2B9BCACD0CC4CB8E37F17732 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = lt; path = lt.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||||
2CA028DCD4157F9A1F999827 /* BackgroundTaskProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundTaskProtocol.swift; sourceTree = "<group>"; };
|
2CA028DCD4157F9A1F999827 /* BackgroundTaskProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundTaskProtocol.swift; sourceTree = "<group>"; };
|
||||||
@@ -484,7 +486,6 @@
|
|||||||
398817652FA8ABAE0A31AC6D /* ReadableFrameModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadableFrameModifier.swift; sourceTree = "<group>"; };
|
398817652FA8ABAE0A31AC6D /* ReadableFrameModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadableFrameModifier.swift; sourceTree = "<group>"; };
|
||||||
399427358A80BA2848E698A2 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
399427358A80BA2848E698A2 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||||
39EBB6903EFD4236B8D11A42 /* fr-CA */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "fr-CA"; path = "fr-CA.lproj/Localizable.stringsdict"; sourceTree = "<group>"; };
|
39EBB6903EFD4236B8D11A42 /* fr-CA */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "fr-CA"; path = "fr-CA.lproj/Localizable.stringsdict"; sourceTree = "<group>"; };
|
||||||
3A008A7A3B4DF58C1A7AD142 /* changelog.d */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.dtrace; path = changelog.d; sourceTree = "<group>"; };
|
|
||||||
3A4427F9E0571B4E6E048A2B /* KeychainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainController.swift; sourceTree = "<group>"; };
|
3A4427F9E0571B4E6E048A2B /* KeychainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainController.swift; sourceTree = "<group>"; };
|
||||||
3ACBDC1D28EFB7789EB467E0 /* MockRoomProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRoomProxy.swift; sourceTree = "<group>"; };
|
3ACBDC1D28EFB7789EB467E0 /* MockRoomProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRoomProxy.swift; sourceTree = "<group>"; };
|
||||||
3B5B535DA49C54523FF7A412 /* nn */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nn; path = nn.lproj/Localizable.strings; sourceTree = "<group>"; };
|
3B5B535DA49C54523FF7A412 /* nn */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nn; path = nn.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
@@ -532,7 +533,6 @@
|
|||||||
4D6E4C37E9F0E53D3DF951AC /* HomeScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenUITests.swift; sourceTree = "<group>"; };
|
4D6E4C37E9F0E53D3DF951AC /* HomeScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenUITests.swift; sourceTree = "<group>"; };
|
||||||
4DF56C3239EA3C16951E1E66 /* is */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Localizable.strings; sourceTree = "<group>"; };
|
4DF56C3239EA3C16951E1E66 /* is */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
4E2245243369B99216C7D84E /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
|
4E2245243369B99216C7D84E /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
|
||||||
4E854E7CF531DAC5CBEBDC75 /* ListTableViewAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTableViewAdapter.swift; sourceTree = "<group>"; };
|
|
||||||
4F0CB536D1C3CC15AA740CC6 /* AuthenticationServiceProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationServiceProxyProtocol.swift; sourceTree = "<group>"; };
|
4F0CB536D1C3CC15AA740CC6 /* AuthenticationServiceProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationServiceProxyProtocol.swift; sourceTree = "<group>"; };
|
||||||
4F49CDE349C490D617332770 /* NoticeRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeRoomTimelineItem.swift; sourceTree = "<group>"; };
|
4F49CDE349C490D617332770 /* NoticeRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeRoomTimelineItem.swift; sourceTree = "<group>"; };
|
||||||
4F5F0662483ED69791D63B16 /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = et; path = et.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
4F5F0662483ED69791D63B16 /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = et; path = et.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||||
@@ -809,6 +809,7 @@
|
|||||||
E9D059BFE329BE09B6D96A9F /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ro; path = ro.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
E9D059BFE329BE09B6D96A9F /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ro; path = ro.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||||
EBE5502760CF6CA2D7201883 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ja; path = ja.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
EBE5502760CF6CA2D7201883 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ja; path = ja.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||||
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = "<group>"; };
|
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = "<group>"; };
|
||||||
|
ED0C923DD8D9946257D46806 /* ListCollectionViewAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListCollectionViewAdapter.swift; sourceTree = "<group>"; };
|
||||||
ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = "<group>"; };
|
ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = "<group>"; };
|
||||||
EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = "<group>"; };
|
EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = "<group>"; };
|
||||||
EDB6E40BAD4504D899FAAC9A /* TemplateViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateViewModel.swift; sourceTree = "<group>"; };
|
EDB6E40BAD4504D899FAAC9A /* TemplateViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateViewModel.swift; sourceTree = "<group>"; };
|
||||||
@@ -1097,7 +1098,6 @@
|
|||||||
405B00F139AEE3994601B36A = {
|
405B00F139AEE3994601B36A = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
3A008A7A3B4DF58C1A7AD142 /* changelog.d */,
|
|
||||||
5D26A086A8278D39B5756D6F /* project.yml */,
|
5D26A086A8278D39B5756D6F /* project.yml */,
|
||||||
99B9B46F2D621380428E68F7 /* ElementX */,
|
99B9B46F2D621380428E68F7 /* ElementX */,
|
||||||
A4852B57D55D71EEBFCD931D /* UnitTests */,
|
A4852B57D55D71EEBFCD931D /* UnitTests */,
|
||||||
@@ -1130,6 +1130,7 @@
|
|||||||
A9FAFE1C2149E6AC8156ED2B /* Collection.swift */,
|
A9FAFE1C2149E6AC8156ED2B /* Collection.swift */,
|
||||||
E26747B3154A5DBC3A7E24A5 /* Image.swift */,
|
E26747B3154A5DBC3A7E24A5 /* Image.swift */,
|
||||||
4E2245243369B99216C7D84E /* ImageCache.swift */,
|
4E2245243369B99216C7D84E /* ImageCache.swift */,
|
||||||
|
2AFEF3AC64B1358083F76B8B /* List.swift */,
|
||||||
40B21E611DADDEF00307E7AC /* String.swift */,
|
40B21E611DADDEF00307E7AC /* String.swift */,
|
||||||
A40C19719687984FD9478FBE /* Task.swift */,
|
A40C19719687984FD9478FBE /* Task.swift */,
|
||||||
287FC98AF2664EAD79C0D902 /* UIDevice.swift */,
|
287FC98AF2664EAD79C0D902 /* UIDevice.swift */,
|
||||||
@@ -1399,7 +1400,7 @@
|
|||||||
79023E5904B155E8E2B8B502 /* View */ = {
|
79023E5904B155E8E2B8B502 /* View */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
4E854E7CF531DAC5CBEBDC75 /* ListTableViewAdapter.swift */,
|
ED0C923DD8D9946257D46806 /* ListCollectionViewAdapter.swift */,
|
||||||
E18CF12478983A5EB390FB26 /* MessageComposer.swift */,
|
E18CF12478983A5EB390FB26 /* MessageComposer.swift */,
|
||||||
BE6C10032A77AE7DC5AA4C50 /* MessageComposerTextField.swift */,
|
BE6C10032A77AE7DC5AA4C50 /* MessageComposerTextField.swift */,
|
||||||
422724361B6555364C43281E /* RoomHeaderView.swift */,
|
422724361B6555364C43281E /* RoomHeaderView.swift */,
|
||||||
@@ -2259,6 +2260,7 @@
|
|||||||
};
|
};
|
||||||
98CA896D84BFD53B2554E891 /* ⚠️ SwiftLint */ = {
|
98CA896D84BFD53B2554E891 /* ⚠️ SwiftLint */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -2277,6 +2279,7 @@
|
|||||||
};
|
};
|
||||||
A7130911BCB2DF3D249A1836 /* 🛠 SwiftGen */ = {
|
A7130911BCB2DF3D249A1836 /* 🛠 SwiftGen */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -2295,6 +2298,7 @@
|
|||||||
};
|
};
|
||||||
B35AB66424BB30087EEE408C /* 🧹 SwiftFormat */ = {
|
B35AB66424BB30087EEE408C /* 🧹 SwiftFormat */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -2428,7 +2432,8 @@
|
|||||||
F4C3FEDB1B3A05376A1723A3 /* KeychainController.swift in Sources */,
|
F4C3FEDB1B3A05376A1723A3 /* KeychainController.swift in Sources */,
|
||||||
F2DD8661B5C0BA2BB526FA6C /* KeychainControllerProtocol.swift in Sources */,
|
F2DD8661B5C0BA2BB526FA6C /* KeychainControllerProtocol.swift in Sources */,
|
||||||
9C9E48A627C7C166084E3F5B /* LabelledActivityIndicatorView.swift in Sources */,
|
9C9E48A627C7C166084E3F5B /* LabelledActivityIndicatorView.swift in Sources */,
|
||||||
D826154612415D2A3BB6EBF3 /* ListTableViewAdapter.swift in Sources */,
|
15D867E638BFD0E5E71DB1EF /* List.swift in Sources */,
|
||||||
|
E8AFB40CC7C3DF1930DA89E2 /* ListCollectionViewAdapter.swift in Sources */,
|
||||||
83E5054739949181CA981193 /* LoginCoordinator.swift in Sources */,
|
83E5054739949181CA981193 /* LoginCoordinator.swift in Sources */,
|
||||||
872A6457DF573AF8CEAE927A /* LoginHomeserver.swift in Sources */,
|
872A6457DF573AF8CEAE927A /* LoginHomeserver.swift in Sources */,
|
||||||
CEB8FB1269DE20536608B957 /* LoginMode.swift in Sources */,
|
CEB8FB1269DE20536608B957 /* LoginMode.swift in Sources */,
|
||||||
@@ -2949,8 +2954,8 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -3014,8 +3019,8 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
MACOSX_DEPLOYMENT_TARGET = 13.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import UIKit
|
|||||||
struct ServiceLocator {
|
struct ServiceLocator {
|
||||||
fileprivate static var serviceLocator: ServiceLocator?
|
fileprivate static var serviceLocator: ServiceLocator?
|
||||||
static var shared: ServiceLocator {
|
static var shared: ServiceLocator {
|
||||||
guard let serviceLocator = serviceLocator else {
|
guard let serviceLocator else {
|
||||||
fatalError("The service locator should be setup at this point")
|
fatalError("The service locator should be setup at this point")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ class AppCoordinator: Coordinator {
|
|||||||
private var userSession: UserSessionProtocol! {
|
private var userSession: UserSessionProtocol! {
|
||||||
didSet {
|
didSet {
|
||||||
deobserveUserSessionChanges()
|
deobserveUserSessionChanges()
|
||||||
if let userSession = userSession, !userSession.isSoftLogout {
|
if let userSession, !userSession.isSoftLogout {
|
||||||
observeUserSessionChanges()
|
observeUserSessionChanges()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ class AppCoordinator: Coordinator {
|
|||||||
// swiftlint:disable:next cyclomatic_complexity
|
// swiftlint:disable:next cyclomatic_complexity
|
||||||
private func setupStateMachine() {
|
private func setupStateMachine() {
|
||||||
stateMachine.addTransitionHandler { [weak self] context in
|
stateMachine.addTransitionHandler { [weak self] context in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch (context.fromState, context.event, context.toState) {
|
switch (context.fromState, context.event, context.toState) {
|
||||||
case (.initial, .startWithAuthentication, .signedOut):
|
case (.initial, .startWithAuthentication, .signedOut):
|
||||||
@@ -297,7 +297,7 @@ class AppCoordinator: Coordinator {
|
|||||||
userSession.callbacks
|
userSession.callbacks
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak self] callback in
|
.sink { [weak self] callback in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
switch callback {
|
switch callback {
|
||||||
case .didReceiveAuthError(let isSoftLogout):
|
case .didReceiveAuthError(let isSoftLogout):
|
||||||
self.stateMachine.processEvent(.remoteSignOut(isSoft: isSoftLogout))
|
self.stateMachine.processEvent(.remoteSignOut(isSoft: isSoftLogout))
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ struct Benchmark {
|
|||||||
let startTime = CFAbsoluteTimeGetCurrent()
|
let startTime = CFAbsoluteTimeGetCurrent()
|
||||||
trackingIdentifiers[identifier] = startTime
|
trackingIdentifiers[identifier] = startTime
|
||||||
|
|
||||||
if let message = message {
|
if let message {
|
||||||
MXLog.verbose("⏰ \(message).")
|
MXLog.verbose("⏰ \(message).")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ struct Benchmark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let elapsedTime = CFAbsoluteTimeGetCurrent() - start
|
let elapsedTime = CFAbsoluteTimeGetCurrent() - start
|
||||||
if let message = message {
|
if let message {
|
||||||
MXLog.verbose("⏰ \(message). Elapsed time: \(elapsedTime.round(to: 4)) seconds.")
|
MXLog.verbose("⏰ \(message). Elapsed time: \(elapsedTime.round(to: 4)) seconds.")
|
||||||
} else {
|
} else {
|
||||||
MXLog.verbose("⏰ Elapsed time: \(elapsedTime.round(to: 4)) seconds.")
|
MXLog.verbose("⏰ Elapsed time: \(elapsedTime.round(to: 4)) seconds.")
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Copyright 2022 New Vector Ltd
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Introspect
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
extension View {
|
||||||
|
/// Finds a `UICollectionView` from a `SwiftUI.List`, or `SwiftUI.List` child.
|
||||||
|
/// Stop gap until https://github.com/siteline/SwiftUI-Introspect/pull/169
|
||||||
|
func introspectCollectionView(customize: @escaping (UICollectionView) -> Void) -> some View {
|
||||||
|
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fromPlain(_ string: String?) -> AttributedString? {
|
func fromPlain(_ string: String?) -> AttributedString? {
|
||||||
guard let string = string else {
|
guard let string else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
|||||||
// that could happen with the default HTML renderer of NSAttributedString which is a
|
// that could happen with the default HTML renderer of NSAttributedString which is a
|
||||||
// webview.
|
// webview.
|
||||||
func fromHTML(_ htmlString: String?) -> AttributedString? {
|
func fromHTML(_ htmlString: String?) -> AttributedString? {
|
||||||
guard let htmlString = htmlString,
|
guard let htmlString,
|
||||||
let data = htmlString.data(using: .utf8) else {
|
let data = htmlString.data(using: .utf8) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func blockquoteCoalescedComponentsFrom(_ attributedString: AttributedString?) -> [AttributedStringBuilderComponent]? {
|
func blockquoteCoalescedComponentsFrom(_ attributedString: AttributedString?) -> [AttributedStringBuilderComponent]? {
|
||||||
guard let attributedString = attributedString else {
|
guard let attributedString else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public extension DTHTMLElement {
|
|||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - font: The default font to use when resetting the content of any unsupported tags.
|
/// - font: The default font to use when resetting the content of any unsupported tags.
|
||||||
@objc func sanitize(font: UIFont) {
|
@objc func sanitize(font: UIFont) {
|
||||||
if let name = name, !Self.allowedHTMLTags.contains(name) {
|
if let name, !Self.allowedHTMLTags.contains(name) {
|
||||||
// This is an unsupported tag.
|
// This is an unsupported tag.
|
||||||
// Remove any attachments to fix rendering.
|
// Remove any attachments to fix rendering.
|
||||||
textAttachment = nil
|
textAttachment = nil
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ final class NavigationRouter: NSObject, NavigationRouterType {
|
|||||||
self.willPopViewController($0)
|
self.willPopViewController($0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let popCompletion = popCompletion {
|
if let popCompletion {
|
||||||
completions[controller] = popCompletion
|
completions[controller] = popCompletion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,14 +60,14 @@ extension AlertInfo {
|
|||||||
|
|
||||||
extension AlertInfo {
|
extension AlertInfo {
|
||||||
private var messageText: Text? {
|
private var messageText: Text? {
|
||||||
guard let message = message else { return nil }
|
guard let message else { return nil }
|
||||||
return Text(message)
|
return Text(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a SwiftUI `Alert` created from this alert info, using default button
|
/// Returns a SwiftUI `Alert` created from this alert info, using default button
|
||||||
/// styles for both primary and (if set) secondary buttons.
|
/// styles for both primary and (if set) secondary buttons.
|
||||||
var alert: Alert {
|
var alert: Alert {
|
||||||
if let secondaryButton = secondaryButton {
|
if let secondaryButton {
|
||||||
return Alert(title: Text(title),
|
return Alert(title: Text(title),
|
||||||
message: messageText,
|
message: messageText,
|
||||||
primaryButton: alertButton(for: primaryButton),
|
primaryButton: alertButton(for: primaryButton),
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class StateStoreViewModel<State: BindableState, ViewAction> {
|
|||||||
init(initialViewState: State) {
|
init(initialViewState: State) {
|
||||||
context = Context(initialViewState: initialViewState)
|
context = Context(initialViewState: initialViewState)
|
||||||
context.viewActions.sink { [weak self] action in
|
context.viewActions.sink { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
Task { await self.process(viewAction: action) }
|
Task { await self.process(viewAction: action) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType {
|
|||||||
|
|
||||||
func presentActivityIndicator(on view: UIView, animated: Bool, completion: (() -> Void)? = nil) {
|
func presentActivityIndicator(on view: UIView, animated: Bool, completion: (() -> Void)? = nil) {
|
||||||
if presentingView != nil {
|
if presentingView != nil {
|
||||||
if let completion = completion {
|
if let completion {
|
||||||
completion()
|
completion()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -88,7 +88,7 @@ final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func removeCurrentActivityIndicator(animated: Bool, completion: (() -> Void)? = nil) {
|
func removeCurrentActivityIndicator(animated: Bool, completion: (() -> Void)? = nil) {
|
||||||
guard let presentingView = presentingView,
|
guard let presentingView,
|
||||||
let backgroundOverlayView = backgroundOverlayView,
|
let backgroundOverlayView = backgroundOverlayView,
|
||||||
let activityIndicatorView = activityIndicatorView else {
|
let activityIndicatorView = activityIndicatorView else {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class FullscreenLoadingViewPresenter: UserIndicatorViewPresentable {
|
|||||||
while presentingController?.navigationController != nil {
|
while presentingController?.navigationController != nil {
|
||||||
presentingController = presentingController?.navigationController
|
presentingController = presentingController?.navigationController
|
||||||
}
|
}
|
||||||
guard let presentingController = presentingController else {
|
guard let presentingController else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class FullscreenLoadingViewPresenter: UserIndicatorViewPresentable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func dismiss() {
|
func dismiss() {
|
||||||
guard let view = view, view.superview != nil else {
|
guard let view, view.superview != nil else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class RectangleToastView: UIView {
|
|||||||
image: UIImage? = nil) {
|
image: UIImage? = nil) {
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
|
|
||||||
if let image = image {
|
if let image {
|
||||||
imageView.image = image
|
imageView.image = image
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
imageView.widthAnchor.constraint(equalToConstant: image.size.width),
|
imageView.widthAnchor.constraint(equalToConstant: image.size.width),
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class ToastViewPresenter: UserIndicatorViewPresentable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func dismiss() {
|
func dismiss() {
|
||||||
guard let view = view, view.superview != nil else {
|
guard let view, view.superview != nil else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable {
|
|||||||
analyticsPromptViewModel.callback = { [weak self] result in
|
analyticsPromptViewModel.callback = { [weak self] result in
|
||||||
MXLog.debug("AnalyticsPromptViewModel did complete with result: \(result).")
|
MXLog.debug("AnalyticsPromptViewModel did complete with result: \(result).")
|
||||||
|
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch result {
|
switch result {
|
||||||
case .enable:
|
case .enable:
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class AuthenticationCoordinator: Coordinator, Presentable {
|
|||||||
let coordinator = SplashScreenCoordinator()
|
let coordinator = SplashScreenCoordinator()
|
||||||
|
|
||||||
coordinator.callback = { [weak self] action in
|
coordinator.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
switch action {
|
switch action {
|
||||||
case .login:
|
case .login:
|
||||||
Task { await self.startAuthentication() }
|
Task { await self.startAuthentication() }
|
||||||
@@ -93,7 +93,7 @@ class AuthenticationCoordinator: Coordinator, Presentable {
|
|||||||
let coordinator = ServerSelectionCoordinator(parameters: parameters)
|
let coordinator = ServerSelectionCoordinator(parameters: parameters)
|
||||||
|
|
||||||
coordinator.callback = { [weak self] action in
|
coordinator.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .updated:
|
case .updated:
|
||||||
@@ -117,7 +117,7 @@ class AuthenticationCoordinator: Coordinator, Presentable {
|
|||||||
let coordinator = LoginCoordinator(parameters: parameters)
|
let coordinator = LoginCoordinator(parameters: parameters)
|
||||||
|
|
||||||
coordinator.callback = { [weak self] action in
|
coordinator.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .signedIn(let userSession):
|
case .signedIn(let userSession):
|
||||||
@@ -138,7 +138,7 @@ class AuthenticationCoordinator: Coordinator, Presentable {
|
|||||||
let coordinator = AnalyticsPromptCoordinator(parameters: parameters)
|
let coordinator = AnalyticsPromptCoordinator(parameters: parameters)
|
||||||
|
|
||||||
coordinator.callback = { [weak self] in
|
coordinator.callback = { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
self.delegate?.authenticationCoordinator(self, didLoginWithSession: userSession)
|
self.delegate?.authenticationCoordinator(self, didLoginWithSession: userSession)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ final class LoginCoordinator: Coordinator, Presentable {
|
|||||||
MXLog.debug("Did start.")
|
MXLog.debug("Did start.")
|
||||||
|
|
||||||
loginViewModel.callback = { [weak self] action in
|
loginViewModel.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
MXLog.debug("LoginViewModel did callback with result: \(action).")
|
MXLog.debug("LoginViewModel did callback with result: \(action).")
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
@@ -144,7 +144,7 @@ final class LoginCoordinator: Coordinator, Presentable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func loginWithOIDC() {
|
private func loginWithOIDC() {
|
||||||
guard let oidcUserAgent = oidcUserAgent else {
|
guard let oidcUserAgent else {
|
||||||
handleError(AuthenticationServiceError.oidcError(.notSupported))
|
handleError(AuthenticationServiceError.oidcError(.notSupported))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ final class LoginCoordinator: Coordinator, Presentable {
|
|||||||
hasModalPresentation: true)
|
hasModalPresentation: true)
|
||||||
let coordinator = ServerSelectionCoordinator(parameters: parameters)
|
let coordinator = ServerSelectionCoordinator(parameters: parameters)
|
||||||
coordinator.callback = { [weak self, weak coordinator] action in
|
coordinator.callback = { [weak self, weak coordinator] action in
|
||||||
guard let self = self, let coordinator = coordinator else { return }
|
guard let self, let coordinator = coordinator else { return }
|
||||||
self.serverSelectionCoordinator(coordinator, didCompleteWith: action)
|
self.serverSelectionCoordinator(coordinator, didCompleteWith: action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ final class ServerSelectionCoordinator: Coordinator, Presentable {
|
|||||||
MXLog.debug("Did start.")
|
MXLog.debug("Did start.")
|
||||||
|
|
||||||
serverSelectionViewModel.callback = { [weak self] action in
|
serverSelectionViewModel.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
MXLog.debug("ServerSelectionViewModel did callback with action: \(action).")
|
MXLog.debug("ServerSelectionViewModel did callback with action: \(action).")
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ final class SoftLogoutCoordinator: Coordinator, Presentable {
|
|||||||
MXLog.debug("[SoftLogoutCoordinator] did start.")
|
MXLog.debug("[SoftLogoutCoordinator] did start.")
|
||||||
|
|
||||||
softLogoutViewModel.callback = { [weak self] result in
|
softLogoutViewModel.callback = { [weak self] result in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
MXLog.debug("[SoftLogoutCoordinator] SoftLogoutViewModel did complete with result: \(result).")
|
MXLog.debug("[SoftLogoutCoordinator] SoftLogoutViewModel did complete with result: \(result).")
|
||||||
|
|
||||||
switch result {
|
switch result {
|
||||||
@@ -154,7 +154,7 @@ final class SoftLogoutCoordinator: Coordinator, Presentable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func loginWithOIDC() {
|
private func loginWithOIDC() {
|
||||||
guard let oidcUserAgent = oidcUserAgent else {
|
guard let oidcUserAgent else {
|
||||||
handleError(AuthenticationServiceError.oidcError(.notSupported))
|
handleError(AuthenticationServiceError.oidcError(.notSupported))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ final class BugReportCoordinator: Coordinator, Presentable {
|
|||||||
func start() {
|
func start() {
|
||||||
MXLog.debug("Did start.")
|
MXLog.debug("Did start.")
|
||||||
bugReportViewModel.callback = { [weak self] result in
|
bugReportViewModel.callback = { [weak self] result in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
MXLog.debug("BugReportViewModel did complete with result: \(result).")
|
MXLog.debug("BugReportViewModel did complete with result: \(result).")
|
||||||
switch result {
|
switch result {
|
||||||
case .submitStarted:
|
case .submitStarted:
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ final class HomeScreenCoordinator: Coordinator, Presentable {
|
|||||||
hostingController = UIHostingController(rootView: view)
|
hostingController = UIHostingController(rootView: view)
|
||||||
|
|
||||||
viewModel.callback = { [weak self] action in
|
viewModel.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .selectRoom(let roomIdentifier):
|
case .selectRoom(let roomIdentifier):
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
timelineController.callbacks
|
timelineController.callbacks
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak self] callback in
|
.sink { [weak self] callback in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch callback {
|
switch callback {
|
||||||
case .updatedTimelineItems:
|
case .updatedTimelineItems:
|
||||||
@@ -66,7 +66,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
|
|
||||||
buildTimelineViews()
|
buildTimelineViews()
|
||||||
|
|
||||||
if let roomAvatarUrl = roomAvatarUrl {
|
if let roomAvatarUrl {
|
||||||
Task {
|
Task {
|
||||||
if case let .success(avatar) = await mediaProvider.loadImageFromURLString(roomAvatarUrl,
|
if case let .success(avatar) = await mediaProvider.loadImageFromURLString(roomAvatarUrl,
|
||||||
avatarSize: .room(on: .timeline)) {
|
avatarSize: .room(on: .timeline)) {
|
||||||
|
|||||||
+43
-45
@@ -17,7 +17,7 @@
|
|||||||
import Combine
|
import Combine
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
class ListCollectionViewAdapter: NSObject, UICollectionViewDelegate {
|
||||||
private enum ContentOffsetDetails {
|
private enum ContentOffsetDetails {
|
||||||
case topOffset(previousVisibleIndexPath: IndexPath, previousItemCount: Int)
|
case topOffset(previousVisibleIndexPath: IndexPath, previousItemCount: Int)
|
||||||
case bottomOffset
|
case bottomOffset
|
||||||
@@ -34,7 +34,7 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
private var isAnimatingKeyboardAppearance = false
|
private var isAnimatingKeyboardAppearance = false
|
||||||
private var previousFrame: CGRect = .zero
|
private var previousFrame: CGRect = .zero
|
||||||
|
|
||||||
private(set) var tableView: UITableView?
|
private(set) var collectionView: UICollectionView?
|
||||||
|
|
||||||
let scrollViewDidRestPublisher = PassthroughSubject<Void, Never>()
|
let scrollViewDidRestPublisher = PassthroughSubject<Void, Never>()
|
||||||
let scrollViewTopVisiblePublisher = CurrentValueSubject<Bool, Never>(false)
|
let scrollViewTopVisiblePublisher = CurrentValueSubject<Bool, Never>(false)
|
||||||
@@ -45,38 +45,36 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
bottomDetectionOffset = 0.0
|
bottomDetectionOffset = 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
init(tableView: UITableView, topDetectionOffset: CGFloat, bottomDetectionOffset: CGFloat) {
|
init(collectionView: UICollectionView, topDetectionOffset: CGFloat, bottomDetectionOffset: CGFloat) {
|
||||||
self.tableView = tableView
|
self.collectionView = collectionView
|
||||||
self.topDetectionOffset = topDetectionOffset
|
self.topDetectionOffset = topDetectionOffset
|
||||||
self.bottomDetectionOffset = bottomDetectionOffset
|
self.bottomDetectionOffset = bottomDetectionOffset
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
tableView.clipsToBounds = true
|
collectionView.clipsToBounds = true
|
||||||
tableView.keyboardDismissMode = .onDrag
|
collectionView.keyboardDismissMode = .onDrag
|
||||||
|
|
||||||
registerContentOfffsetObserver()
|
registerContentOffsetObserver()
|
||||||
registerBoundsObserver()
|
registerBoundsObserver()
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidShow(notification:)), name: UIResponder.keyboardDidShowNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidShow(notification:)), name: UIResponder.keyboardDidShowNotification, object: nil)
|
||||||
|
|
||||||
tableView.panGestureRecognizer.addTarget(self, action: #selector(handlePanGesture(_:)))
|
collectionView.panGestureRecognizer.addTarget(self, action: #selector(handlePanGesture(_:)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func saveCurrentOffset() {
|
func saveCurrentOffset() {
|
||||||
guard let tableView = tableView,
|
guard let collectionView,
|
||||||
tableView.numberOfSections > 0 else {
|
collectionView.numberOfSections > 0 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if computeIsBottomVisible() {
|
if computeIsBottomVisible() {
|
||||||
offsetDetails = .bottomOffset
|
offsetDetails = .bottomOffset
|
||||||
} else if computeIsTopVisible() {
|
} else if computeIsTopVisible(), let topIndexPath = collectionView.indexPathsForVisibleItems.first {
|
||||||
if let topIndexPath = tableView.indexPathsForVisibleRows?.first {
|
offsetDetails = .topOffset(previousVisibleIndexPath: topIndexPath,
|
||||||
offsetDetails = .topOffset(previousVisibleIndexPath: topIndexPath,
|
previousItemCount: collectionView.numberOfItems(inSection: 0))
|
||||||
previousItemCount: tableView.numberOfRows(inSection: 0))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,20 +83,20 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
offsetDetails = nil
|
offsetDetails = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let tableView = tableView,
|
guard let collectionView,
|
||||||
tableView.numberOfSections > 0 else {
|
collectionView.numberOfSections > 0 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentItemCount = tableView.numberOfRows(inSection: 0)
|
let currentItemCount = collectionView.numberOfItems(inSection: 0)
|
||||||
|
|
||||||
switch offsetDetails {
|
switch offsetDetails {
|
||||||
case .bottomOffset:
|
case .bottomOffset:
|
||||||
tableView.scrollToRow(at: .init(row: max(0, currentItemCount - 1), section: 0), at: .bottom, animated: false)
|
collectionView.scrollToItem(at: .init(item: max(0, currentItemCount - 1), section: 0), at: .bottom, animated: false)
|
||||||
case .topOffset(let indexPath, let previousItemCount):
|
case .topOffset(let indexPath, let previousItemCount):
|
||||||
let row = indexPath.row + max(0, currentItemCount - previousItemCount)
|
let item = indexPath.item + max(0, currentItemCount - previousItemCount)
|
||||||
if row < currentItemCount {
|
if item < currentItemCount {
|
||||||
tableView.scrollToRow(at: .init(row: row, section: 0), at: .top, animated: false)
|
collectionView.scrollToItem(at: .init(item: item, section: 0), at: .top, animated: false)
|
||||||
}
|
}
|
||||||
case .none:
|
case .none:
|
||||||
break
|
break
|
||||||
@@ -106,35 +104,35 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isTracking: Bool {
|
var isTracking: Bool {
|
||||||
tableView?.isTracking == true
|
collectionView?.isTracking == true
|
||||||
}
|
}
|
||||||
|
|
||||||
var isDecelerating: Bool {
|
var isDecelerating: Bool {
|
||||||
tableView?.isDecelerating == true
|
collectionView?.isDecelerating == true
|
||||||
}
|
}
|
||||||
|
|
||||||
func scrollToBottom(animated: Bool = false) {
|
func scrollToBottom(animated: Bool = false) {
|
||||||
guard let tableView = tableView,
|
guard let collectionView,
|
||||||
tableView.numberOfSections > 0 else {
|
collectionView.numberOfSections > 0 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentItemCount = tableView.numberOfRows(inSection: 0)
|
let currentItemCount = collectionView.numberOfItems(inSection: 0)
|
||||||
guard currentItemCount > 1 else {
|
guard currentItemCount > 1 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tableView.scrollToRow(at: .init(row: currentItemCount - 1, section: 0), at: .bottom, animated: animated)
|
collectionView.scrollToItem(at: .init(item: currentItemCount - 1, section: 0), at: .bottom, animated: animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
private func registerContentOfffsetObserver() {
|
private func registerContentOffsetObserver() {
|
||||||
// Don't attempt stealing the UITableView delegate away from the List.
|
// Don't attempt stealing the UICollectionView delegate away from the List.
|
||||||
// Doing so results in undefined behavior e.g. context menus not working
|
// Doing so results in undefined behavior e.g. context menus not working
|
||||||
contentOffsetObserverToken = tableView?.observe(\.contentOffset, options: .new, changeHandler: { [weak self] _, _ in
|
contentOffsetObserverToken = collectionView?.observe(\.contentOffset, options: .new) { [weak self] _, _ in
|
||||||
self?.handleScrollViewScroll()
|
self?.handleScrollViewScroll()
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func deregisterContentOffsetObserver() {
|
private func deregisterContentOffsetObserver() {
|
||||||
@@ -142,10 +140,10 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func registerBoundsObserver() {
|
private func registerBoundsObserver() {
|
||||||
boundsObserverToken = tableView?.observe(\.frame, options: .new, changeHandler: { [weak self] tableView, _ in
|
boundsObserverToken = collectionView?.observe(\.frame, options: .new) { [weak self] collectionView, _ in
|
||||||
self?.previousFrame = tableView.frame
|
self?.previousFrame = collectionView.frame
|
||||||
self?.handleScrollViewScroll()
|
self?.handleScrollViewScroll()
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func deregisterBoundsObserver() {
|
private func deregisterBoundsObserver() {
|
||||||
@@ -161,18 +159,18 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func handleScrollViewScroll() {
|
private func handleScrollViewScroll() {
|
||||||
guard let tableView = tableView else {
|
guard let collectionView else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let hasScrolledBecauseOfFrameChange = (previousFrame != tableView.frame)
|
let hasScrolledBecauseOfFrameChange = (previousFrame != collectionView.frame)
|
||||||
let shouldPinToBottom = scrollViewBottomVisiblePublisher.value && (isAnimatingKeyboardAppearance || hasScrolledBecauseOfFrameChange)
|
let shouldPinToBottom = scrollViewBottomVisiblePublisher.value && (isAnimatingKeyboardAppearance || hasScrolledBecauseOfFrameChange)
|
||||||
|
|
||||||
if shouldPinToBottom {
|
if shouldPinToBottom {
|
||||||
deregisterContentOffsetObserver()
|
deregisterContentOffsetObserver()
|
||||||
scrollToBottom()
|
scrollToBottom()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.registerContentOfffsetObserver()
|
self.registerContentOffsetObserver()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -187,19 +185,19 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
scrollViewBottomVisiblePublisher.send(isBottomVisible)
|
scrollViewBottomVisiblePublisher.send(isBottomVisible)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !draggingInitiated, tableView.isDragging {
|
if !draggingInitiated, collectionView.isDragging {
|
||||||
draggingInitiated = true
|
draggingInitiated = true
|
||||||
} else if draggingInitiated, !tableView.isDragging {
|
} else if draggingInitiated, !collectionView.isDragging {
|
||||||
draggingInitiated = false
|
draggingInitiated = false
|
||||||
scrollViewDidRestPublisher.send(())
|
scrollViewDidRestPublisher.send(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func handlePanGesture(_ sender: UIPanGestureRecognizer) {
|
@objc private func handlePanGesture(_ sender: UIPanGestureRecognizer) {
|
||||||
guard let tableView = tableView,
|
guard let collectionView,
|
||||||
sender.state == .ended,
|
sender.state == .ended,
|
||||||
draggingInitiated == true,
|
draggingInitiated,
|
||||||
!tableView.isDecelerating else {
|
!collectionView.isDecelerating else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +206,7 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func computeIsTopVisible() -> Bool {
|
private func computeIsTopVisible() -> Bool {
|
||||||
guard let scrollView = tableView else {
|
guard let scrollView = collectionView else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +214,7 @@ class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func computeIsBottomVisible() -> Bool {
|
private func computeIsBottomVisible() -> Bool {
|
||||||
guard let scrollView = tableView else {
|
guard let scrollView = collectionView else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ struct PlaceholderAvatarImage: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var bgColor: Color {
|
private var bgColor: Color {
|
||||||
guard let contentId = contentId else {
|
guard let contentId else {
|
||||||
return .element.accent
|
return .element.accent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import Introspect
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct TimelineItemList: View {
|
struct TimelineItemList: View {
|
||||||
@State private var tableViewObserver = ListTableViewAdapter()
|
@State private var collectionViewObserver = ListCollectionViewAdapter()
|
||||||
@State private var timelineItems: [RoomTimelineViewProvider] = []
|
@State private var timelineItems: [RoomTimelineViewProvider] = []
|
||||||
@State private var hasPendingChanges = false
|
@State private var hasPendingChanges = false
|
||||||
@ObservedObject private var settings = ElementSettings.shared
|
@ObservedObject private var settings = ElementSettings.shared
|
||||||
@@ -32,105 +32,106 @@ struct TimelineItemList: View {
|
|||||||
@State private var viewFrame: CGRect = .zero
|
@State private var viewFrame: CGRect = .zero
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
// The observer behaves differently when not in an reader
|
List {
|
||||||
ScrollViewReader { _ in
|
ProgressView()
|
||||||
List {
|
.frame(maxWidth: .infinity)
|
||||||
ProgressView()
|
.opacity(context.viewState.isBackPaginating ? 1.0 : 0.0)
|
||||||
.frame(maxWidth: .infinity)
|
.animation(.elementDefault, value: context.viewState.isBackPaginating)
|
||||||
.opacity(context.viewState.isBackPaginating ? 1.0 : 0.0)
|
.listRowBackground(Color.clear)
|
||||||
.animation(.elementDefault, value: context.viewState.isBackPaginating)
|
.listRowSeparator(.hidden)
|
||||||
|
|
||||||
|
// timelineItems won't be set for static Xcode Previews until they're run.
|
||||||
|
ForEach(isPreview ? context.viewState.items : timelineItems) { timelineItem in
|
||||||
|
timelineItem
|
||||||
|
.contextMenu {
|
||||||
|
context.viewState.contextMenuBuilder?(timelineItem.id)
|
||||||
|
}
|
||||||
|
.opacity(opacityForItem(timelineItem))
|
||||||
.listRowBackground(Color.clear)
|
.listRowBackground(Color.clear)
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
|
.listRowInsets(settings.timelineStyle.listRowInsets)
|
||||||
// No idea why previews don't work otherwise
|
.onAppear {
|
||||||
ForEach(isPreview ? context.viewState.items : timelineItems) { timelineItem in
|
context.send(viewAction: .itemAppeared(id: timelineItem.id))
|
||||||
timelineItem
|
}
|
||||||
.contextMenu {
|
.onDisappear {
|
||||||
context.viewState.contextMenuBuilder?(timelineItem.id)
|
context.send(viewAction: .itemDisappeared(id: timelineItem.id))
|
||||||
}
|
}
|
||||||
.opacity(opacityForItem(timelineItem))
|
.environment(\.openURL, OpenURLAction { url in
|
||||||
.listRowBackground(Color.clear)
|
context.send(viewAction: .linkClicked(url: url))
|
||||||
.listRowSeparator(.hidden)
|
return .systemAction
|
||||||
.listRowInsets(settings.timelineStyle.listRowInsets)
|
})
|
||||||
.onAppear {
|
|
||||||
context.send(viewAction: .itemAppeared(id: timelineItem.id))
|
|
||||||
}
|
|
||||||
.onDisappear {
|
|
||||||
context.send(viewAction: .itemDisappeared(id: timelineItem.id))
|
|
||||||
}
|
|
||||||
.environment(\.openURL, OpenURLAction { url in
|
|
||||||
context.send(viewAction: .linkClicked(url: url))
|
|
||||||
return .systemAction
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.listStyle(.plain)
|
}
|
||||||
.background(ViewFrameReader(frame: $viewFrame))
|
.listStyle(.plain)
|
||||||
.environment(\.timelineWidth, viewFrame.width)
|
.background(ViewFrameReader(frame: $viewFrame))
|
||||||
.timelineStyle(settings.timelineStyle)
|
.environment(\.timelineWidth, viewFrame.width)
|
||||||
.environment(\.defaultMinListRowHeight, 0.0)
|
.timelineStyle(settings.timelineStyle)
|
||||||
.introspectTableView { tableView in
|
.environment(\.defaultMinListRowHeight, 0.0)
|
||||||
if tableView == tableViewObserver.tableView {
|
.introspectCollectionView { collectionView in
|
||||||
return
|
if collectionView == collectionViewObserver.collectionView { return }
|
||||||
}
|
|
||||||
|
collectionViewObserver = ListCollectionViewAdapter(collectionView: collectionView,
|
||||||
tableViewObserver = ListTableViewAdapter(tableView: tableView,
|
topDetectionOffset: collectionView.bounds.size.height / 3.0,
|
||||||
topDetectionOffset: tableView.bounds.size.height / 3.0,
|
bottomDetectionOffset: 10.0)
|
||||||
bottomDetectionOffset: 10.0)
|
|
||||||
|
collectionViewObserver.scrollToBottom()
|
||||||
tableViewObserver.scrollToBottom()
|
|
||||||
|
// Check if there are enough items. Otherwise ask for more
|
||||||
// Check if there are enough items. Otherwise ask for more
|
attemptBackPagination()
|
||||||
attemptBackPagination()
|
}
|
||||||
}
|
.onAppear {
|
||||||
.onAppear {
|
if timelineItems != context.viewState.items {
|
||||||
if timelineItems != context.viewState.items {
|
|
||||||
timelineItems = context.viewState.items
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onReceive(scrollToBottomPublisher) {
|
|
||||||
tableViewObserver.scrollToBottom(animated: true)
|
|
||||||
}
|
|
||||||
.onReceive(tableViewObserver.scrollViewTopVisiblePublisher) { isTopVisible in
|
|
||||||
if !isTopVisible || context.viewState.isBackPaginating {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
attemptBackPagination()
|
|
||||||
}
|
|
||||||
.onReceive(tableViewObserver.scrollViewBottomVisiblePublisher) { isBottomVisible in
|
|
||||||
bottomVisiblePublisher.send(isBottomVisible)
|
|
||||||
}
|
|
||||||
.onChange(of: context.viewState.items) { _ in
|
|
||||||
// Don't update the list while moving
|
|
||||||
if tableViewObserver.isDecelerating || tableViewObserver.isTracking {
|
|
||||||
hasPendingChanges = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tableViewObserver.saveCurrentOffset()
|
|
||||||
timelineItems = context.viewState.items
|
timelineItems = context.viewState.items
|
||||||
}
|
}
|
||||||
.onReceive(tableViewObserver.scrollViewDidRestPublisher) {
|
}
|
||||||
if hasPendingChanges == false {
|
.onReceive(scrollToBottomPublisher) {
|
||||||
return
|
collectionViewObserver.scrollToBottom(animated: true)
|
||||||
}
|
}
|
||||||
|
.onReceive(collectionViewObserver.scrollViewTopVisiblePublisher) { isTopVisible in
|
||||||
tableViewObserver.saveCurrentOffset()
|
if !isTopVisible || context.viewState.isBackPaginating {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
attemptBackPagination()
|
||||||
|
}
|
||||||
|
.onReceive(collectionViewObserver.scrollViewBottomVisiblePublisher) { isBottomVisible in
|
||||||
|
bottomVisiblePublisher.send(isBottomVisible)
|
||||||
|
}
|
||||||
|
.onChange(of: context.viewState.items) { _ in
|
||||||
|
// If the count hasn't changed then don't observe a pagination
|
||||||
|
guard context.viewState.items.count != timelineItems.count else {
|
||||||
timelineItems = context.viewState.items
|
timelineItems = context.viewState.items
|
||||||
hasPendingChanges = false
|
return
|
||||||
}
|
}
|
||||||
.onChange(of: timelineItems) { _ in
|
|
||||||
tableViewObserver.restoreSavedOffset()
|
// Don't update the list while moving
|
||||||
|
if collectionViewObserver.isDecelerating || collectionViewObserver.isTracking {
|
||||||
// Check if there are enough items. Otherwise ask for more
|
hasPendingChanges = true
|
||||||
attemptBackPagination()
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collectionViewObserver.saveCurrentOffset()
|
||||||
|
timelineItems = context.viewState.items
|
||||||
|
}
|
||||||
|
.onReceive(collectionViewObserver.scrollViewDidRestPublisher) {
|
||||||
|
if hasPendingChanges == false {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
collectionViewObserver.saveCurrentOffset()
|
||||||
|
timelineItems = context.viewState.items
|
||||||
|
hasPendingChanges = false
|
||||||
|
}
|
||||||
|
.onChange(of: timelineItems.count) { _ in
|
||||||
|
collectionViewObserver.restoreSavedOffset()
|
||||||
|
|
||||||
|
// Check if there are enough items. Otherwise ask for more
|
||||||
|
attemptBackPagination()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func scrollToBottom(animated: Bool = false) {
|
func scrollToBottom(animated: Bool = false) {
|
||||||
tableViewObserver.scrollToBottom(animated: animated)
|
collectionViewObserver.scrollToBottom(animated: animated)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func attemptBackPagination() {
|
private func attemptBackPagination() {
|
||||||
@@ -138,7 +139,7 @@ struct TimelineItemList: View {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if tableViewObserver.scrollViewTopVisiblePublisher.value == false {
|
if collectionViewObserver.scrollViewTopVisiblePublisher.value == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ final class SessionVerificationCoordinator: Coordinator, Presentable {
|
|||||||
func start() {
|
func start() {
|
||||||
MXLog.debug("Did start.")
|
MXLog.debug("Did start.")
|
||||||
sessionVerificationViewModel.callback = { [weak self] action in
|
sessionVerificationViewModel.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .finished:
|
case .finished:
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVer
|
|||||||
sessionVerificationControllerProxy.callbacks
|
sessionVerificationControllerProxy.callbacks
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak self] callback in
|
.sink { [weak self] callback in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch callback {
|
switch callback {
|
||||||
case .receivedVerificationData(let emojis):
|
case .receivedVerificationData(let emojis):
|
||||||
@@ -95,7 +95,7 @@ class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVer
|
|||||||
|
|
||||||
private func setupStateMachine() {
|
private func setupStateMachine() {
|
||||||
stateMachine.addTransitionHandler { [weak self] context in
|
stateMachine.addTransitionHandler { [weak self] context in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
self.state.verificationState = context.toState
|
self.state.verificationState = context.toState
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
|
|||||||
indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: settingsHostingController)
|
indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: settingsHostingController)
|
||||||
|
|
||||||
settingsViewModel.callback = { [weak self] result in
|
settingsViewModel.callback = { [weak self] result in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
MXLog.debug("SettingsViewModel did complete with result: \(result).")
|
MXLog.debug("SettingsViewModel did complete with result: \(result).")
|
||||||
switch result {
|
switch result {
|
||||||
case .close:
|
case .close:
|
||||||
@@ -105,7 +105,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
|
|||||||
screenshot: nil)
|
screenshot: nil)
|
||||||
let coordinator = BugReportCoordinator(parameters: params)
|
let coordinator = BugReportCoordinator(parameters: params)
|
||||||
coordinator.completion = { [weak self, weak coordinator] in
|
coordinator.completion = { [weak self, weak coordinator] in
|
||||||
guard let self = self, let coordinator = coordinator else { return }
|
guard let self, let coordinator = coordinator else { return }
|
||||||
self.parameters.navigationRouter.popModule(animated: true)
|
self.parameters.navigationRouter.popModule(animated: true)
|
||||||
self.remove(childCoordinator: coordinator)
|
self.remove(childCoordinator: coordinator)
|
||||||
self.showSuccess(label: ElementL10n.done)
|
self.showSuccess(label: ElementL10n.done)
|
||||||
@@ -114,7 +114,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
|
|||||||
add(childCoordinator: coordinator)
|
add(childCoordinator: coordinator)
|
||||||
coordinator.start()
|
coordinator.start()
|
||||||
navigationRouter.push(coordinator, animated: true) { [weak self] in
|
navigationRouter.push(coordinator, animated: true) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
self.remove(childCoordinator: coordinator)
|
self.remove(childCoordinator: coordinator)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ final class SplashScreenCoordinator: Coordinator, Presentable {
|
|||||||
MXLog.debug("Did start.")
|
MXLog.debug("Did start.")
|
||||||
splashScreenViewModel.callback = { [weak self] action in
|
splashScreenViewModel.callback = { [weak self] action in
|
||||||
MXLog.debug("SplashScreenViewModel did complete with result: \(action).")
|
MXLog.debug("SplashScreenViewModel did complete with result: \(action).")
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
switch action {
|
switch action {
|
||||||
case .login:
|
case .login:
|
||||||
self.callback?(.login)
|
self.callback?(.login)
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ struct SplashScreen: View {
|
|||||||
|
|
||||||
/// Stops the animation timer for manual interaction.
|
/// Stops the animation timer for manual interaction.
|
||||||
private func stopTimer() {
|
private func stopTimer() {
|
||||||
guard let pageTimer = pageTimer else { return }
|
guard let pageTimer else { return }
|
||||||
|
|
||||||
self.pageTimer = nil
|
self.pageTimer = nil
|
||||||
pageTimer.invalidate()
|
pageTimer.invalidate()
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class AnalyticsService {
|
|||||||
return .failure(.accountDataFailure)
|
return .failure(.accountDataFailure)
|
||||||
case .success(let settings):
|
case .success(let settings):
|
||||||
// The id has already be set so we are done here.
|
// The id has already be set so we are done here.
|
||||||
if let settings = settings, settings.id != nil {
|
if let settings, settings.id != nil {
|
||||||
return .success(settings)
|
return .success(settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class PostHogAnalyticsClient: AnalyticsClientProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateUserProperties(_ userProperties: AnalyticsEvent.UserProperties) {
|
func updateUserProperties(_ userProperties: AnalyticsEvent.UserProperties) {
|
||||||
guard let pendingUserProperties = pendingUserProperties else {
|
guard let pendingUserProperties else {
|
||||||
pendingUserProperties = userProperties
|
pendingUserProperties = userProperties
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ class OIDCService {
|
|||||||
additionalParameters: nil)
|
additionalParameters: nil)
|
||||||
let result: OIDAuthorizationResponse = try await withCheckedThrowingContinuation { continuation in
|
let result: OIDAuthorizationResponse = try await withCheckedThrowingContinuation { continuation in
|
||||||
self.session = OIDAuthorizationService.present(request, externalUserAgent: userAgent) { response, error in
|
self.session = OIDAuthorizationService.present(request, externalUserAgent: userAgent) { response, error in
|
||||||
guard let response = response else {
|
guard let response else {
|
||||||
if let error = error {
|
if let error {
|
||||||
MXLog.info("User cancelled the ASWebAuthenticationSession window")
|
MXLog.info("User cancelled the ASWebAuthenticationSession window")
|
||||||
continuation.resume(with: .failure(self.isUserCancellationError(error) ? OIDCError.userCancellation : error))
|
continuation.resume(with: .failure(self.isUserCancellationError(error) ? OIDCError.userCancellation : error))
|
||||||
} else {
|
} else {
|
||||||
@@ -136,7 +136,7 @@ extension OIDAuthorizationService {
|
|||||||
originalAuthorizationResponse authorizationResponse: OIDAuthorizationResponse?) async throws -> OIDTokenResponse {
|
originalAuthorizationResponse authorizationResponse: OIDAuthorizationResponse?) async throws -> OIDTokenResponse {
|
||||||
try await withCheckedThrowingContinuation { continuation in
|
try await withCheckedThrowingContinuation { continuation in
|
||||||
perform(request, originalAuthorizationResponse: authorizationResponse) { response, error in
|
perform(request, originalAuthorizationResponse: authorizationResponse) { response, error in
|
||||||
guard let response = response else {
|
guard let response else {
|
||||||
continuation.resume(with: .failure(error ?? OIDCError.unknown))
|
continuation.resume(with: .failure(error ?? OIDCError.unknown))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class UIKitBackgroundTask: BackgroundTaskProtocol {
|
|||||||
|
|
||||||
// attempt to start
|
// attempt to start
|
||||||
identifier = application.beginBackgroundTask(withName: name) { [weak self] in
|
identifier = application.beginBackgroundTask(withName: name) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
self.expirationHandler?(self)
|
self.expirationHandler?(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
|
|||||||
func startBackgroundTask(withName name: String,
|
func startBackgroundTask(withName name: String,
|
||||||
isReusable: Bool,
|
isReusable: Bool,
|
||||||
expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol? {
|
expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol? {
|
||||||
guard let application = application else {
|
guard let application else {
|
||||||
MXLog.verbose("Do not start background task: \(name). Application is nil")
|
MXLog.verbose("Do not start background task: \(name). Application is nil")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
|
|||||||
isReusable: isReusable,
|
isReusable: isReusable,
|
||||||
application: application,
|
application: application,
|
||||||
expirationHandler: { [weak self] task in
|
expirationHandler: { [weak self] task in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
self.reusableTasks[task.name] = nil
|
self.reusableTasks[task.name] = nil
|
||||||
expirationHandler?()
|
expirationHandler?()
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class ScreenshotDetector {
|
|||||||
targetSize: PHImageManagerMaximumSize,
|
targetSize: PHImageManagerMaximumSize,
|
||||||
contentMode: .default,
|
contentMode: .default,
|
||||||
options: PHImageRequestOptions.highQualitySyncLocal) { [weak self] image, _ in
|
options: PHImageRequestOptions.highQualitySyncLocal) { [weak self] image, _ in
|
||||||
guard let image = image else {
|
guard let image else {
|
||||||
self?.fail(withError: ScreenshotDetectorError.loadFailed)
|
self?.fail(withError: ScreenshotDetectorError.loadFailed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ struct MediaProvider: MediaProviderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func imageFromSource(_ source: MediaSource?, avatarSize: AvatarSize?) -> UIImage? {
|
func imageFromSource(_ source: MediaSource?, avatarSize: AvatarSize?) -> UIImage? {
|
||||||
guard let source = source else {
|
guard let source else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
let cacheKey = cacheKeyForURLString(source.underlyingSource.url(), avatarSize: avatarSize)
|
let cacheKey = cacheKeyForURLString(source.underlyingSource.url(), avatarSize: avatarSize)
|
||||||
@@ -39,7 +39,7 @@ struct MediaProvider: MediaProviderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func imageFromURLString(_ urlString: String?, avatarSize: AvatarSize?) -> UIImage? {
|
func imageFromURLString(_ urlString: String?, avatarSize: AvatarSize?) -> UIImage? {
|
||||||
guard let urlString = urlString else {
|
guard let urlString else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ struct MediaProvider: MediaProviderProtocol {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
let imageData = try await Task.detached { () -> Data in
|
let imageData = try await Task.detached { () -> Data in
|
||||||
if let avatarSize = avatarSize {
|
if let avatarSize {
|
||||||
return try await clientProxy.loadMediaThumbnailForSource(source.underlyingSource, width: UInt(avatarSize.scaledValue), height: UInt(avatarSize.scaledValue))
|
return try await clientProxy.loadMediaThumbnailForSource(source.underlyingSource, width: UInt(avatarSize.scaledValue), height: UInt(avatarSize.scaledValue))
|
||||||
} else {
|
} else {
|
||||||
return try await clientProxy.loadMediaContentForSource(source.underlyingSource)
|
return try await clientProxy.loadMediaContentForSource(source.underlyingSource)
|
||||||
@@ -97,7 +97,7 @@ struct MediaProvider: MediaProviderProtocol {
|
|||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
private func cacheKeyForURLString(_ urlString: String, avatarSize: AvatarSize?) -> String {
|
private func cacheKeyForURLString(_ urlString: String, avatarSize: AvatarSize?) -> String {
|
||||||
if let avatarSize = avatarSize {
|
if let avatarSize {
|
||||||
return "\(urlString){\(avatarSize.scaledValue),\(avatarSize.scaledValue)}"
|
return "\(urlString){\(avatarSize.scaledValue),\(avatarSize.scaledValue)}"
|
||||||
} else {
|
} else {
|
||||||
return urlString
|
return urlString
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ struct MockMediaProvider: MediaProviderProtocol {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let avatarSize = avatarSize {
|
if let avatarSize {
|
||||||
switch avatarSize {
|
switch avatarSize {
|
||||||
case .room:
|
case .room:
|
||||||
return Asset.Images.appLogo.image
|
return Asset.Images.appLogo.image
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadDisplayName() async -> Result<String, RoomProxyError> {
|
func loadDisplayName() async -> Result<String, RoomProxyError> {
|
||||||
if let displayName = displayName { return .success(displayName) }
|
if let displayName { return .success(displayName) }
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let displayName = try await Task.dispatch(on: .global()) {
|
let displayName = try await Task.dispatch(on: .global()) {
|
||||||
@@ -176,7 +176,7 @@ class RoomProxy: RoomProxyProtocol {
|
|||||||
|
|
||||||
return await Task.dispatch(on: .global()) {
|
return await Task.dispatch(on: .global()) {
|
||||||
do {
|
do {
|
||||||
if let inReplyToEventId = inReplyToEventId {
|
if let inReplyToEventId {
|
||||||
try self.room.sendReply(msg: message, inReplyToEventId: inReplyToEventId, txnId: transactionId)
|
try self.room.sendReply(msg: message, inReplyToEventId: inReplyToEventId, txnId: transactionId)
|
||||||
} else {
|
} else {
|
||||||
let messageContent = messageEventContentFromMarkdown(md: message)
|
let messageContent = messageEventContentFromMarkdown(md: message)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
|||||||
.callbacks
|
.callbacks
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak self] callback in
|
.sink { [weak self] callback in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch callback {
|
switch callback {
|
||||||
case .updatedMessages:
|
case .updatedMessages:
|
||||||
@@ -248,7 +248,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
|||||||
|
|
||||||
switch await roomProxy.loadAvatarURLForUserId(timelineItem.senderId) {
|
switch await roomProxy.loadAvatarURLForUserId(timelineItem.senderId) {
|
||||||
case .success(let avatarURLString):
|
case .success(let avatarURLString):
|
||||||
guard let avatarURLString = avatarURLString else {
|
guard let avatarURLString else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
|||||||
|
|
||||||
switch await roomProxy.loadDisplayNameForUserId(timelineItem.senderId) {
|
switch await roomProxy.loadDisplayNameForUserId(timelineItem.senderId) {
|
||||||
case .success(let displayName):
|
case .success(let displayName):
|
||||||
guard let displayName = displayName,
|
guard let displayName,
|
||||||
let index = timelineItems.firstIndex(where: { $0.id == timelineItem.id }),
|
let index = timelineItems.firstIndex(where: { $0.id == timelineItem.id }),
|
||||||
var item = timelineItems[index] as? EventBasedTimelineItemProtocol else {
|
var item = timelineItems[index] as? EventBasedTimelineItemProtocol else {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -106,34 +106,34 @@ private extension RoomTimelineProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func replaceItems(_ items: [MatrixRustSDK.TimelineItem]?) {
|
private func replaceItems(_ items: [MatrixRustSDK.TimelineItem]?) {
|
||||||
guard let items = items else { return }
|
guard let items else { return }
|
||||||
itemProxies = items.map(TimelineItemProxy.init)
|
itemProxies = items.map(TimelineItemProxy.init)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func insertItem(_ data: InsertAtData?) {
|
private func insertItem(_ data: InsertAtData?) {
|
||||||
guard let data = data else { return }
|
guard let data else { return }
|
||||||
let itemProxy = TimelineItemProxy(item: data.item)
|
let itemProxy = TimelineItemProxy(item: data.item)
|
||||||
itemProxies.insert(itemProxy, at: Int(data.index))
|
itemProxies.insert(itemProxy, at: Int(data.index))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateItem(_ data: UpdateAtData?) {
|
private func updateItem(_ data: UpdateAtData?) {
|
||||||
guard let data = data else { return }
|
guard let data else { return }
|
||||||
let itemProxy = TimelineItemProxy(item: data.item)
|
let itemProxy = TimelineItemProxy(item: data.item)
|
||||||
itemProxies[Int(data.index)] = itemProxy
|
itemProxies[Int(data.index)] = itemProxy
|
||||||
}
|
}
|
||||||
|
|
||||||
private func removeItem(at index: UInt32?) {
|
private func removeItem(at index: UInt32?) {
|
||||||
guard let index = index else { return }
|
guard let index else { return }
|
||||||
itemProxies.remove(at: Int(index))
|
itemProxies.remove(at: Int(index))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func moveItem(_ data: MoveData?) {
|
private func moveItem(_ data: MoveData?) {
|
||||||
guard let data = data else { return }
|
guard let data else { return }
|
||||||
itemProxies.move(fromOffsets: IndexSet(integer: Int(data.oldIndex)), toOffset: Int(data.newIndex))
|
itemProxies.move(fromOffsets: IndexSet(integer: Int(data.oldIndex)), toOffset: Int(data.newIndex))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func pushItem(_ item: MatrixRustSDK.TimelineItem?) {
|
private func pushItem(_ item: MatrixRustSDK.TimelineItem?) {
|
||||||
guard let item = item else { return }
|
guard let item else { return }
|
||||||
itemProxies.append(TimelineItemProxy(item: item))
|
itemProxies.append(TimelineItemProxy(item: item))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class UserSessionFlowCoordinator: Coordinator {
|
|||||||
|
|
||||||
private func setupStateMachine() {
|
private func setupStateMachine() {
|
||||||
stateMachine.addTransitionHandler { [weak self] context in
|
stateMachine.addTransitionHandler { [weak self] context in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch (context.fromState, context.event, context.toState) {
|
switch (context.fromState, context.event, context.toState) {
|
||||||
case (.initial, .start, .homeScreen):
|
case (.initial, .start, .homeScreen):
|
||||||
@@ -89,7 +89,7 @@ class UserSessionFlowCoordinator: Coordinator {
|
|||||||
let coordinator = HomeScreenCoordinator(parameters: parameters)
|
let coordinator = HomeScreenCoordinator(parameters: parameters)
|
||||||
|
|
||||||
coordinator.callback = { [weak self] action in
|
coordinator.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .presentRoom(let roomIdentifier):
|
case .presentRoom(let roomIdentifier):
|
||||||
@@ -142,7 +142,7 @@ class UserSessionFlowCoordinator: Coordinator {
|
|||||||
|
|
||||||
add(childCoordinator: coordinator)
|
add(childCoordinator: coordinator)
|
||||||
navigationRouter.push(coordinator) { [weak self] in
|
navigationRouter.push(coordinator) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
self.stateMachine.processEvent(.dismissedRoomScreen)
|
self.stateMachine.processEvent(.dismissedRoomScreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ class UserSessionFlowCoordinator: Coordinator {
|
|||||||
bugReportService: bugReportService)
|
bugReportService: bugReportService)
|
||||||
let coordinator = SettingsCoordinator(parameters: parameters)
|
let coordinator = SettingsCoordinator(parameters: parameters)
|
||||||
coordinator.callback = { [weak self] action in
|
coordinator.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
switch action {
|
switch action {
|
||||||
case .dismiss:
|
case .dismiss:
|
||||||
self.dismissSettingsScreen()
|
self.dismissSettingsScreen()
|
||||||
@@ -246,7 +246,7 @@ class UserSessionFlowCoordinator: Coordinator {
|
|||||||
screenshot: image)
|
screenshot: image)
|
||||||
let coordinator = BugReportCoordinator(parameters: parameters)
|
let coordinator = BugReportCoordinator(parameters: parameters)
|
||||||
coordinator.completion = { [weak self, weak coordinator] in
|
coordinator.completion = { [weak self, weak coordinator] in
|
||||||
guard let self = self, let coordinator = coordinator else { return }
|
guard let self, let coordinator = coordinator else { return }
|
||||||
self.navigationRouter.dismissModule(animated: true)
|
self.navigationRouter.dismissModule(animated: true)
|
||||||
self.remove(childCoordinator: coordinator)
|
self.remove(childCoordinator: coordinator)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ targets:
|
|||||||
preBuildScripts:
|
preBuildScripts:
|
||||||
- name: 🛠 SwiftGen
|
- name: 🛠 SwiftGen
|
||||||
runOnlyWhenInstalling: false
|
runOnlyWhenInstalling: false
|
||||||
|
basedOnDependencyAnalysis: false
|
||||||
shell: /bin/sh
|
shell: /bin/sh
|
||||||
script: |
|
script: |
|
||||||
export PATH="$PATH:/opt/homebrew/bin"
|
export PATH="$PATH:/opt/homebrew/bin"
|
||||||
@@ -74,6 +75,7 @@ targets:
|
|||||||
postBuildScripts:
|
postBuildScripts:
|
||||||
- name: ⚠️ SwiftLint
|
- name: ⚠️ SwiftLint
|
||||||
runOnlyWhenInstalling: false
|
runOnlyWhenInstalling: false
|
||||||
|
basedOnDependencyAnalysis: false
|
||||||
shell: /bin/sh
|
shell: /bin/sh
|
||||||
script: |
|
script: |
|
||||||
export PATH="$PATH:/opt/homebrew/bin"
|
export PATH="$PATH:/opt/homebrew/bin"
|
||||||
@@ -84,6 +86,7 @@ targets:
|
|||||||
fi
|
fi
|
||||||
- name: 🧹 SwiftFormat
|
- name: 🧹 SwiftFormat
|
||||||
runOnlyWhenInstalling: false
|
runOnlyWhenInstalling: false
|
||||||
|
basedOnDependencyAnalysis: false
|
||||||
shell: /bin/sh
|
shell: /bin/sh
|
||||||
script: |
|
script: |
|
||||||
export PATH="$PATH:/opt/homebrew/bin"
|
export PATH="$PATH:/opt/homebrew/bin"
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class TestMeasurementParser {
|
|||||||
dup2(pipe.fileHandleForWriting.fileDescriptor, STDERR_FILENO)
|
dup2(pipe.fileHandleForWriting.fileDescriptor, STDERR_FILENO)
|
||||||
|
|
||||||
pipe.fileHandleForReading.readabilityHandler = { [weak self] handle in
|
pipe.fileHandleForReading.readabilityHandler = { [weak self] handle in
|
||||||
guard let self = self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ final class TemplateCoordinator: Coordinator, Presentable {
|
|||||||
func start() {
|
func start() {
|
||||||
MXLog.debug("Did start.")
|
MXLog.debug("Did start.")
|
||||||
templateViewModel.callback = { [weak self] action in
|
templateViewModel.callback = { [weak self] action in
|
||||||
guard let self = self else { return }
|
guard let self else { return }
|
||||||
MXLog.debug("TemplateViewModel did complete with result: \(action).")
|
MXLog.debug("TemplateViewModel did complete with result: \(action).")
|
||||||
switch action {
|
switch action {
|
||||||
case .accept:
|
case .accept:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ extension XCUIApplication {
|
|||||||
named: identifier.rawValue,
|
named: identifier.rawValue,
|
||||||
testName: testName)
|
testName: testName)
|
||||||
|
|
||||||
if let failure = failure,
|
if let failure,
|
||||||
!failure.contains("No reference was found on disk."),
|
!failure.contains("No reference was found on disk."),
|
||||||
!failure.contains("to test against the newly-recorded snapshot") {
|
!failure.contains("to test against the newly-recorded snapshot") {
|
||||||
XCTFail(failure)
|
XCTFail(failure)
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ class AttributedStringBuilderTests: XCTestCase {
|
|||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
private func checkMatrixEntityLinkIn(attributedString: AttributedString?, expected: String) {
|
private func checkMatrixEntityLinkIn(attributedString: AttributedString?, expected: String) {
|
||||||
guard let attributedString = attributedString else {
|
guard let attributedString else {
|
||||||
XCTFail("Could not build the attributed string")
|
XCTFail("Could not build the attributed string")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class ScreenshotDetectorTests: XCTestCase {
|
|||||||
XCTAssertNil(image)
|
XCTAssertNil(image)
|
||||||
|
|
||||||
// and get an error
|
// and get an error
|
||||||
guard let error = error else {
|
guard let error else {
|
||||||
XCTFail("Should get an error")
|
XCTFail("Should get an error")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ class ScreenshotDetectorTests: XCTestCase {
|
|||||||
XCTAssertNil(image)
|
XCTAssertNil(image)
|
||||||
|
|
||||||
// and get an error
|
// and get an error
|
||||||
guard let error = error else {
|
guard let error else {
|
||||||
XCTFail("Should get an error")
|
XCTFail("Should get an error")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class SessionVerificationViewModelTests: XCTestCase {
|
|||||||
XCTAssertEqual(context.viewState.verificationState, .requestingVerification)
|
XCTAssertEqual(context.viewState.verificationState, .requestingVerification)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testVerificationCancellation() async {
|
func testVerificationCancellation() async throws {
|
||||||
XCTAssertEqual(context.viewState.verificationState, .initial)
|
XCTAssertEqual(context.viewState.verificationState, .initial)
|
||||||
|
|
||||||
context.send(viewAction: .start)
|
context.send(viewAction: .start)
|
||||||
@@ -53,7 +53,7 @@ class SessionVerificationViewModelTests: XCTestCase {
|
|||||||
|
|
||||||
XCTAssertEqual(context.viewState.verificationState, .cancelling)
|
XCTAssertEqual(context.viewState.verificationState, .cancelling)
|
||||||
|
|
||||||
await Task.yield()
|
try await Task.sleep(nanoseconds: 100_000_000)
|
||||||
|
|
||||||
XCTAssertEqual(context.viewState.verificationState, .cancelled)
|
XCTAssertEqual(context.viewState.verificationState, .cancelled)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Build with Xcode 14.0 and fix introspection on the timeline List.
|
||||||
+1
-1
@@ -2,7 +2,7 @@ require 'yaml'
|
|||||||
require_relative 'changelog'
|
require_relative 'changelog'
|
||||||
|
|
||||||
before_all do
|
before_all do
|
||||||
xcversion(version: "~> 13.4")
|
xcversion(version: "~> 14.0")
|
||||||
end
|
end
|
||||||
|
|
||||||
lane :alpha do
|
lane :alpha do
|
||||||
|
|||||||
+2
-3
@@ -4,14 +4,13 @@ attributes:
|
|||||||
|
|
||||||
fileGroups:
|
fileGroups:
|
||||||
- project.yml
|
- project.yml
|
||||||
- changelog.d
|
|
||||||
|
|
||||||
options:
|
options:
|
||||||
groupSortPosition: bottom
|
groupSortPosition: bottom
|
||||||
createIntermediateGroups: true
|
createIntermediateGroups: true
|
||||||
deploymentTarget:
|
deploymentTarget:
|
||||||
iOS: "15.0"
|
iOS: "16.0"
|
||||||
macOS: "12.0"
|
macOS: "13.0"
|
||||||
groupOrdering:
|
groupOrdering:
|
||||||
- order: [ElementX, UnitTests, UITests, IntegrationTests, Tools]
|
- order: [ElementX, UnitTests, UITests, IntegrationTests, Tools]
|
||||||
- pattern: ElementX
|
- pattern: ElementX
|
||||||
|
|||||||
Reference in New Issue
Block a user