Merge pull request 'Fix #295 - P2P Avatar should not be clickable.' (#296) from fix_295 into trunk
continuous-integration/drone/push Build is pending
Details
continuous-integration/drone/push Build is pending
Details
Reviewed-on: #296 Reviewed-by: erinn <erinn@openprivacy.ca>
This commit is contained in:
commit
5e4c190e41
|
@ -108,7 +108,7 @@ class FlwtchState extends State<Flwtch> {
|
||||||
supportedLocales: AppLocalizations.supportedLocales,
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
title: 'Cwtch',
|
title: 'Cwtch',
|
||||||
theme: mkThemeData(settings),
|
theme: mkThemeData(settings),
|
||||||
home: (!appState.cwtchInit || appState.modalState != ModalState.none) ? SplashView() : ProfileMgrView(),
|
home: (!appState.cwtchInit || appState.modalState != ModalState.none) ? SplashView() : ProfileMgrView(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,10 +26,7 @@ class ChatMessage {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ModalState {
|
enum ModalState { none, storageMigration }
|
||||||
none,
|
|
||||||
storageMigration
|
|
||||||
}
|
|
||||||
|
|
||||||
class AppState extends ChangeNotifier {
|
class AppState extends ChangeNotifier {
|
||||||
bool cwtchInit = false;
|
bool cwtchInit = false;
|
||||||
|
@ -633,7 +630,7 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
|
|
||||||
set accepted(bool newVal) {
|
set accepted(bool newVal) {
|
||||||
this._accepted = newVal;
|
this._accepted = newVal;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
set blocked(bool newVal) {
|
set blocked(bool newVal) {
|
||||||
|
|
|
@ -222,14 +222,8 @@ class Settings extends ChangeNotifier {
|
||||||
// (ignores file size; if the user manually accepts the file, assume it's okay to preview)
|
// (ignores file size; if the user manually accepts the file, assume it's okay to preview)
|
||||||
bool shouldPreview(String path) {
|
bool shouldPreview(String path) {
|
||||||
var lpath = path.toLowerCase();
|
var lpath = path.toLowerCase();
|
||||||
return isExperimentEnabled(ImagePreviewsExperiment) && (
|
return isExperimentEnabled(ImagePreviewsExperiment) &&
|
||||||
lpath.endsWith(".jpg") ||
|
(lpath.endsWith(".jpg") || lpath.endsWith(".jpeg") || lpath.endsWith(".png") || lpath.endsWith(".gif") || lpath.endsWith(".webp") || lpath.endsWith(".bmp"));
|
||||||
lpath.endsWith(".jpeg") ||
|
|
||||||
lpath.endsWith(".png") ||
|
|
||||||
lpath.endsWith(".gif") ||
|
|
||||||
lpath.endsWith(".webp") ||
|
|
||||||
lpath.endsWith(".bmp")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String get downloadPath => _downloadPath;
|
String get downloadPath => _downloadPath;
|
||||||
|
|
|
@ -139,7 +139,7 @@ ThemeData mkThemeData(Settings opaque) {
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
systemOverlayStyle: SystemUiOverlayStyle(
|
systemOverlayStyle: SystemUiOverlayStyle(
|
||||||
// Status bar color
|
// Status bar color
|
||||||
statusBarColor: opaque.current().topbarColor,
|
statusBarColor: opaque.current().topbarColor,
|
||||||
// Status bar brightness (optional)
|
// Status bar brightness (optional)
|
||||||
statusBarIconBrightness: opaque.current().mode == mode_light ? Brightness.dark : Brightness.light, // For Android (dark icons)
|
statusBarIconBrightness: opaque.current().mode == mode_light ? Brightness.dark : Brightness.light, // For Android (dark icons)
|
||||||
statusBarBrightness: opaque.current().mode == mode_light ? Brightness.dark : Brightness.light, // For iOS (dark icons)
|
statusBarBrightness: opaque.current().mode == mode_light ? Brightness.dark : Brightness.light, // For iOS (dark icons)
|
||||||
|
|
|
@ -87,7 +87,9 @@ class _MessageViewState extends State<MessageView> {
|
||||||
appBarButtons.add(IconButton(
|
appBarButtons.add(IconButton(
|
||||||
icon: Icon(Icons.attach_file, size: 24),
|
icon: Icon(Icons.attach_file, size: 24),
|
||||||
tooltip: AppLocalizations.of(context)!.tooltipSendFile,
|
tooltip: AppLocalizations.of(context)!.tooltipSendFile,
|
||||||
onPressed: (){_showFilePicker(context);},
|
onPressed: () {
|
||||||
|
_showFilePicker(context);
|
||||||
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
appBarButtons.add(IconButton(
|
appBarButtons.add(IconButton(
|
||||||
|
@ -154,8 +156,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
builder: (BuildContext bcontext) {
|
builder: (BuildContext bcontext) {
|
||||||
if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) {
|
if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) {
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context)),
|
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context)), ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context))],
|
||||||
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context))],
|
|
||||||
child: GroupSettingsView(),
|
child: GroupSettingsView(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -423,19 +424,27 @@ class _MessageViewState extends State<MessageView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
Visibility(visible: showPreview, child: showPreview ? Image.file(
|
Visibility(
|
||||||
imagePreview!,
|
visible: showPreview,
|
||||||
cacheHeight: 150, // limit the amount of space the image can decode too, we keep this high-ish to allow quality previews...
|
child: showPreview
|
||||||
filterQuality: FilterQuality.medium,
|
? Image.file(
|
||||||
fit: BoxFit.fill,
|
imagePreview!,
|
||||||
alignment: Alignment.center,
|
cacheHeight: 150, // limit the amount of space the image can decode too, we keep this high-ish to allow quality previews...
|
||||||
height: 150,
|
filterQuality: FilterQuality.medium,
|
||||||
isAntiAlias: false,
|
fit: BoxFit.fill,
|
||||||
errorBuilder: (context, error, stackTrace) {
|
alignment: Alignment.center,
|
||||||
return MalformedBubble();
|
height: 150,
|
||||||
},
|
isAntiAlias: false,
|
||||||
) : Container()),
|
errorBuilder: (context, error, stackTrace) {
|
||||||
Visibility(visible: showPreview, child: SizedBox(height: 10,)),
|
return MalformedBubble();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: Container()),
|
||||||
|
Visibility(
|
||||||
|
visible: showPreview,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 10,
|
||||||
|
)),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: Text(AppLocalizations.of(context)!.cancel, semanticsLabel: AppLocalizations.of(context)!.cancel),
|
child: Text(AppLocalizations.of(context)!.cancel, semanticsLabel: AppLocalizations.of(context)!.cancel),
|
||||||
|
@ -443,7 +452,9 @@ class _MessageViewState extends State<MessageView> {
|
||||||
Navigator.pop(bcontext);
|
Navigator.pop(bcontext);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 20,),
|
SizedBox(
|
||||||
|
width: 20,
|
||||||
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: Text(AppLocalizations.of(context)!.btnSendFile, semanticsLabel: AppLocalizations.of(context)!.btnSendFile),
|
child: Text(AppLocalizations.of(context)!.btnSendFile, semanticsLabel: AppLocalizations.of(context)!.btnSendFile),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
|
@ -55,6 +55,7 @@ class MessageRowState extends State<MessageRow> with SingleTickerProviderStateMi
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var fromMe = Provider.of<MessageMetadata>(context).senderHandle == Provider.of<ProfileInfoState>(context).onion;
|
var fromMe = Provider.of<MessageMetadata>(context).senderHandle == Provider.of<ProfileInfoState>(context).onion;
|
||||||
var isContact = Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle) != null;
|
var isContact = Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle) != null;
|
||||||
|
var isGroup = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageMetadata>(context, listen: false).conversationIdentifier)!.isGroup;
|
||||||
var isBlocked = isContact ? Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle)!.isBlocked : false;
|
var isBlocked = isContact ? Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle)!.isBlocked : false;
|
||||||
var actualMessage = Flexible(flex: Platform.isAndroid ? 10 : 3, fit: FlexFit.loose, child: widget.child);
|
var actualMessage = Flexible(flex: Platform.isAndroid ? 10 : 3, fit: FlexFit.loose, child: widget.child);
|
||||||
|
|
||||||
|
@ -148,17 +149,24 @@ class MessageRowState extends State<MessageRow> with SingleTickerProviderStateMi
|
||||||
} else {
|
} else {
|
||||||
var contact = Provider.of<ContactInfoState>(context);
|
var contact = Provider.of<ContactInfoState>(context);
|
||||||
Widget wdgPortrait = GestureDetector(
|
Widget wdgPortrait = GestureDetector(
|
||||||
onTap: isContact ? _btnGoto : _btnAdd,
|
onTap: !isGroup
|
||||||
|
? null
|
||||||
|
: isContact
|
||||||
|
? _btnGoto
|
||||||
|
: _btnAdd,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(4.0),
|
padding: EdgeInsets.all(4.0),
|
||||||
child: ProfileImage(
|
child: ProfileImage(
|
||||||
diameter: 48.0,
|
diameter: 48.0,
|
||||||
imagePath: Provider.of<MessageMetadata>(context).senderImage ?? contact.imagePath,
|
imagePath: Provider.of<MessageMetadata>(context).senderImage ?? contact.imagePath,
|
||||||
//maskOut: contact.status != "Authenticated",
|
|
||||||
border: contact.status == "Authenticated" ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor,
|
border: contact.status == "Authenticated" ? Provider.of<Settings>(context).theme.portraitOnlineBorderColor : Provider.of<Settings>(context).theme.portraitOfflineBorderColor,
|
||||||
badgeTextColor: Colors.red,
|
badgeTextColor: Colors.red,
|
||||||
badgeColor: Colors.red,
|
badgeColor: Colors.red,
|
||||||
tooltip: isContact ? AppLocalizations.of(context)!.contactGoto.replaceFirst("%1", senderDisplayStr) : AppLocalizations.of(context)!.addContact,
|
tooltip: !isGroup
|
||||||
|
? ""
|
||||||
|
: isContact
|
||||||
|
? AppLocalizations.of(context)!.contactGoto.replaceFirst("%1", senderDisplayStr)
|
||||||
|
: AppLocalizations.of(context)!.addContact,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
widgetRow = <Widget>[
|
widgetRow = <Widget>[
|
||||||
|
|
Loading…
Reference in New Issue