Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/3099/fix crash when open ai translation is enabled #3122

Merged
merged 2 commits into from Jun 30, 2023

Conversation

mahibi
Copy link
Collaborator

@mahibi mahibi commented Jun 24, 2023

fix #3099

Bug was caused by sending too much data via intent (leads to crash / TransactionTooLargeException).

When OpenAI translation is enabled, the capabilities contain a ton of translation combinations. These capabilities are contained in 'currentUser' as well in 'selectedConversation'. So, TransactionTooLargeException was thrown.

this PR:

  • avoids passing too much data as parcelables in intents (esp. conversation and user)
  • introduces MVVM patterns to load required data (esp conversation) from backend (for now via requests, in the future from database first)
  • introduces ConversationModel which is created out of the Conversation json model
  • loads user data via injection when possible
  • creates some quickfixes in ConversationBottomDialog, EntryMenuController and OperationsMenuController.

馃毀 TODO for Follow up PR's

  • Simplify ConversationBottomDialog, EntryMenuController and OperationsMenuController.
    These classes need some refactoring anyway to remove conductor.

  • Avoid using the Conversation JSON model throughout the app. Replace with new ConversationModel.

  • Further move code to ViewModels

  • Create new models from JSON, e.g. for chat message etc.. Include "lastMessage" in ConversationModel

  • Remove methods from Conversation JSON model. use ConversationUtil instead that uses the domain model.

馃弫 Checklist

  • 鉀戯笍 Tests (unit and/or integration) are included or not needed
  • 馃敄 Capability is checked or not needed
  • 馃敊 Backport requests are created or not needed: /backport to stable-xx.x
  • 馃搮 Milestone is set
  • 馃尭 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@mahibi mahibi self-assigned this Jun 24, 2023
@mahibi mahibi force-pushed the bugfix/3099/fixCrashWhenOpenAiTranslationIsEnabled branch from e469eb2 to 7b39ea8 Compare June 26, 2023 13:20
@mahibi mahibi marked this pull request as ready for review June 26, 2023 13:36
@mahibi mahibi added 2. developing Work in progress don't merge labels Jun 26, 2023
@mahibi mahibi force-pushed the bugfix/3099/fixCrashWhenOpenAiTranslationIsEnabled branch from a8543d9 to 05e467a Compare June 29, 2023 11:54
@mahibi mahibi added 3. to review Waiting for reviews and removed 2. developing Work in progress don't merge labels Jun 29, 2023
@mahibi mahibi added this to the 17.1.0 milestone Jun 29, 2023
@mahibi mahibi force-pushed the bugfix/3099/fixCrashWhenOpenAiTranslationIsEnabled branch 2 times, most recently from 28eb895 to 1ac35eb Compare June 29, 2023 19:06
sending too much data via intent always is a bad pattern which can lead to TransactionTooLargeException.

When OpenAI translation is enabled, the capabilities contain a ton of translation combinations. These capabilities are contained in 'currentUser' as well in 'selectedConversation'. So, TransactionTooLargeException was thrown.

this PR:
- avoids passing too much data as parcelables in intents (esp. conversation and user)
- introduces MVVM patterns to load required data (esp conversation) from backend (for now via requests, in the future from database first)
- introduces ConversationModel which is created out of the Conversation json model
- loads user data via injection when possible
- creates some quickfixes in ConversationBottomDialog, EntryMenuController and OperationsMenuController.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
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>
@mahibi mahibi force-pushed the bugfix/3099/fixCrashWhenOpenAiTranslationIsEnabled branch from 1ac35eb to cbf74cc Compare June 30, 2023 05:06
@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/3122-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

@mahibi mahibi merged commit 64d0f0e into master Jun 30, 2023
13 of 16 checks passed
@delete-merged-branch delete-merged-branch bot deleted the bugfix/3099/fixCrashWhenOpenAiTranslationIsEnabled branch June 30, 2023 05:30
@mahibi
Copy link
Collaborator Author

mahibi commented Jun 30, 2023

/backport to stable-17.0

@backportbot-nextcloud
Copy link

The backport to stable-17.0 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable-17.0
git pull origin stable-17.0

# Create the new backport branch
git checkout -b fix/foo-stable-17.0

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable-17.0

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@mahibi
Copy link
Collaborator Author

mahibi commented Jun 30, 2023

The backport to stable-17.0 failed.

expected..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when loading conversations after updating to 17.0.0
2 participants