Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Update CustomerProfileActivity.java #82

Closed
wants to merge 2 commits into from

Conversation

garvit984
Copy link

Fixes #78 FIN-203

Checking for Camera Permission instead of Write Permission in CustomerProfileActivity

Click on "Customer" inside the drawer.
Click on any item in the list of customers.
Click on the profile picture (by default it's the Mifos Logo)
Click on the "Share" option in the app bar.
Supposing the permission to write to external storage is not given, it'll ask for permission. When granted it should ideally call the "share image" method, but nothing happens. This is because when the Permission is being granted, it's checking for "CAMERA" permission instead of "WRITE_EXTERNAL_STORAGE" permission.
It occurs when the permission is being granted initially and later, this error does not occur.
Please make sure these boxes are checked before submitting your pull request - thanks!

Apply the AndroidStyle.xml style template to your code in Android Studio.

Run the unit tests with ./gradlew check to make sure you didn't break anything.

If you have multiple commits please combine them into one commit by squashing them.

@@ -164,6 +168,16 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
Toaster.show(findViewById(android.R.id.content),
getString(R.string.permission_denied_write));
}
case ConstantKeys.PERMISSIONS_REQUEST_CAMERA: {switch (requestCode) {
case ConstantKeys.PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we are using two switches? It is too complicated, even by that, as I see in both cases we are doing the same thing. Instead, add only case ConstantKeys.PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE: before case ConstantKeys.PERMISSIONS_REQUEST_CAMERA: at line number 163 without adding break after the first case. It will do the same work as your boilerplate codes are doing at line numbers[171-180].

@jawidMuhammadi
Copy link
Contributor

@garvit984 why the build is failing, can you take a look, please?

@garvit984 garvit984 closed this May 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants