Fix message timestamps showing in UTC instead of local time
This commit is contained in:
parent
8a6a033cfd
commit
d51eba5009
11 changed files with 13 additions and 24 deletions
|
@ -78,7 +78,7 @@ class NotificationClient {
|
|||
}
|
||||
return fln.Message(
|
||||
content,
|
||||
message.sendTime,
|
||||
message.sendTime.toLocal(),
|
||||
fln.Person(
|
||||
name: uname,
|
||||
bot: false,
|
||||
|
|
|
@ -92,7 +92,7 @@ class _ContactsPlusPlusState extends State<ContactsPlusPlus> {
|
|||
return;
|
||||
}
|
||||
|
||||
if (remoteSem > currentSem && navigator.overlay?.context != null) {
|
||||
if (remoteSem > currentSem && navigator.overlay?.context != null && context.mounted) {
|
||||
showDialog(
|
||||
context: navigator.overlay!.context,
|
||||
builder: (context) {
|
||||
|
|
|
@ -49,8 +49,8 @@ class Message implements Comparable {
|
|||
final MessageState state;
|
||||
|
||||
Message({required this.id, required this.recipientId, required this.senderId, required this.type,
|
||||
required this.content, required this.sendTime, this.state=MessageState.local})
|
||||
: formattedContent = FormatNode.fromText(content);
|
||||
required this.content, required DateTime sendTime, this.state=MessageState.local})
|
||||
: formattedContent = FormatNode.fromText(content), sendTime = sendTime.toUtc();
|
||||
|
||||
factory Message.fromMap(Map map, {MessageState? withState}) {
|
||||
final typeString = (map["messageType"] as String?) ?? "";
|
||||
|
@ -105,7 +105,7 @@ class Message implements Comparable {
|
|||
}
|
||||
|
||||
@override
|
||||
int compareTo(other) {
|
||||
int compareTo(covariant Message other) {
|
||||
return other.sendTime.compareTo(sendTime);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:contacts_plus_plus/clients/messaging_client.dart';
|
|||
import 'package:contacts_plus_plus/models/friend.dart';
|
||||
import 'package:contacts_plus_plus/models/personal_profile.dart';
|
||||
import 'package:contacts_plus_plus/widgets/default_error_widget.dart';
|
||||
import 'package:contacts_plus_plus/widgets/formatted_text.dart';
|
||||
import 'package:contacts_plus_plus/widgets/friends/expanding_input_fab.dart';
|
||||
import 'package:contacts_plus_plus/widgets/friends/friend_list_tile.dart';
|
||||
import 'package:contacts_plus_plus/widgets/my_profile_dialog.dart';
|
||||
|
|
|
@ -88,8 +88,8 @@ class _UserSearchState extends State<UserSearch> {
|
|||
return DefaultErrorWidget(title: "${snapshot.error}",);
|
||||
}
|
||||
} else {
|
||||
return Column(
|
||||
children: const [
|
||||
return const Column(
|
||||
children: [
|
||||
LinearProgressIndicator(),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'package:contacts_plus_plus/string_formatter.dart';
|
|||
import 'package:contacts_plus_plus/widgets/formatted_text.dart';
|
||||
import 'package:contacts_plus_plus/widgets/messages/message_state_indicator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:full_screen_image/full_screen_image.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
|
@ -76,7 +75,7 @@ class MessageAsset extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: Text(
|
||||
_dateFormat.format(message.sendTime),
|
||||
_dateFormat.format(message.sendTime.toLocal()),
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
|
|
|
@ -148,7 +148,7 @@ class _MessageAudioPlayerState extends State<MessageAudioPlayer> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: Text(
|
||||
_dateFormat.format(widget.message.sendTime),
|
||||
_dateFormat.format(widget.message.sendTime.toLocal()),
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
|
|
|
@ -100,7 +100,7 @@ class MyMessageBubble extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: Text(
|
||||
_dateFormat.format(message.sendTime),
|
||||
_dateFormat.format(message.sendTime.toLocal()),
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
|
@ -227,7 +227,7 @@ class OtherMessageBubble extends StatelessWidget {
|
|||
),
|
||||
const SizedBox(height: 6,),
|
||||
Text(
|
||||
_dateFormat.format(message.sendTime),
|
||||
_dateFormat.format(message.sendTime.toLocal()),
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
|
|
|
@ -67,7 +67,7 @@ class MessageSessionInvite extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: Text(
|
||||
_dateFormat.format(message.sendTime),
|
||||
_dateFormat.format(message.sendTime.toLocal()),
|
||||
style: Theme
|
||||
.of(context)
|
||||
.textTheme
|
||||
|
|
|
@ -264,14 +264,6 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
full_screen_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: full_screen_image
|
||||
sha256: "97831b00d07b17c674ba3a4eddcee306dbd0d7c66851f1b67856e12daeb9b3aa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
html:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.2.0+1
|
||||
version: 1.2.1+1
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.0'
|
||||
|
@ -53,7 +53,6 @@ dependencies:
|
|||
collection: ^1.17.0
|
||||
package_info_plus: ^3.1.2
|
||||
provider: ^6.0.5
|
||||
full_screen_image: ^2.0.0
|
||||
photo_view: ^0.14.0
|
||||
color: ^3.0.0
|
||||
|
||||
|
|
Loading…
Reference in a new issue