LCOV - code coverage report
Current view: top level - lib/cwtch - gomobile.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 209 0.0 %
Date: 2026-08-30 22:38:45 Functions: 0 0 -

          Line data    Source code
       1             : import 'dart:collection';
       2             : import 'dart:convert';
       3             : 
       4             : import 'package:cwtch/config.dart';
       5             : import 'package:flutter/services.dart';
       6             : import 'package:path_provider/path_provider.dart';
       7             : import 'dart:async';
       8             : import 'package:path/path.dart' as path;
       9             : 
      10             : import 'cwtch.dart';
      11             : import 'cwtchNotifier.dart';
      12             : 
      13             : /*
      14             : TODO: make a reusable plugin for other flutter apps
      15             : 
      16             : import 'package:federated_plugin_platform_interface/federated_plugin_platform_interface.dart';
      17             : 
      18             : /// It uses [FederatedPluginInterface]
      19             : Future startCwtch() async {
      20             :   return await FederatedPluginInterface.instance.startCwtch();
      21             : }
      22             :  */
      23             : 
      24             : class CwtchGomobile implements Cwtch {
      25             :   static const appInfoPlatform = const MethodChannel('test.flutter.dev/applicationInfo');
      26             :   static const cwtchPlatform = const MethodChannel('cwtch');
      27             : 
      28             :   final appbusEventChannelName = 'test.flutter.dev/eventBus';
      29             : 
      30             :   late Future<dynamic> androidLibraryDir;
      31             :   late Future<dynamic> androidHomeDirectory;
      32             :   String androidHomeDirectoryStr = "";
      33             :   String _cwtchDir = "";
      34             :   late CwtchNotifier cwtchNotifier;
      35             :   bool _isL10nInit = false;
      36             : 
      37           0 :   @override
      38             :   Future<HashMap<String, String>> PlatformChannelInfo() async {
      39           0 :     HashMap<String, String> info = HashMap<String, String>();
      40             : 
      41           0 :     info.addAll({"appInfoPlatform.name": appInfoPlatform.name});
      42           0 :     info.addAll({"appInfoPlatform.codec": appInfoPlatform.codec.toString()});
      43           0 :     EnvironmentConfig.debugLog("getting foreground service info...");
      44           0 :     appInfoPlatform.invokeMapMethod('getForegroundServiceInfo').then((foregroundServiceInfoMap) {
      45           0 :       EnvironmentConfig.debugLog("parsing foreground service info...");
      46           0 :       foregroundServiceInfoMap?.entries.forEach((element) {
      47           0 :         info.addAll({element.key.toString(): element.value.toString()});
      48             :       });
      49             :     });
      50           0 :     EnvironmentConfig.debugLog("returning foreground service info...");
      51             :     return info;
      52             :   }
      53             : 
      54           0 :   CwtchGomobile(CwtchNotifier _cwtchNotifier) {
      55           0 :     print("gomobile.dart: CwtchGomobile()");
      56           0 :     cwtchNotifier = _cwtchNotifier;
      57           0 :     cwtchNotifier.setMessageSeenCallback((String profile, int conversation, DateTime time) => {this.SetConversationAttribute(profile, conversation, LastMessageSeenTimeKey, time.toIso8601String())});
      58           0 :     androidHomeDirectory = getApplicationDocumentsDirectory();
      59           0 :     androidLibraryDir = appInfoPlatform.invokeMethod('getNativeLibDir');
      60             : 
      61             :     // Method channel to receive libcwtch-go events via Kotlin and dispatch them to _handleAppbusEvent (sends to cwtchNotifier)
      62           0 :     final appbusEventChannel = MethodChannel(appbusEventChannelName);
      63           0 :     appbusEventChannel.setMethodCallHandler(this._handleAppbusEvent);
      64             :   }
      65             : 
      66           0 :   String getAssetsDir() {
      67             :     // TODO
      68             :     return "";
      69             :   }
      70             : 
      71             :   // Requires Start() to have been run to initialize
      72           0 :   Future<String> getCwtchDir() async {
      73           0 :     return _cwtchDir;
      74             :   }
      75             : 
      76             :   // ignore: non_constant_identifier_names
      77           0 :   Future<void> Start() async {
      78           0 :     print("gomobile.dart: Start()...");
      79           0 :     androidHomeDirectoryStr = (await androidHomeDirectory).path;
      80           0 :     _cwtchDir = path.join(androidHomeDirectoryStr, ".cwtch");
      81           0 :     if (EnvironmentConfig.BUILD_VER == dev_version) {
      82           0 :       _cwtchDir = path.join(_cwtchDir, "dev");
      83             :     }
      84           0 :     String torPath = path.join(await androidLibraryDir, "libtor.so");
      85           0 :     print("gomobile.dart: Start invokeMethod Start($_cwtchDir, $torPath)...");
      86           0 :     cwtchPlatform.invokeMethod("Start", {"appDir": _cwtchDir, "torPath": torPath});
      87             :   }
      88             : 
      89             :   // Handle libcwtch-go events (received via kotlin) and dispatch to the cwtchNotifier
      90           0 :   Future<void> _handleAppbusEvent(MethodCall call) async {
      91           0 :     final String json = call.arguments;
      92           0 :     var obj = jsonDecode(json);
      93           0 :     cwtchNotifier.handleMessage(call.method, obj);
      94             :   }
      95             : 
      96             :   // ignore: non_constant_identifier_names
      97           0 :   Future<dynamic> CreateProfile(String nick, String pass, bool autostart) {
      98           0 :     return cwtchPlatform.invokeMethod("CreateProfile", {"nick": nick, "pass": pass, "autostart": autostart});
      99             :   }
     100             : 
     101             :   // ignore: non_constant_identifier_names
     102           0 :   void ActivatePeerEngine(String profile) {
     103           0 :     cwtchPlatform.invokeMethod("ActivatePeerEngine", {"profile": profile});
     104             :   }
     105             : 
     106             :   // ignore: non_constant_identifier_names
     107           0 :   void DeactivatePeerEngine(String profile) {
     108           0 :     cwtchPlatform.invokeMethod("DeactivatePeerEngine", {"profile": profile});
     109             :   }
     110             : 
     111             :   // ignore: non_constant_identifier_names
     112           0 :   void LoadProfiles(String pass) {
     113           0 :     cwtchPlatform.invokeMethod("LoadProfiles", {"pass": pass});
     114             :   }
     115             : 
     116             :   // ignore: non_constant_identifier_names
     117           0 :   void DeleteProfile(String onion, String pass) {
     118           0 :     cwtchPlatform.invokeMethod("DeleteProfile", {"ProfileOnion": onion, "pass": pass});
     119             :   }
     120             : 
     121             :   // ignore: non_constant_identifier_names
     122           0 :   Future<dynamic> GetMessage(String profile, int conversation, int index) {
     123           0 :     return cwtchPlatform.invokeMethod("GetMessage", {"ProfileOnion": profile, "conversation": conversation, "index": index});
     124             :   }
     125             : 
     126             :   // ignore: non_constant_identifier_names
     127           0 :   Future<dynamic> GetMessageByID(String profile, int conversation, int id) {
     128           0 :     return cwtchPlatform.invokeMethod("GetMessageByID", {"ProfileOnion": profile, "conversation": conversation, "id": id});
     129             :   }
     130             : 
     131             :   // ignore: non_constant_identifier_names
     132           0 :   Future<dynamic> GetMessages(String profile, int conversation, int index, int count) {
     133           0 :     return cwtchPlatform.invokeMethod("GetMessages", {"ProfileOnion": profile, "conversation": conversation, "index": index, "count": count});
     134             :   }
     135             : 
     136           0 :   @override
     137             :   // ignore: non_constant_identifier_names
     138             :   void SendProfileEvent(String onion, String jsonEvent) {
     139           0 :     cwtchPlatform.invokeMethod("SendProfileEvent", {"onion": onion, "jsonEvent": jsonEvent});
     140             :   }
     141             : 
     142           0 :   @override
     143             :   // ignore: non_constant_identifier_names
     144             :   void SendAppEvent(String jsonEvent) {
     145           0 :     cwtchPlatform.invokeMethod("SendAppEvent", {"jsonEvent": jsonEvent});
     146             :   }
     147             : 
     148           0 :   @override
     149           0 :   void dispose() => {};
     150             : 
     151           0 :   @override
     152             :   // ignore: non_constant_identifier_names
     153             :   void AcceptContact(String profileOnion, int conversation) {
     154           0 :     cwtchPlatform.invokeMethod("AcceptConversation", {"ProfileOnion": profileOnion, "conversation": conversation});
     155             :   }
     156             : 
     157           0 :   @override
     158             :   // ignore: non_constant_identifier_names
     159             :   void BlockContact(String profileOnion, int conversation) {
     160           0 :     cwtchPlatform.invokeMethod("BlockContact", {"ProfileOnion": profileOnion, "conversation": conversation});
     161             :   }
     162             : 
     163           0 :   @override
     164             :   // ignore: non_constant_identifier_names
     165             :   void UnblockContact(String profileOnion, int conversation) {
     166           0 :     cwtchPlatform.invokeMethod("UnblockContact", {"ProfileOnion": profileOnion, "conversation": conversation});
     167             :   }
     168             : 
     169           0 :   @override
     170             :   // ignore: non_constant_identifier_names
     171             :   Future<dynamic> SendMessage(String profileOnion, int conversation, String message) {
     172           0 :     return cwtchPlatform.invokeMethod("SendMessage", {"ProfileOnion": profileOnion, "conversation": conversation, "message": message});
     173             :   }
     174             : 
     175           0 :   @override
     176             :   // ignore: non_constant_identifier_names
     177             :   Future<dynamic> SendInvitation(String profileOnion, int conversation, int target) {
     178           0 :     return cwtchPlatform.invokeMethod("SendInvitation", {"ProfileOnion": profileOnion, "conversation": conversation, "target": target});
     179             :   }
     180             : 
     181           0 :   @override
     182             :   // ignore: non_constant_identifier_names
     183             :   Future<dynamic> ShareFile(String profileOnion, int conversation, String filepath) {
     184           0 :     return cwtchPlatform.invokeMethod("ShareFile", {"ProfileOnion": profileOnion, "conversation": conversation, "filepath": filepath});
     185             :   }
     186             : 
     187           0 :   @override
     188             :   // ignore: non_constant_identifier_names
     189             :   void DownloadFile(String profileOnion, int conversation, String filepath, String manifestpath, String filekey) {
     190           0 :     cwtchPlatform.invokeMethod("DownloadFile", {"ProfileOnion": profileOnion, "conversation": conversation, "filepath": filepath, "manifestpath": manifestpath, "filekey": filekey});
     191             :   }
     192             : 
     193             :   // ignore: non_constant_identifier_names
     194           0 :   void CreateDownloadableFile(String profileOnion, int conversation, String filenameSuggestion, String filekey, String manifestpath) {
     195           0 :     cwtchPlatform.invokeMethod("CreateDownloadableFile", {
     196             :       "ProfileOnion": profileOnion,
     197             :       "conversation": conversation,
     198             :       "manifestpath": manifestpath,
     199             :       "filename": filenameSuggestion,
     200             :       "filekey": filekey,
     201             :     });
     202             :   }
     203             : 
     204             :   // ignore: non_constant_identifier_names
     205           0 :   void ExportPreviewedFile(String sourceFile, String suggestion) {
     206           0 :     cwtchPlatform.invokeMethod("ExportPreviewedFile", {"Path": sourceFile, "FileName": suggestion});
     207             :   }
     208             : 
     209           0 :   @override
     210             :   // ignore: non_constant_identifier_names
     211             :   void CheckDownloadStatus(String profileOnion, String fileKey) {
     212           0 :     cwtchPlatform.invokeMethod("CheckDownloadStatus", {"ProfileOnion": profileOnion, "fileKey": fileKey});
     213             :   }
     214             : 
     215           0 :   @override
     216             :   // ignore: non_constant_identifier_names
     217             :   void VerifyOrResumeDownload(String profileOnion, int conversation, String filekey) {
     218           0 :     cwtchPlatform.invokeMethod("VerifyOrResumeDownload", {"ProfileOnion": profileOnion, "conversation": conversation, "filekey": filekey});
     219             :   }
     220             : 
     221           0 :   @override
     222             :   // ignore: non_constant_identifier_names
     223             :   void ResetTor() {
     224           0 :     cwtchPlatform.invokeMethod("ResetTor", {});
     225             :   }
     226             : 
     227           0 :   @override
     228             :   // ignore: non_constant_identifier_names
     229             :   Future<dynamic> ImportBundle(String profileOnion, String bundle) {
     230           0 :     return cwtchPlatform.invokeMethod("ImportBundle", {"ProfileOnion": profileOnion, "bundle": bundle});
     231             :   }
     232             : 
     233           0 :   @override
     234             :   void CreateGroup(String profileOnion, String server, String groupName) {
     235           0 :     cwtchPlatform.invokeMethod("CreateGroup", {"ProfileOnion": profileOnion, "server": server, "groupName": groupName});
     236             :   }
     237             : 
     238           0 :   @override
     239             :   // ignore: non_constant_identifier_names
     240             :   void DeleteContact(String profileOnion, int conversation) {
     241           0 :     cwtchPlatform.invokeMethod("DeleteConversation", {"ProfileOnion": profileOnion, "conversation": conversation});
     242             :   }
     243             : 
     244           0 :   @override
     245             :   // ignore: non_constant_identifier_names
     246             :   void ArchiveConversation(String profileOnion, int conversation) {
     247           0 :     cwtchPlatform.invokeMethod("ArchiveConversation", {"ProfileOnion": profileOnion, "conversation": conversation});
     248             :   }
     249             : 
     250           0 :   @override
     251             :   // ignore: non_constant_identifier_names
     252             :   void SetProfileAttribute(String profile, String key, String val) {
     253           0 :     cwtchPlatform.invokeMethod("SetProfileAttribute", {"ProfileOnion": profile, "Key": key, "Val": val});
     254             :   }
     255             : 
     256           0 :   @override
     257             :   // ignore: non_constant_identifier_names
     258             :   void SetConversationAttribute(String profile, int conversation, String key, String val) {
     259           0 :     cwtchPlatform.invokeMethod("SetConversationAttribute", {"ProfileOnion": profile, "conversation": conversation, "Key": key, "Val": val});
     260             :   }
     261             : 
     262           0 :   @override
     263             :   // ignore: non_constant_identifier_names
     264             :   void LoadServers(String password) {
     265           0 :     cwtchPlatform.invokeMethod("LoadServers", {"Password": password});
     266             :   }
     267             : 
     268           0 :   @override
     269             :   // ignore: non_constant_identifier_names
     270             :   void CreateServer(String password, String description, bool autostart) {
     271           0 :     cwtchPlatform.invokeMethod("CreateServer", {"Password": password, "Description": description, "Autostart": autostart});
     272             :   }
     273             : 
     274           0 :   @override
     275             :   // ignore: non_constant_identifier_names
     276             :   void DeleteServer(String serverOnion, String password) {
     277           0 :     cwtchPlatform.invokeMethod("DeleteServer", {"ServerOnion": serverOnion, "Password": password});
     278             :   }
     279             : 
     280           0 :   @override
     281             :   // ignore: non_constant_identifier_names
     282             :   void LaunchServers() {
     283           0 :     cwtchPlatform.invokeMethod("LaunchServers", {});
     284             :   }
     285             : 
     286           0 :   @override
     287             :   // ignore: non_constant_identifier_names
     288             :   void LaunchServer(String serverOnion) {
     289           0 :     cwtchPlatform.invokeMethod("LaunchServer", {"ServerOnion": serverOnion});
     290             :   }
     291             : 
     292           0 :   @override
     293             :   // ignore: non_constant_identifier_names
     294             :   void StopServer(String serverOnion) {
     295           0 :     cwtchPlatform.invokeMethod("StopServer", {"ServerOnion": serverOnion});
     296             :   }
     297             : 
     298           0 :   @override
     299             :   // ignore: non_constant_identifier_names
     300             :   void StopServers() {
     301           0 :     cwtchPlatform.invokeMethod("StopServers", {});
     302             :   }
     303             : 
     304           0 :   @override
     305             :   // ignore: non_constant_identifier_names
     306             :   void DestroyServers() {
     307           0 :     cwtchPlatform.invokeMethod("DestroyServers", {});
     308             :   }
     309             : 
     310           0 :   @override
     311             :   // ignore: non_constant_identifier_names
     312             :   void SetServerAttribute(String serverOnion, String key, String val) {
     313           0 :     cwtchPlatform.invokeMethod("SetServerAttribute", {"ServerOnion": serverOnion, "Key": key, "Val": val});
     314             :   }
     315             : 
     316           0 :   @override
     317             :   // ignore: non_constant_identifier_names
     318             :   void LoadHybridGroups(String password) {
     319           0 :     cwtchPlatform.invokeMethod("LoadHybridGroup", {"Password": password});
     320             :   }
     321             : 
     322           0 :   @override
     323             :   // ignore: non_constant_identifier_names
     324             :   void CreateHybridGroup(String password, String description, bool autostart, String groupAdmin) {
     325           0 :     cwtchPlatform.invokeMethod("CreateHybridGroup", {"Password": password, "Description": description, "Autostart": autostart, "GroupAdmin": groupAdmin});
     326             :   }
     327             : 
     328           0 :   @override
     329             :   // ignore: non_constant_identifier_names
     330             :   void DeleteHybridGroup(String groupOnion, String password) {
     331           0 :     cwtchPlatform.invokeMethod("DeleteHybridGroup", {"GroupOnion": groupOnion, "Password": password});
     332             :   }
     333             : 
     334           0 :   @override
     335             :   // ignore: non_constant_identifier_names
     336             :   void LaunchHybridGroups() {
     337           0 :     cwtchPlatform.invokeMethod("LaunchHybridGroups", {});
     338             :   }
     339             : 
     340           0 :   @override
     341             :   // ignore: non_constant_identifier_names
     342             :   void LaunchHybridGroup(String groupOnion) {
     343           0 :     cwtchPlatform.invokeMethod("LaunchHybridGroup", {"GroupOnion": groupOnion});
     344             :   }
     345             : 
     346           0 :   @override
     347             :   // ignore: non_constant_identifier_names
     348             :   void StopHybridGroup(String groupOnion) {
     349           0 :     cwtchPlatform.invokeMethod("StopHybridGroup", {"GroupOnion": groupOnion});
     350             :   }
     351             : 
     352           0 :   @override
     353             :   // ignore: non_constant_identifier_names
     354             :   void StopHybridGroups() {
     355           0 :     cwtchPlatform.invokeMethod("StopHybridGroups", {});
     356             :   }
     357             : 
     358           0 :   @override
     359             :   // ignore: non_constant_identifier_names
     360             :   void DestroyHybridGroups() {
     361           0 :     cwtchPlatform.invokeMethod("DestroyHybridGroups", {});
     362             :   }
     363             : 
     364           0 :   @override
     365             :   // ignore: non_constant_identifier_names
     366             :   void SetHybridGroupAttribute(String groupOnion, String key, String val) {
     367           0 :     cwtchPlatform.invokeMethod("SetHybridGroupAttribute", {"GroupOnion": groupOnion, "Key": key, "Val": val});
     368             :   }
     369             : 
     370           0 :   @override
     371             :   // ignore: non_constant_identifier_names
     372             :   void ChangeGroupMode(String profile, int conversation, String mode) {
     373           0 :     cwtchPlatform.invokeMethod("ChangeGroupMode", {"ProfileOnion": profile, "conversation": conversation, "mode": mode});
     374             :   }
     375             : 
     376           0 :   @override
     377             :   // ignore: non_constant_identifier_names
     378             :   void ChangeGroupMask(String profile, int conversation, String mode) {
     379           0 :     cwtchPlatform.invokeMethod("ChangeGroupMask", {"ProfileOnion": profile, "conversation": conversation, "mode": mode});
     380             :   }
     381             : 
     382           0 :   @override
     383             :   // ignore: non_constant_identifier_names
     384             :   void ChangeRole(String profile, int conversation, String handle, String role) {
     385           0 :     cwtchPlatform.invokeMethod("ChangeRole", {"ProfileOnion": profile, "conversation": conversation, "handle": handle, "role": role});
     386             :   }
     387             : 
     388           0 :   @override
     389             :   // ignore: non_constant_identifier_names
     390             :   void InviteMember(String profile, int conversation, String handle) {
     391           0 :     cwtchPlatform.invokeMethod("InviteMember", {"ProfileOnion": profile, "conversation": conversation, "handle": handle});
     392             :   }
     393             : 
     394           0 :   @override
     395             :   // ignore: non_constant_identifier_names
     396             :   void KickMember(String profile, int conversation, String handle) {
     397           0 :     cwtchPlatform.invokeMethod("KickMember", {"ProfileOnion": profile, "conversation": conversation, "handle": handle});
     398             :   }
     399             : 
     400           0 :   @override
     401             :   // ignore: non_constant_identifier_names
     402             :   void ModerateMessage(String profile, int conversation, String signature, String action) {
     403           0 :     cwtchPlatform.invokeMethod("ModerateMessage", {"ProfileOnion": profile, "conversation": conversation, "signature": signature, "action": action});
     404             :   }
     405             : 
     406           0 :   @override
     407             :   // ignore: non_constant_identifier_names
     408             :   void UpdateGroupMetadata(String profile, int conversation, String name, String attr1, String attr2, String attr3) {
     409           0 :     cwtchPlatform.invokeMethod("UpdateGroupMetadata", {"ProfileOnion": profile, "conversation": conversation, "name": name, "a1": attr1, "a2": attr2, "a3": attr3});
     410             :   }
     411             : 
     412           0 :   @override
     413             :   // ignore: non_constant_identifier_names
     414             :   void UpdateGroupPicture(String profile, int conversation, String filePath) {
     415           0 :     cwtchPlatform.invokeMethod("UpdateGroupPicture", {"ProfileOnion": profile, "conversation": conversation, "filePath": filePath});
     416             :   }
     417             : 
     418           0 :   @override
     419             :   Future<void> Shutdown() async {
     420           0 :     print("gomobile.dart Shutdown");
     421           0 :     cwtchPlatform.invokeMethod("Shutdown", {});
     422             :   }
     423             : 
     424           0 :   @override
     425             :   Future GetMessageByContentHash(String profile, int conversation, String contentHash) {
     426           0 :     return cwtchPlatform.invokeMethod("GetMessageByContentHash", {"ProfileOnion": profile, "conversation": conversation, "contentHash": contentHash});
     427             :   }
     428             : 
     429           0 :   @override
     430             :   void SetMessageAttribute(String profile, int conversation, int channel, int message, String key, String val) {
     431           0 :     cwtchPlatform.invokeMethod("SetMessageAttribute", {"ProfileOnion": profile, "conversation": conversation, "Channel": channel, "Message": message, "Key": key, "Val": val});
     432             :   }
     433             : 
     434           0 :   @override
     435             :   String? defaultDownloadPath() {
     436           0 :     return this.androidHomeDirectoryStr;
     437             :   }
     438             : 
     439           0 :   @override
     440             :   void ChangePassword(String profile, String pass, String newpass, String newpassAgain) {
     441           0 :     cwtchPlatform.invokeMethod("ChangePassword", {"ProfileOnion": profile, "OldPass": pass, "NewPass": newpass, "NewPassAgain": newpassAgain});
     442             :   }
     443             : 
     444           0 :   @override
     445             :   bool isL10nInit() {
     446           0 :     return _isL10nInit;
     447             :   }
     448             : 
     449           0 :   @override
     450             :   void l10nInit(String notificationSimple, String notificationConversationInfo) {
     451           0 :     cwtchNotifier.l10nInit(notificationSimple, notificationConversationInfo);
     452           0 :     cwtchPlatform.invokeMethod("L10nInit", {"notificationSimple": notificationSimple, "notificationConversationInfo": notificationConversationInfo});
     453           0 :     _isL10nInit = true;
     454             :   }
     455             : 
     456           0 :   @override
     457             :   // ignore: non_constant_identifier_names
     458             :   void ExportProfile(String profile, String file) {
     459           0 :     cwtchPlatform.invokeMethod("ExportProfile", {"ProfileOnion": profile, "file": file});
     460             :   }
     461             : 
     462           0 :   @override
     463             :   // ignore: non_constant_identifier_names
     464             :   Future<dynamic> ImportProfile(String file, String pass) {
     465           0 :     return cwtchPlatform.invokeMethod("ImportProfile", {"file": file, "pass": pass});
     466             :   }
     467             : 
     468           0 :   @override
     469             :   Future GetDebugInfo() {
     470             :     // FIXME: getDebugInfo is less useful for Android so for now
     471             :     // we don't implement it
     472           0 :     return Future.value("{}");
     473             :   }
     474             : 
     475           0 :   @override
     476             :   Future GetSharedFiles(String profile, int handle) {
     477           0 :     return cwtchPlatform.invokeMethod("GetSharedFiles", {"ProfileOnion": profile, "conversation": handle});
     478             :   }
     479             : 
     480           0 :   @override
     481             :   void RestartSharing(String profile, String filekey) {
     482           0 :     cwtchPlatform.invokeMethod("RestartFileShare", {"ProfileOnion": profile, "filekey": filekey});
     483             :   }
     484             : 
     485           0 :   @override
     486             :   void StopSharing(String profile, String filekey) {
     487           0 :     cwtchPlatform.invokeMethod("StopSharing", {"ProfileOnion": profile, "filekey": filekey});
     488             :   }
     489             : 
     490           0 :   @override
     491             :   void DeleteServerInfo(String profile, String handle) {
     492           0 :     cwtchPlatform.invokeMethod("DeleteServerInfo", {"ProfileOnion": profile, "handle": handle});
     493             :   }
     494             : 
     495           0 :   @override
     496             :   void UpdateSettings(String json) {
     497           0 :     cwtchPlatform.invokeMethod("UpdateSettings", {"json": json});
     498             :   }
     499             : 
     500           0 :   @override
     501             :   bool IsManagedGroupsCompiled() {
     502             :     return false;
     503             :   }
     504             : 
     505           0 :   @override
     506             :   bool IsServersCompiled() {
     507             :     // never for android builds...
     508             :     return false;
     509             :   }
     510             : 
     511           0 :   @override
     512             :   Future<String> SummarizeConversation(String profile, int conversation) {
     513             :     // TODO: implement SummarizeConversation
     514           0 :     throw UnimplementedError();
     515             :   }
     516             : 
     517           0 :   @override
     518             :   Future<String> TranslateMessage(String profile, int conversation, int message, String language) {
     519             :     // TODO: implement TranslateMessage
     520           0 :     throw UnimplementedError();
     521             :   }
     522             : 
     523           0 :   @override
     524             :   bool IsBlodeuweddSupported() {
     525             :     // Blodeuwedd is not currently supported on lower end devices.
     526             :     return false;
     527             :   }
     528             : 
     529           0 :   @override
     530             :   Future<String?> GetProfileAttribute(String profile, String key) async {
     531           0 :     return await cwtchPlatform.invokeMethod("GetProfileAttribute", {"ProfileOnion": profile, "key": key}).then((dynamic json) {
     532           0 :       var value = jsonDecode(json);
     533           0 :       if (value["Exists"]) {
     534           0 :         return value["Value"];
     535             :       }
     536             :       return null;
     537             :     });
     538             :   }
     539             : 
     540           0 :   @override
     541             :   Future<String?> GetConversationAttribute(String profile, int conversation, String key) async {
     542           0 :     return await cwtchPlatform.invokeMethod("GetConversationAttribute", {"ProfileOnion": profile, "conversation": conversation, "key": key}).then((dynamic json) {
     543           0 :       var value = jsonDecode(json);
     544           0 :       if (value["Exists"]) {
     545           0 :         return value["Value"];
     546             :       }
     547             :       return null;
     548             :     });
     549             :   }
     550             : 
     551           0 :   @override
     552             :   void AttemptReconnection(String profile, String onion) {
     553           0 :     cwtchPlatform.invokeMethod("PeerWithOnion", {"ProfileOnion": profile, "onion": onion});
     554             :   }
     555             : 
     556           0 :   @override
     557             :   void AttemptReconnectionServer(String profile, String onion) {
     558           0 :     cwtchPlatform.invokeMethod("QueueJoinServer", {"ProfileOnion": profile, "onion": onion});
     559             :   }
     560             : 
     561           0 :   @override
     562             :   void DisconnectFromPeer(String profile, String onion) {
     563           0 :     cwtchPlatform.invokeMethod("DisconnectFromPeer", {"ProfileOnion": profile, "onion": onion});
     564             :   }
     565             : 
     566           0 :   @override
     567             :   void DisconnectFromServer(String profile, String onion) {
     568           0 :     cwtchPlatform.invokeMethod("DisconnectFromServer", {"ProfileOnion": profile, "onion": onion});
     569             :   }
     570             : 
     571           0 :   @override
     572             :   Future<String> SearchConversations(String profile, String pattern) async {
     573           0 :     return await cwtchPlatform.invokeMethod("SearchConversations", {"ProfileOnion": profile, "pattern": pattern});
     574             :   }
     575             : 
     576           0 :   @override
     577             :   Future<void> ConfigureConnections(String profile, bool listen, bool peers, bool servers) async {
     578           0 :     cwtchPlatform.invokeMethod("ConfigureConnections", {"ProfileOnion": profile, "listen": listen, "peers": peers, "servers": servers});
     579             :     return;
     580             :   }
     581             : 
     582           0 :   @override
     583             :   void PublishServerUpdate(String profile) {
     584           0 :     cwtchPlatform.invokeMethod("PublishServerUpdate", {"ProfileOnion": profile});
     585             :   }
     586             : 
     587           0 :   @override
     588             :   bool IsLoaded() {
     589             :     return true;
     590             :   }
     591             : }

Generated by: LCOV version 1.14