Loading app/src/main/java/io/heckel/ntfy/msg/NotificationDispatcher.kt +4 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ import io.heckel.ntfy.data.Subscription import io.heckel.ntfy.up.Distributor import io.heckel.ntfy.util.safeLet /** * The notification dispatcher figures out what to do with a notification. * It may display a notification, send out a broadcast, or forward via UnifiedPush. */ class NotificationDispatcher(val context: Context, val repository: Repository) { private val notifier = NotificationService(context) private val broadcaster = BroadcastService(context) Loading Loading @@ -48,8 +52,4 @@ class NotificationDispatcher(val context: Context, val repository: Repository) { } return subscription.mutedUntil == 1L || (subscription.mutedUntil > 1L && subscription.mutedUntil > System.currentTimeMillis()/1000) } companion object { private const val TAG = "NtfyNotificationDispatcher" } } app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +1 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra private val repository by lazy { (application as Application).repository } private val api = ApiService() private val messenger = FirebaseMessenger() private var serviceManager: SubscriberServiceManager? = null // Context-dependent private var notifier: NotificationService? = null // Context-dependent private var appBaseUrl: String? = null // Context-dependent Loading @@ -69,7 +68,6 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra Log.d(MainActivity.TAG, "Create $this") // Dependencies that depend on Context serviceManager = SubscriberServiceManager(this) notifier = NotificationService(this) appBaseUrl = getString(R.string.app_base_url) Loading Loading @@ -146,7 +144,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra // React to changes in fast delivery setting repository.getSubscriptionIdsWithInstantStatusLiveData().observe(this) { serviceManager?.refresh() SubscriberServiceManager.refresh(this) } // Mark this subscription as "open" so we don't receive notifications for it Loading app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt +1 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc private var actionMode: ActionMode? = null private var workManager: WorkManager? = null // Context-dependent private var dispatcher: NotificationDispatcher? = null // Context-dependent private var serviceManager: SubscriberServiceManager? = null // Context-dependent private var appBaseUrl: String? = null // Context-dependent override fun onCreate(savedInstanceState: Bundle?) { Loading @@ -66,7 +65,6 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc // Dependencies that depend on Context workManager = WorkManager.getInstance(this) dispatcher = NotificationDispatcher(this, repository) serviceManager = SubscriberServiceManager(this) appBaseUrl = getString(R.string.app_base_url) // Action bar Loading Loading @@ -107,7 +105,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc // React to changes in instant delivery setting viewModel.listIdsWithInstantStatus().observe(this) { serviceManager?.refresh() SubscriberServiceManager.refresh(this) } // Create notification channels right away, so we can configure them immediately after installing the app Loading Loading
app/src/main/java/io/heckel/ntfy/msg/NotificationDispatcher.kt +4 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,10 @@ import io.heckel.ntfy.data.Subscription import io.heckel.ntfy.up.Distributor import io.heckel.ntfy.util.safeLet /** * The notification dispatcher figures out what to do with a notification. * It may display a notification, send out a broadcast, or forward via UnifiedPush. */ class NotificationDispatcher(val context: Context, val repository: Repository) { private val notifier = NotificationService(context) private val broadcaster = BroadcastService(context) Loading Loading @@ -48,8 +52,4 @@ class NotificationDispatcher(val context: Context, val repository: Repository) { } return subscription.mutedUntil == 1L || (subscription.mutedUntil > 1L && subscription.mutedUntil > System.currentTimeMillis()/1000) } companion object { private const val TAG = "NtfyNotificationDispatcher" } }
app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt +1 −3 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra private val repository by lazy { (application as Application).repository } private val api = ApiService() private val messenger = FirebaseMessenger() private var serviceManager: SubscriberServiceManager? = null // Context-dependent private var notifier: NotificationService? = null // Context-dependent private var appBaseUrl: String? = null // Context-dependent Loading @@ -69,7 +68,6 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra Log.d(MainActivity.TAG, "Create $this") // Dependencies that depend on Context serviceManager = SubscriberServiceManager(this) notifier = NotificationService(this) appBaseUrl = getString(R.string.app_base_url) Loading Loading @@ -146,7 +144,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra // React to changes in fast delivery setting repository.getSubscriptionIdsWithInstantStatusLiveData().observe(this) { serviceManager?.refresh() SubscriberServiceManager.refresh(this) } // Mark this subscription as "open" so we don't receive notifications for it Loading
app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt +1 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc private var actionMode: ActionMode? = null private var workManager: WorkManager? = null // Context-dependent private var dispatcher: NotificationDispatcher? = null // Context-dependent private var serviceManager: SubscriberServiceManager? = null // Context-dependent private var appBaseUrl: String? = null // Context-dependent override fun onCreate(savedInstanceState: Bundle?) { Loading @@ -66,7 +65,6 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc // Dependencies that depend on Context workManager = WorkManager.getInstance(this) dispatcher = NotificationDispatcher(this, repository) serviceManager = SubscriberServiceManager(this) appBaseUrl = getString(R.string.app_base_url) // Action bar Loading Loading @@ -107,7 +105,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc // React to changes in instant delivery setting viewModel.listIdsWithInstantStatus().observe(this) { serviceManager?.refresh() SubscriberServiceManager.refresh(this) } // Create notification channels right away, so we can configure them immediately after installing the app Loading