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
bc8f66aa
Commit
bc8f66aa
authored
May 28, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hop to chat room when notification tapping
parent
e1a7dc32
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
18 deletions
+58
-18
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+6
-0
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+30
-5
MainNavigator.kt
...va/chat/rocket/android/main/presentation/MainNavigator.kt
+3
-3
MainPresenter.kt
...va/chat/rocket/android/main/presentation/MainPresenter.kt
+1
-1
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+5
-1
PushManager.kt
app/src/main/java/chat/rocket/android/push/PushManager.kt
+1
-2
ChangeServerNavigator.kt
...cket/android/server/presentation/ChangeServerNavigator.kt
+5
-2
ChangeServerPresenter.kt
...cket/android/server/presentation/ChangeServerPresenter.kt
+2
-2
ChangeServerActivity.kt
...ava/chat/rocket/android/server/ui/ChangeServerActivity.kt
+5
-2
No files found.
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
bc8f66aa
...
...
@@ -640,4 +640,10 @@ class ChatRoomsPresenter @Inject constructor(
manager
.
removeRoomsAndSubscriptionsChannel
(
subscriptionsChannel
)
manager
.
removeActiveUserChannel
(
activeUserChannel
)
}
fun
goToChatRoomWithId
(
chatRoomId
:
String
)
{
launchUI
(
strategy
)
{
chatRoomsInteractor
.
getById
(
currentServer
,
chatRoomId
)
?.
let
{
loadChatRoom
(
it
)
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
bc8f66aa
package
chat.rocket.android.chatrooms.ui
import
android.app.AlertDialog
import
android.content.Context
import
android.content.SharedPreferences
import
android.os.Bundle
import
android.os.Handler
import
android.support.v4.app.Fragment
...
...
@@ -11,7 +9,12 @@ import android.support.v7.util.DiffUtil
import
android.support.v7.widget.DefaultItemAnimator
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.SearchView
import
android.view.*
import
android.view.LayoutInflater
import
android.view.Menu
import
android.view.MenuInflater
import
android.view.MenuItem
import
android.view.View
import
android.view.ViewGroup
import
android.widget.CheckBox
import
android.widget.RadioGroup
import
androidx.core.view.isVisible
...
...
@@ -24,7 +27,12 @@ import chat.rocket.android.helper.SharedPreferenceHelper
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.SettingsRepository
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.widget.DividerItemDecoration
import
chat.rocket.common.model.RoomType
import
chat.rocket.core.internal.realtime.socket.model.State
...
...
@@ -36,6 +44,8 @@ import kotlinx.coroutines.experimental.NonCancellable.isActive
import
timber.log.Timber
import
javax.inject.Inject
private
const
val
BUNDLE_CHAT_ROOM_ID
=
"BUNDLE_CHAT_ROOM_ID"
class
ChatRoomsFragment
:
Fragment
(),
ChatRoomsView
{
@Inject
lateinit
var
presenter
:
ChatRoomsPresenter
...
...
@@ -50,15 +60,30 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
private
var
listJob
:
Job
?
=
null
private
var
sectionedAdapter
:
SimpleSectionedRecyclerViewAdapter
?
=
null
private
var
chatRoomId
:
String
?
=
null
companion
object
{
fun
newInstance
()
=
ChatRoomsFragment
()
fun
newInstance
(
chatRoomId
:
String
?
=
null
):
ChatRoomsFragment
{
return
ChatRoomsFragment
().
apply
{
arguments
=
Bundle
(
1
).
apply
{
putString
(
BUNDLE_CHAT_ROOM_ID
,
chatRoomId
)
}
}
}
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
AndroidSupportInjection
.
inject
(
this
)
setHasOptionsMenu
(
true
)
val
bundle
=
arguments
if
(
bundle
!=
null
)
{
chatRoomId
=
bundle
.
getString
(
BUNDLE_CHAT_ROOM_ID
)
chatRoomId
?.
let
{
presenter
.
goToChatRoomWithId
(
it
)
chatRoomId
=
null
}
}
}
override
fun
onDestroy
()
{
...
...
app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt
View file @
bc8f66aa
...
...
@@ -12,9 +12,9 @@ import chat.rocket.android.util.extensions.addFragment
class
MainNavigator
(
internal
val
activity
:
MainActivity
)
{
fun
toChatList
()
{
fun
toChatList
(
chatRoomId
:
String
?
=
null
)
{
activity
.
addFragment
(
"ChatRoomsFragment"
,
R
.
id
.
fragment_container
)
{
ChatRoomsFragment
.
newInstance
()
ChatRoomsFragment
.
newInstance
(
chatRoomId
)
}
}
...
...
@@ -43,7 +43,7 @@ class MainNavigator(internal val activity: MainActivity) {
}
fun
toNewServer
(
serverUrl
:
String
?
=
null
)
{
activity
.
startActivity
(
activity
.
changeServerIntent
(
serverUrl
))
activity
.
startActivity
(
activity
.
changeServerIntent
(
serverUrl
=
serverUrl
))
activity
.
finish
()
}
...
...
app/src/main/java/chat/rocket/android/main/presentation/MainPresenter.kt
View file @
bc8f66aa
...
...
@@ -49,7 +49,7 @@ class MainPresenter @Inject constructor(
private
val
userDataChannel
=
Channel
<
Myself
>()
fun
toChatList
(
)
=
navigator
.
toChatList
(
)
fun
toChatList
(
chatRoomId
:
String
?
=
null
)
=
navigator
.
toChatList
(
chatRoomId
)
fun
toUserProfile
()
=
navigator
.
toUserProfile
()
...
...
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
bc8f66aa
...
...
@@ -18,6 +18,7 @@ import chat.rocket.android.main.presentation.MainPresenter
import
chat.rocket.android.main.presentation.MainView
import
chat.rocket.android.main.viewmodel.NavHeaderViewModel
import
chat.rocket.android.server.domain.model.Account
import
chat.rocket.android.server.ui.INTENT_CHAT_ROOM_ID
import
chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.rotateBy
...
...
@@ -52,6 +53,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, HasSupp
private
var
expanded
=
false
private
lateinit
var
googleApiClient
:
GoogleApiClient
private
val
headerLayout
by
lazy
{
view_navigation
.
getHeaderView
(
0
)
}
private
var
chatRoomId
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
...
...
@@ -69,6 +71,8 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, HasSupp
}
}
chatRoomId
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_ID
)
presenter
.
connect
()
presenter
.
loadCurrentInfo
()
setupToolbar
()
...
...
@@ -111,7 +115,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, HasSupp
override
fun
onResume
()
{
super
.
onResume
()
if
(!
isFragmentAdded
)
{
presenter
.
toChatList
()
presenter
.
toChatList
(
chatRoomId
)
isFragmentAdded
=
true
}
}
...
...
app/src/main/java/chat/rocket/android/push/PushManager.kt
View file @
bc8f66aa
...
...
@@ -26,7 +26,6 @@ import chat.rocket.android.server.domain.siteName
import
chat.rocket.android.server.ui.changeServerIntent
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.common.util.ifNull
import
com.squareup.moshi.Json
import
com.squareup.moshi.Moshi
import
kotlinx.coroutines.experimental.runBlocking
...
...
@@ -300,7 +299,7 @@ class PushManager @Inject constructor(
}
private
fun
getContentIntent
(
context
:
Context
,
notificationId
:
Int
,
pushMessage
:
PushMessage
,
grouped
:
Boolean
=
false
):
PendingIntent
{
val
notificationIntent
=
context
.
changeServerIntent
(
pushMessage
.
info
.
host
)
val
notificationIntent
=
context
.
changeServerIntent
(
pushMessage
.
info
.
host
,
chatRoomId
=
pushMessage
.
info
.
roomId
)
// TODO - add support to go directly to the chatroom
/*if (!grouped) {
notificationIntent.putExtra(EXTRA_ROOM_ID, pushMessage.info.roomId)
...
...
app/src/main/java/chat/rocket/android/server/presentation/ChangeServerNavigator.kt
View file @
bc8f66aa
...
...
@@ -4,6 +4,7 @@ import android.content.Intent
import
chat.rocket.android.authentication.ui.newServerIntent
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.server.ui.ChangeServerActivity
import
chat.rocket.android.server.ui.INTENT_CHAT_ROOM_ID
class
ChangeServerNavigator
(
internal
val
activity
:
ChangeServerActivity
)
{
fun
toServerScreen
()
{
...
...
@@ -11,8 +12,10 @@ class ChangeServerNavigator (internal val activity: ChangeServerActivity) {
activity
.
finish
()
}
fun
toChatRooms
()
{
activity
.
startActivity
(
Intent
(
activity
,
MainActivity
::
class
.
java
))
fun
toChatRooms
(
chatRoomId
:
String
?
=
null
)
{
activity
.
startActivity
(
Intent
(
activity
,
MainActivity
::
class
.
java
).
also
{
it
.
putExtra
(
INTENT_CHAT_ROOM_ID
,
chatRoomId
)
})
activity
.
finish
()
}
...
...
app/src/main/java/chat/rocket/android/server/presentation/ChangeServerPresenter.kt
View file @
bc8f66aa
...
...
@@ -21,7 +21,7 @@ class ChangeServerPresenter @Inject constructor(
private
val
localRepository
:
LocalRepository
,
private
val
connectionManager
:
ConnectionManagerFactory
)
{
fun
loadServer
(
newUrl
:
String
?)
{
fun
loadServer
(
newUrl
:
String
?
,
chatRoomId
:
String
?
=
null
)
{
launchUI
(
strategy
)
{
view
.
showProgress
()
var
url
=
newUrl
...
...
@@ -56,7 +56,7 @@ class ChangeServerPresenter @Inject constructor(
saveCurrentServerInteractor
.
save
(
serverUrl
)
view
.
hideProgress
()
navigator
.
toChatRooms
()
navigator
.
toChatRooms
(
chatRoomId
)
}.
ifNull
{
view
.
hideProgress
()
navigator
.
toServerScreen
()
...
...
app/src/main/java/chat/rocket/android/server/ui/ChangeServerActivity.kt
View file @
bc8f66aa
...
...
@@ -21,7 +21,8 @@ class ChangeServerActivity : AppCompatActivity(), ChangeServerView {
super
.
onCreate
(
savedInstanceState
)
val
serverUrl
:
String
?
=
intent
.
getStringExtra
(
INTENT_SERVER_URL
)
presenter
.
loadServer
(
serverUrl
)
val
chatRoomId
:
String
?
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_ID
)
presenter
.
loadServer
(
serverUrl
,
chatRoomId
)
}
override
fun
showInvalidCredentials
()
{
...
...
@@ -40,11 +41,13 @@ class ChangeServerActivity : AppCompatActivity(), ChangeServerView {
private
const
val
INTENT_SERVER_URL
=
"INTENT_SERVER_URL"
private
const
val
INTENT_CHAT_ROOM_NAME
=
"INTENT_CHAT_ROOM_NAME"
private
const
val
INTENT_CHAT_ROOM_TYPE
=
"INTENT_CHAT_ROOM_TYPE"
const
val
INTENT_CHAT_ROOM_ID
=
"INTENT_CHAT_ROOM_ID"
fun
Context
.
changeServerIntent
(
serverUrl
:
String
?
=
null
):
Intent
{
fun
Context
.
changeServerIntent
(
serverUrl
:
String
?
=
null
,
chatRoomId
:
String
?
=
""
):
Intent
{
return
Intent
(
this
,
ChangeServerActivity
::
class
.
java
).
apply
{
serverUrl
?.
let
{
url
->
putExtra
(
INTENT_SERVER_URL
,
url
)
putExtra
(
INTENT_CHAT_ROOM_ID
,
chatRoomId
)
}
flags
=
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
or
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
}
...
...
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