Skip to content
This repository was archived by the owner on Jun 7, 2020. It is now read-only.

Commit 4c78f18

Browse files
authored
Merge pull request #2454 from RocketChat/develop
[RELEASE] Merge DEVELOP into BETA
2 parents 8d68569 + 0c689bd commit 4c78f18

File tree

21 files changed

+151
-37
lines changed

21 files changed

+151
-37
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ android {
1818
applicationId "chat.rocket.android"
1919
minSdkVersion versions.minSdk
2020
targetSdkVersion versions.targetSdk
21-
versionCode 2074
22-
versionName "3.5.0"
21+
versionCode 2075
22+
versionName "3.5.1"
2323
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2424
multiDexEnabled true
2525

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4+
android:sharedUserId="chat.rocket.android"
45
package="chat.rocket.android">
56

67
<uses-permission android:name="android.permission.INTERNET" />

app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ class LoginPresenter @Inject constructor(
149149
icon,
150150
logo,
151151
username,
152-
thumb
152+
thumb,
153+
token?.userId,
154+
token?.authToken
153155
)
154156
saveAccountInteractor.save(account)
155157
}

app/src/main/java/chat/rocket/android/authentication/loginoptions/presentation/LoginOptionsPresenter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ class LoginOptionsPresenter @Inject constructor(
190190
icon,
191191
logo,
192192
username,
193-
thumb
193+
thumb,
194+
token?.userId,
195+
token?.authToken
194196
)
195197
saveAccountInteractor.save(account)
196198
}

app/src/main/java/chat/rocket/android/authentication/registerusername/presentation/RegisterUsernamePresenter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ class RegisterUsernamePresenter @Inject constructor(
8888
icon,
8989
logo,
9090
username,
91-
thumb
91+
thumb,
92+
token?.userId,
93+
token?.authToken
9294
)
9395
saveAccountInteractor.save(account)
9496
}

app/src/main/java/chat/rocket/android/authentication/signup/presentation/SignupPresenter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ class SignupPresenter @Inject constructor(
109109
icon,
110110
logo,
111111
me.username!!,
112-
thumb
112+
thumb,
113+
token?.userId,
114+
token?.authToken
113115
)
114116
saveAccountInteractor.save(account)
115117
}

app/src/main/java/chat/rocket/android/authentication/twofactor/presentation/TwoFAPresenter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ class TwoFAPresenter @Inject constructor(
110110
icon,
111111
logo,
112112
me.username!!,
113-
thumb
113+
thumb,
114+
token?.userId,
115+
token?.authToken
114116
)
115117
saveAccountInteractor.save(account)
116118
}

app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import DrawableHelper
44
import android.content.Context
55
import android.content.Intent
66
import android.os.Bundle
7+
import android.text.method.ScrollingMovementMethod
78
import android.view.View
89
import androidx.appcompat.app.AppCompatActivity
910
import androidx.fragment.app.Fragment
@@ -143,6 +144,7 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
143144
text_toolbar_title,
144145
DrawableHelper.getDrawableFromId(R.drawable.ic_chatroom_toolbar_expand_more_20dp, this)
145146
)
147+
text_toolbar_title.movementMethod = ScrollingMovementMethod()
146148
text_toolbar_title.setOnClickListener { listener(it) }
147149
}
148150

app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
746746
}
747747

748748
private fun setReactionButtonIcon(@DrawableRes drawableId: Int) {
749-
button_add_reaction_or_show_keyboard.setImageResource(drawableId)
750-
button_add_reaction_or_show_keyboard.tag = drawableId
749+
button_add_reaction_or_show_keyboard?.setImageResource(drawableId)
750+
button_add_reaction_or_show_keyboard?.tag = drawableId
751751
}
752752

753753
override fun showFileSelection(filter: Array<String>?) {
@@ -929,9 +929,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
929929
}
930930

931931
button_send.setOnClickListener {
932-
var textMessage = citation ?: ""
933-
textMessage += text_message.textContent
934-
sendMessage(textMessage)
932+
text_message.textContent.run {
933+
if(this.isNotBlank()) {
934+
sendMessage(citation ?: "" + this)
935+
}
936+
}
935937
}
936938

937939
button_show_attachment_options.setOnClickListener {

app/src/main/java/chat/rocket/android/main/presentation/MainPresenter.kt

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ package chat.rocket.android.main.presentation
22

33
import chat.rocket.android.authentication.domain.model.DeepLinkInfo
44
import chat.rocket.android.core.behaviours.AppLanguageView
5+
import chat.rocket.android.helper.UserHelper
56
import chat.rocket.android.push.GroupedPush
6-
import chat.rocket.android.server.domain.GetCurrentLanguageInteractor
7-
import chat.rocket.android.server.domain.RefreshPermissionsInteractor
8-
import chat.rocket.android.server.domain.RefreshSettingsInteractor
7+
import chat.rocket.android.server.domain.*
8+
import chat.rocket.android.server.domain.model.Account
99
import chat.rocket.android.server.infrastructure.ConnectionManagerFactory
10+
import chat.rocket.android.util.extensions.avatarUrl
11+
import chat.rocket.android.util.extensions.serverLogoUrl
1012
import javax.inject.Inject
1113
import javax.inject.Named
1214

@@ -16,10 +18,16 @@ class MainPresenter @Inject constructor(
1618
private val appLanguageView: AppLanguageView,
1719
private val refreshSettingsInteractor: RefreshSettingsInteractor,
1820
private val refreshPermissionsInteractor: RefreshPermissionsInteractor,
21+
private val getSettingsInteractor: GetSettingsInteractor,
1922
private val connectionManagerFactory: ConnectionManagerFactory,
2023
private var getLanguageInteractor: GetCurrentLanguageInteractor,
21-
private val groupedPush: GroupedPush
24+
private val groupedPush: GroupedPush,
25+
private val tokenRepository: TokenRepository,
26+
private val userHelper: UserHelper,
27+
private val saveAccountInteractor: SaveAccountInteractor,
28+
private val removeAccountInteractor: RemoveAccountInteractor
2229
) {
30+
2331
fun connect() = currentServer?.let {
2432
refreshSettingsInteractor.refreshAsync(it)
2533
refreshPermissionsInteractor.refreshAsync(it)
@@ -44,4 +52,39 @@ class MainPresenter @Inject constructor(
4452
}
4553
}
4654
}
55+
56+
fun removeOldAccount() = currentServer?.let {
57+
removeAccountInteractor.remove(currentServer)
58+
}
59+
60+
fun saveNewAccount() {
61+
currentServer?.let { currentServer ->
62+
with(getSettingsInteractor.get(currentServer)) {
63+
val icon = favicon()?.let {
64+
currentServer.serverLogoUrl(it)
65+
}
66+
val logo = wideTile()?.let {
67+
currentServer.serverLogoUrl(it)
68+
}
69+
val token = tokenRepository.get(currentServer)
70+
val thumb = currentServer.avatarUrl(
71+
userHelper.username() ?: "",
72+
token?.userId,
73+
token?.authToken
74+
)
75+
76+
val account = Account(
77+
siteName() ?: currentServer,
78+
currentServer,
79+
icon,
80+
logo,
81+
userHelper.username() ?: "",
82+
thumb,
83+
token?.userId,
84+
token?.authToken
85+
)
86+
saveAccountInteractor.save(account)
87+
}
88+
}
89+
}
4790
}

0 commit comments

Comments
 (0)