Skip to content

Commit 5e1d4bf

Browse files
committed
#Renamed AppNotInstalledErrorCode to AppType
#YM-23299
1 parent bac5ccf commit 5e1d4bf

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import androidx.annotation.NonNull;
1212
import androidx.annotation.Nullable;
1313

14-
import com.yoti.mobile.android.sdk.exceptions.AppNotInstalledErrorCode;
14+
import com.yoti.mobile.android.sdk.exceptions.AppType;
1515
import com.yoti.mobile.android.sdk.exceptions.YotiSDKAppNotInstalledException;
1616
import com.yoti.mobile.android.sdk.exceptions.YotiSDKException;
1717
import com.yoti.mobile.android.sdk.exceptions.YotiSDKMinVersionException;
@@ -24,9 +24,9 @@
2424

2525
import static com.yoti.mobile.android.sdk.ButtonTheme.THEME_PARTNERSHIP;
2626
import static com.yoti.mobile.android.sdk.ButtonTheme.THEME_YOTI;
27-
import static com.yoti.mobile.android.sdk.exceptions.AppNotInstalledErrorCode.EASY_ID_APP_NOT_INSTALLED;
28-
import static com.yoti.mobile.android.sdk.exceptions.AppNotInstalledErrorCode.PARTNERSHIP_APP_NOT_INSTALLED;
29-
import static com.yoti.mobile.android.sdk.exceptions.AppNotInstalledErrorCode.YOTI_APP_NOT_INSTALLED;
27+
import static com.yoti.mobile.android.sdk.exceptions.AppType.EASY_ID_APP;
28+
import static com.yoti.mobile.android.sdk.exceptions.AppType.PARTNERSHIP_APP;
29+
import static com.yoti.mobile.android.sdk.exceptions.AppType.YOTI_APP;
3030

3131
/**
3232
* Singleton to manage the different Scenarios defined by a third party app.
@@ -158,22 +158,22 @@ private static PackageInfo getAppPackageInfoBasedOnTheme(PackageManager packageM
158158
} else if (checkAppInstalled(packageManager, YotiAppDefs.EASY_ID_APP_PACKAGE)) {
159159
packageInfo = packageManager.getPackageInfo(YotiAppDefs.EASY_ID_APP_PACKAGE, 0);
160160
} else {
161-
AppNotInstalledErrorCode errorCode = buttonTheme == THEME_YOTI ? YOTI_APP_NOT_INSTALLED : PARTNERSHIP_APP_NOT_INSTALLED;
162-
throw new YotiSDKAppNotInstalledException(errorCode, "Yoti app not installed");
161+
AppType appType = buttonTheme == THEME_YOTI ? YOTI_APP : PARTNERSHIP_APP;
162+
throw new YotiSDKAppNotInstalledException(appType, appType.getValue()+" app not installed");
163163
}
164164
break;
165165
case THEME_EASYID:
166166
if (checkAppInstalled(packageManager, YotiAppDefs.EASY_ID_APP_PACKAGE)
167167
&& checkEasyAppWithSchemeAvailable(packageManager)) {
168168
packageInfo = packageManager.getPackageInfo(YotiAppDefs.EASY_ID_APP_PACKAGE, 0);
169169
} else {
170-
throw new YotiSDKAppNotInstalledException(EASY_ID_APP_NOT_INSTALLED, "EasyId app not installed");
170+
throw new YotiSDKAppNotInstalledException(EASY_ID_APP, "EasyId app not installed");
171171
}
172172
break;
173173
}
174174
}
175175
catch (NameNotFoundException e) {
176-
throw new YotiSDKAppNotInstalledException(YOTI_APP_NOT_INSTALLED, "Yoti app not installed");
176+
throw new YotiSDKAppNotInstalledException(YOTI_APP, "Yoti app not installed");
177177
}
178178
return packageInfo;
179179
}

yoti-sdk/src/main/java/com/yoti/mobile/android/sdk/exceptions/AppNotInstalledErrorCode.java

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.yoti.mobile.android.sdk.exceptions;
2+
3+
public enum AppType {
4+
YOTI_APP("Yoti"),
5+
EASY_ID_APP("EasyId"),
6+
PARTNERSHIP_APP("Yoti / EasyId");
7+
8+
private final String appName;
9+
10+
AppType(final String value) {
11+
this.appName = value;
12+
}
13+
14+
public String getValue() {
15+
return appName;
16+
}
17+
}

yoti-sdk/src/main/java/com/yoti/mobile/android/sdk/exceptions/YotiSDKAppNotInstalledException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
public class YotiSDKAppNotInstalledException extends YotiSDKException {
44

5-
AppNotInstalledErrorCode errorCode;
5+
AppType unavailableApp;
66

7-
public YotiSDKAppNotInstalledException(AppNotInstalledErrorCode errorCode, String message) {
7+
public YotiSDKAppNotInstalledException(AppType unavailableApp, String message) {
88
super(message);
9-
this.errorCode = errorCode;
9+
this.unavailableApp = unavailableApp;
1010
}
1111
}
1212

0 commit comments

Comments
 (0)