From ab7ec131b62ac1567e983c846c921bd3ada11dd4 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 7 Aug 2017 14:56:48 -0700 Subject: Fix/2FA (#115) * Create basis for downloading videos * Resolve some download errors and allow video to be opened in external apps * Remove url checks for loging * Update readme with build links * Allow for all apks to build * Fix travis apk uploads * Fix null mapping * Fix some notation * Add commit message to test builds * Remove faulty commit from test release * Add intent overriding to login web client * Add resource logging * Add intent verification without url check * Simplify login activity * Check start activity for result * Add check before resolving intent * Fix wrong index * Temporary fix for 2FA login with U2F (#116) * Clean up and add comments --- .../com/pitchedapps/frost/activities/ImageActivity.kt | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt index e419c21c..6a39b269 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -148,7 +148,7 @@ class ImageActivity : KauBaseActivity() { private fun saveTempImage(resource: Bitmap, callback: (uri: Uri?) -> Unit) { var photoFile: File? = null try { - photoFile = createImageFile() + photoFile = createPrivateMediaFile(".png") } catch (ignored: IOException) { } finally { if (photoFile == null) { @@ -166,27 +166,13 @@ class ImageActivity : KauBaseActivity() { } } - @Throws(IOException::class) - private fun createImageFile(): File { - // Create an image file name - val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date()) - val imageFileName = "Frost_" + timeStamp + "_" - val storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES) - return File.createTempFile(imageFileName, ".png", storageDir) - } - internal fun downloadImage() { kauRequestPermissions(PERMISSION_WRITE_EXTERNAL_STORAGE) { granted, _ -> L.d("Download image callback granted: $granted") if (granted) { doAsync { - val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date()) - val imageFileName = "Frost_" + timeStamp + "_" - val storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) - val frostDir = File(storageDir, "Frost") - if (!frostDir.exists()) frostDir.mkdirs() - val destination = File.createTempFile(imageFileName, ".png", frostDir) + val destination = createMediaFile(".png") downloadPath = destination.absolutePath var success = true try { -- cgit v1.2.3