Removed Jiffy update

This commit is contained in:
rlee1990
2023-06-05 15:46:17 -04:00
parent dea5664851
commit 4dcc747f94
12 changed files with 31 additions and 34 deletions
@@ -108,7 +108,7 @@ class _ConnectedTitleState extends StatelessWidget {
} else { } else {
alternativeWidget = Text( alternativeWidget = Text(
'${context.translations.userLastOnlineText} ' '${context.translations.userLastOnlineText} '
'${Jiffy.parseFromDateTime(otherMember.user!.lastActive!).fromNow()}', '${Jiffy(otherMember.user!.lastActive!).fromNow()}',
style: textStyle, style: textStyle,
); );
} }
@@ -349,16 +349,16 @@ class _Date extends StatelessWidget {
if (lastMessageAt.millisecondsSinceEpoch >= if (lastMessageAt.millisecondsSinceEpoch >=
startOfDay.millisecondsSinceEpoch) { startOfDay.millisecondsSinceEpoch) {
stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).jm; stringDate = Jiffy(lastMessageAt.toLocal()).jm;
} else if (lastMessageAt.millisecondsSinceEpoch >= } else if (lastMessageAt.millisecondsSinceEpoch >=
startOfDay startOfDay
.subtract(const Duration(days: 1)) .subtract(const Duration(days: 1))
.millisecondsSinceEpoch) { .millisecondsSinceEpoch) {
stringDate = context.translations.yesterdayLabel; stringDate = context.translations.yesterdayLabel;
} else if (startOfDay.difference(lastMessageAt).inDays < 7) { } else if (startOfDay.difference(lastMessageAt).inDays < 7) {
stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).EEEE; stringDate = Jiffy(lastMessageAt.toLocal()).EEEE;
} else { } else {
stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).yMd; stringDate = Jiffy(lastMessageAt.toLocal()).yMd;
} }
return Text( return Text(
@@ -611,13 +611,13 @@ class DefaultTranslations implements Translations {
} else if (date == yesterday) { } else if (date == yesterday) {
return 'yesterday'; return 'yesterday';
} else { } else {
return 'on ${Jiffy.parseFromDateTime(date).MMMd}'; return 'on ${Jiffy(date).MMMd}';
} }
} }
@override @override
String sentAtText({required DateTime date, required DateTime time}) => String sentAtText({required DateTime date, required DateTime time}) =>
'Sent ${_getDay(date)} at ${Jiffy.parseFromDateTime(time.toLocal()).format(pattern: 'HH:mm')}'; 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}';
@override @override
String get todayLabel => 'Today'; String get todayLabel => 'Today';
@@ -666,15 +666,13 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
final createdAt = message.createdAt.toLocal(); final createdAt = message.createdAt.toLocal();
final nextCreatedAt = nextMessage.createdAt.toLocal(); final nextCreatedAt = nextMessage.createdAt.toLocal();
if (!Jiffy.parseFromDateTime(createdAt).isSame( if (!Jiffy(createdAt)
Jiffy.parseFromDateTime(nextCreatedAt), .isSame(Jiffy(nextCreatedAt), Units.DAY)) {
unit: Unit.day)) {
separator = _buildDateDivider(nextMessage); separator = _buildDateDivider(nextMessage);
} else { } else {
final hasTimeDiff = final hasTimeDiff = !Jiffy(createdAt).isSame(
!Jiffy.parseFromDateTime(createdAt).isSame( Jiffy(nextCreatedAt),
Jiffy.parseFromDateTime(nextCreatedAt), Units.MINUTE,
unit: Unit.minute,
); );
final isNextUserSame = final isNextUserSame =
@@ -1064,10 +1062,9 @@ class _StreamMessageListViewState extends State<StreamMessageListView> {
var hasTimeDiff = false; var hasTimeDiff = false;
if (nextMessage != null) { if (nextMessage != null) {
hasTimeDiff = hasTimeDiff = !Jiffy(message.createdAt.toLocal()).isSame(
!Jiffy.parseFromDateTime(message.createdAt.toLocal()).isSame( Jiffy(nextMessage.createdAt.toLocal()),
Jiffy.parseFromDateTime(nextMessage.createdAt.toLocal()), Units.MINUTE,
unit: Unit.minute,
); );
} }
@@ -191,7 +191,7 @@ class BottomRow extends StatelessWidget {
), ),
if (showTimeStamp) if (showTimeStamp)
Text( Text(
Jiffy.parseFromDateTime(message.createdAt.toLocal()).jm, Jiffy(message.createdAt.toLocal()).jm,
style: messageTheme.createdAtStyle, style: messageTheme.createdAtStyle,
), ),
if (showSendingIndicator) if (showSendingIndicator)
@@ -20,17 +20,17 @@ class StreamDateDivider extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final createdAt = Jiffy.parseFromDateTime(dateTime); final createdAt = Jiffy(dateTime);
final now = Jiffy.parseFromDateTime(DateTime.now()); final now = Jiffy(DateTime.now());
var dayInfo = createdAt.MMMd; var dayInfo = createdAt.MMMd;
if (createdAt.isSame(now, unit: Unit.day)) { if (createdAt.isSame(now, Units.DAY)) {
dayInfo = context.translations.todayLabel; dayInfo = context.translations.todayLabel;
} else if (createdAt.isSame(now.subtract(days: 1), unit: Unit.day)) { } else if (createdAt.isSame(now.subtract(days: 1), Units.DAY)) {
dayInfo = context.translations.yesterdayLabel; dayInfo = context.translations.yesterdayLabel;
} else if (createdAt.isAfter(now.subtract(days: 7), unit: Unit.day)) { } else if (createdAt.isAfter(now.subtract(days: 7), Units.DAY)) {
dayInfo = createdAt.EEEE; dayInfo = createdAt.EEEE;
} else if (createdAt.isAfter(now.subtract(years: 1), unit: Unit.day)) { } else if (createdAt.isAfter(now.subtract(years: 1), Units.DAY)) {
dayInfo = createdAt.MMMd; dayInfo = createdAt.MMMd;
} }
@@ -287,16 +287,16 @@ class ChannelLastMessageDate extends StatelessWidget {
if (lastMessageAt.millisecondsSinceEpoch >= if (lastMessageAt.millisecondsSinceEpoch >=
startOfDay.millisecondsSinceEpoch) { startOfDay.millisecondsSinceEpoch) {
stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).jm; stringDate = Jiffy(lastMessageAt.toLocal()).jm;
} else if (lastMessageAt.millisecondsSinceEpoch >= } else if (lastMessageAt.millisecondsSinceEpoch >=
startOfDay startOfDay
.subtract(const Duration(days: 1)) .subtract(const Duration(days: 1))
.millisecondsSinceEpoch) { .millisecondsSinceEpoch) {
stringDate = context.translations.yesterdayLabel; stringDate = context.translations.yesterdayLabel;
} else if (startOfDay.difference(lastMessageAt).inDays < 7) { } else if (startOfDay.difference(lastMessageAt).inDays < 7) {
stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).EEEE; stringDate = Jiffy(lastMessageAt.toLocal()).EEEE;
} else { } else {
stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).yMd; stringDate = Jiffy(lastMessageAt.toLocal()).yMd;
} }
return Text( return Text(
@@ -227,9 +227,9 @@ class MessageSearchTileMessageDate extends StatelessWidget {
if (now.year != createdAt.year || if (now.year != createdAt.year ||
now.month != createdAt.month || now.month != createdAt.month ||
now.day != createdAt.day) { now.day != createdAt.day) {
stringDate = Jiffy.parseFromDateTime(createdAt.toLocal()).yMd; stringDate = Jiffy(createdAt.toLocal()).yMd;
} else { } else {
stringDate = Jiffy.parseFromDateTime(createdAt.toLocal()).jm; stringDate = Jiffy(createdAt.toLocal()).jm;
} }
return Text( return Text(
@@ -179,7 +179,7 @@ class UserLastActive extends StatelessWidget {
user.online user.online
? context.translations.userOnlineText ? context.translations.userOnlineText
: '${context.translations.userLastOnlineText} ' : '${context.translations.userLastOnlineText} '
'${Jiffy.parseFromDateTime(user.lastActive!).fromNow()}', '${Jiffy(user.lastActive!).fromNow()}',
style: chatTheme.textTheme.footnote.copyWith( style: chatTheme.textTheme.footnote.copyWith(
color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5), color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5),
), ),
@@ -165,9 +165,9 @@ class StreamChatState extends State<StreamChat> {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
final currentLocale = Localizations.localeOf(context).toString(); final currentLocale = Localizations.localeOf(context).toString();
final availableLocales = Jiffy.getSupportedLocales(); final availableLocales = Jiffy.getAllAvailableLocales();
if (availableLocales.contains(currentLocale)) { if (availableLocales.contains(currentLocale)) {
Jiffy.setLocale(currentLocale); Jiffy.locale(currentLocale);
} }
super.didChangeDependencies(); super.didChangeDependencies();
} }
@@ -77,7 +77,7 @@ class StreamUserItem extends StatelessWidget {
user.online user.online
? context.translations.userOnlineText ? context.translations.userOnlineText
: '${context.translations.userLastOnlineText} ' : '${context.translations.userLastOnlineText} '
'${Jiffy.parseFromDateTime(user.lastActive!).fromNow()}', '${Jiffy(user.lastActive!).fromNow()}',
style: chatTheme.textTheme.footnote.copyWith( style: chatTheme.textTheme.footnote.copyWith(
color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5), color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5),
), ),
+1 -1
View File
@@ -29,7 +29,7 @@ dependencies:
http_parser: ^4.0.0 http_parser: ^4.0.0
image_gallery_saver: ^2.0.1 image_gallery_saver: ^2.0.1
image_picker: ^0.8.2 image_picker: ^0.8.2
jiffy: ^6.2.1 jiffy: ^5.0.0
lottie: ^2.0.0 lottie: ^2.0.0
meta: ^1.8.0 meta: ^1.8.0
path_provider: ^2.0.9 path_provider: ^2.0.9