aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/google
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-20 01:26:29 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-20 01:26:29 -0600
commitecc818705b9b523dbd1a85f017d14ba0d017849b (patch)
tree556f1c62fb22ad0bc85720985a0fcc1137989e96 /androidApp/src/google
parent5472556161c2f781e7a0dabe48301f3b665641b1 (diff)
downloadetbsa-trackermap-mobile-ecc818705b9b523dbd1a85f017d14ba0d017849b.tar.gz
etbsa-trackermap-mobile-ecc818705b9b523dbd1a85f017d14ba0d017849b.tar.bz2
etbsa-trackermap-mobile-ecc818705b9b523dbd1a85f017d14ba0d017849b.zip
Properly implemented save and share report actions
Diffstat (limited to 'androidApp/src/google')
-rw-r--r--androidApp/src/google/AndroidManifest.xml15
-rw-r--r--androidApp/src/google/java/ManagerMessagingService.kt19
2 files changed, 23 insertions, 11 deletions
diff --git a/androidApp/src/google/AndroidManifest.xml b/androidApp/src/google/AndroidManifest.xml
index f7aea6c..ce72a8b 100644
--- a/androidApp/src/google/AndroidManifest.xml
+++ b/androidApp/src/google/AndroidManifest.xml
@@ -7,7 +7,10 @@
<application
android:name=".GoogleMainApplication"
tools:replace="android:name"
- tools:ignore="GoogleAppIndexingWarning">
+ tools:ignore="GoogleAppIndexingWarning"
+ android:allowBackup="false"
+ android:icon="@mipmap/ic_launcher"
+ android:fullBackupContent="false">
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
@@ -23,6 +26,16 @@
</intent-filter>
</service>
+ <provider
+ android:authorities="${applicationId}.fileprovider"
+ android:name="androidx.core.content.FileProvider"
+ android:exported="false"
+ android:grantUriPermissions="true">
+ <meta-data
+ android:name="android.support.FILE_PROVIDER_PATHS"
+ android:resource="@xml/filepaths" />
+ </provider>
+
</application>
</manifest>
diff --git a/androidApp/src/google/java/ManagerMessagingService.kt b/androidApp/src/google/java/ManagerMessagingService.kt
index 07ee427..9ac4636 100644
--- a/androidApp/src/google/java/ManagerMessagingService.kt
+++ b/androidApp/src/google/java/ManagerMessagingService.kt
@@ -16,14 +16,13 @@
package mx.trackermap.TrackerMap.android
import android.annotation.SuppressLint
-import android.app.NotificationManager
import android.app.PendingIntent
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
@@ -39,14 +38,14 @@ class ManagerMessagingService : FirebaseMessagingService() {
} else {
PendingIntent.FLAG_ONE_SHOT
}
- val pendingIntent = PendingIntent.getActivity(this, 0, Intent(this, UnitsActivity::class.java), flags)
- val builder = NotificationCompat.Builder(this, getString(R.string.notification_channel_id))
- .setSmallIcon(R.drawable.icon_notify)
- .setContentTitle(getString(R.string.app_name))
- .setContentText(remoteMessage.notification?.body)
- .setAutoCancel(true)
- .setContentIntent(pendingIntent)
- (getSystemService(NOTIFICATION_SERVICE) as NotificationManager).notify(remoteMessage.hashCode(), builder.build())
+ val intent = Intent(this, UnitsActivity::class.java)
+ val pendingIntent = PendingIntent.getActivity(this, 0, intent, flags)
+ Utils.showNotification(
+ this,
+ remoteMessage.hashCode(),
+ remoteMessage.notification?.body,
+ pendingIntent
+ )
}
override fun onNewToken(token: String) {