@Background void getUserProfileInfo(String userID) { ProfileDataResponseEntity userProfile = restClient.getUserPublicProfile( userID, CommonUtils.getDeviceID(getContext()), prefs.bookfusionAccessToken().get()); doneGetUserProfile(userProfile); }
@Background void sendDislikeRequest() { restClient.removeLikeFromActivity( item.getId(), new BaseRequestEntity( CommonUtils.getDeviceID(getContext()), prefs.bookfusionAccessToken().get())); setDislikeBadgeToActivity(); }
@Background void sendAuthRequest(SingupRequestEntity requestEntity) { try { TokenResponseEntity response = restClient.authSignupUser(requestEntity); if (response == null) { showErrorNotification("sign up fail"); return; } Log.w(TAG, "token: " + response.getToken()); prefs.edit().bookfusionAccessToken().put(response.getToken()).apply(); ProfileDataResponseEntity profile = restClient.getProfileData( CommonUtils.getDeviceID(getActivity()), prefs.bookfusionAccessToken().get()); prefs.edit().currentUserId().put(profile.getId()).apply(); showSignInNotification(); } catch (RestClientException clientException) { HttpStatus status = null; if (clientException instanceof HttpClientErrorException) { status = ((HttpClientErrorException) clientException).getStatusCode(); } else if (clientException instanceof HttpServerErrorException) { status = ((HttpServerErrorException) clientException).getStatusCode(); } String errorMessage; if (status != null) { errorMessage = HttpUtils.getHttpErrorMessage(status.toString()); } else { errorMessage = "Error happened, try again please"; } showErrorNotification(errorMessage); Log.e(TAG, "Error happened: " + clientException.getMessage()); } }