mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-07-30 18:26:11 -04:00
fix(NotificationDownloadListener): Crash on no-installer forge versions
Fixes #282
This commit is contained in:
@@ -14,19 +14,20 @@ import java.io.File;
|
||||
|
||||
public class NotificationDownloadListener implements ModloaderDownloadListener {
|
||||
private final Context mContext;
|
||||
private final Intent mIntent;
|
||||
private final ModLoader mModLoader;
|
||||
|
||||
public NotificationDownloadListener(Context context, ModLoader modLoader) {
|
||||
mModLoader = modLoader;
|
||||
mContext = context.getApplicationContext();
|
||||
mIntent = new Intent(mContext, LauncherActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadFinished(File downloadedFile) {
|
||||
if(mModLoader.requiresGuiInstallation()) {
|
||||
ModloaderInstallTracker.saveModLoader(mContext, mModLoader, downloadedFile);
|
||||
Intent mainActivityIntent = new Intent(mContext, LauncherActivity.class);
|
||||
sendIntentNotification(mainActivityIntent, R.string.modpack_install_notification_success);
|
||||
sendIntentNotification(R.string.modpack_install_notification_success);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +41,11 @@ public class NotificationDownloadListener implements ModloaderDownloadListener {
|
||||
Tools.showErrorRemote(mContext, R.string.modpack_install_modloader_download_failed, e);
|
||||
}
|
||||
|
||||
private void sendIntentNotification(Intent intent, int localeString) {
|
||||
private void sendIntentNotification(int localeString) {
|
||||
Tools.runOnUiThread(() -> NotificationUtils.sendBasicNotification(mContext,
|
||||
R.string.modpack_install_notification_title,
|
||||
localeString,
|
||||
intent,
|
||||
mIntent,
|
||||
NotificationUtils.PENDINGINTENT_CODE_DOWNLOAD_SERVICE,
|
||||
NotificationUtils.NOTIFICATION_ID_DOWNLOAD_LISTENER
|
||||
));
|
||||
@@ -54,7 +55,7 @@ public class NotificationDownloadListener implements ModloaderDownloadListener {
|
||||
Tools.runOnUiThread(()->NotificationUtils.sendBasicNotification(mContext,
|
||||
R.string.modpack_install_notification_title,
|
||||
localeString,
|
||||
null,
|
||||
mIntent,
|
||||
NotificationUtils.PENDINGINTENT_CODE_DOWNLOAD_SERVICE,
|
||||
NotificationUtils.NOTIFICATION_ID_DOWNLOAD_LISTENER
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user