prevent android test user from flagging posts

This commit is contained in:
Phillip Thelen 2019-08-29 10:26:52 +02:00
parent 6dc5452f6e
commit f269f41a4e
4 changed files with 12 additions and 7 deletions

View file

@ -152,7 +152,7 @@ android {
buildConfigField "String", "TESTING_LEVEL", "\"production\""
multiDexEnabled true
versionCode 2222
versionCode 2224
versionName "2.1"
}

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.data.implementation
import com.habitrpg.android.habitica.BuildConfig
import com.habitrpg.android.habitica.data.ApiClient
import com.habitrpg.android.habitica.data.SocialRepository
import com.habitrpg.android.habitica.data.local.SocialLocalRepository
@ -68,12 +69,14 @@ class SocialRepositoryImpl(localRepository: SocialLocalRepository, apiClient: Ap
}
override fun flagMessage(chatMessage: ChatMessage, additionalInfo: String): Flowable<Void> {
return if (chatMessage.id == "") {
Flowable.empty()
} else {
val data = mutableMapOf<String, String>()
data["comment"] = additionalInfo
apiClient.flagMessage(chatMessage.groupId ?: "", chatMessage.id, data)
return when {
chatMessage.id == "" -> Flowable.empty()
userID == BuildConfig.ANDROID_TESTING_UUID -> Flowable.empty()
else -> {
val data = mutableMapOf<String, String>()
data["comment"] = additionalInfo
apiClient.flagMessage(chatMessage.groupId ?: "", chatMessage.id, data)
}
}
}

View file

@ -14,3 +14,4 @@ PORT=80
BASE_URL=https://habitica.com
STAGING_KEY=
ANDROID_TESTING_UUID=

View file

@ -1,3 +1,4 @@
PORT=3000
BASE_URL=http://localhost:3000
STAGING_KEY=
ANDROID_TESTING_UUID=