Skip to content

Commit

Permalink
tmp4
Browse files Browse the repository at this point in the history
  • Loading branch information
thermatk committed Sep 17, 2023
1 parent c022263 commit 7fb2d63
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ private void resetTranslatingDialogsCache() {

// ensure dialogId in storyItem is valid
public void detectStoryLanguage(TLRPC.StoryItem storyItem) {
if (storyItem == null || storyItem.detectedLng != null || storyItem.caption == null || storyItem.caption.length() == 0 || !LanguageDetector.hasSupport()) {
if (storyItem == null || storyItem.detectedLng != null || storyItem.caption == null || storyItem.caption.length() == 0 || true) {
return;
}

Expand All @@ -1023,15 +1023,15 @@ public void detectStoryLanguage(TLRPC.StoryItem storyItem) {
}
detectingStories.add(key);

LanguageDetector.detectLanguage(storyItem.caption, lng -> AndroidUtilities.runOnUIThread(() -> {
/*LanguageDetector.detectLanguage(storyItem.caption, lng -> AndroidUtilities.runOnUIThread(() -> {
storyItem.detectedLng = lng;
getMessagesController().getStoriesController().getStoriesStorage().putStoryInternal(storyItem.dialogId, storyItem);
detectingStories.remove(key);
}), err -> AndroidUtilities.runOnUIThread(() -> {
}), err -> AndroidUtilities.runOnUIThread(() -> {*/
storyItem.detectedLng = UNKNOWN_LANGUAGE;
getMessagesController().getStoriesController().getStoriesStorage().putStoryInternal(storyItem.dialogId, storyItem);
detectingStories.remove(key);
}));
//}));
}

public boolean canTranslateStory(TLRPC.StoryItem storyItem) {
Expand Down Expand Up @@ -1132,7 +1132,7 @@ public StoryKey(TLRPC.StoryItem storyItem) {
private final HashSet<MessageKey> translatingPhotos = new HashSet<>();

public void detectPhotoLanguage(MessageObject messageObject, Utilities.Callback<String> done) {
if (messageObject == null || messageObject.messageOwner == null || !LanguageDetector.hasSupport() || TextUtils.isEmpty(messageObject.messageOwner.message)) {
if (messageObject == null || messageObject.messageOwner == null || true || TextUtils.isEmpty(messageObject.messageOwner.message)) {
return;
}
if (!TextUtils.isEmpty(messageObject.messageOwner.originalLanguage)) {
Expand All @@ -1148,21 +1148,21 @@ public void detectPhotoLanguage(MessageObject messageObject, Utilities.Callback<
}
detectingPhotos.add(key);

LanguageDetector.detectLanguage(messageObject.messageOwner.message, lng -> AndroidUtilities.runOnUIThread(() -> {
/*LanguageDetector.detectLanguage(messageObject.messageOwner.message, lng -> AndroidUtilities.runOnUIThread(() -> {
messageObject.messageOwner.originalLanguage = lng;
getMessagesStorage().updateMessageCustomParams(key.dialogId, messageObject.messageOwner);
detectingPhotos.remove(key);
if (done != null) {
done.run(lng);
}
}), err -> AndroidUtilities.runOnUIThread(() -> {
}), err -> AndroidUtilities.runOnUIThread(() -> {*/
messageObject.messageOwner.originalLanguage = UNKNOWN_LANGUAGE;
getMessagesStorage().updateMessageCustomParams(key.dialogId, messageObject.messageOwner);
detectingPhotos.remove(key);
if (done != null) {
done.run(UNKNOWN_LANGUAGE);
}
}));
//}));
}

public boolean canTranslatePhoto(MessageObject messageObject, String detectedLanguage) {
Expand Down

0 comments on commit 7fb2d63

Please sign in to comment.