diff --git a/README.md b/README.md
index 932d5a3..6665687 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,8 @@
图片上传+管理新体验
-
-
+
+
diff --git a/docs/version.json b/docs/version.json
index 9bad56f..2ed8061 100644
--- a/docs/version.json
+++ b/docs/version.json
@@ -4,7 +4,7 @@
"versionCode": "22"
},
"Android": {
- "versionName": "1.9.1",
- "versionCode": "22"
+ "versionName": "1.9.2",
+ "versionCode": "23"
}
}
\ No newline at end of file
diff --git a/lib/components/upload_item/upload_item_presenter.dart b/lib/components/upload_item/upload_item_presenter.dart
index f57bc1a..67fbb75 100644
--- a/lib/components/upload_item/upload_item_presenter.dart
+++ b/lib/components/upload_item/upload_item_presenter.dart
@@ -1,6 +1,5 @@
import 'dart:io';
import 'package:dio/dio.dart';
-import 'package:flutter/cupertino.dart';
import 'package:flutter_picgo/utils/image_upload.dart';
import 'package:flutter_picgo/utils/strategy/upload_strategy_factory.dart';
diff --git a/lib/routers/router_handler.dart b/lib/routers/router_handler.dart
index 8f74d9a..bee0f9f 100644
--- a/lib/routers/router_handler.dart
+++ b/lib/routers/router_handler.dart
@@ -19,7 +19,6 @@ import 'package:flutter_picgo/views/pb_setting_page/tcyun_page/tcyun_page.dart';
import 'package:flutter_picgo/views/pb_setting_page/upyun_page/upyun_page.dart';
import 'package:flutter_picgo/views/picgo_setting_page/theme_setting_page.dart';
import 'package:flutter_picgo/views/upload_page/handle_upload_page.dart';
-import 'package:flutter_picgo/views/upload_page/upload_page.dart';
import 'package:flutter_picgo/views/pb_setting_page/github_page/github_page.dart';
import 'package:flutter_picgo/views/picgo_setting_page/picgo_setting_page.dart';
import 'package:flutter_picgo/views/setting_page/setting_page.dart';
@@ -56,11 +55,6 @@ var settingHandler = new Handler(
);
// 上传页面
-var uploadHandler = new Handler(
- handlerFunc: (BuildContext context, Map> params) =>
- UploadPage(),
-);
-
var preUploadHandler = new Handler(
handlerFunc: (context, parameters) {
final assets = context.settings.arguments as List;
diff --git a/lib/routers/routers.dart b/lib/routers/routers.dart
index c7b4477..b100289 100644
--- a/lib/routers/routers.dart
+++ b/lib/routers/routers.dart
@@ -50,7 +50,6 @@ class Routes {
router.define(root, handler: appHandler);
router.define(notfound, handler: notfoundHandler);
router.define(album, handler: albumHandler);
- router.define(upload, handler: uploadHandler);
router.define(handleUpload, handler: preUploadHandler);
router.define(setting, handler: settingHandler);
router.define(settingPb, handler: pbsettingHandler);
diff --git a/lib/utils/db_provider.dart b/lib/utils/db_provider.dart
index 7217995..862fc77 100644
--- a/lib/utils/db_provider.dart
+++ b/lib/utils/db_provider.dart
@@ -1,5 +1,4 @@
import 'dart:io';
-import 'package:flutter/foundation.dart';
import 'package:flutter_picgo/resources/pb_type_keys.dart';
import 'package:flutter_picgo/resources/table_name_keys.dart';
import 'package:sqflite/sqflite.dart';
diff --git a/lib/utils/image_preview.dart b/lib/utils/image_preview.dart
index e0535e8..12c11fc 100644
--- a/lib/utils/image_preview.dart
+++ b/lib/utils/image_preview.dart
@@ -4,15 +4,15 @@ import 'dart:math';
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:flutter_picgo/model/uploaded.dart';
import 'package:flutter_picgo/utils/extended.dart';
import 'package:toast/toast.dart';
class ImagePreviewUtils {
/// 打开图片预览页面
- static void open(BuildContext context, String content) {
- var item = new GalleryItem(id: '0', resource: '$content');
+ static void open(BuildContext context, Uploaded content) {
var page = GalleryPhotoViewWrapper(
- galleryItems: [item],
+ galleryItems: [content],
);
Navigator.push(
context,
@@ -22,8 +22,7 @@ class ImagePreviewUtils {
);
}
- static void openMulti(
- BuildContext context, int index, List items) {
+ static void openMulti(BuildContext context, int index, List items) {
var page = GalleryPhotoViewWrapper(
galleryItems: items,
initialIndex: index,
@@ -36,16 +35,9 @@ class ImagePreviewUtils {
}
}
-class GalleryItem {
- GalleryItem({this.id, this.resource});
-
- final String id;
- final String resource;
-}
-
class GalleryPhotoViewWrapper extends StatefulWidget {
final int initialIndex;
- final List galleryItems;
+ final List galleryItems;
GalleryPhotoViewWrapper({
this.initialIndex = 0,
@@ -85,44 +77,67 @@ class _GalleryPhotoViewWrapperState extends State {
color: Colors.black,
pageGestureAxis: SlideAxis.both),
child: GestureDetector(
- child: ExtendedImageGesturePageView.builder(
- itemBuilder: (BuildContext context, int index) {
- var item = widget.galleryItems[index];
- Widget image = item.resource.startsWith('http')
- ? ExtendedImage.network(
- item.resource,
- fit: BoxFit.contain,
- cache: true,
- mode: ExtendedImageMode.gesture,
- enableSlideOutPage: true,
- loadStateChanged: (state) =>
- defaultLoadStateChanged(state, iconSize: 50),
- )
- : ExtendedImage.file(
- File(item.resource),
- fit: BoxFit.contain,
- mode: ExtendedImageMode.gesture,
- enableSlideOutPage: true,
- loadStateChanged: (state) =>
- defaultLoadStateChanged(state, iconSize: 50),
+ child: Stack(
+ // fit: StackFit.expand,
+ alignment: Alignment.bottomRight,
+ children: [
+ ExtendedImageGesturePageView.builder(
+ itemBuilder: (BuildContext context, int index) {
+ var item = widget.galleryItems[index];
+ Widget image = item.path.startsWith('http')
+ ? ExtendedImage.network(
+ item.path,
+ fit: BoxFit.contain,
+ cache: true,
+ mode: ExtendedImageMode.gesture,
+ enableSlideOutPage: true,
+ loadStateChanged: (state) =>
+ defaultLoadStateChanged(state, iconSize: 50),
+ )
+ : ExtendedImage.file(
+ File(item.path),
+ fit: BoxFit.contain,
+ mode: ExtendedImageMode.gesture,
+ enableSlideOutPage: true,
+ loadStateChanged: (state) =>
+ defaultLoadStateChanged(state, iconSize: 50),
+ );
+ image = Container(
+ child: image,
+ );
+ if (index == currentIndex) {
+ return Hero(
+ tag: index,
+ child: image,
);
- image = Container(
- child: image,
- );
- if (index == currentIndex) {
- return Hero(
- tag: index,
- child: image,
- );
- } else {
- return image;
- }
- },
- itemCount: widget.galleryItems.length,
- controller: PageController(
- initialPage: currentIndex,
- ),
- scrollDirection: Axis.horizontal,
+ } else {
+ return image;
+ }
+ },
+ itemCount: widget.galleryItems.length,
+ controller: PageController(
+ initialPage: currentIndex,
+ ),
+ onPageChanged: onPageChanged,
+ scrollDirection: Axis.horizontal,
+ ),
+ SafeArea(
+ child: Container(
+ margin: EdgeInsets.only(right: 10),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.all(Radius.circular(4)),
+ color: Colors.grey),
+ padding: EdgeInsets.fromLTRB(5, 2, 5, 2),
+ child: Text(
+ '${currentIndex + 1} / ${widget.galleryItems.length}',
+ style: TextStyle(
+ color: Colors.white,
+ decoration: TextDecoration.none,
+ fontWeight: FontWeight.normal,
+ fontSize: 10),
+ ),
+ ))
+ ],
),
onLongPress: () {
_showBottomPane();
@@ -142,9 +157,41 @@ class _GalleryPhotoViewWrapperState extends State {
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
- title: Text('复制链接'),
+ title: Text(
+ '图床类型',
+ style: TextStyle(fontWeight: FontWeight.bold),
+ ),
+ subtitle: Text(widget.galleryItems[currentIndex].type),
+ ),
+ ListTile(
+ title: Text(
+ '图片链接',
+ style: TextStyle(fontWeight: FontWeight.bold),
+ ),
+ subtitle: Text(widget.galleryItems[currentIndex].path),
+ onTap: () {
+ _handleCopy(
+ widget.galleryItems[currentIndex].path, context);
+ },
+ ),
+ ListTile(
+ title: Text(
+ '图片信息',
+ style: TextStyle(fontWeight: FontWeight.bold),
+ ),
+ subtitle: Text(widget.galleryItems[currentIndex].info),
+ onTap: () {
+ _handleCopy(
+ widget.galleryItems[currentIndex].info, context);
+ },
+ ),
+ ListTile(
+ title: Text(
+ '取消',
+ style: TextStyle(fontWeight: FontWeight.bold),
+ ),
onTap: () {
- _handleCopy(context);
+ Navigator.pop(context);
},
),
],
@@ -154,9 +201,8 @@ class _GalleryPhotoViewWrapperState extends State {
}
/// 复制链接
- _handleCopy(BuildContext context) {
- Clipboard.setData(
- ClipboardData(text: widget.galleryItems[currentIndex].resource));
+ _handleCopy(String content, BuildContext context) {
+ Clipboard.setData(ClipboardData(text: content));
Toast.show('已复制到剪切板', context);
Navigator.pop(context);
}
diff --git a/lib/utils/local_notification.dart b/lib/utils/local_notification.dart
index eee771e..f05a59a 100644
--- a/lib/utils/local_notification.dart
+++ b/lib/utils/local_notification.dart
@@ -1,6 +1,5 @@
import 'dart:io';
-import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
class LocalNotificationUtil {
diff --git a/lib/utils/strategy/impl/tcyun_image_upload.dart b/lib/utils/strategy/impl/tcyun_image_upload.dart
index cc32972..53862d1 100644
--- a/lib/utils/strategy/impl/tcyun_image_upload.dart
+++ b/lib/utils/strategy/impl/tcyun_image_upload.dart
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'package:dio/dio.dart';
-import 'package:flutter/foundation.dart';
import 'package:flutter_picgo/api/tcyun_api.dart';
import 'package:flutter_picgo/model/tcyun_config.dart';
import 'package:flutter_picgo/model/uploaded.dart';
diff --git a/lib/views/album_page/album_page.dart b/lib/views/album_page/album_page.dart
index fb40315..eb46226 100644
--- a/lib/views/album_page/album_page.dart
+++ b/lib/views/album_page/album_page.dart
@@ -197,12 +197,7 @@ class _AlbumPageState extends State implements AlbumPageContract {
/// 处理图片点击事件
handleTap(int index) {
- ImagePreviewUtils.openMulti(
- context,
- index,
- _uploadeds.map((e) {
- return GalleryItem(id: e.id.toString(), resource: e.path);
- }).toList());
+ ImagePreviewUtils.openMulti(context, index, _uploadeds);
}
/// 处理图片双击
diff --git a/lib/views/manage_page/qiniu_page/qiniu_repo_page_presenter.dart b/lib/views/manage_page/qiniu_page/qiniu_repo_page_presenter.dart
index 46b7f03..d59807e 100644
--- a/lib/views/manage_page/qiniu_page/qiniu_repo_page_presenter.dart
+++ b/lib/views/manage_page/qiniu_page/qiniu_repo_page_presenter.dart
@@ -1,6 +1,5 @@
import 'dart:convert';
-import 'package:flutter/foundation.dart';
import 'package:flutter_picgo/api/qiniu_api.dart';
import 'package:flutter_picgo/components/manage_item.dart';
import 'package:flutter_picgo/model/qiniu_config.dart';
diff --git a/lib/views/pb_setting_page/pb_setting_presenter.dart b/lib/views/pb_setting_page/pb_setting_presenter.dart
index e164f56..08cbd8a 100644
--- a/lib/views/pb_setting_page/pb_setting_presenter.dart
+++ b/lib/views/pb_setting_page/pb_setting_presenter.dart
@@ -1,6 +1,5 @@
import 'dart:convert';
-import 'package:flutter/material.dart';
import 'package:flutter_picgo/model/pb_setting.dart';
import 'package:flutter_picgo/resources/table_name_keys.dart';
import 'package:flutter_picgo/utils/image_upload.dart';
diff --git a/lib/views/picgo_setting_page/picgo_setting_page.dart b/lib/views/picgo_setting_page/picgo_setting_page.dart
index 01179c5..3739eb6 100644
--- a/lib/views/picgo_setting_page/picgo_setting_page.dart
+++ b/lib/views/picgo_setting_page/picgo_setting_page.dart
@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:dio/dio.dart';
+import 'package:extended_image/extended_image.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@@ -120,10 +121,6 @@ class _PicGoSettingPageState extends State {
transition: TransitionType.cupertino);
},
),
- // ListTile(
- // title: Text('设置显示图床'),
- // onTap: () {},
- // ),
ListTile(
title: Text('版本更新'),
onTap: () {
@@ -141,6 +138,12 @@ class _PicGoSettingPageState extends State {
),
),
),
+ ListTile(
+ title: Text('清除缓存'),
+ onTap: () {
+ _handleClearCache();
+ },
+ )
],
);
},
@@ -181,4 +184,19 @@ class _PicGoSettingPageState extends State {
launch('https://apps.apple.com/cn/app/flutter-picgo/id1519714305');
}
}
+
+ /// 清空缓存
+ _handleClearCache() async {
+ /// extended_image
+ try {
+ bool clear = await clearDiskCachedImages();
+ if (clear) {
+ Toast.show('清除成功', context);
+ } else {
+ throw ('clear fail');
+ }
+ } catch (e) {
+ Toast.show('清除失败', context);
+ }
+ }
}
diff --git a/lib/views/upload_page/handle_upload_page.dart b/lib/views/upload_page/handle_upload_page.dart
index fc178a0..682ecfd 100644
--- a/lib/views/upload_page/handle_upload_page.dart
+++ b/lib/views/upload_page/handle_upload_page.dart
@@ -1,5 +1,4 @@
import 'dart:io';
-import 'dart:math';
import 'package:flutter_picgo/components/upload_item/upload_item.dart';
import 'package:flutter_picgo/utils/strings.dart';
import 'package:path/path.dart' as path;
@@ -116,15 +115,15 @@ class _HandleUploadPageState extends State {
sp.getBool(SharedPreferencesKeys.settingIsTimestampRename) ?? false;
if (settingIsTimestampRename) {
+ int timestamp = new DateTime.now().millisecondsSinceEpoch;
+
/// 处理时间戳命名
- var random = Random();
for (int i = 0; i < widget.assets.length; i++) {
/// 获取图片名
String suffix = path.extension(tmp.path);
/// replace
- filesName[i] =
- '${new DateTime.now().millisecondsSinceEpoch.toString()}-${random.nextInt(100)}$suffix';
+ filesName[i] = '${timestamp + i}$suffix';
}
}
var settingIsUploadedRename =
diff --git a/lib/views/upload_page/upload_page.dart b/lib/views/upload_page/upload_page.dart
deleted file mode 100644
index d4415dc..0000000
--- a/lib/views/upload_page/upload_page.dart
+++ /dev/null
@@ -1,347 +0,0 @@
-import 'dart:io';
-import 'package:flutter/material.dart';
-import 'package:flutter_picgo/components/loading.dart';
-import 'package:flutter_picgo/utils/local_notification.dart';
-import 'package:flutter_picgo/utils/permission.dart';
-import 'package:flutter_picgo/utils/shared_preferences.dart';
-import 'package:flutter_picgo/utils/strings.dart';
-import 'package:flutter_picgo/views/upload_page/upload_page_presenter.dart';
-import 'package:permission_handler/permission_handler.dart';
-import 'package:toast/toast.dart';
-import 'package:path/path.dart' as path;
-import 'package:flutter/services.dart';
-
-class UploadPage extends StatefulWidget {
- _UploadPageState createState() => _UploadPageState();
-}
-
-class _UploadPageState extends State
- with WidgetsBindingObserver
- implements UploadPageContract {
- String _title = '';
- String _previewPath = '';
- String _renameImage = '';
- String _clipUrl = '';
- TextEditingController _controller;
- // 默认不选中则不复制
- int _selectButton = 0;
-
- // 通知提示
- bool needNotify = false;
-
- // 按钮id
- static const MARKDOWN = 1;
- static const HTML = 2;
- static const URL = 3;
-
- UploadPagePresenter _presenter;
-
- _UploadPageState() {
- _presenter = UploadPagePresenter(this);
- SpUtil.getInstance().then((sp) {
- this.needNotify =
- sp.getBool(SharedPreferencesKeys.settingIsUploadedTip) ?? false;
- });
- }
-
- @override
- void initState() {
- super.initState();
- // 加载当前图床的名称
- _presenter.doLoadCurrentPB();
- }
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text(this._title),
- centerTitle: true,
- ),
- body: uploadView(context),
- );
- }
-
- Widget uploadView(BuildContext context) {
- return ListView(
- children: [
- Container(
- clipBehavior: Clip.antiAliasWithSaveLayer,
- margin: EdgeInsets.all(10.0),
- height: 250.0,
- decoration: BoxDecoration(
- border: Border.all(
- color: Theme.of(context).accentColor,
- ),
- ),
- child: Stack(
- children: [
- SizedBox.expand(
- child: this._previewPath == ''
- ? Center()
- : Image.file(new File(this._previewPath),
- fit: BoxFit.cover),
- ),
- SizedBox.expand(
- child: IconButton(
- icon: Icon(
- IconData(0xe639, fontFamily: 'iconfont'),
- size: 50,
- color: Theme.of(context).accentColor,
- ),
- highlightColor: Colors.transparent,
- splashColor: Colors.transparent,
- tooltip: "上传",
- onPressed: () {
- _getImage();
- },
- ),
- ),
- ],
- ),
- ),
- Container(
- child: Center(
- child: Text(
- '图片预览 - ${isBlank(this._previewPath) ? "暂未选择图片" : this._renameImage}',
- maxLines: 1,
- textWidthBasis: TextWidthBasis.parent,
- overflow: TextOverflow.ellipsis,
- textAlign: TextAlign.center,
- ),
- ),
- ),
- SizedBox(height: 10),
- Row(
- children: [
- SizedBox(width: 10),
- Expanded(
- child: RaisedButton(
- color: this._selectButton == MARKDOWN
- ? Theme.of(context).accentColor
- : Colors.white,
- textColor: this._selectButton == MARKDOWN
- ? Colors.white
- : Colors.black,
- child: Text('Markdown'),
- onPressed: () {
- setState(() {
- this._selectButton = MARKDOWN;
- setClipData();
- });
- },
- ),
- ),
- Expanded(
- child: RaisedButton(
- color: this._selectButton == HTML
- ? Theme.of(context).accentColor
- : Colors.white,
- textColor:
- this._selectButton == HTML ? Colors.white : Colors.black,
- child: Text('HTML'),
- onPressed: () {
- setState(() {
- this._selectButton = HTML;
- setClipData();
- });
- },
- ),
- ),
- Expanded(
- child: RaisedButton(
- color: this._selectButton == URL
- ? Theme.of(context).accentColor
- : Colors.white,
- textColor:
- this._selectButton == URL ? Colors.white : Colors.black,
- child: Text('URL'),
- onPressed: () {
- setState(() {
- this._selectButton = URL;
- setClipData();
- });
- },
- ),
- ),
- SizedBox(width: 10),
- ],
- ),
- SizedBox(height: 10),
- Container(
- child: Center(
- child: Text('点击上传后可获取的对应选中的链接格式到剪切板,可点击切换', maxLines: 2),
- ),
- ),
- SizedBox(height: 10),
- Container(
- height: 40,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: RaisedButton(
- color: Theme.of(context).accentColor,
- textColor: Colors.white,
- child: Text('上传'),
- onPressed: () {
- if (this._previewPath == null || this._previewPath == '') {
- _getImage();
- return;
- }
- _uploadImage();
- },
- ),
- ),
- )
- ],
- );
- }
-
- /// 获取图片
- _getImage() async {
- var status = await PermissionUtils.requestPhotos();
- if (status == PermissionStatus.denied) {
- PermissionUtils.showPermissionDialog(context);
- return;
- }
- // 获取图片
- // try {
- // final pickedFile = await picker.getImage(source: ImageSource.gallery);
- // if (pickedFile != null) {
- // var sp = await SpUtil.getInstance();
- // var settingIsTimestampRename =
- // sp.getBool(SharedPreferencesKeys.settingIsTimestampRename) ?? false;
- // var settingIsUploadedRename =
- // sp.getBool(SharedPreferencesKeys.settingIsUploadedRename) ?? false;
-
- // /// 获取文件后缀
- // String suffix = path.extension(pickedFile.path);
- // String filename = path.basenameWithoutExtension(pickedFile.path);
- // _renameImage = settingIsTimestampRename
- // ? '${new DateTime.now().millisecondsSinceEpoch.toString()}$suffix'
- // : '$filename$suffix';
- // if (settingIsUploadedRename) {
- // _controller = TextEditingController(text: _renameImage);
- // await showDialog(
- // context: context,
- // barrierDismissible: false,
- // builder: (context) {
- // return AlertDialog(
- // title: Center(
- // child: Text('重命名图片'),
- // ),
- // content: Padding(
- // padding: EdgeInsets.only(left: 4, right: 4),
- // child: TextField(
- // controller: _controller,
- // ),
- // ),
- // actions: [
- // FlatButton(
- // child: Text('确定'),
- // onPressed: () {
- // this._renameImage = _controller.text;
- // Navigator.pop(context);
- // }),
- // ],
- // );
- // },
- // );
- // }
- // setState(() {
- // this._previewPath = pickedFile.path;
- // });
- // }
- // } catch (e) {
- // debugPrint(e);
- // }
- }
-
- /// 上传图片
- _uploadImage() {
- showDialog(
- context: context,
- barrierDismissible: false,
- builder: (context) {
- return NetLoadingDialog(
- loading: true,
- loadingText: "上传中",
- requestCallBack: _presenter.doUploadImage(
- new File(this._previewPath), _renameImage),
- );
- });
- }
-
- @override
- loadCurrentPB(String pbname) {
- setState(() {
- this._title = '图片上传 - $pbname';
- });
- }
-
- @override
- uploadFaild(String errorMsg) async {
- if (needNotify) {
- await _showNotification(0, '上传失败:$errorMsg');
- }
- Toast.show(errorMsg ?? '', context);
- }
-
- /// 设置剪切板
- setClipData([bool needShowTip = true]) {
- if (isBlank(_clipUrl)) {
- Toast.show('暂无可获取图片', context);
- return;
- }
- String cliptext;
- switch (_selectButton) {
- case MARKDOWN:
- {
- cliptext = '![]($_clipUrl)';
- }
- break;
- case HTML:
- {
- cliptext = '';
- }
- break;
- case URL:
- {
- cliptext = _clipUrl;
- }
- break;
- default:
- {
- //statements;
- cliptext = '';
- }
- break;
- }
- if (!isBlank(cliptext)) {
- Clipboard.setData(ClipboardData(text: cliptext));
- }
- if (needShowTip) {
- Toast.show('已复制到剪切板', context);
- }
- }
-
- @override
- uploadSuccess(String imageUrl) async {
- if (needNotify) {
- await _showNotification(1, '上传成功, 图片链接:$imageUrl');
- }
- this._clipUrl = imageUrl;
- setClipData(false);
- Toast.show('上传成功,图片链接为:$imageUrl', context);
- }
-
- Future _showNotification(int id, String body) async {
- LocalNotificationUtil.getInstance().show(
- id,
- '上传提示',
- body,
- LocalNotificationUtil.createNotificationDetails(
- LocalNotificationUtil.uploadAndroidChannel(),
- LocalNotificationUtil.normalIOSNotificationDetails(),
- LocalNotificationUtil.normalMacOSNotificationDetails()));
- }
-}
diff --git a/lib/views/upload_page/upload_page_presenter.dart b/lib/views/upload_page/upload_page_presenter.dart
deleted file mode 100644
index 681511a..0000000
--- a/lib/views/upload_page/upload_page_presenter.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-import 'dart:io';
-import 'package:dio/dio.dart';
-import 'package:flutter/cupertino.dart';
-import 'package:flutter_picgo/utils/image_upload.dart';
-import 'package:flutter_picgo/utils/strategy/upload_strategy_factory.dart';
-
-abstract class UploadPageContract {
- loadCurrentPB(String pbname);
- uploadSuccess(String url);
- uploadFaild(String errorMsg);
-}
-
-class UploadPagePresenter {
- UploadPageContract _view;
- UploadPagePresenter(this._view);
-
- /// 读取当前默认图床
- doLoadCurrentPB() async {
- try {
- String pbType = await ImageUploadUtils.getDefaultPB();
- String name = await ImageUploadUtils.getPBName(pbType);
- if (name != null) {
- _view.loadCurrentPB(name);
- }
- } catch (e) {}
- }
-
- /// 根据配置上传图片
- doUploadImage(File file, String renameImage) async {
- // 读取配置
- try {
- String pbType = await ImageUploadUtils.getDefaultPB();
- var uploader =
- ImageUploadUtils(UploadStrategyFactory.getUploadStrategy(pbType));
- var uploadedItem = await uploader.upload(file, renameImage);
- if (uploadedItem != null) {
- _view.uploadSuccess(uploadedItem.path);
- } else {
- _view.uploadFaild('上传失败!请重试');
- }
- } on DioError catch (e) {
- _view.uploadFaild('${e.message}');
- } catch (e) {
- _view.uploadFaild('$e');
- }
- }
-}
diff --git a/pubspec.yaml b/pubspec.yaml
index b409783..04feef3 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 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.9.2+23
+version: 1.9.2+24
environment:
sdk: ">=2.7.0 <3.0.0"