UI Updates to new Cwtch API
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
1d6b533df3
commit
880c1c107b
|
@ -23,7 +23,8 @@ class CwtchNotifier {
|
|||
late AppState appState;
|
||||
late ServerListState serverListState;
|
||||
|
||||
CwtchNotifier(ProfileListState pcn, Settings settingsCN, ErrorHandler errorCN, TorStatus torStatusCN, NotificationsManager notificationManagerP, AppState appStateCN, ServerListState serverListStateCN) {
|
||||
CwtchNotifier(
|
||||
ProfileListState pcn, Settings settingsCN, ErrorHandler errorCN, TorStatus torStatusCN, NotificationsManager notificationManagerP, AppState appStateCN, ServerListState serverListStateCN) {
|
||||
profileCN = pcn;
|
||||
settings = settingsCN;
|
||||
error = errorCN;
|
||||
|
@ -51,7 +52,7 @@ class CwtchNotifier {
|
|||
EnvironmentConfig.debugLog("NewServer $data");
|
||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.add(ContactInfoState(
|
||||
data["ProfileOnion"],
|
||||
data["ConversationID"],
|
||||
int.parse(data["ConversationID"]),
|
||||
data["RemotePeer"],
|
||||
nickname: data["nick"],
|
||||
status: data["status"],
|
||||
|
@ -68,13 +69,7 @@ class CwtchNotifier {
|
|||
break;
|
||||
case "NewServer":
|
||||
EnvironmentConfig.debugLog("NewServer $data");
|
||||
serverListState.add(
|
||||
data["Onion"],
|
||||
data["ServerBundle"],
|
||||
data["Running"] == "true",
|
||||
data["Description"],
|
||||
data["Autostart"] == "true",
|
||||
data["StorageType"] == "storage-password");
|
||||
serverListState.add(data["Onion"], data["ServerBundle"], data["Running"] == "true", data["Description"], data["Autostart"] == "true", data["StorageType"] == "storage-password");
|
||||
break;
|
||||
case "ServerIntentUpdate":
|
||||
EnvironmentConfig.debugLog("ServerIntentUpdate $data");
|
||||
|
@ -207,7 +202,7 @@ class CwtchNotifier {
|
|||
// For now we perform some minimal checks on the sent timestamp to use to provide a useful ordering for honest contacts
|
||||
// and ensure that malicious contacts in groups can only set this timestamp to a value within the range of `last seen message time`
|
||||
// and `local now`.
|
||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["GroupID"], timestampSent.toLocal());
|
||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(identifier, timestampSent.toLocal());
|
||||
notificationManager.notify("New Message From Group!");
|
||||
}
|
||||
} else {
|
||||
|
@ -271,8 +266,8 @@ class CwtchNotifier {
|
|||
case "UpdateGlobalSettings":
|
||||
settings.handleUpdate(jsonDecode(data["Data"]));
|
||||
break;
|
||||
case "SetAttribute":
|
||||
if (data["Key"] == "public.name") {
|
||||
case "UpdatedProfileAttribute":
|
||||
if (data["Key"] == "public.profile.name") {
|
||||
profileCN.getProfile(data["ProfileOnion"])?.nickname = data["Data"];
|
||||
} else {
|
||||
EnvironmentConfig.debugLog("unhandled set attribute event: ${data['Key']}");
|
||||
|
|
|
@ -66,7 +66,13 @@ typedef get_json_blob_from_str_int_int_function = Pointer<Utf8> Function(Pointer
|
|||
typedef GetJsonBlobFromStrIntIntFn = Pointer<Utf8> Function(Pointer<Utf8>, int, int, int);
|
||||
|
||||
typedef get_json_blob_from_str_int_string_function = Pointer<Utf8> Function(Pointer<Utf8>, Int32, Int32, Pointer<Utf8>, Int32);
|
||||
typedef GetJsonBlobFromStrIntStringFn = Pointer<Utf8> Function(Pointer<Utf8>, int, int, Pointer<Utf8>, int,);
|
||||
typedef GetJsonBlobFromStrIntStringFn = Pointer<Utf8> Function(
|
||||
Pointer<Utf8>,
|
||||
int,
|
||||
int,
|
||||
Pointer<Utf8>,
|
||||
int,
|
||||
);
|
||||
|
||||
// func c_GetMessagesByContentHash(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, contenthash_ptr *C.char, contenthash_len C.int) *C.char
|
||||
typedef get_json_blob_from_str_str_str_function = Pointer<Utf8> Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Pointer<Utf8>, Int32);
|
||||
|
@ -78,10 +84,9 @@ typedef VoidFromStringIntStringFn = void Function(Pointer<Utf8>, int, int, Point
|
|||
typedef void_from_string_int_string_string_function = Void Function(Pointer<Utf8>, Int32, Int32, Pointer<Utf8>, Int32, Pointer<Utf8>, Int32);
|
||||
typedef VoidFromStringIntStringStringFn = void Function(Pointer<Utf8>, int, int, Pointer<Utf8>, int, Pointer<Utf8>, int);
|
||||
|
||||
typedef void_from_string_int_int_function =Void Function(Pointer<Utf8>, Int32, Int32, Int32);
|
||||
typedef void_from_string_int_int_function = Void Function(Pointer<Utf8>, Int32, Int32, Int32);
|
||||
typedef VoidFromStringIntIntFn = void Function(Pointer<Utf8>, int, int, int);
|
||||
|
||||
|
||||
typedef appbus_events_function = Pointer<Utf8> Function();
|
||||
typedef AppbusEventsFn = Pointer<Utf8> Function();
|
||||
|
||||
|
@ -325,7 +330,7 @@ class CwtchFfi implements Cwtch {
|
|||
@override
|
||||
// ignore: non_constant_identifier_names
|
||||
void AcceptContact(String profileOnion, int contactHandle) {
|
||||
var acceptContact = library.lookup<NativeFunction<string_int_to_void_function>>("c_AcceptContact");
|
||||
var acceptContact = library.lookup<NativeFunction<string_int_to_void_function>>("c_AcceptConversation");
|
||||
// ignore: non_constant_identifier_names
|
||||
final AcceptContact = acceptContact.asFunction<VoidFromStringIntFn>();
|
||||
final u1 = profileOnion.toNativeUtf8();
|
||||
|
@ -430,7 +435,6 @@ class CwtchFfi implements Cwtch {
|
|||
malloc.free(u3);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
// ignore: non_constant_identifier_names
|
||||
void ResetTor() {
|
||||
|
@ -453,7 +457,6 @@ class CwtchFfi implements Cwtch {
|
|||
malloc.free(u2);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
// ignore: non_constant_identifier_names
|
||||
void RejectInvite(String profileOnion, int groupHandle) {
|
||||
|
@ -490,7 +493,6 @@ class CwtchFfi implements Cwtch {
|
|||
final u1 = profileOnion.toNativeUtf8();
|
||||
ArchiveConversation(u1, u1.length, handle);
|
||||
malloc.free(u1);
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -504,7 +506,6 @@ class CwtchFfi implements Cwtch {
|
|||
malloc.free(u1);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
// ignore: non_constant_identifier_names
|
||||
void DeleteProfile(String onion, String currentPassword) {
|
||||
|
@ -526,7 +527,7 @@ class CwtchFfi implements Cwtch {
|
|||
final SetProfileAttribute = setProfileAttribute.asFunction<VoidFromStringStringStringFn>();
|
||||
final u1 = profile.toNativeUtf8();
|
||||
final u2 = key.toNativeUtf8();
|
||||
final u3 = key.toNativeUtf8();
|
||||
final u3 = val.toNativeUtf8();
|
||||
SetProfileAttribute(u1, u1.length, u2, u2.length, u3, u3.length);
|
||||
malloc.free(u1);
|
||||
malloc.free(u2);
|
||||
|
|
|
@ -201,7 +201,6 @@ class CwtchGomobile implements Cwtch {
|
|||
cwtchPlatform.invokeMethod("ArchiveConversation", {"ProfileOnion": profileOnion, "handle": contactHandle});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
// ignore: non_constant_identifier_names
|
||||
void SetProfileAttribute(String profile, String key, String val) {
|
||||
|
|
|
@ -208,7 +208,6 @@ class ContactListState extends ChangeNotifier {
|
|||
int idx = _contacts.indexWhere((element) => element.onion == byHandle);
|
||||
return idx >= 0 ? _contacts[idx] : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ProfileInfoState extends ChangeNotifier {
|
||||
|
@ -601,7 +600,7 @@ class ContactInfoState extends ChangeNotifier {
|
|||
if (newVal > 0) {
|
||||
this._newMarker = newVal;
|
||||
} else {
|
||||
this._newMarkerClearAt = DateTime.now().add(const Duration(minutes:2));
|
||||
this._newMarkerClearAt = DateTime.now().add(const Duration(minutes: 2));
|
||||
}
|
||||
this._unreadMessages = newVal;
|
||||
notifyListeners();
|
||||
|
@ -616,6 +615,7 @@ class ContactInfoState extends ChangeNotifier {
|
|||
}
|
||||
return this._newMarker;
|
||||
}
|
||||
|
||||
// what's a getter that sometimes sets without a setter
|
||||
// that sometimes doesn't set
|
||||
set newMarker(int newVal) {
|
||||
|
|
|
@ -127,5 +127,6 @@ class MessageMetadata extends ChangeNotifier {
|
|||
notifyListeners();
|
||||
}
|
||||
|
||||
MessageMetadata(this.profileOnion, this.conversationIdentifier, this.messageIndex, this.messageID, this.timestamp, this.senderHandle, this.senderImage, this.signature, this._flags, this._ackd, this._error);
|
||||
MessageMetadata(
|
||||
this.profileOnion, this.conversationIdentifier, this.messageIndex, this.messageID, this.timestamp, this.senderHandle, this.senderImage, this.signature, this._flags, this._ackd, this._error);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,7 @@ class ServerListState extends ChangeNotifier {
|
|||
if (idx >= 0) {
|
||||
_servers[idx] = sis;
|
||||
} else {
|
||||
_servers.add(ServerInfoState(onion: onion,
|
||||
serverBundle: serverBundle,
|
||||
running: running,
|
||||
description: description,
|
||||
autoStart: autoStart,
|
||||
isEncrypted: isEncrypted));
|
||||
_servers.add(ServerInfoState(onion: onion, serverBundle: serverBundle, running: running, description: description, autoStart: autoStart, isEncrypted: isEncrypted));
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
|
|
@ -296,11 +296,13 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
// Profile Editing
|
||||
if (ctrlrPass.value.text.isEmpty) {
|
||||
// Don't update password, only update name
|
||||
Provider.of<ProfileInfoState>(context, listen: false).nickname = ctrlrNick.value.text;
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(Provider.of<ProfileInfoState>(context, listen: false).onion, "profile.name", ctrlrNick.value.text);
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
// At this points passwords have been validated to be the same and not empty
|
||||
// Update both password and name, even if name hasn't been changed...
|
||||
Provider.of<ProfileInfoState>(context, listen: false).nickname = ctrlrNick.value.text;
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(Provider.of<ProfileInfoState>(context, listen: false).onion, "profile.name", ctrlrNick.value.text);
|
||||
final updatePasswordEvent = {
|
||||
"EventType": "ChangePassword",
|
||||
|
|
|
@ -53,7 +53,6 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: ctrlrOnion.text.isEmpty ? Text(AppLocalizations.of(context)!.addServerTitle) : Text(AppLocalizations.of(context)!.editServerTitle),
|
||||
|
@ -83,10 +82,8 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
key: _formKey,
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(30, 0, 30, 10),
|
||||
padding: EdgeInsets.fromLTRB(20, 0 , 20, 10),
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 10),
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: [
|
||||
// Onion
|
||||
Visibility(
|
||||
visible: serverInfoState.onion.isNotEmpty,
|
||||
|
@ -98,9 +95,7 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
SelectableText(
|
||||
serverInfoState.onion
|
||||
)
|
||||
SelectableText(serverInfoState.onion)
|
||||
])),
|
||||
|
||||
// Description
|
||||
|
@ -152,7 +147,7 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
onChanged: (bool value) {
|
||||
serverInfoState.setAutostart(value);
|
||||
|
||||
if (! serverInfoState.onion.isEmpty) {
|
||||
if (!serverInfoState.onion.isEmpty) {
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetServerAttribute(serverInfoState.onion, "autostart", value ? "true" : "false");
|
||||
}
|
||||
},
|
||||
|
@ -161,7 +156,6 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
secondary: Icon(CwtchIcons.favorite_24dp, color: settings.current().mainTextColor()),
|
||||
),
|
||||
|
||||
|
||||
// ***** Password *****
|
||||
|
||||
// use password toggle
|
||||
|
@ -195,7 +189,6 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
),
|
||||
])),
|
||||
|
||||
|
||||
// current password
|
||||
Visibility(
|
||||
visible: serverInfoState.onion.isNotEmpty && serverInfoState.isEncrypted,
|
||||
|
@ -209,10 +202,7 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
autoFillHints: [AutofillHints.newPassword],
|
||||
validator: (value) {
|
||||
// Password field can be empty when just updating the profile, not on creation
|
||||
if (serverInfoState.isEncrypted &&
|
||||
serverInfoState.onion.isEmpty &&
|
||||
value.isEmpty &&
|
||||
usePassword) {
|
||||
if (serverInfoState.isEncrypted && serverInfoState.onion.isEmpty && value.isEmpty && usePassword) {
|
||||
return AppLocalizations.of(context)!.passwordErrorEmpty;
|
||||
}
|
||||
if (Provider.of<ErrorHandler>(context).deletedServerError == true) {
|
||||
|
@ -306,7 +296,6 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
]))
|
||||
|
||||
// ***** END Password *****
|
||||
|
||||
]))))));
|
||||
});
|
||||
});
|
||||
|
@ -318,29 +307,20 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
// match (and are provided if the user has requested an encrypted profile).
|
||||
if (_formKey.currentState!.validate()) {
|
||||
if (usePassword) {
|
||||
Provider
|
||||
.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.CreateServer(ctrlrPass.value.text, ctrlrDesc.value.text, Provider.of<ServerInfoState>(context, listen: false).autoStart);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateServer(ctrlrPass.value.text, ctrlrDesc.value.text, Provider.of<ServerInfoState>(context, listen: false).autoStart);
|
||||
} else {
|
||||
Provider
|
||||
.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.CreateServer(DefaultPassword, ctrlrDesc.value.text, Provider.of<ServerInfoState>(context, listen: false).autoStart);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateServer(DefaultPassword, ctrlrDesc.value.text, Provider.of<ServerInfoState>(context, listen: false).autoStart);
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
|
||||
void _savePressed() {
|
||||
|
||||
var server = Provider.of<ServerInfoState>(context, listen: false);
|
||||
|
||||
Provider.of<FlwtchState>(context, listen: false)
|
||||
.cwtch.SetServerAttribute(server.onion, "description", ctrlrDesc.text);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetServerAttribute(server.onion, "description", ctrlrDesc.text);
|
||||
server.setDescription(ctrlrDesc.text);
|
||||
|
||||
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// TODO support change password
|
||||
}
|
||||
|
@ -358,13 +338,8 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
Widget continueButton = ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context)!.deleteServerConfirmBtn),
|
||||
onPressed: () {
|
||||
var onion = Provider
|
||||
.of<ServerInfoState>(context, listen: false)
|
||||
.onion;
|
||||
Provider
|
||||
.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.DeleteServer(onion, Provider.of<ServerInfoState>(context, listen: false).isEncrypted ? ctrlrOldPass.value.text : DefaultPassword);
|
||||
var onion = Provider.of<ServerInfoState>(context, listen: false).onion;
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.DeleteServer(onion, Provider.of<ServerInfoState>(context, listen: false).isEncrypted ? ctrlrOldPass.value.text : DefaultPassword);
|
||||
Future.delayed(
|
||||
const Duration(milliseconds: 500),
|
||||
() {
|
||||
|
|
|
@ -112,7 +112,6 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
Clipboard.setData(new ClipboardData(text: Provider.of<ProfileInfoState>(context, listen: false).onion));
|
||||
}));
|
||||
|
||||
|
||||
// TODO servers
|
||||
|
||||
// Search contacts
|
||||
|
|
|
@ -192,8 +192,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
|||
),
|
||||
Visibility(
|
||||
visible: !Platform.isAndroid && !Platform.isIOS,
|
||||
child:
|
||||
SwitchListTile(
|
||||
child: SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context)!.settingServers, style: TextStyle(color: settings.current().mainTextColor())),
|
||||
subtitle: Text(AppLocalizations.of(context)!.settingServersDescription),
|
||||
value: settings.isExperimentEnabled(ServerManagementExperiment),
|
||||
|
|
|
@ -57,8 +57,8 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
|
|||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(child: Text(MediaQuery.of(context).size.width > 600 ?
|
||||
AppLocalizations.of(context)!.titleManageProfiles : AppLocalizations.of(context)!.titleManageProfilesShort,
|
||||
Expanded(
|
||||
child: Text(MediaQuery.of(context).size.width > 600 ? AppLocalizations.of(context)!.titleManageProfiles : AppLocalizations.of(context)!.titleManageProfilesShort,
|
||||
style: TextStyle(color: settings.current().mainTextColor())))
|
||||
]),
|
||||
actions: getActions(),
|
||||
|
|
|
@ -31,7 +31,7 @@ class _ServersView extends State<ServersView> {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text( MediaQuery.of(context).size.width > 600 ? AppLocalizations.of(context)!.serversManagerTitleLong : AppLocalizations.of(context)!.serversManagerTitleShort),
|
||||
title: Text(MediaQuery.of(context).size.width > 600 ? AppLocalizations.of(context)!.serversManagerTitleLong : AppLocalizations.of(context)!.serversManagerTitleShort),
|
||||
actions: getActions(),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
|
@ -44,7 +44,8 @@ class _ServersView extends State<ServersView> {
|
|||
),
|
||||
body: Consumer<ServerListState>(
|
||||
builder: (context, svrs, child) {
|
||||
final tiles = svrs.servers.map((ServerInfoState server) {
|
||||
final tiles = svrs.servers.map(
|
||||
(ServerInfoState server) {
|
||||
return ChangeNotifierProvider<ServerInfoState>.value(
|
||||
value: server,
|
||||
builder: (context, child) => RepaintBoundary(child: ServerRow()),
|
||||
|
@ -141,9 +142,11 @@ class _ServersView extends State<ServersView> {
|
|||
Navigator.of(context).push(MaterialPageRoute<void>(
|
||||
builder: (BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [ChangeNotifierProvider<ServerInfoState>(
|
||||
providers: [
|
||||
ChangeNotifierProvider<ServerInfoState>(
|
||||
create: (_) => ServerInfoState(onion: "", serverBundle: "", description: "", autoStart: true, running: false, isEncrypted: true),
|
||||
)],
|
||||
)
|
||||
],
|
||||
child: AddEditServerView(),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -89,15 +89,15 @@ class FileBubbleState extends State<FileBubble> {
|
|||
} else if (flagStarted) {
|
||||
// in this case, the download was done in a previous application launch,
|
||||
// so we probably have to request an info lookup
|
||||
if (!Provider.of<ProfileInfoState>(context).downloadInterrupted(widget.fileKey()) ) {
|
||||
if (!Provider.of<ProfileInfoState>(context).downloadInterrupted(widget.fileKey())) {
|
||||
wdgDecorations = Text(AppLocalizations.of(context)!.fileCheckingStatus + '...' + '\u202F');
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.CheckDownloadStatus(Provider.of<ProfileInfoState>(context, listen: false).onion, widget.fileKey());
|
||||
} else {
|
||||
var path = Provider.of<ProfileInfoState>(context).downloadFinalPath(widget.fileKey()) ?? "";
|
||||
wdgDecorations = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children:[Text(AppLocalizations.of(context)!.fileInterrupted + ': ' + path + '\u202F'),ElevatedButton(onPressed: _btnResume, child: Text(AppLocalizations.of(context)!.verfiyResumeButton))]
|
||||
);
|
||||
wdgDecorations = Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(AppLocalizations.of(context)!.fileInterrupted + ': ' + path + '\u202F'),
|
||||
ElevatedButton(onPressed: _btnResume, child: Text(AppLocalizations.of(context)!.verfiyResumeButton))
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
wdgDecorations = Center(
|
||||
|
@ -156,11 +156,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
Provider.of<MessageMetadata>(context, listen: false).flags |= 0x02;
|
||||
ContactInfoState? contact = Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle);
|
||||
if (contact != null) {
|
||||
Provider
|
||||
.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.CreateDownloadableFile(
|
||||
profileOnion, contact.identifier, widget.nameSuggestion, widget.fileKey());
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateDownloadableFile(profileOnion, contact.identifier, widget.nameSuggestion, widget.fileKey());
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
@ -176,11 +172,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
Provider.of<MessageMetadata>(context, listen: false).flags |= 0x02;
|
||||
ContactInfoState? contact = Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle);
|
||||
if (contact != null) {
|
||||
Provider
|
||||
.of<FlwtchState>(context, listen: false)
|
||||
.cwtch
|
||||
.DownloadFile(profileOnion, contact.identifier, file.path, manifestPath,
|
||||
widget.fileKey());
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.DownloadFile(profileOnion, contact.identifier, file.path, manifestPath, widget.fileKey());
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
|
@ -134,8 +134,7 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"Opening this link will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open links from people you trust. Are you sure you want to continue?"
|
||||
),
|
||||
"Opening this link will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open links from people you trust. Are you sure you want to continue?"),
|
||||
Flex(direction: Axis.horizontal, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 20, horizontal: 10),
|
||||
|
|
|
@ -199,7 +199,7 @@ class MessageRowState extends State<MessageRow> with SingleTickerProviderStateMi
|
|||
)))));
|
||||
var mark = Provider.of<ContactInfoState>(context).newMarker;
|
||||
if (mark > 0 && mark == Provider.of<ContactInfoState>(context).totalMessages - Provider.of<MessageMetadata>(context).messageIndex) {
|
||||
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Align(alignment:Alignment.center ,child:_bubbleNew()), mr]);
|
||||
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Align(alignment: Alignment.center, child: _bubbleNew()), mr]);
|
||||
} else {
|
||||
return mr;
|
||||
}
|
||||
|
@ -209,9 +209,7 @@ class MessageRowState extends State<MessageRow> with SingleTickerProviderStateMi
|
|||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Provider.of<Settings>(context).theme.messageFromMeBackgroundColor(),
|
||||
border: Border.all(
|
||||
color: Provider.of<Settings>(context).theme.messageFromMeBackgroundColor(),
|
||||
width: 1),
|
||||
border: Border.all(color: Provider.of<Settings>(context).theme.messageFromMeBackgroundColor(), width: 1),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(8),
|
||||
topRight: Radius.circular(8),
|
||||
|
@ -219,9 +217,7 @@ class MessageRowState extends State<MessageRow> with SingleTickerProviderStateMi
|
|||
bottomRight: Radius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(9.0),
|
||||
child: Text(AppLocalizations.of(context)!.newMessagesLabel)));
|
||||
child: Padding(padding: EdgeInsets.all(9.0), child: Text(AppLocalizations.of(context)!.newMessagesLabel)));
|
||||
}
|
||||
|
||||
void _runAnimation(Offset pixelsPerSecond, Size size) {
|
||||
|
|
|
@ -21,26 +21,24 @@ class _ServerRowState extends State<ServerRow> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var server = Provider.of<ServerInfoState>(context);
|
||||
return Card(clipBehavior: Clip.antiAlias,
|
||||
return Card(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.all(0.0),
|
||||
child: InkWell(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(6.0), //border size
|
||||
child: Icon(CwtchIcons.dns_24px,
|
||||
color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor(),
|
||||
size: 64)
|
||||
|
||||
),
|
||||
color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor(), size: 64)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
server.description,
|
||||
semanticsLabel: server.description,
|
||||
style: Provider.of<FlwtchState>(context).biggerFont.apply(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor()),
|
||||
style: Provider.of<FlwtchState>(context)
|
||||
.biggerFont
|
||||
.apply(color: server.running ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor() : Provider.of<Settings>(context).theme.portraitOfflineBorderColor()),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
@ -75,20 +73,20 @@ class _ServerRowState extends State<ServerRow> {
|
|||
_pushEditServer(server);
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
])));
|
||||
}
|
||||
|
||||
void _pushEditServer(ServerInfoState server ) {
|
||||
void _pushEditServer(ServerInfoState server) {
|
||||
Provider.of<ErrorHandler>(context).reset();
|
||||
Navigator.of(context).push(MaterialPageRoute<void>(
|
||||
settings: RouteSettings(name: "serveraddedit"),
|
||||
builder: (BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [ChangeNotifierProvider<ServerInfoState>(
|
||||
providers: [
|
||||
ChangeNotifierProvider<ServerInfoState>(
|
||||
create: (_) => server,
|
||||
)],
|
||||
)
|
||||
],
|
||||
child: AddEditServerView(),
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue