Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
e26e797b
Commit
e26e797b
authored
Apr 21, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix noty type
parent
fa3948b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
RoomParkMessageService.kt
...om/biganto/visual/roompark/data/RoomParkMessageService.kt
+9
-2
NotificationCenter.kt
.../roompark/data/service/notification/NotificationCenter.kt
+18
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/data/RoomParkMessageService.kt
View file @
e26e797b
package
com.biganto.visual.roompark.data
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.data.service.notification.INotificationCenter
import
com.google.firebase.messaging.FirebaseMessagingService
import
com.google.firebase.messaging.RemoteMessage
...
...
@@ -12,6 +13,11 @@ class RoomParkMessageService : FirebaseMessagingService() {
@Inject
lateinit
var
notyCenter
:
INotificationCenter
init
{
notyCenter
=
RoomParkApplication
.
component
.
provideNotifivations
()
}
override
fun
onNewToken
(
p0
:
String
)
{
super
.
onNewToken
(
p0
)
Timber
.
d
(
"NEW TOKEN REGISTERED: ${p0}"
)
...
...
@@ -24,7 +30,7 @@ class RoomParkMessageService : FirebaseMessagingService() {
// Check if message contains a data payload.
if
(
remoteMessage
.
data
.
size
>
0
)
{
Timber
.
d
(
"Message data payload: %s"
,
remoteMessage
.
data
)
notyCenter
.
showPushNotifyMessage
(
remoteMessage
.
notification
?.
body
?:
"Уведомление"
)
if
(
/* Check if data needs to be processed by long running job */
true
)
{
// For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.
// scheduleJob()
}
else
{
// Handle message within 10 seconds
...
...
@@ -33,7 +39,8 @@ class RoomParkMessageService : FirebaseMessagingService() {
}
// Check if message contains a notification payload.
if
(
remoteMessage
.
notification
!=
null
)
{
Timber
.
d
(
"Message Notification Body: %s"
,
remoteMessage
.
notification
!!
.
body
)
Timber
.
d
(
"Message Notification Body: %s"
,
remoteMessage
.
notification
?.
body
)
notyCenter
.
showPushNotifyMessage
(
remoteMessage
.
notification
?.
body
?:
"Уведомление"
)
}
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated. See sendNotification method below.
...
...
app/src/main/java/com/biganto/visual/roompark/data/service/notification/NotificationCenter.kt
View file @
e26e797b
...
...
@@ -131,12 +131,28 @@ class NotificationCenter @Inject constructor(val context: Application) : INotif
override
fun
showPushNotifyMessage
(
message
:
String
){
val
pendingIntent
=
PendingIntent
.
getActivity
(
context
,
PENDING_REQUEST_CODE
,
toDownloadsIntent
,
PendingIntent
.
FLAG_ONE_SHOT
)
val
noty
=
pushNotyBuilder
.
setContentTitle
(
context
.
getString
(
R
.
string
.
notification_content_title
))
//getString(R.string.app_name))
.
setPriority
(
NotificationCompat
.
PRIORITY_HIGH
)
.
setSmallIcon
(
R
.
mipmap
.
ic_launcher
)
.
setContentText
(
message
)
.
setColor
(
notificationSystemColor
)
.
setContentTitle
(
context
.
getString
(
R
.
string
.
notification_content_title
))
.
setContentIntent
(
pendingIntent
)
.
setContentText
(
message
)
.
setStyle
(
NotificationCompat
.
BigTextStyle
()
.
setBigContentTitle
(
context
.
getString
(
R
.
string
.
notification_content_title
))
.
bigText
(
message
))
.
setAutoCancel
(
true
)
.
build
()
actualNotifyManager
.
notify
(
...
...
@@ -168,7 +184,7 @@ class NotificationCenter @Inject constructor(val context: Application) : INotif
.
setColor
(
notificationSystemColor
)
.
setLargeIcon
(
icon
)
.
setContentIntent
(
pendingIntent
)
.
setAutoCancel
(
fals
e
)
.
setAutoCancel
(
tru
e
)
.
build
()
actualNotifyManager
.
notify
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment