@@ -21,14 +21,14 @@ public class MessageComposerViewModel: ObservableObject {
21
21
}
22
22
}
23
23
}
24
-
24
+
25
25
@Published private( set) var imageAssets : PHFetchResult < PHAsset > ?
26
26
@Published private( set) var addedAssets = [ AddedAsset] ( ) {
27
27
didSet {
28
28
checkPickerSelectionState ( )
29
29
}
30
30
}
31
-
31
+
32
32
@Published var text = " " {
33
33
didSet {
34
34
if text != " " {
@@ -43,12 +43,13 @@ public class MessageComposerViewModel: ObservableObject {
43
43
checkPickerSelectionState ( )
44
44
}
45
45
}
46
+
46
47
@Published var addedCustomAttachments = [ CustomAttachment] ( ) {
47
48
didSet {
48
49
checkPickerSelectionState ( )
49
50
}
50
51
}
51
-
52
+
52
53
@Published var pickerTypeState : PickerTypeState = . expanded( . none) {
53
54
didSet {
54
55
switch pickerTypeState {
@@ -59,7 +60,7 @@ public class MessageComposerViewModel: ObservableObject {
59
60
}
60
61
}
61
62
}
62
-
63
+
63
64
@Published private( set) var overlayShown = false {
64
65
didSet {
65
66
if overlayShown == true {
@@ -93,7 +94,7 @@ public class MessageComposerViewModel: ObservableObject {
93
94
}
94
95
95
96
attachments += addedCustomAttachments. map { attachment in
96
- return attachment. content
97
+ attachment. content
97
98
}
98
99
99
100
channelController. createNewMessage (
@@ -119,9 +120,9 @@ public class MessageComposerViewModel: ObservableObject {
119
120
120
121
public var sendButtonEnabled : Bool {
121
122
!addedAssets. isEmpty ||
122
- !text. isEmpty ||
123
- !addedFileURLs. isEmpty ||
124
- !addedCustomAttachments. isEmpty
123
+ !text. isEmpty ||
124
+ !addedFileURLs. isEmpty ||
125
+ !addedCustomAttachments. isEmpty
125
126
}
126
127
127
128
public func change( pickerState: AttachmentPickerState ) {
@@ -195,7 +196,7 @@ public class MessageComposerViewModel: ObservableObject {
195
196
return true
196
197
}
197
198
}
198
-
199
+
199
200
return false
200
201
}
201
202
@@ -214,7 +215,7 @@ public class MessageComposerViewModel: ObservableObject {
214
215
temp. append ( attachment)
215
216
}
216
217
217
- self . addedCustomAttachments = temp
218
+ addedCustomAttachments = temp
218
219
}
219
220
220
221
func isCustomAttachmentSelected( _ attachment: CustomAttachment ) -> Bool {
@@ -302,7 +303,7 @@ public struct CustomAttachment: Identifiable, Equatable {
302
303
303
304
public static func == ( lhs: CustomAttachment , rhs: CustomAttachment ) -> Bool {
304
305
lhs. id == rhs. id
305
- }
306
+ }
306
307
307
308
public let id : String
308
309
public let content : AnyAttachmentPayload
@@ -311,5 +312,4 @@ public struct CustomAttachment: Identifiable, Equatable {
311
312
self . id = id
312
313
self . content = content
313
314
}
314
-
315
315
}
0 commit comments