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

Extract Android permissions from HomeActivity #46

Open
JoaquimLey opened this issue Apr 21, 2018 · 0 comments
Open

Extract Android permissions from HomeActivity #46

JoaquimLey opened this issue Apr 21, 2018 · 0 comments

Comments

@JoaquimLey
Copy link
Owner

HomeActivity is currently responsible for requesting the necessary Android permissions, this is wrong.

Context

The idea is the HomeActivity should only be responsible for navigation.

Tasks

  • Create a specific activity to request the permissions (since the app is unusable without), keeps the responsibilities simple.

Extract this code from HomeActivity

 /**
     * Runtime permission shenanigans
     */
    private fun hasReadSmsPermission(): Boolean {
        return ContextCompat.checkSelfPermission(this, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED &&
                ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS) == PackageManager.PERMISSION_GRANTED &&
                ContextCompat.checkSelfPermission(this, Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED
    }

    private fun requestReadAndSendSmsPermission() {
        ActivityCompat.requestPermissions(this,
                arrayOf(Manifest.permission.SEND_SMS, Manifest.permission.READ_SMS, Manifest.permission.RECEIVE_SMS), SMS_PERMISSION_CODE)
    }
@JoaquimLey JoaquimLey added this to the MVP milestone Apr 21, 2018
@JoaquimLey JoaquimLey added this to Backlog in Roadmap via automation Apr 21, 2018
@JoaquimLey JoaquimLey moved this from Backlog to Up-next in Roadmap Apr 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Roadmap
  
Up-next
Development

No branches or pull requests

1 participant