Skip to content

Commit 717ec24

Browse files
committed
[ver1.2.2] fix
1 parent 94a10e1 commit 717ec24

21 files changed

+1593
-667
lines changed

.flutter-plugins

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# This is a generated file; do not edit or check into version control.
22
file_picker=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\git\\fluttertpc_file_picker-2d732270bd172e7bf2b803ebff03d3f05f4e1595\\
33
file_picker_ohos=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\git\\fluttertpc_file_picker-2d732270bd172e7bf2b803ebff03d3f05f4e1595\\ohos\\
4-
file_selector=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\git\\flutter_packages-c8dcc27e8ea01326727075985207c77002b2bb8d\\packages\\file_selector\\file_selector\\
4+
file_selector=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\git\\flutter_packages-b06d063a9cf3c92850f013c3b4203054987c37d6\\packages\\file_selector\\file_selector\\
55
file_selector_android=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_android-0.5.1+6\\
66
file_selector_ios=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_ios-0.5.3+1\\
77
file_selector_linux=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_linux-0.9.3+2\\
88
file_selector_macos=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_macos-0.9.4+2\\
9-
file_selector_ohos=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\git\\flutter_packages-c8dcc27e8ea01326727075985207c77002b2bb8d\\packages\\file_selector\\file_selector_ohos\\
9+
file_selector_ohos=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\git\\flutter_packages-b06d063a9cf3c92850f013c3b4203054987c37d6\\packages\\file_selector\\file_selector_ohos\\
1010
file_selector_web=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_web-0.9.4+2\\
1111
file_selector_windows=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_windows-0.9.3+4\\
1212
flutter_plugin_android_lifecycle=C:\\Users\\samuioto\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_plugin_android_lifecycle-2.0.22\\

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ A lightweight & cross-platform SSH/SFTP client built with Flutter.
1818
### 下载
1919
| 平台 | 下载 | 备注 |
2020
|------|------|------|
21-
| Android | [APK](https://github.com/RWPteam/ConnSSH/releases/download/1.2.1/ConnSSH_1.2.1.apk) | arm64 |
22-
| Windows | [exe](https://github.com/RWPteam/ConnSSH/releases/download/1.2.1/ConnSSH.1.2.1.Installer.exe) | 仅支持64位设备 |
23-
| OHOS | [app](https://github.com/RWPteam/ConnSSH/releases/download/1.2.1/ConnSSH_1.2.1.app.zip) | 华为手机、平板用户需要从AppGallery下载 |
21+
| Android | [APK](https://github.com/RWPteam/ConnSSH/releases/download/1.2.2/ConnSSH_1.2.2.apk) | arm64 |
22+
| Windows | [exe](https://github.com/RWPteam/ConnSSH/releases/download/1.2.2/ConnSSH.1.2.2.Installer.exe) | 仅支持64位设备 |
23+
| OHOS | [app](https://github.com/RWPteam/ConnSSH/releases/download/1.2.2/ConnSSH_1.2.2.app.zip) | 华为手机、平板用户需要从AppGallery下载 |
2424
| OHOS | [AppGallery](https://appgallery.huawei.com/app/detail?id=com.samuioto.connecter&channelId=SHARE&source=appshare) | 已上架至华为应用市场,欢迎体验
2525

2626

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
2323

2424
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
2525
if (flutterVersionCode == null) {
26-
flutterVersionCode = "195"
26+
flutterVersionCode = "213"
2727
}
2828

2929
def flutterVersionName = "1.2.2"

android/app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
android:taskAffinity=""
1212
android:theme="@style/LaunchTheme"
1313
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
14-
android:hardwareAccelerated="true">
14+
android:hardwareAccelerated="true"
15+
android:requestLegacyExternalStorage="true" >
1516
<!-- Specifies an Android theme to apply to this Activity as soon as
1617
the Android process has started. This theme is visible to the user
1718
while the Flutter UI initializes. After that, this theme continues
@@ -44,6 +45,7 @@
4445
android:resource="@xml/file_paths" />
4546
</provider>
4647

48+
4749
</application>
4850

4951
<!-- Required to query activities that can process text, see:
@@ -64,4 +66,5 @@
6466
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6567
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
6668
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
69+
6770
</manifest>

android/build/reports/problems/problems-report.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/pages/help.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ ConnSSH 版本 1.2.2
6969
此版本更新内容:
7070
7171
新增功能:
72-
• 快捷栏自定义
73-
• 数据备份/还原
74-
• 服务器支持分组(todo)
72+
• 快捷栏支持自定义
73+
• 支持数据备份/还原
7574
7675
问题改进:
7776
• 修复了服务器数据面板不兼容多硬盘服务器的问题
77+
• 完整支持了华为设备的文件下载保存功能
78+
• 修复Android10以下设备无法保存文件的问题
7879
• 改进了部分页面设计
7980
8081
如有问题或建议,请发送邮件至:

lib/pages/settings/global.dart

Lines changed: 23 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// global_settings_page.dart
2-
import 'package:file_selector/file_selector.dart';
2+
import 'package:file_picker_ohos/file_picker_ohos.dart';
33
import 'package:flutter/material.dart';
44
import 'package:connssh/main.dart';
55
import '../../models/app_settings_model.dart';
@@ -63,13 +63,12 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
6363
child: Column(
6464
mainAxisSize: MainAxisSize.min,
6565
children: [
66-
const Text('请输入备份密码', style: TextStyle(fontSize: 14)),
6766
const SizedBox(height: 16),
6867
TextField(
6968
controller: passwordController,
7069
obscureText: passwordObscure,
7170
decoration: InputDecoration(
72-
labelText: '密码',
71+
labelText: '请设置密码',
7372
border: const OutlineInputBorder(),
7473
suffixIcon: IconButton(
7574
icon: Icon(passwordObscure
@@ -202,45 +201,30 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
202201
child: Column(
203202
mainAxisSize: MainAxisSize.min,
204203
children: [
205-
const Text(
206-
'选择备份文件并输入密码',
207-
style: TextStyle(fontSize: 14),
208-
),
209204
const SizedBox(height: 16),
210205
OutlinedButton.icon(
211206
onPressed: () async {
212207
try {
213-
// 使用 file_selector 选择文件
214-
const XTypeGroup typeGroup = XTypeGroup(
215-
label: 'ConnSSH Backup',
216-
extensions: ['cntinfo'],
217-
);
218-
final XFile? file = await openFile(
219-
acceptedTypeGroups: [typeGroup],
208+
final FilePickerResult? result =
209+
await FilePicker.platform.pickFiles(
210+
type: FileType.custom,
211+
allowedExtensions: ['cntinfo'],
212+
dialogTitle: '选择备份文件',
213+
allowMultiple: false,
220214
);
221215

222-
if (file != null) {
216+
if (result != null && result.files.isNotEmpty) {
217+
PlatformFile file = result.files.first;
223218
setState(() {
224219
selectedFilePath = file.path;
225220
});
226-
227-
// 显示选择的文件名
228-
if (mounted) {
229-
ScaffoldMessenger.of(context).showSnackBar(
230-
SnackBar(
231-
content: Text('已选择文件: ${file.name}'),
232-
duration: const Duration(seconds: 2),
233-
),
234-
);
235-
}
236221
}
237222
} catch (e) {
238223
debugPrint('选择文件失败: $e');
239224
if (mounted) {
240225
ScaffoldMessenger.of(context).showSnackBar(
241226
SnackBar(
242227
content: Text('选择文件失败: $e'),
243-
backgroundColor: Colors.red,
244228
),
245229
);
246230
}
@@ -257,15 +241,6 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
257241
),
258242
if (selectedFilePath != null) ...[
259243
const SizedBox(height: 8),
260-
Text(
261-
'文件路径: ${selectedFilePath!.length > 50 ? '...${selectedFilePath!.substring(selectedFilePath!.length - 50)}' : selectedFilePath!}',
262-
style: const TextStyle(
263-
fontSize: 10,
264-
color: Colors.grey,
265-
),
266-
maxLines: 2,
267-
overflow: TextOverflow.ellipsis,
268-
),
269244
],
270245
const SizedBox(height: 12),
271246
TextField(
@@ -315,10 +290,11 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
315290
showDialog(
316291
context: context,
317292
builder: (context) => AlertDialog(
318-
title: const Text('确认恢复'),
319-
content: const Text(
320-
'此操作将覆盖所有现有数据,且不可撤销,确定要恢复吗?',
321-
),
293+
title: const Text('这是最后一次确认'),
294+
content: const Text('此操作将覆盖所有现有数据,且不可撤销,确定要恢复吗?',
295+
style: TextStyle(
296+
color: Colors.red,
297+
fontWeight: FontWeight.bold)),
322298
actions: [
323299
OutlinedButton(
324300
onPressed: () => Navigator.of(context).pop(),
@@ -332,7 +308,9 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
332308
Navigator.of(context, rootNavigator: true)
333309
.pop();
334310
}
335-
311+
final NavigatorState navigator = Navigator.of(
312+
this.context,
313+
rootNavigator: true);
336314
showDialog(
337315
context: context,
338316
barrierDismissible: false,
@@ -360,17 +338,13 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
360338
backupData,
361339
);
362340

363-
// 关闭加载对话框
364-
if (Navigator.of(context,
365-
rootNavigator: true)
366-
.canPop()) {
367-
Navigator.of(context, rootNavigator: true)
368-
.pop();
341+
if (navigator.canPop()) {
342+
navigator.pop();
369343
}
370344

371345
// 刷新应用
372346
widget.onSettingsChanged();
373-
MyApp.of(context)?.loadSettings();
347+
MyApp.of(this.context)?.loadSettings();
374348

375349
showDialog(
376350
context: context,
@@ -385,10 +359,8 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
385359
actions: [
386360
OutlinedButton(
387361
onPressed: () {
388-
Navigator.of(context).pop();
389-
if (Navigator.of(context)
390-
.canPop()) {
391-
Navigator.of(context).pop();
362+
if (navigator.canPop()) {
363+
navigator.pop();
392364
}
393365
},
394366
child: const Text('确定'),
@@ -458,7 +430,6 @@ class _GlobalSettingsPageState extends State<GlobalSettingsPage> {
458430
ScaffoldMessenger.of(context).showSnackBar(
459431
const SnackBar(
460432
content: Text('已恢复默认设置'),
461-
duration: Duration(seconds: 2),
462433
),
463434
);
464435
}

lib/pages/settings/sftp.dart

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -116,28 +116,12 @@ class _SFTPSettingsPageState extends State<SFTPSettingsPage> {
116116
}
117117

118118
void _showDownloadPathDialog() {
119-
if (Platform.isOhos) {
119+
if (Platform.isWindows || Platform.operatingSystem == 'ohos') {
120120
showDialog(
121121
context: context,
122122
builder: (context) => AlertDialog(
123123
title: const Text('提示'),
124-
content: const Text('HarmonyOS平台仅支持保存在沙盒目录'),
125-
actions: [
126-
OutlinedButton(
127-
onPressed: () => Navigator.of(context).pop(),
128-
child: const Text('确定'),
129-
),
130-
],
131-
),
132-
);
133-
return;
134-
}
135-
if (Platform.isWindows) {
136-
showDialog(
137-
context: context,
138-
builder: (context) => AlertDialog(
139-
title: const Text('提示'),
140-
content: const Text('Windows平台请在下载文件时选择保存位置'),
124+
content: const Text('您所使用的平台请在下载文件时选择保存位置'),
141125
actions: [
142126
OutlinedButton(
143127
onPressed: () => Navigator.of(context).pop(),

0 commit comments

Comments
 (0)