Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
AloqaIM-Android
Commits
6a0c4051
Unverified
Commit
6a0c4051
authored
Nov 23, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Nov 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1859 from RocketChat/feature/room-deep-link
[FEATURE] Notification deeplink to room
parents
cfc98b08
2095a508
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
62 additions
and
50 deletions
+62
-50
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+1
-1
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+20
-0
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+1
-2
FavoriteMessagesPresenter.kt
...avoritemessages/presentation/FavoriteMessagesPresenter.kt
+8
-10
FilesPresenter.kt
.../chat/rocket/android/files/presentation/FilesPresenter.kt
+7
-9
MembersPresenter.kt
...t/rocket/android/members/presentation/MembersPresenter.kt
+8
-10
PinnedMessagesPresenter.kt
...id/pinnedmessages/presentation/PinnedMessagesPresenter.kt
+8
-10
PushManager.kt
app/src/main/java/chat/rocket/android/push/PushManager.kt
+2
-5
FirebaseMessagingService.kt
...java/chat/rocket/android/push/FirebaseMessagingService.kt
+7
-3
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
6a0c4051
...
@@ -137,7 +137,7 @@ class ChatRoomPresenter @Inject constructor(
...
@@ -137,7 +137,7 @@ class ChatRoomPresenter @Inject constructor(
}
finally
{
}
finally
{
// User has at least an 'owner' or 'moderator' role.
// User has at least an 'owner' or 'moderator' role.
val
userCanMod
=
isOwnerOrMod
()
val
userCanMod
=
isOwnerOrMod
()
val
chatRoom
=
retryDB
(
"getRoom($roomId)"
)
{
dbManager
.
getRoom
(
roomId
)
}
val
chatRoom
=
dbManager
.
getRoom
(
roomId
)
val
muted
=
chatRoom
?.
chatRoom
?.
muted
?:
emptyList
()
val
muted
=
chatRoom
?.
chatRoom
?.
muted
?:
emptyList
()
// Can post anyway if has the 'post-readonly' permission on server.
// Can post anyway if has the 'post-readonly' permission on server.
val
userCanPost
=
userCanMod
||
permissions
.
canPostToReadOnlyChannels
()
||
val
userCanPost
=
userCanMod
||
permissions
.
canPostToReadOnlyChannels
()
||
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
6a0c4051
...
@@ -42,6 +42,26 @@ class ChatRoomsPresenter @Inject constructor(
...
@@ -42,6 +42,26 @@ class ChatRoomsPresenter @Inject constructor(
private
val
client
=
manager
.
client
private
val
client
=
manager
.
client
private
val
settings
=
settingsRepository
.
get
(
currentServer
)
private
val
settings
=
settingsRepository
.
get
(
currentServer
)
fun
loadChatRoom
(
roomId
:
String
)
{
launchUI
(
strategy
)
{
view
.
showLoadingRoom
(
""
)
try
{
val
room
=
dbManager
.
getRoom
(
roomId
)
if
(
room
!=
null
)
{
loadChatRoom
(
room
.
chatRoom
,
true
)
}
else
{
Timber
.
d
(
"Error loading channel"
)
view
.
showGenericErrorMessage
()
}
}
catch
(
ex
:
Exception
)
{
Timber
.
d
(
ex
,
"Error loading channel"
)
view
.
showGenericErrorMessage
()
}
finally
{
view
.
hideLoadingRoom
()
}
}
}
fun
loadChatRoom
(
chatRoom
:
RoomUiModel
)
{
fun
loadChatRoom
(
chatRoom
:
RoomUiModel
)
{
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
view
.
showLoadingRoom
(
chatRoom
.
name
)
view
.
showLoadingRoom
(
chatRoom
.
name
)
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
6a0c4051
...
@@ -84,8 +84,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
...
@@ -84,8 +84,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
if
(
bundle
!=
null
)
{
if
(
bundle
!=
null
)
{
chatRoomId
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_ID
)
chatRoomId
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_ID
)
chatRoomId
?.
let
{
chatRoomId
?.
let
{
// TODO - bring back support to load a room from id.
presenter
.
loadChatRoom
(
it
)
//presenter.goToChatRoomWithId(it)
chatRoomId
=
null
chatRoomId
=
null
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/favoritemessages/presentation/FavoriteMessagesPresenter.kt
View file @
6a0c4051
...
@@ -35,16 +35,14 @@ class FavoriteMessagesPresenter @Inject constructor(
...
@@ -35,16 +35,14 @@ class FavoriteMessagesPresenter @Inject constructor(
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
try
{
try
{
view
.
showLoading
()
view
.
showLoading
()
retryDB
(
"getRoom($roomId)"
)
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
val
favoriteMessages
=
val
favoriteMessages
=
client
.
getFavoriteMessages
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
)
client
.
getFavoriteMessages
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
)
val
messageList
=
mapper
.
map
(
favoriteMessages
.
result
,
asNotReversed
=
true
)
val
messageList
=
mapper
.
map
(
favoriteMessages
.
result
,
asNotReversed
=
true
)
view
.
showFavoriteMessages
(
messageList
)
view
.
showFavoriteMessages
(
messageList
)
offset
+=
1
*
30
offset
+=
1
*
30
}.
ifNull
{
}.
ifNull
{
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
}
}
}
}
catch
(
exception
:
RocketChatException
)
{
}
catch
(
exception
:
RocketChatException
)
{
Timber
.
e
(
exception
)
Timber
.
e
(
exception
)
...
...
app/src/main/java/chat/rocket/android/files/presentation/FilesPresenter.kt
View file @
6a0c4051
...
@@ -37,15 +37,13 @@ class FilesPresenter @Inject constructor(
...
@@ -37,15 +37,13 @@ class FilesPresenter @Inject constructor(
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
try
{
try
{
view
.
showLoading
()
view
.
showLoading
()
retryDB
(
"getRoom($roomId)"
)
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
val
files
=
client
.
getFiles
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
)
val
files
=
client
.
getFiles
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
)
val
filesUiModel
=
mapper
.
mapToUiModelList
(
files
.
result
)
val
filesUiModel
=
mapper
.
mapToUiModelList
(
files
.
result
)
view
.
showFiles
(
filesUiModel
,
files
.
total
)
view
.
showFiles
(
filesUiModel
,
files
.
total
)
offset
+=
1
*
30
offset
+=
1
*
30
}.
ifNull
{
}.
ifNull
{
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
}
}
}
}
catch
(
exception
:
RocketChatException
)
{
}
catch
(
exception
:
RocketChatException
)
{
exception
.
message
?.
let
{
exception
.
message
?.
let
{
...
...
app/src/main/java/chat/rocket/android/members/presentation/MembersPresenter.kt
View file @
6a0c4051
...
@@ -37,16 +37,14 @@ class MembersPresenter @Inject constructor(
...
@@ -37,16 +37,14 @@ class MembersPresenter @Inject constructor(
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
try
{
try
{
view
.
showLoading
()
view
.
showLoading
()
retryDB
(
"getRoom($roomId)"
)
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
val
members
=
val
members
=
client
.
getMembers
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
,
60
)
client
.
getMembers
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
,
60
)
val
memberUiModels
=
mapper
.
mapToUiModelList
(
members
.
result
)
val
memberUiModels
=
mapper
.
mapToUiModelList
(
members
.
result
)
view
.
showMembers
(
memberUiModels
,
members
.
total
)
view
.
showMembers
(
memberUiModels
,
members
.
total
)
offset
+=
1
*
60L
offset
+=
1
*
60L
}.
ifNull
{
}.
ifNull
{
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
}
}
}
}
catch
(
exception
:
RocketChatException
)
{
}
catch
(
exception
:
RocketChatException
)
{
exception
.
message
?.
let
{
exception
.
message
?.
let
{
...
...
app/src/main/java/chat/rocket/android/pinnedmessages/presentation/PinnedMessagesPresenter.kt
View file @
6a0c4051
...
@@ -35,16 +35,14 @@ class PinnedMessagesPresenter @Inject constructor(
...
@@ -35,16 +35,14 @@ class PinnedMessagesPresenter @Inject constructor(
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
try
{
try
{
view
.
showLoading
()
view
.
showLoading
()
retryDB
(
"getRoom($roomId)"
)
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
dbManager
.
getRoom
(
roomId
)
?.
let
{
val
pinnedMessages
=
val
pinnedMessages
=
client
.
getPinnedMessages
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
)
client
.
getPinnedMessages
(
roomId
,
roomTypeOf
(
it
.
chatRoom
.
type
),
offset
)
val
messageList
=
mapper
.
map
(
pinnedMessages
.
result
,
asNotReversed
=
true
)
val
messageList
=
mapper
.
map
(
pinnedMessages
.
result
,
asNotReversed
=
true
)
view
.
showPinnedMessages
(
messageList
)
view
.
showPinnedMessages
(
messageList
)
offset
+=
1
*
30
offset
+=
1
*
30
}.
ifNull
{
}.
ifNull
{
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
Timber
.
e
(
"Couldn't find a room with id: $roomId at current server."
)
}
}
}
}
catch
(
exception
:
RocketChatException
)
{
}
catch
(
exception
:
RocketChatException
)
{
Timber
.
e
(
exception
)
Timber
.
e
(
exception
)
...
...
app/src/main/java/chat/rocket/android/push/PushManager.kt
View file @
6a0c4051
...
@@ -296,11 +296,8 @@ class PushManager @Inject constructor(
...
@@ -296,11 +296,8 @@ class PushManager @Inject constructor(
}
}
private
fun
getContentIntent
(
context
:
Context
,
notificationId
:
Int
,
pushMessage
:
PushMessage
,
grouped
:
Boolean
=
false
):
PendingIntent
{
private
fun
getContentIntent
(
context
:
Context
,
notificationId
:
Int
,
pushMessage
:
PushMessage
,
grouped
:
Boolean
=
false
):
PendingIntent
{
val
notificationIntent
=
context
.
changeServerIntent
(
pushMessage
.
info
.
host
,
chatRoomId
=
pushMessage
.
info
.
roomId
)
val
roomId
=
if
(!
grouped
)
pushMessage
.
info
.
roomId
else
null
// TODO - add support to go directly to the chatroom
val
notificationIntent
=
context
.
changeServerIntent
(
pushMessage
.
info
.
host
,
chatRoomId
=
roomId
)
/*if (!isGrouped) {
notificationIntent.putExtra(EXTRA_ROOM_ID, pushMessage.info.roomId)
}*/
return
PendingIntent
.
getActivity
(
context
,
random
.
nextInt
(),
notificationIntent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
)
return
PendingIntent
.
getActivity
(
context
,
random
.
nextInt
(),
notificationIntent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
)
}
}
...
...
app/src/play/java/chat/rocket/android/push/FirebaseMessagingService.kt
View file @
6a0c4051
package
chat.rocket.android.push
package
chat.rocket.android.push
import
android.os.Bundle
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
import
androidx.work.Constraints
import
androidx.work.Constraints
import
androidx.work.NetworkType
import
androidx.work.NetworkType
...
@@ -23,9 +24,12 @@ class FirebaseMessagingService : FirebaseMessagingService() {
...
@@ -23,9 +24,12 @@ class FirebaseMessagingService : FirebaseMessagingService() {
}
}
override
fun
onMessageReceived
(
message
:
RemoteMessage
)
{
override
fun
onMessageReceived
(
message
:
RemoteMessage
)
{
// XXX - for now this is ok, if we start to do network calls, use a Worker instead
message
.
data
?.
let
{
data
->
message
.
data
?.
let
{
val
bundle
=
Bundle
()
pushManager
.
handle
(
bundleOf
(*(
it
.
map
{
Pair
(
it
.
key
,
it
.
value
)
}).
toTypedArray
()))
data
.
entries
.
forEach
{
entry
->
bundle
.
putString
(
entry
.
key
,
entry
.
value
)
}
pushManager
.
handle
(
bundle
)
}
}
}
}
...
...
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