File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Modules/Sources/ProfileFeature/Edit Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments