Compare commits

..

3 Commits

Author SHA1 Message Date
Dan Ballard 13a57844af move padding for message list inside image decoration background
continuous-integration/drone/pr Build is pending Details
2024-02-14 03:21:16 +00:00
Dan Ballard fe8f0a47e7 fix saving and displaying theme name 2024-02-14 03:21:16 +00:00
Sarah Jamie Lewis 71f65f993b Fix Lazy Loading for Themes 2024-02-14 03:21:16 +00:00
60 changed files with 207 additions and 72 deletions

View File

@ -1,8 +1,17 @@
import 'package:cwtch/main.dart';
import 'package:cwtch/widgets/messagebubble.dart';
import 'package:cwtch/widgets/profilerow.dart';
import 'package:cwtch/widgets/quotedmessage.dart';
import 'package:cwtch/widgets/tor_icon.dart';
import 'package:cwtch/views/profilemgrview.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:flutter_gherkin/src/flutter/parameters/existence_parameter.dart';
import 'package:flutter_gherkin/src/flutter/parameters/swipe_direction_parameter.dart';
import 'package:gherkin/gherkin.dart';
import 'package:flutter/material.dart';
import 'overrides.dart';
StepDefinitionGeneric ExpectReply() {
return given3<String, String, int, FlutterWorld>(

View File

@ -1,7 +1,10 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
enum SwitchState { checked, unchecked }
@ -14,7 +17,6 @@ class SwitchStateParameter extends CustomParameter<SwitchState> {
case "unchecked":
return SwitchState.unchecked;
}
return null;
});
}

View File

@ -1,5 +1,6 @@
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/third_party/linkify/linkify.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

View File

@ -3,10 +3,15 @@ import 'package:cwtch/cwtch/cwtch.dart';
import 'package:cwtch/main.dart';
import 'package:cwtch/models/appstate.dart';
import 'package:cwtch/models/contact.dart';
import 'package:cwtch/models/message.dart';
import 'package:cwtch/models/profilelist.dart';
import 'package:cwtch/models/profileservers.dart';
import 'package:cwtch/models/remoteserver.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/notification_manager.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:cwtch/torstatus.dart';
@ -249,7 +254,7 @@ class CwtchNotifier {
var notification = data["notification"];
// Only bother to do anything if we know about the group and the provided index is greater than our current total...
if (idx >= currentTotal) {
if (currentTotal != null && idx >= currentTotal) {
// TODO: There are 2 timestamps associated with a new group message - time sent and time received.
// Sent refers to the time a profile alleges they sent a message
// Received refers to the time we actually saw the message from the server
@ -341,7 +346,7 @@ class CwtchNotifier {
associatedGroups.forEach((identifier) {
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(int.parse(identifier.toString()))!.antispamTickets = count;
});
EnvironmentConfig.debugLog("update server token count for $associatedGroups, $count");
EnvironmentConfig.debugLog("update server token count for ${associatedGroups}, $count");
} catch (e) {
// No tokens in data...
}

View File

@ -3,6 +3,7 @@ import 'dart:convert';
import 'dart:ffi';
import 'dart:io';
import 'dart:isolate';
import 'dart:io' show Platform;
import 'package:cwtch/cwtch/cwtchNotifier.dart';
import 'package:path/path.dart' as path;
@ -12,6 +13,7 @@ import 'package:cwtch/cwtch/cwtch.dart';
import '../config.dart';
import "package:path/path.dart" show dirname, join;
import 'dart:io' show Platform;
/////////////////////
/// Cwtch API ///

View File

@ -77,7 +77,7 @@ class CwtchGomobile implements Cwtch {
Future<void> Start() async {
print("gomobile.dart: Start()...");
androidHomeDirectoryStr = (await androidHomeDirectory).path;
_cwtchDir = path.join(androidHomeDirectoryStr, ".cwtch");
_cwtchDir = path.join(await androidHomeDirectoryStr, ".cwtch");
if (EnvironmentConfig.BUILD_VER == dev_version) {
_cwtchDir = path.join(_cwtchDir, "dev");
}

View File

@ -1,7 +1,9 @@
import 'dart:async';
import 'dart:convert';
import 'dart:isolate';
import 'package:cwtch/config.dart';
import 'package:cwtch/notification_manager.dart';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/views/doublecolview.dart';
import 'package:cwtch/views/messageview.dart';
import 'package:flutter/foundation.dart';
@ -31,6 +33,8 @@ import 'themes/opaque.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:intl/intl.dart' as intl;
var globalSettings = Settings(Locale("en", ''));
var globalErrorHandler = ErrorHandler();
var globalTorStatus = TorStatus();
@ -126,7 +130,7 @@ class FlwtchState extends State<Flwtch> with WindowListener {
// gracefully fails and NOPs, as it's not a required functionality
startConnectivityListener() async {
try {
connectivityStream = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
connectivityStream = await Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
// Got a new connectivity status!
if (result == ConnectivityResult.none) {
connectivityState = ConnectivityState.confirmed_offline;
@ -251,6 +255,7 @@ class FlwtchState extends State<Flwtch> with WindowListener {
exit(0);
}
}
;
}
// Invoked via notificationClickChannel by MyBroadcastReceiver in MainActivity.kt

View File

@ -1,3 +1,4 @@
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
@ -7,9 +8,11 @@ import 'package:glob/list_local_fs.dart';
import 'config.dart';
import 'licenses.dart';
import 'main.dart';
import 'themes/opaque.dart';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import "package:flutter_driver/driver_extension.dart";
import 'package:flutter_test/flutter_test.dart';
import 'package:glob/glob.dart';

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:cwtch/config.dart';
import 'package:flutter/widgets.dart';
@ -32,13 +33,13 @@ class AppState extends ChangeNotifier {
void SetAppError(String error) {
appError = error;
EnvironmentConfig.debugLog("App Error: $appError");
EnvironmentConfig.debugLog("App Error: ${appError}");
notifyListeners();
}
void SetModalState(ModalState newState) {
modalState = newState;
EnvironmentConfig.debugLog("Modal State: $newState");
EnvironmentConfig.debugLog("Modal State: ${newState}");
notifyListeners();
}

View File

@ -1,3 +1,5 @@
import 'dart:ffi';
import 'package:cwtch/main.dart';
import 'package:cwtch/models/message_draft.dart';
import 'package:cwtch/models/profile.dart';
@ -11,6 +13,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'message.dart';
import 'messagecache.dart';
enum ConversationNotificationPolicy {

View File

@ -54,7 +54,7 @@ class ContactListState extends ChangeNotifier {
if (otherGroups != null && otherGroups.isNotEmpty) {
EnvironmentConfig.debugLog("sharing antispam tickets to new group. FIXME: in Cwtch 1.14");
var antispamTickets = otherGroups[0].antispamTickets;
_contacts.last.antispamTickets = antispamTickets;
_contacts.last!.antispamTickets = antispamTickets;
}
servers?.addGroup(newContact);
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
/// A "MessageDraft" structure that stores information about in-progress message drafts.
/// MessageDraft stores text, quoted replies, and attached images.

View File

@ -129,7 +129,7 @@ class MessageCache extends ChangeNotifier {
void addNew(String profileOnion, int conversation, int messageID, DateTime timestamp, String senderHandle, String senderImage, bool isAuto, String data, String contenthash) {
this.cache[messageID] = MessageInfo(MessageMetadata(profileOnion, conversation, messageID, timestamp, senderHandle, senderImage, "", {}, false, false, isAuto, contenthash), data);
this.cacheByIndex.insert(0, LocalIndexMessage(messageID));
if (contenthash != "") {
if (contenthash != null && contenthash != "") {
this.cacheByHash[contenthash] = messageID;
}
}

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:cwtch/config.dart';
import 'package:cwtch/models/message.dart';
import 'package:cwtch/models/messages/malformedmessage.dart';
import 'package:cwtch/widgets/malformedbubble.dart';
@ -10,6 +11,7 @@ import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import '../../settings.dart';
import '../../third_party/linkify/flutter_linkify.dart';
class QuotedMessageStructure {
final String quotedHash;

View File

@ -1,11 +1,17 @@
import 'dart:math';
import 'package:cwtch/models/message.dart';
import 'package:cwtch/models/messages/malformedmessage.dart';
import 'package:cwtch/widgets/malformedbubble.dart';
import 'package:cwtch/widgets/messagebubble.dart';
import 'package:cwtch/widgets/messageloadingbubble.dart';
import 'package:cwtch/widgets/messagerow.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import '../../settings.dart';
import '../../third_party/linkify/flutter_linkify.dart';
import '../../widgets/messageBubbleWidgetHelpers.dart';
class TextMessage extends Message {
@ -21,6 +27,7 @@ class TextMessage extends Message {
builder: (bcontext, child) {
var formatMessages = Provider.of<Settings>(bcontext).isExperimentEnabled(FormattingExperiment);
return compileMessageContentWidget(context, constraints ?? BoxConstraints.loose(MediaQuery.sizeOf(context)), false, content, FocusNode(), formatMessages, false);
;
});
}

View File

@ -14,6 +14,8 @@ import '../views/contactsview.dart';
import 'contact.dart';
import 'contactlist.dart';
import 'filedownloadprogress.dart';
import 'message.dart';
import 'messagecache.dart';
import 'profileservers.dart';
class ProfileInfoState extends ChangeNotifier {
@ -239,7 +241,7 @@ class ProfileInfoState extends ChangeNotifier {
this._unreadMessages = 0;
this.replaceServers(serverJson);
if (contactsJson != "" && contactsJson != "null") {
if (contactsJson != null && contactsJson != "" && contactsJson != "null") {
List<dynamic> contacts = jsonDecode(contactsJson);
contacts.forEach((contact) {
var profileContact = this._contacts.getContact(contact["identifier"]);

View File

@ -1,3 +1,6 @@
import 'dart:ui';
import 'package:cwtch/config.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

View File

@ -1,3 +1,4 @@
import 'package:cwtch/config.dart';
import 'package:flutter/cupertino.dart';
import 'contact.dart';

View File

@ -3,8 +3,13 @@ import 'dart:convert';
import 'dart:io';
import 'package:cwtch/main.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:win_toast/win_toast.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_local_notifications_linux/flutter_local_notifications_linux.dart';
import 'package:flutter_local_notifications_linux/src/model/hint.dart';
import 'package:flutter_local_notifications_linux/src/model/icon.dart';
import 'package:path/path.dart' as path;

View File

@ -1,6 +1,8 @@
import 'dart:collection';
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
@ -88,6 +90,7 @@ class Settings extends ChangeNotifier {
bool get useSemanticDebugger => _useSemanticDebugger;
String? _themeId;
String? get themeId => _themeId;
String? _mode;
OpaqueThemeType get theme => themeloader.getTheme(_themeId, _mode);
void setTheme(String themeId, String mode) {
@ -481,7 +484,7 @@ class Settings extends ChangeNotifier {
dynamic asJson() {
return {
"Locale": this.locale.toString(),
"Theme": theme.theme,
"Theme": _themeId,
"ThemeMode": theme.mode,
"ThemeImages": _themeImages,
"PreviousPid": -1,

View File

@ -1,6 +1,8 @@
import 'dart:io';
import 'dart:ui';
import 'dart:core';
import 'package:cwtch/config.dart';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/themes/yamltheme.dart';
import 'package:flutter/material.dart';
@ -24,9 +26,8 @@ class ThemeLoader extends ChangeNotifier {
Map<String, Map<String, OpaqueThemeType>> themes = Map();
LoadThemes(String cwtchDir) async {
themes.clear(); // clear themes...
loadBuiltinThemes().then((builtinThemes) {
themes.addAll(builtinThemes);
loadBuiltinThemes().then((dir) {
themes.addAll(dir);
notifyListeners();
loadCustomThemes(path.join(cwtchDir, custom_themes_subdir)).then((customThemes) {
themes.addAll(customThemes);
@ -176,11 +177,13 @@ ThemeData mkThemeData(Settings opaque) {
return ThemeData(
hoverColor: opaque.current().backgroundHilightElementColor.withOpacity(0.5),
visualDensity: VisualDensity.adaptivePlatformDensity,
primarySwatch: getMaterialColor(opaque.current().topbarColor),
primaryIconTheme: IconThemeData(
color: opaque.current().mainTextColor,
),
primaryColor: opaque.current().mainTextColor,
canvasColor: opaque.current().backgroundMainColor,
backgroundColor: opaque.current().backgroundMainColor,
highlightColor: opaque.current().hilightElementColor,
iconTheme: IconThemeData(
color: opaque.current().toolbarIconColor,
@ -284,6 +287,5 @@ ThemeData mkThemeData(Settings opaque) {
snackBarTheme: SnackBarThemeData(
backgroundColor: opaque.current().snackbarBackgroundColor,
contentTextStyle: TextStyle(color: opaque.current().snackbarTextColor),
)
);
));
}

View File

@ -1,10 +1,13 @@
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:cwtch/config.dart';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:glob/list_local_fs.dart';
import 'package:provider/provider.dart';
import 'package:yaml/yaml.dart';
import 'package:path/path.dart' as path;

View File

@ -24,8 +24,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import 'dart:ui';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'linkify.dart';

View File

@ -9,24 +9,24 @@ class TorStatus extends ChangeNotifier {
TorStatus({this.connected = false, this.progress = 0, this.status = "", this.version = ""});
/// Called by the event bus.
handleUpdate(int newProgress, String newStatus) {
handleUpdate(int new_progress, String new_status) {
if (progress == 100) {
connected = true;
} else {
connected = false;
}
progress = newProgress;
status = newStatus;
if (newProgress != 100) {
status = "$newProgress% - $newStatus";
progress = new_progress;
status = new_status;
if (new_progress != 100) {
status = "$new_progress% - $new_status";
}
notifyListeners();
}
updateVersion(String newVersion) {
version = newVersion;
updateVersion(String new_version) {
version = new_version;
notifyListeners();
}
}

View File

@ -1,9 +1,12 @@
import 'dart:convert';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/models/remoteserver.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:cwtch/errorHandler.dart';
import 'package:cwtch/models/profileservers.dart';
import 'package:cwtch/settings.dart';
import 'package:cwtch/widgets/buttontextfield.dart';
import 'package:cwtch/widgets/cwtchlabel.dart';
@ -234,9 +237,7 @@ class _AddContactViewState extends State<AddContactView> {
controller: ctrlrGroupName,
hintText: AppLocalizations.of(bcontext)!.groupNameLabel,
onChanged: (newValue) {},
validator: (value) {
return null;
},
validator: (value) {},
),
SizedBox(
height: 20,

View File

@ -20,6 +20,7 @@ import '../constants.dart';
import '../cwtch_icons_icons.dart';
import '../errorHandler.dart';
import '../main.dart';
import '../themes/opaque.dart';
import '../settings.dart';
class AddEditProfileView extends StatefulWidget {
@ -153,7 +154,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.profile-attribute-1", profileAttribute1);
Provider.of<ProfileInfoState>(context, listen: false).attributes[0] = profileAttribute1;
},
hintText: Provider.of<ProfileInfoState>(context).attributes[0] ?? AppLocalizations.of(context)!.profileInfoHint)),
hintText: Provider.of<ProfileInfoState>(context).attributes[0] ?? AppLocalizations.of(context)!.profileInfoHint!)),
Padding(
padding: EdgeInsets.all(5.0),
child: CwtchTextField(
@ -164,7 +165,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.profile-attribute-2", profileAttribute2);
Provider.of<ProfileInfoState>(context, listen: false).attributes[1] = profileAttribute2;
},
hintText: Provider.of<ProfileInfoState>(context).attributes[1] ?? AppLocalizations.of(context)!.profileInfoHint2)),
hintText: Provider.of<ProfileInfoState>(context).attributes[1] ?? AppLocalizations.of(context)!.profileInfoHint2!)),
Padding(
padding: EdgeInsets.all(5.0),
child: CwtchTextField(
@ -175,7 +176,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.profile-attribute-3", profileAttribute3);
Provider.of<ProfileInfoState>(context, listen: false).attributes[2] = profileAttribute3;
},
hintText: Provider.of<ProfileInfoState>(context).attributes[2] ?? AppLocalizations.of(context)!.profileInfoHint3)),
hintText: Provider.of<ProfileInfoState>(context).attributes[2] ?? AppLocalizations.of(context)!.profileInfoHint3!)),
],
))
],
@ -257,7 +258,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
onChanged: (bool value) {
Provider.of<ProfileInfoState>(context, listen: false).autostart = value;
if (Provider.of<ProfileInfoState>(context, listen: false).onion.isNotEmpty) {
if (!Provider.of<ProfileInfoState>(context, listen: false).onion.isEmpty) {
Provider.of<FlwtchState>(context, listen: false)
.cwtch
.SetProfileAttribute(Provider.of<ProfileInfoState>(context, listen: false).onion, "profile.autostart", value ? "true" : "false");
@ -279,7 +280,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
onChanged: (bool value) {
Provider.of<ProfileInfoState>(context, listen: false).appearOfflineAtStartup = value;
var onion = Provider.of<ProfileInfoState>(context, listen: false).onion;
if (onion.isNotEmpty) {
if (!onion.isEmpty) {
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(onion, "profile.appear-offline", value ? "true" : "false");
}
},
@ -448,11 +449,11 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
minimumSize: Size(400, 75),
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor,
maximumSize: Size(800, 75),
shape: RoundedRectangleBorder(
side: BorderSide(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor, width: 2.0),
borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))),
primary: Provider.of<Settings>(context).theme.backgroundMainColor,
),
onPressed: () {
showAlertDialog(context);

View File

@ -1,9 +1,11 @@
import 'dart:convert';
import 'package:cwtch/cwtch/cwtch.dart';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/widgets/cwtchlabel.dart';
import 'package:cwtch/widgets/passwordfield.dart';
import 'package:cwtch/widgets/textfield.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/settings.dart';
import 'package:provider/provider.dart';
@ -11,6 +13,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../errorHandler.dart';
import '../main.dart';
import '../config.dart';
/// Pane to add or edit a server
class AddEditServerView extends StatefulWidget {
@ -140,7 +143,7 @@ class _AddEditServerViewState extends State<AddEditServerView> {
onChanged: (bool value) {
serverInfoState.setAutostart(value);
if (serverInfoState.onion.isNotEmpty) {
if (!serverInfoState.onion.isEmpty) {
Provider.of<FlwtchState>(context, listen: false).cwtch.SetServerAttribute(serverInfoState.onion, "autostart", value ? "true" : "false");
}
},

View File

@ -19,6 +19,7 @@ import 'package:provider/provider.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../config.dart';
import '../main.dart';
import '../models/message.dart';
import '../models/redaction.dart';
import '../settings.dart';
import '../themes/opaque.dart';
@ -42,12 +43,12 @@ class ContactsView extends StatefulWidget {
// selectConversation can be called from anywhere to set the active conversation
void selectConversation(BuildContext context, int handle, int? messageIndex) {
int? index;
int? index = null;
if (messageIndex != null) {
// this message is loaded
Provider.of<AppState>(context, listen: false).selectedSearchMessage = messageIndex;
Provider.of<AppState>(context, listen: false).initialScrollIndex = messageIndex;
Provider.of<AppState>(context, listen: false).initialScrollIndex = messageIndex!;
EnvironmentConfig.debugLog("Looked up index $messageIndex");
}
@ -242,7 +243,7 @@ class _ContactsViewState extends State<ContactsView> {
color: Colors.white,
),
Expanded(
child: Text(AppLocalizations.of(context)!.availabilityStatusAvailable,
child: Text(AppLocalizations.of(context)!.availabilityStatusAvailable!,
textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
@ -255,7 +256,7 @@ class _ContactsViewState extends State<ContactsView> {
color: Colors.yellowAccent,
),
Expanded(
child: Text(AppLocalizations.of(context)!.availabilityStatusAway,
child: Text(AppLocalizations.of(context)!.availabilityStatusAway!,
textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
@ -268,7 +269,7 @@ class _ContactsViewState extends State<ContactsView> {
color: Colors.redAccent,
),
Expanded(
child: Text(AppLocalizations.of(context)!.availabilityStatusBusy,
child: Text(AppLocalizations.of(context)!.availabilityStatusBusy!,
textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
@ -279,7 +280,7 @@ class _ContactsViewState extends State<ContactsView> {
child: Row(children: [
Icon(CwtchIcons.disconnect_from_contact),
Expanded(
child: Text(AppLocalizations.of(context)!.profileAppearOffline,
child: Text(AppLocalizations.of(context)!.profileAppearOffline!,
textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
@ -289,7 +290,7 @@ class _ContactsViewState extends State<ContactsView> {
child: Row(children: [
Icon(CwtchIcons.disconnect_from_contact),
Expanded(
child: Text(AppLocalizations.of(context)!.profileAppearOnline,
child: Text(AppLocalizations.of(context)!.profileAppearOnline!,
textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
@ -302,7 +303,7 @@ class _ContactsViewState extends State<ContactsView> {
color: settings.theme.mainTextColor,
),
Expanded(
child: Text((settings.blockUnknownConnections ? AppLocalizations.of(context)!.profileAllowUnknownContacts : AppLocalizations.of(context)!.profileBlockUnknownContacts),
child: Text((settings.blockUnknownConnections ? AppLocalizations.of(context)!.profileAllowUnknownContacts! : AppLocalizations.of(context)!.profileBlockUnknownContacts!),
textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
@ -312,7 +313,7 @@ class _ContactsViewState extends State<ContactsView> {
child: Row(children: [
Icon(CwtchIcons.favorite_24dp, color: settings.theme.mainTextColor),
Expanded(
child: Text((enabled ? AppLocalizations.of(context)!.profileDisableProfile : AppLocalizations.of(context)!.profileEnableProfile),
child: Text((enabled ? AppLocalizations.of(context)!.profileDisableProfile! : AppLocalizations.of(context)!.profileEnableProfile!),
textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
@ -325,7 +326,8 @@ class _ContactsViewState extends State<ContactsView> {
color: settings.theme.mainTextColor,
),
Expanded(
child: Text(AppLocalizations.of(context)!.editProfile, textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
child:
Text(AppLocalizations.of(context)!.editProfile!, textAlign: TextAlign.right, style: Provider.of<Settings>(context, listen: false).scaleFonts(defaultTextButtonStyle)))
]),
),
],
@ -638,14 +640,14 @@ class _ContactsViewState extends State<ContactsView> {
});
}
void _showQRCode(String profileCode) {
void _showQRCode(String profile_code) {
showModalBottomSheet<dynamic>(
context: context,
builder: (BuildContext context) {
return Wrap(children: <Widget>[
Center(
child: QrImageView(
data: profileCode,
data: profile_code,
version: QrVersions.auto,
size: 400.0,
backgroundColor: Provider.of<Settings>(context).theme.backgroundPaneColor,

View File

@ -4,6 +4,7 @@ import 'package:cwtch/models/profile.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../main.dart';
import '../settings.dart';
import 'contactsview.dart';
import 'messageview.dart';

View File

@ -10,6 +10,7 @@ import '../config.dart';
import '../cwtch_icons_icons.dart';
import '../main.dart';
import '../settings.dart';
import '../themes/opaque.dart';
import 'globalsettingsview.dart';
class GlobalSettingsAboutView extends StatefulWidget {

View File

@ -14,6 +14,7 @@ import '../settings.dart';
import '../themes/cwtch.dart';
import '../themes/opaque.dart';
import '../themes/yamltheme.dart';
import '../widgets/folderpicker.dart';
import 'globalsettingsview.dart';
class GlobalSettingsAppearanceView extends StatefulWidget {
@ -91,7 +92,7 @@ class _GlobalSettingsAppearanceViewState extends State<GlobalSettingsAppearanceV
child: DropdownButton<String>(
key: Key("DropdownTheme"),
isExpanded: true,
value: Provider.of<Settings>(context).theme.theme,
value: Provider.of<Settings>(context).themeId,
onChanged: (String? newValue) {
setState(() {
settings.setTheme(newValue!, settings.theme.mode);
@ -101,7 +102,7 @@ class _GlobalSettingsAppearanceViewState extends State<GlobalSettingsAppearanceV
items: settings.themeloader.themes.keys.map<DropdownMenuItem<String>>((String themeId) {
return DropdownMenuItem<String>(
value: themeId,
child: Text(getThemeName(context, themeId), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), //"ddi_$themeId", key: Key("ddi_$themeId")),
child: Text(getThemeName(context, settings, themeId), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), //"ddi_$themeId", key: Key("ddi_$themeId")),
);
}).toList())),
leading: Icon(Icons.palette, color: settings.current().mainTextColor),
@ -329,7 +330,7 @@ class _GlobalSettingsAppearanceViewState extends State<GlobalSettingsAppearanceV
}
/// Since we don't seem to able to dynamically pull translations, this function maps themes to their names
String getThemeName(context, String theme) {
String getThemeName(context, Settings settings, String theme) {
switch (theme) {
case cwtch_theme:
return AppLocalizations.of(context)!.themeNameCwtch;
@ -352,7 +353,7 @@ class _GlobalSettingsAppearanceViewState extends State<GlobalSettingsAppearanceV
case "juniper":
return "Juniper"; // Juniper is a noun, and doesn't get subject to translation...
}
return theme;
return settings.themeloader.themes[theme]?[settings.theme.mode]?.theme ?? theme;
}
void importThemeCheck(BuildContext context, Settings settings, String themesDir, String newThemeDirectory) async {

View File

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../config.dart';
import '../cwtch_icons_icons.dart';
import '../settings.dart';
import '../themes/opaque.dart';

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../config.dart';
import '../cwtch_icons_icons.dart';
import '../main.dart';
import '../models/servers.dart';

View File

@ -1,15 +1,24 @@
import 'dart:collection';
import 'dart:convert';
import 'dart:io';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/views/globalsettingsaboutview.dart';
import 'package:cwtch/views/globalsettingsappearanceview.dart';
import 'package:cwtch/views/globalsettingsbehaviourview.dart';
import 'package:cwtch/views/globalsettingsexperimentsview.dart';
import 'package:cwtch/widgets/folderpicker.dart';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/settings.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../main.dart';
import '../config.dart';
/// Global Settings View provides access to modify all the Globally Relevant Settings including Locale, Theme and Experiments.
class GlobalSettingsView extends StatefulWidget {

View File

@ -109,9 +109,7 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
),
CwtchTextField(
controller: TextEditingController(text: Provider.of<ContactInfoState>(context, listen: false).server),
validator: (value) {
return null;
},
validator: (value) {},
hintText: '',
)
]),

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:ui';
import 'package:crypto/crypto.dart';
import 'package:cwtch/cwtch/cwtch.dart';
import 'package:cwtch/cwtch_icons_icons.dart';
@ -258,7 +259,7 @@ class _MessageViewState extends State<MessageView> {
actions: appBarButtons,
),
body: Padding(
padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 182.0),
padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 164.0),
child: MessageList(
scrollListener,
)),

View File

@ -1,3 +1,5 @@
import 'dart:convert';
import 'dart:ui';
import 'package:cwtch/config.dart';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/appstate.dart';

View File

@ -16,6 +16,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:cwtch/widgets/profilerow.dart';
import 'package:provider/provider.dart';
import '../config.dart';
import '../main.dart';
import '../torstatus.dart';
import 'addeditprofileview.dart';
@ -177,7 +178,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
);
}
void _pushAddProfile(bcontext, {onion = ""}) {
void _pushAddProfile(bcontext, {onion: ""}) {
Navigator.popUntil(bcontext, (route) => route.isFirst);
Navigator.of(context).push(
@ -245,11 +246,11 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
child: ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(399, 20),
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor,
maximumSize: Size(400, 20),
shape: RoundedRectangleBorder(
side: BorderSide(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor, width: 2.0),
borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))),
primary: Provider.of<Settings>(context).theme.backgroundMainColor,
),
child: Text(AppLocalizations.of(context)!.importProfile,
semanticsLabel: AppLocalizations.of(context)!.importProfile,
@ -307,9 +308,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
autofocus: true,
controller: ctrlrPassword,
action: unlock,
validator: (value) {
return null;
},
validator: (value) {},
),
SizedBox(
height: 20,

View File

@ -1,15 +1,26 @@
import 'dart:convert';
import 'package:cwtch/cwtch/cwtch.dart';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/contact.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/models/profileservers.dart';
import 'package:cwtch/models/remoteserver.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/widgets/buttontextfield.dart';
import 'package:cwtch/widgets/contactrow.dart';
import 'package:cwtch/widgets/cwtchlabel.dart';
import 'package:cwtch/widgets/passwordfield.dart';
import 'package:cwtch/widgets/textfield.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/settings.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../errorHandler.dart';
import '../main.dart';
import '../config.dart';
import '../models/appstate.dart';
import '../themes/opaque.dart';
/// Pane to add or edit a server

View File

@ -3,6 +3,8 @@ import 'package:cwtch/views/addeditservers.dart';
import 'package:cwtch/widgets/passwordfield.dart';
import 'package:cwtch/widgets/serverrow.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/torstatus.dart';
import 'package:cwtch/widgets/tor_icon.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@ -110,9 +112,7 @@ class _ServersView extends State<ServersView> {
autofocus: true,
controller: ctrlrPassword,
action: unlock,
validator: (value) {
return null;
},
validator: (value) {},
),
SizedBox(
height: 20,

View File

@ -1,6 +1,7 @@
import 'package:cwtch/config.dart';
import 'package:cwtch/models/appstate.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

View File

@ -14,6 +14,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../main.dart';
import '../models/message.dart';
import '../settings.dart';
import 'package:intl/intl.dart';
class ContactRow extends StatefulWidget {
int? messageIndex;
@ -25,7 +26,7 @@ class ContactRow extends StatefulWidget {
class _ContactRowState extends State<ContactRow> {
bool isHover = false;
Message? cachedMessage;
Message? cachedMessage = null;
@override
Widget build(BuildContext context) {

View File

@ -11,6 +11,7 @@ import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/widgets/malformedbubble.dart';
import 'package:cwtch/widgets/messageBubbleWidgetHelpers.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../main.dart';
@ -99,7 +100,7 @@ class FileBubbleState extends State<FileBubble> {
if (downloadComplete && path != null) {
if (isImagePreview) {
if (myFile == null || myFile?.path != path) {
myFile = new File(path);
myFile = new File(path!);
// reset
if (myFile?.existsSync() == false) {
myFile = null;

View File

@ -6,6 +6,7 @@ import 'package:provider/provider.dart';
import '../settings.dart';
import 'buttontextfield.dart';
import 'package:path/path.dart' as path;
import 'cwtchlabel.dart';
class CwtchFolderPicker extends StatefulWidget {
final String label;

View File

@ -1,3 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/contact.dart';
import 'package:cwtch/models/message.dart';
@ -7,6 +10,7 @@ import 'package:cwtch/widgets/malformedbubble.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../main.dart';
import 'package:intl/intl.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../models/redaction.dart';

View File

@ -1,6 +1,11 @@
import 'dart:io';
import 'package:cwtch/controllers/open_link_modal.dart';
import 'package:cwtch/models/contact.dart';
import 'package:cwtch/models/message.dart';
import 'package:cwtch/models/redaction.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/third_party/linkify/flutter_linkify.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/widgets/malformedbubble.dart';
import 'package:flutter/material.dart';

View File

@ -1,3 +1,6 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../models/redaction.dart';

View File

@ -5,6 +5,7 @@ import 'package:cwtch/models/messagecache.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/widgets/messageloadingbubble.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:provider/provider.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@ -122,7 +123,10 @@ class _MessageListState extends State<MessageList> {
image: AssetImage("assets/core/negative_heart_512px.png"),
colorFilter: ColorFilter.mode(Provider.of<Settings>(context).theme.hilightElementColor.withOpacity(0.15), BlendMode.srcIn))),
// Don't load messages for syncing server...
child: loadMessages
child:
Padding(
padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 20.0),
child: loadMessages
? ScrollablePositionedList.builder(
itemPositionsListener: widget.scrollListener,
itemScrollController: Provider.of<ContactInfoState>(outerContext).messageScrollController,
@ -151,7 +155,7 @@ class _MessageListState extends State<MessageList> {
);
},
)
: null))
: null)))
])));
}
}

View File

@ -51,7 +51,9 @@ class MessageRowState extends State<MessageRow> with SingleTickerProviderStateMi
@override
void dispose() {
_controller.dispose();
if (_controller != null) {
_controller.dispose();
}
super.dispose();
}

View File

@ -20,7 +20,7 @@ class ProfileImage extends StatefulWidget {
this.tooltip = "",
this.disabled = false,
this.badgeEdit = false,
this.badgeIcon});
this.badgeIcon = null});
final double diameter;
final String imagePath;
final Color border;

View File

@ -1,7 +1,9 @@
import 'package:cwtch/models/appstate.dart';
import 'package:cwtch/models/contactlist.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/models/profilelist.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:cwtch/views/addeditprofileview.dart';
import 'package:cwtch/views/contactsview.dart';
import 'package:cwtch/views/doublecolview.dart';
@ -9,6 +11,7 @@ import 'package:cwtch/widgets/profileimage.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../errorHandler.dart';
import '../main.dart';
import '../settings.dart';
@ -113,7 +116,7 @@ class _ProfileRowState extends State<ProfileRow> {
);
}
void _pushEditProfile({onion = "", displayName = "", profileImage = "", encrypted = true}) {
void _pushEditProfile({onion: "", displayName: "", profileImage: "", encrypted: true}) {
Navigator.of(context).push(
PageRouteBuilder(
pageBuilder: (bcontext, a1, a2) {

View File

@ -84,7 +84,9 @@ class QuotedMessageBubbleState extends State<QuotedMessageBubble> {
var messageInfo = Provider.of<ContactInfoState>(context, listen: false).messageCache.getByContentHash(qMessage.getMetadata().contenthash);
if (messageInfo != null) {
var index = Provider.of<ContactInfoState>(context, listen: false).messageCache.findIndex(messageInfo.metadata.messageID);
Provider.of<ContactInfoState>(context, listen: false).messageScrollController.scrollTo(index: index, duration: Duration(milliseconds: 100));
if (index != null) {
Provider.of<ContactInfoState>(context, listen: false).messageScrollController.scrollTo(index: index, duration: Duration(milliseconds: 100));
}
}
},
child: Container(

View File

@ -1,12 +1,19 @@
import 'package:cwtch/main.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/models/profileservers.dart';
import 'package:cwtch/models/remoteserver.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/views/addeditservers.dart';
import 'package:cwtch/views/remoteserverview.dart';
import 'package:cwtch/widgets/profileimage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../cwtch_icons_icons.dart';
import '../errorHandler.dart';
import '../settings.dart';
class RemoteServerRow extends StatefulWidget {

View File

@ -3,6 +3,7 @@ import 'package:cwtch/models/message.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/widgets/malformedbubble.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../models/redaction.dart';
import '../settings.dart';

View File

@ -1,4 +1,5 @@
import 'package:cwtch/themes/opaque.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';

View File

@ -5,6 +5,7 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/settings.dart';

View File

@ -5,6 +5,7 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/settings.dart';

View File

@ -5,6 +5,7 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:cwtch/themes/cwtch.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/settings.dart';

View File

@ -7,6 +7,7 @@
import 'package:flutter/material.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/settings.dart';
import 'package:cwtch/widgets/textfield.dart';
import 'package:flutter_test/flutter_test.dart';
@ -26,9 +27,7 @@ void main() {
tester.binding.window.physicalSizeTestValue = Size(800, 300);
final TextEditingController ctrlr1 = TextEditingController();
Widget testWidget = CwtchTextField(controller: ctrlr1, validator: (value) {
return null;
}, hintText: '',);
Widget testWidget = CwtchTextField(controller: ctrlr1, validator: (value) { }, hintText: '',);
Widget testHarness = MultiProvider(
providers:[getSettingsEnglishDark()],