Skip to content

Commit

Permalink
Merge pull request #1916 from dimagi/wsp/commcare_2.41.1_hotfix
Browse files Browse the repository at this point in the history
Check for permissions error, show toast
  • Loading branch information
Aliza Stone authored Dec 15, 2017
2 parents e50eb1a + ae7770a commit 061cd64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/assets/locales/android_translatable_strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -820,4 +820,6 @@ quarantine.reason.server.processing=The server failed to process the form
quarantine.reason.record.error=There was an issue with the form record that prevented submission
quarantine.reason.manual=The form was manually quarantined by a user
quarantine.reason.fnf=The file backing the form submission could not be found
quarantine.reason.unknown=Reason for quarantine unknown
quarantine.reason.unknown=Reason for quarantine unknown

camera.permissions.denied=CommCare does not have permission to use your camera. Please make sure your permissions are set correctly.
5 changes: 5 additions & 0 deletions app/src/org/commcare/views/widgets/ImageWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.javarosa.core.model.UploadQuestionExtension;
import org.javarosa.core.model.data.IAnswerData;
import org.javarosa.core.model.data.StringData;
import org.javarosa.core.services.locale.Localization;
import org.javarosa.form.api.FormEntryPrompt;

import java.io.File;
Expand Down Expand Up @@ -115,6 +116,10 @@ public void onClick(View v) {
StringUtils.getStringSpannableRobust(getContext(),
R.string.activity_not_found, "image capture"),
Toast.LENGTH_SHORT).show();
} catch (SecurityException e) {
Toast.makeText(getContext(),
Localization.get("camera.permissions.denied"),
Toast.LENGTH_SHORT).show();
}
}
});
Expand Down
5 changes: 5 additions & 0 deletions app/src/org/commcare/views/widgets/VideoWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.commcare.dalvik.R;
import org.commcare.logic.PendingCalloutInterface;
import org.commcare.utils.StringUtils;
import org.javarosa.core.services.locale.Localization;
import org.javarosa.form.api.FormEntryPrompt;

/**
Expand Down Expand Up @@ -52,6 +53,10 @@ public void onClick(View v) {
StringUtils.getStringSpannableRobust(getContext(),
R.string.activity_not_found, "capture video"),
Toast.LENGTH_SHORT).show();
} catch (SecurityException e) {
Toast.makeText(getContext(),
Localization.get("camera.permissions.denied"),
Toast.LENGTH_SHORT).show();
}
}
});
Expand Down

0 comments on commit 061cd64

Please sign in to comment.