Skip to content

Commit

Permalink
rename checkForUpdatesInBackground to inBackground
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoufan committed May 14, 2022
1 parent 9ffa9e6 commit 853a5ec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class _HomePageState extends State<HomePage> {
}

void _handleClickCheckForUpdatesWithoutUI() async {
await autoUpdater.checkForUpdates(checkForUpdatesInBackground: true);
await autoUpdater.checkForUpdates(inBackground: true);
}

Widget _buildBody(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/auto_updater.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class AutoUpdater {
}

/// Asks the server whether there is an update. You must call setFeedURL before using this API.
Future<void> checkForUpdates({bool? checkForUpdatesInBackground}) async {
Future<void> checkForUpdates({bool? inBackground}) async {
final Map<String, dynamic> arguments = {
'checkForUpdatesInBackground': checkForUpdatesInBackground ?? false,
'inBackground': inBackground ?? false,
};
await _channel.invokeMethod('checkForUpdates', arguments);
}
Expand Down
4 changes: 2 additions & 2 deletions macos/Classes/AutoUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class AutoUpdaterPlugin: NSObject, FlutterPlugin {
result(true)
break
case "checkForUpdates":
let checkForUpdatesInBackground = args["checkForUpdatesInBackground"] as! Bool
if(checkForUpdatesInBackground) {
let inBackground = args["inBackground"] as! Bool
if(inBackground) {
autoUpdater.checkForUpdatesInBackground()
}else {
autoUpdater.checkForUpdates()
Expand Down
6 changes: 3 additions & 3 deletions windows/auto_updater_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ void AutoUpdaterPlugin::HandleMethodCall(
} else if (method_name.compare("checkForUpdates") == 0) {
const flutter::EncodableMap& args =
std::get<flutter::EncodableMap>(*method_call.arguments());
bool checkForUpdatesInBackground =
std::get<bool>(args.at(flutter::EncodableValue("checkForUpdatesInBackground")));
if (checkForUpdatesInBackground) {
bool inBackground =
std::get<bool>(args.at(flutter::EncodableValue("inBackground")));
if (inBackground) {
auto_updater->CheckForUpdatesWithoutUI();
} else {
auto_updater->CheckForUpdates();
Expand Down

0 comments on commit 853a5ec

Please sign in to comment.