diff --git a/LIBCWTCH-GO-MACOS.version b/LIBCWTCH-GO-MACOS.version index 8e8a8f96..b9c00d44 100644 --- a/LIBCWTCH-GO-MACOS.version +++ b/LIBCWTCH-GO-MACOS.version @@ -1 +1 @@ -2022-07-06-15-49-v1.8.0-4-g4417347 \ No newline at end of file +2022-07-22-12-41-v1.8.0-7-g7b3e842 \ No newline at end of file diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index 31577150..d6908319 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -2022-07-06-19-50-v1.8.0-4-g4417347 \ No newline at end of file +2022-07-22-16-41-v1.8.0-7-g7b3e842 \ No newline at end of file diff --git a/lib/l10n/intl_cy.arb b/lib/l10n/intl_cy.arb index 0a8fd661..2360b76e 100644 --- a/lib/l10n/intl_cy.arb +++ b/lib/l10n/intl_cy.arb @@ -1,6 +1,9 @@ { "@@locale": "cy", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_da.arb b/lib/l10n/intl_da.arb index 46d534be..f226fa3b 100644 --- a/lib/l10n/intl_da.arb +++ b/lib/l10n/intl_da.arb @@ -1,6 +1,9 @@ { "@@locale": "da", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index f9b8b4de..b7f29c46 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1,6 +1,9 @@ { "@@locale": "de", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_el.arb b/lib/l10n/intl_el.arb index a27e7fda..5edfeeb3 100644 --- a/lib/l10n/intl_el.arb +++ b/lib/l10n/intl_el.arb @@ -1,6 +1,9 @@ { "@@locale": "el", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 70281e8d..2054944e 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1,6 +1,9 @@ { "@@locale": "en", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 55886a19..57f0f1d4 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -1,6 +1,9 @@ { "@@locale": "es", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index fd6aee80..352d74b6 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1,13 +1,16 @@ { "@@locale": "fr", - "@@last_modified": "2022-07-07T22:32:20+02:00", - "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", - "messageNoReplies": "There are no replies to this message.", - "headingReplies": "Replies", - "viewReplies": "View replies to this message", - "restartFileShare": "Start Sharing File", - "stopSharingFile": "Stop Sharing File", - "manageSharedFiles": "Manage Shared Files", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "viewReplies": "Voir les réponses à ce message", + "stopSharingFile": "Arrêter le partage de fichiers", + "restartFileShare": "Démarrer le partage de fichiers", + "replyingTo": "Répondre à %1", + "messageNoReplies": "Il n'y a pas de réponses à ce message.", + "manageSharedFiles": "Gérer les fichiers partagés", + "headingReplies": "Réponses", + "fileDownloadUnavailable": "Ce fichier semble indisponible pour le téléchargement. L'expéditeur a peut-être désactivé les téléchargements pour ce fichier.", "localeDe": "Allemand \/ Deutsch", "localeDa": "Danois \/ Dansk", "localePt": "Portugais \/ Portuguesa", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index ccef6c6c..3b9326a9 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1,13 +1,16 @@ { "@@locale": "it", - "@@last_modified": "2022-07-07T22:32:20+02:00", - "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", - "messageNoReplies": "There are no replies to this message.", - "headingReplies": "Replies", - "viewReplies": "View replies to this message", - "restartFileShare": "Start Sharing File", - "stopSharingFile": "Stop Sharing File", - "manageSharedFiles": "Manage Shared Files", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "fileDownloadUnavailable": "Questo file non sembra disponibile per il download. Il mittente potrebbe aver disabilitato i download per questo file.", + "headingReplies": "Risposte", + "manageSharedFiles": "Gestisci file condivisi", + "messageNoReplies": "Non ci sono risposte a questo messaggio.", + "replyingTo": "Risposta a %1", + "restartFileShare": "Avvia la condivisione del file", + "stopSharingFile": "Interrompi la condivisione del file", + "viewReplies": "Visualizza le risposte a questo messaggio", "localeDe": "Tedesco \/ Deutsch", "settingImagePreviewsDescription": "Le immagini e le immagini del profilo verranno scaricate e visualizzate in anteprima automaticamente. Ti consigliamo di non abilitare questo esperimento se usi Cwtch con contatti non attendibili.", "localeNo": "Norvegese \/ Norsk", diff --git a/lib/l10n/intl_lb.arb b/lib/l10n/intl_lb.arb index d296b51a..9ed9d7d4 100644 --- a/lib/l10n/intl_lb.arb +++ b/lib/l10n/intl_lb.arb @@ -1,6 +1,9 @@ { "@@locale": "lb", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_no.arb b/lib/l10n/intl_no.arb index 2849c2f9..363b73e0 100644 --- a/lib/l10n/intl_no.arb +++ b/lib/l10n/intl_no.arb @@ -1,6 +1,9 @@ { "@@locale": "no", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index 6d599fdc..1cf74319 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -1,6 +1,9 @@ { "@@locale": "pl", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index 2abeecf1..62e28c4b 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -1,6 +1,9 @@ { "@@locale": "pt", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_ro.arb b/lib/l10n/intl_ro.arb index 322bf13c..f129f89f 100644 --- a/lib/l10n/intl_ro.arb +++ b/lib/l10n/intl_ro.arb @@ -1,6 +1,9 @@ { "@@locale": "ro", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index ad92d5c3..05a1559c 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -1,6 +1,9 @@ { "@@locale": "ru", - "@@last_modified": "2022-07-07T22:32:20+02:00", + "@@last_modified": "2022-07-21T19:54:08+02:00", + "tooltipUnpinConversation": "Unpin conversation from the top of \"Conversations\"", + "tooltipPinConversation": "Pin conversation to the top of \"Conversations\"", + "replyingTo": "Replying to %1", "fileDownloadUnavailable": "This file appears unavailable for download. The sender may have disabled downloads for this file.", "messageNoReplies": "There are no replies to this message.", "headingReplies": "Replies", diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 9006ff40..eaa55a05 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -1,6 +1,9 @@ +import 'package:cwtch/main.dart'; +import 'package:cwtch/models/profile.dart'; import 'package:cwtch/widgets/messagerow.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import 'message.dart'; @@ -51,6 +54,7 @@ class ContactInfoState extends ChangeNotifier { late bool _isGroup; String? _server; late bool _archived; + late bool _pinned; String? _acnCircuit; @@ -68,7 +72,8 @@ class ContactInfoState extends ChangeNotifier { lastMessageTime, server, archived = false, - notificationPolicy = "ConversationNotificationPolicy.Default"}) { + notificationPolicy = "ConversationNotificationPolicy.Default", + pinned = false}) { this._nickname = nickname; this._isGroup = isGroup; this._accepted = accepted; @@ -84,6 +89,7 @@ class ContactInfoState extends ChangeNotifier { this._archived = archived; this._notificationPolicy = notificationPolicyFromString(notificationPolicy); this.messageCache = new MessageCache(_totalMessages); + this._pinned = pinned; keys = Map>(); } @@ -285,4 +291,27 @@ class ContactInfoState extends ChangeNotifier { } return ConversationNotificationPolicy.Never; } + + bool get pinned { + return _pinned; + } + + // Pin the conversation to the top of the conversation list + // Requires caller tree to contain a FlwtchState and ProfileInfoState provider. + void pin(context) { + _pinned = true; + var profileHandle = Provider.of(context, listen: false).onion; + Provider.of(context,listen: false).cwtch.SetConversationAttribute(profileHandle, identifier, "profile.pinned", "true"); + notifyListeners(); + } + + // Unpin the conversation from the top of the conversation list + // Requires caller tree to contain a FlwtchState and ProfileInfoState provider. + void unpin(context) { + _pinned = false; + var profileHandle = Provider.of(context,listen: false).onion; + Provider.of(context,listen: false).cwtch.SetConversationAttribute(profileHandle, identifier, "profile.pinned", "false"); + notifyListeners(); + } + } diff --git a/lib/models/contactlist.dart b/lib/models/contactlist.dart index afeb5edb..99bd398f 100644 --- a/lib/models/contactlist.dart +++ b/lib/models/contactlist.dart @@ -51,6 +51,9 @@ class ContactListState extends ChangeNotifier { // return -1 = a first in list // return 1 = b first in list + // pinned contacts first + if (a.pinned != true && b.pinned == true) return 1; + if (a.pinned == true && b.pinned != true) return -1; // blocked contacts last if (a.isBlocked == true && b.isBlocked != true) return 1; if (a.isBlocked != true && b.isBlocked == true) return -1; diff --git a/lib/models/profile.dart b/lib/models/profile.dart index f67179cc..177b8e5b 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -67,6 +67,7 @@ class ProfileInfoState extends ChangeNotifier { server: contact["groupServer"], archived: contact["isArchived"] == true, lastMessageTime: DateTime.fromMillisecondsSinceEpoch(1000 * int.parse(contact["lastMsgTime"])), + pinned: contact["attributes"]?["local.profile.pinned"] == "true", notificationPolicy: contact["notificationPolicy"] ?? "ConversationNotificationPolicy.Default"); })); diff --git a/lib/models/remoteserver.dart b/lib/models/remoteserver.dart index 412c0bf4..8b572552 100644 --- a/lib/models/remoteserver.dart +++ b/lib/models/remoteserver.dart @@ -1,3 +1,4 @@ +import 'package:cwtch/config.dart'; import 'package:flutter/cupertino.dart'; import 'contact.dart'; @@ -13,7 +14,7 @@ class RemoteServerInfoState extends ChangeNotifier { DateTime lastPreSyncMessagTime = new DateTime(2020); RemoteServerInfoState(this.onion, this.identifier, this.description, this._status, {lastPreSyncMessageTime, mostRecentMessageTime}) { - if (_status == "Authenticated") { + if (_status == "Authenticated" || _status == "Synced") { this.lastPreSyncMessagTime = lastPreSyncMessageTime; updateSyncProgressFor(mostRecentMessageTime); } diff --git a/lib/widgets/contactrow.dart b/lib/widgets/contactrow.dart index 1f5b6e74..8c35cdaf 100644 --- a/lib/widgets/contactrow.dart +++ b/lib/widgets/contactrow.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:cwtch/models/appstate.dart'; import 'package:cwtch/models/contact.dart'; +import 'package:cwtch/models/contactlist.dart'; import 'package:cwtch/models/profile.dart'; import 'package:cwtch/views/contactsview.dart'; import 'package:flutter/material.dart'; @@ -18,6 +19,9 @@ class ContactRow extends StatefulWidget { } class _ContactRowState extends State { + + bool isHover = false; + @override Widget build(BuildContext context) { var contact = Provider.of(context); @@ -123,10 +127,30 @@ class _ContactRowState extends State { ), ], ))), + + Visibility(visible: Platform.isAndroid || (!Platform.isAndroid && isHover) || contact.pinned, child: + IconButton( + tooltip: contact.pinned ? AppLocalizations.of(context)!.tooltipUnpinConversation :AppLocalizations.of(context)!.tooltipPinConversation , + icon: Icon(contact.pinned ? Icons.push_pin : Icons.push_pin_outlined, + color: Provider.of(context).theme.mainTextColor,), + onPressed: () { + if (contact.pinned) { + contact.unpin(context); + } else { + contact.pin(context); + } + Provider.of(context, listen: false).resort(); + }, + )) ]), onTap: () { selectConversation(context, contact.identifier); }, + onHover: (onHover) { + setState(() { + isHover = onHover; + }); + }, )); }