113 |
Store Flavor
114 |
Play Store fallback flavor - redirects to Play Store if Spotify app unavailable
115 |
View Store Javadoc →
116 |
117 |
118 |
121 |
122 |
123 | EOF
124 |
125 | - name: Deploy to GitHub Pages
126 | uses: peaceiris/actions-gh-pages@v3
127 | with:
128 | github_token: ${{ secrets.GITHUB_TOKEN }}
129 | publish_dir: ./gh-pages-temp
130 | publish_branch: gh-pages
131 | user_name: 'github-actions[bot]'
132 | user_email: 'github-actions[bot]@users.noreply.github.com'
133 | commit_message: 'Update javadoc from ${{ github.sha }}'
134 |
--------------------------------------------------------------------------------
/auth-lib/src/auth/java/com/spotify/sdk/android/auth/browser/CustomTabsSupportChecker.java:
--------------------------------------------------------------------------------
1 | package com.spotify.sdk.android.auth.browser;
2 |
3 | import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION;
4 |
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.pm.PackageManager;
8 | import android.content.pm.ResolveInfo;
9 | import android.net.Uri;
10 | import android.text.TextUtils;
11 | import android.util.Log;
12 |
13 | import com.spotify.sdk.android.auth.AuthorizationRequest;
14 |
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | /**
19 | * Class that checks if auth can be done in a Custom Tab and returns a package name of the app
20 | * that supports Custom Tabs. If auth flow cannot be done using a Custom Tab, it returns
21 | * an empty string.
22 | */
23 | public final class CustomTabsSupportChecker {
24 | private static final String TAG = CustomTabsSupportChecker.class.getSimpleName();
25 |
26 | static String getPackageSupportingCustomTabs(Context context, AuthorizationRequest request) {
27 | String redirectUri = request.getRedirectUri();
28 | final String packageSupportingCustomTabs = getPackageNameSupportingCustomTabs(
29 | context.getPackageManager(), request.toUri()
30 | );
31 | // CustomTabs seems to have problem with redirecting back the app after auth when URI has http/https scheme
32 | if (!redirectUri.startsWith("http") && !redirectUri.startsWith("https") &&
33 | hasBrowserSupportForCustomTabs(packageSupportingCustomTabs) &&
34 | hasRedirectUriActivity(context.getPackageManager(), redirectUri)) {
35 | return packageSupportingCustomTabs;
36 | } else {
37 | return "";
38 | }
39 | }
40 |
41 | private static String getPackageNameSupportingCustomTabs(PackageManager pm, Uri uri) {
42 | Intent activityIntent = new Intent(Intent.ACTION_VIEW, uri).addCategory(Intent.CATEGORY_BROWSABLE);
43 | // Check for default handler
44 | ResolveInfo defaultViewHandlerInfo = pm.resolveActivity(activityIntent, 0);
45 | String defaultViewHandlerPackageName = null;
46 | if (defaultViewHandlerInfo != null) {
47 | defaultViewHandlerPackageName = defaultViewHandlerInfo.activityInfo.packageName;
48 | }
49 | Log.d(TAG, "Found default package name for handling VIEW intents: " + defaultViewHandlerPackageName);
50 |
51 | // Get all apps that can handle the intent
52 | List