Skip to content

Commit 4f46fb1

Browse files
committed
Profile edit improvements
1 parent fffd63a commit 4f46fb1

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Modules/Sources/ProfileFeature/Edit/EditFeature.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ public struct EditFeature: Reducer, Sendable {
9595
case onAppear
9696
case avatarSelected(Data)
9797
case deleteAvatar
98-
case avatarBadWidthHeight
99-
case avatarBadFileSizeTooBig
98+
99+
case onAvatarBadFileSizeProvided
100+
case onAvatarBadWidthHeightProvided
100101

101102
case wipeBirthdayDate
102103
case setBirthdayDate
@@ -145,13 +146,13 @@ public struct EditFeature: Reducer, Sendable {
145146
case .view(.deleteAvatar):
146147
let empty = Data()
147148
return .send(.internal(.updateAvatar(empty)))
148-
149-
case .view(.avatarBadWidthHeight):
150-
return showToast(ToastMessage(text: Localization.avatarWidthHeightError, haptic: .error))
151149

152-
case .view(.avatarBadFileSizeTooBig):
150+
case .view(.onAvatarBadFileSizeProvided):
153151
return showToast(ToastMessage(text: Localization.avatarFileSizeError, haptic: .error))
154152

153+
case .view(.onAvatarBadWidthHeightProvided):
154+
return showToast(ToastMessage(text: Localization.avatarWidthHeightError, haptic: .error))
155+
155156
case .view(.setBirthdayDate):
156157
state.birthdayDate = state.draftUser.birthdayDate ?? Date()
157158
return .none

Modules/Sources/ProfileFeature/Edit/EditScreen.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,14 @@ public struct EditScreen: View {
247247
return
248248
}
249249

250-
if data.count <= 32768 {
250+
if data.count <= 32768 /* should be max 32kb size */ {
251251
if image.size.width <= 100, image.size.height <= 100 {
252252
send(.avatarSelected(data))
253253
} else {
254-
send(.avatarBadWidthHeight)
254+
send(.onAvatarBadWidthHeightProvided)
255255
}
256256
} else {
257-
send(.avatarBadFileSizeTooBig)
257+
send(.onAvatarBadFileSizeProvided)
258258
}
259259

260260
// Drop last selected avatar.

0 commit comments

Comments
 (0)