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

Commit 413f10c

Browse files
authored
Merge pull request #2431 from RocketChat/beta
[RELEASE] Merge BETA into MASTER
2 parents a3e993f + 8d68569 commit 413f10c

File tree

127 files changed

+2848
-1247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2848
-1247
lines changed

.circleci/config.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
version: 2
2-
build:
3-
machine:
4-
java: oraclejdk8
52
jobs:
63
build-kotlin-sdk:
74
docker:
8-
- image: circleci/android:api-28-alpha
5+
- image: circleci/android:api-29
96
environment:
107
JAVA_TOOL_OPTIONS: -Xmx5024m
118
steps:
@@ -15,7 +12,7 @@ jobs:
1512
command: git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git ../Rocket.Chat.Kotlin.SDK
1613
- run:
1714
name: ANDROID_HOME
18-
command: echo "sdk.dir="$ANDROID_HOME > local.properties
15+
command: echo "sdk.dir="$ANDROID_HOME > local.properties
1916
- run:
2017
name: Build Kotlin.SDK
2118
command: pushd app/ ; ./build-sdk.sh ; popd
@@ -34,7 +31,7 @@ jobs:
3431
destination: libs
3532
code-analysis:
3633
docker:
37-
- image: circleci/android:api-28-alpha
34+
- image: circleci/android:api-29
3835
environment:
3936
JAVA_TOOL_OPTIONS: -Xmx5024m
4037
steps:
@@ -71,7 +68,7 @@ jobs:
7168
destination: reports
7269
build-play-apk:
7370
docker:
74-
- image: circleci/android:api-28-alpha
71+
- image: circleci/android:api-29
7572
environment:
7673
JAVA_TOOL_OPTIONS: -Xmx5024m
7774
steps:
@@ -108,7 +105,7 @@ jobs:
108105
destination: apks
109106
build-foss-apk:
110107
docker:
111-
- image: circleci/android:api-28-alpha
108+
- image: circleci/android:api-29
112109
environment:
113110
JAVA_TOOL_OPTIONS: -Xmx5024m
114111
steps:
@@ -143,7 +140,6 @@ jobs:
143140
- store_artifacts:
144141
path: app/build/outputs/apk
145142
destination: apks
146-
147143
workflows:
148144
version: 2
149145
build-deploy:

app/build.gradle

Lines changed: 6 additions & 10 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 2070
22-
versionName "3.4.2"
21+
versionCode 2074
22+
versionName "3.5.0"
2323
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2424
multiDexEnabled true
2525

@@ -37,11 +37,6 @@ android {
3737
sourceCompatibility JavaVersion.VERSION_1_8
3838
targetCompatibility JavaVersion.VERSION_1_8
3939
}
40-
41-
// For Jitsi
42-
ndk {
43-
abiFilters "armeabi-v7a", "x86"
44-
}
4540
}
4641

