导航菜单

页面标题

页面副标题

BAM Crawford v6.14.1 - AppHandler.java 源代码

正在查看: BAM Crawford v6.14.1 应用的 AppHandler.java JAVA 源代码文件

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


package com.subsplash.thechurchapp.handlers.app;

import android.content.Context;
import android.widget.Toast;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.subsplash.thechurchapp.MainActivity;
import com.subsplash.thechurchapp.TheChurchApp;
import com.subsplash.thechurchapp.api.h;
import com.subsplash.thechurchapp.dataObjects.DisplayOptions;
import com.subsplash.thechurchapp.dataObjects.ImageSet;
import com.subsplash.thechurchapp.handlers.common.NavigationHandler;
import com.subsplash.thechurchapp.handlers.common.NavigationItemStates;
import com.subsplash.thechurchapp.handlers.common.f;
import com.subsplash.thechurchapp.handlers.common.i;
import com.subsplash.util.ApplicationInstance;
import com.subsplash.util.PushUtil;
import com.subsplash.util.h0;
import com.subsplash.widgets.showcase.PromptHandler;
import com.subsplash.widgets.showcase.ShowcaseContentHandler;
import java.util.ArrayList;
import java.util.Locale;

public class AppHandler extends NavigationHandler {
    public static final String COMMAND_ENABLE_LOCATION = "enableLocation";
    public static final String COMMAND_ENABLE_PUSH_NOTIFICATIONS = "enablePushNotifications";
    public static final String COMMAND_UNREGISTER_PUSH_NOTIFICATIONS = "unregisterPushNotifications";
    private static final String TAG = "AppHandler";

    @SerializedName("appkey")
    @Expose
    public String appKey;
    public String pushTokenUrl;

    @Expose
    public NavigationItemStates states;

    public AppHandler() {
        this.appKey = null;
        this.type = f.App;
        this.handlerName = "app";
    }

    public void dispatchPromptForPushNotification() {
        ShowcaseContentHandler showcaseContentHandler = new ShowcaseContentHandler();
        showcaseContentHandler.title = "Don't miss anything";
        showcaseContentHandler.body = String.format("Enable notifications to receive updates from %s", getTitle());
        ArrayList<i> arrayList = new ArrayList<>();
        i iVar = new i();
        iVar.title = "Turn on notifications";
        AppHandler appHandler = new AppHandler();
        appHandler.appKey = this.appKey;
        appHandler.command = COMMAND_ENABLE_PUSH_NOTIFICATIONS;
        iVar.setNavigationHandler(appHandler);
        i iVar2 = new i();
        iVar2.title = "Not now";
        arrayList.add(iVar);
        arrayList.add(iVar2);
        showcaseContentHandler.items = arrayList;
        ImageSet imageSet = new ImageSet();
        ImageSet.ImageSpec imageSpec = new ImageSet.ImageSpec();
        int i = (int) (TheChurchApp.n().getResources().getDisplayMetrics().density * 89.0f);
        imageSpec.url = h0.o(TAG, String.format(Locale.US, "https://artwork.subsplash.com/images/cdn/%s/%d/%d/ios/circle.png", this.appKey, Integer.valueOf(i), Integer.valueOf(i)));
        imageSpec.width = i;
        imageSpec.height = i;
        imageSet.add(imageSpec);
        showcaseContentHandler.images = imageSet;
        showcaseContentHandler.displayOptions = getDisplayOptions();
        new PromptHandler(showcaseContentHandler).navigate(TheChurchApp.x());
    }

    public DisplayOptions getDisplayOptions() {
        return null;
    }

    public String getPushTokenUrl() {
        return this.pushTokenUrl;
    }

    @Override
    public boolean hasData() {
        return true;
    }

    public boolean isLaunchedFromNetworkApp() {
        return false;
    }

    @Override
    public void navigate(Context context, int i, int i2) {
        if (COMMAND_ENABLE_LOCATION.equals(this.command)) {
            TheChurchApp.k("android.permission.ACCESS_FINE_LOCATION");
            return;
        }
        if (COMMAND_ENABLE_PUSH_NOTIFICATIONS.equals(this.command)) {
            String str = this.appKey;
            if (str != null && ApplicationInstance.hasInstanceForKey(str) && ApplicationInstance.getInstance(this.appKey).supportsPushNotifications()) {
                PushUtil.n(ApplicationInstance.getInstance(this.appKey));
                return;
            }
            return;
        }
        if (COMMAND_UNREGISTER_PUSH_NOTIFICATIONS.equals(this.command)) {
            if (this.appKey != null) {
                PushUtil.u(this);
                Toast.makeText(context, "Unregistered Push Notifications", 0).show();
                return;
            }
            return;
        }
        String str2 = this.appKey;
        if (str2 != null) {
            if (str2.equalsIgnoreCase(ApplicationInstance.getCurrentInstance().getAppKey())) {
                NavigationHandler.navigate("home", (String) null, TheChurchApp.n());
                return;
            }
            String upperCase = this.appKey.toUpperCase();
            this.appKey = upperCase;
            MainActivity.A0(upperCase, context, 268468224);
        }
    }

    public void setPushTokenUrl(String str) {
        this.pushTokenUrl = str;
    }

    public boolean supportsPushNotifications() {
        return (h.w().booleanValue() || isLaunchedFromNetworkApp() || getPushTokenUrl() == null || !com.subsplash.util.i.c(TheChurchApp.n())) ? false : true;
    }

    public AppHandler(String str) {
        this.appKey = null;
        this.type = f.App;
        this.handlerName = "app";
        this.appKey = str;
    }
}