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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): Ti.Media.previewImage() fails to display in-memory blobs as of 9.1.0 #12271

Merged
merged 4 commits into from Nov 20, 2020

Conversation

jquick-axway
Copy link
Contributor

JIRA:
https://jira.appcelerator.org/browse/TIMOB-28246

Github Issue:
#12265

Summary:

  • Changed TiFileHelper.getTempFile() to create file like it did before 9.1.0.
  • Fixed Java TiFileHelper.getTempFileFromInputStream() method which always failed to create file.
    • Prevented our Ti.Media.previewImage() method from working.
    • Also caused issues in 3rd party modules.
  • Fixed issue where Java TiFileHelper would not delete files if app was force-quit.

Test:

  1. Run the test shown in ticket TIMOB-28246.
  2. Verify a screenshot of the app is now shown in preview window.

- Regression introduced by Titanium 9.1.0

Fixes TIMOB-28246
@build
Copy link
Contributor

build commented Nov 19, 2020

Messages
📖 👍 Hey!, You deleted more code than you added. That's awesome!
📖

💾 Here's the generated SDK zipfile.

📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖

✅ All tests are passing
Nice one! All 11310 tests are passing.
(There are 896 skipped tests not included in that total)

Generated by 🚫 dangerJS against bb9a4a4

@@ -1038,7 +992,6 @@ public void dispose()
{
TiActivityWindows.dispose();
TiActivitySupportHelpers.dispose();
TiFileHelper.getInstance().destroyTempFiles();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not destroy temp files here now? I assume because this no longer an active API and this just happens automatically implicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed TiFileHelper to use the same temp directory we expose in JavaScript. This temp directory gets deleted on app startup and every time the JS runtime terminates. See the deleteTiTempFiles() method calls below...
https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java#L363-L384

Also, the old TiFileHelper code wasn't deleting temp files if the app was forced-quit, which happens all the time by the Android OS while the app is backgrounded. This needed to be fixed.

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

@ssekhri
Copy link

ssekhri commented Nov 20, 2020

FR Passed.
Verified on:
Mac OS: 10.15.4
SDK: 9.3.0.v20201119151119
Appc CLI: 8.1.1
JDK: 11.0.6
Node: 12.16.1
Studio: 6.0.0.202005141803
Device: Pixel 3 XL(v11.0),

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

Successfully merging this pull request may close these issues.

None yet

5 participants