Booty Calls v1.2.156版本的 MD5 值为:919c7e4dc831ea1adbaf506a3cc1a198

以下内容为反编译后的 DmmGamesAndroidStoreUtil.java 源代码,内容仅作参考


package com.dmm.games.android.util.store;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;

public class DmmGamesAndroidStoreUtil {
    private static final String DMM_GAMES_STORE_ANNOUNCEMENT_ACTIVITY = "com.dmm.app.store.activity.AnnouncementListActivity";
    private static final String DMM_GAMES_STORE_AUTH_ACTIVITY_NAME = "com.dmm.app.store.auth.activity.DmmGameAutoAuthenticationActivity";
    private static final String DMM_GAMES_STORE_INSTALL_PAGE_URL_FORMAT = "https://www.dmm.%s/netgame/app/appstore/download.html";
    private static final String DMM_GAMES_STORE_KEY_IS_ADULT = "extrakeyIsAdult";
    private static final String DMM_GAMES_STORE_MAIN_ACTIVITY = "com.dmm.app.store.activity.MainActivity";
    private static final String DMM_GAMES_STORE_MY_GAME_ACTIVITY = "com.dmm.app.store.activity.MyAppActivity";
    private static final String DMM_GAMES_STORE_PACKAGE_NAME = "com.dmm.app.store";
    private static final String DOMAIN_ADULT = "co.jp";
    private static final String DOMAIN_GENERAL = "com";
    private static final String FORMAT_DOWNLOAD_URL_ON_STORE = "https://www.dmm.%s/app/-/appstore/download?action=detail&content_id=%s&is_digital=0";
    private static final String REQUEST_KEY_REFERER_USER_ON_RESULT = "loginActivityRefererUserOnResult";

    private static String getUrlDomain(boolean z) {
        return z ? DOMAIN_ADULT : DOMAIN_GENERAL;
    }

    private DmmGamesAndroidStoreUtil() {
    }

    public static boolean isGamesStoreInstalled(Context context) {
        if (context == null) {
            return false;
        }
        Iterator<ApplicationInfo> it = context.getPackageManager().getInstalledApplications(0).iterator();
        while (it.hasNext()) {
            if (DMM_GAMES_STORE_PACKAGE_NAME.equals(it.next().packageName)) {
                return true;
            }
        }
        return false;
    }

    public static Intent getGamesStoreInstallPageIntent(boolean z) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.setData(Uri.parse(String.format(DMM_GAMES_STORE_INSTALL_PAGE_URL_FORMAT, getUrlDomain(z))));
        return intent;
    }

    public static Intent getGamesStoreAuthIntent(Context context, Bundle bundle, boolean z) {
        if (!isGamesStoreInstalled(context)) {
            return getGamesStoreInstallPageIntent(z);
        }
        Intent intent = new Intent();
        intent.setClassName(DMM_GAMES_STORE_PACKAGE_NAME, DMM_GAMES_STORE_AUTH_ACTIVITY_NAME);
        intent.setAction("android.intent.action.SEND");
        intent.putExtra(REQUEST_KEY_REFERER_USER_ON_RESULT, true);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        return intent;
    }

    public static Intent getGamesStoreTopIntent(Context context, boolean z) {
        if (!isGamesStoreInstalled(context)) {
            return getGamesStoreInstallPageIntent(z);
        }
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(DMM_GAMES_STORE_PACKAGE_NAME, DMM_GAMES_STORE_MAIN_ACTIVITY));
        intent.putExtra(DMM_GAMES_STORE_KEY_IS_ADULT, z);
        return intent;
    }

    public static Intent getGamesStoreMyGameIntent(Context context, boolean z) {
        if (!isGamesStoreInstalled(context)) {
            return getGamesStoreInstallPageIntent(z);
        }
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(DMM_GAMES_STORE_PACKAGE_NAME, DMM_GAMES_STORE_MY_GAME_ACTIVITY));
        intent.putExtra(DMM_GAMES_STORE_KEY_IS_ADULT, z);
        return intent;
    }

    public static Intent getGamesStoreAnnouncementIntent(Context context, boolean z) {
        if (!isGamesStoreInstalled(context)) {
            return getGamesStoreInstallPageIntent(z);
        }
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(DMM_GAMES_STORE_PACKAGE_NAME, DMM_GAMES_STORE_ANNOUNCEMENT_ACTIVITY));
        intent.putExtra(DMM_GAMES_STORE_KEY_IS_ADULT, z);
        return intent;
    }

    public static Intent getGameDetailIntent(Context context, boolean z, String str) {
        if (!isGamesStoreInstalled(context)) {
            return getGamesStoreInstallPageIntent(z);
        }
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setData(Uri.parse(String.format(Locale.ENGLISH, FORMAT_DOWNLOAD_URL_ON_STORE, getUrlDomain(z), str)));
        return setGamesStoreComponent(context, intent);
    }

    private static Intent setGamesStoreComponent(Context context, Intent intent) {
        if (intent == null || context == null) {
            return null;
        }
        try {
            List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 0);
            if (queryIntentActivities == null) {
                return intent;
            }
            Iterator<ResolveInfo> it = queryIntentActivities.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                ResolveInfo next = it.next();
                if (next != null && next.activityInfo != null && DMM_GAMES_STORE_PACKAGE_NAME.equals(next.activityInfo.packageName) && (r1 = next.activityInfo.name) != null) {
                    break;
                }
            }
            return intent;
        } catch (Throwable th) {
            th.printStackTrace();
            return intent;
        }
    }
}