Skip to content

Commit 927a083

Browse files
committed
chore: Add auto_updater_windows package
1 parent 97a5e46 commit 927a083

37 files changed

+617
-199
lines changed

.vscode/c_cpp_properties.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"${workspaceFolder}/**"
7+
],
8+
"defines": [
9+
"_DEBUG",
10+
"UNICODE",
11+
"_UNICODE"
12+
],
13+
"windowsSdkVersion": "10.0.22000.0",
14+
"compilerPath": "cl.exe",
15+
"cStandard": "c17",
16+
"cppStandard": "c++17",
17+
"intelliSenseMode": "windows-msvc-x64"
18+
}
19+
],
20+
"version": 4
21+
}

.vscode/settings.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"files.associations": {
3+
"algorithm": "cpp",
4+
"array": "cpp",
5+
"atomic": "cpp",
6+
"bit": "cpp",
7+
"cctype": "cpp",
8+
"charconv": "cpp",
9+
"chrono": "cpp",
10+
"clocale": "cpp",
11+
"cmath": "cpp",
12+
"codecvt": "cpp",
13+
"compare": "cpp",
14+
"concepts": "cpp",
15+
"cstddef": "cpp",
16+
"cstdint": "cpp",
17+
"cstdio": "cpp",
18+
"cstdlib": "cpp",
19+
"cstring": "cpp",
20+
"ctime": "cpp",
21+
"cwchar": "cpp",
22+
"exception": "cpp",
23+
"format": "cpp",
24+
"forward_list": "cpp",
25+
"functional": "cpp",
26+
"initializer_list": "cpp",
27+
"iomanip": "cpp",
28+
"ios": "cpp",
29+
"iosfwd": "cpp",
30+
"iostream": "cpp",
31+
"istream": "cpp",
32+
"iterator": "cpp",
33+
"limits": "cpp",
34+
"list": "cpp",
35+
"locale": "cpp",
36+
"map": "cpp",
37+
"memory": "cpp",
38+
"new": "cpp",
39+
"optional": "cpp",
40+
"ostream": "cpp",
41+
"ratio": "cpp",
42+
"set": "cpp",
43+
"sstream": "cpp",
44+
"stdexcept": "cpp",
45+
"streambuf": "cpp",
46+
"string": "cpp",
47+
"system_error": "cpp",
48+
"tuple": "cpp",
49+
"type_traits": "cpp",
50+
"typeinfo": "cpp",
51+
"unordered_map": "cpp",
52+
"utility": "cpp",
53+
"variant": "cpp",
54+
"vector": "cpp",
55+
"xfacet": "cpp",
56+
"xhash": "cpp",
57+
"xiosbase": "cpp",
58+
"xlocale": "cpp",
59+
"xlocbuf": "cpp",
60+
"xlocinfo": "cpp",
61+
"xlocmes": "cpp",
62+
"xlocmon": "cpp",
63+
"xlocnum": "cpp",
64+
"xloctime": "cpp",
65+
"xmemory": "cpp",
66+
"xstddef": "cpp",
67+
"xstring": "cpp",
68+
"xtr1common": "cpp",
69+
"xtree": "cpp",
70+
"xutility": "cpp",
71+
"any": "cpp"
72+
}
73+
}

packages/auto_updater/example/windows/flutter/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
1010
# https://github.com/flutter/flutter/issues/57146.
1111
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
1212

13+
# Set fallback configurations for older versions of the flutter tool.
14+
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
15+
set(FLUTTER_TARGET_PLATFORM "windows-x64")
16+
endif()
17+
1318
# === Flutter Library ===
1419
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
1520

@@ -92,7 +97,7 @@ add_custom_command(
9297
COMMAND ${CMAKE_COMMAND} -E env
9398
${FLUTTER_TOOL_ENVIRONMENT}
9499
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95-
windows-x64 $<CONFIG>
100+
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
96101
VERBATIM
97102
)
98103
add_custom_target(flutter_assemble DEPENDS

packages/auto_updater/example/windows/flutter/generated_plugin_registrant.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
#include "generated_plugin_registrant.h"
88

9-
#include <auto_updater/auto_updater_plugin.h>
9+
#include <auto_updater_windows/auto_updater_windows_plugin_c_api.h>
1010
#include <screen_retriever/screen_retriever_plugin.h>
1111
#include <window_manager/window_manager_plugin.h>
1212

1313
void RegisterPlugins(flutter::PluginRegistry* registry) {
14-
AutoUpdaterPluginRegisterWithRegistrar(
15-
registry->GetRegistrarForPlugin("AutoUpdaterPlugin"));
14+
AutoUpdaterWindowsPluginCApiRegisterWithRegistrar(
15+
registry->GetRegistrarForPlugin("AutoUpdaterWindowsPluginCApi"));
1616
ScreenRetrieverPluginRegisterWithRegistrar(
1717
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
1818
WindowManagerPluginRegisterWithRegistrar(

packages/auto_updater/example/windows/flutter/generated_plugins.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
list(APPEND FLUTTER_PLUGIN_LIST
6-
auto_updater
6+
auto_updater_windows
77
screen_retriever
88
window_manager
99
)

packages/auto_updater/example/windows/runner/flutter_window.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() {
3131
this->Show();
3232
});
3333

34+
// Flutter can complete the first frame before the "show window" callback is
35+
// registered. The following call ensures a frame is pending to ensure the
36+
// window is shown. It is a no-op if the first frame hasn't completed yet.
37+
flutter_controller_->ForceRedraw();
38+
3439
return true;
3540
}
3641

packages/auto_updater/lib/src/auto_updater.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class AutoUpdater {
1818
final List<UpdaterListener> _listeners = [];
1919

2020
void _handleSparkleEvents(event) {
21+
print(event);
2122
UpdaterError? updaterError;
2223
Appcast? appcast;
2324
AppcastItem? appcastItem;
@@ -26,7 +27,6 @@ class AutoUpdater {
2627
Map<Object?, Object?>? data;
2728
if (event['data'] != null) {
2829
data = event['data'] as Map;
29-
3030
if (data['error'] != null) {
3131
updaterError = UpdaterError(
3232
data['error'].toString(),
@@ -50,7 +50,7 @@ class AutoUpdater {
5050
for (var listener in _listeners) {
5151
switch (type) {
5252
case 'error':
53-
listener.onUpdaterError(updaterError!);
53+
listener.onUpdaterError(updaterError);
5454
break;
5555
case 'checking-for-update':
5656
listener.onUpdaterCheckingForUpdate(appcast);

packages/auto_updater/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ environment:
1717
dependencies:
1818
auto_updater_macos: ^0.2.0
1919
auto_updater_platform_interface: ^0.2.0
20+
auto_updater_windows: ^0.2.0
2021
flutter:
2122
sdk: flutter
2223
json_annotation: ^4.8.0

packages/auto_updater/windows/CMakeLists.txt

Lines changed: 0 additions & 33 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)