cph-cachet / carp.sensing-flutter

CARP Mobile Sensing for Flutter, including mobile sensing framework, data backend support, and the CARP mobile sensing app.
MIT License
80 stars 28 forks source link

[carp_backend] Add timestamp to Messages in message_manager #247

Closed luciamontesinos closed 2 years ago

luciamontesinos commented 2 years ago

By default, the timestamp of the messages is overwritten to DateTime.now() : https://github.com/cph-cachet/carp.sensing-flutter/blob/88c3fa0ec1b07e13a2505035209c0d3b200c755b/backends/carp_backend/lib/message_manager.dart#L48-L59

A possible fix could be something like this:

Message({
    String? id,
    this.type = MessageType.announcement,
    this.title,
    this.subTitle,
    this.message,
    this.url,
    this.imagePath,
    DateTime? timestamp,
  }) {
    this.id = id ?? Uuid().v1();
    this.timestamp = timestamp ?? DateTime.now();
  }
bardram commented 2 years ago

Fixed in v. 0.33.0