Skip to content

Commit

Permalink
app upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
toly1994328 committed Jan 1, 2025
1 parent b753fc2 commit 37793e7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
26 changes: 26 additions & 0 deletions modules/basic_system/app_update/lib/bloc/bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,36 @@ class UpgradeBloc extends Bloc<UpdateEvent, UpdateState> {
onReceiveProgress: (c, t) => callback(c / t),
);
if (rep.statusCode == 200) {
if(kAppEnv.isMacOS){
await addQuarantineAttribute(filePath);
}
await OpenFile.open(filePath);
}
}

Future<void> addQuarantineAttribute(String filePath) async {
try {
// 检查文件是否存在
if (!await File(filePath).exists()) {
throw Exception('File not found: $filePath');
}

// 添加 com.apple.quarantine 属性
final result = await Process.run(
'xattr',
['-w', 'com.apple.quarantine', '0083;602b8b1a;Chrome;', filePath],
);

if (result.exitCode == 0) {
print('Successfully added quarantine attribute to $filePath');
} else {
print('Error adding quarantine attribute: ${result.stderr}');
}
} catch (e) {
print('Exception: $e');
}
}

late int? id;
StreamSubscription<DownloadInfo>? subscription;

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_unit
description: All Platform Flutter Experience App.
publish_to: none
version: 3.0.9
version: 3.1.0
author: 张风捷特烈 <[email protected]>
homepage: https://juejin.cn/user/149189281194766/posts

Expand Down
14 changes: 14 additions & 0 deletions test/size.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'dart:io';
import 'package:path/path.dart' as p;
void main() async{
Directory directory=Directory(r'D:\Projects\Flutter\Github\FlutterUnit\build_tools\output');
List<FileSystemEntity> files = directory.listSync();
Map<String,dynamic> map = {};
for(FileSystemEntity file in files){
if(file is File){
map[p.basename(file.path)] = file.statSync().size;
}
}

print(map);
}

0 comments on commit 37793e7

Please sign in to comment.