Only copy multipaste link if multi box checked, add copy to clipboard shortcut in history view #2 #3
This commit is contained in:
parent
37d1b11b5a
commit
e623cef713
7 changed files with 48 additions and 10 deletions
|
@ -1,5 +1,9 @@
|
|||
# CHANGELOG
|
||||
|
||||
## 1.1.0+6
|
||||
* Only copy multipaste link if multi box checked
|
||||
* Add copy to clipboard shortcut in history view
|
||||
|
||||
## 1.1.0+5
|
||||
* Replace API key login with username and password login: a valid API key will automatically be created on login
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
A mobile flutter app for [FileBin](https://github.com/Bluewind/filebin).
|
||||
|
||||
Available on the [Play Store](https://play.google.com/store/apps/details?id=de.varakh.fbmobile).
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
"link": "Link",
|
||||
"date": "Date",
|
||||
"open_link": "Open in browser",
|
||||
"copy_link": {
|
||||
"description": "Copy link",
|
||||
"dismiss": "Dismiss",
|
||||
"copied": "Copied link to clipboard."
|
||||
},
|
||||
"mimetype": "Mimetype",
|
||||
"delete": "Delete permanently",
|
||||
"multipaste_element": "Included as multipaste item",
|
||||
|
|
|
@ -146,11 +146,11 @@ class UploadModel extends BaseModel {
|
|||
setState(ViewState.Idle);
|
||||
}
|
||||
|
||||
Future<List<String>> upload() async {
|
||||
Future<Map<String, bool>> upload() async {
|
||||
setState(ViewState.Busy);
|
||||
setStateMessage(translate('upload.uploading_now'));
|
||||
|
||||
List<String> uploadedPasteIds = [];
|
||||
Map<String, bool> uploadedPasteIds = new Map();
|
||||
try {
|
||||
List<File> files;
|
||||
Map<String, String> additionalFiles;
|
||||
|
@ -165,11 +165,13 @@ class UploadModel extends BaseModel {
|
|||
}
|
||||
|
||||
UploadedResponse response = await _fileService.upload(files, additionalFiles);
|
||||
uploadedPasteIds.addAll(response.data.ids);
|
||||
response.data.ids.forEach((element) {
|
||||
uploadedPasteIds.putIfAbsent(element, () => false);
|
||||
});
|
||||
|
||||
if (createMulti && response.data.ids.length > 1) {
|
||||
UploadedMultiResponse multiResponse = await _fileService.createMulti(response.data.ids);
|
||||
uploadedPasteIds.add(multiResponse.data.urlId);
|
||||
uploadedPasteIds.putIfAbsent(multiResponse.data.urlId, () => true);
|
||||
}
|
||||
|
||||
clearCachedFiles();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:clipboard/clipboard.dart';
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_translate/flutter_translate.dart';
|
||||
|
@ -33,7 +34,7 @@ class HistoryView extends StatelessWidget {
|
|||
: (model.errorMessage == null
|
||||
? Container(
|
||||
padding: EdgeInsets.all(0),
|
||||
child: RefreshIndicator(onRefresh: () => model.getHistory(), child: _render(model, url)))
|
||||
child: RefreshIndicator(onRefresh: () => model.getHistory(), child: _render(model, url, context)))
|
||||
: Container(
|
||||
padding: EdgeInsets.all(25),
|
||||
child: CenteredErrorRow(
|
||||
|
@ -43,7 +44,7 @@ class HistoryView extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
Widget _render(HistoryModel model, String url) {
|
||||
Widget _render(HistoryModel model, String url, BuildContext context) {
|
||||
List<Widget> cards = List<Widget>();
|
||||
|
||||
if (model.pastes.length > 0) {
|
||||
|
@ -63,6 +64,27 @@ class HistoryView extends StatelessWidget {
|
|||
trailing: openInBrowserButton,
|
||||
);
|
||||
|
||||
var copyWidget = ListTile(
|
||||
title: Text(translate('history.copy_link.description')),
|
||||
trailing: IconButton(
|
||||
icon: Icon(Icons.copy, color: Colors.blue, textDirection: TextDirection.ltr),
|
||||
onPressed: () {
|
||||
FlutterClipboard.copy(fullPasteUrl).then((value) {
|
||||
final snackBar = SnackBar(
|
||||
action: SnackBarAction(
|
||||
label: translate('history.copy_link.dismiss'),
|
||||
textColor: Colors.blue,
|
||||
onPressed: () {
|
||||
Scaffold.of(context).hideCurrentSnackBar();
|
||||
},
|
||||
),
|
||||
content: Text(translate('history.copy_link.copied')),
|
||||
duration: Duration(seconds: 10),
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
});
|
||||
}));
|
||||
|
||||
var deleteWidget = ListTile(
|
||||
title: Text(translate('history.delete')),
|
||||
trailing: IconButton(
|
||||
|
@ -105,6 +127,7 @@ class HistoryView extends StatelessWidget {
|
|||
|
||||
widgets.add(dateWidget);
|
||||
widgets.add(linkWidget);
|
||||
widgets.add(copyWidget);
|
||||
widgets.add(deleteWidget);
|
||||
|
||||
var expandable = ExpandableTheme(
|
||||
|
|
|
@ -103,12 +103,14 @@ class UploadView extends StatelessWidget {
|
|||
),
|
||||
color: primaryAccentColor,
|
||||
onPressed: () async {
|
||||
List<String> items = await model.upload();
|
||||
Map<String, bool> items = await model.upload();
|
||||
|
||||
if (items != null) {
|
||||
var clipboardContent = '';
|
||||
items.forEach((element) {
|
||||
clipboardContent += '$url/$element\n';
|
||||
items.forEach((id, isMulti) {
|
||||
if (isMulti && model.createMulti || !isMulti && !model.createMulti) {
|
||||
clipboardContent += '$url/$id\n';
|
||||
}
|
||||
});
|
||||
|
||||
FlutterClipboard.copy(clipboardContent).then((value) {
|
||||
|
|
|
@ -11,7 +11,7 @@ description: A mobile client for FileBin.
|
|||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.1.0+5
|
||||
version: 1.2.0+6
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
|
Loading…
Reference in a new issue