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 1fffef4 commit 7ad3431
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/basic_system/app_update/lib/bloc/bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,19 @@ class UpgradeBloc extends Bloc<UpdateEvent, UpdateState> {
void _onDownloadEvent(DownloadEvent event, Emitter<UpdateState> emit) async {
UpdateState curState = state;
if (curState is! ShouldUpdateState) return;
String url = event.appInfo.url;

if(kAppEnv.isMacOS){
launchUrl(Uri.parse(url));
return;
}

void onProgressChange(double progress) {
add(ProgressChangeEvent(progress: progress));
}

onProgressChange(0.001);

String url = event.appInfo.url;
if (kIsDesk) {
handleDesk(url, onProgressChange);
return;
Expand All @@ -62,10 +67,6 @@ class UpgradeBloc extends Bloc<UpdateEvent, UpdateState> {
}

void handleDesk(String url, OnProgressChange callback) async {
if(kAppEnv.isMacOS){
launchUrl(Uri.parse(url));
return;
}
Dio dio = Dio();
Directory dir = await getTemporaryDirectory();
String filePath = p.join(dir.path, p.basename(url));
Expand Down

0 comments on commit 7ad3431

Please sign in to comment.