Skip to content

Commit e010ae4

Browse files
committed
Fixing error handling.
Improving "Yoti app not installed" case in Sample-app. ED-545
1 parent 9c8dbec commit e010ae4

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

sample-app/src/main/java/com/yoti/mobile/android/sdk/sampleapp/MainActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public void onStartScenarioError(YotiSDKException cause) {
4444
@Override
4545
public void onYotiAppNotInstalledError(YotiSDKNoYotiAppException cause) {
4646
//The Yoti app is not installed, let's deal with it
47+
yotiSDKButton.setVisibility(View.VISIBLE);
48+
progress.setVisibility(View.GONE);
49+
message.setText(R.string.loc_no_yoti_app_error);
4750
}
4851
});
4952

sample-app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<string name="share_my_phone">Share my phone</string>
55

66
<string name="loc_error_unknow">Something went wrong :(</string>
7+
<string name="loc_no_yoti_app_error">The Yoti app is not install in this device</string>
78
<string name="loc_error_not_completed_on_yoti">Process not completed on the Yoti App</string>
89
<string name="loc_phone_number">Your phone number is : %s</string>
910
</resources>

yoti-sdk/src/main/java/com/yoti/mobile/android/sdk/YotiSDKButton.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,10 @@ public void onClick(View v) {
104104

105105
YotiSDKLogger.error(cause.getMessage(), cause);
106106

107-
if (mOnYotiButtonClickListener != null) {
108-
mOnYotiButtonClickListener.onStartScenarioError(cause);
109-
}
110-
111107
if (mOnYotiAppNotInstalledListener != null && cause instanceof YotiSDKNoYotiAppException) {
112108
mOnYotiAppNotInstalledListener.onYotiAppNotInstalledError((YotiSDKNoYotiAppException) cause);
109+
} else if (mOnYotiButtonClickListener != null) {
110+
mOnYotiButtonClickListener.onStartScenarioError(cause);
113111
}
114112
}
115113
}

0 commit comments

Comments
 (0)