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(
|
return fln.Message(
|
||||||
content,
|
content,
|
||||||
message.sendTime,
|
message.sendTime.toLocal(),
|
||||||
fln.Person(
|
fln.Person(
|
||||||
name: uname,
|
name: uname,
|
||||||
bot: false,
|
bot: false,
|
||||||
|
|
|
@ -92,7 +92,7 @@ class _ContactsPlusPlusState extends State<ContactsPlusPlus> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteSem > currentSem && navigator.overlay?.context != null) {
|
if (remoteSem > currentSem && navigator.overlay?.context != null && context.mounted) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: navigator.overlay!.context,
|
context: navigator.overlay!.context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
|
|
@ -49,8 +49,8 @@ class Message implements Comparable {
|
||||||
final MessageState state;
|
final MessageState state;
|
||||||
|
|
||||||
Message({required this.id, required this.recipientId, required this.senderId, required this.type,
|
Message({required this.id, required this.recipientId, required this.senderId, required this.type,
|
||||||
required this.content, required this.sendTime, this.state=MessageState.local})
|
required this.content, required DateTime sendTime, this.state=MessageState.local})
|
||||||
: formattedContent = FormatNode.fromText(content);
|
: formattedContent = FormatNode.fromText(content), sendTime = sendTime.toUtc();
|
||||||
|
|
||||||
factory Message.fromMap(Map map, {MessageState? withState}) {
|
factory Message.fromMap(Map map, {MessageState? withState}) {
|
||||||
final typeString = (map["messageType"] as String?) ?? "";
|
final typeString = (map["messageType"] as String?) ?? "";
|
||||||
|
@ -105,7 +105,7 @@ class Message implements Comparable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int compareTo(other) {
|
int compareTo(covariant Message other) {
|
||||||
return other.sendTime.compareTo(sendTime);
|
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/friend.dart';
|
||||||
import 'package:contacts_plus_plus/models/personal_profile.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/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/expanding_input_fab.dart';
|
||||||
import 'package:contacts_plus_plus/widgets/friends/friend_list_tile.dart';
|
import 'package:contacts_plus_plus/widgets/friends/friend_list_tile.dart';
|
||||||
import 'package:contacts_plus_plus/widgets/my_profile_dialog.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}",);
|
return DefaultErrorWidget(title: "${snapshot.error}",);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Column(
|
return const Column(
|
||||||
children: const [
|
children: [
|
||||||
LinearProgressIndicator(),
|
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/formatted_text.dart';
|
||||||
import 'package:contacts_plus_plus/widgets/messages/message_state_indicator.dart';
|
import 'package:contacts_plus_plus/widgets/messages/message_state_indicator.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:full_screen_image/full_screen_image.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
import 'package:photo_view/photo_view.dart';
|
||||||
|
|
||||||
|
@ -76,7 +75,7 @@ class MessageAsset extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
_dateFormat.format(message.sendTime),
|
_dateFormat.format(message.sendTime.toLocal()),
|
||||||
style: Theme
|
style: Theme
|
||||||
.of(context)
|
.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
|
|
|
@ -148,7 +148,7 @@ class _MessageAudioPlayerState extends State<MessageAudioPlayer> {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
_dateFormat.format(widget.message.sendTime),
|
_dateFormat.format(widget.message.sendTime.toLocal()),
|
||||||
style: Theme
|
style: Theme
|
||||||
.of(context)
|
.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
|
|
|
@ -100,7 +100,7 @@ class MyMessageBubble extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
_dateFormat.format(message.sendTime),
|
_dateFormat.format(message.sendTime.toLocal()),
|
||||||
style: Theme
|
style: Theme
|
||||||
.of(context)
|
.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
|
@ -227,7 +227,7 @@ class OtherMessageBubble extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 6,),
|
const SizedBox(height: 6,),
|
||||||
Text(
|
Text(
|
||||||
_dateFormat.format(message.sendTime),
|
_dateFormat.format(message.sendTime.toLocal()),
|
||||||
style: Theme
|
style: Theme
|
||||||
.of(context)
|
.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
|
|
|
@ -67,7 +67,7 @@ class MessageSessionInvite extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
_dateFormat.format(message.sendTime),
|
_dateFormat.format(message.sendTime.toLocal()),
|
||||||
style: Theme
|
style: Theme
|
||||||
.of(context)
|
.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
|
|
|
@ -264,14 +264,6 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
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:
|
html:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
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
|
# 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
|
# 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.
|
# 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:
|
environment:
|
||||||
sdk: '>=3.0.0'
|
sdk: '>=3.0.0'
|
||||||
|
@ -53,7 +53,6 @@ dependencies:
|
||||||
collection: ^1.17.0
|
collection: ^1.17.0
|
||||||
package_info_plus: ^3.1.2
|
package_info_plus: ^3.1.2
|
||||||
provider: ^6.0.5
|
provider: ^6.0.5
|
||||||
full_screen_image: ^2.0.0
|
|
||||||
photo_view: ^0.14.0
|
photo_view: ^0.14.0
|
||||||
color: ^3.0.0
|
color: ^3.0.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue