diff --git a/app/build.gradle b/app/build.gradle index ca3c445f11530e35463d4da225fd52836332a226..f80aa65e83aea379b06fe20dac70538a03972e5c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,10 +27,6 @@ android { } } - buildFeatures { - viewBinding = true - } - buildTypes { release { minifyEnabled true @@ -133,6 +129,4 @@ dependencies { // Image viewer implementation 'com.github.stfalcon-studio:StfalconImageViewer:v1.0.1' - - implementation 'foundation.e:elib:0.0.1-alpha11' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 29093161eccca2bf93192a0ed79635ebf0f19578..c1baa027b9347943f6f7bd5b09c5642d986e80ea 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -176,25 +176,5 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/> - - - - - - - - - - diff --git a/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt b/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt index a70acf091579a31886869bde6f98c6c69b6cd534..7fd6f9327d27052a35cada9c54c40fec2f1dfe3e 100644 --- a/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt +++ b/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt @@ -10,7 +10,6 @@ import android.os.PowerManager import android.os.SystemClock import androidx.core.app.NotificationCompat import androidx.core.content.ContextCompat -import androidx.preference.PreferenceManager import io.heckel.ntfy.BuildConfig import io.heckel.ntfy.R import io.heckel.ntfy.app.Application @@ -94,11 +93,7 @@ class SubscriberService : Service() { override fun onDestroy() { Log.d(TAG, "Subscriber service has been destroyed") stopService() - val preferenceKey = getString(R.string.eos_preference_key_is_enabled) - if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(preferenceKey, false)) { - sendBroadcast(Intent(this, AutoRestartReceiver::class.java)) - } - + sendBroadcast(Intent(this, AutoRestartReceiver::class.java)) // Restart it if necessary! super.onDestroy() } @@ -132,6 +127,7 @@ class SubscriberService : Service() { } } wakeLock = null + stopForeground(true) stopSelf() } catch (e: Exception) { Log.d(TAG, "Service stopped without being started: ${e.message}") diff --git a/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt b/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt index 18ed4f947a02cc5e22e8cc0619e804b8816cbb7b..f7573f299c4a3d5a5410c9cbdb8df9b13617f03e 100644 --- a/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt +++ b/app/src/main/java/io/heckel/ntfy/service/SubscriberServiceManager.kt @@ -2,11 +2,10 @@ package io.heckel.ntfy.service import android.content.Context import android.content.Intent -import androidx.preference.PreferenceManager +import androidx.core.content.ContextCompat import androidx.work.* import io.heckel.ntfy.app.Application import io.heckel.ntfy.util.Log -import io.heckel.ntfy.R import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -44,17 +43,11 @@ class SubscriberServiceManager(private val context: Context) { Log.d(TAG, "ServiceStartWorker: Failed, no application found (work ID: ${id})") return Result.failure() } - withContext(Dispatchers.IO) { val app = context.applicationContext as Application - val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(app) - val preferenceKey = context.getString(R.string.eos_preference_key_is_enabled) - val action = if (sharedPreferences.getBoolean(preferenceKey, false)) { - SubscriberService.Action.START - } else { - SubscriberService.Action.STOP - } - + val subscriptionIdsWithInstantStatus = app.repository.getSubscriptionIdsWithInstantStatus() + val instantSubscriptions = subscriptionIdsWithInstantStatus.toList().filter { (_, instant) -> instant }.size + val action = if (instantSubscriptions > 0) SubscriberService.Action.START else SubscriberService.Action.STOP val serviceState = SubscriberService.readServiceState(context) if (serviceState == SubscriberService.ServiceState.STOPPED && action == SubscriberService.Action.STOP) { return@withContext Result.success() diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainSettingsActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/MainSettingsActivity.kt deleted file mode 100644 index 1aabb1a1edbbf24cd4ec0e5ec29a17e3fefac921..0000000000000000000000000000000000000000 --- a/app/src/main/java/io/heckel/ntfy/ui/MainSettingsActivity.kt +++ /dev/null @@ -1,71 +0,0 @@ -package io.heckel.ntfy.ui - -import android.content.res.Configuration -import android.os.Build -import android.os.Bundle -import android.view.WindowInsetsController -import androidx.annotation.RequiresApi -import androidx.appcompat.app.AppCompatActivity -import io.heckel.ntfy.R -import io.heckel.ntfy.databinding.MainSettingsActivityBinding - -class MainSettingsActivity : AppCompatActivity() { - - private lateinit var mBinding: MainSettingsActivityBinding - - @RequiresApi(Build.VERSION_CODES.R) - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - mBinding = MainSettingsActivityBinding.inflate(layoutInflater) - setContentView(mBinding.root) - - setupToolbar() - setSystemBarsAppearance() - showPreferencesFragment() - } - - private fun setupToolbar() { - mBinding.toolbar.setNavigationOnClickListener { - onBackPressedDispatcher.onBackPressed() - } - } - - @RequiresApi(Build.VERSION_CODES.R) - private fun setSystemBarsAppearance() { - val insetsController = window.insetsController ?: return - - val isLightMode = isSystemInLightMode() - if (isLightMode) { - insetsController.setSystemBarsAppearance( - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS - ) - insetsController.setSystemBarsAppearance( - WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS, - WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS - ) - } else { - insetsController.setSystemBarsAppearance( - 0, - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS - ) - insetsController.setSystemBarsAppearance( - 0, - WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS - ) - } - } - - private fun isSystemInLightMode(): Boolean { - val nightModeFlags = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK - return nightModeFlags != Configuration.UI_MODE_NIGHT_YES - } - - private fun showPreferencesFragment() { - supportFragmentManager - .beginTransaction() - .replace(R.id.fragment_container, PreferencesFragment()) - .commit() - } -} \ No newline at end of file diff --git a/app/src/main/java/io/heckel/ntfy/ui/PreferencesFragment.kt b/app/src/main/java/io/heckel/ntfy/ui/PreferencesFragment.kt deleted file mode 100644 index 2bc5e30d5b7daf574b5e06edb34adcee18344264..0000000000000000000000000000000000000000 --- a/app/src/main/java/io/heckel/ntfy/ui/PreferencesFragment.kt +++ /dev/null @@ -1,37 +0,0 @@ -package io.heckel.ntfy.ui - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem -import android.widget.Toolbar -import androidx.preference.PreferenceFragmentCompat -import androidx.preference.SwitchPreferenceCompat -import io.heckel.ntfy.R -import io.heckel.ntfy.service.SubscriberService -import io.heckel.ntfy.util.Log - -class PreferencesFragment : PreferenceFragmentCompat() { - - override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { - setPreferencesFromResource(R.xml.settings_preferences, rootKey) - - val preference: SwitchPreferenceCompat? = - findPreference(getString(R.string.eos_preference_key_is_enabled)) - - preference?.setOnPreferenceChangeListener { _, newValue -> - val isChecked = newValue as Boolean - val intent = Intent(context, SubscriberService::class.java) - intent.action = if (isChecked) { - SubscriberService.Action.START.name - } else { - SubscriberService.Action.STOP.name - } - - requireContext().startService(intent) - true - } - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_notification.xml b/app/src/main/res/drawable/ic_notification.xml index 900100ba1745a94bf570a455e6b90cb43a170a85..d02140aa2ccdf137a1399e6b4d23b175a17175d8 100644 --- a/app/src/main/res/drawable/ic_notification.xml +++ b/app/src/main/res/drawable/ic_notification.xml @@ -1,31 +1,31 @@ diff --git a/app/src/main/res/layout/main_settings_activity.xml b/app/src/main/res/layout/main_settings_activity.xml deleted file mode 100644 index 06731953cf289eaa9e472b1266409a8de5ef8258..0000000000000000000000000000000000000000 --- a/app/src/main/res/layout/main_settings_activity.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index bef8d4f91d2e15ef7459b7c80ebb34bff96e1456..a9c38b99a4da76d4af98d4ff18375fb78b67aeeb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -343,6 +343,4 @@ ntfy arbeitet nicht als UnifiedPush-Distributor UnifiedPush aktivieren ntfy arbeitet als UnifiedPush-Distributor - Den Verteiler aktivieren - Es ermöglicht Drittanbieteranwendungen, UnifiedPush-Benachrichtigungen zu empfangen \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 33f9aa92f24ee82ab4ccc1f5466122ff394b5c50..0bda4a7a07753dbf6eb2f0beba1a67fe2f91beac 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -343,6 +343,4 @@ Activar UnifiedPush ntfy actuará como distribuidor UnifiedPush ntfy no actuará como distribuidor UnifiedPush - Habilitar el distribuidor - Permite a las aplicaciones de terceros recibir notificaciones de UnifiedPush \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 97d536c884b3e47bae70ed241308332ed4cc947a..348eecc25568c6f9dd977e788503e3f2f8253b7a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -343,6 +343,4 @@ ntfy agira comme un distributeur UnifiedPush ntfy n\'agira pas comme un distributeur UnifiedPush Activer le \"UnifiedPush\" - Activer le distributeur - Cela permet aux applications tierces de recevoir des notifications UnifiedPush \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 84d2254da6ca1d0af056f3aca2b5d42ad611b37c..703806f4e65f517ec092b102a229bf264a51d85c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -330,6 +330,4 @@ Default Dona 💸 Le app non possono più essere installate: devono essere scaricate via browser. Vedi l\'issue #531 per dettagli. - Abilitare il distributore - Consente alle applicazioni di terze parti di ricevere notifiche UnifiedPush \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2eddd12399a9ddfb358b51d145969ffe23160769..c775990100879de1a3126eb45d46076f4cb7308e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -391,10 +391,4 @@ Cancel Delete user Save - - - isEnabled - UnifiedPush - Enable the distributor - It allows 3rd party applications to receive UnifiedPush notifications diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e7244948e0c527ee38747b05e0f3f00935cf5c2b..4f0902d86c37b4b055f690801a4fa78c2764b37a 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -30,26 +30,4 @@ rounded 5dp - - - diff --git a/app/src/main/res/values/values.xml b/app/src/main/res/values/values.xml index f94a598b2d38daf1deef74b802097a610cf6446f..1dea3b89f5ffd9809066166acab95bc3323d9e23 100644 --- a/app/src/main/res/values/values.xml +++ b/app/src/main/res/values/values.xml @@ -5,7 +5,7 @@ ntfy - https://ntfy.sh + https://push.murena.com https://github.com/binwiederhier/ntfy/issues diff --git a/app/src/main/res/xml/settings_preferences.xml b/app/src/main/res/xml/settings_preferences.xml deleted file mode 100644 index 6b02c9c4692b64f010b6da9bbd2231194cf530e7..0000000000000000000000000000000000000000 --- a/app/src/main/res/xml/settings_preferences.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 865925819673184777014125ac237b235d5f7ba1..babcca89d4805b23025a18a429302f81ae2d4f26 100644 --- a/build.gradle +++ b/build.gradle @@ -18,8 +18,7 @@ allprojects { repositories { google() mavenCentral() - maven { url 'https://gitlab.e.foundation/api/v4/groups/9/-/packages/maven'} - maven { url "https://jitpack.io" } // For StfalconImageViewer + maven { url 'https://maven.scijava.org/content/repositories/public/' } // For StfalconImageViewer } }