diff --git a/packages/auto_updater/analysis_options.yaml b/packages/auto_updater/analysis_options.yaml index 9033bb2..8da401e 100644 --- a/packages/auto_updater/analysis_options.yaml +++ b/packages/auto_updater/analysis_options.yaml @@ -1 +1,34 @@ -include: package:mostly_reasonable_lints/analysis_options.yaml +include: package:flutter_lints/flutter.yaml + +analyzer: + exclude: + - "**/*.g.dart" + - "**/*.freezed.dart" + +linter: + rules: + - require_trailing_commas + + - prefer_collection_literals + - prefer_final_fields + - prefer_final_in_for_each + - prefer_final_locals + + - sized_box_for_whitespace + - use_decorated_box + + - unnecessary_parenthesis + - unnecessary_await_in_return + - unnecessary_raw_strings + + - avoid_unnecessary_containers + - avoid_redundant_argument_values + - avoid_unused_constructor_parameters + + - always_declare_return_types + + - sort_constructors_first + - unawaited_futures + +errors: + invalid_annotation_target: ignore diff --git a/packages/auto_updater/bin/generate_keys.dart b/packages/auto_updater/bin/generate_keys.dart index 166ffbc..4db799c 100644 --- a/packages/auto_updater/bin/generate_keys.dart +++ b/packages/auto_updater/bin/generate_keys.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'dart:io'; + import 'package:path/path.dart' as p; Future main(List arguments) async { @@ -7,7 +8,7 @@ Future main(List arguments) async { throw UnsupportedError('auto_updater:generate_keys'); } - String executable = Platform.isMacOS + final String executable = Platform.isMacOS ? '${Directory.current.path}/macos/Pods/Sparkle/bin/generate_keys' : p.joinAll( [ @@ -18,13 +19,13 @@ Future main(List arguments) async { '.plugin_symlinks', 'auto_updater_windows', 'windows', - 'WinSparkle-0.8.1', + 'WinSparkle-0.8.3', 'bin', 'generate_keys.bat', ], ); - Process process = await Process.start( + final Process process = await Process.start( executable, arguments, ); diff --git a/packages/auto_updater/bin/sign_update.dart b/packages/auto_updater/bin/sign_update.dart index e427660..b4f73db 100644 --- a/packages/auto_updater/bin/sign_update.dart +++ b/packages/auto_updater/bin/sign_update.dart @@ -1,4 +1,5 @@ import 'dart:io'; + import 'package:path/path.dart' as p; class SignUpdateResult { @@ -12,7 +13,7 @@ class SignUpdateResult { } SignUpdateResult signUpdate(List args) { - String executable = Platform.isMacOS + final String executable = Platform.isMacOS ? '${Directory.current.path}/macos/Pods/Sparkle/bin/sign_update' : p.joinAll( [ @@ -23,24 +24,24 @@ SignUpdateResult signUpdate(List args) { '.plugin_symlinks', 'auto_updater_windows', 'windows', - 'WinSparkle-0.8.1', + 'WinSparkle-0.8.3', 'bin', 'sign_update.bat', ], ); - List arguments = List.from(args); + final List arguments = List.from(args); if (Platform.isWindows) { if (arguments.length == 1) { arguments.add(p.join('dsa_priv.pem')); } } - ProcessResult processResult = Process.runSync( + final ProcessResult processResult = Process.runSync( executable, arguments, ); - int exitCode = processResult.exitCode; + final int exitCode = processResult.exitCode; String? signUpdateOutput; if (exitCode == 0) { @@ -54,8 +55,9 @@ SignUpdateResult signUpdate(List args) { stderr.write(processResult.stderr); } - RegExp regex = RegExp(r'sparkle:(dsa|ed)Signature="([^"]+)" length="(\d+)"'); - RegExpMatch? match = regex.firstMatch(signUpdateOutput!); + final RegExp regex = + RegExp(r'sparkle:(dsa|ed)Signature="([^"]+)" length="(\d+)"'); + final RegExpMatch? match = regex.firstMatch(signUpdateOutput!); if (match == null) { throw Exception('Failed to sign update'); diff --git a/packages/auto_updater/example/lib/pages/home.dart b/packages/auto_updater/example/lib/pages/home.dart index 6100015..4e75867 100644 --- a/packages/auto_updater/example/lib/pages/home.dart +++ b/packages/auto_updater/example/lib/pages/home.dart @@ -138,4 +138,25 @@ class _HomePageState extends State with UpdaterListener { } windowManager.setPreventClose(false); } + + @override + void onUpdaterUpdateSkipped(AppcastItem? appcastItem) { + if (kDebugMode) { + print('onUpdaterUpdateSkipped: ${appcastItem?.toJson()}'); + } + } + + @override + void onUpdaterUpdateCancelled(AppcastItem? appcastItem) { + if (kDebugMode) { + print('onUpdaterUpdateCancelled: ${appcastItem?.toJson()}'); + } + } + + @override + void onUpdaterUpdateInstalled(AppcastItem? appcastItem) { + if (kDebugMode) { + print('onUpdaterUpdateInstalled: ${appcastItem?.toJson()}'); + } + } } diff --git a/packages/auto_updater/example/windows/flutter/generated_plugin_registrant.cc b/packages/auto_updater/example/windows/flutter/generated_plugin_registrant.cc index c517ac4..b609e5c 100644 --- a/packages/auto_updater/example/windows/flutter/generated_plugin_registrant.cc +++ b/packages/auto_updater/example/windows/flutter/generated_plugin_registrant.cc @@ -7,14 +7,14 @@ #include "generated_plugin_registrant.h" #include -#include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { AutoUpdaterWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("AutoUpdaterWindowsPluginCApi")); - ScreenRetrieverPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); + ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi")); WindowManagerPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("WindowManagerPlugin")); } diff --git a/packages/auto_updater/example/windows/flutter/generated_plugins.cmake b/packages/auto_updater/example/windows/flutter/generated_plugins.cmake index 8a8de50..f5175d6 100644 --- a/packages/auto_updater/example/windows/flutter/generated_plugins.cmake +++ b/packages/auto_updater/example/windows/flutter/generated_plugins.cmake @@ -4,7 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST auto_updater_windows - screen_retriever + screen_retriever_windows window_manager ) diff --git a/packages/auto_updater/lib/auto_updater.dart b/packages/auto_updater/lib/auto_updater.dart index ce60e7b..71b8649 100644 --- a/packages/auto_updater/lib/auto_updater.dart +++ b/packages/auto_updater/lib/auto_updater.dart @@ -2,5 +2,7 @@ library auto_updater; export 'src/appcast.dart'; export 'src/auto_updater.dart'; +export 'src/events.dart'; export 'src/updater_error.dart'; export 'src/updater_listener.dart'; +export 'src/user_update_choice.dart'; diff --git a/packages/auto_updater/lib/src/appcast.dart b/packages/auto_updater/lib/src/appcast.dart index f91af8e..80e146a 100644 --- a/packages/auto_updater/lib/src/appcast.dart +++ b/packages/auto_updater/lib/src/appcast.dart @@ -39,6 +39,8 @@ class AppcastItem { this.maximumSystemVersion, this.maximumOperatingSystemVersionIsOK, this.channel, + this.criticalUpdate, + this.os, }); factory AppcastItem.fromJson(Map json) => @@ -60,6 +62,8 @@ class AppcastItem { final String? maximumSystemVersion; final bool? maximumOperatingSystemVersionIsOK; final String? channel; + final bool? criticalUpdate; + final String? os; Map toJson() => _$AppcastItemToJson(this); } diff --git a/packages/auto_updater/lib/src/appcast.g.dart b/packages/auto_updater/lib/src/appcast.g.dart index a4f8925..04c3336 100644 --- a/packages/auto_updater/lib/src/appcast.g.dart +++ b/packages/auto_updater/lib/src/appcast.g.dart @@ -20,7 +20,7 @@ AppcastItem _$AppcastItemFromJson(Map json) => AppcastItem( versionString: json['versionString'] as String?, displayVersionString: json['displayVersionString'] as String?, fileURL: json['fileURL'] as String?, - contentLength: json['contentLength'] as int?, + contentLength: (json['contentLength'] as num?)?.toInt(), infoURL: json['infoURL'] as String?, title: json['title'] as String?, dateString: json['dateString'] as String?, @@ -35,6 +35,8 @@ AppcastItem _$AppcastItemFromJson(Map json) => AppcastItem( maximumOperatingSystemVersionIsOK: json['maximumOperatingSystemVersionIsOK'] as bool?, channel: json['channel'] as String?, + criticalUpdate: json['criticalUpdate'] as bool?, + os: json['os'] as String?, ); Map _$AppcastItemToJson(AppcastItem instance) => @@ -57,4 +59,6 @@ Map _$AppcastItemToJson(AppcastItem instance) => 'maximumOperatingSystemVersionIsOK': instance.maximumOperatingSystemVersionIsOK, 'channel': instance.channel, + 'criticalUpdate': instance.criticalUpdate, + 'os': instance.os, }; diff --git a/packages/auto_updater/lib/src/auto_updater.dart b/packages/auto_updater/lib/src/auto_updater.dart index 4f4bb2c..978d1a1 100644 --- a/packages/auto_updater/lib/src/auto_updater.dart +++ b/packages/auto_updater/lib/src/auto_updater.dart @@ -1,8 +1,10 @@ import 'dart:async'; import 'package:auto_updater/src/appcast.dart'; +import 'package:auto_updater/src/events.dart'; import 'package:auto_updater/src/updater_error.dart'; import 'package:auto_updater/src/updater_listener.dart'; +import 'package:auto_updater/src/user_update_choice.dart'; import 'package:auto_updater_platform_interface/auto_updater_platform_interface.dart'; class AutoUpdater { @@ -17,84 +19,107 @@ class AutoUpdater { final List _listeners = []; - void _handleSparkleEvents(event) { - UpdaterError? updaterError; - Appcast? appcast; - AppcastItem? appcastItem; - - String type = event['type'] as String; - Map? data; - if (event['data'] != null) { - data = event['data'] as Map; - if (data['error'] != null) { - updaterError = UpdaterError( - data['error'].toString(), - ); - } - if (data['appcast'] != null) { - appcast = Appcast.fromJson( - Map.from( - (data['appcast'] as Map).cast(), - ), - ); - } - if (data['appcastItem'] != null) { - appcastItem = AppcastItem.fromJson( - Map.from( - (data['appcastItem'] as Map).cast(), - ), - ); - } - } - for (var listener in _listeners) { - switch (type) { - case 'error': - listener.onUpdaterError(updaterError); - break; - case 'checking-for-update': - listener.onUpdaterCheckingForUpdate(appcast); - break; - case 'update-available': - listener.onUpdaterUpdateAvailable(appcastItem); - break; - case 'update-not-available': - listener.onUpdaterUpdateNotAvailable(updaterError); - break; - case 'update-downloaded': - listener.onUpdaterUpdateDownloaded(appcastItem); - break; - case 'before-quit-for-update': - listener.onUpdaterBeforeQuitForUpdate(appcastItem); - break; - } - } - } - /// Adds a listener to the auto updater. - void addListener(UpdaterListener listener) { - _listeners.add(listener); - } + void addListener(UpdaterListener listener) => _listeners.add(listener); /// Removes a listener from the auto updater. - void removeListener(UpdaterListener listener) { - _listeners.remove(listener); - } + void removeListener(UpdaterListener listener) => _listeners.remove(listener); /// Sets the url and initialize the auto updater. - Future setFeedURL(String feedUrl) { - return _platform.setFeedURL(feedUrl); - } + Future setFeedURL(String feedUrl) => _platform.setFeedURL(feedUrl); /// Asks the server whether there is an update. You must call setFeedURL before using this API. - Future checkForUpdates({bool? inBackground}) { - return _platform.checkForUpdates( - inBackground: inBackground, - ); - } + Future checkForUpdates({bool? inBackground}) => + _platform.checkForUpdates(inBackground: inBackground); /// Sets the auto update check interval, default 86400, minimum 3600, 0 to disable update - Future setScheduledCheckInterval(int interval) { - return _platform.setScheduledCheckInterval(interval); + Future setScheduledCheckInterval(int interval) => + _platform.setScheduledCheckInterval(interval); + + /// Checks for update information. + Future checkForUpdateInformation() => + _platform.checkForUpdateInformation(); + + /// Cleans up the auto updater. + /// + /// Notes: this function is only available on Windows. + Future cleanup() => _platform.cleanup(); + + void _handleSparkleEvents(dynamic event) { + final type = event['type'] as String; + final eventType = UpdaterEvent.fromString(type); + final eventData = event['data'] as Map? ?? {}; + + // Parse event data + final updaterError = eventData['error'] != null + ? UpdaterError(eventData['error'].toString()) + : null; + + final appcast = eventData['appcast'] is Map + ? Appcast.fromJson( + Map.from( + (eventData['appcast'] as Map).cast(), + ), + ) + : null; + + final appcastItem = eventData['appcastItem'] is Map + ? AppcastItem.fromJson( + Map.from( + (eventData['appcastItem'] as Map).cast(), + ), + ) + : null; + + final userUpdateChoice = eventData['choice'] is int + ? UserUpdateChoice.values[eventData['choice'] as int] + : null; + + // Notify listeners + for (final listener in _listeners) { + switch (eventType) { + case UpdaterEvent.error: + listener.onUpdaterError(updaterError); + case UpdaterEvent.checkingForUpdate: + listener.onUpdaterCheckingForUpdate(appcast); + case UpdaterEvent.updateAvailable: + listener.onUpdaterUpdateAvailable(appcastItem); + case UpdaterEvent.updateNotAvailable: + listener.onUpdaterUpdateNotAvailable(updaterError); + case UpdaterEvent.updateDownloaded: + listener.onUpdaterUpdateDownloaded(appcastItem); + case UpdaterEvent.beforeQuitForUpdate: + listener.onUpdaterBeforeQuitForUpdate(appcastItem); + case UpdaterEvent.userUpdateChoice: + // this function is only available on macOS + final choice = userUpdateChoice; + if (choice == null) return; + switch (choice) { + case UserUpdateChoice.skip: + listener.onUpdaterUpdateSkipped(appcastItem); + case UserUpdateChoice.install: + listener.onUpdaterUpdateInstalled(appcastItem); + case UserUpdateChoice.dismiss: + listener.onUpdaterUpdateCancelled(appcastItem); + } + case UpdaterEvent.updateCancelled: + // this event is only available on Windows + listener.onUpdaterUpdateCancelled(appcastItem); + case UpdaterEvent.updateSkipped: + // this event is only available on Windows + listener.onUpdaterUpdateSkipped(appcastItem); + case UpdaterEvent.updateInstalled: + // this event is only available on Windows + listener.onUpdaterUpdateInstalled(appcastItem); + case UpdaterEvent.updateDismissed: + // this event is only available on Windows + listener.onUpdaterUpdateCancelled(appcastItem); + case UpdaterEvent.updatePostponed: + case UpdaterEvent.userRunInstaller: + // this event is only available on Windows, ignore it + break; + } + } } } diff --git a/packages/auto_updater/lib/src/events.dart b/packages/auto_updater/lib/src/events.dart new file mode 100644 index 0000000..cf3d207 --- /dev/null +++ b/packages/auto_updater/lib/src/events.dart @@ -0,0 +1,64 @@ +enum UpdaterEvent { + error, + checkingForUpdate, + updateAvailable, + updateNotAvailable, + updateDownloaded, + beforeQuitForUpdate, + + // this event is only available on macOS + userUpdateChoice, + + // these events are only available on Windows + updatePostponed, + updateDismissed, + updateCancelled, + updateSkipped, + updateInstalled, + userRunInstaller; + + static UpdaterEvent fromString(String name) { + switch (name) { + case 'error': + return UpdaterEvent.error; + case 'checking-for-update': + case 'checkingForUpdate': + return UpdaterEvent.checkingForUpdate; + case 'update-available': + case 'updateAvailable': + return UpdaterEvent.updateAvailable; + case 'update-not-available': + case 'updateNotAvailable': + return UpdaterEvent.updateNotAvailable; + case 'update-downloaded': + case 'updateDownloaded': + return UpdaterEvent.updateDownloaded; + case 'before-quit-for-update': + case 'beforeQuitForUpdate': + return UpdaterEvent.beforeQuitForUpdate; + case 'user-update-choice': + case 'userUpdateChoice': + return UpdaterEvent.userUpdateChoice; + case 'update-cancelled': + case 'updateCancelled': + return UpdaterEvent.updateCancelled; + case 'update-skipped': + case 'updateSkipped': + return UpdaterEvent.updateSkipped; + case 'update-installed': + case 'updateInstalled': + return UpdaterEvent.updateInstalled; + case 'update-postponed': + case 'updatePostponed': + return UpdaterEvent.updatePostponed; + case 'update-dismissed': + case 'updateDismissed': + return UpdaterEvent.updateDismissed; + case 'user-run-installer': + case 'userRunInstaller': + return UpdaterEvent.userRunInstaller; + default: + throw ArgumentError('Invalid event name: $name'); + } + } +} diff --git a/packages/auto_updater/lib/src/updater_listener.dart b/packages/auto_updater/lib/src/updater_listener.dart index 079ac24..c488910 100644 --- a/packages/auto_updater/lib/src/updater_listener.dart +++ b/packages/auto_updater/lib/src/updater_listener.dart @@ -7,4 +7,7 @@ abstract mixin class UpdaterListener { void onUpdaterUpdateNotAvailable(UpdaterError? error); void onUpdaterUpdateDownloaded(AppcastItem? appcastItem); void onUpdaterBeforeQuitForUpdate(AppcastItem? appcastItem); + void onUpdaterUpdateSkipped(AppcastItem? appcastItem); + void onUpdaterUpdateCancelled(AppcastItem? appcastItem); + void onUpdaterUpdateInstalled(AppcastItem? appcastItem); } diff --git a/packages/auto_updater/lib/src/user_update_choice.dart b/packages/auto_updater/lib/src/user_update_choice.dart new file mode 100644 index 0000000..70c6267 --- /dev/null +++ b/packages/auto_updater/lib/src/user_update_choice.dart @@ -0,0 +1,5 @@ +enum UserUpdateChoice { + skip, + install, + dismiss, +} diff --git a/packages/auto_updater/pubspec.yaml b/packages/auto_updater/pubspec.yaml index 8d4c2a8..2dd5dc4 100644 --- a/packages/auto_updater/pubspec.yaml +++ b/packages/auto_updater/pubspec.yaml @@ -29,7 +29,7 @@ dev_dependencies: flutter_test: sdk: flutter json_serializable: ^6.6.0 - mostly_reasonable_lints: ^0.1.2 + flutter_lints: ^4.0.0 flutter: plugin: @@ -38,3 +38,5 @@ flutter: default_package: auto_updater_macos windows: default_package: auto_updater_windows + linux: + default_package: auto_updater_linux diff --git a/packages/auto_updater_macos/macos/Classes/AutoUpdater.swift b/packages/auto_updater_macos/macos/Classes/AutoUpdater.swift index 1525b32..69ee66e 100644 --- a/packages/auto_updater_macos/macos/Classes/AutoUpdater.swift +++ b/packages/auto_updater_macos/macos/Classes/AutoUpdater.swift @@ -14,8 +14,8 @@ extension SUAppcast { } extension SUAppcastItem { - - + + public func toDictionary() -> NSDictionary { let dict: NSDictionary = [ "versionString": self.versionString, @@ -34,6 +34,8 @@ extension SUAppcastItem { "maximumSystemVersion": self.maximumSystemVersion ?? "", "maximumOperatingSystemVersionIsOK": self.maximumOperatingSystemVersionIsOK, "channel": self.channel ?? "", + "criticalUpdate": self.isCriticalUpdate, + "os": self.osString, ] return dict; } @@ -44,11 +46,11 @@ public class AutoUpdater: NSObject, SPUUpdaterDelegate { var _updater: SPUUpdater? var feedURL: URL? public var onEvent:((String, NSDictionary) -> Void)? - + override init() { super.init() let hostBundle: Bundle = Bundle.main - + _userDriver = SPUStandardUserDriver(hostBundle: hostBundle, delegate: nil) _updater = SPUUpdater( hostBundle: hostBundle, @@ -59,7 +61,7 @@ public class AutoUpdater: NSObject, SPUUpdaterDelegate { _updater?.clearFeedURLFromUserDefaults() try? _updater?.start() } - + public func feedURLString(for updater: SPUUpdater) -> String? { return feedURL?.absoluteString } @@ -68,56 +70,60 @@ public class AutoUpdater: NSObject, SPUUpdaterDelegate { self.feedURL = feedURL try? _updater?.start() } - + public func checkForUpdates() { _updater?.checkForUpdates() } - + public func checkForUpdatesInBackground() { _updater?.checkForUpdatesInBackground() } - + public func setScheduledCheckInterval(_ interval: Int) { _updater?.updateCheckInterval = TimeInterval(interval) } - + + public func checkForUpdateInformation() { + _updater?.checkForUpdateInformation() + } + // SPUUpdaterDelegate - + public func updater(_ updater: SPUUpdater, didAbortWithError error: Error) { let data: NSDictionary = [ "error": error.localizedDescription, ] _emitEvent("error", data); } - + public func updater(_ updater: SPUUpdater, didFinishLoading appcast: SUAppcast) { let data: NSDictionary = [ "appcast": appcast.toDictionary() ] _emitEvent("checking-for-update", data) } - + public func updater(_ updater: SPUUpdater, didFindValidUpdate item: SUAppcastItem) { let data: NSDictionary = [ "appcastItem": item.toDictionary() ] _emitEvent("update-available", data) } - + public func updaterDidNotFindUpdate(_ updater: SPUUpdater, error: Error) { let data: NSDictionary = [ "error": error.localizedDescription, ] _emitEvent("update-not-available", data) } - + public func updater(_ updater: SPUUpdater, didDownloadUpdate item: SUAppcastItem) { let data: NSDictionary = [ "appcastItem": item.toDictionary() ] _emitEvent("update-downloaded", data) } - + public func updater(_ updater: SPUUpdater, willInstallUpdateOnQuit item: SUAppcastItem, immediateInstallationBlock immediateInstallHandler: @escaping () -> Void) -> Bool { let data: NSDictionary = [ "appcastItem": item.toDictionary() @@ -125,7 +131,15 @@ public class AutoUpdater: NSObject, SPUUpdaterDelegate { _emitEvent("before-quit-for-update", data) return true } - + + public func updater(_ updater: SPUUpdater, userDidMake choice: SPUUserUpdateChoice, forUpdate updateItem: SUAppcastItem, state: SPUUserUpdateState) { + let data: NSDictionary = [ + "choice": choice.rawValue, + "updateItem": updateItem.toDictionary(), + ] + _emitEvent("user-update-choice", data) + } + public func _emitEvent(_ eventName: String, _ data: NSDictionary) { if (onEvent != nil) { onEvent!(eventName, data) diff --git a/packages/auto_updater_macos/macos/Classes/AutoUpdaterMacosPlugin.swift b/packages/auto_updater_macos/macos/Classes/AutoUpdaterMacosPlugin.swift index ddd2870..94ad173 100644 --- a/packages/auto_updater_macos/macos/Classes/AutoUpdaterMacosPlugin.swift +++ b/packages/auto_updater_macos/macos/Classes/AutoUpdaterMacosPlugin.swift @@ -3,9 +3,9 @@ import FlutterMacOS public class AutoUpdaterMacosPlugin: NSObject, FlutterPlugin,FlutterStreamHandler { private var _eventSink: FlutterEventSink? - + private var autoUpdater: AutoUpdater = AutoUpdater() - + public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "dev.leanflutter.plugins/auto_updater", binaryMessenger: registrar.messenger) let instance = AutoUpdaterMacosPlugin() @@ -24,20 +24,20 @@ public class AutoUpdaterMacosPlugin: NSObject, FlutterPlugin,FlutterStreamHandle eventSink(event) } } - + public func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? { self._eventSink = events return nil; } - + public func onCancel(withArguments arguments: Any?) -> FlutterError? { self._eventSink = nil return nil } - + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { let args: [String: Any] = call.arguments as? [String: Any] ?? [:] - + switch call.method { case "setFeedURL": let feedURL = URL(string: args["feedURL"] as! String) @@ -53,6 +53,10 @@ public class AutoUpdaterMacosPlugin: NSObject, FlutterPlugin,FlutterStreamHandle } result(true) break + case "checkForUpdateInformation": + autoUpdater.checkForUpdateInformation() + result(true) + break case "setScheduledCheckInterval": let interval = args["interval"] as! Int autoUpdater.setScheduledCheckInterval(interval) diff --git a/packages/auto_updater_platform_interface/lib/src/auto_updater_method_channel.dart b/packages/auto_updater_platform_interface/lib/src/auto_updater_method_channel.dart index 9af60b9..ff277a8 100644 --- a/packages/auto_updater_platform_interface/lib/src/auto_updater_method_channel.dart +++ b/packages/auto_updater_platform_interface/lib/src/auto_updater_method_channel.dart @@ -44,4 +44,9 @@ class MethodChannelAutoUpdater extends AutoUpdaterPlatform { }; await methodChannel.invokeMethod('setScheduledCheckInterval', arguments); } + + @override + Future checkForUpdateInformation() async { + await methodChannel.invokeMethod('checkForUpdateInformation'); + } } diff --git a/packages/auto_updater_platform_interface/lib/src/auto_updater_platform_interface.dart b/packages/auto_updater_platform_interface/lib/src/auto_updater_platform_interface.dart index cec1ac6..d4827c9 100644 --- a/packages/auto_updater_platform_interface/lib/src/auto_updater_platform_interface.dart +++ b/packages/auto_updater_platform_interface/lib/src/auto_updater_platform_interface.dart @@ -42,4 +42,16 @@ abstract class AutoUpdaterPlatform extends PlatformInterface { 'setScheduledCheckInterval() has not been implemented.', ); } + + /// Checks for update information. + Future checkForUpdateInformation() async { + throw UnimplementedError( + 'checkForUpdateInformation() has not been implemented.', + ); + } + + /// Cleans up the auto updater. + Future cleanup() async { + throw UnimplementedError('cleanup() has not been implemented.'); + } } diff --git a/packages/auto_updater_windows/windows/.gitignore b/packages/auto_updater_windows/windows/.gitignore index 60ef81e..2bfbd41 100644 --- a/packages/auto_updater_windows/windows/.gitignore +++ b/packages/auto_updater_windows/windows/.gitignore @@ -16,4 +16,4 @@ x86/ # but keep track of directories ending in .cache !*.[Cc]ache/ -!WinSparkle-0.8.1/x64 \ No newline at end of file +!WinSparkle-0.8.3/x64 diff --git a/packages/auto_updater_windows/windows/CMakeLists.txt b/packages/auto_updater_windows/windows/CMakeLists.txt index ae2c1fc..ce173cd 100644 --- a/packages/auto_updater_windows/windows/CMakeLists.txt +++ b/packages/auto_updater_windows/windows/CMakeLists.txt @@ -17,7 +17,7 @@ cmake_policy(VERSION 3.14...3.25) set(PLUGIN_NAME "auto_updater_windows_plugin") # WinSparkle -set(WIN_SPARKLE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/WinSparkle-0.8.1") +set(WIN_SPARKLE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/WinSparkle-0.8.3") set(WIN_SPARKLE_BINARIES "${WIN_SPARKLE_DIR}/x64/Release/WinSparkle.dll") set(WIN_SPARKLE_LIBRARIES "${WIN_SPARKLE_DIR}/x64/Release/WinSparkle.lib") @@ -50,7 +50,7 @@ target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) # Source include directories and library dependencies. Add any plugin-specific # dependencies here. target_include_directories(${PLUGIN_NAME} INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/include" + "${CMAKE_CURRENT_SOURCE_DIR}/include" "${WIN_SPARKLE_DIR}/include" ) target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.dll b/packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.dll deleted file mode 100644 index 2f333c6..0000000 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.dll and /dev/null differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.dll b/packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.dll deleted file mode 100644 index 9b928e3..0000000 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.dll and /dev/null differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.dll b/packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.dll deleted file mode 100644 index d77a210..0000000 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.dll and /dev/null differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.dll b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.dll new file mode 100644 index 0000000..a417779 Binary files /dev/null and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.dll differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.lib b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.lib similarity index 94% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.lib rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.lib index 17ca122..9609953 100644 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.lib and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.lib differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.pdb b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.pdb similarity index 56% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.pdb rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.pdb index 35b29cc..9e0b39d 100644 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/ARM64/Release/WinSparkle.pdb and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/ARM64/Release/WinSparkle.pdb differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/AUTHORS b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/AUTHORS similarity index 95% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/AUTHORS rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/AUTHORS index 34ebd54..6e6b010 100644 --- a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/AUTHORS +++ b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/AUTHORS @@ -1,12 +1,12 @@ -Maintainer: - -Vaclav Slavik - - -Contributors: - -Kohan Ikin -Christian L. Jacobsen -Littleboy -Vasco Veloso -Jonas Emanuel Mueller +Maintainer: + +Vaclav Slavik + + +Contributors: + +Kohan Ikin +Christian L. Jacobsen +Littleboy +Vasco Veloso +Jonas Emanuel Mueller diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/COPYING b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/COPYING similarity index 94% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/COPYING rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/COPYING index 79db356..45dcf25 100644 --- a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/COPYING +++ b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/COPYING @@ -1,25 +1,25 @@ -Copyright (c) 2009-2023 Vaclav Slavik - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - - -This product includes software developed by the OpenSSL Project -for use in the OpenSSL Toolkit (http://www.openssl.org/). +Copyright (c) 2009-2024 Vaclav Slavik + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + + +This product includes software developed by the OpenSSL Project +for use in the OpenSSL Toolkit (http://www.openssl.org/). diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/COPYING.expat b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/COPYING.expat similarity index 100% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/COPYING.expat rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/COPYING.expat diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/NEWS b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/NEWS similarity index 80% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/NEWS rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/NEWS index c0cbb12..9328e8f 100644 --- a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/NEWS +++ b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/NEWS @@ -1,151 +1,173 @@ -Version 0.8.1 -------------- - -- Fixed release notes not shown if is malformed - and has whitespace around the URL. - - -Version 0.8.0 -------------- - -- Added support for modern Edge/WebView2 browser for release notes. -- Added win_sparkle_set_update_dismissed_callback() and - win_sparkle_set_update_postponed_callback() callbacks. -- Added partiaul support for tag. -- Links in release notes now open in user's default browser as they should. -- Added support for Visual Studio 2019 and 2022. -- Added official NuGet package. -- Added support for ARM64 architecture. -- This version drops official support for Windows XP. It may still be possible - to target it with vs*_xp toolsets, but would probably require at least - disabling WebView2. Prebuilt binaries and NuGet package don't support XP. - - -Version 0.7.0 -------------- - -- Added support for providing custom HTTP headers when fetch appcast feeds. -- Added support for overriding WinSparkle config functions. -- Reduced size of WinSparkle.dll. - - -Version 0.6.0 -------------- - -- Added support for validating DSA signatures. -- Fixes to window placement. -- Fixed regression in win_sparkle_check_update_without_ui() not checking - immediately. - - -Version 0.5.7 -------------- - -- Fixed issue with downloads from servers without keep-alive support. - - -Version 0.5.6 -------------- - -- Includes security fixes for Expat XML parser (CVE-2017-11742). - - -Version 0.5.5 -------------- - -- Fixed regression in initial update checking introduced in 0.5.4. - - -Version 0.5.4 -------------- - -- Updates are now checked in background periodically even in applications that - are running for a long time. -- HTTP caching is now disabled more aggressively. -- Fixed handling of downloads from URLs with query parameters. -- Includes security fixes for Expat XML parser. - - -Version 0.5.3 -------------- - -- Downloads are now cancellable. -- Fixed an issue with parsing some appcasts (#123). -- Verify UpdateTempDir's validity before deleting it. - - -Version 0.5.2 -------------- - -- Includes security fixes for Expat XML parser. - - -Version 0.5.1 -------------- - -- Includes fix for the CVE-2016-0718 vulnerability in Expat XML parser. -- Added Pascal bindings. -- Fixes for RTL languages, added Arabic and Hebrew translations. - - -Version 0.5 ------------ - -- Added translations support (32 languages are included at the moment). -- HiDPI support. -- Updated Expat XML parser to 2.1.1 (security fixes, CVE-2015-1283). -- Support for minimumSystemVersion and for specifying 32/64 versions. -- Added win_sparkle_check_update_with_ui_and_install() for forcefully - installing available updates. -- Added more callbacks for various events during updating. -- Misc cosmetic fixes. - - -Version 0.4 ------------ - -- Added API for gracefully shutting down the host app. -- Added the ability to disable automatic checks. -- Added the ability to change the update checks interval. -- Added x64 support. -- Added Visual Studio 201x project files. -- Release notes included in appcast's element are now recognized. -- Added support for build numbers and shortVersionString. -- Added support for sparkle:os="windows" attribute on appcast items. -- Fixed appcasts over HTTPS. -- Use application icon in the UI. -- In-app downloads. - - -Version 0.3 ------------ - -- Added win_sparkle_set_app_details() for setting app metadata from code, - as an alternative to their extraction from resources. -- It is no longer necessary to call win_sparkle_set_appcast_url(), the - feed can be specified in FeedURL resource with type set to APPCAST. -- Added win_sparkle_set_registry_path(). - - -Version 0.2 ------------ - -- Display error if update info couldn't be retrieved while manually checking - for updates. -- WinSparkle window is now resizable only when showing release notes. -- Bypass cache and proxies in manual checks. - - -Version 0.1.1 -------------- - -- Fixed Sparkle namespace in appcast parser; it now looks for the correct - `http://www.andymatuschak.org/xml-namespaces/sparkle` value. Appcasts - using the incorrect `http://www.andymatuschak.org/xml-namespaces` - URI must be updated. - - -Version 0.1 ------------ - -- Initial release. +Version 0.8.3 +------------- + +- Fixed parsing breakage introduced in 0.8.2. +- Also understand major.minor-build for . + + +Version 0.8.2 +------------- + +- Support major.minor.build versioning scheme in ; + previously only much less useful major.minor.servicepack was used. +- Added support for gzip/deflate-compressed appcasts. +- Added support for ARM-specific enclosures. +- Fixed handling of multiple enclosures to correctly pick the most-specific + binary available, and to use the latest available app version. +- Fixed feed parsing to ignore appcast order of items and instead find the + highest compatible version. +- Call cancelled/dismissed callbacks when user closes WinSparkle's window. +- New and updated translations. + + +Version 0.8.1 +------------- + +- Fixed release notes not shown if is malformed + and has whitespace around the URL. + + +Version 0.8.0 +------------- + +- Added support for modern Edge/WebView2 browser for release notes. +- Added win_sparkle_set_update_dismissed_callback() and + win_sparkle_set_update_postponed_callback() callbacks. +- Added partiaul support for tag. +- Links in release notes now open in user's default browser as they should. +- Added support for Visual Studio 2019 and 2022. +- Added official NuGet package. +- Added support for ARM64 architecture. +- This version drops official support for Windows XP. It may still be possible + to target it with vs*_xp toolsets, but would probably require at least + disabling WebView2. Prebuilt binaries and NuGet package don't support XP. + + +Version 0.7.0 +------------- + +- Added support for providing custom HTTP headers when fetch appcast feeds. +- Added support for overriding WinSparkle config functions. +- Reduced size of WinSparkle.dll. + + +Version 0.6.0 +------------- + +- Added support for validating DSA signatures. +- Fixes to window placement. +- Fixed regression in win_sparkle_check_update_without_ui() not checking + immediately. + + +Version 0.5.7 +------------- + +- Fixed issue with downloads from servers without keep-alive support. + + +Version 0.5.6 +------------- + +- Includes security fixes for Expat XML parser (CVE-2017-11742). + + +Version 0.5.5 +------------- + +- Fixed regression in initial update checking introduced in 0.5.4. + + +Version 0.5.4 +------------- + +- Updates are now checked in background periodically even in applications that + are running for a long time. +- HTTP caching is now disabled more aggressively. +- Fixed handling of downloads from URLs with query parameters. +- Includes security fixes for Expat XML parser. + + +Version 0.5.3 +------------- + +- Downloads are now cancellable. +- Fixed an issue with parsing some appcasts (#123). +- Verify UpdateTempDir's validity before deleting it. + + +Version 0.5.2 +------------- + +- Includes security fixes for Expat XML parser. + + +Version 0.5.1 +------------- + +- Includes fix for the CVE-2016-0718 vulnerability in Expat XML parser. +- Added Pascal bindings. +- Fixes for RTL languages, added Arabic and Hebrew translations. + + +Version 0.5 +----------- + +- Added translations support (32 languages are included at the moment). +- HiDPI support. +- Updated Expat XML parser to 2.1.1 (security fixes, CVE-2015-1283). +- Support for minimumSystemVersion and for specifying 32/64 versions. +- Added win_sparkle_check_update_with_ui_and_install() for forcefully + installing available updates. +- Added more callbacks for various events during updating. +- Misc cosmetic fixes. + + +Version 0.4 +----------- + +- Added API for gracefully shutting down the host app. +- Added the ability to disable automatic checks. +- Added the ability to change the update checks interval. +- Added x64 support. +- Added Visual Studio 201x project files. +- Release notes included in appcast's element are now recognized. +- Added support for build numbers and shortVersionString. +- Added support for sparkle:os="windows" attribute on appcast items. +- Fixed appcasts over HTTPS. +- Use application icon in the UI. +- In-app downloads. + + +Version 0.3 +----------- + +- Added win_sparkle_set_app_details() for setting app metadata from code, + as an alternative to their extraction from resources. +- It is no longer necessary to call win_sparkle_set_appcast_url(), the + feed can be specified in FeedURL resource with type set to APPCAST. +- Added win_sparkle_set_registry_path(). + + +Version 0.2 +----------- + +- Display error if update info couldn't be retrieved while manually checking + for updates. +- WinSparkle window is now resizable only when showing release notes. +- Bypass cache and proxies in manual checks. + + +Version 0.1.1 +------------- + +- Fixed Sparkle namespace in appcast parser; it now looks for the correct + `http://www.andymatuschak.org/xml-namespaces/sparkle` value. Appcasts + using the incorrect `http://www.andymatuschak.org/xml-namespaces` + URI must be updated. + + +Version 0.1 +----------- + +- Initial release. diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/README.md b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/README.md similarity index 97% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/README.md rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/README.md index 8a61785..6744123 100644 --- a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/README.md +++ b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/README.md @@ -1,4 +1,4 @@ -[![Crowdin](https://d322cqt584bo4o.cloudfront.net/winsparkle/localized.png)](https://crowdin.com/project/winsparkle) +[![Crowdin](https://badges.crowdin.net/winsparkle/localized.svg)](https://crowdin.com/project/winsparkle) About ------- diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.dll b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.dll new file mode 100644 index 0000000..4be7bce Binary files /dev/null and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.dll differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.lib b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.lib similarity index 94% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.lib rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.lib index ad0a6b4..54aee9b 100644 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.lib and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.lib differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.pdb b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.pdb similarity index 56% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.pdb rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.pdb index 64804d5..20a90f3 100644 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/Release/WinSparkle.pdb and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/Release/WinSparkle.pdb differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/bin/generate_keys.bat b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/bin/generate_keys.bat similarity index 100% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/bin/generate_keys.bat rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/bin/generate_keys.bat diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/bin/sign_update.bat b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/bin/sign_update.bat similarity index 100% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/bin/sign_update.bat rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/bin/sign_update.bat diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/include/winsparkle-version.h b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/include/winsparkle-version.h similarity index 95% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/include/winsparkle-version.h rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/include/winsparkle-version.h index 1fa1ef5..b4e4208 100644 --- a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/include/winsparkle-version.h +++ b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/include/winsparkle-version.h @@ -1,64 +1,64 @@ -/* - * This file is part of WinSparkle (https://winsparkle.org) - * - * Copyright (C) 2009-2023 Vaclav Slavik - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef _winsparkle_version_h_ -#define _winsparkle_version_h_ - -/*--------------------------------------------------------------------------* - Version information - *--------------------------------------------------------------------------*/ - -#define WIN_SPARKLE_VERSION_MAJOR 0 -#define WIN_SPARKLE_VERSION_MINOR 8 -#define WIN_SPARKLE_VERSION_MICRO 1 - -/** - Checks if WinSparkle version is at least @a major.@a minor.@a micro. - */ -#define WIN_SPARKLE_CHECK_VERSION(major, minor, micro) \ - ( \ - WIN_SPARKLE_VERSION_MAJOR > (major) \ - || \ - (WIN_SPARKLE_VERSION_MAJOR == (major) && \ - WIN_SPARKLE_VERSION_MINOR >= (minor)) \ - || \ - (WIN_SPARKLE_VERSION_MAJOR == (major) && \ - WIN_SPARKLE_VERSION_MINOR == (minor) && \ - WIN_SPARKLE_VERSION_MICRO >= (micro)) \ - ) - -#define _WIN_SPARKLE_MAKE_STR(x) #x -#define _WIN_SPARKLE_MAKE_VERSION_STR(a,b,c) \ - _WIN_SPARKLE_MAKE_STR(a) "." _WIN_SPARKLE_MAKE_STR(b) "." _WIN_SPARKLE_MAKE_STR(c) - -/** - WinSparkle version as a string in the form of e.g. "0.1.3". - */ -#define WIN_SPARKLE_VERSION_STRING \ - _WIN_SPARKLE_MAKE_VERSION_STR(WIN_SPARKLE_VERSION_MAJOR, \ - WIN_SPARKLE_VERSION_MINOR, \ - WIN_SPARKLE_VERSION_MICRO) - -#endif // _winsparkle_version_h_ +/* + * This file is part of WinSparkle (https://winsparkle.org) + * + * Copyright (C) 2009-2024 Vaclav Slavik + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _winsparkle_version_h_ +#define _winsparkle_version_h_ + +/*--------------------------------------------------------------------------* + Version information + *--------------------------------------------------------------------------*/ + +#define WIN_SPARKLE_VERSION_MAJOR 0 +#define WIN_SPARKLE_VERSION_MINOR 8 +#define WIN_SPARKLE_VERSION_MICRO 3 + +/** + Checks if WinSparkle version is at least @a major.@a minor.@a micro. + */ +#define WIN_SPARKLE_CHECK_VERSION(major, minor, micro) \ + ( \ + WIN_SPARKLE_VERSION_MAJOR > (major) \ + || \ + (WIN_SPARKLE_VERSION_MAJOR == (major) && \ + WIN_SPARKLE_VERSION_MINOR >= (minor)) \ + || \ + (WIN_SPARKLE_VERSION_MAJOR == (major) && \ + WIN_SPARKLE_VERSION_MINOR == (minor) && \ + WIN_SPARKLE_VERSION_MICRO >= (micro)) \ + ) + +#define _WIN_SPARKLE_MAKE_STR(x) #x +#define _WIN_SPARKLE_MAKE_VERSION_STR(a,b,c) \ + _WIN_SPARKLE_MAKE_STR(a) "." _WIN_SPARKLE_MAKE_STR(b) "." _WIN_SPARKLE_MAKE_STR(c) + +/** + WinSparkle version as a string in the form of e.g. "0.1.3". + */ +#define WIN_SPARKLE_VERSION_STRING \ + _WIN_SPARKLE_MAKE_VERSION_STR(WIN_SPARKLE_VERSION_MAJOR, \ + WIN_SPARKLE_VERSION_MINOR, \ + WIN_SPARKLE_VERSION_MICRO) + +#endif // _winsparkle_version_h_ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/include/winsparkle.h b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/include/winsparkle.h similarity index 94% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/include/winsparkle.h rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/include/winsparkle.h index 5a61418..5b29b3e 100644 --- a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/include/winsparkle.h +++ b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/include/winsparkle.h @@ -1,613 +1,617 @@ -/* - * This file is part of WinSparkle (https://winsparkle.org) - * - * Copyright (C) 2009-2023 Vaclav Slavik - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef _winsparkle_h_ -#define _winsparkle_h_ - -#include -#include - -#include "winsparkle-version.h" - -#if !defined(BUILDING_WIN_SPARKLE) && defined(_MSC_VER) -#pragma comment(lib, "WinSparkle.lib") -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef BUILDING_WIN_SPARKLE - #define WIN_SPARKLE_API __declspec(dllexport) -#else - #define WIN_SPARKLE_API __declspec(dllimport) -#endif - - -/// Return value for boolean functions to indicate unexpected error. -/// Only used by functions or callbacks that are explicitly documented as using it. -#define WINSPARKLE_RETURN_ERROR (-1) - - -/*--------------------------------------------------------------------------* - Initialization and shutdown - *--------------------------------------------------------------------------*/ - -/** - @name Initialization functions - */ -//@{ - -/** - Starts WinSparkle. - - If WinSparkle is configured to check for updates on startup, proceeds - to perform the check. You should only call this function when your app - is initialized and shows its main window. - - @note This call doesn't block and returns almost immediately. If an - update is available, the respective UI is shown later from a separate - thread. - - @see win_sparkle_cleanup() - */ -WIN_SPARKLE_API void __cdecl win_sparkle_init(); - -/** - Cleans up after WinSparkle. - - Should be called by the app when it's shutting down. Cancels any - pending Sparkle operations and shuts down its helper threads. - */ -WIN_SPARKLE_API void __cdecl win_sparkle_cleanup(); - -//@} - - -/*--------------------------------------------------------------------------* - Language settings -*--------------------------------------------------------------------------*/ - -/** -@name Language settings - -These functions set user interface language. They must be called before -win_sparkle_init() to have any effect. If none of them is called, WinSparkle -detects the UI language automatically. -*/ -//@{ - -/** - Sets UI language from its ISO code. - - This function must be called before win_sparkle_init(). - - @param lang ISO 639 language code with an optional ISO 3116 country - code, e.g. "fr", "pt-PT", "pt-BR" or "pt_BR", as used - e.g. by ::GetThreadPreferredUILanguages() too. - - @since 0.5 - - @see win_sparkle_set_langid() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_lang(const char *lang); - -/** - Sets UI language from its Win32 LANGID code. - - This function must be called before win_sparkle_init(). - - @param lang Language code (LANGID) as created by the MAKELANGID macro - or returned by e.g. ::GetThreadUILanguage() - - @since 0.5 - - @see win_sparkle_set_lang() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_langid(unsigned short lang); - -//@} - -/*--------------------------------------------------------------------------* - Configuration - *--------------------------------------------------------------------------*/ - -/** - @name Configuration functions - - Functions for setting up WinSparkle. - - All functions in this category can only be called @em before the first - call to win_sparkle_init()! - - Typically, the application would configure WinSparkle on startup and then - call win_sparkle_init(), all from its main thread. - */ -//@{ - -/** - Sets URL for the app's appcast. - - Only http and https schemes are supported. - - If this function isn't called by the app, the URL is obtained from - Windows resource named "FeedURL" of type "APPCAST". - - @param url URL of the appcast. - - @note Always use HTTPS feeds, do not use unencrypted HTTP! This is - necessary to prevent both leaking user information and preventing - various MITM attacks. - - @note See https://github.com/vslavik/winsparkle/wiki/Appcast-Feeds for - more information about appcast feeds. - */ -WIN_SPARKLE_API void __cdecl win_sparkle_set_appcast_url(const char *url); - -/** - Sets DSA public key. - - Only PEM format is supported. - - Public key will be used to verify DSA signature of the update file. - PEM data will be set only if it contains valid DSA public key. - - If this function isn't called by the app, public key is obtained from - Windows resource named "DSAPub" of type "DSAPEM". - - @param dsa_pub_pem DSA public key in PEM format. - - @return 1 if valid DSA public key provided, 0 otherwise. - - @since 0.6.0 - */ -WIN_SPARKLE_API int __cdecl win_sparkle_set_dsa_pub_pem(const char *dsa_pub_pem); - -/** - Sets application metadata. - - Normally, these are taken from VERSIONINFO/StringFileInfo resources, - but if your application doesn't use them for some reason, using this - function is an alternative. - - @param company_name Company name of the vendor. - @param app_name Application name. This is both shown to the user - and used in HTTP User-Agent header. - @param app_version Version of the app, as string (e.g. "1.2" or "1.2rc1"). - - @note @a company_name and @a app_name are used to determine the location - of WinSparkle settings in registry. - (HKCU\Software\\\WinSparkle is used.) - - @since 0.3 - - @see win_sparkle_set_app_build_version(); - */ -WIN_SPARKLE_API void __cdecl win_sparkle_set_app_details(const wchar_t *company_name, - const wchar_t *app_name, - const wchar_t *app_version); - -/** - Sets application build version number. - - This is the internal version number that is not normally shown to the user. - It can be used for finer granularity that official release versions, e.g. for - interim builds. - - If this function is called, then the provided *build* number is used for comparing - versions; it is compared to the "version" attribute in the appcast and corresponds - to OS X Sparkle's CFBundleVersion handling. If used, then the appcast must - also contain the "shortVersionString" attribute with human-readable display - version string. The version passed to win_sparkle_set_app_details() - corresponds to this and is used for display. - - @since 0.4 - - @see win_sparkle_set_app_details() - */ -WIN_SPARKLE_API void __cdecl win_sparkle_set_app_build_version(const wchar_t *build); - -/** - Set custom HTTP header for appcast checks. - - @since 0.7 - - @see win_sparkle_clear_http_headers() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_http_header(const char *name, const char *value); - -/** - Clears all custom HTTP headers previously added using - win_sparkle_set_http_header(). - - @since 0.7 - - @see win_sparkle_set_http_header() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_clear_http_headers(); - -/** - Set the registry path where settings will be stored. - - Normally, these are stored in - "HKCU\Software\\\WinSparkle" - but if your application needs to store the data elsewhere for - some reason, using this function is an alternative. - - Note that @a path is relative to HKCU/HKLM root and the root is not part - of it. For example: - @code - win_sparkle_set_registry_path("Software\\My App\\Updates"); - @endcode - - @param path Registry path where settings will be stored. - - @since 0.3 - */ -WIN_SPARKLE_API void __cdecl win_sparkle_set_registry_path(const char *path); - -/// Type used to override WinSparkle configuration's read, write and delete functions -typedef struct win_sparkle_config_methods_tag { - /// Copy config value named @a name to the buffer pointed by @a buf, returns TRUE on success, FALSE on failure - int(__cdecl *config_read)(const char *name, wchar_t *buf, size_t len, void *user_data); - /// Write @a value as config value @a name 's new value - void(__cdecl *config_write)(const char *name, const wchar_t *value, void *user_data); - /// Delete config value named @a name - void(__cdecl *config_delete)(const char *name, void *user_data); - /// Arbitrary data which will be passed to the above functions, WinSparkle will not read or alter it. - void *user_data; -} win_sparkle_config_methods_t; - - -/** - Override WinSparkle's configuration read, write and delete functions. - - By default, WinSparkle will read, write and delete configuration values by - interacting directly with Windows Registry. - If you want to manage configuration by yourself, or if you don't want let WinSparkle - write settings directly to the Windows Registry, you can provide your own functions - to read, write and delete configuration. - - These functions needs to return TRUE on success, FALSE on failure. - If you passed NULL as a configuration action (read, write or delete)'s function pointer, - WinSparkle will use the default function for that action. - - @param config_methods Your own configuration read, write and delete functions. - Pass NULL to let WinSparkle continue to use its default functions. - - @note There's no guarantee about the thread from which these functions are called, - Make sure your functions are thread-safe. - - @since 0.7 -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_config_methods(win_sparkle_config_methods_t *config_methods); - -/** - Sets whether updates are checked automatically or only through a manual call. - - If disabled, win_sparkle_check_update_with_ui() must be used explicitly. - - @param state 1 to have updates checked automatically, 0 otherwise - - @since 0.4 - */ -WIN_SPARKLE_API void __cdecl win_sparkle_set_automatic_check_for_updates(int state); - -/** - Gets the automatic update checking state - - @return 1 if updates are set to be checked automatically, 0 otherwise - - @note Defaults to 0 when not yet configured (as happens on first start). - - @since 0.4 - */ -WIN_SPARKLE_API int __cdecl win_sparkle_get_automatic_check_for_updates(); - -/** - Sets the automatic update interval. - - @param interval The interval in seconds between checks for updates. - The minimum update interval is 3600 seconds (1 hour). - - @since 0.4 - */ -WIN_SPARKLE_API void __cdecl win_sparkle_set_update_check_interval(int interval); - -/** - Gets the automatic update interval in seconds. - - Default value is one day. - - @since 0.4 - */ -WIN_SPARKLE_API int __cdecl win_sparkle_get_update_check_interval(); - -/** - Gets the time for the last update check. - - Default value is -1, indicating that the update check has never run. - - @since 0.4 -*/ -WIN_SPARKLE_API time_t __cdecl win_sparkle_get_last_check_time(); - -/// Callback type for win_sparkle_error_callback() -typedef void (__cdecl *win_sparkle_error_callback_t)(); - -/** - Set callback to be called when the updater encounters an error. - - @since 0.5 -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_error_callback(win_sparkle_error_callback_t callback); - -/// Callback type for win_sparkle_can_shutdown_callback() -typedef int (__cdecl *win_sparkle_can_shutdown_callback_t)(); - -/** - Set callback for querying the application if it can be closed. - - This callback will be called to ask the host if it's ready to shut down, - before attempting to launch the installer. The callback returns TRUE if - the host application can be safely shut down or FALSE if not (e.g. because - the user has unsaved documents). - - @note There's no guarantee about the thread from which the callback is called, - except that it certainly *won't* be called from the app's main thread. - Make sure the callback is thread-safe. - - @since 0.4 - - @see win_sparkle_set_shutdown_request_callback() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_can_shutdown_callback(win_sparkle_can_shutdown_callback_t callback); - - -/// Callback type for win_sparkle_shutdown_request_callback() -typedef void (__cdecl *win_sparkle_shutdown_request_callback_t)(); - -/** - Set callback for shutting down the application. - - This callback will be called to ask the host to shut down immediately after - launching the installer. Its implementation should gracefully terminate the - application. - - It will only be called if the call to the callback set with - win_sparkle_set_can_shutdown_callback() returns TRUE. - - @note There's no guarantee about the thread from which the callback is called, - except that it certainly *won't* be called from the app's main thread. - Make sure the callback is thread-safe. - - @since 0.4 - - @see win_sparkle_set_can_shutdown_callback() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_shutdown_request_callback(win_sparkle_shutdown_request_callback_t); - -/// Callback type for win_sparkle_did_find_update_callback() -typedef void(__cdecl *win_sparkle_did_find_update_callback_t)(); - -/** - Set callback to be called when the updater did find an update. - - This is useful in combination with - win_sparkle_check_update_with_ui_and_install() as it allows you to perform - some action after WinSparkle checks for updates. - - @since 0.5 - - @see win_sparkle_did_not_find_update_callback() - @see win_sparkle_check_update_with_ui_and_install() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_did_find_update_callback(win_sparkle_did_find_update_callback_t callback); - -/// Callback type for win_sparkle_did_not_find_update_callback() -typedef void (__cdecl *win_sparkle_did_not_find_update_callback_t)(); - -/** - Set callback to be called when the updater did not find an update. - - This is useful in combination with - win_sparkle_check_update_with_ui_and_install() as it allows you to perform - some action after WinSparkle checks for updates. - - @since 0.5 - - @see win_sparkle_did_find_update_callback() - @see win_sparkle_check_update_with_ui_and_install() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_did_not_find_update_callback(win_sparkle_did_not_find_update_callback_t callback); - -/// Callback type for win_sparkle_update_cancelled_callback() -typedef void (__cdecl *win_sparkle_update_cancelled_callback_t)(); - -/** - Set callback to be called when the user cancels a download. - - This is useful in combination with - win_sparkle_check_update_with_ui_and_install() as it allows you to perform - some action when the installation is interrupted. - - @since 0.5 - - @see win_sparkle_check_update_with_ui_and_install() -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_update_cancelled_callback(win_sparkle_update_cancelled_callback_t callback); - -/// Callback type for win_sparkle_update_skipped_callback() -typedef void(__cdecl* win_sparkle_update_skipped_callback_t)(); - -/** - Set callback to be called when the user skips an update. - - This is useful in combination with - win_sparkle_check_update_with_ui() or similar as it - allows you to perform some action when the update - is skipped. - - @see win_sparkle_check_update_with_ui_and_install() - - @since 0.8 -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_update_skipped_callback(win_sparkle_update_skipped_callback_t callback); - -/// Callback type for win_sparkle_update_postponed_callback() -typedef void(__cdecl* win_sparkle_update_postponed_callback_t)(); - -/** - Set callback to be called when the user postpones an update - ( presses 'remind me later' button). - - This is useful in combination with - win_sparkle_check_update_with_ui() or similar as it - allows you to perform some action when the download - is postponed. - - @see win_sparkle_check_update_with_ui() - - @since 0.8 -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_update_postponed_callback(win_sparkle_update_postponed_callback_t callback); - -/// Callback type for win_sparkle_update_dismissed_callback() -typedef void(__cdecl* win_sparkle_update_dismissed_callback_t)(); - -/** - Set callback to be called when the user dismisses - (closes) update dialog. - - This is useful in combination with - win_sparkle_check_update_with_ui() or similar as it - allows you to perform some action when the update - dialog is closed. - - @see win_sparkle_check_update_with_ui() - - @since 0.8 -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_update_dismissed_callback(win_sparkle_update_dismissed_callback_t callback); - - -/// Callback type for win_sparkle_user_run_installer_callback() -typedef int(__cdecl* win_sparkle_user_run_installer_callback_t)(const wchar_t *); - -/** - Set callback to be called when the update payload is - downloaded and read to be executed.or handled in some - other manner. - - The callback returns: - - 1 if the file was handled by the callback - - 0 if it was not, in which case WinSparkle default handling will take place - - WINSPARKLE_RETURN_ERROR in case of an error - - @since 0.8 -*/ -WIN_SPARKLE_API void __cdecl win_sparkle_set_user_run_installer_callback(win_sparkle_user_run_installer_callback_t callback); - -//@} - - -/*--------------------------------------------------------------------------* - Manual usage - *--------------------------------------------------------------------------*/ - -/** - @name Manually using WinSparkle - */ -//@{ - -/** - Checks if an update is available, showing progress UI to the user. - - Normally, WinSparkle checks for updates on startup and only shows its UI - when it finds an update. If the application disables this behavior, it - can hook this function to "Check for updates..." menu item. - - When called, background thread is started to check for updates. A small - window is shown to let the user know the progress. If no update is found, - the user is told so. If there is an update, the usual "update available" - window is shown. - - This function returns immediately. - - @note Because this function is intended for manual, user-initiated checks - for updates, it ignores "Skip this version" even if the user checked - it previously. - - @see win_sparkle_check_update_without_ui() - */ -WIN_SPARKLE_API void __cdecl win_sparkle_check_update_with_ui(); - -/** - Checks if an update is available, showing progress UI to the user and - immediately installing the update if one is available. - - This is useful for the case when users should almost always use the - newest version of your software. When called, WinSparkle will check for - updates showing a progress UI to the user. If an update is found the update - prompt will be skipped and the update will be installed immediately. - - If your application expects to do something after checking for updates you - may wish to use win_sparkle_set_did_not_find_update_callback() and - win_sparkle_set_update_cancelled_callback(). - - @since 0.5 - - @see win_sparkle_set_did_find_update_callback() - @see win_sparkle_set_update_cancelled_callback() - */ -WIN_SPARKLE_API void __cdecl win_sparkle_check_update_with_ui_and_install(); - -/** - Checks if an update is available. - - No progress UI is shown to the user when checking. If an update is - available, the usual "update available" window is shown; this function - is *not* completely UI-less. - - Use with caution, it usually makes more sense to use the automatic update - checks on interval option or manual check with visible UI. - - This function returns immediately. - - @note This function respects "Skip this version" choice by the user. - - @since 0.4 - - @see win_sparkle_check_update_with_ui() - */ -WIN_SPARKLE_API void __cdecl win_sparkle_check_update_without_ui(); - -//@} - -#ifdef __cplusplus -} -#endif - -#endif // _winsparkle_h_ +/* + * This file is part of WinSparkle (https://winsparkle.org) + * + * Copyright (C) 2009-2024 Vaclav Slavik + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _winsparkle_h_ +#define _winsparkle_h_ + +#include +#include + +#include "winsparkle-version.h" + +#if !defined(BUILDING_WIN_SPARKLE) && defined(_MSC_VER) +#pragma comment(lib, "WinSparkle.lib") +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef BUILDING_WIN_SPARKLE + #define WIN_SPARKLE_API __declspec(dllexport) +#else + #define WIN_SPARKLE_API __declspec(dllimport) +#endif + + +/// Return value for boolean functions to indicate unexpected error. +/// Only used by functions or callbacks that are explicitly documented as using it. +#define WINSPARKLE_RETURN_ERROR (-1) + + +/*--------------------------------------------------------------------------* + Initialization and shutdown + *--------------------------------------------------------------------------*/ + +/** + @name Initialization functions + */ +//@{ + +/** + Starts WinSparkle. + + If WinSparkle is configured to check for updates on startup, proceeds + to perform the check. You should only call this function when your app + is initialized and shows its main window. + + @note This call doesn't block and returns almost immediately. If an + update is available, the respective UI is shown later from a separate + thread. + + @see win_sparkle_cleanup() + */ +WIN_SPARKLE_API void __cdecl win_sparkle_init(); + +/** + Cleans up after WinSparkle. + + Should be called by the app when it's shutting down. Cancels any + pending Sparkle operations and shuts down its helper threads. + */ +WIN_SPARKLE_API void __cdecl win_sparkle_cleanup(); + +//@} + + +/*--------------------------------------------------------------------------* + Language settings +*--------------------------------------------------------------------------*/ + +/** +@name Language settings + +These functions set user interface language. They must be called before +win_sparkle_init() to have any effect. If none of them is called, WinSparkle +detects the UI language automatically. +*/ +//@{ + +/** + Sets UI language from its ISO code. + + This function must be called before win_sparkle_init(). + + @param lang ISO 639 language code with an optional ISO 3116 country + code, e.g. "fr", "pt-PT", "pt-BR" or "pt_BR", as used + e.g. by ::GetThreadPreferredUILanguages() too. + + @since 0.5 + + @see win_sparkle_set_langid() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_lang(const char *lang); + +/** + Sets UI language from its Win32 LANGID code. + + This function must be called before win_sparkle_init(). + + @param lang Language code (LANGID) as created by the MAKELANGID macro + or returned by e.g. ::GetThreadUILanguage() + + @since 0.5 + + @see win_sparkle_set_lang() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_langid(unsigned short lang); + +//@} + +/*--------------------------------------------------------------------------* + Configuration + *--------------------------------------------------------------------------*/ + +/** + @name Configuration functions + + Functions for setting up WinSparkle. + + All functions in this category can only be called @em before the first + call to win_sparkle_init()! + + Typically, the application would configure WinSparkle on startup and then + call win_sparkle_init(), all from its main thread. + */ +//@{ + +/** + Sets URL for the app's appcast. + + Only http and https schemes are supported. + + If this function isn't called by the app, the URL is obtained from + Windows resource named "FeedURL" of type "APPCAST". + + @param url URL of the appcast. + + @note Always use HTTPS feeds, do not use unencrypted HTTP! This is + necessary to prevent both leaking user information and preventing + various MITM attacks. + + @note See https://github.com/vslavik/winsparkle/wiki/Appcast-Feeds for + more information about appcast feeds. + */ +WIN_SPARKLE_API void __cdecl win_sparkle_set_appcast_url(const char *url); + +/** + Sets DSA public key. + + Only PEM format is supported. + + Public key will be used to verify DSA signature of the update file. + PEM data will be set only if it contains valid DSA public key. + + If this function isn't called by the app, public key is obtained from + Windows resource named "DSAPub" of type "DSAPEM". + + @param dsa_pub_pem DSA public key in PEM format. + + @return 1 if valid DSA public key provided, 0 otherwise. + + @since 0.6.0 + */ +WIN_SPARKLE_API int __cdecl win_sparkle_set_dsa_pub_pem(const char *dsa_pub_pem); + +/** + Sets application metadata. + + Normally, these are taken from VERSIONINFO/StringFileInfo resources, + but if your application doesn't use them for some reason, using this + function is an alternative. + + @param company_name Company name of the vendor. + @param app_name Application name. This is both shown to the user + and used in HTTP User-Agent header. + @param app_version Version of the app, as string (e.g. "1.2" or "1.2rc1"). + + @note @a company_name and @a app_name are used to determine the location + of WinSparkle settings in registry. + (HKCU\Software\\\WinSparkle is used.) + + @since 0.3 + + @see win_sparkle_set_app_build_version(); + */ +WIN_SPARKLE_API void __cdecl win_sparkle_set_app_details(const wchar_t *company_name, + const wchar_t *app_name, + const wchar_t *app_version); + +/** + Sets application build version number. + + This is the internal version number that is not normally shown to the user. + It can be used for finer granularity that official release versions, e.g. for + interim builds. + + If this function is called, then the provided *build* number is used for comparing + versions; it is compared to the "version" attribute in the appcast and corresponds + to OS X Sparkle's CFBundleVersion handling. If used, then the appcast must + also contain the "shortVersionString" attribute with human-readable display + version string. The version passed to win_sparkle_set_app_details() + corresponds to this and is used for display. + + @since 0.4 + + @see win_sparkle_set_app_details() + */ +WIN_SPARKLE_API void __cdecl win_sparkle_set_app_build_version(const wchar_t *build); + +/** + Set custom HTTP header for appcast checks. + + @since 0.7 + + @see win_sparkle_clear_http_headers() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_http_header(const char *name, const char *value); + +/** + Clears all custom HTTP headers previously added using + win_sparkle_set_http_header(). + + @since 0.7 + + @see win_sparkle_set_http_header() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_clear_http_headers(); + +/** + Set the registry path where settings will be stored. + + Normally, these are stored in + "HKCU\Software\\\WinSparkle" + but if your application needs to store the data elsewhere for + some reason, using this function is an alternative. + + Note that @a path is relative to HKCU/HKLM root and the root is not part + of it. For example: + @code + win_sparkle_set_registry_path("Software\\My App\\Updates"); + @endcode + + @param path Registry path where settings will be stored. + + @since 0.3 + */ +WIN_SPARKLE_API void __cdecl win_sparkle_set_registry_path(const char *path); + +/// Type used to override WinSparkle configuration's read, write and delete functions +typedef struct win_sparkle_config_methods_tag { + /// Copy config value named @a name to the buffer pointed by @a buf, returns TRUE on success, FALSE on failure + int(__cdecl *config_read)(const char *name, wchar_t *buf, size_t len, void *user_data); + /// Write @a value as config value @a name 's new value + void(__cdecl *config_write)(const char *name, const wchar_t *value, void *user_data); + /// Delete config value named @a name + void(__cdecl *config_delete)(const char *name, void *user_data); + /// Arbitrary data which will be passed to the above functions, WinSparkle will not read or alter it. + void *user_data; +} win_sparkle_config_methods_t; + + +/** + Override WinSparkle's configuration read, write and delete functions. + + By default, WinSparkle will read, write and delete configuration values by + interacting directly with Windows Registry. + If you want to manage configuration by yourself, or if you don't want let WinSparkle + write settings directly to the Windows Registry, you can provide your own functions + to read, write and delete configuration. + + These functions needs to return TRUE on success, FALSE on failure. + If you passed NULL as a configuration action (read, write or delete)'s function pointer, + WinSparkle will use the default function for that action. + + @param config_methods Your own configuration read, write and delete functions. + Pass NULL to let WinSparkle continue to use its default functions. + + @note There's no guarantee about the thread from which these functions are called, + Make sure your functions are thread-safe. + + @since 0.7 +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_config_methods(win_sparkle_config_methods_t *config_methods); + +/** + Sets whether updates are checked automatically or only through a manual call. + + If disabled, win_sparkle_check_update_with_ui() must be used explicitly. + + @param state 1 to have updates checked automatically, 0 otherwise + + @since 0.4 + */ +WIN_SPARKLE_API void __cdecl win_sparkle_set_automatic_check_for_updates(int state); + +/** + Gets the automatic update checking state + + @return 1 if updates are set to be checked automatically, 0 otherwise + + @note Defaults to 0 when not yet configured (as happens on first start). + + @since 0.4 + */ +WIN_SPARKLE_API int __cdecl win_sparkle_get_automatic_check_for_updates(); + +/** + Sets the automatic update interval. + + @param interval The interval in seconds between checks for updates. + The minimum update interval is 3600 seconds (1 hour). + + @since 0.4 + */ +WIN_SPARKLE_API void __cdecl win_sparkle_set_update_check_interval(int interval); + +/** + Gets the automatic update interval in seconds. + + Default value is one day. + + @since 0.4 + */ +WIN_SPARKLE_API int __cdecl win_sparkle_get_update_check_interval(); + +/** + Gets the time for the last update check. + + Default value is -1, indicating that the update check has never run. + + @since 0.4 +*/ +WIN_SPARKLE_API time_t __cdecl win_sparkle_get_last_check_time(); + +/// Callback type for win_sparkle_error_callback() +typedef void (__cdecl *win_sparkle_error_callback_t)(); + +/** + Set callback to be called when the updater encounters an error. + + @since 0.5 +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_error_callback(win_sparkle_error_callback_t callback); + +/// Callback type for win_sparkle_can_shutdown_callback() +typedef int (__cdecl *win_sparkle_can_shutdown_callback_t)(); + +/** + Set callback for querying the application if it can be closed. + + This callback will be called to ask the host if it's ready to shut down, + before attempting to launch the installer. The callback returns TRUE if + the host application can be safely shut down or FALSE if not (e.g. because + the user has unsaved documents). + + @note There's no guarantee about the thread from which the callback is called, + except that it certainly *won't* be called from the app's main thread. + Make sure the callback is thread-safe. + + @since 0.4 + + @see win_sparkle_set_shutdown_request_callback() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_can_shutdown_callback(win_sparkle_can_shutdown_callback_t callback); + + +/// Callback type for win_sparkle_shutdown_request_callback() +typedef void (__cdecl *win_sparkle_shutdown_request_callback_t)(); + +/** + Set callback for shutting down the application. + + This callback will be called to ask the host to shut down immediately after + launching the installer. Its implementation should gracefully terminate the + application. + + It will only be called if the call to the callback set with + win_sparkle_set_can_shutdown_callback() returns TRUE. + + @note There's no guarantee about the thread from which the callback is called, + except that it certainly *won't* be called from the app's main thread. + Make sure the callback is thread-safe. + + @since 0.4 + + @see win_sparkle_set_can_shutdown_callback() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_shutdown_request_callback(win_sparkle_shutdown_request_callback_t); + +/// Callback type for win_sparkle_did_find_update_callback() +typedef void(__cdecl *win_sparkle_did_find_update_callback_t)(); + +/** + Set callback to be called when the updater did find an update. + + This is useful in combination with + win_sparkle_check_update_with_ui_and_install() as it allows you to perform + some action after WinSparkle checks for updates. + + @since 0.5 + + @see win_sparkle_did_not_find_update_callback() + @see win_sparkle_check_update_with_ui_and_install() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_did_find_update_callback(win_sparkle_did_find_update_callback_t callback); + +/// Callback type for win_sparkle_did_not_find_update_callback() +typedef void (__cdecl *win_sparkle_did_not_find_update_callback_t)(); + +/** + Set callback to be called when the updater did not find an update. + + This is useful in combination with + win_sparkle_check_update_with_ui_and_install() as it allows you to perform + some action after WinSparkle checks for updates. + + @since 0.5 + + @see win_sparkle_did_find_update_callback() + @see win_sparkle_check_update_with_ui_and_install() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_did_not_find_update_callback(win_sparkle_did_not_find_update_callback_t callback); + +/// Callback type for win_sparkle_update_cancelled_callback() +typedef void (__cdecl *win_sparkle_update_cancelled_callback_t)(); + +/** + Set callback to be called when the user cancels an update, e.g. + by closing the window, skipping an update or cancelling download. + This callback is not called when there's no update to install or an error occurs. + + This is useful in combination with + win_sparkle_check_update_with_ui_and_install() as it allows you to perform + some action when the installation is interrupted. + + @since 0.5 + + @see win_sparkle_check_update_with_ui_and_install(), win_sparkle_set_update_dismissed_callback() +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_update_cancelled_callback(win_sparkle_update_cancelled_callback_t callback); + +/// Callback type for win_sparkle_update_skipped_callback() +typedef void(__cdecl* win_sparkle_update_skipped_callback_t)(); + +/** + Set callback to be called when the user skips an update. + + This is useful in combination with + win_sparkle_check_update_with_ui() or similar as it + allows you to perform some action when the update + is skipped. + + @see win_sparkle_check_update_with_ui_and_install() + + @since 0.8 +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_update_skipped_callback(win_sparkle_update_skipped_callback_t callback); + +/// Callback type for win_sparkle_update_postponed_callback() +typedef void(__cdecl* win_sparkle_update_postponed_callback_t)(); + +/** + Set callback to be called when the user postpones an update + ( presses 'remind me later' button). + + This is useful in combination with + win_sparkle_check_update_with_ui() or similar as it + allows you to perform some action when the download + is postponed. + + @see win_sparkle_check_update_with_ui() + + @since 0.8 +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_update_postponed_callback(win_sparkle_update_postponed_callback_t callback); + +/// Callback type for win_sparkle_update_dismissed_callback() +typedef void(__cdecl* win_sparkle_update_dismissed_callback_t)(); + +/** + Set callback to be called when the user dismisses + (closes) update dialog, including when there were no updates or an error occured. + See win_sparkle_set_update_cancelled_callback() for a subtly different callback + that may be more appropriate. + + This is useful in combination with + win_sparkle_check_update_with_ui() or similar as it + allows you to perform some action when the update + dialog is closed. + + @see win_sparkle_check_update_with_ui(), win_sparkle_set_update_cancelled_callback() + + @since 0.8 +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_update_dismissed_callback(win_sparkle_update_dismissed_callback_t callback); + + +/// Callback type for win_sparkle_user_run_installer_callback() +typedef int(__cdecl* win_sparkle_user_run_installer_callback_t)(const wchar_t *); + +/** + Set callback to be called when the update payload is + downloaded and read to be executed.or handled in some + other manner. + + The callback returns: + - 1 if the file was handled by the callback + - 0 if it was not, in which case WinSparkle default handling will take place + - WINSPARKLE_RETURN_ERROR in case of an error + + @since 0.8 +*/ +WIN_SPARKLE_API void __cdecl win_sparkle_set_user_run_installer_callback(win_sparkle_user_run_installer_callback_t callback); + +//@} + + +/*--------------------------------------------------------------------------* + Manual usage + *--------------------------------------------------------------------------*/ + +/** + @name Manually using WinSparkle + */ +//@{ + +/** + Checks if an update is available, showing progress UI to the user. + + Normally, WinSparkle checks for updates on startup and only shows its UI + when it finds an update. If the application disables this behavior, it + can hook this function to "Check for updates..." menu item. + + When called, background thread is started to check for updates. A small + window is shown to let the user know the progress. If no update is found, + the user is told so. If there is an update, the usual "update available" + window is shown. + + This function returns immediately. + + @note Because this function is intended for manual, user-initiated checks + for updates, it ignores "Skip this version" even if the user checked + it previously. + + @see win_sparkle_check_update_without_ui() + */ +WIN_SPARKLE_API void __cdecl win_sparkle_check_update_with_ui(); + +/** + Checks if an update is available, showing progress UI to the user and + immediately installing the update if one is available. + + This is useful for the case when users should almost always use the + newest version of your software. When called, WinSparkle will check for + updates showing a progress UI to the user. If an update is found the update + prompt will be skipped and the update will be installed immediately. + + If your application expects to do something after checking for updates you + may wish to use win_sparkle_set_did_not_find_update_callback() and + win_sparkle_set_update_cancelled_callback(). + + @since 0.5 + + @see win_sparkle_set_did_find_update_callback() + @see win_sparkle_set_update_cancelled_callback() + */ +WIN_SPARKLE_API void __cdecl win_sparkle_check_update_with_ui_and_install(); + +/** + Checks if an update is available. + + No progress UI is shown to the user when checking. If an update is + available, the usual "update available" window is shown; this function + is *not* completely UI-less. + + Use with caution, it usually makes more sense to use the automatic update + checks on interval option or manual check with visible UI. + + This function returns immediately. + + @note This function respects "Skip this version" choice by the user. + + @since 0.4 + + @see win_sparkle_check_update_with_ui() + */ +WIN_SPARKLE_API void __cdecl win_sparkle_check_update_without_ui(); + +//@} + +#ifdef __cplusplus +} +#endif + +#endif // _winsparkle_h_ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.dll b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.dll new file mode 100644 index 0000000..f4dc887 Binary files /dev/null and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.dll differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.lib b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.lib similarity index 94% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.lib rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.lib index 99bcf25..3c4718a 100644 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.lib and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.lib differ diff --git a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.pdb b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.pdb similarity index 57% rename from packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.pdb rename to packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.pdb index 17c48c2..7640db3 100644 Binary files a/packages/auto_updater_windows/windows/WinSparkle-0.8.1/x64/Release/WinSparkle.pdb and b/packages/auto_updater_windows/windows/WinSparkle-0.8.3/x64/Release/WinSparkle.pdb differ diff --git a/packages/auto_updater_windows/windows/auto_updater.cpp b/packages/auto_updater_windows/windows/auto_updater.cpp index d5ea5f3..7880eeb 100644 --- a/packages/auto_updater_windows/windows/auto_updater.cpp +++ b/packages/auto_updater_windows/windows/auto_updater.cpp @@ -1,4 +1,4 @@ -#include "WinSparkle-0.8.1/include/winsparkle.h" +#include "WinSparkle-0.8.3/include/winsparkle.h" #include #include @@ -32,6 +32,7 @@ class AutoUpdater { void AutoUpdater::CheckForUpdates(); void AutoUpdater::CheckForUpdatesWithoutUI(); void AutoUpdater::SetScheduledCheckInterval(int interval); + void AutoUpdater::Cleanup(); void AutoUpdater::RegisterEventSink( std::unique_ptr> ptr); @@ -67,12 +68,9 @@ void AutoUpdater::SetFeedURL(std::string feedURL) { win_sparkle_set_did_find_update_callback(__onDidFindUpdateCallback); win_sparkle_set_did_not_find_update_callback(__onDidNotFindUpdateCallback); win_sparkle_set_update_cancelled_callback(__onUpdateCancelledCallback); - - // TODO: These will be supported once we update WinSparkle to >0.8.0 - // win_sparkle_set_update_skipped_callback(__onUpdateSkippedCallback); - // win_sparkle_set_update_postponed_callback(__onUpdatePostponedCallback); - // win_sparkle_set_update_dismissed_callback(__onUpdateDismissedCallback); - // win_sparkle_set_user_run_installer_callback(__onUserRunInstallerCallback); + win_sparkle_set_update_skipped_callback(__onUpdateSkippedCallback); + win_sparkle_set_update_postponed_callback(__onUpdatePostponedCallback); + win_sparkle_set_update_dismissed_callback(__onUpdateDismissedCallback); } void AutoUpdater::CheckForUpdates() { @@ -89,6 +87,10 @@ void AutoUpdater::SetScheduledCheckInterval(int interval) { win_sparkle_set_update_check_interval(interval); } +void AutoUpdater::Cleanup() { + win_sparkle_cleanup(); +} + void AutoUpdater::RegisterEventSink( std::unique_ptr> ptr) { event_sink_ = std::move(ptr); @@ -136,34 +138,34 @@ void __onUpdateCancelledCallback() { AutoUpdater* autoUpdater = AutoUpdater::GetInstance(); if (autoUpdater == nullptr) return; - autoUpdater->OnWinSparkleEvent("updateCancelled"); + autoUpdater->OnWinSparkleEvent("update-cancelled"); } void __onUpdateSkippedCallback() { AutoUpdater* autoUpdater = AutoUpdater::GetInstance(); if (autoUpdater == nullptr) return; - autoUpdater->OnWinSparkleEvent("updateSkipped"); + autoUpdater->OnWinSparkleEvent("update-skipped"); } void __onUpdatePostponedCallback() { AutoUpdater* autoUpdater = AutoUpdater::GetInstance(); if (autoUpdater == nullptr) return; - autoUpdater->OnWinSparkleEvent("updatePostponed"); + autoUpdater->OnWinSparkleEvent("update-postponed"); } void __onUpdateDismissedCallback() { AutoUpdater* autoUpdater = AutoUpdater::GetInstance(); if (autoUpdater == nullptr) return; - autoUpdater->OnWinSparkleEvent("updateDismissed"); + autoUpdater->OnWinSparkleEvent("update-dismissed"); } void __onUserRunInstallerCallback() { AutoUpdater* autoUpdater = AutoUpdater::GetInstance(); if (autoUpdater == nullptr) return; - autoUpdater->OnWinSparkleEvent("userRunInstaller"); + autoUpdater->OnWinSparkleEvent("user-run-installer"); } } // namespace diff --git a/packages/auto_updater_windows/windows/auto_updater_windows_plugin.cpp b/packages/auto_updater_windows/windows/auto_updater_windows_plugin.cpp index 593eec3..47e3295 100644 --- a/packages/auto_updater_windows/windows/auto_updater_windows_plugin.cpp +++ b/packages/auto_updater_windows/windows/auto_updater_windows_plugin.cpp @@ -86,8 +86,19 @@ void AutoUpdaterWindowsPlugin::HandleMethodCall( auto_updater.SetScheduledCheckInterval(interval); result->Success(flutter::EncodableValue(true)); + } else if (method_name.compare("checkForUpdateInformation") == 0) { + const flutter::EncodableMap& args = + std::get(*method_call.arguments()); + auto_updater.CheckForUpdatesWithoutUI(); + result->Success(flutter::EncodableValue(true)); + + } else if (method_name.compare("cleanup") == 0) { + auto_updater.Cleanup(); + result->Success(flutter::EncodableValue(true)); + } else { result->NotImplemented(); + } }