4742
signingConfigs {
@@ -169,16 +164,17 @@ dependencies {
169164
implementation libraries.glide
170165
implementation libraries.glideTransformations
171166

172-
implementation(libraries.jitsi) { transitive = true }
167+
implementation (libraries.jitsi) { transitive = true }
173168

174169
implementation 'com.google.code.findbugs:jsr305:3.0.2'
175170

176171
// Proprietary libraries
177172
playImplementation libraries.fcm
178173
playImplementation libraries.firebaseAnalytics
174+
playImplementation (libraries.firebaseCrashlytics) { transitive = true }
175+
playImplementation (libraries.firebaseAnswers) { transitive = true }
176+
playImplementation libraries.dynamiclinks
179177
playImplementation libraries.playServicesAuth
180-
playImplementation('com.crashlytics.sdk.android:crashlytics:2.9.8@aar') { transitive = true }
181-
playImplementation('com.crashlytics.sdk.android:answers:1.4.6@aar') { transitive = true }
182178

183179
testImplementation libraries.junit
184180
testImplementation libraries.truth
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package chat.rocket.android.dynamiclinks
2+
3+
import android.content.Context
4+
import android.content.Intent
5+
import android.net.Uri
6+
import javax.inject.Inject
7+
8+
class DynamicLinksForFirebase @Inject constructor(private val context: Context) : DynamicLinks {
9+
10+
override fun getDynamicLink(intent: Intent, deepLinkCallback: (Uri?) -> Unit? ) {
11+
deepLinkCallback(null)
12+
}
13+
14+
override fun createDynamicLink(username: String?, server: String, deepLinkCallback: (String?) -> Unit?) {
15+
deepLinkCallback(null)
16+
}
17+
}

app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<activity
2424
android:name=".authentication.ui.AuthenticationActivity"
2525
android:configChanges="orientation"
26+
android:launchMode="singleTask"
2627
android:screenOrientation="portrait"
2728
android:theme="@style/AppTheme"
2829
android:windowSoftInputMode="adjustResize">
@@ -49,6 +50,18 @@
4950
android:path="/auth"
5051
android:scheme="https" />
5152
</intent-filter>
53+
54+
<intent-filter>
55+
<action android:name="android.intent.action.VIEW" />
56+
57+
<category android:name="android.intent.category.BROWSABLE" />
58+
<category android:name="android.intent.category.DEFAULT" />
59+
60+
<data
61+
android:host="rocketchat.page.link"
62+
android:scheme="https" />
63+
64+
</intent-filter>
5265
</activity>
5366

5467
<activity

app/src/main/java/chat/rocket/android/analytics/Analytics.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package chat.rocket.android.analytics
22

33
import chat.rocket.android.analytics.event.AuthenticationEvent
4+
import chat.rocket.android.analytics.event.InviteType
45
import chat.rocket.android.analytics.event.ScreenViewEvent
56
import chat.rocket.android.analytics.event.SubscriptionTypeEvent
67

@@ -80,6 +81,13 @@ interface Analytics {
8081
*/
8182
fun logVideoConference(event: SubscriptionTypeEvent, serverUrl: String) {}
8283

84+
/**
85+
* Logs the invitation sent event.
86+
*
87+
* @param inviteType The method of invite to log, currently only 'share' using the share intent.
88+
*/
89+
fun logInviteSent(inviteType: InviteType) {}
90+
8391
/**
8492
* Logs the add reaction message action.
8593
*/

app/src/main/java/chat/rocket/android/analytics/AnalyticsManager.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package chat.rocket.android.analytics
22

33
import chat.rocket.android.analytics.event.AuthenticationEvent
4+
import chat.rocket.android.analytics.event.InviteType
45
import chat.rocket.android.analytics.event.ScreenViewEvent
56
import chat.rocket.android.analytics.event.SubscriptionTypeEvent
67
import chat.rocket.android.server.domain.AnalyticsTrackingInteractor
@@ -83,6 +84,12 @@ class AnalyticsManager @Inject constructor(
8384
}
8485
}
8586

87+
fun logInviteSent(inviteType: InviteType) {
88+
if (analyticsTrackingInteractor.get()) {
89+
analytics.forEach { it.logInviteSent(inviteType)}
90+
}
91+
}
92+
8693
fun logMessageActionAddReaction() {
8794
if (analyticsTrackingInteractor.get()) {
8895
analytics.forEach { it.logMessageActionAddReaction() }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package chat.rocket.android.analytics.event
2+
3+
enum class InviteType(val inviteTypeName: String) {
4+
ViaApp("viaApp")
5+
}

app/src/main/java/chat/rocket/android/analytics/event/ScreenViewEvent.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@ sealed class ScreenViewEvent(val screenName: String) {
1212
object RegisterUsername : ScreenViewEvent("RegisterUsernameFragment")
1313
object ResetPassword : ScreenViewEvent("ResetPasswordFragment")
1414

15-
object About : ScreenViewEvent("AboutFragment")
1615
object ChatRoom : ScreenViewEvent("ChatRoomFragment")
1716
object ChatRooms : ScreenViewEvent("ChatRoomsFragment")
1817
object CreateChannel : ScreenViewEvent("CreateChannelFragment")
1918
object UserDetails : ScreenViewEvent("UserDetailsFragment")
2019
object FavoriteMessages : ScreenViewEvent("FavoriteMessagesFragment")
2120
object Files : ScreenViewEvent("FilesFragment")
2221
object Members : ScreenViewEvent("MembersFragment")
22+
object InviteUsers : ScreenViewEvent("InviteUsersFragment")
2323
object Mentions : ScreenViewEvent("MentionsFragment")
2424
object MessageInfo : ScreenViewEvent("MessageInfoFragment")
2525
object Password : ScreenViewEvent("PasswordFragment")
2626
object PinnedMessages : ScreenViewEvent("PinnedMessagesFragment")
27-
object Preferences : ScreenViewEvent("PreferencesFragment")
2827
object Profile : ScreenViewEvent("ProfileFragment")
2928
object Settings : ScreenViewEvent("SettingsFragment")
3029
object Directory : ScreenViewEvent("DirectoryFragment")

app/src/main/java/chat/rocket/android/app/AppLifecycleObserver.kt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,33 @@ package chat.rocket.android.app
33
import androidx.lifecycle.Lifecycle
44
import androidx.lifecycle.LifecycleObserver
55
import androidx.lifecycle.OnLifecycleEvent
6-
import chat.rocket.android.server.domain.GetCurrentServerInteractor
76
import chat.rocket.android.server.infrastructure.ConnectionManagerFactory
7+
import chat.rocket.android.server.infrastructure.RocketChatClientFactory
88
import chat.rocket.common.model.UserStatus
9-
import kotlinx.coroutines.GlobalScope
10-
import kotlinx.coroutines.launch
9+
import chat.rocket.core.internal.realtime.setTemporaryStatus
1110
import javax.inject.Inject
11+
import javax.inject.Named
1212

1313
class AppLifecycleObserver @Inject constructor(
14-
private val serverInteractor: GetCurrentServerInteractor,
15-
private val factory: ConnectionManagerFactory
14+
@Named("currentServer") private val currentServer: String?,
15+
private val rocketChatClientFactory: RocketChatClientFactory,
16+
private val connectionManagerFactory: ConnectionManagerFactory
1617
) : LifecycleObserver {
1718

1819
@OnLifecycleEvent(Lifecycle.Event.ON_START)
1920
fun onEnterForeground() {
2021
changeTemporaryStatus(UserStatus.Online())
21-
serverInteractor.get()?.let { currentServer ->
22-
factory.create(currentServer).resetReconnectionTimer()
22+
currentServer?.let {
23+
connectionManagerFactory.create(it)?.resetReconnectionTimer()
2324
}
2425
}
2526

2627
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
27-
fun onEnterBackground() {
28+
fun onEnterBackground() =
2829
changeTemporaryStatus(UserStatus.Away())
29-
}
3030

31-
private fun changeTemporaryStatus(userStatus: UserStatus) {
32-
GlobalScope.launch {
33-
serverInteractor.get()?.let { currentServer ->
34-
factory.create(currentServer).setTemporaryStatus(userStatus)
35-
}
36-
}
31+
private fun changeTemporaryStatus(userStatus: UserStatus) = currentServer?.let {
32+
rocketChatClientFactory.get(it).setTemporaryStatus(userStatus)
3733
}
34+
3835
}

app/src/main/java/chat/rocket/android/app/DateTimeHelper.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ object DateTimeHelper {
3535
* @return The date or the textual representation from a [LocalDateTime].
3636
*/
3737
fun getDate(localDateTime: LocalDateTime, context: Context): String {
38-
val localDate = localDateTime.toLocalDate()
39-
return when (localDate) {
38+
return when (val localDate = localDateTime.toLocalDate()) {
4039
today -> formatLocalTime(localDateTime.toLocalTime())
4140
yesterday -> context.getString(R.string.msg_yesterday)
4241
else -> {
@@ -50,8 +49,7 @@ object DateTimeHelper {
5049
}
5150

5251
fun getFormattedDateForMessages(localDateTime: LocalDateTime, context: Context): String {
53-
val localDate = localDateTime.toLocalDate()
54-
return when (localDate) {
52+
return when (val localDate = localDateTime.toLocalDate()) {
5553
today -> context.getString(R.string.msg_today)
5654
yesterday -> context.getString(R.string.msg_yesterday)
5755
else -> formatLocalDate(localDate)
@@ -64,9 +62,13 @@ object DateTimeHelper {
6462
* @param localDateTime The [LocalDateTime].
6563
* @return The time from a [LocalDateTime].
6664
*/
67-
fun getTime(localDateTime: LocalDateTime): String {
68-
val formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
69-
return localDateTime.toLocalTime().format(formatter).toString()
65+
fun getTime(localDateTime: LocalDateTime, showDateAndHour: Boolean = false): String {
66+
return if (showDateAndHour) {
67+
formatLocalDateTime(localDateTime)
68+
} else {
69+
val formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
70+
localDateTime.toLocalTime().format(formatter).toString()
71+
}
7072
}
7173

7274
/**

0 commit comments

Comments
 (0)