File tree 2 files changed +10
-12
lines changed
2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -248,19 +248,15 @@ class PerAccountStore extends ChangeNotifier {
248
248
}
249
249
}
250
250
251
- Future <void > sendStreamMessage ({required String topic , required String content}) {
251
+ Future <void > sendMessage ({required MessageDestination destination , required String content}) {
252
252
// TODO implement outbox; see design at
253
253
// https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M3881.20Sending.20outbox.20messages.20is.20fraught.20with.20issues/near/1405739
254
-
255
- if (connection.realmUrl.origin != 'https://chat.zulip.org' ) {
256
- throw Exception ('This method can currently only be used on https://chat.zulip.org.' );
257
- }
258
- final destination = StreamDestination (7 , topic); // TODO parametrize; this is `#test here`
259
-
260
- return sendMessage (connection, destination: destination, content: content);
254
+ return _apiSendMessage (connection, destination: destination, content: content);
261
255
}
262
256
}
263
257
258
+ const _apiSendMessage = sendMessage; // Bit ugly; for alternatives, see: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/flutter.3A.20PerAccountStore.20methods/near/1545809
259
+
264
260
/// A [GlobalStore] that uses a live server and live, persistent local database.
265
261
///
266
262
/// The underlying data store is an [AppDatabase] corresponding to a SQLite
Original file line number Diff line number Diff line change @@ -517,10 +517,12 @@ class _StreamSendButtonState extends State<_StreamSendButton> {
517
517
}
518
518
519
519
final store = PerAccountStoreWidget .of (context);
520
- store.sendStreamMessage (
521
- topic: widget.topicController.textNormalized (),
522
- content: widget.contentController.textNormalized (),
523
- );
520
+ if (store.connection.realmUrl.origin != 'https://chat.zulip.org' ) {
521
+ throw Exception ('This method can currently only be used on https://chat.zulip.org.' );
522
+ }
523
+ final destination = StreamDestination (7 , widget.topicController.textNormalized ()); // TODO parametrize; this is `#test here`
524
+ final content = widget.contentController.textNormalized ();
525
+ store.sendMessage (destination: destination, content: content);
524
526
525
527
widget.contentController.clear ();
526
528
}
You can’t perform that action at this time.
0 commit comments