Skip to content

Commit 2d8fd81

Browse files
committed
IOS-5229 disable empty type names
1 parent 8f55bf1 commit 2d8fd81

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Anytype/Sources/PresentationLayer/ObjectTypeSearch/NewTypeCreation/ObjectTypeInfoView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,10 @@ struct ObjectTypeInfoView: View {
118118
switch model.mode {
119119
case .create:
120120
StandardButton(Loc.create, style: .primaryLarge) { model.onSaveTap() }
121+
.disabled(!model.isCreateButtonEnabled)
121122
case .edit:
122123
StandardButton(Loc.save, style: .primaryLarge) { model.onSaveTap() }
124+
.disabled(!model.isCreateButtonEnabled)
123125
case .preview:
124126
EmptyView()
125127
}

Anytype/Sources/PresentationLayer/ObjectTypeSearch/NewTypeCreation/ObjectTypeInfoViewModel.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ final class ObjectTypeInfoViewModel: ObservableObject {
1515
return ObjectIcon.customIcon(CustomIconData(icon: icon, customColor: color ?? .default))
1616
}
1717
var isRemoveIconButtonAvailable: Bool { icon.isNotNil }
18-
18+
var isCreateButtonEnabled: Bool { !name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }
19+
1920
var dismiss: DismissAction?
2021

2122
let mode: ObjectTypeInfoViewMode

0 commit comments

Comments
 (0)