Add a slash to copied URLs, Expand item when pressing on the card's title in history view , release 1.3.2+11
This commit is contained in:
parent
06eb990eea
commit
c0a2e8d569
6 changed files with 36 additions and 15 deletions
|
@ -1,5 +1,9 @@
|
|||
# CHANGELOG
|
||||
|
||||
## 1.3.2+11
|
||||
* Add a slash to copied URLs
|
||||
* Expand item when pressing on the card's title in history view
|
||||
|
||||
## 1.3.1+10
|
||||
* Added gesture detection for tab bar
|
||||
* Disable upload when no files have been attached or upload text input is empty
|
||||
|
|
6
lib/core/util/paste_util.dart
Normal file
6
lib/core/util/paste_util.dart
Normal file
|
@ -0,0 +1,6 @@
|
|||
class PasteUtil {
|
||||
/// Generate paste link adding a trailing slash
|
||||
static String generateLink(String url, String id) {
|
||||
return '$url/$id/';
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@ import '../services/file_service.dart';
|
|||
import '../services/link_service.dart';
|
||||
import '../services/refresh_service.dart';
|
||||
import '../util/logger.dart';
|
||||
import '../util/paste_util.dart';
|
||||
import 'base_model.dart';
|
||||
|
||||
class UploadModel extends BaseModel {
|
||||
|
@ -111,6 +112,22 @@ class UploadModel extends BaseModel {
|
|||
});
|
||||
}
|
||||
|
||||
String generatePasteLinks(Map<String, bool> uploads, String url) {
|
||||
if (uploads != null && uploads.length > 0) {
|
||||
var links = '';
|
||||
|
||||
uploads.forEach((id, isMulti) {
|
||||
if (isMulti && createMulti || !isMulti && !createMulti) {
|
||||
links += '${PasteUtil.generateLink(url, id)}\n';
|
||||
}
|
||||
});
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
void toggleCreateMulti() {
|
||||
setStateView(ViewState.Busy);
|
||||
createMulti = !createMulti;
|
||||
|
|
|
@ -8,6 +8,7 @@ import 'package:share/share.dart';
|
|||
import '../../core/enums/viewstate.dart';
|
||||
import '../../core/models/session.dart';
|
||||
import '../../core/util/formatter_util.dart';
|
||||
import '../../core/util/paste_util.dart';
|
||||
import '../../core/viewmodels/history_model.dart';
|
||||
import '../../ui/widgets/centered_error_row.dart';
|
||||
import '../shared/app_colors.dart';
|
||||
|
@ -56,7 +57,7 @@ class HistoryView extends StatelessWidget {
|
|||
model.pastes.reversed.forEach((paste) {
|
||||
List<Widget> widgets = [];
|
||||
|
||||
var fullPasteUrl = '$url/${paste.id}';
|
||||
var fullPasteUrl = PasteUtil.generateLink(url, paste.id);
|
||||
var openInBrowserButton = _renderOpenInBrowser(model, fullPasteUrl);
|
||||
|
||||
var dateWidget = ListTile(
|
||||
|
@ -144,7 +145,6 @@ class HistoryView extends StatelessWidget {
|
|||
tapHeaderToExpand: true),
|
||||
child: ExpandablePanel(
|
||||
header: InkWell(
|
||||
onLongPress: () => model.deletePaste(paste.id),
|
||||
child: Text(
|
||||
paste.id,
|
||||
style: TextStyle(color: blueColor),
|
||||
|
|
|
@ -119,15 +119,9 @@ class UploadView extends StatelessWidget {
|
|||
? null
|
||||
: () async {
|
||||
Map<String, bool> items = await model.upload();
|
||||
String clipboardContent = model.generatePasteLinks(items, url);
|
||||
|
||||
if (items != null) {
|
||||
var clipboardContent = '';
|
||||
items.forEach((id, isMulti) {
|
||||
if (isMulti && model.createMulti || !isMulti && !model.createMulti) {
|
||||
clipboardContent += '$url/$id\n';
|
||||
}
|
||||
});
|
||||
|
||||
if (clipboardContent != null && clipboardContent.isNotEmpty) {
|
||||
FlutterClipboard.copy(clipboardContent).then((value) {
|
||||
final snackBar = SnackBar(
|
||||
action: SnackBarAction(
|
||||
|
|
|
@ -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.3.1+10
|
||||
version: 1.3.2+11
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
|
Loading…
Reference in a new issue