Remove unneeded file permission checks
This fixes sharing and saving images
This commit is contained in:
parent
5149150f27
commit
69a0c13d32
|
@ -221,9 +221,6 @@ dependencies {
|
||||||
implementation 'com.mikepenz:iconics-views:5.4.0'
|
implementation 'com.mikepenz:iconics-views:5.4.0'
|
||||||
implementation 'com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar'
|
implementation 'com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar'
|
||||||
|
|
||||||
|
|
||||||
implementation 'com.karumi:dexter:6.2.3'
|
|
||||||
|
|
||||||
implementation 'com.github.ligi:tracedroid:4.1'
|
implementation 'com.github.ligi:tracedroid:4.1'
|
||||||
|
|
||||||
implementation 'me.relex:circleindicator:2.1.6'
|
implementation 'me.relex:circleindicator:2.1.6'
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.pixeldroid.app.posts
|
package org.pixeldroid.app.posts
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
|
@ -36,10 +35,6 @@ import com.davemorrissey.labs.subscaleview.ImageSource
|
||||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.karumi.dexter.Dexter
|
|
||||||
import com.karumi.dexter.listener.PermissionDeniedResponse
|
|
||||||
import com.karumi.dexter.listener.PermissionGrantedResponse
|
|
||||||
import com.karumi.dexter.listener.single.BasePermissionListener
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
import okio.BufferedSink
|
import okio.BufferedSink
|
||||||
|
@ -401,41 +396,16 @@ class StatusViewHolder(val binding: PostFragmentBinding) : RecyclerView.ViewHold
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.post_more_menu_save_to_gallery -> {
|
R.id.post_more_menu_save_to_gallery -> {
|
||||||
Dexter.withContext(binding.root.context)
|
|
||||||
.withPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
|
||||||
.withListener(object : BasePermissionListener() {
|
|
||||||
override fun onPermissionDenied(p0: PermissionDeniedResponse?) {
|
|
||||||
Toast.makeText(
|
|
||||||
binding.root.context,
|
|
||||||
binding.root.context.getString(R.string.write_permission_download_pic),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPermissionGranted(p0: PermissionGrantedResponse?) {
|
|
||||||
status?.downloadImage(
|
status?.downloadImage(
|
||||||
binding.root.context,
|
binding.root.context,
|
||||||
status?.media_attachments?.getOrNull(binding.postPager.currentItem)?.url
|
status?.media_attachments?.getOrNull(binding.postPager.currentItem)?.url
|
||||||
?: "",
|
?: "",
|
||||||
binding.root
|
binding.root
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}).check()
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.post_more_menu_share_picture -> {
|
|
||||||
Dexter.withContext(binding.root.context)
|
|
||||||
.withPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
|
||||||
.withListener(object : BasePermissionListener() {
|
|
||||||
override fun onPermissionDenied(p0: PermissionDeniedResponse?) {
|
|
||||||
Toast.makeText(
|
|
||||||
binding.root.context,
|
|
||||||
binding.root.context.getString(R.string.write_permission_share_pic),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPermissionGranted(p0: PermissionGrantedResponse?) {
|
R.id.post_more_menu_share_picture -> {
|
||||||
status?.downloadImage(
|
status?.downloadImage(
|
||||||
binding.root.context,
|
binding.root.context,
|
||||||
status?.media_attachments?.getOrNull(binding.postPager.currentItem)?.url
|
status?.media_attachments?.getOrNull(binding.postPager.currentItem)?.url
|
||||||
|
@ -443,8 +413,6 @@ class StatusViewHolder(val binding: PostFragmentBinding) : RecyclerView.ViewHold
|
||||||
binding.root,
|
binding.root,
|
||||||
share = true,
|
share = true,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}).check()
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.post_more_menu_delete -> {
|
R.id.post_more_menu_delete -> {
|
||||||
|
|
Loading…
Reference in New Issue