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 #2460 from RocketChat/chore/release-3.5.2
Browse files Browse the repository at this point in the history
[CHORE] Release app version 2077 (3.5.1)
  • Loading branch information
philipbrito authored Aug 23, 2019
2 parents 4e8bc44 + 11d6f01 commit b8f30da
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 56 deletions.
38 changes: 18 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
docker:
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
steps:
- checkout
- run:
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
docker:
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
steps:
- checkout
- run:
Expand All @@ -48,29 +48,29 @@ jobs:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}-{{ checksum "core/build.gradle" }}-{{ checksum "util/build.gradle" }}-{{ checksum "draw/build.gradle" }}-{{ checksum "emoji/build.gradle" }}-{{ checksum "suggestions/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew --no-daemon androidDependencies --quiet --console=plain
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}-{{ checksum "core/build.gradle" }}-{{ checksum "util/build.gradle" }}-{{ checksum "draw/build.gradle" }}-{{ checksum "emoji/build.gradle" }}-{{ checksum "suggestions/build.gradle" }}
- run:
name: Run Lint #, Checkstyles, PMD, Findbugs...
command: ./gradlew --no-daemon lint
name: Run Lint
command: ./gradlew lint
- run:
name: Run Unit test
command: ./gradlew --no-daemon test
command: ./gradlew test
- run:
name: Compile Instrumentation test
command: ./gradlew --no-daemon assembleAndroidTest
command: ./gradlew assembleAndroidTest
- store_artifacts:
path: app/build/reports/
destination: reports
build-play-apk:
build-aab:
docker:
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
steps:
- checkout
- run:
Expand All @@ -90,24 +90,23 @@ jobs:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}-{{ checksum "core/build.gradle" }}-{{ checksum "util/build.gradle" }}-{{ checksum "draw/build.gradle" }}-{{ checksum "emoji/build.gradle" }}-{{ checksum "suggestions/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew --no-daemon androidDependencies --quiet --console=plain
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}-{{ checksum "core/build.gradle" }}-{{ checksum "util/build.gradle" }}-{{ checksum "draw/build.gradle" }}-{{ checksum "emoji/build.gradle" }}-{{ checksum "suggestions/build.gradle" }}
- run:
name: Build APK
command: |
./gradlew --no-daemon assemblePlayRelease --info --console=plain --stacktrace
name: Build AAB
command: ./gradlew bundleRelease
- store_artifacts:
path: app/build/outputs/apk
destination: apks
path: app/build/outputs/bundle
destination: bundle
build-foss-apk:
docker:
- image: circleci/android:api-29
environment:
JAVA_TOOL_OPTIONS: -Xmx5024m
GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
steps:
- checkout
- run:
Expand All @@ -127,16 +126,15 @@ jobs:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}-{{ checksum "core/build.gradle" }}-{{ checksum "util/build.gradle" }}-{{ checksum "draw/build.gradle" }}-{{ checksum "emoji/build.gradle" }}-{{ checksum "suggestions/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew --no-daemon androidDependencies --quiet --console=plain
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}-{{ checksum "core/build.gradle" }}-{{ checksum "util/build.gradle" }}-{{ checksum "draw/build.gradle" }}-{{ checksum "emoji/build.gradle" }}-{{ checksum "suggestions/build.gradle" }}
- run:
name: Build APK
command: |
./gradlew --no-daemon assembleFossRelease --info --console=plain --stacktrace
command: ./gradlew assembleFossRelease
- store_artifacts:
path: app/build/outputs/apk
destination: apks
Expand All @@ -154,7 +152,7 @@ workflows:
- develop
- develop-2.x
- master
- build-play-apk:
- build-aab:
requires:
- build-kotlin-sdk
- build-foss-apk:
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
applicationId "chat.rocket.android"
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 2075
versionCode 2077
versionName "3.5.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MessageInfoFragment : Fragment(), MessageInfoView {

val bundle = arguments
if (bundle != null) {
messageId = bundle.getString(BUNDLE_MESSAGE_ID)
messageId = bundle.getString(BUNDLE_MESSAGE_ID, "")
} else {
requireNotNull(bundle) { "no arguments supplied when the fragment was instantiated" }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UriInteractor @Inject constructor(private val context: Context) {
/**
* Returns the MimeType from the [Uri].
*/
fun getMimeType(uri: Uri): String = uri.getMimeType(context)
fun getMimeType(uri: Uri): String = uri.getMimeType(context) ?: ".png"

/**
* Returns the file size from the [Uri].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR

override fun copyToClipboard(message: String) {
ui {
val clipboard = it.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
clipboard.primaryClip = ClipData.newPlainText("", message)
(it.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager).apply {
setPrimaryClip(ClipData.newPlainText("", message))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) {
var bitmap: Bitmap? = null

activity?.let { context ->
uri.getMimeType(context).let {
uri.getMimeType(context)?.let {
mimeType = it
description.text.clear()
when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MainActivity : AppCompatActivity(), HasActivityInjector,
val config = Configuration()

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
config.locales = LocaleList(locale)
config.setLocales(LocaleList(locale))
} else {
config.locale = locale
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.app.Activity
import android.content.Intent

fun Intent.isSupportedLink(activity: Activity): Boolean {
return (action == Intent.ACTION_VIEW && data != null && (data.isDynamicLink(activity) ||
data.isAuthenticationDeepLink(activity) ||
data.isCustomSchemeRoomLink() ||
data.isWebSchemeRoomLink()))
return (action == Intent.ACTION_VIEW && data != null && (data?.isDynamicLink(activity) == true ||
data?.isAuthenticationDeepLink(activity) == true ||
data?.isCustomSchemeRoomLink() == true ||
data?.isWebSchemeRoomLink() == true))
}
32 changes: 13 additions & 19 deletions app/src/main/java/chat/rocket/android/util/extensions/Uri.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fun Uri.getFileSize(context: Context): Int {
return fileSize?.toIntOrNull() ?: -1
}

fun Uri.getMimeType(context: Context): String {
fun Uri.getMimeType(context: Context): String? {
return if (scheme == ContentResolver.SCHEME_CONTENT) {
context.contentResolver?.getType(this) ?: ""
} else {
Expand Down Expand Up @@ -121,7 +121,7 @@ fun Uri.getDeepLinkInfo(context: Context): DeepLinkInfo? {
return when {
isAuthenticationDeepLink(context) -> {
val host = getQueryParameter("host")
val url = if (host.startsWith("http")) host else "https://$host"
val url = if (host?.startsWith("http") == true) host else "https://$host"
val userId = getQueryParameter("userId")
val token = getQueryParameter("token")
try {
Expand All @@ -133,12 +133,12 @@ fun Uri.getDeepLinkInfo(context: Context): DeepLinkInfo? {
}
isCustomSchemeRoomLink() -> {
val hostValue = getQueryParameter("host")
val url = if (hostValue.startsWith("http")) hostValue else "https://$hostValue"
val url = if (hostValue?.startsWith("http") == true) hostValue else "https://$hostValue"
val rid = getQueryParameter("rid")
val pathValue = getQueryParameter("path")
val pathSplit = pathValue.split("/")
val roomType = pathSplit[0]
val roomName = pathSplit[1]
val pathSplit = pathValue?.split("/")
val roomType = pathSplit?.get(0)
val roomName = pathSplit?.get(1)
try {
DeepLinkInfo(url, null, null, rid, roomType, roomName)
} catch (ex: Exception) {
Expand All @@ -148,9 +148,9 @@ fun Uri.getDeepLinkInfo(context: Context): DeepLinkInfo? {
}
isWebSchemeRoomLink() -> {
val url = "https://$host"
val pathSplit = path.split("/")
val roomType = pathSplit[1]
val roomName = pathSplit[2]
val pathSplit = path?.split("/")
val roomType = pathSplit?.get(1)
val roomName = pathSplit?.get(2)
try {
DeepLinkInfo(url, null, null, null, roomType, roomName)
} catch (ex: Exception) {
Expand All @@ -163,7 +163,7 @@ fun Uri.getDeepLinkInfo(context: Context): DeepLinkInfo? {
}

fun Uri.isDynamicLink(activity: Activity): Boolean {
return (host != null && host.contains(activity.getString(R.string.dynamic_link_host_url)))
return (host != null && host?.contains(activity.getString(R.string.dynamic_link_host_url)) == true)
}

// Authentication deep link defined here: https://rocket.chat/docs/developer-guides/deeplink/#authentication
Expand All @@ -177,17 +177,11 @@ fun Uri.isAuthenticationDeepLink(context: Context): Boolean {

// Custom scheme room deep link defined here: https://rocket.chat/docs/developer-guides/deeplink/#channel--group--dm
fun Uri.isCustomSchemeRoomLink(): Boolean {
if (scheme.startsWith("rocketchat") &&
host == "room")
return true
return false
return (scheme?.startsWith("rocketchat")) == true && host == "room"
}

// http(s) scheme deep link not yet documented. Ex: https://open.rocket.chat/direct/testuser1
fun Uri.isWebSchemeRoomLink(): Boolean {
val roomType = path.split("/")[1]
if (scheme.startsWith("http") &&
(roomType == "channel" || roomType == "group" || roomType == "direct"))
return true
return false
val roomType = path?.split("/")?.get(1)
return (scheme?.startsWith("http")) == true && (roomType == "channel" || roomType == "group" || roomType == "direct")
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}"
classpath 'com.google.gms:google-services:4.3.0'
Expand Down
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ ext {
// For project configuration
java : JavaVersion.VERSION_1_8,
minSdk : 21,
compileSdk : 28,
targetSdk : 28,
compileSdk : 29,
targetSdk : 29,
buildTools : '29.0.1',
dokka : '0.9.16',

Expand Down
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Tue May 14 21:15:38 BRT 2019
#Wed Aug 21 11:31:33 BRT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionSha256Sum=53b71812f18cdb2777e9f1b2a0f2038683907c90bdc406bc64d8b400e1fb2c3b
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

0 comments on commit b8f30da

Please sign in to comment.