diff --git a/.gitignore b/.gitignore index 97360a2..c559c9e 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,7 @@ story-player/storyvm/build/ story-player-sdl/build/ story-player-raylib/build/ + +story-player/linux/flutter/generated_plugin_registrant.cc + +story-player/linux/flutter/generated_plugins.cmake diff --git a/.vscode/launch.json b/.vscode/launch.json index 2290ea5..0dec3ed 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,14 @@ // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "name": "Flutter (debug)", + "type": "dart", + "request": "launch", + "program": "lib/main.dart", + "flutterMode": "debug", + "cwd": "${workspaceFolder}/story-player" + }, { "name": "Debug Story Editor (GDB)", "type": "cppdbg", diff --git a/docs/player-dev.md b/docs/player-dev.md index 0798775..193ed05 100644 --- a/docs/player-dev.md +++ b/docs/player-dev.md @@ -8,14 +8,23 @@ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev # Environment variables +``` +export PATH=$PATH:/home/anthony/development/flutter +export ANDROID_HOME=/mnt/work/android-sdk +export PATH=$PATH:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools +``` # Build for Linux flutter build linux -# Build for Android +# Build and run for Android flutter build apk + +adb devices +adb -s emulator-5554 install -r build/app/outputs/flutter-apk/app-release.apk +adb push stories /storage/emulated/0/Download/ diff --git a/story-editor/CMakeLists.txt b/story-editor/CMakeLists.txt index 1fc4748..322e3e3 100644 --- a/story-editor/CMakeLists.txt +++ b/story-editor/CMakeLists.txt @@ -132,10 +132,10 @@ include_directories(${sdl3_SOURCE_DIR}/include) FetchContent_Declare( sdl3_mixer GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer.git - GIT_TAG origin/main - GIT_SHALLOW TRUE - GIT_PROGRESS TRUE - GIT_SUBMODULES "" + GIT_TAG cc78718f6e87354fee8ffe4dc516a20f608c2d65 + # GIT_SHALLOW TRUE + # GIT_PROGRESS TRUE + # GIT_SUBMODULES "" ) set(BUILD_SHARED_LIBS TRUE) @@ -151,10 +151,9 @@ include_directories(${sdl3_mixer_SOURCE_DIR}/include) FetchContent_Declare( sdl_image GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git - GIT_TAG origin/main - GIT_SHALLOW TRUE + GIT_TAG ff62eb68aebe9801f06695c86a67292c6f166b16 GIT_PROGRESS TRUE -) +) set(SDL3IMAGE_INSTALL OFF) diff --git a/story-player/android/app/build.gradle b/story-player/android/app/build.gradle index e1da9c7..cc53734 100644 --- a/story-player/android/app/build.gradle +++ b/story-player/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,9 +22,6 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { namespace "org.openstoryteller.story_player" @@ -43,15 +41,20 @@ android { main.java.srcDirs += 'src/main/kotlin' } + lintOptions { + checkReleaseBuilds false + } + defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "org.openstoryteller.story_player" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + maxSdkVersion 23 + targetSdkVersion 23 + versionCode 2 + versionName "1.1.0" } buildTypes { @@ -73,6 +76,5 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} + diff --git a/story-player/android/app/src/main/AndroidManifest.xml b/story-player/android/app/src/main/AndroidManifest.xml index e6c7ac5..4d246bc 100644 --- a/story-player/android/app/src/main/AndroidManifest.xml +++ b/story-player/android/app/src/main/AndroidManifest.xml @@ -5,6 +5,9 @@ + + + diff --git a/story-player/android/build.gradle b/story-player/android/build.gradle index f7eb7f6..1e73c4f 100644 --- a/story-player/android/build.gradle +++ b/story-player/android/build.gradle @@ -1,15 +1,3 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} allprojects { repositories { diff --git a/story-player/android/settings.gradle b/story-player/android/settings.gradle index 44e62bc..a7fce79 100644 --- a/story-player/android/settings.gradle +++ b/story-player/android/settings.gradle @@ -1,11 +1,26 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + // includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false +} + +include ":app" \ No newline at end of file diff --git a/story-player/assets/320x240.png b/story-player/assets/320x240.png deleted file mode 100644 index 240eff5..0000000 Binary files a/story-player/assets/320x240.png and /dev/null differ diff --git a/story-player/assets/logo.png b/story-player/assets/logo.png new file mode 100644 index 0000000..2f44da5 Binary files /dev/null and b/story-player/assets/logo.png differ diff --git a/story-player/lib/libstory/indexfile.dart b/story-player/lib/libstory/indexfile.dart index 0ab5cb5..4b21c81 100644 --- a/story-player/lib/libstory/indexfile.dart +++ b/story-player/lib/libstory/indexfile.dart @@ -121,16 +121,17 @@ class IndexFile { String indexFileName = '$libraryRoot/index.ost'; - bool isGranted = true; + bool isGranted = false; - // if (Platform.isAndroid) { - - // if (await Permission.manageExternalStorage.request().isGranted) { - // isGranted = true; - // } - // } else { - // isGranted = true; - // } + if (Platform.isAndroid) { + if (await Permission.storage.request().isGranted) { + if (await Permission.manageExternalStorage.request().isGranted) { + isGranted = true; + } + } + } else { + isGranted = true; + } if (isGranted) { final file = File(indexFileName); diff --git a/story-player/lib/main.dart b/story-player/lib/main.dart index 939f82a..cd1304a 100644 --- a/story-player/lib/main.dart +++ b/story-player/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart' hide Router; +import 'package:path/path.dart'; import 'dart:io'; import 'dart:convert'; @@ -98,18 +99,14 @@ enum PlayerState { disabled, indexFile, inStory } class _MyHomePageState extends State { String myPath = 'fffff'; IndexFile indexFile = IndexFile(); - String currentImage = 'assets/320x240.png'; + String currentImage = 'assets/logo.png'; final player = AudioPlayer(); StreamSubscription? mediaPub; PlayerState state = PlayerState.disabled; StreamSubscription? audioPlayerSub; - Image img = const Image(image: AssetImage('assets/320x240.png')); + Image img = const Image(image: AssetImage('assets/logo.png')); - // final Permission _permission = Permission.storage; - PermissionStatus _permissionStatus = PermissionStatus.denied; - - var _openResult = 'Unknown'; void initPaths() async { Directory? dir; @@ -221,7 +218,10 @@ class _MyHomePageState extends State { ); }).toList(); }, + ), + const Divider() + , const Text("v1.1") ], ), body: Center( diff --git a/story-player/linux/flutter/generated_plugin_registrant.cc b/story-player/linux/flutter/generated_plugin_registrant.cc deleted file mode 100644 index e71a16d..0000000 --- a/story-player/linux/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,11 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - - -void fl_register_plugins(FlPluginRegistry* registry) { -} diff --git a/story-player/linux/flutter/generated_plugins.cmake b/story-player/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87..0000000 --- a/story-player/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/story-player/linux/my_application.cc b/story-player/linux/my_application.cc index bf8eca2..874d97e 100644 --- a/story-player/linux/my_application.cc +++ b/story-player/linux/my_application.cc @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) { if (use_header_bar) { GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "flutter_launcher"); + gtk_header_bar_set_title(header_bar, "Story Player"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); } else { - gtk_window_set_title(window, "flutter_launcher"); + gtk_window_set_title(window, "Story Player"); } gtk_window_set_default_size(window, 1280, 720); diff --git a/story-player/pubspec.yaml b/story-player/pubspec.yaml index 3f67bca..fd016de 100644 --- a/story-player/pubspec.yaml +++ b/story-player/pubspec.yaml @@ -103,5 +103,5 @@ flutter: # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages assets: - - assets/320x240.png + - assets/logo.png \ No newline at end of file