Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ struct BackupImportFlowView: View {
.foregroundStyle(Color.red)
}
}
.animation(.easeOut, value: viewModel.importState)
.animation(.easeOut, value: viewModel.payloadState)
.animation(.snappy, value: viewModel.importState)
.animation(.snappy, value: viewModel.payloadState)
.navigationTitle(Text("Import"))
.navigationBarTitleDisplayMode(.inline)
.navigationDestination(for: VaultApplicationPayload.self) { payload in
Expand Down Expand Up @@ -177,8 +177,8 @@ struct BackupImportFlowView: View {
successSection
}
}
.animation(.easeOut, value: viewModel.importState)
.animation(.easeOut, value: viewModel.payloadState)
.animation(.snappy, value: viewModel.importState)
.animation(.snappy, value: viewModel.payloadState)
.toolbar {
if viewModel.importState.isFinished {
ToolbarItem(placement: .primaryAction) {
Expand Down
4 changes: 2 additions & 2 deletions Vault/Sources/VaultiOS/Views/Backup/BackupKeyChangeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct BackupKeyChangeView: View {
.navigationTitle(Text("Backup Password"))
.navigationBarTitleDisplayMode(.inline)
.interactiveDismissDisabled(viewModel.newPassword.isLoading)
.animation(.easeOut, value: viewModel.newlyEnteredPassword.isNotEmpty)
.animation(.snappy, value: viewModel.newlyEnteredPassword.isNotEmpty)
.task {
await viewModel.onAppear()
}
Expand Down Expand Up @@ -113,7 +113,7 @@ struct BackupKeyChangeView: View {
} footer: {
Text("Enter a new password to generate an encryption key.")
}
.animation(.easeOut, value: viewModel.newlyEnteredPassword)
.animation(.snappy, value: viewModel.newlyEnteredPassword)
}

// MARK: - Generate Section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ struct BackupKeyDecryptorView: View {
}
.disabled(!viewModel.canAttemptDecryption || viewModel.isDecrypting)
}
.animation(.easeOut, value: viewModel.canAttemptDecryption)
.animation(.snappy, value: viewModel.canAttemptDecryption)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct EncryptedItemDetailView: View {
}
.disabled(!viewModel.canStartDecryption)
}
.animation(.easeOut, value: viewModel.state)
.animation(.snappy, value: viewModel.state)
}

