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
8b0f2c72
Unverified
Commit
8b0f2c72
authored
Jun 29, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Jun 29, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into bottomsheet
parents
49176f16
001f1a01
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
14 deletions
+26
-14
RoomUiModelMapper.kt
...hat/rocket/android/chatrooms/adapter/RoomUiModelMapper.kt
+2
-1
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+6
-7
ChatRoomsAdapter.kt
...java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
+2
-1
MessageHelper.kt
...src/main/java/chat/rocket/android/helper/MessageHelper.kt
+6
-1
SettingsRepository.kt
...a/chat/rocket/android/server/domain/SettingsRepository.kt
+1
-0
RocketChatClientFactory.kt
...android/server/infraestructure/RocketChatClientFactory.kt
+9
-4
No files found.
app/src/main/java/chat/rocket/android/chatrooms/adapter/RoomUiModelMapper.kt
View file @
8b0f2c72
...
...
@@ -13,6 +13,7 @@ import chat.rocket.android.infrastructure.checkIfMyself
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.showLastMessage
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.server.domain.useSpecialCharsOnRoom
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.date
import
chat.rocket.android.util.extensions.localDateTime
...
...
@@ -111,7 +112,7 @@ class RoomUiModelMapper(
}
private
fun
mapName
(
name
:
String
,
fullName
:
String
?,
unread
:
Boolean
):
CharSequence
{
val
roomName
=
if
(
settings
.
useRealName
())
{
val
roomName
=
if
(
settings
.
use
SpecialCharsOnRoom
()
||
settings
.
use
RealName
())
{
fullName
?:
name
}
else
{
name
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
8b0f2c72
...
...
@@ -6,6 +6,7 @@ import chat.rocket.android.helper.UserHelper
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.main.presentation.MainNavigator
import
chat.rocket.android.server.domain.SettingsRepository
import
chat.rocket.android.server.domain.useSpecialCharsOnRoom
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.server.infraestructure.ConnectionManager
import
chat.rocket.android.util.extensions.launchUI
...
...
@@ -36,13 +37,11 @@ class ChatRoomsPresenter @Inject constructor(
fun
loadChatRoom
(
chatRoom
:
chat
.
rocket
.
android
.
db
.
model
.
ChatRoom
)
{
with
(
chatRoom
.
chatRoom
)
{
val
isDirectMessage
=
roomTypeOf
(
type
)
is
RoomType
.
DirectMessage
val
roomName
=
if
(
isDirectMessage
&&
fullname
!=
null
&&
settings
.
useRealName
())
{
fullname
!!
}
else
{
name
}
val
roomName
=
if
(
settings
.
useSpecialCharsOnRoom
()
||
(
isDirectMessage
&&
settings
.
useRealName
()))
{
fullname
?:
name
}
else
{
name
}
launchUI
(
strategy
)
{
val
myself
=
getCurrentUser
()
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
View file @
8b0f2c72
...
...
@@ -18,6 +18,7 @@ import chat.rocket.android.infrastructure.checkIfMyself
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.showLastMessage
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.server.domain.useSpecialCharsOnRoom
import
chat.rocket.android.util.extensions.*
import
chat.rocket.common.model.RoomType
import
chat.rocket.core.model.ChatRoom
...
...
@@ -123,7 +124,7 @@ class ChatRoomsAdapter(
}
private
fun
chatRoomName
(
chatRoom
:
ChatRoom
):
String
{
return
if
(
settings
.
useRealName
())
{
return
if
(
settings
.
use
SpecialCharsOnRoom
()
||
settings
.
use
RealName
())
{
chatRoom
.
fullName
?:
chatRoom
.
name
}
else
{
chatRoom
.
name
...
...
app/src/main/java/chat/rocket/android/helper/MessageHelper.kt
View file @
8b0f2c72
...
...
@@ -3,6 +3,7 @@ package chat.rocket.android.helper
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.useSpecialCharsOnRoom
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.common.model.RoomType
import
chat.rocket.core.model.ChatRoom
...
...
@@ -24,7 +25,11 @@ class MessageHelper @Inject constructor(
is
RoomType
.
LiveChat
->
"livechat"
else
->
"custom"
}
val
name
=
if
(
settings
.
useRealName
())
chatRoom
.
fullName
?:
chatRoom
.
name
else
chatRoom
.
name
val
name
=
if
(
settings
.
useSpecialCharsOnRoom
()
||
settings
.
useRealName
())
{
chatRoom
.
fullName
?:
chatRoom
.
name
}
else
{
chatRoom
.
name
}
return
"[ ]($currentServer/$type/$name?msg=${message.id}) "
}
...
...
app/src/main/java/chat/rocket/android/server/domain/SettingsRepository.kt
View file @
8b0f2c72
...
...
@@ -71,6 +71,7 @@ fun PublicSettings.gitlabUrl(): String? = this[ACCOUNT_GITLAB_URL]?.value as Str
fun
PublicSettings
.
isWordpressAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_WORDPRESS
]
?.
value
==
true
fun
PublicSettings
.
useRealName
():
Boolean
=
this
[
USE_REALNAME
]
?.
value
==
true
fun
PublicSettings
.
useSpecialCharsOnRoom
():
Boolean
=
this
[
ALLOW_ROOM_NAME_SPECIAL_CHARS
]
?.
value
==
true
fun
PublicSettings
.
faviconLarge
():
String
?
=
this
[
FAVICON_512
]
?.
value
as
String
?
fun
PublicSettings
.
favicon
():
String
?
=
this
[
FAVICON_196
]
?.
value
as
String
?
fun
PublicSettings
.
wideTile
():
String
?
=
this
[
WIDE_TILE_310
]
?.
value
as
String
?
...
...
app/src/main/java/chat/rocket/android/server/infraestructure/RocketChatClientFactory.kt
View file @
8b0f2c72
package
chat.rocket.android.server.infraestructure
import
android.os.Build
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.server.domain.TokenRepository
import
chat.rocket.common.util.PlatformLogger
import
chat.rocket.core.RocketChatClient
import
chat.rocket.android.server.domain.TokenRepository
import
okhttp3.OkHttpClient
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Singleton
@Singleton
class
RocketChatClientFactory
@Inject
constructor
(
private
val
okHttpClient
:
OkHttpClient
,
private
val
repository
:
TokenRepository
,
private
val
logger
:
PlatformLogger
)
{
class
RocketChatClientFactory
@Inject
constructor
(
private
val
okHttpClient
:
OkHttpClient
,
private
val
repository
:
TokenRepository
,
private
val
logger
:
PlatformLogger
)
{
private
val
cache
=
HashMap
<
String
,
RocketChatClient
>()
fun
create
(
url
:
String
):
RocketChatClient
{
...
...
@@ -23,6 +27,7 @@ class RocketChatClientFactory @Inject constructor(private val okHttpClient: OkHt
val
client
=
RocketChatClient
.
create
{
httpClient
=
okHttpClient
restUrl
=
url
userAgent
=
"RC Mobile; Android ${Build.VERSION.RELEASE}; v${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
tokenRepository
=
repository
platformLogger
=
logger
}
...
...
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