Commit 728f4011 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Merge branch 'develop' of github.com:RocketChat/Rocket.Chat.Android into new/admin-panel

parents 07dfbcdc 960de03e
...@@ -64,7 +64,7 @@ jobs: ...@@ -64,7 +64,7 @@ jobs:
- store_artifacts: - store_artifacts:
path: app/build/reports/ path: app/build/reports/
destination: reports destination: reports
build-apk: build-play-apk:
docker: docker:
- image: circleci/android:api-27-alpha - image: circleci/android:api-27-alpha
environment: environment:
...@@ -93,7 +93,40 @@ jobs: ...@@ -93,7 +93,40 @@ jobs:
- run: - run:
name: Build APK name: Build APK
command: | command: |
./gradlew assembleRelease --info --console=plain --stacktrace ./gradlew assemblePlayRelease --info --console=plain --stacktrace
- store_artifacts:
path: app/build/outputs/apk
destination: apks
build-foss-apk:
docker:
- image: circleci/android:api-27-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- run:
name: restore files from ENV
command: |
echo $ROCKET_JKS_BASE64 | base64 --decode > Rocket.jks
echo $ROCKET_PLAY_JSON | base64 --decode > app/rocket-chat.json
- run:
name: checkout Rocket.Chat.Kotlin.SDK
command: git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git ../Rocket.Chat.Kotlin.SDK
- restore_cache:
key: kotlin-sdk-{{ .Revision }}
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies --quiet --console=plain
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "player/build.gradle" }}
- run:
name: Build APK
command: |
./gradlew assembleFossRelease --info --console=plain --stacktrace
- store_artifacts: - store_artifacts:
path: app/build/outputs/apk path: app/build/outputs/apk
destination: apks destination: apks
...@@ -112,6 +145,9 @@ workflows: ...@@ -112,6 +145,9 @@ workflows:
- develop - develop
- develop-2.x - develop-2.x
- master - master
- build-apk: - build-play-apk:
requires:
- build-kotlin-sdk
- build-foss-apk:
requires: requires:
- build-kotlin-sdk - build-kotlin-sdk
#!/bin/bash #!/bin/bash
CURRENT_DIR=$(pwd) CURRENT_DIR=$(pwd)
# The SDK dir should be 2 directories up in the tree, so we use dirname 2 times
# to get the common parent dir of the SDK and the app
GIT=$(which git) GIT=$(which git)
cd ../..
tmp=$(pwd) if [ "$#" -eq 1 ] && [ ! -z "$1" ]; then
SDK_DIR="$tmp/Rocket.Chat.Kotlin.SDK" # if in an argument is given this is the (relative) path to SDK_DIR
cd "${CURRENT_DIR}" SDK_DIR=$(readlink -f $1)
else
# The SDK dir should be 2 directories up in the tree, so we use dirname 2 times
# to get the common parent dir of the SDK and the app
cd ../..
tmp=$(pwd)
SDK_DIR="$tmp/Rocket.Chat.Kotlin.SDK"
cd "${CURRENT_DIR}"
fi
echo "CURRENT DIR: $CURRENT_DIR" echo "CURRENT DIR: $CURRENT_DIR"
echo "SDK DIR: $SDK_DIR" echo "SDK DIR: $SDK_DIR"
......
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
def isPlay = !(taskRequests.contains("Foss") || taskRequests.contains("foss"))
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'io.fabric' if (isPlay) { apply plugin: 'io.fabric' }
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
...@@ -17,6 +20,10 @@ android { ...@@ -17,6 +20,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true multiDexEnabled true
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new GregorianCalendar().format("MM-dd-yyyy' 'h:mm:ss a z")
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
...@@ -57,6 +64,20 @@ android { ...@@ -57,6 +64,20 @@ android {
} }
} }
flavorDimensions "type"
productFlavors {
// includes proprietary libs
play {
dimension "type"
}
// only foss
foss {
dimension "type"
}
}
packagingOptions { packagingOptions {
exclude 'META-INF/core.kotlin_module' exclude 'META-INF/core.kotlin_module'
exclude 'META-INF/main.kotlin_module' exclude 'META-INF/main.kotlin_module'
...@@ -91,9 +112,6 @@ dependencies { ...@@ -91,9 +112,6 @@ dependencies {
kapt libraries.daggerProcessor kapt libraries.daggerProcessor
kapt libraries.daggerAndroidApt kapt libraries.daggerAndroidApt
implementation libraries.fcm
implementation libraries.playServicesAuth
implementation libraries.room implementation libraries.room
kapt libraries.roomProcessor kapt libraries.roomProcessor
implementation libraries.lifecycleExtensions implementation libraries.lifecycleExtensions
...@@ -126,7 +144,10 @@ dependencies { ...@@ -126,7 +144,10 @@ dependencies {
implementation "com.github.luciofm:livedata-ktx:b1e8bbc25a" implementation "com.github.luciofm:livedata-ktx:b1e8bbc25a"
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') { playImplementation libraries.fcm
playImplementation libraries.playServicesAuth
playImplementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true transitive = true
} }
...@@ -148,13 +169,16 @@ androidExtensions { ...@@ -148,13 +169,16 @@ androidExtensions {
// FIXME - build and install the sdk into the app/libs directory // FIXME - build and install the sdk into the app/libs directory
// We were having some issues with the kapt generated files from the sdk when importing as a module // We were having some issues with the kapt generated files from the sdk when importing as a module
def sdk_location=project.properties['sdk_location'] ?: ""
task compileSdk(type:Exec) { task compileSdk(type:Exec) {
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) { if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', 'build-sdk.sh' commandLine 'cmd', '/c', 'build-sdk.sh', sdk_location
} else { } else {
commandLine './build-sdk.sh' commandLine './build-sdk.sh', sdk_location
} }
} }
preBuild.dependsOn compileSdk preBuild.dependsOn compileSdk
if (isPlay) {
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
}
package chat.rocket.android.dagger.module
import chat.rocket.android.chatroom.di.MessageServiceProvider
import chat.rocket.android.chatroom.service.MessageService
import dagger.Module
import dagger.android.ContributesAndroidInjector
@Module abstract class ServiceBuilder {
@ContributesAndroidInjector(modules = [MessageServiceProvider::class])
abstract fun bindMessageService(): MessageService
}
package chat.rocket.android.helper
import android.app.Activity
import android.content.Intent
import androidx.fragment.app.FragmentActivity
fun FragmentActivity.saveCredentials(id: String, password: String) {
}
fun Activity.requestStoredCredentials(): Pair<String, String>? = null
fun getCredentials(data: Intent): Pair<String, String>? = null
fun hasCredentialsSupport() = false
\ No newline at end of file
package chat.rocket.android.helper
import timber.log.Timber
import android.util.Log
class CrashlyticsTree : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, throwable: Throwable?) {
Log.println(priority, tag, message)
if (throwable != null) {
Log.e(tag,throwable.toString())
}
}
}
package chat.rocket.android.push
class FirebaseTokenService {
}
\ No newline at end of file
package chat.rocket.android.util
import android.content.Context
fun setupCrashlytics(context: Context) {
//Do absolutely nothing
}
package chat.rocket.android.util
import chat.rocket.android.main.ui.MainActivity
import chat.rocket.android.main.presentation.MainPresenter
fun refreshFCMToken(presenter: MainPresenter) {
//Do absolutely nothing
}
fun invalidateFirebaseToken(token: String) {
//Do absolutely nothing
}
\ No newline at end of file
...@@ -95,23 +95,6 @@ ...@@ -95,23 +95,6 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<service
android:name=".push.FirebaseTokenService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name=".push.FirebaseMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service <service
android:name=".chatroom.service.MessageService" android:name=".chatroom.service.MessageService"
android:exported="true" android:exported="true"
......
...@@ -4,6 +4,7 @@ import android.os.Bundle ...@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import chat.rocket.android.BuildConfig import chat.rocket.android.BuildConfig
import chat.rocket.android.R import chat.rocket.android.R
...@@ -29,8 +30,9 @@ class AboutFragment : Fragment() { ...@@ -29,8 +30,9 @@ class AboutFragment : Fragment() {
} }
private fun setupViews() { private fun setupViews() {
text_version_name.text = getString(R.string.msg_version, BuildConfig.VERSION_NAME) text_version_name.text = BuildConfig.VERSION_NAME
text_build_number.text = getString(R.string.msg_build, BuildConfig.VERSION_CODE) text_build_number.text = getString(R.string.msg_build, BuildConfig.VERSION_CODE,
BuildConfig.GIT_SHA, BuildConfig.FLAVOR)
} }
private fun setupToolbar() { private fun setupToolbar() {
......
...@@ -22,6 +22,9 @@ class AppLifecycleObserver @Inject constructor( ...@@ -22,6 +22,9 @@ class AppLifecycleObserver @Inject constructor(
@OnLifecycleEvent(Lifecycle.Event.ON_START) @OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onEnterForeground() { fun onEnterForeground() {
changeTemporaryStatus(UserStatus.Online()) changeTemporaryStatus(UserStatus.Online())
serverInteractor.get()?.let { currentServer ->
factory.create(currentServer).resetReconnectionTimer()
}
} }
@OnLifecycleEvent(Lifecycle.Event.ON_STOP) @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
......
...@@ -13,15 +13,13 @@ import chat.rocket.android.dagger.DaggerAppComponent ...@@ -13,15 +13,13 @@ import chat.rocket.android.dagger.DaggerAppComponent
import chat.rocket.android.dagger.qualifier.ForMessages import chat.rocket.android.dagger.qualifier.ForMessages
import chat.rocket.android.helper.CrashlyticsTree import chat.rocket.android.helper.CrashlyticsTree
import chat.rocket.android.infrastructure.LocalRepository import chat.rocket.android.infrastructure.LocalRepository
import chat.rocket.android.infrastructure.installCrashlyticsWrapper
import chat.rocket.android.server.domain.AccountsRepository import chat.rocket.android.server.domain.AccountsRepository
import chat.rocket.android.server.domain.GetCurrentServerInteractor import chat.rocket.android.server.domain.GetCurrentServerInteractor
import chat.rocket.android.server.domain.GetSettingsInteractor import chat.rocket.android.server.domain.GetSettingsInteractor
import chat.rocket.android.server.domain.SITE_URL import chat.rocket.android.server.domain.SITE_URL
import chat.rocket.android.server.domain.TokenRepository import chat.rocket.android.server.domain.TokenRepository
import chat.rocket.android.emoji.EmojiRepository import chat.rocket.android.emoji.EmojiRepository
import com.crashlytics.android.Crashlytics import chat.rocket.android.util.setupCrashlytics
import com.crashlytics.android.core.CrashlyticsCore
import com.facebook.drawee.backends.pipeline.DraweeConfig import com.facebook.drawee.backends.pipeline.DraweeConfig
import com.facebook.drawee.backends.pipeline.Fresco import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.imagepipeline.core.ImagePipelineConfig import com.facebook.imagepipeline.core.ImagePipelineConfig
...@@ -31,7 +29,6 @@ import dagger.android.DispatchingAndroidInjector ...@@ -31,7 +29,6 @@ import dagger.android.DispatchingAndroidInjector
import dagger.android.HasActivityInjector import dagger.android.HasActivityInjector
import dagger.android.HasBroadcastReceiverInjector import dagger.android.HasBroadcastReceiverInjector
import dagger.android.HasServiceInjector import dagger.android.HasServiceInjector
import io.fabric.sdk.android.Fabric
import timber.log.Timber import timber.log.Timber
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import javax.inject.Inject import javax.inject.Inject
...@@ -89,7 +86,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje ...@@ -89,7 +86,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
AndroidThreeTen.init(this) AndroidThreeTen.init(this)
EmojiRepository.load(this) EmojiRepository.load(this)
setupCrashlytics() setupCrashlytics(this)
setupFresco() setupFresco()
setupTimber() setupTimber()
...@@ -125,15 +122,6 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje ...@@ -125,15 +122,6 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
} }
} }
private fun setupCrashlytics() {
val core = CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()
Fabric.with(this, Crashlytics.Builder().core(core).build())
installCrashlyticsWrapper(this@RocketChatApplication,
getCurrentServerInteractor, settingsInteractor,
accountRepository, localRepository)
}
private fun setupFresco() { private fun setupFresco() {
Fresco.initialize(this, imagePipelineConfig, draweeConfig) Fresco.initialize(this, imagePipelineConfig, draweeConfig)
} }
......
...@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.login.presentation ...@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.login.presentation
import chat.rocket.android.core.behaviours.LoadingView import chat.rocket.android.core.behaviours.LoadingView
import chat.rocket.android.core.behaviours.MessageView import chat.rocket.android.core.behaviours.MessageView
import com.google.android.gms.auth.api.credentials.Credential
interface LoginView : LoadingView, MessageView { interface LoginView : LoadingView, MessageView {
......
...@@ -30,11 +30,13 @@ import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET ...@@ -30,11 +30,13 @@ import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET
import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_TOKEN import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_TOKEN
import chat.rocket.android.webview.oauth.ui.oauthWebViewIntent import chat.rocket.android.webview.oauth.ui.oauthWebViewIntent
import chat.rocket.common.util.ifNull import chat.rocket.common.util.ifNull
import com.google.android.gms.auth.api.credentials.*
import dagger.android.support.AndroidSupportInjection import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.fragment_authentication_log_in.* import kotlinx.android.synthetic.main.fragment_authentication_log_in.*
import javax.inject.Inject import javax.inject.Inject
internal const val REQUEST_CODE_FOR_SIGN_IN_REQUIRED = 1
internal const val REQUEST_CODE_FOR_MULTIPLE_ACCOUNTS_RESOLUTION = 2
internal const val REQUEST_CODE_FOR_SAVE_RESOLUTION = 3
internal const val REQUEST_CODE_FOR_CAS = 4 internal const val REQUEST_CODE_FOR_CAS = 4
internal const val REQUEST_CODE_FOR_SAML = 5 internal const val REQUEST_CODE_FOR_SAML = 5
internal const val REQUEST_CODE_FOR_OAUTH = 6 internal const val REQUEST_CODE_FOR_OAUTH = 6
...@@ -48,7 +50,6 @@ class LoginFragment : Fragment(), LoginView { ...@@ -48,7 +50,6 @@ class LoginFragment : Fragment(), LoginView {
} }
private var isGlobalLayoutListenerSetUp = false private var isGlobalLayoutListenerSetUp = false
private var deepLinkInfo: LoginDeepLinkInfo? = null private var deepLinkInfo: LoginDeepLinkInfo? = null
private val credentialsClient by lazy { Credentials.getClient(requireActivity()) }
companion object { companion object {
private const val DEEP_LINK_INFO = "DeepLinkInfo" private const val DEEP_LINK_INFO = "DeepLinkInfo"
...@@ -85,6 +86,10 @@ class LoginFragment : Fragment(), LoginView { ...@@ -85,6 +86,10 @@ class LoginFragment : Fragment(), LoginView {
}.ifNull { }.ifNull {
presenter.setupView() presenter.setupView()
} }
if (!hasCredentialsSupport()) {
image_key.isVisible = false
}
} }
override fun onDestroyView() { override fun onDestroyView() {
...@@ -100,13 +105,15 @@ class LoginFragment : Fragment(), LoginView { ...@@ -100,13 +105,15 @@ class LoginFragment : Fragment(), LoginView {
if (data != null) { if (data != null) {
when (requestCode) { when (requestCode) {
REQUEST_CODE_FOR_MULTIPLE_ACCOUNTS_RESOLUTION -> { REQUEST_CODE_FOR_MULTIPLE_ACCOUNTS_RESOLUTION -> {
onCredentialRetrieved(data.getParcelableExtra(Credential.EXTRA_KEY)) getCredentials(data)?.let {
onCredentialRetrieved(it.first, it.second)
}
} }
REQUEST_CODE_FOR_SIGN_IN_REQUIRED -> { REQUEST_CODE_FOR_SIGN_IN_REQUIRED -> {
//use the hints to autofill sign in forms to reduce the info to be filled. getCredentials(data)?.let { credential ->
val credential: Credential = data.getParcelableExtra(Credential.EXTRA_KEY) text_username_or_email.setText(credential.first)
text_username_or_email.setText(credential.id) text_password.setText(credential.second)
text_password.setText(credential.password) }
} }
REQUEST_CODE_FOR_SAVE_RESOLUTION -> { REQUEST_CODE_FOR_SAVE_RESOLUTION -> {
showMessage(getString(R.string.message_credentials_saved_successfully)) showMessage(getString(R.string.message_credentials_saved_successfully))
...@@ -154,19 +161,19 @@ class LoginFragment : Fragment(), LoginView { ...@@ -154,19 +161,19 @@ class LoginFragment : Fragment(), LoginView {
private fun requestStoredCredentials() { private fun requestStoredCredentials() {
activity?.let { activity?.let {
SmartLockHelper.requestStoredCredentials(credentialsClient, it)?.let { it.requestStoredCredentials()?.let { credentials ->
onCredentialRetrieved(it) onCredentialRetrieved(credentials.first, credentials.second)
} }
} }
} }
private fun onCredentialRetrieved(credential: Credential) { private fun onCredentialRetrieved(id: String, password: String) {
presenter.authenticateWithUserAndPassword(credential.id, credential.password.toString()) presenter.authenticateWithUserAndPassword(id, password)
} }
override fun saveSmartLockCredentials(id: String, password: String) { override fun saveSmartLockCredentials(id: String, password: String) {
activity?.let { activity?.let {
SmartLockHelper.save(credentialsClient, it, id, password) it.saveCredentials(id, password)
} }
} }
......
...@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.signup.presentation ...@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.signup.presentation
import chat.rocket.android.core.behaviours.LoadingView import chat.rocket.android.core.behaviours.LoadingView
import chat.rocket.android.core.behaviours.MessageView import chat.rocket.android.core.behaviours.MessageView
import com.google.android.gms.auth.api.credentials.Credential
interface SignupView : LoadingView, MessageView { interface SignupView : LoadingView, MessageView {
......
...@@ -16,10 +16,9 @@ import chat.rocket.android.R.string.message_credentials_saved_successfully ...@@ -16,10 +16,9 @@ import chat.rocket.android.R.string.message_credentials_saved_successfully
import chat.rocket.android.authentication.signup.presentation.SignupPresenter import chat.rocket.android.authentication.signup.presentation.SignupPresenter
import chat.rocket.android.authentication.signup.presentation.SignupView import chat.rocket.android.authentication.signup.presentation.SignupView
import chat.rocket.android.helper.KeyboardHelper import chat.rocket.android.helper.KeyboardHelper
import chat.rocket.android.helper.SmartLockHelper
import chat.rocket.android.helper.TextHelper import chat.rocket.android.helper.TextHelper
import chat.rocket.android.helper.saveCredentials
import chat.rocket.android.util.extensions.* import chat.rocket.android.util.extensions.*
import com.google.android.gms.auth.api.credentials.Credentials
import dagger.android.support.AndroidSupportInjection import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.fragment_authentication_sign_up.* import kotlinx.android.synthetic.main.fragment_authentication_sign_up.*
import javax.inject.Inject import javax.inject.Inject
...@@ -156,7 +155,7 @@ class SignupFragment : Fragment(), SignupView { ...@@ -156,7 +155,7 @@ class SignupFragment : Fragment(), SignupView {
override fun saveSmartLockCredentials(id: String, password: String) { override fun saveSmartLockCredentials(id: String, password: String) {
activity?.let { activity?.let {
SmartLockHelper.save(Credentials.getClient(it), it, id, password) it.saveCredentials(id, password)
} }
} }
......
...@@ -216,7 +216,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { ...@@ -216,7 +216,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
AlertDialog.Builder(context) AlertDialog.Builder(context)
.setTitle(R.string.dialog_sort_title) .setTitle(R.string.dialog_sort_title)
.setView(dialogLayout) .setView(dialogLayout)
.setPositiveButton("Done") { dialog, _ -> .setPositiveButton(R.string.dialog_button_done) { dialog, _ ->
invalidateQueryOnSearch() invalidateQueryOnSearch()
updateSort() updateSort()
dialog.dismiss() dialog.dismiss()
......
...@@ -25,9 +25,9 @@ import chat.rocket.android.util.extensions.fadeIn ...@@ -25,9 +25,9 @@ import chat.rocket.android.util.extensions.fadeIn
import chat.rocket.android.util.extensions.fadeOut import chat.rocket.android.util.extensions.fadeOut
import chat.rocket.android.util.extensions.rotateBy import chat.rocket.android.util.extensions.rotateBy
import chat.rocket.android.util.extensions.showToast import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.invalidateFirebaseToken
import chat.rocket.android.util.refreshFCMToken
import chat.rocket.common.model.UserStatus import chat.rocket.common.model.UserStatus
import com.google.firebase.iid.FirebaseInstanceId
import com.google.firebase.messaging.FirebaseMessaging
import dagger.android.AndroidInjection import dagger.android.AndroidInjection
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector import dagger.android.DispatchingAndroidInjector
...@@ -65,13 +65,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, ...@@ -65,13 +65,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
launch(CommonPool) { launch(CommonPool) {
try { refreshFCMToken(presenter)
val token = FirebaseInstanceId.getInstance().token
Timber.d("FCM token: $token")
presenter.refreshToken(token)
} catch (ex: Exception) {
Timber.d(ex, "Missing play services...")
}
} }
chatRoomId = intent.getStringExtra(INTENT_CHAT_ROOM_ID) chatRoomId = intent.getStringExtra(INTENT_CHAT_ROOM_ID)
...@@ -213,7 +207,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, ...@@ -213,7 +207,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
} }
override fun invalidateToken(token: String) = override fun invalidateToken(token: String) =
FirebaseInstanceId.getInstance().deleteToken(token, FirebaseMessaging.INSTANCE_ID_SCOPE) invalidateFirebaseToken(token)
override fun showMessage(resId: Int) = showToast(resId) override fun showMessage(resId: Int) = showToast(resId)
......
...@@ -193,6 +193,14 @@ class ConnectionManager( ...@@ -193,6 +193,14 @@ class ConnectionManager(
client.setTemporaryStatus(userStatus) client.setTemporaryStatus(userStatus)
} }
fun resetReconnectionTimer() {
// if we are waiting to reconnect, immediately try to reconnect
// and reset the reconnection counter
if (client.state is State.Waiting) {
client.connect(resetCounter = true)
}
}
private fun resubscribeRooms() { private fun resubscribeRooms() {
roomMessagesChannels.toList().map { (roomId, channel) -> roomMessagesChannels.toList().map { (roomId, channel) ->
client.subscribeRoomMessages(roomId) { _, id -> client.subscribeRoomMessages(roomId) { _, id ->
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/image_app_name" app:layout_constraintTop_toBottomOf="@+id/image_app_name"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:textColor="@color/colorSecondaryText" /> android:textColor="@color/colorSecondaryText"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"/>
<TextView <TextView
android:id="@+id/text_build_number" android:id="@+id/text_build_number"
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
android:src="@drawable/ic_vpn_key_black_24dp" android:src="@drawable/ic_vpn_key_black_24dp"
android:tint="@color/colorDrawableTintGrey" android:tint="@color/colorDrawableTintGrey"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/text_username_or_email" app:layout_constraintBottom_toBottomOf="@+id/text_username_or_email"
app:layout_constraintEnd_toEndOf="@+id/text_username_or_email" app:layout_constraintEnd_toEndOf="@+id/text_username_or_email"
app:layout_constraintTop_toTopOf="@+id/text_username_or_email" /> app:layout_constraintTop_toTopOf="@+id/text_username_or_email" />
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<string name="msg_content_description_log_in_using_meteor">Login mit Meteor</string> <string name="msg_content_description_log_in_using_meteor">Login mit Meteor</string>
<string name="msg_content_description_log_in_using_twitter">Login mit Twitter</string> <string name="msg_content_description_log_in_using_twitter">Login mit Twitter</string>
<string name="msg_content_description_log_in_using_gitlab">Login mit Gitlab</string> <string name="msg_content_description_log_in_using_gitlab">Login mit Gitlab</string>
<string name="msg_content_description_log_in_using_wordprees">Login using WordPress</string> <!-- TODO Translate--> <string name="msg_content_description_log_in_using_wordpress">Login mit WordPress</string>
<string name="msg_content_description_send_message">Sende Nachricht</string> <string name="msg_content_description_send_message">Sende Nachricht</string>
<string name="msg_content_description_show_attachment_options">Zeige Anhang Optionen</string> <string name="msg_content_description_show_attachment_options">Zeige Anhang Optionen</string>
<string name="msg_you">Du</string> <string name="msg_you">Du</string>
...@@ -99,8 +99,6 @@ ...@@ -99,8 +99,6 @@
<string name="msg_preview_photo">Bild</string> <string name="msg_preview_photo">Bild</string>
<string name="msg_preview_file">Datei</string> <string name="msg_preview_file">Datei</string>
<string name="msg_no_messages_yet">Noch keine Nachrichten</string> <string name="msg_no_messages_yet">Noch keine Nachrichten</string>
<string name="msg_version">Version %1$s</string>
<string name="msg_build">Build %1$d</string>
<string name="msg_ok">OK</string> <string name="msg_ok">OK</string>
<string name="msg_update_app_version_in_order_to_continue">Server Version veraltet. Bitte kontaktieren Sie ihren Server Administrator.</string> <string name="msg_update_app_version_in_order_to_continue">Server Version veraltet. Bitte kontaktieren Sie ihren Server Administrator.</string>
<string name="msg_ver_not_recommended"> <string name="msg_ver_not_recommended">
...@@ -174,7 +172,6 @@ ...@@ -174,7 +172,6 @@
<string name="action_msg_share">Teilen</string> <string name="action_msg_share">Teilen</string>
<string name="action_title_editing">Nachricht bearbeiten</string> <string name="action_title_editing">Nachricht bearbeiten</string>
<string name="action_msg_add_reaction">Reaktion hinzufügen</string> <string name="action_msg_add_reaction">Reaktion hinzufügen</string>
<string name="action_share">Teilen</string>
<!-- Permission messages --> <!-- Permission messages -->
<string name="permission_editing_not_allowed">Bearbeiten nicht erlaubt</string> <string name="permission_editing_not_allowed">Bearbeiten nicht erlaubt</string>
...@@ -262,6 +259,7 @@ ...@@ -262,6 +259,7 @@
<string name="dialog_sort_by_activity">Aktivität</string> <string name="dialog_sort_by_activity">Aktivität</string>
<string name="dialog_group_by_type">Räume nach Typ</string> <string name="dialog_group_by_type">Räume nach Typ</string>
<string name="dialog_group_favourites">Räume nach Favoriten</string> <string name="dialog_group_favourites">Räume nach Favoriten</string>
<string name="dialog_button_done">Done</string><!-- TODO Add translation -->
<string name="chatroom_header">Kopf</string> <string name="chatroom_header">Kopf</string>
<!--ChatRooms Headers--> <!--ChatRooms Headers-->
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<string name="msg_content_description_log_in_using_meteor">Inicia sesión usando Meteor</string> <string name="msg_content_description_log_in_using_meteor">Inicia sesión usando Meteor</string>
<string name="msg_content_description_log_in_using_twitter">Inicia sesión usando Twitter</string> <string name="msg_content_description_log_in_using_twitter">Inicia sesión usando Twitter</string>
<string name="msg_content_description_log_in_using_gitlab">Inicia sesión usando Gitlab</string> <string name="msg_content_description_log_in_using_gitlab">Inicia sesión usando Gitlab</string>
<string name="msg_content_description_log_in_using_wordprees">Login using WordPress</string> <!-- TODO Translate--> <string name="msg_content_description_log_in_using_wordpress">Login using WordPress</string> <!-- TODO Translate-->
<string name="msg_content_description_send_message">Enviar mensaje</string> <string name="msg_content_description_send_message">Enviar mensaje</string>
<string name="msg_content_description_show_attachment_options">Mostrar opciones de archivo adjunto</string> <string name="msg_content_description_show_attachment_options">Mostrar opciones de archivo adjunto</string>
<string name="msg_you"></string> <string name="msg_you"></string>
...@@ -96,8 +96,6 @@ ...@@ -96,8 +96,6 @@
<string name="msg_preview_photo">Foto</string> <string name="msg_preview_photo">Foto</string>
<string name="msg_preview_file">Fichero</string> <string name="msg_preview_file">Fichero</string>
<string name="msg_no_messages_yet">Aún no hay mensajes</string> <string name="msg_no_messages_yet">Aún no hay mensajes</string>
<string name="msg_version">Versión %1$s</string>
<string name="msg_build">Build %1$d</string>
<string name="msg_ok">OK</string> <string name="msg_ok">OK</string>
<string name="msg_update_app_version_in_order_to_continue">Versión del servidor actualizada. Póngase en contacto con el administrador del servidor para actualizar la versión del servidor y continuar.</string> <string name="msg_update_app_version_in_order_to_continue">Versión del servidor actualizada. Póngase en contacto con el administrador del servidor para actualizar la versión del servidor y continuar.</string>
<string name="msg_ver_not_recommended"> <string name="msg_ver_not_recommended">
...@@ -256,6 +254,7 @@ ...@@ -256,6 +254,7 @@
<string name="dialog_sort_by_activity">Actividad</string> <string name="dialog_sort_by_activity">Actividad</string>
<string name="dialog_group_by_type">Agrupar por tipo</string> <string name="dialog_group_by_type">Agrupar por tipo</string>
<string name="dialog_group_favourites">Agrupar favoritos</string> <string name="dialog_group_favourites">Agrupar favoritos</string>
<string name="dialog_button_done">Done</string><!-- TODO Add translation -->
<string name="chatroom_header">Cabezazo</string> <string name="chatroom_header">Cabezazo</string>
<!--ChatRooms Headers--> <!--ChatRooms Headers-->
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<string name="msg_content_description_log_in_using_meteor">Connectez-vous en utilisant Meteor</string> <string name="msg_content_description_log_in_using_meteor">Connectez-vous en utilisant Meteor</string>
<string name="msg_content_description_log_in_using_twitter">Connectez-vous en utilisant Twitter</string> <string name="msg_content_description_log_in_using_twitter">Connectez-vous en utilisant Twitter</string>
<string name="msg_content_description_log_in_using_gitlab">Connectez-vous en utilisant Gitlab</string> <string name="msg_content_description_log_in_using_gitlab">Connectez-vous en utilisant Gitlab</string>
<string name="msg_content_description_log_in_using_wordprees">Login using WordPress</string> <!-- TODO Translate--> <string name="msg_content_description_log_in_using_wordpress">Login using WordPress</string> <!-- TODO Translate-->
<string name="msg_content_description_send_message">Envoyer message</string> <string name="msg_content_description_send_message">Envoyer message</string>
<string name="msg_content_description_show_attachment_options">Afficher les options de fichiers</string> <string name="msg_content_description_show_attachment_options">Afficher les options de fichiers</string>
<string name="msg_you">Toi</string> <string name="msg_you">Toi</string>
...@@ -102,8 +102,6 @@ ...@@ -102,8 +102,6 @@
<string name="msg_preview_photo">Photo</string> <string name="msg_preview_photo">Photo</string>
<string name="msg_preview_file">File</string> <string name="msg_preview_file">File</string>
<string name="msg_no_messages_yet">Aucun message pour le moment</string> <string name="msg_no_messages_yet">Aucun message pour le moment</string>
<string name="msg_version">Version %1$s</string>
<string name="msg_build">Build %1$d</string>
<string name="msg_ok">OK</string> <string name="msg_ok">OK</string>
// TODO: Add proper translation. // TODO: Add proper translation.
<string name="msg_update_app_version_in_order_to_continue">Out to date server version. Please contact the server admin to update the server version in order to continue.</string> <string name="msg_update_app_version_in_order_to_continue">Out to date server version. Please contact the server admin to update the server version in order to continue.</string>
...@@ -188,7 +186,6 @@ ...@@ -188,7 +186,6 @@
<string name="action_msg_share">Partager</string> <string name="action_msg_share">Partager</string>
<string name="action_title_editing">Modification du message</string> <string name="action_title_editing">Modification du message</string>
<string name="action_msg_add_reaction">Ajouter une réaction</string> <string name="action_msg_add_reaction">Ajouter une réaction</string>
<string name="action_share">Partager</string>
<!-- Permission messages --> <!-- Permission messages -->
<string name="permission_editing_not_allowed">L\'édition n\'est pas autorisée</string> <string name="permission_editing_not_allowed">L\'édition n\'est pas autorisée</string>
...@@ -282,6 +279,7 @@ ...@@ -282,6 +279,7 @@
<string name="dialog_sort_by_activity">Activité</string> <string name="dialog_sort_by_activity">Activité</string>
<string name="dialog_group_by_type">Grouper par type</string> <string name="dialog_group_by_type">Grouper par type</string>
<string name="dialog_group_favourites">Grouper favoris</string> <string name="dialog_group_favourites">Grouper favoris</string>
<string name="dialog_button_done">Done</string><!-- TODO Add translation -->
<string name="chatroom_header">Entête</string> <string name="chatroom_header">Entête</string>
<!--ChatRooms Headers--> <!--ChatRooms Headers-->
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
<string name="action_select_photo_from_gallery">Select photo from gallery</string> <!-- TODO Add translation --> <string name="action_select_photo_from_gallery">Select photo from gallery</string> <!-- TODO Add translation -->
<string name="action_take_photo">Select photo from gallery</string> <!-- TODO Add translation --> <string name="action_take_photo">Select photo from gallery</string> <!-- TODO Add translation -->
<string name="action_reset_avatar">Reset avatar</string> <!-- TODO Add translation --> <string name="action_reset_avatar">Reset avatar</string> <!-- TODO Add translation -->
<string name="action_share">शेयर</string>
<!-- Settings List --> <!-- Settings List -->
<string-array name="settings_actions"> <string-array name="settings_actions">
...@@ -83,7 +82,7 @@ ...@@ -83,7 +82,7 @@
<string name="msg_content_description_log_in_using_meteor">Meteor द्वारा लॉगिन करें</string> <string name="msg_content_description_log_in_using_meteor">Meteor द्वारा लॉगिन करें</string>
<string name="msg_content_description_log_in_using_twitter">Twitter द्वारा लॉगिन करें</string> <string name="msg_content_description_log_in_using_twitter">Twitter द्वारा लॉगिन करें</string>
<string name="msg_content_description_log_in_using_gitlab">Gitlab द्वारा लॉगिन करें</string> <string name="msg_content_description_log_in_using_gitlab">Gitlab द्वारा लॉगिन करें</string>
<string name="msg_content_description_log_in_using_wordprees">Login using WordPress</string> <!-- TODO Translate--> <string name="msg_content_description_log_in_using_wordpress">Login using WordPress</string> <!-- TODO Translate-->
<string name="msg_content_description_send_message">मेसेज भेजें</string> <string name="msg_content_description_send_message">मेसेज भेजें</string>
<string name="msg_content_description_show_attachment_options">अटैचमेंट विकल्प दिखाएं</string> <string name="msg_content_description_show_attachment_options">अटैचमेंट विकल्प दिखाएं</string>
<string name="msg_you">आप</string> <string name="msg_you">आप</string>
...@@ -98,8 +97,6 @@ ...@@ -98,8 +97,6 @@
<string name="msg_preview_file">फ़ाइल</string> <string name="msg_preview_file">फ़ाइल</string>
<string name="msg_unread_messages">अपठित संदेश</string> <string name="msg_unread_messages">अपठित संदेश</string>
<string name="msg_no_messages_yet">अभी तक कोई पोस्ट नहीं</string> <string name="msg_no_messages_yet">अभी तक कोई पोस्ट नहीं</string>
<string name="msg_version">वर्शन %1$s</string>
<string name="msg_build">बिल्ड %1$d</string>
<string name="msg_update_app_version_in_order_to_continue">पुराना सर्वर वर्शन। जारी रखने के लिए सर्वर वर्शन को अद्यतन करने के लिए कृपया सर्वर व्यवस्थापक से संपर्क करें।</string> <string name="msg_update_app_version_in_order_to_continue">पुराना सर्वर वर्शन। जारी रखने के लिए सर्वर वर्शन को अद्यतन करने के लिए कृपया सर्वर व्यवस्थापक से संपर्क करें।</string>
<string name="msg_ok">ठीक है</string> <string name="msg_ok">ठीक है</string>
<string name="msg_ver_not_recommended"> <string name="msg_ver_not_recommended">
...@@ -264,6 +261,7 @@ ...@@ -264,6 +261,7 @@
<string name="dialog_sort_by_activity">गतिविधि</string> <string name="dialog_sort_by_activity">गतिविधि</string>
<string name="dialog_group_by_type">प्रकार के आधार पर समूह</string> <string name="dialog_group_by_type">प्रकार के आधार पर समूह</string>
<string name="dialog_group_favourites">पसंदीदा समूह</string> <string name="dialog_group_favourites">पसंदीदा समूह</string>
<string name="dialog_button_done">Done</string><!-- TODO Add translation -->
<string name="chatroom_header">हैडर</string> <string name="chatroom_header">हैडर</string>
<!--ChatRooms Headers--> <!--ChatRooms Headers-->
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<string name="msg_content_description_log_in_using_meteor">Fazer login através do Meteor</string> <string name="msg_content_description_log_in_using_meteor">Fazer login através do Meteor</string>
<string name="msg_content_description_log_in_using_twitter">Fazer login através do Twitter</string> <string name="msg_content_description_log_in_using_twitter">Fazer login através do Twitter</string>
<string name="msg_content_description_log_in_using_gitlab">Fazer login através do Gitlab</string> <string name="msg_content_description_log_in_using_gitlab">Fazer login através do Gitlab</string>
<string name="msg_content_description_log_in_using_wordprees">Fazer login através do WordPress</string> <string name="msg_content_description_log_in_using_wordpress">Fazer login através do WordPress</string>
<string name="msg_content_description_send_message">Enviar mensagem</string> <string name="msg_content_description_send_message">Enviar mensagem</string>
<string name="msg_content_description_show_attachment_options">Mostrar opções de anexo</string> <string name="msg_content_description_show_attachment_options">Mostrar opções de anexo</string>
<string name="msg_you">Você</string> <string name="msg_you">Você</string>
...@@ -97,8 +97,6 @@ ...@@ -97,8 +97,6 @@
<string name="msg_preview_photo">Foto</string> <string name="msg_preview_photo">Foto</string>
<string name="msg_preview_file">Arquivo</string> <string name="msg_preview_file">Arquivo</string>
<string name="msg_no_messages_yet">Nenhuma mensagem ainda</string> <string name="msg_no_messages_yet">Nenhuma mensagem ainda</string>
<string name="msg_version">Versão %1$s</string>
<string name="msg_build">Build %1$d</string>
<string name="msg_ok">OK</string> <string name="msg_ok">OK</string>
<string name="msg_update_app_version_in_order_to_continue">Versão do servidor desatualizada. Por favor, entre em contato com o administrador do sistema para continuar.</string> <string name="msg_update_app_version_in_order_to_continue">Versão do servidor desatualizada. Por favor, entre em contato com o administrador do sistema para continuar.</string>
<string name="msg_ver_not_recommended"> <string name="msg_ver_not_recommended">
...@@ -262,6 +260,7 @@ ...@@ -262,6 +260,7 @@
<string name="dialog_sort_by_activity">Atividade</string> <string name="dialog_sort_by_activity">Atividade</string>
<string name="dialog_group_by_type">Agrupar por tipo</string> <string name="dialog_group_by_type">Agrupar por tipo</string>
<string name="dialog_group_favourites">Grupos favoritos</string> <string name="dialog_group_favourites">Grupos favoritos</string>
<string name="dialog_button_done">Done</string><!-- TODO Add translation -->
<string name="chatroom_header">Cabeçalho</string> <string name="chatroom_header">Cabeçalho</string>
<!--ChatRooms Headers--> <!--ChatRooms Headers-->
...@@ -276,7 +275,6 @@ ...@@ -276,7 +275,6 @@
<string name="notif_action_reply_hint">RESPONDER</string> <string name="notif_action_reply_hint">RESPONDER</string>
<string name="notif_error_sending">Falha ao enviar a mensagem.</string> <string name="notif_error_sending">Falha ao enviar a mensagem.</string>
<string name="notif_success_sending">Mensagem enviada para %1$s!</string> <string name="notif_success_sending">Mensagem enviada para %1$s!</string>
<string name="action_share">Compartilhar</string>
<string name="read_by">Lida por</string> <string name="read_by">Lida por</string>
<string name="message_information_title">Informações da mensagem</string> <string name="message_information_title">Informações da mensagem</string>
<string name="msg_log_out">Deslogando…</string> <string name="msg_log_out">Deslogando…</string>
......
<resources> <resources>
<!-- Titles --> <!-- Titles -->
<string name="title_sign_in_your_server">Войдите на ваш сервер</string> <string name="title_sign_in_your_server">Ваш сервер</string>
<string name="title_log_in">Войти</string> <string name="title_log_in">Войти</string>
<string name="title_register_username">Зарегистрировать имя</string> <string name="title_register_username">Зарегистрировать имя</string>
<string name="title_reset_password">Сброс пароля</string> <string name="title_reset_password">Сброс пароля</string>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<string name="title_create_channel">Создать новый канал</string> <string name="title_create_channel">Создать новый канал</string>
<!-- Actions --> <!-- Actions -->
<string name="action_connect">Соединение</string> <string name="action_connect">Подключиться</string>
<string name="action_use_this_username">Использовать это имя</string> <string name="action_use_this_username">Использовать это имя</string>
<string name="action_login_or_sign_up">Нажмите эту кнопку, чтобы войти в систему или создать учетную запись</string> <string name="action_login_or_sign_up">Нажмите эту кнопку, чтобы войти в систему или создать учетную запись</string>
<string name="action_terms_of_service">Условия использования</string> <string name="action_terms_of_service">Условия использования</string>
...@@ -38,11 +38,11 @@ ...@@ -38,11 +38,11 @@
<string name="action_away">Отошел</string> <string name="action_away">Отошел</string>
<string name="action_busy">Занят</string> <string name="action_busy">Занят</string>
<string name="action_invisible">Невидимый</string> <string name="action_invisible">Невидимый</string>
<string name="action_drawing">Рисование</string> <string name="action_drawing">Рисунок</string>
<string name="action_save_to_gallery">Сохранить в галерею</string> <string name="action_save_to_gallery">Сохранить в галерею</string>
<string name="action_select_photo_from_gallery">Select photo from gallery</string> <!-- TODO Add translation --> <string name="action_select_photo_from_gallery">Выбрать из галереи</string>
<string name="action_take_photo">Select photo from gallery</string> <!-- TODO Add translation --> <string name="action_take_photo">Сделать снимок</string>
<string name="action_reset_avatar">Reset avatar</string> <!-- TODO Add translation --> <string name="action_reset_avatar">Восстановить аватар</string>
<!-- Settings List --> <!-- Settings List -->
<string-array name="settings_actions"> <string-array name="settings_actions">
...@@ -66,23 +66,23 @@ ...@@ -66,23 +66,23 @@
<string name="msg_reset">Сброс</string> <string name="msg_reset">Сброс</string>
<string name="msg_check_your_email_to_reset_your_password">Письмо отправлено! Проверьте свой почтовый ящик, чтобы сбросить пароль.</string> <string name="msg_check_your_email_to_reset_your_password">Письмо отправлено! Проверьте свой почтовый ящик, чтобы сбросить пароль.</string>
<string name="msg_invalid_email">Введите действующий e-mail</string> <string name="msg_invalid_email">Введите действующий e-mail</string>
<string name="msg_new_user_agreement">Продолжая, вы соглашаетесь с нашими\n%1$s и %2$s</string> <string name="msg_new_user_agreement">Продолжая, вы принимаете\n%1$s и %2$s</string>
<string name="msg_2fa_code">Код 2FA</string> <string name="msg_2fa_code">Код 2FA</string>
<string name="msg_yesterday">Вчера</string> <string name="msg_yesterday">Вчера</string>
<string name="msg_today">Сегодня</string> <string name="msg_today">Сегодня</string>
<string name="msg_message">Сообщение</string> <string name="msg_message">Сообщение</string>
<string name="msg_this_room_is_read_only">Этот канал только для чтения</string> <string name="msg_this_room_is_read_only">Канал только для чтения</string>
<string name="msg_invalid_2fa_code">Неверный код 2FA</string> <string name="msg_invalid_2fa_code">Неверный код 2FA</string>
<string name="msg_invalid_file">Неверный файл</string> <string name="msg_invalid_file">Неверный файл</string>
<string name="msg_invalid_server_url">Неверный URL-адрес сервера.</string> <string name="msg_invalid_server_url">Неверный URL-адрес сервера.</string>
<string name="msg_content_description_log_in_using_facebook">Войти используя Facebook</string> <string name="msg_content_description_log_in_using_facebook">Войти с помощью Facebook</string>
<string name="msg_content_description_log_in_using_github">Войти используя Github</string> <string name="msg_content_description_log_in_using_github">Войти с помощью Github</string>
<string name="msg_content_description_log_in_using_google">Войти используя Google</string> <string name="msg_content_description_log_in_using_google">Войти с помощью Google</string>
<string name="msg_content_description_log_in_using_linkedin">Войти используя Linkedin</string> <string name="msg_content_description_log_in_using_linkedin">Войти с помощью Linkedin</string>
<string name="msg_content_description_log_in_using_meteor">Войти используя Meteor</string> <string name="msg_content_description_log_in_using_meteor">Войти с помощью Meteor</string>
<string name="msg_content_description_log_in_using_twitter">Войти используя Twitter</string> <string name="msg_content_description_log_in_using_twitter">Войти с помощью Twitter</string>
<string name="msg_content_description_log_in_using_gitlab">Войти используя Gitlab</string> <string name="msg_content_description_log_in_using_gitlab">Войти с помощью Gitlab</string>
<string name="msg_content_description_log_in_using_wordprees">Login using WordPress</string> <!-- TODO Translate--> <string name="msg_content_description_log_in_using_wordpress">Войти с помощью WordPress</string>
<string name="msg_content_description_send_message">Отправить сообщение</string> <string name="msg_content_description_send_message">Отправить сообщение</string>
<string name="msg_content_description_show_attachment_options">Показать параметры вложения</string> <string name="msg_content_description_show_attachment_options">Показать параметры вложения</string>
<string name="msg_you">Вы</string> <string name="msg_you">Вы</string>
...@@ -97,17 +97,13 @@ ...@@ -97,17 +97,13 @@
<string name="msg_preview_photo">Фото</string> <string name="msg_preview_photo">Фото</string>
<string name="msg_preview_file">Файл</string> <string name="msg_preview_file">Файл</string>
<string name="msg_no_messages_yet">Нет сообщений</string> <string name="msg_no_messages_yet">Нет сообщений</string>
<string name="msg_version">Версия %1$s</string> <string name="msg_build">Сборка %1$d - %2$s - %3$s</string>
<string name="msg_build">Сборка %1$d</string>
<string name="msg_ok">OK</string> <string name="msg_ok">OK</string>
<string name="msg_update_app_version_in_order_to_continue">Версия сервера устарела. Пожалуйста, свяжитесь с администратором, чтобы обновить версию сервера.</string> <string name="msg_update_app_version_in_order_to_continue">Версия сервера устарела. Пожалуйста, свяжитесь с администратором, чтобы обновить сервер.</string>
<string name="msg_ver_not_recommended"> <string name="msg_ver_not_recommended">Похоже, версия сервера меньше рекомендуемой %1$s.\nМожно войти, но могут возникнуть те или иные проблемы при работе.\n</string>
Похоже ваша версия сервера ниже рекомендуемой %1$s.\nВы можете войти, но будьте готовы столкнуться с непредвиденными трудностями.</string> <string name="msg_ver_not_minimum">Похоже, версия сервера меньше минимально необходимой %1$s.\nДля работы потребуется обновить сервер!</string>
<string name="msg_ver_not_minimum"> <string name="msg_no_chat_title">Нет сообщений</string>
Похоже ваша версия сервера ниже минимально необходимой версии %1$s.\nОбновите свой сервер чтобы войти в систему! <string name="msg_no_chat_description">Начните общаться, чтобы увидеть\nтут сообщения.</string>
</string>
<string name="msg_no_chat_title">Нет сообщений чата</string>
<string name="msg_no_chat_description">Начните разговор, чтобы увидеть ваши\nсообщения здесь.</string>
<string name="msg_proceed">ПРОДОЛЖИТЬ</string> <string name="msg_proceed">ПРОДОЛЖИТЬ</string>
<string name="msg_cancel">ОТМЕНА</string> <string name="msg_cancel">ОТМЕНА</string>
<string name="msg_warning">ПРЕДУПРЕЖДЕНИЕ</string> <string name="msg_warning">ПРЕДУПРЕЖДЕНИЕ</string>
...@@ -125,8 +121,8 @@ ...@@ -125,8 +121,8 @@
<string name="msg_message_copied">Сообщение скопировано</string> <string name="msg_message_copied">Сообщение скопировано</string>
<string name="msg_upload_file">Загрузить файл</string> <string name="msg_upload_file">Загрузить файл</string>
<string name="msg_file_description">Описание файла</string> <string name="msg_file_description">Описание файла</string>
<string name="msg_send">послать</string> <string name="msg_send">Отправить</string>
<string name="msg_sent_attachment">Отправить вложение</string> <string name="msg_sent_attachment">Вложение отправлено</string>
<string name="msg_delete_message">Удалить сообщение</string> <string name="msg_delete_message">Удалить сообщение</string>
<string name="msg_delete_description">Вы уверены, что хотите удалить это сообщение?</string> <string name="msg_delete_description">Вы уверены, что хотите удалить это сообщение?</string>
<string name="msg_channel_name">Название канала</string> <string name="msg_channel_name">Название канала</string>
...@@ -139,54 +135,53 @@ ...@@ -139,54 +135,53 @@
<string name="msg_public_channel_description">Каждый может получить доступ к этому каналу</string> <string name="msg_public_channel_description">Каждый может получить доступ к этому каналу</string>
<string name="msg_ready_only_channel">Канал только для чтения</string> <string name="msg_ready_only_channel">Канал только для чтения</string>
<string name="msg_ready_only_channel_description">Только администратор может писать новые сообщения</string> <string name="msg_ready_only_channel_description">Только администратор может писать новые сообщения</string>
<string name="msg_invite_members">Пригласить пользователей на канал</string> <string name="msg_invite_members">Пригласить пользователей в канал</string>
<string name="msg_member_already_added">Вы уже выбрали этого пользователя</string> <string name="msg_member_already_added">Вы уже выбрали этого пользователя</string>
<string name="msg_member_not_found">Пользователь не найден</string> <string name="msg_member_not_found">Пользователь не найден</string>
<string name="msg_channel_created_successfully">Канал создан успешно</string> <string name="msg_channel_created_successfully">Канал создан успешно</string>
<!-- System messages --> <!-- System messages -->
<string name="message_room_name_changed">Название канала изменено на: %1$s by %2$s</string> <string name="message_room_name_changed">%2$s изменил название канала на %1$s</string>
<string name="message_user_added_by">Пользователь %1$s добавлен пользователем %2$s</string> <string name="message_user_added_by">Пользователь %1$s добавлен пользователем %2$s</string>
<string name="message_user_removed_by">Пользователь %1$s удален пользователем %2$s</string> <string name="message_user_removed_by">Пользователь %1$s удален пользователем %2$s</string>
<string name="message_user_left">Покинул канал.</string> <string name="message_user_left">Покинул канал.</string>
<string name="message_user_joined_channel">Присоединился к каналу.</string> <string name="message_user_joined_channel">Присоединился к каналу.</string>
<string name="message_welcome">Добро пожаловать %s</string> <string name="message_welcome">Привет, %s</string>
<string name="message_removed">Сообщение удалено</string> <string name="message_removed">Сообщение удалено</string>
<string name="message_pinned">Прикрепленное сообщение:</string> <string name="message_pinned">Прикрепленное сообщение:</string>
<string name="message_muted">Пользователь %1$s заглушен пользователем %2$s</string> <string name="message_muted">Пользователь %2$s лишил %1$s дара речи</string>
<string name="message_unmuted">Пользователь %1$s перестал быть заглушенным по решению %2$s</string> <string name="message_unmuted">Пользователю %1$s вернули дар речи по решению %2$s</string>
<string name="message_role_add">%1$s был назначен %2$s пользователем %3$s</string> <string name="message_role_add">%1$s был назначен %2$s пользователем %3$s</string>
<string name="message_role_removed">%1$s больше не %2$s по решению %3$s</string> <string name="message_role_removed">%1$s больше не %2$s по решению %3$s</string>
<string name="message_credentials_saved_successfully">Учетные данные успешно сохранены</string> <string name="message_credentials_saved_successfully">Учетные данные успешно сохранены</string>
<!-- Message actions --> <!-- Message actions -->
<string name="action_msg_reply">Ответить</string> <string name="action_msg_reply">Ответить</string>
<string name="action_msg_info">О сообщении</string> <string name="action_msg_info">Информация о прочтении</string>
<string name="action_msg_edit">Редактировать</string> <string name="action_msg_edit">Редактировать</string>
<string name="action_msg_copy">Копировать</string> <string name="action_msg_copy">Копировать</string>
<string name="action_msg_quote">Цитата</string> <string name="action_msg_quote">Цитировать</string>
<string name="action_msg_delete">Удалить</string> <string name="action_msg_delete">Удалить</string>
<string name="action_msg_pin">Прикрепить сообщение</string> <string name="action_msg_pin">Закрепить сообщение</string>
<string name="action_msg_unpin">Открепить сообщение</string> <string name="action_msg_unpin">Открепить сообщение</string>
<string name="action_msg_star">Пометить сообщение</string> <string name="action_msg_star">В избранное</string>
<string name="action_msg_unstar">Снять отметку</string> <string name="action_msg_unstar">Из избранного</string>
<string name="action_msg_share">Поделиться</string> <string name="action_msg_share">Поделиться</string>
<string name="action_title_editing">Редактирование сообщения</string> <string name="action_title_editing">Редактирование сообщения</string>
<string name="action_msg_add_reaction">Добавить реакцию</string> <string name="action_msg_add_reaction">Отреагировать</string>
<string name="action_share">Поделиться</string>
<!-- Permission messages --> <!-- Permission messages -->
<string name="permission_editing_not_allowed">Редактирование запрещено</string> <string name="permission_editing_not_allowed">Редактирование запрещено</string>
<string name="permission_deleting_not_allowed">Удаление запрещено</string> <string name="permission_deleting_not_allowed">Удаление запрещено</string>
<string name="permission_pinning_not_allowed">Прикрепление запрещено</string> <string name="permission_pinning_not_allowed">Нельзя закрепить</string>
<string name="permission_starring_not_allowed">Отмечивание запрещено</string> <string name="permission_starring_not_allowed">Нельзя отметить</string>
<!-- Search message --> <!-- Search message -->
<string name="title_search_message">Поиск сообщения</string> <string name="title_search_message">Поиск сообщения</string>
<!-- Favorite/Unfavorite chat room --> <!-- Favorite/Unfavorite chat room -->
<string name="title_favorite_chat">Добавить чат в избранное</string> <string name="title_favorite_chat">Добавить в избранное</string>
<string name="title_unfavorite_chat">Удалить чат из избранного</string> <string name="title_unfavorite_chat">Удалить из избранного</string>
<!-- Members List --> <!-- Members List -->
<string name="title_members_list">Пользователи</string> <string name="title_members_list">Пользователи</string>
...@@ -194,17 +189,17 @@ ...@@ -194,17 +189,17 @@
<!-- Mentions --> <!-- Mentions -->
<string name="msg_mentions">Упоминания</string> <string name="msg_mentions">Упоминания</string>
<string name="msg_no_mention">Нет упоминаний</string> <string name="msg_no_mention">Нет упоминаний</string>
<string name="msg_all_the_mentions_appear_here">Все упоминания\nотображаются здесь</string> <string name="msg_all_the_mentions_appear_here">Упоминания\nотображаются здесь</string>
<!-- Pinned Messages --> <!-- Pinned Messages -->
<string name="title_pinned_messages">Прикрепленные сообщения</string> <string name="title_pinned_messages">Прикрепленные сообщения</string>
<string name="no_pinned_messages">Нет прикрепленных сообщений</string> <string name="no_pinned_messages">Нет прикрепленных сообщений</string>
<string name="no_pinned_description">Все прикрепленные сообщения\nотображаются здесь</string> <string name="no_pinned_description">Прикрепленные сообщения\nотображаются здесь</string>
<!-- Favorite Messages --> <!-- Favorite Messages -->
<string name="title_favorite_messages">Избранные сообщения</string> <string name="title_favorite_messages">Избранные сообщения</string>
<string name="no_favorite_messages">Нет избранных сообщений</string> <string name="no_favorite_messages">Нет избранных сообщений</string>
<string name="no_favorite_description">Все избранные сообщения\nотображаются здесь</string> <string name="no_favorite_description">Избранные сообщения\nотображаются здесь</string>
<!-- Files --> <!-- Files -->
<string name="title_files">Файлы</string> <string name="title_files">Файлы</string>
...@@ -213,14 +208,14 @@ ...@@ -213,14 +208,14 @@
<string name="msg_all_files_appear_here">Все файлы отображаются здесь</string> <string name="msg_all_files_appear_here">Все файлы отображаются здесь</string>
<!-- Upload Messages --> <!-- Upload Messages -->
<string name="max_file_size_exceeded">Размер файла %1$d превысил максимально допустимый %2$d bytes</string> <string name="max_file_size_exceeded">Размер файла %1$d превысил максимально допустимый %2$d байт</string>
<!-- Socket status --> <!-- Socket status -->
<string name="status_connected">Соединено</string> <string name="status_connected">Подключено</string>
<string name="status_disconnected">Отключено</string> <string name="status_disconnected">Отключено</string>
<string name="status_connecting">Соединение</string> <string name="status_connecting">Подключаемся…</string>
<string name="status_authenticating">Аутентификация</string> <string name="status_authenticating">Аутентификация</string>
<string name="status_disconnecting">Отключение</string> <string name="status_disconnecting">Отключаемся…</string>
<string name="status_waiting">Соединение через %d секунд</string> <string name="status_waiting">Соединение через %d секунд</string>
<!--Suggestions--> <!--Suggestions-->
...@@ -248,10 +243,10 @@ ...@@ -248,10 +243,10 @@
<string name="Unarchive">Разархивировать</string> <string name="Unarchive">Разархивировать</string>
<string name="Join_the_given_channel">Присоединиться к этому каналу</string> <string name="Join_the_given_channel">Присоединиться к этому каналу</string>
<string name="Guggy_Command_Description">Создает gif на основе предоставленного текста</string> <string name="Guggy_Command_Description">Создает gif на основе предоставленного текста</string>
<string name="Slash_Topic_Description">Установить тему</string> <string name="Slash_Topic_Description">Задать тему</string>
<!-- Emoji message--> <!-- Emoji message-->
<string name="msg_no_recent_emoji">Нет недавно используемых emoji</string> <string name="msg_no_recent_emoji">Пусто</string>
<string name="alert_title_default_skin_tone">Тон кожи по умолчанию</string> <string name="alert_title_default_skin_tone">Тон кожи по умолчанию</string>
<!-- Sorting and grouping--> <!-- Sorting and grouping-->
...@@ -261,21 +256,22 @@ ...@@ -261,21 +256,22 @@
<string name="dialog_sort_by_activity">По активности</string> <string name="dialog_sort_by_activity">По активности</string>
<string name="dialog_group_by_type">Группировать по типу</string> <string name="dialog_group_by_type">Группировать по типу</string>
<string name="dialog_group_favourites">Группировать избранное</string> <string name="dialog_group_favourites">Группировать избранное</string>
<string name="dialog_button_done">Ок</string>
<string name="chatroom_header">Заголовок</string> <string name="chatroom_header">Заголовок</string>
<!--ChatRooms Headers--> <!--ChatRooms Headers-->
<string name="header_channel">Каналы</string> <string name="header_channel">Каналы</string>
<string name="header_private_groups">Приватные группы</string> <string name="header_private_groups">Приватные каналы</string>
<string name="header_direct_messages">Личная переписка</string> <string name="header_direct_messages">Личная переписка</string>
<string name="header_live_chats">Живые чаты</string> <string name="header_live_chats">Живые чаты</string>
<string name="header_unknown">Неизвестные</string> <string name="header_unknown">Неизвестные</string>
<!--Notifications--> <!--Notifications-->
<string name="share_label">Изменить общее сообщение</string> <string name="share_label">Редактировать сообщение</string>
<string name="notif_action_reply_hint">ОТВЕТИТЬ</string> <string name="notif_action_reply_hint">ОТВЕТИТЬ</string>
<string name="notif_error_sending">Ошибка ответа. Пожалуйста, попробуйте еще раз.</string> <string name="notif_error_sending">Не удалось ответить. Пожалуйста, попробуйте еще раз.</string>
<string name="notif_success_sending">Сообщение отправлено %1$s!</string> <string name="notif_success_sending">Сообщение отправлено %1$s!</string>
<string name="read_by">Прочитано</string> <string name="read_by">Прочитано</string>
<string name="message_information_title">Информация о сообщении</string> <string name="message_information_title">Информация о прочтении</string>
<string name="msg_log_out">Выход…</string> <string name="msg_log_out">Выходим</string>
</resources> </resources>
<resources> <resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name" translatable="false">Rocket.Chat</string> <string name="app_name" translatable="false">Rocket.Chat</string>
<!-- Titles --> <!-- Titles -->
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<string name="msg_content_description_log_in_using_meteor">Login using Meteor</string> <string name="msg_content_description_log_in_using_meteor">Login using Meteor</string>
<string name="msg_content_description_log_in_using_twitter">Login using Twitter</string> <string name="msg_content_description_log_in_using_twitter">Login using Twitter</string>
<string name="msg_content_description_log_in_using_gitlab">Login using Gitlab</string> <string name="msg_content_description_log_in_using_gitlab">Login using Gitlab</string>
<string name="msg_content_description_log_in_using_wordprees">Login using WordPress</string> <string name="msg_content_description_log_in_using_wordpress">Login using WordPress</string>
<string name="msg_content_description_send_message">Send message</string> <string name="msg_content_description_send_message">Send message</string>
<string name="msg_content_description_show_attachment_options">Show attachment options</string> <string name="msg_content_description_show_attachment_options">Show attachment options</string>
<string name="msg_you">You</string> <string name="msg_you">You</string>
...@@ -101,8 +101,7 @@ ...@@ -101,8 +101,7 @@
<string name="msg_preview_photo">Photo</string> <string name="msg_preview_photo">Photo</string>
<string name="msg_preview_file">File</string> <string name="msg_preview_file">File</string>
<string name="msg_no_messages_yet">No messages yet</string> <string name="msg_no_messages_yet">No messages yet</string>
<string name="msg_version">Version %1$s</string> <string name="msg_build" tools:ignore="MissingTranslation">Build %1$d - %2$s - %3$s</string>
<string name="msg_build">Build %1$d</string>
<string name="msg_ok">OK</string> <string name="msg_ok">OK</string>
<string name="msg_update_app_version_in_order_to_continue">Out to date server version. Please contact the server admin to update the server version in order to continue.</string> <string name="msg_update_app_version_in_order_to_continue">Out to date server version. Please contact the server admin to update the server version in order to continue.</string>
<string name="msg_ver_not_recommended"> <string name="msg_ver_not_recommended">
...@@ -176,7 +175,6 @@ ...@@ -176,7 +175,6 @@
<string name="action_msg_share">Share</string> <string name="action_msg_share">Share</string>
<string name="action_title_editing">Editing Message</string> <string name="action_title_editing">Editing Message</string>
<string name="action_msg_add_reaction">Add reaction</string> <string name="action_msg_add_reaction">Add reaction</string>
<string name="action_share">Share</string>
<!-- Permission messages --> <!-- Permission messages -->
<string name="permission_editing_not_allowed">Editing is not allowed</string> <string name="permission_editing_not_allowed">Editing is not allowed</string>
...@@ -264,6 +262,7 @@ ...@@ -264,6 +262,7 @@
<string name="dialog_sort_by_activity">Activity</string> <string name="dialog_sort_by_activity">Activity</string>
<string name="dialog_group_by_type">Group by type</string> <string name="dialog_group_by_type">Group by type</string>
<string name="dialog_group_favourites">Group favourites</string> <string name="dialog_group_favourites">Group favourites</string>
<string name="dialog_button_done">Done</string>
<string name="chatroom_header">Header</string> <string name="chatroom_header">Header</string>
<!--ChatRooms Headers--> <!--ChatRooms Headers-->
...@@ -280,4 +279,6 @@ ...@@ -280,4 +279,6 @@
<string name="notif_success_sending">Message sent to %1$s!</string> <string name="notif_success_sending">Message sent to %1$s!</string>
<string name="read_by">Read by</string> <string name="read_by">Read by</string>
<string name="message_information_title">Message information</string> <string name="message_information_title">Message information</string>
<string name="foss" tools:ignore="MissingTranslation">(FOSS)</string>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="chat.rocket.android">
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<application
android:name=".app.RocketChatApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_config"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<service
android:name=".push.FirebaseTokenService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name=".push.FirebaseMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
package chat.rocket.android.helper
import android.app.Activity
import android.content.Intent
import androidx.fragment.app.FragmentActivity
import com.google.android.gms.auth.api.credentials.Credential
import com.google.android.gms.auth.api.credentials.Credentials
fun FragmentActivity.saveCredentials(id: String, password: String) {
val credentialsClient = Credentials.getClient(this)
SmartLockHelper.save(credentialsClient, this, id, password)
}
fun Activity.requestStoredCredentials(): Pair<String, String>? {
val credentialsClient = Credentials.getClient(this)
return SmartLockHelper.requestStoredCredentials(credentialsClient, this)?.let {
null
}
}
fun getCredentials(data: Intent): Pair<String, String>? {
val credentials: Credential = data.getParcelableExtra(Credential.EXTRA_KEY)
return credentials?.let { cred ->
cred.password?.let {
Pair(cred.id, it)
}
}
}
fun hasCredentialsSupport() = true
\ No newline at end of file
package chat.rocket.android.util
import chat.rocket.android.BuildConfig
import io.fabric.sdk.android.Fabric
import com.crashlytics.android.Crashlytics
import com.crashlytics.android.core.CrashlyticsCore
import android.content.Context
import chat.rocket.android.app.RocketChatApplication
import chat.rocket.android.infrastructure.installCrashlyticsWrapper
fun setupCrashlytics(context: Context) {
val core = CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()
Fabric.with(context, Crashlytics.Builder().core(core).build())
installCrashlyticsWrapper(context as RocketChatApplication,
context.getCurrentServerInteractor, context.settingsInteractor,
context.accountRepository, context.localRepository)
}
\ No newline at end of file
package chat.rocket.android.util
import chat.rocket.android.R
import chat.rocket.android.main.ui.MainActivity
import chat.rocket.android.main.presentation.MainPresenter
import com.google.firebase.iid.FirebaseInstanceId
import com.google.firebase.messaging.FirebaseMessaging
import timber.log.Timber
suspend fun refreshFCMToken(presenter: MainPresenter) {
try {
val token = FirebaseInstanceId.getInstance().token
Timber.d("FCM token: $token")
presenter.refreshToken(token)
} catch (ex: Exception) {
Timber.d(ex, "Missing play services...")
}
}
fun invalidateFirebaseToken(token: String) {
FirebaseInstanceId.getInstance().deleteToken(token, FirebaseMessaging.INSTANCE_ID_SCOPE)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment