/** * Parses serialized Intents from the query string of the given URI, assuming the parameter key of * DepedencyManagerContract.QUERY_PARAM_INTENT. Returns null if no intents are found in the Uri. */ public static List<Intent> parseIntents(Uri uri) { List<String> values = uri.getQueryParameters(DependencyManagerContract.QUERY_PARAM_INTENT); if (null == values) { return null; } LinkedList<Intent> results = new LinkedList<Intent>(); for (String v : values) { try { results.add(Intent.parseUri(v, Intent.URI_INTENT_SCHEME)); } catch (java.net.URISyntaxException ex) { // pass } } if (0 >= results.size()) { return null; } return results; }
static Set<BarcodeFormat> parseDecodeFormats(Uri inputUri) { List<String> formats = inputUri.getQueryParameters(QRcodeIntents.Scan.FORMATS); if (formats != null && formats.size() == 1 && formats.get(0) != null) { formats = Arrays.asList(COMMA_PATTERN.split(formats.get(0))); } return parseDecodeFormats(formats, inputUri.getQueryParameter(QRcodeIntents.Scan.MODE)); }
public static dvn a(Uri paramUri) { Object localObject = paramUri.getPathSegments(); String str = (String) ((List) localObject).get(0); List localList = paramUri.getQueryParameters("contentType"); long l1 = Long.parseLong((String) ((List) localObject).get(2)); long l2 = Long.parseLong((String) ((List) localObject).get(3)); if (((List) localObject).size() >= 5) { localObject = (String) ((List) localObject).get(4); if (!((String) localObject).equals("empty")) { break label139; } dri.e( Attachment.a, "Parsed message attachment uri with partId = \"empty\"", new Object[] {paramUri}); } label139: for (; ; ) { return new dvn( str, l1, Long.parseLong(paramUri.getQueryParameter("serverMessageId")), l2, (String) localObject, localList); localObject = null; } }
@Override protected void performAction( @NonNull final Context context, @NonNull final Uri uri, @NonNull final UrlHandler urlHandler) throws IntentNotResolvableException { // 1. Parse the URL as a valid deeplink+ if (!"navigate".equalsIgnoreCase(uri.getHost())) { throw new IntentNotResolvableException( "Deeplink+ URL did not have 'navigate' as" + " the host."); } final String primaryUrl; final List<String> primaryTrackingUrls; final String fallbackUrl; final List<String> fallbackTrackingUrls; try { primaryUrl = uri.getQueryParameter("primaryUrl"); primaryTrackingUrls = uri.getQueryParameters("primaryTrackingUrl"); fallbackUrl = uri.getQueryParameter("fallbackUrl"); fallbackTrackingUrls = uri.getQueryParameters("fallbackTrackingUrl"); } catch (UnsupportedOperationException e) { // If the URL is not hierarchical, getQueryParameter[s] will throw // UnsupportedOperationException (see // http://developer.android.com/reference/android/net/Uri.html#getQueryParameter(java.lang.String) throw new IntentNotResolvableException("Deeplink+ URL was not a hierarchical" + " URI."); } if (primaryUrl == null) { throw new IntentNotResolvableException( "Deeplink+ did not have 'primaryUrl' query" + " param."); } final Uri primaryUri = Uri.parse(primaryUrl); if (shouldTryHandlingUrl(primaryUri)) { // Nested Deeplink+ URLs are not allowed throw new IntentNotResolvableException( "Deeplink+ had another Deeplink+ as the " + "'primaryUrl'."); } // 2. Attempt to handle the primary URL try { Intents.launchApplicationUrl(context, primaryUri); makeTrackingHttpRequest(primaryTrackingUrls, context, BaseEvent.Name.CLICK_REQUEST); return; } catch (IntentNotResolvableException e) { // Primary URL failed; proceed to attempt fallback URL } // 3. Attempt to handle the fallback URL if (fallbackUrl == null) { throw new IntentNotResolvableException( "Unable to handle 'primaryUrl' for " + "Deeplink+ and 'fallbackUrl' was missing."); } if (shouldTryHandlingUrl(Uri.parse(fallbackUrl))) { // Nested Deeplink+ URLs are not allowed throw new IntentNotResolvableException( "Deeplink+ URL had another Deeplink+ " + "URL as the 'fallbackUrl'."); } // UrlAction.handleUrl already verified this comes from a user interaction final boolean fromUserInteraction = true; urlHandler.handleUrl(context, fallbackUrl, true, fallbackTrackingUrls); }