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 06e2587..882d250 100644
--- a/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt
+++ b/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt
@@ -4,7 +4,10 @@ import android.app.*
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
-import android.os.*
+import android.os.Build
+import android.os.IBinder
+import android.os.PowerManager
+import android.os.SystemClock
import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
@@ -17,7 +20,9 @@ import io.heckel.ntfy.msg.ApiService
import io.heckel.ntfy.msg.NotificationDispatcher
import io.heckel.ntfy.ui.MainActivity
import io.heckel.ntfy.util.topicUrl
-import kotlinx.coroutines.*
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
import java.util.concurrent.ConcurrentHashMap
@@ -80,7 +85,11 @@ class SubscriberService : Service() {
Log.d(TAG, "Subscriber service has been created")
val title = getString(R.string.channel_subscriber_notification_title)
- val text = getString(R.string.channel_subscriber_notification_text)
+ val text = if (BuildConfig.FIREBASE_AVAILABLE) {
+ getString(R.string.channel_subscriber_notification_instant_text)
+ } else {
+ getString(R.string.channel_subscriber_notification_noinstant_text)
+ }
notificationManager = createNotificationChannel()
serviceNotification = createNotification(title, text)
@@ -184,12 +193,22 @@ class SubscriberService : Service() {
if (connections.size > 0) {
synchronized(this) {
val title = getString(R.string.channel_subscriber_notification_title)
- val text = when (instantSubscriptions.size) {
- 1 -> getString(R.string.channel_subscriber_notification_text_one)
- 2 -> getString(R.string.channel_subscriber_notification_text_two)
- 3 -> getString(R.string.channel_subscriber_notification_text_three)
- 4 -> getString(R.string.channel_subscriber_notification_text_four)
- else -> getString(R.string.channel_subscriber_notification_text_more, instantSubscriptions.size)
+ val text = if (BuildConfig.FIREBASE_AVAILABLE) {
+ when (instantSubscriptions.size) {
+ 1 -> getString(R.string.channel_subscriber_notification_instant_text_one)
+ 2 -> getString(R.string.channel_subscriber_notification_instant_text_two)
+ 3 -> getString(R.string.channel_subscriber_notification_instant_text_three)
+ 4 -> getString(R.string.channel_subscriber_notification_instant_text_four)
+ else -> getString(R.string.channel_subscriber_notification_instant_text_more, instantSubscriptions.size)
+ }
+ } else {
+ when (instantSubscriptions.size) {
+ 1 -> getString(R.string.channel_subscriber_notification_noinstant_text_one)
+ 2 -> getString(R.string.channel_subscriber_notification_noinstant_text_two)
+ 3 -> getString(R.string.channel_subscriber_notification_noinstant_text_three)
+ 4 -> getString(R.string.channel_subscriber_notification_noinstant_text_four)
+ else -> getString(R.string.channel_subscriber_notification_noinstant_text_more, instantSubscriptions.size)
+ }
}
serviceNotification = createNotification(title, text)
notificationManager?.notify(NOTIFICATION_SERVICE_ID, serviceNotification)
diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt
index fe77540..d2bf37e 100644
--- a/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt
+++ b/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt
@@ -23,14 +23,11 @@ import io.heckel.ntfy.BuildConfig
import io.heckel.ntfy.R
import io.heckel.ntfy.app.Application
import io.heckel.ntfy.data.Notification
-import io.heckel.ntfy.util.topicShortUrl
-import io.heckel.ntfy.util.topicUrl
import io.heckel.ntfy.firebase.FirebaseMessenger
import io.heckel.ntfy.msg.ApiService
import io.heckel.ntfy.msg.NotificationService
import io.heckel.ntfy.service.SubscriberServiceManager
-import io.heckel.ntfy.util.fadeStatusBarColor
-import io.heckel.ntfy.util.formatDateShort
+import io.heckel.ntfy.util.*
import kotlinx.coroutines.*
import java.util.*
import kotlin.random.Random
@@ -401,7 +398,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
} else {
enableInstantItem?.isVisible = false
disableInstantItem?.isVisible = false
- instantInfoItem?.isVisible = true
+ instantInfoItem?.isVisible = BuildConfig.FIREBASE_AVAILABLE
}
}
}
diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt b/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt
index 72c926e..8aa0928 100644
--- a/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt
+++ b/app/src/main/java/io/heckel/ntfy/ui/MainAdapter.kt
@@ -8,6 +8,7 @@ import android.widget.TextView
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
+import io.heckel.ntfy.BuildConfig
import io.heckel.ntfy.R
import io.heckel.ntfy.data.ConnectionState
import io.heckel.ntfy.data.Repository
@@ -89,7 +90,7 @@ class MainAdapter(private val repository: Repository, private val onClick: (Subs
dateView.visibility = if (isUnifiedPush) View.GONE else View.VISIBLE
notificationDisabledUntilImageView.visibility = if (showMutedUntilIcon) View.VISIBLE else View.GONE
notificationDisabledForeverImageView.visibility = if (showMutedForeverIcon) View.VISIBLE else View.GONE
- instantImageView.visibility = if (subscription.instant) View.VISIBLE else View.GONE
+ instantImageView.visibility = if (subscription.instant && BuildConfig.FIREBASE_AVAILABLE) View.VISIBLE else View.GONE
if (isUnifiedPush || subscription.newCount == 0) {
newItemsView.visibility = View.GONE
} else {
diff --git a/app/src/main/java/io/heckel/ntfy/util/Util.kt b/app/src/main/java/io/heckel/ntfy/util/Util.kt
index 82b4586..5622cb5 100644
--- a/app/src/main/java/io/heckel/ntfy/util/Util.kt
+++ b/app/src/main/java/io/heckel/ntfy/util/Util.kt
@@ -184,3 +184,4 @@ fun formatBytes(bytes: Long, decimals: Int = 1): String {
fun supportedImage(mimeType: String?): Boolean {
return listOf("image/jpeg", "image/png").contains(mimeType)
}
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0e91b5d..fda0730 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -13,12 +13,18 @@
Notifications (Max Priority)
Subscription Service
Listening for incoming notifications
- You are subscribed to instant delivery topics
- You are subscribed to one instant delivery topic
- You are subscribed to two instant delivery topics
- You are subscribed to three instant delivery topics
- You are subscribed to four instant delivery topics
- You are subscribed to %1$d instant delivery topics
+ You are subscribed to instant delivery topics
+ You are subscribed to one instant delivery topic
+ You are subscribed to two instant delivery topics
+ You are subscribed to three instant delivery topics
+ You are subscribed to four instant delivery topics
+ You are subscribed to %1$d instant delivery topics
+ You are subscribed to topics
+ You are subscribed to one topic
+ You are subscribed to two topics
+ You are subscribed to three topics
+ You are subscribed to four topics
+ You are subscribed to %1$d topics
%1$d notification(s) received
diff --git a/build.gradle b/build.gradle
index 2963adf..59568af 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.0'
+ classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10' // This is removed in the "fdroid" flavor