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
b7bdffa8
Commit
b7bdffa8
authored
Nov 19, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into observe-channel-changes
parents
b0d383b1
ad7e04f5
Changes
19
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1184 additions
and
56 deletions
+1184
-56
12.json
app/schemas/chat.rocket.android.db.RCDatabase/12.json
+1087
-0
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+1
-0
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+8
-0
RoomUiModel.kt
...hat/rocket/android/chatrooms/adapter/model/RoomUiModel.kt
+2
-1
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+2
-1
ChatRoomsViewModel.kt
.../rocket/android/chatrooms/viewmodel/ChatRoomsViewModel.kt
+2
-2
DatabaseManager.kt
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
+51
-46
RCDatabase.kt
app/src/main/java/chat/rocket/android/db/RCDatabase.kt
+5
-2
ChatRoomEntity.kt
.../main/java/chat/rocket/android/db/model/ChatRoomEntity.kt
+6
-2
strings.xml
app/src/main/res/values-de/strings.xml
+2
-0
strings.xml
app/src/main/res/values-es/strings.xml
+2
-0
strings.xml
app/src/main/res/values-fr/strings.xml
+2
-0
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+2
-0
strings.xml
app/src/main/res/values-ja/strings.xml
+2
-0
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+3
-2
strings.xml
app/src/main/res/values-ru-rRU/strings.xml
+2
-0
strings.xml
app/src/main/res/values-tr/strings.xml
+2
-0
strings.xml
app/src/main/res/values-uk/strings.xml
+2
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/schemas/chat.rocket.android.db.RCDatabase/12.json
0 → 100644
View file @
b7bdffa8
This diff is collapsed.
Click to expand it.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
b7bdffa8
...
...
@@ -38,6 +38,7 @@ import chat.rocket.android.server.infraestructure.state
import
chat.rocket.android.util.extension.getByteArray
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.exhaustive
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.model.RoomType
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
b7bdffa8
...
...
@@ -770,6 +770,14 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
if
(
isReadOnly
&&
!
roomUiModel
.
canPost
)
{
text_room_is_read_only
.
isVisible
=
true
input_container
.
isVisible
=
false
text_room_is_read_only
.
setText
(
if
(
isReadOnly
)
{
R
.
string
.
msg_this_room_is_read_only
}
else
{
// Not a read-only channel but user has been muted.
R
.
string
.
msg_muted_on_this_channel
}
)
}
else
if
(!
isSubscribed
&&
roomTypeOf
(
chatRoomType
)
!
is
RoomType
.
DirectMessage
)
{
input_container
.
isVisible
=
false
button_join_chat
.
isVisible
=
true
...
...
app/src/main/java/chat/rocket/android/chatrooms/adapter/model/RoomUiModel.kt
View file @
b7bdffa8
...
...
@@ -17,5 +17,6 @@ data class RoomUiModel(
val
username
:
String
?
=
null
,
val
broadcast
:
Boolean
=
false
,
val
canModerate
:
Boolean
=
false
,
val
canPost
:
Boolean
=
true
val
canPost
:
Boolean
=
true
,
val
muted
:
List
<
String
>
=
emptyList
()
)
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
b7bdffa8
...
...
@@ -56,7 +56,8 @@ class ChatRoomsPresenter @Inject constructor(
type
=
type
.
toString
(),
name
=
username
?:
name
.
toString
(),
fullname
=
name
.
toString
(),
open
=
open
open
=
open
,
muted
=
muted
)
loadChatRoom
(
entity
,
false
)
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/viewmodel/ChatRoomsViewModel.kt
View file @
b7bdffa8
...
...
@@ -27,7 +27,7 @@ import kotlinx.coroutines.experimental.launch
import
kotlinx.coroutines.experimental.newSingleThreadContext
import
kotlinx.coroutines.experimental.withContext
import
timber.log.Timber
import
java.
security.InvalidParameter
Exception
import
java.
lang.IllegalArgument
Exception
import
kotlin.coroutines.experimental.coroutineContext
...
...
@@ -171,6 +171,6 @@ fun Query.asSortingOrder(): ChatRoomsRepository.Order {
ChatRoomsRepository
.
Order
.
ACTIVITY
}
}
else
->
throw
I
nvalidParameter
Exception
(
"Should be ByName or ByActivity"
)
else
->
throw
I
llegalArgument
Exception
(
"Should be ByName or ByActivity"
)
}
}
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
View file @
b7bdffa8
...
...
@@ -41,8 +41,7 @@ import timber.log.Timber
import
java.util.HashSet
import
kotlin.system.measureTimeMillis
class
DatabaseManager
(
val
context
:
Application
,
val
serverUrl
:
String
)
{
class
DatabaseManager
(
val
context
:
Application
,
val
serverUrl
:
String
)
{
private
val
database
:
RCDatabase
=
androidx
.
room
.
Room
.
databaseBuilder
(
context
,
RCDatabase
::
class
.
java
,
serverUrl
.
databaseName
())
...
...
@@ -124,11 +123,11 @@ class DatabaseManager(val context: Application,
val
toInsert
=
ArrayList
<
ChatRoomEntity
>(
batch
.
size
/
2
)
val
toUpdate
=
ArrayList
<
ChatRoomEntity
>(
batch
.
size
)
batch
.
forEach
{
when
(
it
.
type
)
{
when
(
it
.
type
)
{
is
Type
.
Removed
->
toRemove
.
add
(
removeChatRoom
(
it
.
data
))
is
Type
.
Inserted
->
insertChatRoom
(
it
.
data
)
?.
let
{
toInsert
.
add
(
it
)
}
is
Type
.
Updated
->
{
when
(
it
.
data
)
{
when
(
it
.
data
)
{
is
Subscription
->
updateSubs
[(
it
.
data
as
Subscription
).
roomId
]
=
it
.
data
as
Subscription
is
Room
->
updateRooms
[(
it
.
data
as
Room
).
id
]
=
it
.
data
as
Room
}
...
...
@@ -329,7 +328,7 @@ class DatabaseManager(val context: Application,
}
private
fun
removeChatRoom
(
data
:
BaseRoom
):
String
{
return
when
(
data
)
{
return
when
(
data
)
{
is
Subscription
->
data
.
roomId
else
->
data
.
id
}
...
...
@@ -351,7 +350,8 @@ class DatabaseManager(val context: Application,
updatedAt
=
updatedAt
?:
chatRoom
.
updatedAt
,
lastMessageText
=
mapLastMessageText
(
lastMessage
),
lastMessageUserId
=
lastMessage
?.
sender
?.
id
,
lastMessageTimestamp
=
lastMessage
?.
timestamp
lastMessageTimestamp
=
lastMessage
?.
timestamp
,
muted
=
muted
)
}
}
...
...
@@ -389,7 +389,8 @@ class DatabaseManager(val context: Application,
id
=
roomId
,
subscriptionId
=
id
,
type
=
type
.
toString
(),
name
=
name
?:
throw
NullPointerException
(),
// this should be filtered on the SDK
name
=
name
?:
throw
NullPointerException
(),
// this should be filtered on the SDK
fullname
=
fullName
?:
chatRoom
.
fullname
,
userId
=
userId
?:
chatRoom
.
userId
,
readonly
=
readonly
?:
chatRoom
.
readonly
,
...
...
@@ -402,14 +403,15 @@ class DatabaseManager(val context: Application,
groupMentions
=
groupMentions
?:
chatRoom
.
groupMentions
,
updatedAt
=
updatedAt
?:
chatRoom
.
updatedAt
,
timestamp
=
timestamp
?:
chatRoom
.
timestamp
,
lastSeen
=
lastSeen
?:
chatRoom
.
lastSeen
lastSeen
=
lastSeen
?:
chatRoom
.
lastSeen
,
muted
=
chatRoom
.
muted
)
}
}
}
private
suspend
fun
insertChatRoom
(
data
:
BaseRoom
):
ChatRoomEntity
?
{
return
when
(
data
)
{
return
when
(
data
)
{
is
Room
->
insertRoom
(
data
)
is
Subscription
->
insertSubscription
(
data
)
else
->
null
...
...
@@ -451,7 +453,8 @@ class DatabaseManager(val context: Application,
id
=
room
.
id
,
subscriptionId
=
subscription
.
id
,
type
=
room
.
type
.
toString
(),
name
=
room
.
name
?:
subscription
.
name
?:
throw
NullPointerException
(),
// this should be filtered on the SDK
name
=
room
.
name
?:
subscription
.
name
?:
throw
NullPointerException
(),
// this should be filtered on the SDK
fullname
=
subscription
.
fullName
?:
room
.
fullName
,
userId
=
userId
,
ownerId
=
room
.
user
?.
id
,
...
...
@@ -506,7 +509,8 @@ class DatabaseManager(val context: Application,
lastMessageText
=
mapLastMessageText
(
lastMessage
),
lastMessageUserId
=
lastMessage
?.
sender
?.
id
,
lastMessageTimestamp
=
lastMessage
?.
timestamp
,
broadcast
=
broadcast
broadcast
=
broadcast
,
muted
=
room
.
muted
)
}
}
...
...
@@ -579,6 +583,7 @@ sealed class Operation {
val
toUpdate
:
List
<
ChatRoomEntity
>,
val
toRemove
:
List
<
String
>
)
:
Operation
()
data class
InsertRooms
(
val
chatRooms
:
List
<
ChatRoomEntity
>)
:
Operation
()
data class
CleanInsertRooms
(
val
chatRooms
:
List
<
ChatRoomEntity
>)
:
Operation
()
...
...
@@ -609,7 +614,7 @@ private fun String.databaseName(): String {
val
tmp
=
this
.
removePrefix
(
"https://"
)
.
removePrefix
(
"http://"
)
.
removeTrailingSlash
()
.
replace
(
"/"
,
"-"
)
.
replace
(
"/"
,
"-"
)
.
replace
(
"."
,
"_"
)
return
"$tmp.db"
...
...
app/src/main/java/chat/rocket/android/db/RCDatabase.kt
View file @
b7bdffa8
...
...
@@ -2,6 +2,7 @@ package chat.rocket.android.db
import
androidx.room.Database
import
androidx.room.RoomDatabase
import
androidx.room.TypeConverters
import
chat.rocket.android.db.model.AttachmentActionEntity
import
chat.rocket.android.db.model.AttachmentEntity
import
chat.rocket.android.db.model.AttachmentFieldEntity
...
...
@@ -14,6 +15,7 @@ import chat.rocket.android.db.model.MessagesSync
import
chat.rocket.android.db.model.ReactionEntity
import
chat.rocket.android.db.model.UrlEntity
import
chat.rocket.android.db.model.UserEntity
import
chat.rocket.android.emoji.internal.db.StringListConverter
@Database
(
entities
=
[
...
...
@@ -23,9 +25,10 @@ import chat.rocket.android.db.model.UserEntity
AttachmentFieldEntity
::
class
,
AttachmentActionEntity
::
class
,
UrlEntity
::
class
,
ReactionEntity
::
class
,
MessagesSync
::
class
],
version
=
1
0
,
version
=
1
2
,
exportSchema
=
true
)
@TypeConverters
(
StringListConverter
::
class
)
abstract
class
RCDatabase
:
RoomDatabase
()
{
abstract
fun
userDao
():
UserDao
abstract
fun
chatRoomDao
():
ChatRoomDao
...
...
app/src/main/java/chat/rocket/android/db/model/ChatRoomEntity.kt
View file @
b7bdffa8
...
...
@@ -5,6 +5,8 @@ import androidx.room.Entity
import
androidx.room.ForeignKey
import
androidx.room.Index
import
androidx.room.PrimaryKey
import
androidx.room.TypeConverters
import
chat.rocket.android.emoji.internal.db.StringListConverter
@Entity
(
tableName
=
"chatrooms"
,
indices
=
[
...
...
@@ -20,6 +22,7 @@ import androidx.room.PrimaryKey
ForeignKey
(
entity
=
UserEntity
::
class
,
parentColumns
=
[
"id"
],
childColumns
=
[
"lastMessageUserId"
])
]
)
@TypeConverters
(
StringListConverter
::
class
)
data class
ChatRoomEntity
(
@PrimaryKey
var
id
:
String
,
var
subscriptionId
:
String
,
...
...
@@ -42,7 +45,8 @@ data class ChatRoomEntity(
var
lastMessageText
:
String
?
=
null
,
var
lastMessageUserId
:
String
?
=
null
,
var
lastMessageTimestamp
:
Long
?
=
null
,
var
broadcast
:
Boolean
?
=
false
var
broadcast
:
Boolean
?
=
false
,
var
muted
:
List
<
String
>?
=
null
)
data class
ChatRoom
(
...
...
app/src/main/res/values-de/strings.xml
View file @
b7bdffa8
...
...
@@ -148,6 +148,8 @@
<string
name=
"msg_continue_with_wordpress"
>
Continue with
<b>
WordPress
</b></string>
<!-- TODO Add translation -->
<string
name=
"msg_two_factor_authentication"
>
Two-factor Authentication
</string>
<!-- TODO Add translation -->
<string
name=
"msg__your_2fa_code"
>
What’s your 2FA code?
</string>
<!-- TODO Add translation -->
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
Privat
</string>
...
...
app/src/main/res/values-es/strings.xml
View file @
b7bdffa8
...
...
@@ -165,6 +165,8 @@
<string
name=
"msg_view_less"
>
view less
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_permalink_copied"
>
Permalink copied
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Preferences messages -->
<string
name=
"msg_analytics_tracking"
>
Analytics tracking
</string>
<!-- TODO Add translation -->
...
...
app/src/main/res/values-fr/strings.xml
View file @
b7bdffa8
...
...
@@ -160,6 +160,8 @@
<string
name=
"msg_view_less"
>
view less
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_permalink_copied"
>
Permalink copied
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
Privé
</string>
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
b7bdffa8
...
...
@@ -171,6 +171,8 @@
<string
name=
"msg_view_less"
>
कम देखें
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_permalink_copied"
>
Permalink copied
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Preferences messages -->
<string
name=
"msg_analytics_tracking"
>
एनालिटिक्स ट्रैकिंग
</string>
...
...
app/src/main/res/values-ja/strings.xml
View file @
b7bdffa8
...
...
@@ -158,6 +158,8 @@
<string
name=
"msg_view_more"
>
更に表示
</string>
<string
name=
"msg_view_less"
>
隠す
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
プライベート
</string>
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
b7bdffa8
...
...
@@ -158,6 +158,7 @@
<string
name=
"msg_view_less"
>
visualizar menos
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_permalink_copied"
>
Permalink copiado
</string>
<string
name=
"msg_muted_on_this_channel"
>
Você está silenciado neste canal
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
Privado
</string>
...
...
@@ -186,8 +187,8 @@
<string
name=
"message_welcome"
>
Bem-vindo, %s
</string>
<string
name=
"message_removed"
>
Mensagem removida
</string>
<string
name=
"message_pinned"
>
Pinou uma mensagem:
</string>
<string
name=
"message_muted"
>
Usuário %1$s
entrou no modo mu
do por %2$s
</string>
<string
name=
"message_unmuted"
>
Usuário %1$s saiu do modo
mu
do por %2$s
</string>
<string
name=
"message_muted"
>
Usuário %1$s
foi silencia
do por %2$s
</string>
<string
name=
"message_unmuted"
>
Usuário %1$s saiu do modo
silencia
do por %2$s
</string>
<string
name=
"message_role_add"
>
%1$s foi definido %2$s por %3$s
</string>
<string
name=
"message_role_removed"
>
%1$s não é mais %2$s por %3$s
</string>
// TODO:Add proper translation.
...
...
app/src/main/res/values-ru-rRU/strings.xml
View file @
b7bdffa8
...
...
@@ -155,6 +155,8 @@
<string
name=
"msg_view_more"
>
больше
</string>
<string
name=
"msg_view_less"
>
меньше
</string>
<string
name=
"msg_permalink_copied"
>
Ссылка скопирована
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
Приватный
</string>
...
...
app/src/main/res/values-tr/strings.xml
View file @
b7bdffa8
...
...
@@ -172,6 +172,8 @@
<string
name=
"msg_view_less"
>
Daha az göster
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_permalink_copied"
>
Permalink copied
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Preferences messages -->
<string
name=
"msg_analytics_tracking"
>
İstatistik takibi
</string>
...
...
app/src/main/res/values-uk/strings.xml
View file @
b7bdffa8
...
...
@@ -157,6 +157,8 @@
<string
name=
"msg_view_less"
>
view less
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_permalink_copied"
>
Permalink copied
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Create channel messages -->
<string
name=
"msg_private_channel"
>
Приватний
</string>
...
...
app/src/main/res/values/strings.xml
View file @
b7bdffa8
...
...
@@ -183,6 +183,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<string
name=
"msg_delete_description"
>
Are you sure you want to delete this message
</string>
<string
name=
"msg_view_more"
>
view more
</string>
<string
name=
"msg_view_less"
>
view less
</string>
<string
name=
"msg_muted_on_this_channel"
>
You are muted on this channel
</string>
<!-- Preferences messages -->
<string
name=
"msg_analytics_tracking"
>
Analytics tracking
</string>
...
...
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