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

Commit

Permalink
Merge pull request #2431 from RocketChat/beta
Browse files Browse the repository at this point in the history
[RELEASE] Merge BETA into MASTER
  • Loading branch information
philipbrito authored Jul 26, 2019
2 parents a3e993f + 8d68569 commit 413f10c
Show file tree
Hide file tree
Showing 127 changed files with 2,848 additions and 1,247 deletions.
14 changes: 5 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
version: 2
build:
machine:
java: oraclejdk8
jobs:
build-kotlin-sdk:
docker:
- image: circleci/android:api-28-alpha
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
steps:
Expand All @@ -15,7 +12,7 @@ jobs:
command: git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git ../Rocket.Chat.Kotlin.SDK
- run:
name: ANDROID_HOME
command: echo "sdk.dir="$ANDROID_HOME > local.properties
command: echo "sdk.dir="$ANDROID_HOME > local.properties
- run:
name: Build Kotlin.SDK
command: pushd app/ ; ./build-sdk.sh ; popd
Expand All @@ -34,7 +31,7 @@ jobs:
destination: libs
code-analysis:
docker:
- image: circleci/android:api-28-alpha
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
steps:
Expand Down Expand Up @@ -71,7 +68,7 @@ jobs:
destination: reports
build-play-apk:
docker:
- image: circleci/android:api-28-alpha
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
steps:
Expand Down Expand Up @@ -108,7 +105,7 @@ jobs:
destination: apks
build-foss-apk:
docker:
- image: circleci/android:api-28-alpha
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
steps:
Expand Down Expand Up @@ -143,7 +140,6 @@ jobs:
- store_artifacts:
path: app/build/outputs/apk
destination: apks

workflows:
version: 2
build-deploy:
Expand Down
16 changes: 6 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId "chat.rocket.android"
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 2070
versionName "3.4.2"
versionCode 2074
versionName "3.5.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true

Expand All @@ -37,11 +37,6 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

// For Jitsi
ndk {
abiFilters "armeabi-v7a", "x86"
}
}

