From 35e29709c3cd0de71b34883c0ffa635a049f8bf6 Mon Sep 17 00:00:00 2001 From: RblSb Date: Tue, 29 Oct 2024 22:52:24 +0300 Subject: [PATCH] Update template --- .gitignore | 11 ++-- android/.gitignore | 2 +- android/app/build.gradle | 62 ++++++++----------- android/app/src/debug/AndroidManifest.xml | 6 +- android/app/src/main/AndroidManifest.xml | 47 +++++++------- .../com/example/SyncTube/MainActivity.kt | 6 -- .../com/example/synctube/MainActivity.kt | 5 ++ .../res/drawable-v21/launch_background.xml | 12 ++++ .../app/src/main/res/values-night/styles.xml | 18 ++++++ android/app/src/main/res/values/styles.xml | 2 +- android/app/src/profile/AndroidManifest.xml | 6 +- android/build.gradle | 4 +- android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 4 +- lib/app.dart | 2 +- lib/video_player.dart | 34 +++++----- pubspec.lock | 17 ++--- pubspec.yaml | 10 ++- 19 files changed, 137 insertions(+), 115 deletions(-) delete mode 100644 android/app/src/main/kotlin/com/example/SyncTube/MainActivity.kt create mode 100644 android/app/src/main/kotlin/com/example/synctube/MainActivity.kt create mode 100644 android/app/src/main/res/drawable-v21/launch_background.xml create mode 100644 android/app/src/main/res/values-night/styles.xml diff --git a/.gitignore b/.gitignore index d923b5d..320c1de 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ android/app/release.jks .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml @@ -25,23 +26,25 @@ android/app/release.jks # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies -.packages .pub-cache/ .pub/ /build/ -# Web related -lib/generated_plugin_registrant.dart - # Symbolication related app.*.symbols # Obfuscation related app.*.map.json +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages /upload_dev_build.sh diff --git a/android/.gitignore b/android/.gitignore index 6f56801..55afd91 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -7,7 +7,7 @@ gradle-wrapper.jar GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties **/*.keystore **/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle index 14d67d8..22a0250 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,27 +1,11 @@ plugins { id "com.android.application" id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id "dev.flutter.flutter-gradle-plugin" } -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - +// custom: load signing keys def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { @@ -29,30 +13,34 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 34 + namespace = "com.example.synctube" + compileSdk = flutter.compileSdkVersion + // ndkVersion = flutter.ndkVersion + // temp fix for this error: + // Your project is configured with Android NDK 23.1.7779620, but the following plugin(s) depend on a different Android NDK version: + ndkVersion = "25.1.8937393" compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.SyncTube" - minSdkVersion flutter.minSdkVersion - targetSdkVersion 30 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + applicationId = "com.example.synctube" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } + // custom: config signingConfigs { release { keyAlias keystoreProperties['keyAlias'] @@ -61,19 +49,19 @@ android { storePassword keystoreProperties['storePassword'] } } + buildTypes { debug { - signingConfig keystorePropertiesFile.exists() ? signingConfigs.release : signingConfigs.debug - } - profile { - signingConfig keystorePropertiesFile.exists() ? signingConfigs.release : signingConfigs.debug + signingConfig = keystorePropertiesFile.exists() ? signingConfigs.release : signingConfigs.debug } release { - signingConfig signingConfigs.release + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = keystorePropertiesFile.exists() ? signingConfigs.release : signingConfigs.debug } } } flutter { - source '../..' + source = "../.." } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index de42c0d..399f698 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a33385b..38d9489 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,20 +1,13 @@ - - + - + android:name="${applicationName}" + android:icon="@mipmap/ic_launcher"> - + + @@ -39,23 +33,34 @@ + - + - + android:name="sk.fourq.otaupdate.OtaUpdateFileProvider" + android:authorities="${applicationId}.ota_update_provider" + android:exported="false" + android:grantUriPermissions="true"> + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/SyncTube/MainActivity.kt b/android/app/src/main/kotlin/com/example/SyncTube/MainActivity.kt deleted file mode 100644 index c61cb9f..0000000 --- a/android/app/src/main/kotlin/com/example/SyncTube/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.SyncTube - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/android/app/src/main/kotlin/com/example/synctube/MainActivity.kt b/android/app/src/main/kotlin/com/example/synctube/MainActivity.kt new file mode 100644 index 0000000..c38f393 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/synctube/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.synctube + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index c7986f6..3afa56f 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -3,7 +3,7 @@ diff --git a/android/build.gradle b/android/build.gradle index bc157bd..d2ffbff 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,12 +5,12 @@ allprojects { } } -rootProject.buildDir = '../build' +rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { - project.evaluationDependsOn(':app') + project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { diff --git a/android/gradle.properties b/android/gradle.properties index 94adc3a..2597170 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index cb24abd..5e6b542 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index e61e8dc..5c58366 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -18,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.1.2" apply false - id "org.jetbrains.kotlin.android" version "1.9.23" apply false + id "com.android.application" version "8.3.2" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false } include ":app" diff --git a/lib/app.dart b/lib/app.dart index 6a8be80..59982d3 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -81,7 +81,7 @@ class _AppState extends State with WidgetsBindingObserver { child: PopScope( // canPop: canPop, canPop: false, - onPopInvoked: (didPop) => _onWillPop(context), + onPopInvokedWithResult: (didPop, result) => _onWillPop(context), child: Selector( selector: (context, app) => app.hasSystemUi, builder: (context, hasSystemUi, _) => diff --git a/lib/video_player.dart b/lib/video_player.dart index b23511f..1baf36e 100644 --- a/lib/video_player.dart +++ b/lib/video_player.dart @@ -1,7 +1,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:perfect_volume_control/perfect_volume_control.dart'; +// import 'package:perfect_volume_control/perfect_volume_control.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:video_player/video_player.dart'; @@ -316,22 +316,22 @@ class TvControls extends StatelessWidget { player.toggleControls(!player.showControls); player.hideControlsWithDelay(); } - if (isKeyPressed(LogicalKeyboardKey.arrowLeft)) { - () async { - final volume = await PerfectVolumeControl.getVolume(); - var newVolume = volume - 0.1; - if (newVolume < 0) newVolume = 0; - PerfectVolumeControl.setVolume(newVolume); - }(); - } - if (isKeyPressed(LogicalKeyboardKey.arrowRight)) { - () async { - final volume = await PerfectVolumeControl.getVolume(); - var newVolume = volume + 0.1; - if (newVolume > 1) newVolume = 1; - PerfectVolumeControl.setVolume(newVolume); - }(); - } + // if (isKeyPressed(LogicalKeyboardKey.arrowLeft)) { + // () async { + // final volume = await PerfectVolumeControl.getVolume(); + // var newVolume = volume - 0.1; + // if (newVolume < 0) newVolume = 0; + // PerfectVolumeControl.setVolume(newVolume); + // }(); + // } + // if (isKeyPressed(LogicalKeyboardKey.arrowRight)) { + // () async { + // final volume = await PerfectVolumeControl.getVolume(); + // var newVolume = volume + 0.1; + // if (newVolume > 1) newVolume = 1; + // PerfectVolumeControl.setVolume(newVolume); + // }(); + // } }, child: child, ), diff --git a/pubspec.lock b/pubspec.lock index 46cdbfc..7eca68d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -291,10 +291,11 @@ packages: ota_update: dependency: "direct main" description: - name: ota_update - sha256: "8c47531b655f8fcf9961dc7758a933a9ccbcbe1c77a7ec52e5c5cfc2ec367ba7" - url: "https://pub.dev" - source: hosted + path: "." + ref: patch-1 + resolved-ref: "0aa1d08d301e884142a3837edebc28ba927a13f2" + url: "https://github.com/eduardohr-muniz/ota_update.git" + source: git version: "6.0.0" package_info_plus: dependency: "direct main" @@ -344,14 +345,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.0" - perfect_volume_control: - dependency: "direct main" - description: - name: perfect_volume_control - sha256: "9bc513e4a2b6151f7d04fc917271c40bdd44cbe67224d52a314302879d2a30f8" - url: "https://pub.dev" - source: hosted - version: "1.0.5" petitparser: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4726c9c..05a7f7d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+21 +version: 1.0.0+22 environment: sdk: ">=3.3.0 <4.0.0" @@ -32,7 +32,7 @@ dependencies: video_player: ^2.9.1 - perfect_volume_control: ^1.0.5 + # perfect_volume_control: ^1.0.5 web_socket_channel: ^2.4.5 @@ -52,7 +52,11 @@ dependencies: app_links: ^6.2.0 - ota_update: ^6.0.0 + # ota_update: ^6.0.0 + ota_update: + git: + url: https://github.com/eduardohr-muniz/ota_update.git + ref: patch-1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.