Skip to content

Commit 32d9f57

Browse files
committed
#Added the new listener OnAppCalledListener and deprecated setOnYotiCalledListener
#YM-23299
1 parent f5eaf32 commit 32d9f57

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ yotiSDKButton.setOnYotiButtonListener(new YotiSDKButton.OnYotiButtonClickListene
208208
There is also a listener that you can set to be notified when the intent has been sent to the Yoti app.
209209
When this happens you would probably want to restore your state.
210210

211-
211+
Attention: This listener is now deprecated.
212212
```java
213213
yotiSDKButton.setOnYotiCalledListener(new YotiSDKButton.OnYotiCalledListener() {
214214
@Override
@@ -217,6 +217,16 @@ When this happens you would probably want to restore your state.
217217
}
218218
});
219219
```
220+
Please use the below listener to get notified when the intent has been sent to app based on the specified theme:
221+
```java
222+
yotiSDKButton.setOnAppCalledListener(new YotiSDKButton.OnAppCalledListener() {
223+
@Override
224+
public void onAppCalled() {
225+
// Restore the original state
226+
}
227+
});
228+
```
229+
220230
[See this code in one of our sample apps](./sample-app/src/main/java/com/yoti/mobile/android/sdk/sampleapp/MainActivity.java)
221231

222232
You can activate a verbose mode for the SDK by using this method :

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,13 @@ public void onStartScenarioError(YotiSDKException cause) {
126126
launchAppUrl(appURL);
127127
});
128128

129-
yotiSDKButton.setOnYotiCalledListener(() -> {
130-
// Restore the original state
131-
yotiSDKButton.setVisibility(View.VISIBLE);
132-
showStatus(true, R.string.result_status_openYoti);
129+
mYotiSDKButton.setOnAppCalledListener(new YotiSDKButton.OnAppCalledListener() {
130+
@Override
131+
public void onAppCalled() {
132+
// Restore the original state
133+
mYotiSDKButton.setVisibility(View.VISIBLE);
134+
showStatus(true, R.string.result_status_openYoti);
135+
}
133136
});
134137
}
135138

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public void onYotiAppNotInstalledError(YotiSDKNoYotiAppException cause) {
5757
}
5858
});
5959

60-
mYotiSDKButton.setOnYotiCalledListener(new YotiSDKButton.OnYotiCalledListener() {
60+
mYotiSDKButton.setOnAppCalledListener(new YotiSDKButton.OnAppCalledListener() {
6161
@Override
62-
public void onYotiCalled() {
62+
public void onAppCalled() {
6363
// Restore the original state
6464
mYotiSDKButton.setVisibility(View.VISIBLE);
6565
mProgress.setVisibility(View.GONE);

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public final class YotiSDKButton extends YotiButtonContainer {
2525
private OnYotiAppNotInstalledListener mOnYotiAppNotInstalledListener;
2626
private OnAppNotInstalledListener mOnAppNotInstalledListener;
2727
private OnYotiCalledListener mOnYotiCalledListener;
28+
private OnAppCalledListener mOnAppCalledListener;
2829

2930
private ResultReceiver mYotiCallResultReceiver = new ResultReceiver(new Handler()) {
3031
@Override
@@ -33,6 +34,10 @@ protected void onReceiveResult(int resultCode, Bundle resultData) {
3334
if (mOnYotiCalledListener != null) {
3435
mOnYotiCalledListener.onYotiCalled();
3536
}
37+
38+
if (mOnAppCalledListener != null) {
39+
mOnAppCalledListener.onAppCalled();
40+
}
3641
}
3742
};
3843

@@ -110,9 +115,14 @@ public void setOnAppNotInstalledListener(@Nullable OnAppNotInstalledListener lis
110115
}
111116

112117
public void setOnYotiCalledListener(@Nullable OnYotiCalledListener listener) {
118+
YotiSDKLogger.warning("The method 'setOnYotiCalledListener' is now deprecated. Please use 'setOnAppCalledListener' instead.");
113119
mOnYotiCalledListener = listener;
114120
}
115121

122+
public void setOnAppCalledListener(@Nullable OnAppCalledListener listener) {
123+
mOnAppCalledListener = listener;
124+
}
125+
116126
@Override
117127
protected void onSdkButtonClicked() {
118128

@@ -175,4 +185,8 @@ public interface OnAppNotInstalledListener {
175185
public interface OnYotiCalledListener {
176186
void onYotiCalled();
177187
}
188+
189+
public interface OnAppCalledListener {
190+
void onAppCalled();
191+
}
178192
}

0 commit comments

Comments
 (0)