From 912bf6a0c65036ba1d0da03716db77ce26823b82 Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sun, 30 Apr 2023 22:14:57 -0400 Subject: android: Add user directory shortcut --- src/android/app/src/main/AndroidManifest.xml | 1 + .../main/java/org/yuzu/yuzu_emu/YuzuApplication.kt | 33 ++++---- .../yuzu_emu/fragments/HomeSettingsFragment.kt | 89 ++++++++++++++++++++++ .../org/yuzu/yuzu_emu/fragments/SetupFragment.kt | 11 +++ .../org/yuzu/yuzu_emu/utils/ForegroundService.kt | 4 +- src/android/app/src/main/res/values/strings.xml | 27 ++++--- 6 files changed, 140 insertions(+), 25 deletions(-) diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index 4791e3417..ae473ae3a 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml @@ -15,6 +15,7 @@ + = Build.VERSION_CODES.TIRAMISU) { + pushNotificationPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS) + } + mainActivity = requireActivity() as MainActivity homeViewModel.setNavigationVisibility(false) @@ -219,6 +225,11 @@ class SetupFragment : Fragment() { _binding = null } + private val pushNotificationPermissionLauncher = + registerForActivityResult(ActivityResultContracts.RequestPermission()) { + // TODO: Show proper notification request reason and confirmation + } + private fun finishSetup() { PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext).edit() .putBoolean(Settings.PREF_FIRST_APP_LAUNCH, false) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt index 557fe0738..7e33ff044 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/ForegroundService.kt @@ -29,10 +29,10 @@ class ForegroundService : Service() { PendingIntent.FLAG_IMMUTABLE ) val builder = - NotificationCompat.Builder(this, getString(R.string.app_notification_channel_id)) + NotificationCompat.Builder(this, getString(R.string.emulation_notification_channel_id)) .setSmallIcon(R.drawable.ic_stat_notification_logo) .setContentTitle(getString(R.string.app_name)) - .setContentText(getString(R.string.app_notification_running)) + .setContentText(getString(R.string.emulation_notification_running)) .setPriority(NotificationCompat.PRIORITY_LOW) .setOngoing(true) .setVibrate(null) diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 8220cd412..58ae37790 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -4,10 +4,14 @@ yuzu This software will run games for the Nintendo Switch game console. No game titles or keys are included.<br /><br />Before you begin, please locate your prod.keys ]]> file on your device storage.<br /><br />Learn more]]> - yuzu - yuzu - yuzu Switch emulator notifications - yuzu is running + Emulation is Active + emulationIsActive + Shows a persistent notification when emulation is running. + yuzu is running + Notices and errors + noticesAndErrors + Shows notifications when something goes wrong. + Notification permission not granted! Welcome! @@ -29,14 +33,14 @@ Games Settings - Select Games Folder + Select games folder Allows yuzu to populate the games list Skip selecting games folder? Games won\'t be displayed in the Games list if a folder isn\'t selected. https://yuzu-emu.org/help/quickstart/#dumping-games Search Games Games directory selected - Install Prod.keys + Install prod.keys Required to decrypt retail games Skip adding keys? Valid keys are required to emulate retail games. Only homebrew apps will function if you continue. @@ -44,16 +48,21 @@ Help Skip Cancel - Install Amiibo Keys + Install Amiibo keys Required to use Amiibo in game Invalid keys file selected Keys successfully installed Keys file (prod.keys) is invalid Keys file (key_retail.bin) is invalid - Install GPU Driver + Install GPU driver Install alternative drivers for potentially better performance or accuracy - Advanced Settings + Advanced settings Configure emulator settings + Open yuzu folder + Manage yuzu\'s internal files + No file manager found + Couldn\'t open yuzu directory + Please locate the user folder with the file manager\'s side panel manually. Enable limit speed -- cgit v1.2.3