Compare commits
5 commits
0000-u-use
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
3fb7e6427f | ||
|
afeebcc4d1 | ||
|
9add68ed1a | ||
|
18fb197507 | ||
|
7c00376ae1 |
10 changed files with 21 additions and 40 deletions
|
@ -10,7 +10,7 @@ android {
|
|||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.heckel.ntfy"
|
||||
applicationId "foundation.e.ntfy"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 33
|
||||
|
||||
|
@ -68,6 +68,7 @@ android {
|
|||
'-Xjvm-default=all-compatibility' // https://stackoverflow.com/a/71234042/1440785
|
||||
]
|
||||
}
|
||||
namespace "io.heckel.ntfy"
|
||||
}
|
||||
|
||||
// Disables GoogleServices tasks for F-Droid variant
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.heckel.ntfy">
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- Permissions -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
@ -12,8 +11,6 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/> <!-- Only required on SDK <= 28 -->
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/> <!-- To reschedule the websocket retry -->
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <!-- As of Android 13, we need to ask for permission to post notifications -->
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<!--
|
||||
Permission REQUEST_INSTALL_PACKAGES (F-Droid only!):
|
||||
|
@ -182,14 +179,12 @@
|
|||
|
||||
<activity
|
||||
android:name=".ui.MainSettingsActivity"
|
||||
android:theme="@style/PreferenceTheme"
|
||||
android:process=":ui"/>
|
||||
android:theme="@style/PreferenceTheme"/>
|
||||
|
||||
<activity-alias
|
||||
android:name=".ui.SettingsActivityLink"
|
||||
android:exported="true"
|
||||
android:label="@string/eos_settings_title"
|
||||
android:process=":ui"
|
||||
android:targetActivity=".ui.MainSettingsActivity">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.EXTRA_SETTINGS" />
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.os.Build
|
|||
import android.os.IBinder
|
||||
import android.os.PowerManager
|
||||
import android.os.SystemClock
|
||||
import android.provider.Settings
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
|
@ -95,14 +94,8 @@ class SubscriberService : Service() {
|
|||
override fun onDestroy() {
|
||||
Log.d(TAG, "Subscriber service has been destroyed")
|
||||
stopService()
|
||||
|
||||
val isEnabled = Settings.Global.getInt(
|
||||
applicationContext.contentResolver,
|
||||
applicationContext.getString(R.string.eos_preference_key_is_enabled),
|
||||
0
|
||||
)
|
||||
|
||||
if (isEnabled == 1) {
|
||||
val preferenceKey = getString(R.string.eos_preference_key_is_enabled)
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(preferenceKey, false)) {
|
||||
sendBroadcast(Intent(this, AutoRestartReceiver::class.java))
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package io.heckel.ntfy.service
|
|||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.provider.Settings
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.work.*
|
||||
import io.heckel.ntfy.app.Application
|
||||
|
@ -23,7 +22,6 @@ import kotlinx.coroutines.withContext
|
|||
class SubscriberServiceManager(private val context: Context) {
|
||||
fun refresh() {
|
||||
Log.d(TAG, "Enqueuing work to refresh subscriber service")
|
||||
|
||||
val workManager = WorkManager.getInstance(context)
|
||||
val startServiceRequest = OneTimeWorkRequest.Builder(ServiceStartWorker::class.java).build()
|
||||
workManager.enqueueUniqueWork(WORK_NAME_ONCE, ExistingWorkPolicy.KEEP, startServiceRequest) // Unique avoids races!
|
||||
|
@ -48,14 +46,10 @@ class SubscriberServiceManager(private val context: Context) {
|
|||
}
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
|
||||
val isEnabled = Settings.Global.getInt(
|
||||
context.contentResolver,
|
||||
context.getString(R.string.eos_preference_key_is_enabled),
|
||||
0
|
||||
)
|
||||
|
||||
val action = if (isEnabled == 1) {
|
||||
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
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package io.heckel.ntfy.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
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() {
|
||||
|
||||
|
@ -18,13 +23,6 @@ class PreferencesFragment : PreferenceFragmentCompat() {
|
|||
|
||||
preference?.setOnPreferenceChangeListener { _, newValue ->
|
||||
val isChecked = newValue as Boolean
|
||||
|
||||
Settings.Global.putInt(
|
||||
requireContext().contentResolver,
|
||||
requireContext().getString(R.string.eos_preference_key_is_enabled),
|
||||
if (isChecked) 1 else 0
|
||||
)
|
||||
|
||||
val intent = Intent(context, SubscriberService::class.java)
|
||||
intent.action = if (isChecked) {
|
||||
SubscriberService.Action.START.name
|
||||
|
|
|
@ -343,6 +343,6 @@
|
|||
<string name="settings_advanced_unifiedpush_summary_disabled">ntfy arbeitet nicht als UnifiedPush-Distributor</string>
|
||||
<string name="settings_advanced_unifiedpush_title">UnifiedPush aktivieren</string>
|
||||
<string name="settings_advanced_unifiedpush_summary_enabled">ntfy arbeitet als UnifiedPush-Distributor</string>
|
||||
<string name="eos_settings_enable_title">UnifiedPush-Distributor aktivieren</string>
|
||||
<string name="eos_settings_enable_title">Den Verteiler aktivieren</string>
|
||||
<string name="eos_settings_enable_description">Es ermöglicht Drittanbieteranwendungen, UnifiedPush-Benachrichtigungen zu empfangen</string>
|
||||
</resources>
|
|
@ -343,6 +343,6 @@
|
|||
<string name="settings_advanced_unifiedpush_title">Activar UnifiedPush</string>
|
||||
<string name="settings_advanced_unifiedpush_summary_enabled">ntfy actuará como distribuidor UnifiedPush</string>
|
||||
<string name="settings_advanced_unifiedpush_summary_disabled">ntfy no actuará como distribuidor UnifiedPush</string>
|
||||
<string name="eos_settings_enable_title">Habilitar el distribuidor de UnifiedPush</string>
|
||||
<string name="eos_settings_enable_title">Habilitar el distribuidor</string>
|
||||
<string name="eos_settings_enable_description">Permite a las aplicaciones de terceros recibir notificaciones de UnifiedPush</string>
|
||||
</resources>
|
|
@ -343,6 +343,6 @@
|
|||
<string name="settings_advanced_unifiedpush_summary_enabled">ntfy agira comme un distributeur UnifiedPush</string>
|
||||
<string name="settings_advanced_unifiedpush_summary_disabled">ntfy n\'agira pas comme un distributeur UnifiedPush</string>
|
||||
<string name="settings_advanced_unifiedpush_title">Activer le \"UnifiedPush\"</string>
|
||||
<string name="eos_settings_enable_title">Activer le distributeur UnifiedPush</string>
|
||||
<string name="eos_settings_enable_title">Activer le distributeur</string>
|
||||
<string name="eos_settings_enable_description">Cela permet aux applications tierces de recevoir des notifications UnifiedPush</string>
|
||||
</resources>
|
|
@ -330,6 +330,6 @@
|
|||
<string name="channel_notifications_group_default_name">Default</string>
|
||||
<string name="main_menu_donate_title">Dona 💸</string>
|
||||
<string name="detail_item_cannot_open_apk">Le app non possono più essere installate: devono essere scaricate via browser. Vedi l\'issue #531 per dettagli.</string>
|
||||
<string name="eos_settings_enable_title">Abilita il distributore UnifiedPush</string>
|
||||
<string name="eos_settings_enable_title">Abilitare il distributore</string>
|
||||
<string name="eos_settings_enable_description">Consente alle applicazioni di terze parti di ricevere notifiche UnifiedPush</string>
|
||||
</resources>
|
|
@ -395,6 +395,6 @@
|
|||
<!-- /e/OS integration preferences -->
|
||||
<string name="eos_preference_key_is_enabled" translatable="false">isEnabled</string>
|
||||
<string name="eos_settings_title" translatable="false">UnifiedPush</string>
|
||||
<string name="eos_settings_enable_title" translatable="true">Enable UnifiedPush distributor</string>
|
||||
<string name="eos_settings_enable_title" translatable="true">Enable the distributor</string>
|
||||
<string name="eos_settings_enable_description" translatable="true">It allows 3rd party applications to receive UnifiedPush notifications</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue