From 7f9cee422216ce61f073d8a80ba71ffbb32d72ea Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Wed, 22 Oct 2025 18:30:25 +0200 Subject: [PATCH] fix: unify version source --- android/app/build.gradle.kts | 22 +++++++++++++++--- android/app/src/main/AndroidManifest.xml | 15 ++++++------ ios/Runner.xcodeproj/project.pbxproj | 6 +++++ lib/config/plex_config.dart | 28 +++++++++++++++++++++-- lib/main.dart | 2 +- lib/screens/about_screen.dart | 29 +++++++++++++++++++++--- lib/screens/discover_screen.dart | 2 +- lib/screens/server_selection_screen.dart | 2 +- pubspec.lock | 2 +- pubspec.yaml | 3 ++- 10 files changed, 90 insertions(+), 21 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 5b48e762..262e4ccc 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,3 +1,6 @@ +import java.util.Properties +import java.io.FileInputStream + plugins { id("com.android.application") id("kotlin-android") @@ -29,11 +32,24 @@ android { versionName = flutter.versionName } + signingConfigs { + create("release") { + val keystorePropertiesFile = rootProject.file("key.properties") + if (keystorePropertiesFile.exists()) { + val keystoreProperties = Properties() + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) + + keyAlias = keystoreProperties["keyAlias"] as String + keyPassword = keystoreProperties["keyPassword"] as String + storeFile = file(keystoreProperties["storeFile"] as String) + storePassword = keystoreProperties["storePassword"] as String + } + } + } + buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + signingConfig = signingConfigs.getByName("release") } } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 60b14e5a..ac0c0b27 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,14 +1,13 @@ - + - - - - - - - + + + + + create({ + required String baseUrl, + String? token, + required String clientIdentifier, + String? product, + String? platform, + String? device, + bool acceptJson = true, + }) async { + final packageInfo = await PackageInfo.fromPlatform(); + return PlexConfig( + baseUrl: baseUrl, + token: token, + clientIdentifier: clientIdentifier, + product: product ?? 'Plezy', + version: packageInfo.version, + platform: platform ?? 'Flutter', + device: device, + acceptJson: acceptJson, + ); + } + Map get headers { final headers = { 'X-Plex-Client-Identifier': clientIdentifier, diff --git a/lib/main.dart b/lib/main.dart index 4039870a..92f3c167 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -105,7 +105,7 @@ class _SetupScreenState extends State { await storage.saveServerUrl(connection.uri); // Create client with working connection - final config = PlexConfig( + final config = await PlexConfig.create( baseUrl: connection.uri, token: server.accessToken, clientIdentifier: clientId, diff --git a/lib/screens/about_screen.dart b/lib/screens/about_screen.dart index fa2a8bba..b2913ca9 100644 --- a/lib/screens/about_screen.dart +++ b/lib/screens/about_screen.dart @@ -1,13 +1,36 @@ import 'package:flutter/material.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import '../widgets/desktop_app_bar.dart'; -class AboutScreen extends StatelessWidget { +class AboutScreen extends StatefulWidget { const AboutScreen({super.key}); + @override + State createState() => _AboutScreenState(); +} + +class _AboutScreenState extends State { + String _appName = ''; + String _appVersion = ''; + + @override + void initState() { + super.initState(); + _loadPackageInfo(); + } + + Future _loadPackageInfo() async { + final packageInfo = await PackageInfo.fromPlatform(); + setState(() { + _appName = 'Plezy'; + _appVersion = packageInfo.version; + }); + } + @override Widget build(BuildContext context) { - const appName = 'Plezy'; - const appVersion = '1.0.0'; + final appName = _appName; + final appVersion = _appVersion; return Scaffold( body: CustomScrollView( diff --git a/lib/screens/discover_screen.dart b/lib/screens/discover_screen.dart index a21f2c98..c68aaf2c 100644 --- a/lib/screens/discover_screen.dart +++ b/lib/screens/discover_screen.dart @@ -266,7 +266,7 @@ class _DiscoverScreenState extends State with Refreshable { } // Create new client - final config = PlexConfig( + final config = await PlexConfig.create( baseUrl: connection.uri, token: server.accessToken, clientIdentifier: clientId, diff --git a/lib/screens/server_selection_screen.dart b/lib/screens/server_selection_screen.dart index 1a254fb0..b3d379bd 100644 --- a/lib/screens/server_selection_screen.dart +++ b/lib/screens/server_selection_screen.dart @@ -96,7 +96,7 @@ class _ServerSelectionScreenState extends State { storage.getClientIdentifier() ?? widget.authService.clientIdentifier; // Create client and navigate to main app - final config = PlexConfig( + final config = await PlexConfig.create( baseUrl: connection.uri, token: server.accessToken, clientIdentifier: clientId, diff --git a/pubspec.lock b/pubspec.lock index cd524dcf..d9c4d8d3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -562,7 +562,7 @@ packages: source: hosted version: "2.2.0" package_info_plus: - dependency: transitive + dependency: "direct main" description: name: package_info_plus sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d diff --git a/pubspec.yaml b/pubspec.yaml index 30a65161..2349bfd2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: plezy description: "A beautiful Plex client for Flutter" publish_to: "none" -version: 0.1.0 +version: 1.0.1+3 environment: sdk: ^3.8.1 @@ -25,6 +25,7 @@ dependencies: window_manager: ^0.4.3 logger: ^2.0.2 flutter_svg: ^2.0.10 + package_info_plus: ^9.0.0 dependency_overrides: media_kit: