diff --git a/app/build.gradle b/app/build.gradle index acf4ddd0..c20c80c5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -177,11 +177,12 @@ dependencies { implementation "com.mikepenz:aboutlibraries-core:$about_libraries" implementation 'com.wdullaer:materialdatetimepicker:4.2.3' implementation "io.coil-kt:coil:0.11.0" + implementation "io.github.wulkanowy:AppKillerManager:c33b658" playImplementation 'com.google.firebase:firebase-analytics:17.4.1' playImplementation 'com.google.firebase:firebase-inappmessaging-display-ktx:19.0.6' playImplementation "com.google.firebase:firebase-inappmessaging-ktx:19.0.6" - playImplementation 'com.google.firebase:firebase-messaging:20.1.6' + playImplementation 'com.google.firebase:firebase-messaging:20.1.7' playImplementation 'com.google.firebase:firebase-crashlytics:17.0.0' playImplementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4ec2f781..802cf1ad 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,7 +18,8 @@ android:supportsRtl="false" android:theme="@style/WulkanowyTheme" android:usesCleartextTraffic="true" - tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"> + tools:ignore="GoogleAppIndexingWarning,UnusedAttribute" + tools:replace="android:supportsRtl,android:allowBackup"> (getString(R.string.pref_key_notifications_fix_issues))?.run { + isVisible = AppKillerManager.isDeviceSupported() && AppKillerManager.isAnyActionAvailable(requireContext()) + setOnPreferenceClickListener { + presenter.onFixSyncIssuesClicked() + true + } + } } override fun onActivityCreated(savedInstanceState: Bundle?) { @@ -119,6 +127,19 @@ class SettingsFragment : PreferenceFragmentCompat(), .show() } + override fun showFixSyncDialog() { + AlertDialog.Builder(requireContext()) + .setTitle(R.string.pref_notify_fix_sync_issues) + .setMessage(R.string.pref_notify_fix_sync_issues_message) + .setNegativeButton(android.R.string.cancel) { _, _ -> } + .setPositiveButton(R.string.pref_notify_fix_sync_issues_settings_button) { _, _ -> + AppKillerManager.doActionPowerSaving(requireContext()) + AppKillerManager.doActionAutoStart(requireContext()) + AppKillerManager.doActionNotification(requireContext()) + } + .show() + } + override fun onResume() { super.onResume() preferenceScreen.sharedPreferences.registerOnSharedPreferenceChangeListener(this) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt index 09fc2d70..bccb6f0b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt @@ -58,6 +58,10 @@ class SettingsPresenter @Inject constructor( view?.showForceSyncDialog() } + fun onFixSyncIssuesClicked() { + view?.showFixSyncDialog() + } + fun onForceSyncDialogSubmit() { view?.run { val successString = syncSuccessString diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsView.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsView.kt index 4a1b0c76..3786ba4b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsView.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsView.kt @@ -19,4 +19,5 @@ interface SettingsView : BaseView { fun setSyncInProgress(inProgress: Boolean) fun showForceSyncDialog() + fun showFixSyncDialog() } diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a4af0dec..03ccaa2d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -329,6 +329,9 @@ Powiadomienia Pokazuj powiadomienia Pokazuj powiadomienia o następnych lekcjach + Napraw problemy z synchronizacją i powiadomieniami + Na twoim urządzeniu mogą występować problemy z synchronizacją danych i powiadomieniami.\n\nBy je naprawić, dodaj Wulkanowego do autostartu i wyłącz optymalizację/oszczędzanie baterii w ustawieniach systemowych telefonu. + Przejdź do ustawień Pokazuj powiadomienia debugowania Synchronizacja Automatyczna aktualizacja diff --git a/app/src/main/res/values/preferences_keys.xml b/app/src/main/res/values/preferences_keys.xml index 868a3c89..6cb877ec 100644 --- a/app/src/main/res/values/preferences_keys.xml +++ b/app/src/main/res/values/preferences_keys.xml @@ -13,6 +13,7 @@ services_interval services_disable_wifi_only services_force_sync + notifications_fix_issues notifications_enable notifications_upcoming_lessons_enable notification_debug diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 06f136c7..6e08fded 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -366,6 +366,9 @@ Notifications Show notifications Show upcoming lesson notifications + Fix synchronization & notifications issues + Your device may have data synchronization issues and with notifications.\n\nTo fix them, you need to add Wulkanowy to the autostart and turn off battery optimization/saving in the phone settings. + Go to settings Show debug notifications Synchronization diff --git a/app/src/main/res/xml/scheme_preferences.xml b/app/src/main/res/xml/scheme_preferences.xml index a138177f..c05910f9 100644 --- a/app/src/main/res/xml/scheme_preferences.xml +++ b/app/src/main/res/xml/scheme_preferences.xml @@ -1,4 +1,4 @@ - + + app:key="@string/pref_key_timetable_show_timers" + app:title="@string/pref_view_timetable_show_timers" /> + app:title="@string/pref_view_grade_statistics_list" /> +