From bedf79b8c0bc53bdecdfe7178c1ff48aff11acd0 Mon Sep 17 00:00:00 2001 From: Juan Docal <109512072+kp-juan-docal@users.noreply.github.com> Date: Tue, 5 Mar 2024 10:54:27 +0100 Subject: [PATCH] PIA-1478: Fix latencies not showing after logging in (#73) --- .../android/ui/loginpurchasing/LoginFragment.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/privateinternetaccess/android/ui/loginpurchasing/LoginFragment.java b/app/src/main/java/com/privateinternetaccess/android/ui/loginpurchasing/LoginFragment.java index 52ef60c..1b66654 100644 --- a/app/src/main/java/com/privateinternetaccess/android/ui/loginpurchasing/LoginFragment.java +++ b/app/src/main/java/com/privateinternetaccess/android/ui/loginpurchasing/LoginFragment.java @@ -44,6 +44,7 @@ import com.privateinternetaccess.android.PIAApplication; import com.privateinternetaccess.android.R; import com.privateinternetaccess.android.pia.PIAFactory; +import com.privateinternetaccess.android.pia.handlers.PIAServerHandler; import com.privateinternetaccess.android.pia.handlers.PiaPrefHandler; import com.privateinternetaccess.android.pia.interfaces.IAccount; import com.privateinternetaccess.android.pia.model.AmazonPurchaseData; @@ -271,7 +272,6 @@ public void startLogin() { handleLoginResponseStatus(context, requestResponseStatus); return null; } - account.accountInformation((accountInformation, accountResponseStatus) -> { if (accountResponseStatus != RequestResponseStatus.SUCCEEDED) { DLog.d(TAG, "Check account information unsuccessful " + accountResponseStatus); @@ -283,6 +283,7 @@ public void startLogin() { PiaPrefHandler.setUserIsLoggedIn(context, true); PiaPrefHandler.saveAccountInformation(context, accountInformation); PiaPrefHandler.clearPurchasingInfo(context); + updateListOfServersAndLatencies(); handleLoginResponseStatus(context, accountResponseStatus); return null; }); @@ -403,4 +404,13 @@ public void onMagicLinkClicked() { private LoginPurchaseActivity getLoginPurchaseActivity() { return ((LoginPurchaseActivity) getActivity()); } + + private void updateListOfServersAndLatencies() { + PIAServerHandler.getInstance(getContext()).triggerFetchServers(error -> { + if (error == null) { + PIAServerHandler.getInstance(getContext()).triggerLatenciesUpdate(); + } + return null; + }); + } } \ No newline at end of file