Skip to content

Commit 063ec18

Browse files
LucasXu0vedon
andauthored
Rename project and upgrade windows project (#2072)
* chore: rename product name * chore: upgrade windows project to latest template --------- Co-authored-by: vedon <[email protected]>
1 parent ec444d4 commit 063ec18

File tree

13 files changed

+120
-65
lines changed

13 files changed

+120
-65
lines changed
Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: fa5883b78e566877613ad1ccb48dd92075cb5c23
8-
channel: dev
7+
revision: 135454af32477f815a7525073027a3ff9eff1bfd
8+
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
17+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
18+
- platform: windows
19+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
20+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

frontend/appflowy_flutter/linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.10)
22
project(runner LANGUAGES CXX)
33

4-
set(BINARY_NAME "appflowy_flutter")
4+
set(BINARY_NAME "AppFlowy")
55
set(APPLICATION_ID "io.appflowy.appflowy")
66

77
cmake_policy(SET CMP0063 NEW)

frontend/appflowy_flutter/linux/appflowy.desktop.temp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Name=AppFlowy
33
Comment=An Open Source Alternative to Notion
44
Icon=[CHANGE_THIS]/AppFlowy/flowy_logo.svg
5-
Exec=[CHANGE_THIS]/AppFlowy/appflowy_flutter
5+
Exec=[CHANGE_THIS]/AppFlowy/AppFlowy
66
Categories=Office
77
Type=Application
88
Terminal=false

frontend/appflowy_flutter/linux/my_application.cc

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77

88
#include "flutter/generated_plugin_registrant.h"
99

10-
struct _MyApplication {
10+
struct _MyApplication
11+
{
1112
GtkApplication parent_instance;
12-
char** dart_entrypoint_arguments;
13+
char **dart_entrypoint_arguments;
1314
};
1415

1516
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
1617

1718
// Implements GApplication::activate.
18-
static void my_application_activate(GApplication* application) {
19-
MyApplication* self = MY_APPLICATION(application);
20-
GtkWindow* window =
19+
static void my_application_activate(GApplication *application)
20+
{
21+
MyApplication *self = MY_APPLICATION(application);
22+
GtkWindow *window =
2123
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
2224

2325
// Use a header bar when running in GNOME as this is the common style used
@@ -29,22 +31,27 @@ static void my_application_activate(GApplication* application) {
2931
// if future cases occur).
3032
gboolean use_header_bar = TRUE;
3133
#ifdef GDK_WINDOWING_X11
32-
GdkScreen* screen = gtk_window_get_screen(window);
33-
if (GDK_IS_X11_SCREEN(screen)) {
34-
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35-
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
34+
GdkScreen *screen = gtk_window_get_screen(window);
35+
if (GDK_IS_X11_SCREEN(screen))
36+
{
37+
const gchar *wm_name = gdk_x11_screen_get_window_manager_name(screen);
38+
if (g_strcmp0(wm_name, "GNOME Shell") != 0)
39+
{
3640
use_header_bar = FALSE;
3741
}
3842
}
3943
#endif
40-
if (use_header_bar) {
41-
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
44+
if (use_header_bar)
45+
{
46+
GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
4247
gtk_widget_show(GTK_WIDGET(header_bar));
43-
gtk_header_bar_set_title(header_bar, "appflowy_flutter");
48+
gtk_header_bar_set_title(header_bar, "AppFlowy");
4449
gtk_header_bar_set_show_close_button(header_bar, TRUE);
4550
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46-
} else {
47-
gtk_window_set_title(window, "appflowy_flutter");
51+
}
52+
else
53+
{
54+
gtk_window_set_title(window, "AppFlowy");
4855
}
4956

5057
gtk_window_set_default_size(window, 1280, 720);
@@ -53,7 +60,7 @@ static void my_application_activate(GApplication* application) {
5360
g_autoptr(FlDartProject) project = fl_dart_project_new();
5461
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
5562

56-
FlView* view = fl_view_new(project);
63+
FlView *view = fl_view_new(project);
5764
gtk_widget_show(GTK_WIDGET(view));
5865
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
5966

@@ -63,16 +70,18 @@ static void my_application_activate(GApplication* application) {
6370
}
6471

6572
// Implements GApplication::local_command_line.
66-
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67-
MyApplication* self = MY_APPLICATION(application);
73+
static gboolean my_application_local_command_line(GApplication *application, gchar ***arguments, int *exit_status)
74+
{
75+
MyApplication *self = MY_APPLICATION(application);
6876
// Strip out the first argument as it is the binary name.
6977
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
7078

7179
g_autoptr(GError) error = nullptr;
72-
if (!g_application_register(application, nullptr, &error)) {
73-
g_warning("Failed to register: %s", error->message);
74-
*exit_status = 1;
75-
return TRUE;
80+
if (!g_application_register(application, nullptr, &error))
81+
{
82+
g_warning("Failed to register: %s", error->message);
83+
*exit_status = 1;
84+
return TRUE;
7685
}
7786

7887
g_application_activate(application);
@@ -82,21 +91,24 @@ static gboolean my_application_local_command_line(GApplication* application, gch
8291
}
8392

8493
// Implements GObject::dispose.
85-
static void my_application_dispose(GObject* object) {
86-
MyApplication* self = MY_APPLICATION(object);
94+
static void my_application_dispose(GObject *object)
95+
{
96+
MyApplication *self = MY_APPLICATION(object);
8797
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
8898
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
8999
}
90100

91-
static void my_application_class_init(MyApplicationClass* klass) {
101+
static void my_application_class_init(MyApplicationClass *klass)
102+
{
92103
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93104
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
94105
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95106
}
96107

97-
static void my_application_init(MyApplication* self) {}
108+
static void my_application_init(MyApplication *self) {}
98109

99-
MyApplication* my_application_new() {
110+
MyApplication *my_application_new()
111+
{
100112
return MY_APPLICATION(g_object_new(my_application_get_type(),
101113
"application-id", APPLICATION_ID,
102114
"flags", G_APPLICATION_NON_UNIQUE,

frontend/appflowy_flutter/macos/Runner/Configs/AppInfo.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// 'flutter create' template.
66

77
// The application's name. By default this is also the title of the Flutter window.
8-
PRODUCT_NAME = appflowy_flutter
8+
PRODUCT_NAME = AppFlowy
99

1010
// The application's bundle identifier
1111
PRODUCT_BUNDLE_IDENTIFIER = io.appflowy.appflowy

frontend/appflowy_flutter/windows/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(appflowy_flutter LANGUAGES CXX)
33

4-
set(BINARY_NAME "appflowy_flutter")
4+
set(BINARY_NAME "AppFlowy")
55

66
cmake_policy(SET CMP0063 NEW)
77

88
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
99

1010
# Configure build options.
1111
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
12+
1213
if(IS_MULTICONFIG)
1314
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
1415
CACHE STRING "" FORCE)
@@ -50,14 +51,15 @@ add_subdirectory("runner")
5051
# them to the application.
5152
include(flutter/generated_plugins.cmake)
5253

53-
5454
# === Installation ===
5555
# Support files are copied into place next to the executable, so that it can
5656
# run in place. This is done instead of making a separate bundle (as on Linux)
5757
# so that building and running from within Visual Studio will work.
5858
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
59+
5960
# Make the "install" step default, as it's required to run.
6061
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
62+
6163
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
6264
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
6365
endif()
Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(runner LANGUAGES CXX)
33

4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
49
add_executable(${BINARY_NAME} WIN32
510
"flutter_window.cpp"
611
"main.cpp"
@@ -10,13 +15,25 @@ add_executable(${BINARY_NAME} WIN32
1015
"Runner.rc"
1116
"runner.exe.manifest"
1217
)
18+
19+
# Apply the standard set of build settings. This can be removed for applications
20+
# that need different build settings.
1321
apply_standard_settings(${BINARY_NAME})
22+
23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
30+
# Disable Windows macros that collide with C++ standard library functions.
1431
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32+
33+
# Add dependency libraries and include directories. Add any application-specific
34+
# dependencies here.
1535
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
1636
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
17-
add_dependencies(${BINARY_NAME} flutter_assemble)
18-
1937

20-
# === Flutter Library ===
21-
#set(DART_FFI "${CMAKE_CURRENT_SOURCE_DIR}/dart_ffi/dart_ffi.dll")
22-
#set(DART_FFI ${DART_FFI} PARENT_SCOPE)
38+
# Run the Flutter tool portions of the build. This must not be removed.
39+
add_dependencies(${BINARY_NAME} flutter_assemble)

frontend/appflowy_flutter/windows/runner/Runner.rc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif
@@ -89,13 +89,13 @@ BEGIN
8989
BEGIN
9090
BLOCK "040904e4"
9191
BEGIN
92-
VALUE "CompanyName", "AppFlowy.IO" "\0"
92+
VALUE "CompanyName", "io.appflowy" "\0"
9393
VALUE "FileDescription", "AppFlowy" "\0"
9494
VALUE "FileVersion", VERSION_AS_STRING "\0"
95-
VALUE "InternalName", "appflowy_flutter" "\0"
96-
VALUE "LegalCopyright", "Copyright (C) 2023 AppFlowy.IO. All rights reserved." "\0"
97-
VALUE "OriginalFilename", "appflowy_flutter.exe" "\0"
98-
VALUE "ProductName", "appflowy_flutter" "\0"
95+
VALUE "InternalName", "AppFlowy" "\0"
96+
VALUE "LegalCopyright", "Copyright (C) 2023 io.appflowy. All rights reserved." "\0"
97+
VALUE "OriginalFilename", "AppFlowy.exe" "\0"
98+
VALUE "ProductName", "AppFlowy" "\0"
9999
VALUE "ProductVersion", VERSION_AS_STRING "\0"
100100
END
101101
END

frontend/appflowy_flutter/windows/runner/main.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
#include "utils.h"
77

88
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9-
_In_ wchar_t *command_line, _In_ int show_command) {
9+
_In_ wchar_t *command_line, _In_ int show_command)
10+
{
1011
// Attach to console when present (e.g., 'flutter run') or create a
1112
// new console when running with a debugger.
12-
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13+
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent())
14+
{
1315
CreateAndAttachConsole();
1416
}
1517

@@ -27,13 +29,15 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
2729
FlutterWindow window(project);
2830
Win32Window::Point origin(10, 10);
2931
Win32Window::Size size(1280, 720);
30-
if (!window.CreateAndShow(L"appflowy_flutter", origin, size)) {
32+
if (!window.CreateAndShow(L"AppFlowy", origin, size))
33+
{
3134
return EXIT_FAILURE;
3235
}
3336
window.SetQuitOnClose(true);
3437

3538
::MSG msg;
36-
while (::GetMessage(&msg, nullptr, 0, 0)) {
39+
while (::GetMessage(&msg, nullptr, 0, 0))
40+
{
3741
::TranslateMessage(&msg);
3842
::DispatchMessage(&msg);
3943
}

frontend/scripts/flatpack-buildfiles/io.appflowy.AppFlowy.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
Type=Application
33
Name=AppFlowy
44
Icon=io.appflowy.AppFlowy
5-
Exec=env GDK_GL=gles appflowy_flutter %U
5+
Exec=env GDK_GL=gles AppFlowy %U
66
Categories=Network;Productivity;
77
Keywords=Notes

0 commit comments

Comments
 (0)