导航菜单

页面标题

页面副标题

Perplexity v2.48.1 - MapAttributionDelegateImpl.java 源代码

正在查看: Perplexity v2.48.1 应用的 MapAttributionDelegateImpl.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mapbox.maps.plugin;

import android.content.Context;
import android.net.Uri;
import bl.f;
import com.mapbox.common.MapboxOptions;
import com.mapbox.geojson.Point;
import com.mapbox.maps.CameraState;
import com.mapbox.maps.MapboxMap;
import com.mapbox.maps.Style;
import com.mapbox.maps.attribution.AttributionParser;
import com.mapbox.maps.module.MapTelemetry;
import com.mapbox.maps.plugin.attribution.Attribution;
import com.mapbox.maps.plugin.attribution.AttributionParserConfig;
import com.mapbox.maps.plugin.delegates.MapAttributionDelegate;
import com.revenuecat.purchases.common.diagnostics.DiagnosticsEntry;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0001\u0018\u0000 \u00112\u00020\u0001:\u0001\u0011B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u001e\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\r0\f2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000e\u001a\u00020\u000fH\u0016J\b\u0010\u0010\u001a\u00020\u0005H\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0012"}, d2 = {"Lcom/mapbox/maps/plugin/MapAttributionDelegateImpl;", "Lcom/mapbox/maps/plugin/delegates/MapAttributionDelegate;", "mapboxMap", "Lcom/mapbox/maps/MapboxMap;", "mapTelemetry", "Lcom/mapbox/maps/module/MapTelemetry;", "(Lcom/mapbox/maps/MapboxMap;Lcom/mapbox/maps/module/MapTelemetry;)V", "buildMapBoxFeedbackUrl", "", "context", "Landroid/content/Context;", "parseAttributions", "", "Lcom/mapbox/maps/plugin/attribution/Attribution;", "config", "Lcom/mapbox/maps/plugin/attribution/AttributionParserConfig;", "telemetry", "Companion", "sdk_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public final class MapAttributionDelegateImpl implements MapAttributionDelegate {
    private static final String MAP_FEEDBACK_STYLE_URI_REGEX = "^(.*://[^:^/]*)/(.*)/(.*)";
    private static final String MAP_FEEDBACK_URL = "https://apps.mapbox.com/feedback";
    private final MapTelemetry mapTelemetry;
    private final MapboxMap mapboxMap;

    public MapAttributionDelegateImpl(MapboxMap mapboxMap, MapTelemetry mapTelemetry) {
        Intrinsics.h(mapboxMap, "mapboxMap");
        Intrinsics.h(mapTelemetry, "mapTelemetry");
        this.mapboxMap = mapboxMap;
        this.mapTelemetry = mapTelemetry;
    }

    @Override
    public String buildMapBoxFeedbackUrl(Context context) {
        Intrinsics.h(context, "context");
        Uri.Builder buildUpon = Uri.parse(MAP_FEEDBACK_URL).buildUpon();
        CameraState cameraState = this.mapboxMap.getCameraState();
        Point center = cameraState.getCenter();
        buildUpon.encodedFragment("/" + center.longitude() + '/' + center.latitude() + '/' + cameraState.getZoom() + '/' + cameraState.getBearing() + '/' + cameraState.getPitch());
        String packageName = context.getApplicationContext().getPackageName();
        if (packageName != null) {
            buildUpon.appendQueryParameter("referrer", packageName);
        }
        buildUpon.appendQueryParameter("access_token", MapboxOptions.getAccessToken());
        Style styleDeprecated = this.mapboxMap.getStyleDeprecated();
        if (styleDeprecated != null) {
            Pattern compile = Pattern.compile(MAP_FEEDBACK_STYLE_URI_REGEX);
            Intrinsics.g(compile, "compile(MAP_FEEDBACK_STYLE_URI_REGEX)");
            Matcher matcher = compile.matcher(styleDeprecated.getStyleURI());
            Intrinsics.g(matcher, "pattern.matcher(it.styleURI)");
            if (matcher.find()) {
                buildUpon.appendQueryParameter("owner", matcher.group(2)).appendQueryParameter(DiagnosticsEntry.ID_KEY, matcher.group(3));
            }
        }
        String uri = buildUpon.build().toString();
        Intrinsics.g(uri, "builder.build().toString()");
        return uri;
    }

    @Override
    public List<Attribution> parseAttributions(Context context, AttributionParserConfig config) {
        Intrinsics.h(context, "context");
        Intrinsics.h(config, "config");
        Object[] array = this.mapboxMap.getAttributions().toArray(new String[0]);
        Intrinsics.f(array, "null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
        String[] strArr = (String[]) array;
        return f.n1(new AttributionParser.Options(context).withCopyrightSign(config.getWithCopyrightSign()).withImproveMap(config.getWithImproveMap()).withTelemetryAttribution(config.getWithTelemetryAttribution()).withMapboxAttribution(config.getWithMapboxAttribution()).withMapboxPrivacyPolicy(config.getWithMapboxPrivacyPolicy()).withAttributionData((String[]) Arrays.copyOf(strArr, strArr.length)).build().getAttributions());
    }

    @Override
    public MapTelemetry getMapTelemetry() {
        return this.mapTelemetry;
    }
}