signingConfigs {
Expand Down Expand Up @@ -169,16 +164,17 @@ dependencies {
implementation libraries.glide
implementation libraries.glideTransformations

implementation(libraries.jitsi) { transitive = true }
implementation (libraries.jitsi) { transitive = true }

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

// Proprietary libraries
playImplementation libraries.fcm
playImplementation libraries.firebaseAnalytics
playImplementation (libraries.firebaseCrashlytics) { transitive = true }
playImplementation (libraries.firebaseAnswers) { transitive = true }
playImplementation libraries.dynamiclinks
playImplementation libraries.playServicesAuth
playImplementation('com.crashlytics.sdk.android:crashlytics:2.9.8@aar') { transitive = true }
playImplementation('com.crashlytics.sdk.android:answers:1.4.6@aar') { transitive = true }

testImplementation libraries.junit
testImplementation libraries.truth
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package chat.rocket.android.dynamiclinks

import android.content.Context
import android.content.Intent
import android.net.Uri
import javax.inject.Inject

class DynamicLinksForFirebase @Inject constructor(private val context: Context) : DynamicLinks {

override fun getDynamicLink(intent: Intent, deepLinkCallback: (Uri?) -> Unit? ) {
deepLinkCallback(null)
}

override fun createDynamicLink(username: String?, server: String, deepLinkCallback: (String?) -> Unit?) {
deepLinkCallback(null)
}
}
13 changes: 13 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<activity
android:name=".authentication.ui.AuthenticationActivity"
android:configChanges="orientation"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize">
Expand All @@ -49,6 +50,18 @@
android:path="/auth"
android:scheme="https" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />

<data
android:host="rocketchat.page.link"
android:scheme="https" />

</intent-filter>
</activity>

<activity
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/chat/rocket/android/analytics/Analytics.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package chat.rocket.android.analytics

import chat.rocket.android.analytics.event.AuthenticationEvent
import chat.rocket.android.analytics.event.InviteType
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.analytics.event.SubscriptionTypeEvent

Expand Down Expand Up @@ -80,6 +81,13 @@ interface Analytics {
*/
fun logVideoConference(event: SubscriptionTypeEvent, serverUrl: String) {}

/**
* Logs the invitation sent event.
*
* @param inviteType The method of invite to log, currently only 'share' using the share intent.
*/
fun logInviteSent(inviteType: InviteType) {}

/**
* Logs the add reaction message action.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package chat.rocket.android.analytics

import chat.rocket.android.analytics.event.AuthenticationEvent
import chat.rocket.android.analytics.event.InviteType
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.analytics.event.SubscriptionTypeEvent
import chat.rocket.android.server.domain.AnalyticsTrackingInteractor
Expand Down Expand Up @@ -83,6 +84,12 @@ class AnalyticsManager @Inject constructor(
}
}

fun logInviteSent(inviteType: InviteType) {
if (analyticsTrackingInteractor.get()) {
analytics.forEach { it.logInviteSent(inviteType)}
}
}

fun logMessageActionAddReaction() {
if (analyticsTrackingInteractor.get()) {
analytics.forEach { it.logMessageActionAddReaction() }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package chat.rocket.android.analytics.event

enum class InviteType(val inviteTypeName: String) {
ViaApp("viaApp")
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ sealed class ScreenViewEvent(val screenName: String) {
object RegisterUsername : ScreenViewEvent("RegisterUsernameFragment")
object ResetPassword : ScreenViewEvent("ResetPasswordFragment")

object About : ScreenViewEvent("AboutFragment")
object ChatRoom : ScreenViewEvent("ChatRoomFragment")
object ChatRooms : ScreenViewEvent("ChatRoomsFragment")
object CreateChannel : ScreenViewEvent("CreateChannelFragment")
object UserDetails : ScreenViewEvent("UserDetailsFragment")
object FavoriteMessages : ScreenViewEvent("FavoriteMessagesFragment")
object Files : ScreenViewEvent("FilesFragment")
object Members : ScreenViewEvent("MembersFragment")
object InviteUsers : ScreenViewEvent("InviteUsersFragment")
object Mentions : ScreenViewEvent("MentionsFragment")
object MessageInfo : ScreenViewEvent("MessageInfoFragment")
object Password : ScreenViewEvent("PasswordFragment")
object PinnedMessages : ScreenViewEvent("PinnedMessagesFragment")
object Preferences : ScreenViewEvent("PreferencesFragment")
object Profile : ScreenViewEvent("ProfileFragment")
object Settings : ScreenViewEvent("SettingsFragment")
object Directory : ScreenViewEvent("DirectoryFragment")
Expand Down
27 changes: 12 additions & 15 deletions app/src/main/java/chat/rocket/android/app/AppLifecycleObserver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,33 @@ package chat.rocket.android.app
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import chat.rocket.android.server.domain.GetCurrentServerInteractor
import chat.rocket.android.server.infrastructure.ConnectionManagerFactory
import chat.rocket.android.server.infrastructure.RocketChatClientFactory
import chat.rocket.common.model.UserStatus
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import chat.rocket.core.internal.realtime.setTemporaryStatus
import javax.inject.Inject
import javax.inject.Named

class AppLifecycleObserver @Inject constructor(
private val serverInteractor: GetCurrentServerInteractor,
private val factory: ConnectionManagerFactory
@Named("currentServer") private val currentServer: String?,
private val rocketChatClientFactory: RocketChatClientFactory,
private val connectionManagerFactory: ConnectionManagerFactory
) : LifecycleObserver {

@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onEnterForeground() {
changeTemporaryStatus(UserStatus.Online())
serverInteractor.get()?.let { currentServer ->
factory.create(currentServer).resetReconnectionTimer()
currentServer?.let {
connectionManagerFactory.create(it)?.resetReconnectionTimer()
}
}

@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
fun onEnterBackground() {
fun onEnterBackground() =
changeTemporaryStatus(UserStatus.Away())
}

private fun changeTemporaryStatus(userStatus: UserStatus) {
GlobalScope.launch {
serverInteractor.get()?.let { currentServer ->
factory.create(currentServer).setTemporaryStatus(userStatus)
}
}
private fun changeTemporaryStatus(userStatus: UserStatus) = currentServer?.let {
rocketChatClientFactory.get(it).setTemporaryStatus(userStatus)
}

}
16 changes: 9 additions & 7 deletions app/src/main/java/chat/rocket/android/app/DateTimeHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ object DateTimeHelper {
* @return The date or the textual representation from a [LocalDateTime].
*/
fun getDate(localDateTime: LocalDateTime, context: Context): String {
val localDate = localDateTime.toLocalDate()
return when (localDate) {
return when (val localDate = localDateTime.toLocalDate()) {
today -> formatLocalTime(localDateTime.toLocalTime())
yesterday -> context.getString(R.string.msg_yesterday)
else -> {
Expand All @@ -50,8 +49,7 @@ object DateTimeHelper {
}

fun getFormattedDateForMessages(localDateTime: LocalDateTime, context: Context): String {
val localDate = localDateTime.toLocalDate()
return when (localDate) {
return when (val localDate = localDateTime.toLocalDate()) {
today -> context.getString(R.string.msg_today)
yesterday -> context.getString(R.string.msg_yesterday)
else -> formatLocalDate(localDate)
Expand All @@ -64,9 +62,13 @@ object DateTimeHelper {
* @param localDateTime The [LocalDateTime].
* @return The time from a [LocalDateTime].
*/
fun getTime(localDateTime: LocalDateTime): String {
val formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
return localDateTime.toLocalTime().format(formatter).toString()
fun getTime(localDateTime: LocalDateTime, showDateAndHour: Boolean = false): String {
return if (showDateAndHour) {
formatLocalDateTime(localDateTime)
} else {
val formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
localDateTime.toLocalTime().format(formatter).toString()
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package chat.rocket.android.authentication.domain.model

import android.annotation.SuppressLint
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize

// see https://rocket.chat/docs/developer-guides/deeplink/ for documentation

const val DEEP_LINK_INFO_KEY = "deep_link_info"

@SuppressLint("ParcelCreator")
@Parcelize
data class DeepLinkInfo(
val url: String,
val userId: String?,
val token: String?,
val rid: String?,
val roomType: String?,
val roomName: String?
) : Parcelable

This file was deleted.

Loading

0 comments on commit 413f10c

Please sign in to comment.