aboutsummaryrefslogtreecommitdiff
path: root/androidApp
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-12-14 18:14:39 -0600
committerIván Ávalos <avalos@disroot.org>2022-12-14 18:14:39 -0600
commitd533c9684fb6b3f004656a7862c43e6cd9b69ede (patch)
treef6fa5ec62c1435d52fc6bc1e1e5b074bc3a64520 /androidApp
parent9b6aede19fc0dd89b991fcbbe2294b27b2cc1280 (diff)
parentfacf751f941a2f85d0ce236c4a61f21e84758199 (diff)
downloadetbsa-trackermap-mobile-d533c9684fb6b3f004656a7862c43e6cd9b69ede.tar.gz
etbsa-trackermap-mobile-d533c9684fb6b3f004656a7862c43e6cd9b69ede.tar.bz2
etbsa-trackermap-mobile-d533c9684fb6b3f004656a7862c43e6cd9b69ede.zip
Merge branch 'main' of https://git.sr.ht/~avalos/trackermap-mobile
Diffstat (limited to 'androidApp')
-rw-r--r--androidApp/build.gradle.kts2
-rw-r--r--androidApp/src/google/java/ManagerMessagingService.kt18
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/Utils.kt16
3 files changed, 17 insertions, 19 deletions
diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts
index 803e563..655676e 100644
--- a/androidApp/build.gradle.kts
+++ b/androidApp/build.gradle.kts
@@ -15,7 +15,7 @@ android {
versionName = "1.3.2"
ndk {
abiFilters.clear()
- abiFilters += listOf("armeabi-v7a", "arm64-v8a")
+ //abiFilters += listOf("armeabi-v7a", "arm64-v8a")
}
}
buildTypes {
diff --git a/androidApp/src/google/java/ManagerMessagingService.kt b/androidApp/src/google/java/ManagerMessagingService.kt
index 9ac4636..ff6c65f 100644
--- a/androidApp/src/google/java/ManagerMessagingService.kt
+++ b/androidApp/src/google/java/ManagerMessagingService.kt
@@ -16,13 +16,15 @@
package mx.trackermap.TrackerMap.android
import android.annotation.SuppressLint
+import android.app.NotificationManager
import android.app.PendingIntent
+import android.content.Context
import android.content.Intent
import android.os.Build
+import androidx.core.app.NotificationCompat
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import kotlinx.coroutines.DelicateCoroutinesApi
-import mx.trackermap.TrackerMap.android.shared.Utils
import mx.trackermap.TrackerMap.android.units.UnitsActivity
import kotlin.time.ExperimentalTime
@@ -30,6 +32,18 @@ import kotlin.time.ExperimentalTime
@ExperimentalTime
class ManagerMessagingService : FirebaseMessagingService() {
+ private fun showNotification(context: Context, id: Int, body: String?, pendingIntent: PendingIntent) {
+ val builder = NotificationCompat.Builder(context, context.getString(R.string.notification_channel_id))
+ .setSmallIcon(R.drawable.icon_notify)
+ .setContentTitle(context.getString(R.string.app_name))
+ .setContentText(body)
+ .setAutoCancel(true)
+ .setContentIntent(pendingIntent)
+ (context.getSystemService(NOTIFICATION_SERVICE)
+ as NotificationManager)
+ .notify(id, builder.build())
+ }
+
@SuppressLint("UnspecifiedImmutableFlag")
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
@@ -40,7 +54,7 @@ class ManagerMessagingService : FirebaseMessagingService() {
}
val intent = Intent(this, UnitsActivity::class.java)
val pendingIntent = PendingIntent.getActivity(this, 0, intent, flags)
- Utils.showNotification(
+ showNotification(
this,
remoteMessage.hashCode(),
remoteMessage.notification?.body,
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/Utils.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/Utils.kt
index ac9673f..dfe0681 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/Utils.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/Utils.kt
@@ -17,17 +17,13 @@
*/
package mx.trackermap.TrackerMap.android.shared
-import android.app.NotificationManager
-import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.util.Log
import android.view.View
import androidx.appcompat.widget.PopupMenu
-import androidx.core.app.NotificationCompat
import androidx.core.app.ShareCompat
import androidx.core.content.FileProvider
-import com.google.firebase.messaging.FirebaseMessagingService
import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.client.models.MapLayer
import java.io.BufferedOutputStream
@@ -99,17 +95,5 @@ class Utils {
return cacheFile
}
-
- fun showNotification(context: Context, id: Int, body: String?, pendingIntent: PendingIntent) {
- val builder = NotificationCompat.Builder(context, context.getString(R.string.notification_channel_id))
- .setSmallIcon(R.drawable.icon_notify)
- .setContentTitle(context.getString(R.string.app_name))
- .setContentText(body)
- .setAutoCancel(true)
- .setContentIntent(pendingIntent)
- (context.getSystemService(FirebaseMessagingService.NOTIFICATION_SERVICE)
- as NotificationManager)
- .notify(id, builder.build())
- }
}
} \ No newline at end of file