private func decryptRow(@ViewBuilder content: @escaping () -> some View) -> some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct OTPCodeDetailView<PreviewGenerator: VaultItemPreviewViewGenerator<VaultIt
}
}
}
.animation(.easeOut, value: viewModel.editingModel.detail.viewConfig)
.animation(.snappy, value: viewModel.editingModel.detail.viewConfig)
.sheet(item: $modal, onDismiss: nil, content: { item in
switch item {
case .editLock:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct SecureNoteDetailView: View {
}
}
.ignoresSafeArea(.keyboard)
.animation(.easeOut, value: viewModel.editingModel.detail.viewConfig)
.animation(.snappy, value: viewModel.editingModel.detail.viewConfig)
.onChange(of: selectedColor.hashValue) { _, _ in
viewModel.editingModel.detail.color = VaultItemColor(color: selectedColor)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct VaultDetailKillphraseEditView: View {
titleSection
optionSection
}
.animation(.easeOut, value: killphraseEnabled)
.animation(.snappy, value: killphraseEnabled)
.transition(.move(edge: .top))
.onChange(of: killphraseEnabled) { _, newValue in
if !newValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct VaultDetailLockEditView: View {
titleSection
optionSection
}
.animation(.easeOut, value: lockState)
.animation(.snappy, value: lockState)
.transition(.move(edge: .top))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct VaultDetailNotePreviewEditView: View {
titleSection
optionSection
}
.animation(.easeOut, value: previewMode)
.animation(.snappy, value: previewMode)
.transition(.move(edge: .top))
.onAppear {
if !availableModes.contains(previewMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct VaultDetailPassphraseEditView: View {
titleSection
optionSection
}
.animation(.easeOut, value: viewConfig.isEnabled)
.animation(.snappy, value: viewConfig.isEnabled)
.transition(.move(edge: .top))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct VaultItemDetailView<ChildViewModel: DetailViewModel, ContentsView: View>:
.navigationTitle(viewModel.strings.title)
.navigationBarTitleDisplayMode(.inline)
.interactiveDismissDisabled(viewModel.editingModel.isDirty)
.animation(.easeOut, value: viewModel.isInEditMode)
.animation(.snappy, value: viewModel.isInEditMode)
.onReceive(viewModel.isFinishedPublisher()) {
dismiss()
}
Expand Down
2 changes: 1 addition & 1 deletion Vault/Sources/VaultiOS/Views/Feed/VaultItemFeedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public struct VaultItemFeedView<
.scrollTargetLayout()
.padding(.horizontal)
.padding(.bottom)
.animation(.easeOut(duration: 0.1), value: dataModel.itemsFilteringByTags)
.animation(.snappy, value: dataModel.itemsFilteringByTags)
} else {
ContentUnavailableView {
Label(localized(key: "codeFeed.noCodes.title"), systemImage: "key.horizontal")
Expand Down
22 changes: 21 additions & 1 deletion Vault/Sources/VaultiOS/Views/General/Shimmer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,33 @@ extension View {
bandSize: CGFloat = 0.3,
) -> some View {
if active {
modifier(Shimmer(animation: animation, gradient: gradient, bandSize: bandSize))
modifier(ShimmerIfMotionAllowed(animation: animation, gradient: gradient, bandSize: bandSize))
} else {
self
}
}
}

/// Applies ``Shimmer`` only when the system is not asking for reduced motion.
///
/// The shimmer repeats forever, and is applied to every card in the feed at once while
/// editing, so it is exactly the kind of motion Reduce Motion exists to suppress.
private struct ShimmerIfMotionAllowed: ViewModifier {
var animation: Animation
var gradient: Gradient
var bandSize: CGFloat

@Environment(\.accessibilityReduceMotion) private var reduceMotion

func body(content: Content) -> some View {
if reduceMotion {
content
} else {
content.modifier(Shimmer(animation: animation, gradient: gradient, bandSize: bandSize))
}
}
}

#Preview("Scenarios", traits: .sizeThatFitsLayout) {
Group {
Text("SwiftUI Shimmer").preferredColorScheme(.light)
Expand Down
2 changes: 1 addition & 1 deletion Vault/Sources/VaultiOS/Views/General/TagPillView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct TagPillView: View {
.fill(tag.fillColor(isSelected: isSelected))
.stroke(tag.strokeColor(isSelected: isSelected), lineWidth: 1),
)
.foregroundColor(tag.strokeColor(isSelected: isSelected))
.foregroundStyle(tag.strokeColor(isSelected: isSelected))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ struct HOTPCodePreviewView<ButtonView: View>: View {
timerSection
}
.padding(16)
.animation(.easeOut, value: behaviour)
.animation(.easeOut, value: canLoadNextCode)
.animation(.snappy, value: behaviour)
.animation(.snappy, value: canLoadNextCode)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.aspectRatio(1, contentMode: .fill)
.shimmering(active: isEditing)
Expand Down Expand Up @@ -104,7 +104,7 @@ struct HOTPCodePreviewView<ButtonView: View>: View {
.fontWeight(.heavy)
.minimumScaleFactor(0.5)
.lineLimit(1)
.foregroundColor(isEditing ? .white : .primary)
.foregroundStyle(isEditing ? .white : .primary)
.frame(maxWidth: .infinity, alignment: .leading)
}

Expand All @@ -121,7 +121,7 @@ struct HOTPCodePreviewView<ButtonView: View>: View {
buttonView
.disabled(!canLoadNextCode)
}
.animation(.easeOut, value: canLoadNextCode)
.animation(.snappy, value: canLoadNextCode)
}

private var canLoadNextCode: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct OTPCodeButtonView: View {
}
.foregroundStyle(viewModel.incrementError != nil ? .red : .accentColor)
.disabled(isDisabled)
.animation(.easeOut, value: isDisabled)
.animation(.snappy, value: isDisabled)
}

var isDisabled: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct TOTPCodePreviewView<TimerBar: View>: View {
.clipShape(RoundedRectangle(cornerRadius: 6))
}
.padding(16)
.animation(.easeOut, value: behaviour)
.animation(.snappy, value: behaviour)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.aspectRatio(1, contentMode: .fill)
.shimmering(active: isEditing)
Expand Down Expand Up @@ -94,7 +94,7 @@ struct TOTPCodePreviewView<TimerBar: View>: View {
.fontWeight(.heavy)
.minimumScaleFactor(0.5)
.lineLimit(1)
.foregroundColor(isEditing ? .white : .primary)
.foregroundStyle(isEditing ? .white : .primary)
.frame(maxWidth: .infinity, alignment: .leading)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import SwiftUI
struct PreviewErrorIcon: View {
var body: some View {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.red)
.foregroundStyle(.red)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct VaultCardModifier: ViewModifier {

private var backgroundColor: Color {
switch configuration.style {
case .prominent: Color.blue
case .prominent: Color.accentColor
case .secondary: Color(UIColor.secondarySystemBackground)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ struct ThirdPartyLibraryRowView: View {
VStack(alignment: .leading, spacing: 2) {
Text(library.name)
.font(.body)
.foregroundColor(.primary)
.foregroundStyle(.primary)
.lineLimit(1)
Text(library.url.absoluteString)
.font(.caption)
.foregroundColor(.secondary)
.foregroundStyle(.secondary)
.lineLimit(1)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct CodeStateTimerBarView<Timer: View>: View {
.shimmering(active: isShimmering)
}
}
.animation(.easeOut, value: behaviour)
.animation(.snappy, value: behaviour)
}

private var isShimmering: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import VaultFeed
@MainActor
struct CodeTimerHorizontalBarView: View {
var timerState: OTPCodeTimerPeriodState
var color: Color = .blue
var backgroundColor: Color = .init(UIColor.systemGray2).opacity(0.3)
var color: Color = .accentColor
var backgroundColor: Color = .init(.quaternarySystemFill)

@State private var currentFractionCompleted = 1.0
@Environment(\.scenePhase) private var scenePhase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwiftUI
struct HorizontalTimerProgressBarView: View {
var fractionCompleted: Double
var color: Color
var backgroundColor: Color = .init(UIColor.systemGray6)
var backgroundColor: Color = .init(.quaternarySystemFill)

@Environment(\.redactionReasons) private var redactionReasons

Expand Down
2 changes: 1 addition & 1 deletion Vault/Sources/VaultiOSShared/OTPCodeTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct OTPCodeTextView: View {
.transition(.blurReplace(.downUp))
case let .error(_, digits):
placeholderCode(digits: digits)
.foregroundColor(.red)
.foregroundStyle(.red)
.transition(.blurReplace(.downUp))
case let .visible(code):
makeCodeView(text: code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct OTPWidgetSmallView: View {
.fontWeight(.heavy)
.minimumScaleFactor(0.5)
.lineLimit(1)
.foregroundColor(.primary)
.foregroundStyle(.primary)
.frame(maxWidth: .infinity, alignment: .leading)
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.