Compare commits
3 Commits
e6246cf44a
...
9a17852533
Author | SHA1 | Date |
---|---|---|
erinn | 9a17852533 | |
Sarah Jamie Lewis | 2a07ba8ed7 | |
Sarah Jamie Lewis | 2e5ee796fa |
|
@ -1 +1 @@
|
||||||
2022-02-07-17-39-v1.5.4-31-g17acc3b
|
2022-02-08-16-19-v1.5.4-36-g4467c40
|
|
@ -1 +1 @@
|
||||||
2022-02-07-22-31-v1.5.4-31-g17acc3b
|
2022-02-08-21-19-v1.5.4-36-g4467c40
|
|
@ -333,16 +333,10 @@ class CwtchNotifier {
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"])!.nickname = data["Data"];
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"])!.nickname = data["Data"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data['Path'] == "profile.custom-profile-image" && data["Exists"] == "true") {
|
} else if (data['Path'] == "profile.custom-profile-image") {
|
||||||
|
if (data["Exists"] == "true") {
|
||||||
EnvironmentConfig.debugLog("received ret val of custom profile image: $data");
|
EnvironmentConfig.debugLog("received ret val of custom profile image: $data");
|
||||||
String fileKey = data['Data'];
|
String fileKey = data['Data'];
|
||||||
String filePath = data['FilePath'];
|
|
||||||
bool downloaded = data['FileDownloadFinished'] == "true";
|
|
||||||
if (downloaded) {
|
|
||||||
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"]) != null) {
|
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"])!.imagePath = filePath;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var contact = profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"]);
|
var contact = profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"]);
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.waitForDownloadComplete(contact.identifier, fileKey);
|
profileCN.getProfile(data["ProfileOnion"])?.waitForDownloadComplete(contact.identifier, fileKey);
|
||||||
|
|
|
@ -162,7 +162,13 @@ class ContactInfoState extends ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
String get imagePath => this._imagePath;
|
String get imagePath {
|
||||||
|
// don't show custom images for blocked contacts..
|
||||||
|
if (!this.isBlocked) {
|
||||||
|
return this._imagePath;
|
||||||
|
}
|
||||||
|
return this.defaultImagePath;
|
||||||
|
}
|
||||||
|
|
||||||
set imagePath(String newVal) {
|
set imagePath(String newVal) {
|
||||||
this._imagePath = newVal;
|
this._imagePath = newVal;
|
||||||
|
|
|
@ -160,6 +160,7 @@ MessageInfo? getMessageInfoFromCache(BuildContext context, String profileOnion,
|
||||||
|
|
||||||
Future<MessageInfo?> fetchAndCacheMessageInfo(BuildContext context, String profileOnion, int conversationIdentifier, CacheHandler cacheHandler) {
|
Future<MessageInfo?> fetchAndCacheMessageInfo(BuildContext context, String profileOnion, int conversationIdentifier, CacheHandler cacheHandler) {
|
||||||
// Load and cache
|
// Load and cache
|
||||||
|
var profileInfostate = Provider.of<ProfileInfoState>(context, listen: false);
|
||||||
try {
|
try {
|
||||||
Future<dynamic> rawMessageEnvelopeFuture;
|
Future<dynamic> rawMessageEnvelopeFuture;
|
||||||
|
|
||||||
|
@ -198,14 +199,14 @@ Future<MessageInfo?> fetchAndCacheMessageInfo(BuildContext context, String profi
|
||||||
var metadata = MessageMetadata(profileOnion, conversationIdentifier, messageID, timestamp, senderHandle, senderImage, signature, attributes, ackd, error, false);
|
var metadata = MessageMetadata(profileOnion, conversationIdentifier, messageID, timestamp, senderHandle, senderImage, signature, attributes, ackd, error, false);
|
||||||
var messageInfo = new MessageInfo(metadata, messageWrapper['Message']);
|
var messageInfo = new MessageInfo(metadata, messageWrapper['Message']);
|
||||||
|
|
||||||
var cache = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(conversationIdentifier)?.messageCache;
|
var cache = profileInfostate.contactList.getContact(conversationIdentifier)?.messageCache;
|
||||||
if (cache != null) {
|
if (cache != null) {
|
||||||
cacheHandler.add(cache, messageInfo, contenthash);
|
cacheHandler.add(cache, messageInfo, contenthash);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messageInfo;
|
return messageInfo;
|
||||||
} catch (e) {
|
} catch (e, stacktrace) {
|
||||||
EnvironmentConfig.debugLog("message handler exception on parse message and cache: " + e.toString());
|
EnvironmentConfig.debugLog("message handler exception on parse message and cache: " + e.toString() + " " + stacktrace.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -170,21 +170,24 @@ class _MessageViewState extends State<MessageView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _pushContactSettings() {
|
void _pushContactSettings() {
|
||||||
Navigator.of(context).push(MaterialPageRoute<void>(
|
var profileInfoState = Provider.of<ProfileInfoState>(context, listen: false);
|
||||||
builder: (BuildContext bcontext) {
|
var contactInfoState = Provider.of<ContactInfoState>(context, listen: false);
|
||||||
|
|
||||||
if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) {
|
if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute<void>(builder: (BuildContext bcontext) {
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context)), ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context))],
|
providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)],
|
||||||
child: GroupSettingsView(),
|
child: GroupSettingsView(),
|
||||||
);
|
);
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute<void>(builder: (BuildContext bcontext) {
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context))],
|
providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)],
|
||||||
child: PeerSettingsView(),
|
child: PeerSettingsView(),
|
||||||
);
|
);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: legacy groups currently have restricted message
|
// todo: legacy groups currently have restricted message
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:cwtch/cwtch_icons_icons.dart';
|
||||||
import 'package:cwtch/models/appstate.dart';
|
import 'package:cwtch/models/appstate.dart';
|
||||||
import 'package:cwtch/models/contact.dart';
|
import 'package:cwtch/models/contact.dart';
|
||||||
import 'package:cwtch/models/profile.dart';
|
import 'package:cwtch/models/profile.dart';
|
||||||
|
import 'package:cwtch/widgets/profileimage.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:cwtch/widgets/buttontextfield.dart';
|
import 'package:cwtch/widgets/buttontextfield.dart';
|
||||||
import 'package:cwtch/widgets/cwtchlabel.dart';
|
import 'package:cwtch/widgets/cwtchlabel.dart';
|
||||||
|
@ -89,6 +90,19 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
|
||||||
margin: EdgeInsets.all(10),
|
margin: EdgeInsets.all(10),
|
||||||
padding: EdgeInsets.all(2),
|
padding: EdgeInsets.all(2),
|
||||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
|
ProfileImage(
|
||||||
|
imagePath: Provider.of<Settings>(context).isExperimentEnabled(ImagePreviewsExperiment)
|
||||||
|
? Provider.of<ContactInfoState>(context).imagePath
|
||||||
|
: Provider.of<ContactInfoState>(context).defaultImagePath,
|
||||||
|
diameter: 120,
|
||||||
|
maskOut: false,
|
||||||
|
border: settings.theme.portraitOnlineBorderColor,
|
||||||
|
badgeTextColor: settings.theme.portraitContactBadgeTextColor,
|
||||||
|
badgeColor: settings.theme.portraitContactBadgeColor,
|
||||||
|
badgeEdit: false)
|
||||||
|
]),
|
||||||
|
|
||||||
Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
CwtchLabel(label: AppLocalizations.of(context)!.displayNameLabel),
|
CwtchLabel(label: AppLocalizations.of(context)!.displayNameLabel),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|
|
@ -38,9 +38,10 @@ class _ProfileImageState extends State<ProfileImage> {
|
||||||
var file = new File(widget.imagePath);
|
var file = new File(widget.imagePath);
|
||||||
var image = Image.file(
|
var image = Image.file(
|
||||||
file,
|
file,
|
||||||
cacheWidth: 512,
|
cacheWidth: 1920,
|
||||||
cacheHeight: 512,
|
|
||||||
filterQuality: FilterQuality.medium,
|
filterQuality: FilterQuality.medium,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
alignment: Alignment.center,
|
||||||
// We need some theme specific blending here...we might want to consider making this a theme level attribute
|
// We need some theme specific blending here...we might want to consider making this a theme level attribute
|
||||||
colorBlendMode: !widget.maskOut
|
colorBlendMode: !widget.maskOut
|
||||||
? Provider.of<Settings>(context).theme.mode == mode_dark
|
? Provider.of<Settings>(context).theme.mode == mode_dark
|
||||||
|
@ -48,7 +49,7 @@ class _ProfileImageState extends State<ProfileImage> {
|
||||||
: BlendMode.darken
|
: BlendMode.darken
|
||||||
: BlendMode.srcOut,
|
: BlendMode.srcOut,
|
||||||
color: Provider.of<Settings>(context).theme.portraitBackgroundColor,
|
color: Provider.of<Settings>(context).theme.portraitBackgroundColor,
|
||||||
isAntiAlias: true,
|
isAntiAlias: false,
|
||||||
width: widget.diameter,
|
width: widget.diameter,
|
||||||
height: widget.diameter,
|
height: widget.diameter,
|
||||||
errorBuilder: (context, error, stackTrace) {
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
|
Loading…
Reference in New Issue