Open JoaquimLey opened 6 years ago
HomeActivity is currently responsible for requesting the necessary Android permissions, this is wrong.
HomeActivity
The idea is the HomeActivity should only be responsible for navigation.
/** * 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) }
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
Extract this code from
HomeActivity