File tree Expand file tree Collapse file tree 3 files changed +10
-29
lines changed
testapps/testapp/src/main/java/com/microsoft/identity/client/testapp Expand file tree Collapse file tree 3 files changed +10
-29
lines changed Original file line number Diff line number Diff line change 2525import com .microsoft .identity .client .exception .MsalException ;
2626import com .microsoft .identity .client .exception .MsalServiceException ;
2727import com .microsoft .identity .client .exception .MsalUiRequiredException ;
28+ import com .microsoft .identity .common .internal .ui .browser .AndroidBrowserSelector ;
29+ import com .microsoft .identity .common .java .browser .Browser ;
2830import com .microsoft .identity .common .java .exception .BaseException ;
2931import com .microsoft .identity .common .java .ui .PreferredAuthMethod ;
3032import com .microsoft .identity .common .java .util .StringUtil ;
@@ -68,7 +70,14 @@ public void onError(MsalException exception) {
6870 });
6971 }
7072
71- public abstract String getDefaultBrowser ();
73+ public String getDefaultBrowser () {
74+ final Browser browser =
75+ new AndroidBrowserSelector (getApp ().getConfiguration ().getAppContext ()).selectBrowser (
76+ getApp ().getConfiguration ().getBrowserSafeList (),
77+ getApp ().getConfiguration ().getPreferredBrowser ()
78+ );
79+ return browser == null ? "Unknown" : browser .getPackageName ();
80+ }
7281
7382 public abstract String getMode ();
7483
Original file line number Diff line number Diff line change 3535import com .microsoft .identity .client .PoPAuthenticationScheme ;
3636import com .microsoft .identity .client .PublicClientApplication ;
3737import com .microsoft .identity .client .claims .ClaimsRequest ;
38- import com .microsoft .identity .client .exception .MsalClientException ;
3938import com .microsoft .identity .client .exception .MsalException ;
40- import com .microsoft .identity .common .internal .ui .browser .BrowserSelector ;
41- import com .microsoft .identity .common .java .exception .ClientException ;
4239
4340import java .util .List ;
4441
@@ -62,17 +59,6 @@ public IPublicClientApplication getApp() {
6259 return mApp ;
6360 }
6461
65- @ Override
66- public String getDefaultBrowser () {
67- try {
68- return BrowserSelector .select (mApp .getConfiguration ().getAppContext (),
69- mApp .getConfiguration ().getBrowserSafeList (),
70- mApp .getConfiguration ().getPreferredBrowser ()).getPackageName ();
71- } catch (ClientException e ) {
72- return "Unknown" ;
73- }
74- }
75-
7662 @ Override
7763 public void loadAccounts (@ NonNull final INotifyOperationResultCallback <List <IAccount >> callback ) {
7864 mApp .getAccounts (new IPublicClientApplication .LoadAccountsCallback () {
Original file line number Diff line number Diff line change 3535import com .microsoft .identity .client .PoPAuthenticationScheme ;
3636import com .microsoft .identity .client .PublicClientApplication ;
3737import com .microsoft .identity .client .claims .ClaimsRequest ;
38- import com .microsoft .identity .client .exception .MsalClientException ;
3938import com .microsoft .identity .client .exception .MsalException ;
40- import com .microsoft .identity .common .internal .ui .browser .BrowserSelector ;
41- import com .microsoft .identity .common .java .exception .ClientException ;
4239
4340import java .util .ArrayList ;
4441import java .util .List ;
@@ -65,17 +62,6 @@ public IPublicClientApplication getApp() {
6562 return mApp ;
6663 }
6764
68- @ Override
69- public String getDefaultBrowser () {
70- try {
71- return BrowserSelector .select (mApp .getConfiguration ().getAppContext (),
72- mApp .getConfiguration ().getBrowserSafeList (),
73- mApp .getConfiguration ().getPreferredBrowser ()).getPackageName ();
74- } catch (ClientException e ) {
75- return "Unknown" ;
76- }
77- }
78-
7965 @ Override
8066 public void loadAccounts (final @ NonNull INotifyOperationResultCallback <List <IAccount >> callback ) {
8167 mApp .getCurrentAccountAsync (new ISingleAccountPublicClientApplication .CurrentAccountCallback () {
You can’t perform that action at this time.
0 commit comments