Skip to content

Commit

Permalink
Fix bug in Android 12
Browse files Browse the repository at this point in the history
Thanks google, for don't give a fck for the old apps with your randomic API changes.
  • Loading branch information
marcussacana committed Jun 28, 2022
1 parent 4d6003a commit 6a8dceb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 19 deletions.
23 changes: 14 additions & 9 deletions Build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static async Task<bool> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ private async Task<bool> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6a8dceb

Please sign in to comment.