Support Appear Offline
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
16de726b47
commit
919c7c35a6
|
@ -1 +1 @@
|
|||
2023-08-31-11-56-v0.0.6-2-gf32ad74
|
||||
2023-09-13-11-52-v0.0.6-4-g3e9c9c3
|
|
@ -406,6 +406,13 @@ class MainActivity: FlutterActivity() {
|
|||
val profile: String = call.argument("profile") ?: ""
|
||||
Cwtch.activatePeerEngine(profile)
|
||||
}
|
||||
"ConfigureConnections" -> {
|
||||
val profile: String = call.argument("profile") ?: ""
|
||||
val listen: Boolean = call.argument("listen") ?: false
|
||||
val peers: Boolean = call.argument("peers") ?: false
|
||||
val servers: Boolean = call.argument("servers") ?: false
|
||||
Cwtch.configureConnections(profile, listen, peers, servers)
|
||||
}
|
||||
"DeactivatePeerEngine" -> {
|
||||
val profile: String = call.argument("profile") ?: ""
|
||||
Cwtch.deactivatePeerEngine(profile)
|
||||
|
|
|
@ -46,6 +46,9 @@ abstract class Cwtch {
|
|||
void UnblockContact(String profileOnion, int contactHandle);
|
||||
|
||||
void AttemptReconnection(String profileOnion, String onion);
|
||||
void AttemptReconnectionServer(String profileOnion, String onion);
|
||||
void DisconnectFromPeer(String profileOnion, String onion);
|
||||
void DisconnectFromServer(String profileOnion, String onion);
|
||||
|
||||
// ignore: non_constant_identifier_names
|
||||
Future<dynamic> GetMessage(String profile, int handle, int index);
|
||||
|
@ -151,4 +154,6 @@ abstract class Cwtch {
|
|||
// ignore: non_constant_identifier_names
|
||||
Future<String> SearchConversations(String profile, String pattern);
|
||||
void DeleteServerInfo(String profile, String handle);
|
||||
|
||||
void ConfigureConnections(String onion, bool listen, bool peers, bool servers);
|
||||
}
|
||||
|
|
|
@ -70,8 +70,18 @@ class CwtchNotifier {
|
|||
case "NewPeer":
|
||||
// EnvironmentConfig.debugLog("NewPeer $data");
|
||||
// if tag != v1-defaultPassword then it is either encrypted OR it is an unencrypted account created during pre-beta...
|
||||
profileCN.add(data["Identity"], data["name"], data["picture"], data["defaultPicture"], data["ContactsJson"], data["ServerList"], data["Online"] == "true", data["autostart"] == "true",
|
||||
data["tag"] != "v1-defaultPassword");
|
||||
profileCN.add(
|
||||
data["Identity"],
|
||||
data["name"],
|
||||
data["picture"],
|
||||
data["defaultPicture"],
|
||||
data["ContactsJson"],
|
||||
data["ServerList"],
|
||||
data["Online"] == "true",
|
||||
data["autostart"] == "true",
|
||||
data["tag"] != "v1-defaultPassword",
|
||||
data["appearOffline"] == "true",
|
||||
);
|
||||
|
||||
// Update Profile Attributes
|
||||
EnvironmentConfig.debugLog("Looking up Profile Attributes ${data["Identity"]} ${profileCN.getProfile(data["Identity"])}");
|
||||
|
|
|
@ -45,6 +45,9 @@ typedef VoidFromStringIntStringStringStringFn = void Function(Pointer<Utf8>, int
|
|||
typedef void_from_string_string_int_int_function = Void Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int64, Int64);
|
||||
typedef VoidFromStringStringIntIntFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int, int);
|
||||
|
||||
typedef void_from_string_bool_bool_bool = Void Function(Pointer<Utf8>, Int32, Bool, Bool, Bool);
|
||||
typedef VoidFromStringBoolBoolBool = void Function(Pointer<Utf8>, int, bool, bool, bool);
|
||||
|
||||
typedef void_from_string_string_byte_function = Void Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int8);
|
||||
typedef VoidFromStringStringByteFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int);
|
||||
|
||||
|
@ -1041,6 +1044,42 @@ class CwtchFfi implements Cwtch {
|
|||
malloc.free(utf8onion);
|
||||
}
|
||||
|
||||
@override
|
||||
void AttemptReconnectionServer(String profile, String onion) {
|
||||
// ignore: non_constant_identifier_names
|
||||
var queueJoinServerC = library.lookup<NativeFunction<void_from_string_string_function>>("c_QueueJoinServer");
|
||||
final QueueJoinServerC = queueJoinServerC.asFunction<VoidFromStringStringFn>();
|
||||
final utf8profile = profile.toNativeUtf8();
|
||||
final utf8onion = onion.toNativeUtf8();
|
||||
QueueJoinServerC(utf8profile, utf8profile.length, utf8onion, utf8onion.length);
|
||||
malloc.free(utf8profile);
|
||||
malloc.free(utf8onion);
|
||||
}
|
||||
|
||||
@override
|
||||
void DisconnectFromPeer(String profile, String onion) {
|
||||
// ignore: non_constant_identifier_names
|
||||
var disconnectFromPeerC = library.lookup<NativeFunction<void_from_string_string_function>>("c_DisconnectFromPeer");
|
||||
final DisconnectFromPeerC = disconnectFromPeerC.asFunction<VoidFromStringStringFn>();
|
||||
final utf8profile = profile.toNativeUtf8();
|
||||
final utf8onion = onion.toNativeUtf8();
|
||||
DisconnectFromPeerC(utf8profile, utf8profile.length, utf8onion, utf8onion.length);
|
||||
malloc.free(utf8profile);
|
||||
malloc.free(utf8onion);
|
||||
}
|
||||
|
||||
@override
|
||||
void DisconnectFromServer(String profile, String onion) {
|
||||
// ignore: non_constant_identifier_names
|
||||
var disconnectFromServerC = library.lookup<NativeFunction<void_from_string_string_function>>("c_DisconnectFromServer");
|
||||
final DisconnectFromServerC = disconnectFromServerC.asFunction<VoidFromStringStringFn>();
|
||||
final utf8profile = profile.toNativeUtf8();
|
||||
final utf8onion = onion.toNativeUtf8();
|
||||
DisconnectFromServerC(utf8profile, utf8profile.length, utf8onion, utf8onion.length);
|
||||
malloc.free(utf8profile);
|
||||
malloc.free(utf8onion);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String> SearchConversations(String profile, String pattern) async {
|
||||
var searchConversationsC = library.lookup<NativeFunction<string_string_to_string_function>>("c_SearchConversations");
|
||||
|
@ -1061,4 +1100,15 @@ class CwtchFfi implements Cwtch {
|
|||
Future<HashMap<String, String>> PlatformChannelInfo() {
|
||||
return Future.value(HashMap<String, String>());
|
||||
}
|
||||
|
||||
@override
|
||||
void ConfigureConnections(String profile, bool listen, bool peers, bool servers) {
|
||||
var configureConnections = library.lookup<NativeFunction<void_from_string_bool_bool_bool>>("c_ConfigureConnections");
|
||||
// ignore: non_constant_identifier_names
|
||||
final ConfigureConnections = configureConnections.asFunction<VoidFromStringBoolBoolBool>();
|
||||
final utf8profile = profile.toNativeUtf8();
|
||||
ConfigureConnections(utf8profile, utf8profile.length, listen, peers, servers);
|
||||
malloc.free(utf8profile);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -439,8 +439,28 @@ class CwtchGomobile implements Cwtch {
|
|||
cwtchPlatform.invokeMethod("PeerWithOnion", {"ProfileOnion": profile, "onion": onion});
|
||||
}
|
||||
|
||||
@override
|
||||
void AttemptReconnectionServer(String profile, String onion) {
|
||||
cwtchPlatform.invokeMethod("QueueJoinServer", {"ProfileOnion": profile, "onion": onion});
|
||||
}
|
||||
|
||||
@override
|
||||
void DisconnectFromPeer(String profile, String onion) {
|
||||
cwtchPlatform.invokeMethod("DisconnectFromPeer", {"ProfileOnion": profile, "onion": onion});
|
||||
}
|
||||
|
||||
@override
|
||||
void DisconnectFromServer(String profile, String onion) {
|
||||
cwtchPlatform.invokeMethod("DisconnectFromServer", {"ProfileOnion": profile, "onion": onion});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String> SearchConversations(String profile, String pattern) async {
|
||||
return await cwtchPlatform.invokeMethod("SearchConversations", {"ProfileOnion": profile, "pattern": pattern});
|
||||
}
|
||||
|
||||
@override
|
||||
void ConfigureConnections(String profile, bool listen, bool peers, bool servers) {
|
||||
cwtchPlatform.invokeMethod("ConfigureConnections", {"ProfileOnion": profile, "listen": listen, "peers": peers, "servers": servers});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "cy",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Mewn gwirionedd dileu gweinydd",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grwpiau rydw i'n eu cynnal ar y gweinydd hwn",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "da",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Ja fjern server",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grupper som jeg er vært for på denne server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "de",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Server wirklich löschen",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Gruppen, in denen ich bin, werden auf diesem Server gehostet",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "el",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Really Delete Server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Known Groups on this Cwtch Server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "en",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Really Delete Server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Known Groups on this Cwtch Server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "es",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Realmente eliminar el servidor",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grupos alojados en este servidor en los que estoy",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "fr",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Supprimer vraiment le serveur",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Les groupes dont je fais partie sont hébergés sur ce serveur",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "it",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Elimina davvero il server",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Gruppi di cui sono parte su questo server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "ja",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Really Delete Server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Known Groups on this Cwtch Server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "ko",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Really Delete Server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Known Groups on this Cwtch Server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "lb",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Really Delete Server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Known Groups on this Cwtch Server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "nl",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Server echt verwijderen",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Groepen waarin ik zit gehost op deze server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "no",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Slette tjener",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grupper jeg er vert for på denne tjeneren",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "pl",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Usuń",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grupy na tym serwerze, których jesteś członkiem",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "pt",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Really Delete Server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Known Groups on this Cwtch Server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "pt_BR",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Realmente excluir servidor",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grupos nos quais estou hospedado neste servidor",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "ro",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Sigur doriți sa ștergeți serverul",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grupurile în care mă aflu care sunt găzduite pe acest server",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "ru",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Вы точно хотите удалить сервер?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Группы, в которых я нахожусь, размещены на этом сервере",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "sk",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Vážne vymazať server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Skupiny ktorých som členom a sú hostované na tomto servery",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "sv",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Bekräfta borttagning av servern",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Grupper jag är med i på den här servern",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "sw",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Futa kabisa seva",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Vikundi nilivyopangishwa kwenye seva hii",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "tr",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Sunucuyu gerçekten sil",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Bu sunucuda içinde bulunduğum gruplar",
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{
|
||||
"@@locale": "uk",
|
||||
"@@last_modified": "2023-08-21T19:40:19+02:00",
|
||||
"@@last_modified": "2023-09-13T18:51:59+02:00",
|
||||
"contactDisconnect": "Disconnect from Contact (if you do not have Appear Offline set this contact may still be able to reestablish a connection to you)",
|
||||
"profileAppearOfflineDescription": "By default, when Cwtch profile is enabled it automatically attempts to connect to know contacts, and allows inbound connections. This settings disables those actions and allows you to choose, manually, which contacts to connect to.",
|
||||
"profileAppearOffline": "Appear Offline",
|
||||
"deleteServerConfirmBtn": "Really Delete Server?",
|
||||
"cannotDeleteServerIfActiveGroups": "There are active groups associated with this Cwtch Server. Please delete them prior to deleting this Cwtch Server entry.",
|
||||
"groupsOnThisServerLabel": "Known Groups on this Cwtch Server",
|
||||
|
|
|
@ -70,6 +70,9 @@ class ContactInfoState extends ChangeNotifier {
|
|||
var _hoveredIndex = -1;
|
||||
var _pendingScroll = -1;
|
||||
|
||||
DateTime _lastRetryTime = DateTime.now();
|
||||
DateTime loaded = DateTime.now();
|
||||
|
||||
ContactInfoState(
|
||||
this.profileOnion,
|
||||
this.identifier,
|
||||
|
@ -124,6 +127,12 @@ class ContactInfoState extends ChangeNotifier {
|
|||
|
||||
MessageDraft get messageDraft => this._messageDraft;
|
||||
|
||||
DateTime get lastRetryTime => this._lastRetryTime;
|
||||
set lastRetryTime(DateTime lastRetryTime) {
|
||||
this._lastRetryTime = lastRetryTime;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
set antispamTickets(int antispamTickets) {
|
||||
this._antispamTickets = antispamTickets;
|
||||
notifyListeners();
|
||||
|
|
|
@ -33,6 +33,7 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
|
||||
bool _autostart = true;
|
||||
bool _enabled = false;
|
||||
bool _appearOffline = false;
|
||||
|
||||
ProfileInfoState({
|
||||
required this.onion,
|
||||
|
@ -45,6 +46,7 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
online = false,
|
||||
autostart = true,
|
||||
encrypted = true,
|
||||
appearOffline = false,
|
||||
String,
|
||||
}) {
|
||||
this._nickname = nickname;
|
||||
|
@ -57,6 +59,7 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
if (autostart) {
|
||||
this._enabled = true;
|
||||
}
|
||||
this._appearOffline = appearOffline;
|
||||
this._encrypted = encrypted;
|
||||
|
||||
_contacts.connectServers(this._servers);
|
||||
|
@ -175,12 +178,17 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
bool get autostart => this._autostart;
|
||||
|
||||
set autostart(bool newVal) {
|
||||
this._autostart = newVal;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool get appearOffline => this._appearOffline;
|
||||
set appearOffline(bool newVal) {
|
||||
this._appearOffline = newVal;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
String get defaultImagePath => this._defaultImagePath;
|
||||
|
||||
set defaultImagePath(String newVal) {
|
||||
|
|
|
@ -10,7 +10,7 @@ class ProfileListState extends ChangeNotifier {
|
|||
List<ProfileInfoState> _profiles = [];
|
||||
int get num => _profiles.length;
|
||||
|
||||
void add(String onion, String name, String picture, String defaultPicture, String contactsJson, String serverJson, bool online, bool autostart, bool encrypted) {
|
||||
void add(String onion, String name, String picture, String defaultPicture, String contactsJson, String serverJson, bool online, bool autostart, bool encrypted, bool appearOffline) {
|
||||
var idx = _profiles.indexWhere((element) => element.onion == onion);
|
||||
if (idx == -1) {
|
||||
_profiles.add(ProfileInfoState(
|
||||
|
@ -22,7 +22,8 @@ class ProfileListState extends ChangeNotifier {
|
|||
serversJson: serverJson,
|
||||
online: online,
|
||||
autostart: autostart,
|
||||
encrypted: encrypted));
|
||||
encrypted: encrypted,
|
||||
appearOffline: appearOffline));
|
||||
} else {
|
||||
_profiles[idx].updateFrom(onion, name, picture, contactsJson, serverJson, online);
|
||||
}
|
||||
|
|
|
@ -237,6 +237,9 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
Provider.of<ProfileInfoState>(context).enabled = value;
|
||||
if (value) {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.ActivatePeerEngine(Provider.of<ProfileInfoState>(context).onion);
|
||||
if (Provider.of<ProfileInfoState>(context).appearOffline == false) {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.ConfigureConnections(Provider.of<ProfileInfoState>(context).onion, true, true, true);
|
||||
}
|
||||
} else {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.DeactivatePeerEngine(Provider.of<ProfileInfoState>(context).onion);
|
||||
}
|
||||
|
@ -265,6 +268,25 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
),
|
||||
|
||||
// Auto start
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context)!.profileAppearOffline, style: TextStyle(color: Provider.of<Settings>(context).current().mainTextColor)),
|
||||
subtitle: Text(AppLocalizations.of(context)!.profileAppearOfflineDescription),
|
||||
value: Provider.of<ProfileInfoState>(context).appearOffline,
|
||||
onChanged: (bool value) {
|
||||
Provider.of<ProfileInfoState>(context).appearOffline = value;
|
||||
|
||||
if (!Provider.of<ProfileInfoState>(context).onion.isEmpty) {
|
||||
Provider.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.SetProfileAttribute(Provider.of<ProfileInfoState>(context).onion, "profile.appear-offline", value ? "true" : "false");
|
||||
}
|
||||
},
|
||||
activeTrackColor: Provider.of<Settings>(context).theme.defaultButtonColor,
|
||||
inactiveTrackColor: Provider.of<Settings>(context).theme.defaultButtonDisabledColor,
|
||||
secondary: Icon(CwtchIcons.favorite_24dp, color: Provider.of<Settings>(context).current().mainTextColor),
|
||||
),
|
||||
|
||||
Visibility(
|
||||
visible: Provider.of<ProfileInfoState>(context).onion.isEmpty,
|
||||
child: SizedBox(
|
||||
|
|
|
@ -121,7 +121,6 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
child: Scaffold(
|
||||
endDrawerEnableOpenDragGesture: false,
|
||||
drawerEnableOpenDragGesture: false,
|
||||
|
||||
appBar: AppBar(
|
||||
leading: Stack(children: [
|
||||
Align(
|
||||
|
@ -154,7 +153,6 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
}),
|
||||
)
|
||||
]),
|
||||
|
||||
title: Row(children: [
|
||||
PopupMenuButton<ProfileStatusMenu>(
|
||||
icon: ProfileImage(
|
||||
|
@ -351,7 +349,10 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
physics: BouncingScrollPhysics(),
|
||||
semanticChildCount: tilesSearchResult.length,
|
||||
itemBuilder: (context, index) {
|
||||
return tilesSearchResult.elementAt(index);
|
||||
if (tilesSearchResult.length > index) {
|
||||
return tilesSearchResult.elementAt(index);
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(height: 1);
|
||||
|
|
|
@ -106,6 +106,26 @@ class _MessageViewState extends State<MessageView> {
|
|||
splashRadius: Material.defaultSplashRadius / 2, icon: Icon(CwtchIcons.manage_files), tooltip: AppLocalizations.of(context)!.manageSharedFiles, onPressed: _pushFileSharingSettings));
|
||||
}
|
||||
|
||||
if (Provider.of<ContactInfoState>(context, listen: false).isOnline()) {
|
||||
appBarButtons.add(IconButton(
|
||||
splashRadius: Material.defaultSplashRadius / 2,
|
||||
icon: Icon(Icons.speaker_notes_off),
|
||||
tooltip: AppLocalizations.of(context)!.contactDisconnect,
|
||||
onPressed: () {
|
||||
if (Provider.of<ContactInfoState>(context, listen: false).isGroup) {
|
||||
Provider.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.DisconnectFromServer(Provider.of<ProfileInfoState>(context, listen: false).onion, Provider.of<ContactInfoState>(context, listen: false).server!);
|
||||
} else {
|
||||
Provider.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.DisconnectFromPeer(Provider.of<ProfileInfoState>(context, listen: false).onion, Provider.of<ContactInfoState>(context, listen: false).onion);
|
||||
}
|
||||
// reset the disconnect button to allow for immediate connection...
|
||||
Provider.of<ContactInfoState>(context, listen: false).lastRetryTime = DateTime.now().subtract(Duration(minutes: 2));
|
||||
}));
|
||||
}
|
||||
|
||||
var profile = Provider.of<ContactInfoState>(context, listen: false).profileOnion;
|
||||
var conversation = Provider.of<ContactInfoState>(context, listen: false).identifier;
|
||||
|
||||
|
|
|
@ -47,21 +47,39 @@ class _MessageListState extends State<MessageList> {
|
|||
// With the message cache in place this is no longer necessary
|
||||
bool loadMessages = true;
|
||||
|
||||
var reconnectButton = Visibility(
|
||||
visible: isP2P,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(2),
|
||||
child: Tooltip(
|
||||
// if it's been more than 2 minutes since we last clicked the button let users click the button again
|
||||
// OR if users have never clicked the button AND they appear offline, then they can click the button
|
||||
// NOTE: all these listeners are false...this is not ideal, but if they were true we would end up rebuilding the message view every tick (which would kill performance)
|
||||
// any significant changes in state e.g. peer offline or button clicks will trigger a rebuild anyway
|
||||
bool canReconnect = DateTime.now().difference(Provider.of<ContactInfoState>(context, listen: false).lastRetryTime).abs() > Duration(seconds: 60) ||
|
||||
Provider.of<ProfileInfoState>(context, listen: false).appearOffline &&
|
||||
(Provider.of<ContactInfoState>(context, listen: false).lastRetryTime == Provider.of<ContactInfoState>(context, listen: false).loaded);
|
||||
|
||||
var reconnectButton = Padding(
|
||||
padding: EdgeInsets.all(2),
|
||||
child: canReconnect
|
||||
? Tooltip(
|
||||
message: AppLocalizations.of(context)!.retryConnectionTooltip,
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(padding: MaterialStateProperty.all(EdgeInsets.all(20))),
|
||||
child: Text(AppLocalizations.of(context)!.retryConnection),
|
||||
onPressed: () {
|
||||
Provider.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.AttemptReconnection(Provider.of<ProfileInfoState>(context, listen: false).onion, Provider.of<ContactInfoState>(context, listen: false).onion);
|
||||
if (Provider.of<ContactInfoState>(context, listen: false).isGroup) {
|
||||
Provider.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.AttemptReconnectionServer(Provider.of<ProfileInfoState>(context, listen: false).onion, Provider.of<ContactInfoState>(context, listen: false).server!);
|
||||
} else {
|
||||
Provider.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.AttemptReconnection(Provider.of<ProfileInfoState>(context, listen: false).onion, Provider.of<ContactInfoState>(context, listen: false).onion);
|
||||
}
|
||||
Provider.of<ContactInfoState>(context, listen: false).lastRetryTime = DateTime.now();
|
||||
setState(() {
|
||||
// force update of this view...otherwise the button won't be removed fast enough...
|
||||
});
|
||||
},
|
||||
))));
|
||||
))
|
||||
: CircularProgressIndicator(color: Provider.of<Settings>(context).theme.defaultButtonTextColor));
|
||||
|
||||
return RepaintBoundary(
|
||||
child: Container(
|
||||
|
|
Loading…
Reference in New Issue