Browse Source

hide translation option of no target languages available

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 năm trước cách đây
mục cha
commit
cff28de8b1

+ 3 - 1
app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt

@@ -55,6 +55,7 @@ import io.reactivex.Observer
 import io.reactivex.android.schedulers.AndroidSchedulers
 import io.reactivex.disposables.Disposable
 import io.reactivex.schedulers.Schedulers
+import org.json.JSONArray
 import javax.inject.Inject
 
 @AutoInjector(NextcloudTalkApplication::class)
@@ -91,7 +92,8 @@ class MessageActionsDialog(
         initMenuItemTranslate(
             !message.isDeleted &&
                 ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getCalculateMessageType() &&
-                CapabilitiesUtilNew.isTranslationsSupported(user)
+                CapabilitiesUtilNew.isTranslationsSupported(user) &&
+                JSONArray(CapabilitiesUtilNew.getLanguages(user).toString()).length() > 0
         )
         initMenuReplyToMessage(message.replyable && hasChatPermission)
         initMenuReplyPrivately(