From 6a8dcebf74366277d29087a360ce4e6d6b12400d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Andr=C3=A9?= Date: Tue, 28 Jun 2022 17:11:36 -0300 Subject: [PATCH] Fix bug in Android 12 Thanks google, for don't give a fck for the old apps with your randomic API changes. --- Build.cmd | 23 +++++++++++-------- .../ForegroundService.cs | 17 ++++++++------ .../DirectPackageInstaller/SelfUpdate.cs | 2 +- .../DirectPackageInstaller/Tasks/Installer.cs | 2 +- .../Views/MainView.axaml.cs | 2 +- .../Views/MessageBox.axaml | 2 ++ 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/Build.cmd b/Build.cmd index c16727a..2a3f7e3 100755 --- a/Build.cmd +++ b/Build.cmd @@ -2,6 +2,20 @@ goto BATCH clear +echo "DirectPackageInstaller Build Script - Unix"; + +if !(dotnet --list-sdks | grep -q '6.'); then + echo ".NET 6 SDK NOT FOUND" + exit; +fi + +echo ".NET 6 SDK FOUND" + +if [ -d "/usr/local/lib/android/sdk" ]; then + echo "Github Action Android SDK Path Found" + export ANDROID_SDK_ROOT=/usr/local/lib/android/sdk +fi + if [ -v ANDROID_SDK_ROOT ]; then # The correct SDK directory, contains a build-tools directory export AndroidSdkDirectory=${ANDROID_SDK_ROOT} @@ -16,15 +30,6 @@ else export AndroidNdkDirectory=~/Android/Sdk/ndk/24.0.8215888/ fi; -echo "DirectPackageInstaller Build Script - Unix"; - -if !(dotnet --list-sdks | grep -q '6.'); then - echo ".NET 6 SDK NOT FOUND" - exit; -fi - -echo ".NET 6 SDK FOUND" - dotnet clean rm -r Release mkdir Release diff --git a/DirectPackageInstaller/DirectPackageInstaller.Android/ForegroundService.cs b/DirectPackageInstaller/DirectPackageInstaller.Android/ForegroundService.cs index 67d235b..8c93e44 100644 --- a/DirectPackageInstaller/DirectPackageInstaller.Android/ForegroundService.cs +++ b/DirectPackageInstaller/DirectPackageInstaller.Android/ForegroundService.cs @@ -20,10 +20,11 @@ public class ForegroundService : Service public override void OnCreate() { - base.OnCreate(); BindChannel(); BindForeground(); + + base.OnCreate(); } public override StartCommandResult OnStartCommand(Intent? intent, StartCommandFlags flags, int startId) @@ -91,13 +92,15 @@ private void BindForeground() { try { - var Notification = new Notification.Builder(this, "ServiceChannel") - .SetContentIntent( - PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(NotificationReceiver)), 0)) - .SetContentText("A thread is running.") - .Build(); + var Intent = new Intent(this, typeof(NotificationReceiver)); + PendingIntentFlags Flags = Build.VERSION.SdkInt >= BuildVersionCodes.S ? PendingIntentFlags.Mutable : 0; + var pendingIntent = PendingIntent.GetBroadcast(this, 0, Intent, Flags); + + var Notification = new Notification.Builder(this, "ServiceChannel"); + Notification.SetContentIntent(pendingIntent); + Notification.SetContentText("A thread is running."); - StartForeground(NotificationID, Notification); + StartForeground(NotificationID, Notification.Build()); } catch (Exception ex) { diff --git a/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs b/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs index 97e8e0b..646ddb2 100644 --- a/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs +++ b/DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs @@ -46,7 +46,7 @@ public static string? MainExecutable const string UpdateList = "Update.ini"; - public static Version CurrentVersion = new Version("6.1.6"); + public static Version CurrentVersion = new Version("6.1.7"); public static Version? LastVersion = null; diff --git a/DirectPackageInstaller/DirectPackageInstaller/Tasks/Installer.cs b/DirectPackageInstaller/DirectPackageInstaller/Tasks/Installer.cs index f9d1ccf..bb24439 100644 --- a/DirectPackageInstaller/DirectPackageInstaller/Tasks/Installer.cs +++ b/DirectPackageInstaller/DirectPackageInstaller/Tasks/Installer.cs @@ -185,7 +185,7 @@ public static async Task PushPackage(Settings Config, Source InputType, St return false; } - bool OK = false; + bool OK; if (await IPHelper.IsRPIOnline(Config.PS4IP)) OK = await PushRPI(URL, Config, Silent); else diff --git a/DirectPackageInstaller/DirectPackageInstaller/Views/MainView.axaml.cs b/DirectPackageInstaller/DirectPackageInstaller/Views/MainView.axaml.cs index 04fb5e8..fca4383 100644 --- a/DirectPackageInstaller/DirectPackageInstaller/Views/MainView.axaml.cs +++ b/DirectPackageInstaller/DirectPackageInstaller/Views/MainView.axaml.cs @@ -651,7 +651,7 @@ private async Task Install(string URL, bool Silent) { if (!await IPHelper.IsRPIOnline(App.Config.PS4IP) && !await Installer.TryConnectSocket(App.Config.PS4IP)) { - await MessageBox.ShowAsync($"Remote Package Installer Not Found at {App.Config.PS4IP}, Ensure if he is open.", "DirectPackageInstaller", MessageBoxButtons.OK, MessageBoxIcon.Error); + await MessageBox.ShowAsync($"Remote Package Installer or GoldHEN Not Found at {App.Config.PS4IP}, Verify if is running.", "DirectPackageInstaller", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } diff --git a/DirectPackageInstaller/DirectPackageInstaller/Views/MessageBox.axaml b/DirectPackageInstaller/DirectPackageInstaller/Views/MessageBox.axaml index 15c3395..8a90995 100644 --- a/DirectPackageInstaller/DirectPackageInstaller/Views/MessageBox.axaml +++ b/DirectPackageInstaller/DirectPackageInstaller/Views/MessageBox.axaml @@ -6,6 +6,8 @@ xmlns:views="clr-namespace:DirectPackageInstaller.Views" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="180" x:Class="DirectPackageInstaller.Views.MessageBox" + MinWidth="380" + MinHeight="180" WindowStartupLocation="CenterOwner" Icon="/Assets/avalonia-logo.ico" CanResize="False"