|
18 | 18 | import javax.net.ssl.HttpsURLConnection;
|
19 | 19 |
|
20 | 20 | import static com.yoti.mobile.android.sampleapp2.ProfileActivity.ADDRESS_EXTRA;
|
| 21 | +import static com.yoti.mobile.android.sampleapp2.ProfileActivity.BACKEND_DATA_ERROR_EXTRA; |
21 | 22 | import static com.yoti.mobile.android.sampleapp2.ProfileActivity.DOB_EXTRA;
|
22 | 23 | import static com.yoti.mobile.android.sampleapp2.ProfileActivity.EMAIL_EXTRA;
|
23 | 24 | import static com.yoti.mobile.android.sampleapp2.ProfileActivity.GENDER_EXTRA;
|
@@ -91,18 +92,25 @@ private void handleActionRetrieveProfile(String callbackUrl, String token, Strin
|
91 | 92 | }
|
92 | 93 |
|
93 | 94 | Gson g = new GsonBuilder().create();
|
94 |
| - Profile profile = g.fromJson(new String(response), Profile.class); |
95 |
| - |
96 |
| - Intent intent = new Intent(this, MainActivity.class); |
97 |
| - intent.putExtra(NAME_EXTRA, profile.getGivenNames() + " " + profile.getFamilyName()); |
98 |
| - intent.putExtra(EMAIL_EXTRA, profile.getEmailAddress()); |
99 |
| - intent.putExtra(IMAGE_EXTRA, profile.getSelfie()); |
100 |
| - intent.putExtra(DOB_EXTRA, profile.getDateOfBirth()); |
101 |
| - intent.putExtra(ADDRESS_EXTRA, profile.getPostalAddress()); |
102 |
| - intent.putExtra(MOBILE_EXTRA, profile.getMobNum()); |
103 |
| - intent.putExtra(GENDER_EXTRA, profile.getGender()); |
104 |
| - intent.putExtra(PROFILE_EXTRA, true); |
105 |
| - startActivity(intent); |
| 95 | + |
| 96 | + try { |
| 97 | + Profile profile = g.fromJson(new String(response), Profile.class); |
| 98 | + |
| 99 | + Intent intent = new Intent(this, MainActivity.class); |
| 100 | + intent.putExtra(NAME_EXTRA, profile.getGivenNames() + " " + profile.getFamilyName()); |
| 101 | + intent.putExtra(EMAIL_EXTRA, profile.getEmailAddress()); |
| 102 | + intent.putExtra(IMAGE_EXTRA, profile.getSelfie()); |
| 103 | + intent.putExtra(DOB_EXTRA, profile.getDateOfBirth()); |
| 104 | + intent.putExtra(ADDRESS_EXTRA, profile.getPostalAddress()); |
| 105 | + intent.putExtra(MOBILE_EXTRA, profile.getMobNum()); |
| 106 | + intent.putExtra(GENDER_EXTRA, profile.getGender()); |
| 107 | + intent.putExtra(PROFILE_EXTRA, true); |
| 108 | + startActivity(intent); |
| 109 | + } catch (Exception e) { |
| 110 | + Intent intent = new Intent(this, MainActivity.class); |
| 111 | + intent.putExtra(BACKEND_DATA_ERROR_EXTRA, true); |
| 112 | + startActivity(intent); |
| 113 | + } |
106 | 114 |
|
107 | 115 | }
|
108 | 116 |
|
|
0 commit comments