Compare commits

..

No commits in common. "9a17852533bc70d228b0b1f89a86fd3179839f7f" and "e6246cf44a3bffabab34e2a00f2fb0c0be986872" have entirely different histories.

8 changed files with 34 additions and 53 deletions

View File

@ -1 +1 @@
2022-02-08-16-19-v1.5.4-36-g4467c40
2022-02-07-17-39-v1.5.4-31-g17acc3b

View File

@ -1 +1 @@
2022-02-08-21-19-v1.5.4-36-g4467c40
2022-02-07-22-31-v1.5.4-31-g17acc3b

View File

@ -333,10 +333,16 @@ class CwtchNotifier {
profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"])!.nickname = data["Data"];
}
}
} else if (data['Path'] == "profile.custom-profile-image") {
if (data["Exists"] == "true") {
EnvironmentConfig.debugLog("received ret val of custom profile image: $data");
String fileKey = data['Data'];
} else if (data['Path'] == "profile.custom-profile-image" && data["Exists"] == "true") {
EnvironmentConfig.debugLog("received ret val of custom profile image: $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"]);
if (contact != null) {
profileCN.getProfile(data["ProfileOnion"])?.waitForDownloadComplete(contact.identifier, fileKey);

View File

@ -162,13 +162,7 @@ class ContactInfoState extends ChangeNotifier {
notifyListeners();
}
String get imagePath {
// don't show custom images for blocked contacts..
if (!this.isBlocked) {
return this._imagePath;
}
return this.defaultImagePath;
}
String get imagePath => this._imagePath;
set imagePath(String newVal) {
this._imagePath = newVal;

View File

@ -160,7 +160,6 @@ MessageInfo? getMessageInfoFromCache(BuildContext context, String profileOnion,
Future<MessageInfo?> fetchAndCacheMessageInfo(BuildContext context, String profileOnion, int conversationIdentifier, CacheHandler cacheHandler) {
// Load and cache
var profileInfostate = Provider.of<ProfileInfoState>(context, listen: false);
try {
Future<dynamic> rawMessageEnvelopeFuture;
@ -199,14 +198,14 @@ Future<MessageInfo?> fetchAndCacheMessageInfo(BuildContext context, String profi
var metadata = MessageMetadata(profileOnion, conversationIdentifier, messageID, timestamp, senderHandle, senderImage, signature, attributes, ackd, error, false);
var messageInfo = new MessageInfo(metadata, messageWrapper['Message']);
var cache = profileInfostate.contactList.getContact(conversationIdentifier)?.messageCache;
var cache = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(conversationIdentifier)?.messageCache;
if (cache != null) {
cacheHandler.add(cache, messageInfo, contenthash);
}
return messageInfo;
} catch (e, stacktrace) {
EnvironmentConfig.debugLog("message handler exception on parse message and cache: " + e.toString() + " " + stacktrace.toString());
} catch (e) {
EnvironmentConfig.debugLog("message handler exception on parse message and cache: " + e.toString());
return null;
}
});

View File

@ -170,24 +170,21 @@ class _MessageViewState extends State<MessageView> {
}
void _pushContactSettings() {
var profileInfoState = Provider.of<ProfileInfoState>(context, listen: false);
var contactInfoState = Provider.of<ContactInfoState>(context, listen: false);
if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) {
Navigator.of(context).push(MaterialPageRoute<void>(builder: (BuildContext bcontext) {
return MultiProvider(
providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)],
child: GroupSettingsView(),
);
}));
} else {
Navigator.of(context).push(MaterialPageRoute<void>(builder: (BuildContext bcontext) {
return MultiProvider(
providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)],
child: PeerSettingsView(),
);
}));
}
Navigator.of(context).push(MaterialPageRoute<void>(
builder: (BuildContext bcontext) {
if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) {
return MultiProvider(
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context)), ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context))],
child: GroupSettingsView(),
);
} else {
return MultiProvider(
providers: [ChangeNotifierProvider.value(value: Provider.of<ContactInfoState>(context))],
child: PeerSettingsView(),
);
}
},
));
}
// todo: legacy groups currently have restricted message

View File

@ -4,7 +4,6 @@ import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/appstate.dart';
import 'package:cwtch/models/contact.dart';
import 'package:cwtch/models/profile.dart';
import 'package:cwtch/widgets/profileimage.dart';
import 'package:flutter/services.dart';
import 'package:cwtch/widgets/buttontextfield.dart';
import 'package:cwtch/widgets/cwtchlabel.dart';
@ -90,19 +89,6 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(2),
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: [
CwtchLabel(label: AppLocalizations.of(context)!.displayNameLabel),
SizedBox(

View File

@ -38,10 +38,9 @@ class _ProfileImageState extends State<ProfileImage> {
var file = new File(widget.imagePath);
var image = Image.file(
file,
cacheWidth: 1920,
cacheWidth: 512,
cacheHeight: 512,
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
colorBlendMode: !widget.maskOut
? Provider.of<Settings>(context).theme.mode == mode_dark
@ -49,7 +48,7 @@ class _ProfileImageState extends State<ProfileImage> {
: BlendMode.darken
: BlendMode.srcOut,
color: Provider.of<Settings>(context).theme.portraitBackgroundColor,
isAntiAlias: false,
isAntiAlias: true,
width: widget.diameter,
height: widget.diameter,
errorBuilder: (context, error, stackTrace) {