Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/vector-im/element-x-ios
Browse files Browse the repository at this point in the history
…into mauroromito/knocked_preview_implementation

# Conflicts:
#	ElementX/Sources/Screens/JoinRoomScreen/View/JoinRoomScreen.swift
  • Loading branch information
Velin92 committed Oct 24, 2024
2 parents 724bfa7 + 7d373c0 commit 0afc3c7
Show file tree
Hide file tree
Showing 51 changed files with 92 additions and 92 deletions.
6 changes: 2 additions & 4 deletions ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7466,9 +7466,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER)";
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 1.9.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -7543,9 +7542,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER)";
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 1.9.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Application/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
// The user will log out, clear any existing notifications and unregister from receving new ones
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
UIApplication.shared.applicationIconBadgeNumber = 0
UNUserNotificationCenter.current().setBadgeCount(0)

unregisterForRemoteNotifications()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,15 @@ private struct NavigationSplitCoordinatorView: View {
}
// Handle `horizontalSizeClass` changes breaking the navigation bar
// https://github.com/element-hq/element-x-ios/issues/617
.onChange(of: horizontalSizeClass) { value in
.onChange(of: horizontalSizeClass) { _, newValue in
guard scenePhase != .background else {
return
}

isInSplitMode = value == .regular
isInSplitMode = newValue == .regular
}
.onChange(of: scenePhase) { value in
guard value == .active else {
.onChange(of: scenePhase) { _, newValue in
guard newValue == .active else {
return
}

Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Other/Pills/PillView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct PillView: View {
.padding(.trailing, 6)
.padding(.vertical, 1)
.background { Capsule().foregroundColor(backgroundColor) }
.onChange(of: context.viewState.displayText) { _ in
.onChange(of: context.viewState.displayText) {
didChangeText()
}
}
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Other/SwiftUI/Search.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ struct IsSearchingModifier: ViewModifier {

func body(content: Content) -> some View {
content
.onChange(of: isSearchingEnv) { isSearching = $0 }
.onChange(of: isSearchingEnv) { isSearching = $1 }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct AppLockScreen: View {
pinInputField
.padding(.bottom, 16)
.offset(x: pinInputFieldOffset)
.onChange(of: context.viewState.numberOfPINAttempts) { newValue in
.onChange(of: context.viewState.numberOfPINAttempts) { _, newValue in
guard newValue > 0 else { return } // Reset without animation in Previews.
accessibilitySubtitleFocus = true
Task { await animatePINFailure() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct PINTextField: View {
.textFieldStyle(PINTextFieldStyle(pinCode: pinCode, isSecure: isSecure, maxLength: maxLength, size: size))
.keyboardType(.numberPad)
.accessibilityIdentifier(A11yIdentifiers.appLockSetupPINScreen.textField)
.onChange(of: pinCode) { newValue in
.onChange(of: pinCode) { _, newValue in
let sanitized = sanitize(newValue)
if sanitized != newValue {
MXLog.warning("PIN code input sanitized.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct AppLockSetupSettingsScreen: View {
Section {
ListRow(label: .plain(title: context.viewState.enableBiometricsTitle),
kind: .toggle($context.enableBiometrics))
.onChange(of: context.enableBiometrics) { _ in
.onChange(of: context.enableBiometrics) {
context.send(viewAction: .enableBiometricsChanged)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ struct LoginScreen: View {
.textContentType(.username)
.autocapitalization(.none)
.submitLabel(.next)
.onChange(of: isUsernameFocused, perform: usernameFocusChanged)
.onChange(of: isUsernameFocused) { _, newValue in
usernameFocusChanged(isFocussed: newValue)
}
.onSubmit { isPasswordFocused = true }
.padding(.bottom, 20)

Expand Down Expand Up @@ -135,19 +137,19 @@ struct LoginScreen_Previews: PreviewProvider, TestablePreview {
LoginScreen(context: viewModel.context)
}
.previewDisplayName("matrix.org")
.snapshotPreferences(delay: 0.1)
.snapshotPreferences(delay: 1)

NavigationStack {
LoginScreen(context: credentialsViewModel.context)
}
.previewDisplayName("Credentials Entered")
.snapshotPreferences(delay: 0.1)
.snapshotPreferences(delay: 1)

NavigationStack {
LoginScreen(context: unconfiguredViewModel.context)
}
.previewDisplayName("Unsupported")
.snapshotPreferences(delay: 0.1)
.snapshotPreferences(delay: 1)
}

static func makeViewModel(homeserverAddress: String = "matrix.org", withCredentials: Bool = false) -> LoginScreenViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ServerSelectionScreen: View {
.keyboardType(.URL)
.autocapitalization(.none)
.disableAutocorrection(true)
.onChange(of: context.homeserverAddress) { _ in context.send(viewAction: .clearFooterError) }
.onChange(of: context.homeserverAddress) { context.send(viewAction: .clearFooterError) }
.submitLabel(.done)
.onSubmit(submit)

Expand Down Expand Up @@ -107,7 +107,7 @@ struct ServerSelection_Previews: PreviewProvider, TestablePreview {
NavigationStack {
ServerSelectionScreen(context: invalidViewModel.context)
}
.snapshotPreferences(delay: 0.25)
.snapshotPreferences(delay: 1)
}

static func makeViewModel(for homeserverAddress: String) -> ServerSelectionScreenViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct BugReportScreen: View {
.navigationBarTitleDisplayMode(.inline)
.toolbar { toolbar }
.interactiveDismissDisabled()
.onChange(of: selectedScreenshot) { newItem in
.onChange(of: selectedScreenshot) { _, newItem in
Task {
guard let data = try? await newItem?.loadTransferable(type: Data.self),
let image = UIImage(data: data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ struct PollFormScreen: View {
}
.focused($focus, equals: .option(index: index))
.accessibilityIdentifier(A11yIdentifiers.pollFormScreen.optionID(index))
.onChange(of: context.options[index].text) { optionText in
guard let lastCharacter = optionText.last, lastCharacter.isNewline else {
.onChange(of: context.options[index].text) { _, newOptionText in
guard let lastCharacter = newOptionText.last, lastCharacter.isNewline else {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct EmojiPickerScreen: View {
}
.presentationDetents([.medium, .large])
.presentationDragIndicator(isSearching ? .hidden : .visible)
.onChange(of: searchString) { _ in
.onChange(of: searchString) {
context.send(viewAction: .search(searchString: searchString))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct GlobalSearchScreen: View {
selectedRoom = context.viewState.rooms.first
searchFieldFocus = true
}
.onChange(of: context.viewState.rooms) { _ in
.onChange(of: context.viewState.rooms) {
selectedRoom = context.viewState.rooms.first
}
.onTapGesture {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ struct HomeScreenContent: View {
.onReceive(scrollViewAdapter.isScrolling) { _ in
updateVisibleRange()
}
.onChange(of: context.searchQuery) { _ in
.onChange(of: context.searchQuery) {
updateVisibleRange()
}
.onChange(of: context.viewState.visibleRooms) { _ in
.onChange(of: context.viewState.visibleRooms) {
updateVisibleRange()

// We have been seeing a lot of issues around the room list not updating properly after
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct InviteUsersScreen: View {
.frame(width: cellWidth)
}
}
.onChange(of: context.viewState.scrollToLastID) { lastAddedID in
.onChange(of: context.viewState.scrollToLastID) { _, lastAddedID in
guard let id = lastAddedID else { return }
withElementAnimation(.easeInOut) {
scrollView.scrollTo(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ struct JoinRoomScreen: View {
VStack(alignment: .leading, spacing: 12) {
HStack(spacing: 0) {
TextField("", text: $context.knockMessage, axis: .vertical)
.onChange(of: context.knockMessage) { newValue in
context.knockMessage = String(newValue.prefix(500))
.onChange(of: context.knockMessage) { _, newValue in
context.knockMessage = String(newValue.prefix(1000))
}
.lineLimit(4, reservesSpace: true)
.font(.compound.bodyMD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct IdentityConfirmationScreen_Previews: PreviewProvider, TestablePreview {
NavigationStack {
IdentityConfirmationScreen(context: viewModel.context)
}
.snapshotPreferences(delay: 0.25)
.snapshotPreferences(delay: 1)
}

private static var viewModel: IdentityConfirmationScreenViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ struct RoomChangeRolesScreen: View {
.frame(width: cellWidth)
}
}
.onChange(of: context.viewState.lastPromotedMember) { member in
guard let member else { return }
.onChange(of: context.viewState.lastPromotedMember) { _, newValue in
guard let member = newValue else { return }
withElementAnimation(.easeInOut) {
scrollView.scrollTo(member.id)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct RoomDetailsScreen: View {
ListRow(label: .default(title: L10n.commonFavourite, icon: \.favourite),
kind: .toggle($context.isFavourite))
.accessibilityIdentifier(A11yIdentifiers.roomDetailsScreen.favourite)
.onChange(of: context.isFavourite) { newValue in
.onChange(of: context.isFavourite) { _, newValue in
context.send(viewAction: .toggleFavourite(isFavourite: newValue))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct RoomNotificationSettingsScreen: View {
kind: .toggle($context.allowCustomSetting))
.accessibilityIdentifier(A11yIdentifiers.roomNotificationSettingsScreen.allowCustomSetting)
.disabled(context.viewState.notificationSettingsState.isLoading)
.onChange(of: context.allowCustomSetting) { _ in
.onChange(of: context.allowCustomSetting) {
context.send(viewAction: .changedAllowCustomSettings)
}
} footer: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ struct RoomPollsHistoryScreen: View {
}
.pickerStyle(.segmented)
.readableFrame(maxWidth: 475)
.onChange(of: context.filter) { value in
context.send(viewAction: .filter(value))
.onChange(of: context.filter) { _, newValue in
context.send(viewAction: .filter(newValue))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,18 @@ struct ComposerToolbar: View {
guard !composerFocused else { return }
composerFocused = true
}
.onChange(of: context.composerFocused) { newValue in
.onChange(of: context.composerFocused) { _, newValue in
guard composerFocused != newValue else { return }

composerFocused = newValue
}
.onChange(of: composerFocused) { newValue in
.onChange(of: composerFocused) { _, newValue in
context.composerFocused = newValue
}
.onChange(of: context.plainComposerText) { _ in
.onChange(of: context.plainComposerText) {
context.send(viewAction: .plainComposerTextChanged)
}
.onChange(of: context.composerFormattingEnabled) { _ in
.onChange(of: context.composerFormattingEnabled) {
context.send(viewAction: .didToggleFormattingOptions)
}
.onAppear {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ struct VoiceMessagePreviewComposer: View {
showCursor: playerState.showProgressIndicator,
onSeek: onSeek)
}
.onChange(of: isDragging) { isDragging in
onScrubbing(isDragging)
.onChange(of: isDragging) { _, newValue in
onScrubbing(newValue)
}
.padding(.vertical, 4.0)
.padding(.horizontal, 6.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct SwipeRightAction<Label: View>: ViewModifier {
.offset(x: xOffset, y: 0.0)
.animation(.interactiveSpring().speed(0.5), value: xOffset)
.timelineGesture(gesture)
.onChange(of: dragGestureActive) { value in
if value == true {
.onChange(of: dragGestureActive) { _, newValue in
if newValue == true {
if shouldStartAction() {
feedbackGenerator.prepare()
canStartAction = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct SecureBackupRecoveryKeyScreen: View {
ScrollViewReader { reader in
mainContent
.padding(16)
.onChange(of: focused) { newValue in
.onChange(of: focused) { _, newValue in
guard newValue == true else { return }
reader.scrollTo(textFieldIdentifier)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct AnalyticsSettingsScreen: View {
Section {
ListRow(label: .plain(title: L10n.screenAnalyticsSettingsShareData),
kind: .toggle($context.enableAnalytics))
.onChange(of: context.enableAnalytics) { _ in
.onChange(of: context.enableAnalytics) {
context.send(viewAction: .toggleAnalytics)
}
} footer: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct NotificationSettingsScreen: View {
Section {
ListRow(label: .plain(title: L10n.screenNotificationSettingsEnableNotifications),
kind: .toggle($context.enableNotifications))
.onChange(of: context.enableNotifications) { _ in
.onChange(of: context.enableNotifications) {
context.send(viewAction: .changedEnableNotifications)
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ struct NotificationSettingsScreen: View {
kind: .toggle($context.roomMentionsEnabled))
.disabled(context.viewState.settings?.roomMentionsEnabled == nil)
.allowsHitTesting(!context.viewState.applyingChange)
.onChange(of: context.roomMentionsEnabled) { _ in
.onChange(of: context.roomMentionsEnabled) {
context.send(viewAction: .roomMentionChanged)
}
} header: {
Expand All @@ -143,7 +143,7 @@ struct NotificationSettingsScreen: View {
kind: .toggle($context.callsEnabled))
.disabled(context.viewState.settings?.callsEnabled == nil)
.allowsHitTesting(!context.viewState.applyingChange)
.onChange(of: context.callsEnabled) { _ in
.onChange(of: context.callsEnabled) {
context.send(viewAction: .callsChanged)
}
} header: {
Expand All @@ -158,7 +158,7 @@ struct NotificationSettingsScreen: View {
kind: .toggle($context.invitationsEnabled))
.disabled(context.viewState.settings?.invitationsEnabled == nil)
.allowsHitTesting(!context.viewState.applyingChange)
.onChange(of: context.invitationsEnabled) { _ in
.onChange(of: context.invitationsEnabled) {
context.send(viewAction: .invitationsChanged)
}
} header: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,12 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
.previewDisplayName("Replies")
threads
.previewDisplayName("Thread decorator")
.snapshotPreferences(delay: 1)
encryptionAuthenticity
.previewDisplayName("Encryption Indicators")
pinned
.previewDisplayName("Pinned messages")
.snapshotPreferences(delay: 2.0)
.snapshotPreferences(delay: 1)
}

static var mockTimeline: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct TimelineStyler<Content: View>: View {

var body: some View {
mainContent
.onChange(of: timelineItem.properties.deliveryStatus) { newStatus in
.onChange(of: timelineItem.properties.deliveryStatus) { _, newStatus in
if case .sendingFailed = newStatus {
guard task == nil else {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct ReactionsSummaryView: View {
scrollView.scrollTo(selectedReactionKey)
}
}
.onChange(of: selectedReactionKey) { _ in
.onChange(of: selectedReactionKey) {
scrollView.scrollTo(selectedReactionKey)
}
}
Expand Down
Loading

0 comments on commit 0afc3c7

Please sign in to comment.