flutter format
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
a9cc4b7425
commit
01d816209b
|
@ -24,7 +24,6 @@ class ChatMessage {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
class AppState extends ChangeNotifier {
|
||||
bool cwtchInit = false;
|
||||
bool cwtchIsClosing = false;
|
||||
|
@ -365,7 +364,7 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
|
||||
void downloadUpdate(String fileKey, int progress) {
|
||||
if (!downloadActive(fileKey)) {
|
||||
print("error: received progress for unknown download "+fileKey);
|
||||
print("error: received progress for unknown download " + fileKey);
|
||||
} else {
|
||||
this._downloads[fileKey]!.chunksDownloaded = progress;
|
||||
notifyListeners();
|
||||
|
@ -374,7 +373,7 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
|
||||
void downloadMarkManifest(String fileKey) {
|
||||
if (!downloadActive(fileKey)) {
|
||||
print("error: received download completion notice for unknown download "+fileKey);
|
||||
print("error: received download completion notice for unknown download " + fileKey);
|
||||
} else {
|
||||
this._downloads[fileKey]!.gotManifest = true;
|
||||
notifyListeners();
|
||||
|
@ -407,7 +406,7 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
double downloadProgress(String fileKey) {
|
||||
return this._downloads.containsKey(fileKey) ? this._downloads[fileKey]!.progress() : 0.0;
|
||||
return this._downloads.containsKey(fileKey) ? this._downloads[fileKey]!.progress() : 0.0;
|
||||
}
|
||||
|
||||
String? downloadFinalPath(String fileKey) {
|
||||
|
|
|
@ -47,7 +47,7 @@ class FileMessage extends Message {
|
|||
String nameSuggestion = shareObj['n'] as String;
|
||||
String rootHash = shareObj['h'] as String;
|
||||
String nonce = shareObj['n'] as String;
|
||||
int fileSize = shareObj['s'] as int;
|
||||
int fileSize = shareObj['s'] as int;
|
||||
return FileBubble(nameSuggestion, rootHash, nonce, fileSize);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -89,17 +89,16 @@ class _MessageViewState extends State<MessageView> {
|
|||
onPressed: _showFilePicker,
|
||||
));
|
||||
appBarButtons.add(IconButton(
|
||||
icon: Icon(CwtchIcons.send_invite, size: 24),
|
||||
tooltip: AppLocalizations.of(context)!.sendInvite,
|
||||
onPressed: () {
|
||||
_modalSendInvitation(context);
|
||||
}));
|
||||
icon: Icon(CwtchIcons.send_invite, size: 24),
|
||||
tooltip: AppLocalizations.of(context)!.sendInvite,
|
||||
onPressed: () {
|
||||
_modalSendInvitation(context);
|
||||
}));
|
||||
}
|
||||
appBarButtons.add(IconButton(
|
||||
icon: Provider.of<ContactInfoState>(context, listen: false).isGroup == true ? Icon(CwtchIcons.group_settings_24px) : Icon(CwtchIcons.peer_settings_24px),
|
||||
tooltip: AppLocalizations.of(context)!.conversationSettings,
|
||||
onPressed: _pushContactSettings
|
||||
));
|
||||
icon: Provider.of<ContactInfoState>(context, listen: false).isGroup == true ? Icon(CwtchIcons.group_settings_24px) : Icon(CwtchIcons.peer_settings_24px),
|
||||
tooltip: AppLocalizations.of(context)!.conversationSettings,
|
||||
onPressed: _pushContactSettings));
|
||||
|
||||
var appState = Provider.of<AppState>(context);
|
||||
return WillPopScope(
|
||||
|
@ -374,10 +373,10 @@ class _MessageViewState extends State<MessageView> {
|
|||
|
||||
void _showFilePicker() async {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles();
|
||||
if(result != null) {
|
||||
if (result != null) {
|
||||
File file = File(result.files.first.path);
|
||||
if (file.lengthSync() <= 10737418240) {
|
||||
print("Sending " +file.path);
|
||||
print("Sending " + file.path);
|
||||
_sendFile(file.path);
|
||||
} else {
|
||||
print("file size cannot exceed 10 gigabytes");
|
||||
|
|
|
@ -63,9 +63,9 @@ class FileBubbleState extends State<FileBubble> {
|
|||
var wdgMessage = !showFileSharing
|
||||
? Text(AppLocalizations.of(context)!.messageEnableFileSharing)
|
||||
: fromMe
|
||||
? senderFileChrome(
|
||||
AppLocalizations.of(context)!.messageFileSent, widget.nameSuggestion, widget.rootHash, widget.fileSize)
|
||||
: (fileChrome(AppLocalizations.of(context)!.messageFileOffered + ":", widget.nameSuggestion, widget.rootHash, widget.fileSize, Provider.of<ProfileInfoState>(context).downloadSpeed(widget.fileKey())));
|
||||
? senderFileChrome(AppLocalizations.of(context)!.messageFileSent, widget.nameSuggestion, widget.rootHash, widget.fileSize)
|
||||
: (fileChrome(AppLocalizations.of(context)!.messageFileOffered + ":", widget.nameSuggestion, widget.rootHash, widget.fileSize,
|
||||
Provider.of<ProfileInfoState>(context).downloadSpeed(widget.fileKey())));
|
||||
Widget wdgDecorations;
|
||||
if (!showFileSharing) {
|
||||
wdgDecorations = Text('\u202F');
|
||||
|
@ -76,18 +76,12 @@ class FileBubbleState extends State<FileBubble> {
|
|||
var path = Provider.of<ProfileInfoState>(context).downloadFinalPath(widget.fileKey())!;
|
||||
wdgDecorations = Text('Saved to: ' + path + '\u202F');
|
||||
} else if (Provider.of<ProfileInfoState>(context).downloadActive(widget.fileKey())) {
|
||||
if (!Provider.of<ProfileInfoState>(context).downloadGotManifest(
|
||||
widget.fileKey())) {
|
||||
wdgDecorations = Text(
|
||||
AppLocalizations.of(context)!.retrievingManifestMessage + '\u202F');
|
||||
if (!Provider.of<ProfileInfoState>(context).downloadGotManifest(widget.fileKey())) {
|
||||
wdgDecorations = Text(AppLocalizations.of(context)!.retrievingManifestMessage + '\u202F');
|
||||
} else {
|
||||
wdgDecorations = LinearProgressIndicator(
|
||||
value: Provider.of<ProfileInfoState>(context).downloadProgress(
|
||||
widget.fileKey()),
|
||||
color: Provider
|
||||
.of<Settings>(context)
|
||||
.theme
|
||||
.defaultButtonActiveColor(),
|
||||
value: Provider.of<ProfileInfoState>(context).downloadProgress(widget.fileKey()),
|
||||
color: Provider.of<Settings>(context).theme.defaultButtonActiveColor(),
|
||||
);
|
||||
}
|
||||
} else if (flagStarted) {
|
||||
|
@ -129,8 +123,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
child: Padding(
|
||||
padding: EdgeInsets.all(9.0),
|
||||
child: Wrap(runAlignment: WrapAlignment.spaceEvenly, alignment: WrapAlignment.spaceEvenly, runSpacing: 1.0, crossAxisAlignment: WrapCrossAlignment.center, children: [
|
||||
Center(
|
||||
widthFactor: 1, child: Padding(padding: EdgeInsets.all(10.0), child: Icon(Icons.attach_file, size: 32))),
|
||||
Center(widthFactor: 1, child: Padding(padding: EdgeInsets.all(10.0), child: Icon(Icons.attach_file, size: 32))),
|
||||
Center(
|
||||
widthFactor: 1.0,
|
||||
child: Column(
|
||||
|
@ -158,16 +151,18 @@ class FileBubbleState extends State<FileBubble> {
|
|||
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateDownloadableFile(profileOnion, handle, widget.nameSuggestion, widget.fileKey());
|
||||
} else {
|
||||
try {
|
||||
selectedFileName = await saveFile(defaultFileName: widget.nameSuggestion,);
|
||||
if (selectedFileName != null) {
|
||||
file = File(selectedFileName);
|
||||
print("saving to " + file.path);
|
||||
var manifestPath = file.path + ".manifest";
|
||||
Provider.of<ProfileInfoState>(context, listen: false).downloadInit(widget.fileKey(), (widget.fileSize / 4096).ceil());
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.UpdateMessageFlags(profileOnion, contact, idx, Provider.of<MessageMetadata>(context, listen: false).flags | 0x02);
|
||||
Provider.of<MessageMetadata>(context, listen: false).flags |= 0x02;
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.DownloadFile(profileOnion, handle, file.path, manifestPath, widget.fileKey());
|
||||
}
|
||||
selectedFileName = await saveFile(
|
||||
defaultFileName: widget.nameSuggestion,
|
||||
);
|
||||
if (selectedFileName != null) {
|
||||
file = File(selectedFileName);
|
||||
print("saving to " + file.path);
|
||||
var manifestPath = file.path + ".manifest";
|
||||
Provider.of<ProfileInfoState>(context, listen: false).downloadInit(widget.fileKey(), (widget.fileSize / 4096).ceil());
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.UpdateMessageFlags(profileOnion, contact, idx, Provider.of<MessageMetadata>(context, listen: false).flags | 0x02);
|
||||
Provider.of<MessageMetadata>(context, listen: false).flags |= 0x02;
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.DownloadFile(profileOnion, handle, file.path, manifestPath, widget.fileKey());
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
@ -176,7 +171,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
|
||||
// Construct an invite chrome for the sender
|
||||
Widget senderFileChrome(String chrome, String fileName, String rootHash, int fileSize) {
|
||||
return Wrap(direction: Axis.vertical,children: [
|
||||
return Wrap(direction: Axis.vertical, children: [
|
||||
SelectableText(
|
||||
chrome + '\u202F',
|
||||
style: TextStyle(
|
||||
|
@ -220,14 +215,10 @@ class FileBubbleState extends State<FileBubble> {
|
|||
Widget fileChrome(String chrome, String fileName, String rootHash, int fileSize, String speed) {
|
||||
var prettyHash = rootHash;
|
||||
if (rootHash.length == 128) {
|
||||
prettyHash = rootHash.substring(0, 32) + '\n' +
|
||||
rootHash.substring(32, 64) + '\n' +
|
||||
rootHash.substring(64, 96) + '\n' +
|
||||
rootHash.substring(96);
|
||||
prettyHash = rootHash.substring(0, 32) + '\n' + rootHash.substring(32, 64) + '\n' + rootHash.substring(64, 96) + '\n' + rootHash.substring(96);
|
||||
}
|
||||
|
||||
return Wrap(direction: Axis.vertical,
|
||||
children: [
|
||||
return Wrap(direction: Axis.vertical, children: [
|
||||
SelectableText(
|
||||
chrome + '\u202F',
|
||||
style: TextStyle(
|
||||
|
@ -238,7 +229,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
maxLines: 2,
|
||||
),
|
||||
SelectableText(
|
||||
AppLocalizations.of(context)!.labelFilename +': ' + fileName + '\u202F',
|
||||
AppLocalizations.of(context)!.labelFilename + ': ' + fileName + '\u202F',
|
||||
style: TextStyle(
|
||||
color: Provider.of<Settings>(context).theme.messageFromMeTextColor(),
|
||||
),
|
||||
|
|
|
@ -87,7 +87,7 @@ class _MessageListState extends State<MessageList> {
|
|||
// Already includes MessageRow,,
|
||||
return message.getWidget(context);
|
||||
} else {
|
||||
return Text('');//MessageLoadingBubble();
|
||||
return Text(''); //MessageLoadingBubble();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue