Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TestWorkspaceService {
Future<void> setUp() async {
final inputStream =
InputFileStream(await workspace.zip.then((value) => value.path));
final archive = ZipDecoder().decodeBuffer(inputStream);
final archive = ZipDecoder().decodeBytes(inputStream.file.buffer);
await extractArchiveToDisk(
archive,
await TestWorkspace._parent.then((value) => value.path),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Future<String> customDocumentToMarkdown(
/// create root Archive and directory
final id = document.root.id,
archive = Archive(),
resourceDir = ArchiveFile('$id/', 0, null)..isFile = false,
resourceDir = ArchiveFile('$id/', 0, [])..isFile = false,
fileName = p.basenameWithoutExtension(path),
dirName = resourceDir.name;

Expand Down Expand Up @@ -78,7 +78,7 @@ Future<String> customDocumentToMarkdown(
if (onArchive == null) {
final zipEncoder = ZipEncoder();
final zip = zipEncoder.encode(archive);
if (zip != null) {
if (zip.isNotEmpty) {
final zipFile = await File(path).writeAsBytes(zip);
if (Platform.isIOS) {
await Share.shareUri(zipFile.uri);
Expand Down
4 changes: 2 additions & 2 deletions frontend/appflowy_flutter/lib/startup/startup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ class FlowyRunner {

// localization
const InitLocalizationTask(),
// init the app window
InitAppWindowTask(),
// Init Rust SDK
InitRustSDKTask(customApplicationPath: applicationDataDirectory),
// Load Plugins, like document, grid ...
const PluginLoadTask(),
const FileStorageTask(),
// init the app window
InitAppWindowTask(),

// init the app widget
// ignore in test mode
Expand Down
6 changes: 6 additions & 0 deletions frontend/appflowy_flutter/lib/startup/tasks/windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:scaled_app/scaled_app.dart';
import 'package:window_manager/window_manager.dart';
import 'package:universal_platform/universal_platform.dart';
import 'package:native_splash_screen/native_splash_screen.dart' as nss;

class InitAppWindowTask extends LaunchTask with WindowListener {
InitAppWindowTask({this.title = 'AppFlowy'});
Expand Down Expand Up @@ -61,6 +62,8 @@ class InitAppWindowTask extends LaunchTask with WindowListener {
appWindow.position = position;
}

await nss.close(animation: nss.CloseAnimation.fade);

/// on Windows we maximize the window if it was previously closed
/// from a maximized state.
final isMaximized = await windowSizeManager.getWindowMaximized();
Expand All @@ -72,6 +75,9 @@ class InitAppWindowTask extends LaunchTask with WindowListener {
await windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
if (UniversalPlatform.isLinux || UniversalPlatform.isMacOS) {
await nss.close(animation: nss.CloseAnimation.fade);
}

if (position != null) {
await windowManager.setPosition(position);
Expand Down
2 changes: 1 addition & 1 deletion frontend/appflowy_flutter/lib/util/share_log_files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Future<void> shareLogFiles(BuildContext? context) async {
}

final zip = zipEncoder.encode(archive);
if (zip == null) {
if (zip.isNotEmpty) {
if (context != null && context.mounted) {
showToastNotification(
message: LocaleKeys.noLogFiles.tr(),
Expand Down
3 changes: 3 additions & 0 deletions frontend/appflowy_flutter/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)

add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")

# Include splash screen library configuration
include("${CMAKE_CURRENT_SOURCE_DIR}/runner/native_splash_screen.cmake")

# Application build
add_executable(${BINARY_NAME}
"main.cc"
Expand Down
13 changes: 11 additions & 2 deletions frontend/appflowy_flutter/linux/main.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#include <native_splash_screen_linux/native_splash_screen_linux_plugin.h>
#include "my_application.h"


int main(int argc, char** argv) {
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
// Initialize GTK first
gtk_init(&argc, &argv);

// So can safely show the splash screen first.
show_splash_screen();

// Then initialize and run the application as normal
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}
2 changes: 1 addition & 1 deletion frontend/appflowy_flutter/linux/my_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static void my_application_activate(GApplication *application)
gtk_window_set_title(window, "AppFlowy");

gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
gtk_widget_realize(GTK_WIDGET(window));

g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
Expand Down
48 changes: 48 additions & 0 deletions frontend/appflowy_flutter/linux/runner/native_splash_screen.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Generated file - do not edit
# Generated by native_splash_screen_cli

# Determine splash screen files for different build types
set(SPLASH_SCREEN_FILE_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/runner/native_splash_screen_debug.cc")
set(SPLASH_SCREEN_FILE_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/runner/native_splash_screen_release.cc")
set(SPLASH_SCREEN_FILE_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/runner/native_splash_screen_profile.cc")

# Validate that all expected files exist
foreach(CONFIG_TYPE IN ITEMS DEBUG RELEASE PROFILE)
string(TOLOWER "${CONFIG_TYPE}" CONFIG_TYPE_LOWER)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/runner/native_splash_screen_${CONFIG_TYPE_LOWER}.cc")
message(FATAL_ERROR
"\n-------------------------------------------------------------\n"
"Missing splash screen configuration for ${CONFIG_TYPE} mode:\n"
"${CMAKE_CURRENT_SOURCE_DIR}/runner/native_splash_screen_${CONFIG_TYPE_LOWER}.cc\n\n"
"Please run the following command in your project root:\n"
" dart run native_splash_screen_cli gen\n"
"This will generate all necessary configuration files.\n"
"-------------------------------------------------------------\n")
endif()
endforeach()

# Create a static library for the splash screen code
add_library(native_splash_screen_linux STATIC "")

# Dynamically select the correct splash screen source file per config
target_sources(native_splash_screen_linux
PRIVATE
"$<IF:$<CONFIG:Debug>,${SPLASH_SCREEN_FILE_DEBUG},$<IF:$<CONFIG:Profile>,${SPLASH_SCREEN_FILE_PROFILE},${SPLASH_SCREEN_FILE_RELEASE}>>"
)

# Set properties for the library
set_target_properties(native_splash_screen_linux PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
POSITION_INDEPENDENT_CODE ON
)

# Include directories
target_include_directories(native_splash_screen_linux PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
)

# Warn if CMAKE_BUILD_TYPE is unset in single-config environments
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
message(WARNING "CMAKE_BUILD_TYPE not set. Defaulting to Release splash screen.")
endif()
Loading