Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
efcfd3f57d | |||
84759715a4 | |||
fda09382dd | |||
2c5dd0563a |
@ -322,6 +322,7 @@ class ChatMessageController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
|
||||
final mostRecentMessage = await (_dt.db.snLocalChatMessage.select()
|
||||
..where((e) => e.channelId.equals(channel!.id))
|
||||
..limit(1)
|
||||
..orderBy([
|
||||
(e) =>
|
||||
|
@ -78,10 +78,23 @@ class NotificationProvider extends ChangeNotifier {
|
||||
int showingTrayCount = 0;
|
||||
List<SnNotification> notifications = List.empty(growable: true);
|
||||
|
||||
int? skippableNotifyChannel;
|
||||
|
||||
void listen() {
|
||||
_ws.pk.stream.listen((event) {
|
||||
if (event.method == 'notifications.new') {
|
||||
final notification = SnNotification.fromJson(event.payload!);
|
||||
|
||||
final doHaptic = _cfg.prefs.getBool(kAppNotifyWithHaptic) ?? true;
|
||||
if (doHaptic) HapticFeedback.mediumImpact();
|
||||
|
||||
if (notification.topic == 'messaging.message') {
|
||||
if (notification.metadata['channel_id'] != null &&
|
||||
notification.metadata['channel_id'] == skippableNotifyChannel) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (showingCount < 0) showingCount = 0;
|
||||
showingCount++;
|
||||
showingTrayCount++;
|
||||
@ -92,8 +105,6 @@ class NotificationProvider extends ChangeNotifier {
|
||||
});
|
||||
notifyListeners();
|
||||
updateTray();
|
||||
final doHaptic = _cfg.prefs.getBool(kAppNotifyWithHaptic) ?? true;
|
||||
if (doHaptic) HapticFeedback.mediumImpact();
|
||||
|
||||
if (!kIsWeb) {
|
||||
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
|
||||
|
@ -258,7 +258,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
channel.name),
|
||||
),
|
||||
const Gap(8),
|
||||
if (_unreadCounts?[channel.id] != null)
|
||||
if (_unreadCounts?[channel.id] != null &&
|
||||
_unreadCounts![channel.id]! > 0)
|
||||
Badge(
|
||||
label: Text('${_unreadCounts![channel.id]}'),
|
||||
),
|
||||
@ -294,7 +295,11 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
'alias': channel.alias,
|
||||
},
|
||||
).then((value) {
|
||||
if (mounted) _refreshChannels(noRemote: true);
|
||||
if (mounted) {
|
||||
_unreadCounts?[channel.id] = 0;
|
||||
setState(() => _unreadCounts?[channel.id] = 0);
|
||||
_refreshChannels(noRemote: true);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
@ -305,7 +310,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
children: [
|
||||
Expanded(child: Text(channel.name)),
|
||||
const Gap(8),
|
||||
if (_unreadCounts?[channel.id] != null)
|
||||
if (_unreadCounts?[channel.id] != null &&
|
||||
_unreadCounts![channel.id]! > 0)
|
||||
Badge(
|
||||
label: Text('${_unreadCounts![channel.id]}'),
|
||||
),
|
||||
@ -330,6 +336,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
),
|
||||
onTap: () {
|
||||
if (doExpand) {
|
||||
_unreadCounts?[channel.id] = 0;
|
||||
setState(() => _focusChannel = channel);
|
||||
return;
|
||||
}
|
||||
@ -340,7 +347,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
'alias': channel.alias,
|
||||
},
|
||||
).then((value) {
|
||||
if (value == true) _refreshChannels(noRemote: true);
|
||||
if (mounted) {
|
||||
setState(() => _unreadCounts?[channel.id] = 0);
|
||||
_refreshChannels(noRemote: true);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
@ -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: 2.3.2+72
|
||||
version: 2.3.2+73
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.4
|
||||
|
Reference in New Issue
Block a user