trunk #2

Merged
Guido merged 229 commits from cwtch.im/cwtch-ui:trunk into trunk 2023-04-16 14:29:14 +00:00
3 changed files with 23 additions and 19 deletions
Showing only changes of commit 9a67008ece - Show all commits

View File

@ -1 +1 @@
2022-12-06-12-16-v1.10.0-8-g137027d
2022-12-07-17-51-v1.10.1

View File

@ -1 +1 @@
2022-12-06-17-15-v1.10.0-8-g137027d
2022-12-07-22-53-v1.10.1

View File

@ -22,27 +22,31 @@ class FileMessage extends Message {
return ChangeNotifierProvider.value(
value: this.metadata,
builder: (bcontext, child) {
dynamic shareObj = jsonDecode(this.content);
if (shareObj == null) {
return MessageRow(MalformedBubble(), index);
}
String nameSuggestion = shareObj['f'] as String;
String rootHash = shareObj['h'] as String;
String nonce = shareObj['n'] as String;
int fileSize = shareObj['s'] as int;
String fileKey = rootHash + "." + nonce;
if (metadata.attributes["file-downloaded"] == "true") {
if (!Provider.of<ProfileInfoState>(context).downloadKnown(fileKey)) {
Provider.of<FlwtchState>(context, listen: false).cwtch.CheckDownloadStatus(Provider.of<ProfileInfoState>(context, listen: false).onion, fileKey);
try {
dynamic shareObj = jsonDecode(this.content);
if (shareObj == null) {
return MessageRow(MalformedBubble(), index);
}
}
String nameSuggestion = shareObj['f'] as String;
String rootHash = shareObj['h'] as String;
String nonce = shareObj['n'] as String;
int fileSize = shareObj['s'] as int;
String fileKey = rootHash + "." + nonce;
if (!validHash(rootHash, nonce)) {
if (metadata.attributes["file-downloaded"] == "true") {
if (!Provider.of<ProfileInfoState>(context).downloadKnown(fileKey)) {
Provider.of<FlwtchState>(context, listen: false).cwtch.CheckDownloadStatus(Provider.of<ProfileInfoState>(context, listen: false).onion, fileKey);
}
}
if (!validHash(rootHash, nonce)) {
return MessageRow(MalformedBubble(), index);
}
return MessageRow(FileBubble(nameSuggestion, rootHash, nonce, fileSize, isAuto: metadata.isAuto), index, key: key);
} catch (e) {
return MessageRow(MalformedBubble(), index);
}
return MessageRow(FileBubble(nameSuggestion, rootHash, nonce, fileSize, isAuto: metadata.isAuto), index, key: key);
});
}