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

[TIMOB-20439] Android: Delete temp camera data on exit #9362

Merged
merged 4 commits into from Nov 14, 2017

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Aug 28, 2017

  • Destroy temporary camera captures from application data storage on exit
TEST CASE
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
var win = Titanium.UI.createWindow({title: 'TIMOB-3887', backgroundColor: 'gray', layout: 'vertical'}),
    btn = Ti.UI.createButton({title: 'TAKE PICTURE', width: '100%', height: '40dp'}),
    iv = Ti.UI.createImageView({autorotate: true, width: Ti.UI.FILL, height: Ti.UI.FILL});

function takePicture() {
    Titanium.Media.showCamera({
        success: function(e) {
            iv.image = e.media;
            Ti.Media.hideCamera();
        },
        cancel: function() {
            Ti.API.info('canceled');
        },
        error: function(e) {
            Ti.API.info('error: ' + JSON.stringify(e, null, ' '))
        },
        saveToPhotoGallery: false,
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO]
    });
}

btn.addEventListener('click', function(e) {
    var permissions = ['android.permission.CAMERA',
                       'android.permission.WRITE_EXTERNAL_STORAGE',
                       'android.permission.READ_EXTERNAL_STORAGE'];
    for (var permission of permissions) {
        if (!Ti.Android.hasPermission(permission)) {
            Ti.Android.requestPermissions(permissions, function(e) {
                if (e.success) {
                    takePicture();
                }
            });
            return;
        }
    }
    takePicture();
});

win.add(btn);
win.add(iv);
win.open();
  • Application data should be <1 MB upon exiting

JIRA Ticket

@garymathews garymathews added this to the 7.0.0 milestone Aug 28, 2017
@garymathews garymathews requested a review from ypbnv August 28, 2017 00:05
Copy link
Contributor

@ypbnv ypbnv 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

@lokeshchdhry
Copy link
Contributor

FR Passed.

  1. With 6.3.0 : Start app size 35 MB , App size after close 60MB.
  2. With 7.0.0 with the fix: Start app size 35 MB , App size after close 35MB.

Studio Ver: 4.10.0.201709271713
SDK Ver: 7.0.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.10
Appc CLI: 6.3.0
Ti CLI Ver: 5.0.14
Alloy Ver: 1.10.7
Node Ver: 7.10.1
Java Ver: 1.8.0_101
Devices: ⇨ google Nexus 5 --- Android 6.0.1
⇨ google Nexus 6P --- Android 8.0.0

@eric34 eric34 merged commit 4203776 into tidev:master Nov 14, 2017
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

6 participants