mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Fix to parse OpenAI translations.
The parsed result was without quotes which resulted in error: Unterminated object at character 21 of [{fromLabel=English (US), Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
817ea1ab64
commit
64d0f0e2cd
@ -156,7 +156,7 @@ class TranslateActivity : BaseActivity() {
|
|||||||
|
|
||||||
private fun getLanguageOptions() {
|
private fun getLanguageOptions() {
|
||||||
val currentUser = userManager.currentUser.blockingGet()
|
val currentUser = userManager.currentUser.blockingGet()
|
||||||
val json = JSONArray(CapabilitiesUtilNew.getLanguages(currentUser).toString())
|
val json = JSONArray((CapabilitiesUtilNew.getLanguages(currentUser) as ArrayList<*>).toArray())
|
||||||
|
|
||||||
val fromLanguagesSet = mutableSetOf(resources.getString(R.string.translation_detect_language))
|
val fromLanguagesSet = mutableSetOf(resources.getString(R.string.translation_detect_language))
|
||||||
val toLanguagesSet = mutableSetOf(resources.getString(R.string.translation_device_settings))
|
val toLanguagesSet = mutableSetOf(resources.getString(R.string.translation_device_settings))
|
||||||
@ -212,7 +212,7 @@ class TranslateActivity : BaseActivity() {
|
|||||||
|
|
||||||
private fun getISOFromServer(language: String): String {
|
private fun getISOFromServer(language: String): String {
|
||||||
val currentUser = userManager.currentUser.blockingGet()
|
val currentUser = userManager.currentUser.blockingGet()
|
||||||
val json = JSONArray(CapabilitiesUtilNew.getLanguages(currentUser).toString())
|
val json = JSONArray((CapabilitiesUtilNew.getLanguages(currentUser) as ArrayList<*>).toArray())
|
||||||
|
|
||||||
for (i in 0 until json.length()) {
|
for (i in 0 until json.length()) {
|
||||||
val current = json.getJSONObject(i)
|
val current = json.getJSONObject(i)
|
||||||
|
@ -95,7 +95,7 @@ class MessageActionsDialog(
|
|||||||
!message.isDeleted &&
|
!message.isDeleted &&
|
||||||
ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getCalculateMessageType() &&
|
ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getCalculateMessageType() &&
|
||||||
CapabilitiesUtilNew.isTranslationsSupported(user) &&
|
CapabilitiesUtilNew.isTranslationsSupported(user) &&
|
||||||
JSONArray(CapabilitiesUtilNew.getLanguages(user).toString()).length() > 0
|
JSONArray((CapabilitiesUtilNew.getLanguages(user) as ArrayList<*>).toArray()).length() > 0
|
||||||
)
|
)
|
||||||
initMenuReplyToMessage(message.replyable && hasChatPermission)
|
initMenuReplyToMessage(message.replyable && hasChatPermission)
|
||||||
initMenuReplyPrivately(
|
initMenuReplyPrivately(
|
||||||
|
Loading…
Reference in New Issue
Block a user