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
d8024c9e
Unverified
Commit
d8024c9e
authored
Apr 13, 2018
by
Leonardo Aramaki
Committed by
GitHub
Apr 13, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop-2.x' into new/offline-sending
parents
fbaf478c
f066382a
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
56 additions
and
68 deletions
+56
-68
DrawableHelper.kt
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
+7
-32
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+14
-9
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+1
-1
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+3
-1
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+1
-1
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+3
-3
ChatRoomsView.kt
...at/rocket/android/chatrooms/presentation/ChatRoomsView.kt
+1
-1
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+2
-4
AccountsAdapter.kt
.../java/chat/rocket/android/main/adapter/AccountsAdapter.kt
+1
-1
StatusViewHolder.kt
...java/chat/rocket/android/main/adapter/StatusViewHolder.kt
+5
-5
MainPresenter.kt
...va/chat/rocket/android/main/presentation/MainPresenter.kt
+1
-1
MainView.kt
...in/java/chat/rocket/android/main/presentation/MainView.kt
+1
-1
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+1
-1
ConnectionManager.kt
...ocket/android/server/infraestructure/ConnectionManager.kt
+15
-7
No files found.
app/src/main/java/chat/rocket/android/app/DrawableHelper.kt
View file @
d8024c9e
...
...
@@ -2,7 +2,6 @@ import android.content.Context
import
android.graphics.drawable.Drawable
import
android.support.v4.content.ContextCompat
import
android.support.v4.graphics.drawable.DrawableCompat
import
android.widget.EditText
import
android.widget.TextView
import
chat.rocket.android.R
import
chat.rocket.common.model.UserStatus
...
...
@@ -16,7 +15,8 @@ object DrawableHelper {
* @param context The context.
* @return A drawable.
*/
fun
getDrawableFromId
(
id
:
Int
,
context
:
Context
):
Drawable
=
context
.
resources
.
getDrawable
(
id
,
null
)
fun
getDrawableFromId
(
id
:
Int
,
context
:
Context
):
Drawable
=
context
.
resources
.
getDrawable
(
id
,
null
)
/**
* Wraps an array of Drawable to be used for example for tinting.
...
...
@@ -68,7 +68,8 @@ object DrawableHelper {
* @see tintDrawables
* @see wrapDrawable
*/
fun
tintDrawable
(
drawable
:
Drawable
,
context
:
Context
,
resId
:
Int
)
=
DrawableCompat
.
setTint
(
drawable
,
ContextCompat
.
getColor
(
context
,
resId
))
fun
tintDrawable
(
drawable
:
Drawable
,
context
:
Context
,
resId
:
Int
)
=
DrawableCompat
.
setTint
(
drawable
,
ContextCompat
.
getColor
(
context
,
resId
))
/**
* Compounds an array of Drawable (to appear to the left of the text) into an array of TextView.
...
...
@@ -96,13 +97,15 @@ object DrawableHelper {
* @param drawable The Drawable.
* @see compoundDrawables
*/
fun
compoundDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
fun
compoundDrawable
(
textView
:
TextView
,
drawable
:
Drawable
)
=
textView
.
setCompoundDrawablesWithIntrinsicBounds
(
drawable
,
null
,
null
,
null
)
/**
* Returns the user status drawable.
*
* @param userStatus The user status.
* @param context The context.
* @see [UserStatus]
* @return The user status drawable.
*/
fun
getUserStatusDrawable
(
userStatus
:
UserStatus
,
context
:
Context
):
Drawable
{
...
...
@@ -119,32 +122,4 @@ object DrawableHelper {
else
->
getDrawableFromId
(
R
.
drawable
.
ic_status_invisible_24dp
,
context
)
}
}
// TODO Why we need two UserStatus?
/**
* Returns the user status drawable.
*
* @param userStatus The user status.
* @param context The context.
* @sse [chat.rocket.core.internal.realtime.UserStatus]
* @return The user status drawable.
*/
fun
getUserStatusDrawable
(
userStatus
:
chat
.
rocket
.
core
.
internal
.
realtime
.
UserStatus
,
context
:
Context
):
Drawable
{
return
when
(
userStatus
)
{
is
chat
.
rocket
.
core
.
internal
.
realtime
.
UserStatus
.
Online
->
{
getDrawableFromId
(
R
.
drawable
.
ic_status_online_24dp
,
context
)
}
is
chat
.
rocket
.
core
.
internal
.
realtime
.
UserStatus
.
Away
->
{
getDrawableFromId
(
R
.
drawable
.
ic_status_away_24dp
,
context
)
}
is
chat
.
rocket
.
core
.
internal
.
realtime
.
UserStatus
.
Busy
->
{
getDrawableFromId
(
R
.
drawable
.
ic_status_busy_24dp
,
context
)
}
else
->
getDrawableFromId
(
R
.
drawable
.
ic_status_invisible_24dp
,
context
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
d8024c9e
...
...
@@ -14,6 +14,7 @@ import android.view.ViewGroup
import
android.view.ViewTreeObserver
import
android.widget.ImageButton
import
android.widget.ScrollView
import
androidx.core.view.postDelayed
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.authentication.login.presentation.LoginPresenter
...
...
@@ -377,19 +378,23 @@ class LoginFragment : Fragment(), LoginView {
}
private
fun
showRemainingSocialAccountsView
()
{
social_accounts_container
.
postDelayed
({
(
0
..
social_accounts_container
.
childCount
)
.
mapNotNull
{
social_accounts_container
.
getChildAt
(
it
)
as
?
ImageButton
}
.
filter
{
it
.
isClickable
}
.
forEach
{
ui
{
it
.
setVisible
(
true
)
}}
},
1000
)
social_accounts_container
.
postDelayed
(
300
)
{
ui
{
(
0
..
social_accounts_container
.
childCount
)
.
mapNotNull
{
social_accounts_container
.
getChildAt
(
it
)
as
?
ImageButton
}
.
filter
{
it
.
isClickable
}
.
forEach
{
it
.
setVisible
(
true
)
}
}
}
}
// Scrolling to the bottom of the screen.
private
fun
scrollToBottom
()
{
scroll_view
.
postDelayed
({
ui
{
scroll_view
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
)
}
},
1250
)
scroll_view
.
postDelayed
(
1250
)
{
ui
{
scroll_view
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
)
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
d8024c9e
...
...
@@ -25,7 +25,7 @@ import chat.rocket.common.model.SimpleUser
import
chat.rocket.common.model.UserStatus
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.internal.realtime.State
import
chat.rocket.core.internal.realtime.
socket.model.
State
import
chat.rocket.core.internal.rest.*
import
chat.rocket.core.model.Command
import
chat.rocket.core.model.Message
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
d8024c9e
...
...
@@ -7,7 +7,7 @@ import chat.rocket.android.chatroom.viewmodel.suggestion.CommandSuggestionViewMo
import
chat.rocket.android.chatroom.viewmodel.suggestion.PeopleSuggestionViewModel
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.core.internal.realtime.State
import
chat.rocket.core.internal.realtime.
socket.model.
State
interface
ChatRoomView
:
LoadingView
,
MessageView
{
...
...
@@ -103,7 +103,9 @@ interface ChatRoomView : LoadingView, MessageView {
fun
showInvalidFileSize
(
fileSize
:
Int
,
maxFileSize
:
Int
)
fun
showConnectionState
(
state
:
State
)
fun
populatePeopleSuggestions
(
members
:
List
<
PeopleSuggestionViewModel
>)
fun
populateRoomSuggestions
(
chatRooms
:
List
<
ChatRoomSuggestionViewModel
>)
/**
* This user has joined the chat callback.
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
d8024c9e
...
...
@@ -32,7 +32,7 @@ import chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.widget.emoji.*
import
chat.rocket.core.internal.realtime.State
import
chat.rocket.core.internal.realtime.
socket.model.
State
import
dagger.android.support.AndroidSupportInjection
import
io.reactivex.disposables.CompositeDisposable
import
kotlinx.android.synthetic.main.fragment_chat_room.*
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
d8024c9e
...
...
@@ -19,9 +19,9 @@ import chat.rocket.common.model.RoomType
import
chat.rocket.common.model.SimpleUser
import
chat.rocket.common.model.User
import
chat.rocket.core.internal.model.Subscription
import
chat.rocket.core.internal.realtime.State
import
chat.rocket.core.internal.realtime.StreamMessage
import
chat.rocket.core.internal.realtime.Type
import
chat.rocket.core.internal.realtime.
socket.model.
State
import
chat.rocket.core.internal.realtime.
socket.model.
StreamMessage
import
chat.rocket.core.internal.realtime.
socket.model.
Type
import
chat.rocket.core.internal.rest.spotlight
import
chat.rocket.core.model.ChatRoom
import
chat.rocket.core.model.Room
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsView.kt
View file @
d8024c9e
...
...
@@ -2,7 +2,7 @@ package chat.rocket.android.chatrooms.presentation
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.core.internal.realtime.State
import
chat.rocket.core.internal.realtime.
socket.model.
State
import
chat.rocket.core.model.ChatRoom
interface
ChatRoomsView
:
LoadingView
,
MessageView
{
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
d8024c9e
...
...
@@ -17,24 +17,22 @@ import android.widget.RadioGroup
import
chat.rocket.android.R
import
chat.rocket.android.chatrooms.presentation.ChatRoomsPresenter
import
chat.rocket.android.chatrooms.presentation.ChatRoomsView
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.helper.ChatRoomsSortOrder
import
chat.rocket.android.helper.Constants
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.widget.DividerItemDecoration
import
chat.rocket.common.model.RoomType
import
chat.rocket.core.internal.realtime.State
import
chat.rocket.core.internal.realtime.
socket.model.
State
import
chat.rocket.core.model.ChatRoom
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_chat_rooms.*
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.Job
import
kotlinx.coroutines.experimental.NonCancellable.isActive
import
kotlinx.coroutines.experimental.android.UI
import
kotlinx.coroutines.experimental.async
import
kotlinx.coroutines.experimental.launch
import
timber.log.Timber
import
javax.inject.Inject
...
...
app/src/main/java/chat/rocket/android/main/adapter/AccountsAdapter.kt
View file @
d8024c9e
...
...
@@ -5,7 +5,7 @@ import android.view.ViewGroup
import
chat.rocket.android.R
import
chat.rocket.android.server.domain.model.Account
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.co
re.internal.realtime
.UserStatus
import
chat.rocket.co
mmon.model
.UserStatus
private
const
val
VIEW_TYPE_CHANGE_STATUS
=
0
private
const
val
VIEW_TYPE_ACCOUNT
=
1
...
...
app/src/main/java/chat/rocket/android/main/adapter/StatusViewHolder.kt
View file @
d8024c9e
...
...
@@ -2,17 +2,17 @@ package chat.rocket.android.main.adapter
import
android.support.v7.widget.RecyclerView
import
android.view.View
import
chat.rocket.co
re.internal.realtime
.UserStatus
import
chat.rocket.co
mmon.model
.UserStatus
import
kotlinx.android.synthetic.main.item_change_status.view.*
class
StatusViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
fun
bind
(
listener
:
(
UserStatus
)
->
Unit
)
{
with
(
itemView
)
{
text_online
.
setOnClickListener
{
listener
(
UserStatus
.
Online
)
}
text_away
.
setOnClickListener
{
listener
(
UserStatus
.
Away
)
}
text_busy
.
setOnClickListener
{
listener
(
UserStatus
.
Busy
)
}
text_invisible
.
setOnClickListener
{
listener
(
UserStatus
.
Offline
)
}
text_online
.
setOnClickListener
{
listener
(
UserStatus
.
Online
()
)
}
text_away
.
setOnClickListener
{
listener
(
UserStatus
.
Away
()
)
}
text_busy
.
setOnClickListener
{
listener
(
UserStatus
.
Busy
()
)
}
text_invisible
.
setOnClickListener
{
listener
(
UserStatus
.
Offline
()
)
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/presentation/MainPresenter.kt
View file @
d8024c9e
...
...
@@ -15,9 +15,9 @@ import chat.rocket.android.util.extensions.serverLogoUrl
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatAuthException
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.model.UserStatus
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.realtime.UserStatus
import
chat.rocket.core.internal.realtime.setDefaultStatus
import
chat.rocket.core.internal.rest.logout
import
chat.rocket.core.internal.rest.me
...
...
app/src/main/java/chat/rocket/android/main/presentation/MainView.kt
View file @
d8024c9e
...
...
@@ -4,7 +4,7 @@ import chat.rocket.android.authentication.server.presentation.VersionCheckView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.android.main.viewmodel.NavHeaderViewModel
import
chat.rocket.android.server.domain.model.Account
import
chat.rocket.co
re.internal.realtime
.UserStatus
import
chat.rocket.co
mmon.model
.UserStatus
interface
MainView
:
MessageView
,
VersionCheckView
{
...
...
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
d8024c9e
...
...
@@ -21,7 +21,7 @@ import chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.rotateBy
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.co
re.internal.realtime
.UserStatus
import
chat.rocket.co
mmon.model
.UserStatus
import
com.google.android.gms.gcm.GoogleCloudMessaging
import
com.google.android.gms.iid.InstanceID
import
dagger.android.AndroidInjection
...
...
app/src/main/java/chat/rocket/android/server/infraestructure/ConnectionManager.kt
View file @
d8024c9e
...
...
@@ -2,7 +2,15 @@ package chat.rocket.android.server.infraestructure
import
chat.rocket.common.model.BaseRoom
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.realtime.*
import
chat.rocket.core.internal.realtime.unsubscribe
import
chat.rocket.core.internal.realtime.socket.connect
import
chat.rocket.core.internal.realtime.socket.disconnect
import
chat.rocket.core.internal.realtime.socket.model.State
import
chat.rocket.core.internal.realtime.socket.model.StreamMessage
import
chat.rocket.core.internal.realtime.subscribeRoomMessages
import
chat.rocket.core.internal.realtime.subscribeRooms
import
chat.rocket.core.internal.realtime.subscribeSubscriptions
import
chat.rocket.core.internal.realtime.subscribeUserDataChanges
import
chat.rocket.core.internal.rest.chatRooms
import
chat.rocket.core.model.Message
import
chat.rocket.core.model.Myself
...
...
@@ -12,7 +20,6 @@ import kotlinx.coroutines.experimental.launch
import
timber.log.Timber
import
java.util.concurrent.CopyOnWriteArrayList
class
ConnectionManager
(
internal
val
client
:
RocketChatClient
)
{
private
val
statusChannelList
=
CopyOnWriteArrayList
<
Channel
<
State
>>()
private
val
statusChannel
=
Channel
<
State
>(
Channel
.
CONFLATED
)
...
...
@@ -53,7 +60,6 @@ class ConnectionManager(internal val client: RocketChatClient) {
Timber
.
d
(
"Subscribed to rooms: $id"
)
roomsId
=
id
}
client
.
subscribeUserDataChanges
{
_
,
id
->
Timber
.
d
(
"Subscribed to the user: $id"
)
userId
=
id
...
...
@@ -138,9 +144,11 @@ class ConnectionManager(internal val client: RocketChatClient) {
fun
removeStatusChannel
(
channel
:
Channel
<
State
>)
=
statusChannelList
.
remove
(
channel
)
fun
addRoomsAndSubscriptionsChannel
(
channel
:
Channel
<
StreamMessage
<
BaseRoom
>>)
=
roomAndSubscriptionChannels
.
add
(
channel
)
fun
addRoomsAndSubscriptionsChannel
(
channel
:
Channel
<
StreamMessage
<
BaseRoom
>>)
=
roomAndSubscriptionChannels
.
add
(
channel
)
fun
removeRoomsAndSubscriptionsChannel
(
channel
:
Channel
<
StreamMessage
<
BaseRoom
>>)
=
roomAndSubscriptionChannels
.
remove
(
channel
)
fun
removeRoomsAndSubscriptionsChannel
(
channel
:
Channel
<
StreamMessage
<
BaseRoom
>>)
=
roomAndSubscriptionChannels
.
remove
(
channel
)
fun
addUserDataChannel
(
channel
:
Channel
<
Myself
>)
=
userDataChannels
.
add
(
channel
)
...
...
@@ -170,8 +178,8 @@ class ConnectionManager(internal val client: RocketChatClient) {
}
}
suspend
fun
ConnectionManager
.
chatRooms
(
timestamp
:
Long
=
0
,
filterCustom
:
Boolean
=
true
)
=
client
.
chatRooms
(
timestamp
,
filterCustom
)
suspend
fun
ConnectionManager
.
chatRooms
(
timestamp
:
Long
=
0
,
filterCustom
:
Boolean
=
true
)
=
client
.
chatRooms
(
timestamp
,
filterCustom
)
val
ConnectionManager
.
state
:
State
get
()
=
client
.
state
\ No newline at end of file
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