diff options
author | Allan Wang <me@allanwang.ca> | 2017-08-07 14:56:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-07 14:56:48 -0700 |
commit | ab7ec131b62ac1567e983c846c921bd3ada11dd4 (patch) | |
tree | 1e9e7db2151ba531f438a2ac9c4fc960c913dc46 /app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | |
parent | 7746e63373c905faa6d7e45e45fffc48d3ffff85 (diff) | |
download | frost-ab7ec131b62ac1567e983c846c921bd3ada11dd4.tar.gz frost-ab7ec131b62ac1567e983c846c921bd3ada11dd4.tar.bz2 frost-ab7ec131b62ac1567e983c846c921bd3ada11dd4.zip |
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
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt | 18 |
1 files changed, 2 insertions, 16 deletions
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 { |