Heroes III HD v1.1.6版本的 MD5 值为:99ed52e2d6b85487933b8dc8c0440b36
以下内容为反编译后的 GameHelper.java 源代码,内容仅作参考
package com.dotemu.homm3.social;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import com.google.android.gms.appstate.AppStateManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Drive;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.GamesActivityResultCodes;
import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch;
import com.google.android.gms.games.request.GameRequest;
import com.google.android.gms.plus.Plus;
import java.util.ArrayList;
import obfuse.NPStringFog;
public class GameHelper implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
public static final int CLIENT_ALL = 15;
public static final int CLIENT_APPSTATE = 4;
public static final int CLIENT_GAMES = 1;
public static final int CLIENT_NONE = 0;
public static final int CLIENT_PLUS = 2;
public static final int CLIENT_SNAPSHOT = 8;
static final int DEFAULT_MAX_SIGN_IN_ATTEMPTS = 3;
static final int RC_RESOLVE = 9001;
static final int RC_UNUSED = 9002;
static final String TAG = "GameHelper";
Activity mActivity;
Context mAppContext;
Invitation mInvitation;
int mRequestedClients;
ArrayList<GameRequest> mRequests;
TurnBasedMatch mTurnBasedMatch;
private boolean mSetupDone = false;
private boolean mConnecting = false;
boolean mExpectingResolution = false;
boolean mSignInCancelled = false;
GoogleApiClient.Builder mGoogleApiClientBuilder = null;
Games.GamesOptions mGamesApiOptions = Games.GamesOptions.builder().build();
Plus.PlusOptions mPlusApiOptions = null;
Api.ApiOptions.NoOptions mAppStateApiOptions = null;
GoogleApiClient mGoogleApiClient = null;
boolean mConnectOnStart = true;
boolean mUserInitiatedSignIn = false;
ConnectionResult mConnectionResult = null;
SignInFailureReason mSignInFailureReason = null;
boolean mShowErrorDialogs = true;
boolean mDebugLog = false;
GameHelperListener mListener = null;
int mMaxAutoSignInAttempts = 3;
private final String GAMEHELPER_SHARED_PREFS = NPStringFog.decode("2931202426242B35373C2F3E292F3322212D3E2228273D");
private final String KEY_SIGN_IN_CANCELLATIONS = NPStringFog.decode("2535343E3D28202B2D273E32222F2F24203E22313928212F34");
private final String KEY_SIGN_OUT_REQUESTED = NPStringFog.decode("2535343E3D28202B2D2125393E3C243630373D242825");
Handler mHandler = new Handler();
public interface GameHelperListener {
void onSignInFailed();
void onSignInSucceeded();
}
public GameHelper(Activity activity, int clientsToUse) {
this.mActivity = null;
this.mAppContext = null;
this.mRequestedClients = 0;
this.mActivity = activity;
this.mAppContext = activity.getApplicationContext();
this.mRequestedClients = clientsToUse;
}
public void setMaxAutoSignInAttempts(int max) {
this.mMaxAutoSignInAttempts = max;
}
void assertConfigured(String operation) {
if (!this.mSetupDone) {
String error = NPStringFog.decode("2911000426040B15171C5008131C0E155F52210008130F150E0A1C4E1119150B0C1711170A501A081A090810064E0308151B115D45") + operation + NPStringFog.decode("405039090B411400061B0045484E0C02111A01144D0C1B121345100B500E00020D0201520C150B0E1C044704061A1500111A080902520F1E144101150F00004E1F1D041C00130C1D005E");
logError(error);
throw new IllegalStateException(error);
}
}
private void doApiOptionsPreCheck() {
if (this.mGoogleApiClientBuilder != null) {
String error = NPStringFog.decode("2911000426040B15171C4A4D180114470613001E02154E0206091E4E0308154420170C3D1E04040E00124704141A151F411A090245110219080F1A4105101B021408134E090616520C15080F4E021500131A15094F4E2206091E4E1919410C04010A000B500E00020D0E0B154E131F040F15022402073301080B0F132707071C09041C494E451D1C501E041A14174D5B40");
logError(error);
throw new IllegalStateException(error);
}
}
public void setGamesApiOptions(Games.GamesOptions options) {
doApiOptionsPreCheck();
this.mGamesApiOptions = options;
}
public void setAppStateApiOptions(Api.ApiOptions.NoOptions options) {
doApiOptionsPreCheck();
this.mAppStateApiOptions = options;
}
public void setPlusApiOptions(Plus.PlusOptions options) {
doApiOptionsPreCheck();
this.mPlusApiOptions = options;
}
public GoogleApiClient.Builder createApiClientBuilder() {
if (this.mSetupDone) {
String error = NPStringFog.decode("2911000426040B15171C4A4D180114470613021C08054E26060817261501110B134906000B1119042F110E261E071503152C140E09160B0245484E000111171C500E00020D0E0B154E0308151B1149452B01054D020F0F470A1C02094D060B154704520D1C04040015470707071C09041C41252034212228411E0415031D1C1D040F09411400061B0043");
logError(error);
throw new IllegalStateException(error);
}
GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this.mActivity, this, this);
if ((this.mRequestedClients & 1) != 0) {
builder.addApi(Games.API, this.mGamesApiOptions);
builder.addScope(Games.SCOPE_GAMES);
}
if ((this.mRequestedClients & 2) != 0) {
builder.addApi(Plus.API);
builder.addScope(Plus.SCOPE_PLUS_LOGIN);
}
if ((this.mRequestedClients & 4) != 0) {
builder.addApi(AppStateManager.API);
builder.addScope(AppStateManager.SCOPE_APP_STATE);
}
if ((this.mRequestedClients & 8) != 0) {
builder.addScope(Drive.SCOPE_APPFOLDER);
builder.addApi(Drive.API);
}
this.mGoogleApiClientBuilder = builder;
return builder;
}
public void setup(GameHelperListener listener) {
if (this.mSetupDone) {
String error = NPStringFog.decode("2911000426040B15171C4A4D180114470613001E02154E0206091E4E370C0C0B290209020B0243120B1512155A4750000E1C0447111A0F1E4D0E00020244");
logError(error);
throw new IllegalStateException(error);
}
this.mListener = listener;
debugLog(NPStringFog.decode("3D1519141E5B4717171F0508121A040345110219080F1A125D45") + this.mRequestedClients);
if (this.mGoogleApiClientBuilder == null) {
createApiClientBuilder();
}
this.mGoogleApiClient = this.mGoogleApiClientBuilder.build();
this.mGoogleApiClientBuilder = null;
this.mSetupDone = true;
}
public GoogleApiClient getApiClient() {
if (this.mGoogleApiClient == null) {
throw new IllegalStateException(NPStringFog.decode("201F4D26010E0009172F0004220208020B06405029080A411E0A074E130C0D02411400061B00454851"));
}
return this.mGoogleApiClient;
}
public boolean isSignedIn() {
return this.mGoogleApiClient != null && this.mGoogleApiClient.isConnected();
}
public boolean isConnecting() {
return this.mConnecting;
}
public boolean hasSignInError() {
return this.mSignInFailureReason != null;
}
public SignInFailureReason getSignInError() {
return this.mSignInFailureReason;
}
public void setShowErrorDialogs(boolean show) {
this.mShowErrorDialogs = show;
}
public void onStart(Activity act) {
this.mActivity = act;
this.mAppContext = act.getApplicationContext();
debugLog(NPStringFog.decode("011E3E150F1313"));
assertConfigured(NPStringFog.decode("011E3E150F1313"));
if (this.mConnectOnStart) {
if (this.mGoogleApiClient.isConnected()) {
Log.w(NPStringFog.decode("2911000426040B15171C"), "GameHelper: client was already connected on onStart()");
return;
}
debugLog(NPStringFog.decode("2D1F030F0B02130C1C09500E0D070409115C"));
this.mConnecting = true;
this.mGoogleApiClient.connect();
return;
}
debugLog(NPStringFog.decode("201F19410F1513001F1E04040F0941130A520D1F030F0B021345100B130C120B410A261D001E08021A2E0936060F02195C08000B1617"));
debugLog(NPStringFog.decode("271E1E150B000349521C151D0E1C150E0B154E114D12070609481B00500B00070D12171740"));
this.mHandler.postDelayed(new Runnable() {
@Override
public void run() {
GameHelper.this.notifyListener(false);
}
}, 1000L);
}
public void onStop() {
debugLog(NPStringFog.decode("011E3E150111"));
assertConfigured(NPStringFog.decode("011E3E150111"));
if (this.mGoogleApiClient.isConnected()) {
debugLog(NPStringFog.decode("2A191E02010F0900111A1903064E020B0C1700044D051B0447111D4E1F03321A0E17"));
this.mGoogleApiClient.disconnect();
} else {
debugLog(NPStringFog.decode("2D1C0404001547041E1C150C051741030C010D1F030F0B021300164E0705040041100052091F1941010F34111D1E5E"));
}
this.mConnecting = false;
this.mExpectingResolution = false;
}
public String getInvitationId() {
if (!this.mGoogleApiClient.isConnected()) {
Log.w(NPStringFog.decode("2911000426040B15171C"), "Warning: getInvitationId() should only be called when signed in, that is, after getting onSignInSuceeded()");
}
if (this.mInvitation == null) {
return null;
}
return this.mInvitation.getInvitationId();
}
public Invitation getInvitation() {
if (!this.mGoogleApiClient.isConnected()) {
Log.w(NPStringFog.decode("2911000426040B15171C"), "Warning: getInvitation() should only be called when signed in, that is, after getting onSignInSuceeded()");
}
return this.mInvitation;
}
public boolean hasInvitation() {
return this.mInvitation != null;
}
public boolean hasTurnBasedMatch() {
return this.mTurnBasedMatch != null;
}
public boolean hasRequests() {
return this.mRequests != null;
}
public void clearInvitation() {
this.mInvitation = null;
}
public void clearTurnBasedMatch() {
this.mTurnBasedMatch = null;
}
public void clearRequests() {
this.mRequests = null;
}
public TurnBasedMatch getTurnBasedMatch() {
if (!this.mGoogleApiClient.isConnected()) {
Log.w(NPStringFog.decode("2911000426040B15171C"), "Warning: getTurnBasedMatch() should only be called when signed in, that is, after getting onSignInSuceeded()");
}
return this.mTurnBasedMatch;
}
public ArrayList<GameRequest> getRequests() {
if (!this.mGoogleApiClient.isConnected()) {
Log.w(NPStringFog.decode("2911000426040B15171C"), "Warning: getRequests() should only be called when signed in, that is, after getting onSignInSuceeded()");
}
return this.mRequests;
}
public void enableDebugLog(boolean enabled) {
this.mDebugLog = enabled;
if (enabled) {
debugLog(NPStringFog.decode("2A150F1409410B0A154E1503000C0D02015C"));
}
}
@Deprecated
public void enableDebugLog(boolean enabled, String tag) {
Log.w(NPStringFog.decode("2911000426040B15171C"), "GameHelper.enableDebugLog(boolean,String) is deprecated. Use GameHelper.enableDebugLog(boolean)");
enableDebugLog(enabled);
}
public void signOut() {
if (!this.mGoogleApiClient.isConnected()) {
debugLog(NPStringFog.decode("1D190A0F2114135F5219111E410F0D1500130A094D050712040A1C00150E150B054B451B091E0213070F004B"));
return;
}
if ((this.mRequestedClients & 2) != 0) {
debugLog(NPStringFog.decode("2D1C08001C080902520A150B001B0D1345130D1302140015470A1C4E2001141D220B0C17000443"));
Plus.AccountApi.clearDefaultAccount(this.mGoogleApiClient);
}
if ((this.mRequestedClients & 1) != 0) {
debugLog(NPStringFog.decode("3D190A0F070F00451D1B044D071C0E0A450606154D26010E0009174E313D284E220B0C17000443"));
Games.signOut(this.mGoogleApiClient);
}
debugLog(NPStringFog.decode("2A191E02010F0900111A1903064E020B0C17000443"));
this.mConnectOnStart = false;
this.mConnecting = false;
this.mGoogleApiClient.disconnect();
}
public boolean isSignedOut() {
SharedPreferences sp = this.mAppContext.getSharedPreferences(NPStringFog.decode("2931202426242B35373C2F3E292F3322212D3E2228273D"), 0);
return sp.getBoolean(NPStringFog.decode("2535343E3D28202B2D2125393E3C243630373D242825"), false);
}
private void signedOut(boolean value) {
SharedPreferences sp = this.mAppContext.getSharedPreferences(NPStringFog.decode("2931202426242B35373C2F3E292F3322212D3E2228273D"), 0);
SharedPreferences.Editor spe = sp.edit();
spe.putBoolean(NPStringFog.decode("2535343E3D28202B2D2125393E3C243630373D242825"), value);
spe.commit();
}
public void onActivityResult(int requestCode, int responseCode, Intent intent) {
debugLog(NPStringFog.decode("011E2C021A08110C06172208121B0D135F521C151C5C") + (requestCode == RC_RESOLVE ? NPStringFog.decode("3C3332332B322829242B") : String.valueOf(requestCode)) + NPStringFog.decode("42501F041D115A") + GameHelperUtils.activityResponseCodeToString(responseCode));
switch (responseCode) {
case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
onStop();
signedOut(true);
return;
default:
signedOut(false);
if (requestCode != RC_RESOLVE) {
debugLog(NPStringFog.decode("011E2C021A08110C06172208121B0D135F521C151C140B1213451101140841000E13451F0B1103154E070817521B0343412706090A00071E0A4F"));
return;
}
this.mExpectingResolution = false;
if (!this.mConnecting) {
debugLog(NPStringFog.decode("011E2C021A08110C06172208121B0D135F520717030E1C080902520C150E001B120245050B500C130B41090A064E13020F000404111B001743"));
return;
} else if (responseCode == -1) {
debugLog(NPStringFog.decode("011E2C335441350001011C1815070E0945050F034D332B32322926313F264D4E12084511011E03040D150E0B154E1318131C040911520D1C040400154704150F19034F"));
connect();
return;
} else if (responseCode == 10001) {
debugLog(NPStringFog.decode("011E2C335441350001011C1815070E0945050F034D332B22282B3C2B33393E3C2436303B3C35294D4E120845000B13020F000404111B001743"));
connect();
return;
} else if (responseCode == 0) {
debugLog(NPStringFog.decode("011E2C335441200A064E114D020F0F04001E02111908010F4717171D0501154241140A520A191E02010F0900111A19030640"));
this.mSignInCancelled = true;
this.mConnectOnStart = false;
this.mUserInitiatedSignIn = false;
this.mSignInFailureReason = null;
this.mConnecting = false;
this.mGoogleApiClient.disconnect();
int prevCancellations = getSignInCancellations();
int newCancellations = incrementSignInCancellations();
debugLog(NPStringFog.decode("011E2C33544144451D08500E00000202091E0F04040E001247") + prevCancellations + NPStringFog.decode("4E5D405F4E") + newCancellations + NPStringFog.decode("425000001641") + this.mMaxAutoSignInAttempts);
notifyListener(false);
return;
} else {
debugLog(NPStringFog.decode("011E2C3354411500011E1F03120B2208011753") + GameHelperUtils.activityResponseCodeToString(responseCode) + NPStringFog.decode("42501E0E4E060E131B00174D141E4F"));
giveUp(new SignInFailureReason(this.mConnectionResult.getErrorCode(), responseCode));
return;
}
}
}
void notifyListener(boolean success) {
String decode;
StringBuilder sb = new StringBuilder(NPStringFog.decode("201F190808180E0B154E3C24323A242920204E1F0B411D08000B5F071E4D"));
if (success) {
decode = NPStringFog.decode("3D252E222B3234");
} else {
decode = this.mSignInFailureReason != null ? NPStringFog.decode("2831242D3B3322455A0B021F0E1C48") : NPStringFog.decode("2831242D3B3322455A001F4D041C1308175B");
}
debugLog(sb.append(decode).toString());
if (this.mListener != null) {
if (success) {
this.mListener.onSignInSucceeded();
} else {
this.mListener.onSignInFailed();
}
}
}
public void beginUserInitiatedSignIn() {
debugLog(NPStringFog.decode("0C150A080034140000271E041507001300163D190A0F270F5D45000B0308151A080902520F04190403111345110105031540"));
resetSignInCancellations();
this.mSignInCancelled = false;
this.mConnectOnStart = true;
if (this.mGoogleApiClient.isConnected()) {
logWarn(NPStringFog.decode("0C150A080034140000271E041507001300163D190A0F270F4F4C520D11010D0B0547121A0B1E4D00021302041617500E0E000F0206060B1443412D000B091B00174D0D071213001C0B024D05071302060602094D150141090A060716144101074716070D1308121D4F"));
notifyListener(true);
} else if (this.mConnecting) {
logWarn(NPStringFog.decode("0C150A080034140000271E041507001300163D190A0F270F4F4C520D11010D0B0547121A0B1E4D00021302041617500E0E000F020606071E0A4F4E230245020F040404001546452B01054D020F0F470A1C02094D020F0D0B450606191E410304130D1D0A500C071A0415450B01054D060B1547041C4E1F03320706092C1C3D050E020B0403001646594D0E1C41080B21071703280027060C1E0B1445484E0206091E0C110E0A404134101509151E15070E095F520A191E000C0D02450606154D12070609481B00500F141A15080B52011E4D121A001511071E500C0F0A4106090101501A090B0F470C0649034D020208040E170A5C4D000005471717431503000C0D02450506150341170E1245150B044D150604470613021C0F000D0A49"));
} else {
debugLog(NPStringFog.decode("3D040C131A080902523B2328334328292C26273139242A41140C15005D040F4E070B0A0540"));
this.mUserInitiatedSignIn = true;
if (this.mConnectionResult != null) {
debugLog(NPStringFog.decode("0C150A080034140000271E041507001300163D190A0F270F5D4511011E190800140E0B154E00080F0A080902521D190A0F4308094514021F1A4F"));
this.mConnecting = true;
resolveConnectionResult();
return;
}
debugLog(NPStringFog.decode("0C150A080034140000271E041507001300163D190A0F270F5D45011A111F15070F00451C0B074D12070609481B00500B0D011649"));
this.mConnecting = true;
connect();
}
}
void connect() {
if (this.mGoogleApiClient.isConnected()) {
debugLog(NPStringFog.decode("2F1C1F040F051E4511011E03040D1502015C"));
return;
}
debugLog(NPStringFog.decode("3D040C131A080902520D1F030F0B02130C1D005E"));
this.mConnecting = true;
this.mInvitation = null;
this.mTurnBasedMatch = null;
this.mGoogleApiClient.connect();
}
public void reconnectClient() {
if (!this.mGoogleApiClient.isConnected()) {
Log.w(NPStringFog.decode("2911000426040B15171C"), "reconnectClient() called when client is not connected.");
connect();
return;
}
debugLog(NPStringFog.decode("3C150E0E000F020606071E0A410D0D0E001C1A5E"));
this.mGoogleApiClient.reconnect();
}
@Override
public void onConnected(Bundle connectionHint) {
debugLog(NPStringFog.decode("011E2E0E000F0206060B1457410D0E090B170D0408054F"));
if (connectionHint != null) {
debugLog(NPStringFog.decode("011E2E0E000F0206060B1457410D0E090B170D04040E00410F0C1C1A501D1301170E01170A5E4D220604040E1B00174D070113470C1C1819190440"));
Invitation inv = (Invitation) connectionHint.getParcelable(NPStringFog.decode("071E1B081A00130C1D00"));
if (inv != null && inv.getInvitationId() != null) {
debugLog(NPStringFog.decode("011E2E0E000F0206060B1457410D0E090B170D04040E00410F0C1C1A5005001D41064500011F0041070F110C060B51"));
this.mInvitation = inv;
debugLog(NPStringFog.decode("271E1B081A00130C1D005024255441") + this.mInvitation.getInvitationId());
}
this.mRequests = Games.Requests.getGameRequestsFromBundle(connectionHint);
if (!this.mRequests.isEmpty()) {
debugLog(NPStringFog.decode("011E2E0E000F0206060B1457410D0E090B170D04040E00410F0C1C1A5005001D41") + this.mRequests.size() + NPStringFog.decode("4E0208101B0414115A1D59"));
}
debugLog(NPStringFog.decode("011E2E0E000F0206060B1457410D0E090B170D04040E00410F0C1C1A501D1301170E01170A5E4D220604040E1B00174D07011347313023204D060F0C024B"));
this.mTurnBasedMatch = (TurnBasedMatch) connectionHint.getParcelable(NPStringFog.decode("1A051F0F31030616170A2F00001A020F"));
}
succeedSignIn();
}
void succeedSignIn() {
debugLog(NPStringFog.decode("1D050E020B0403361B091E240F"));
this.mSignInFailureReason = null;
this.mConnectOnStart = true;
this.mUserInitiatedSignIn = false;
this.mConnecting = false;
notifyListener(true);
}
int getSignInCancellations() {
SharedPreferences sp = this.mAppContext.getSharedPreferences(NPStringFog.decode("2931202426242B35373C2F3E292F3322212D3E2228273D"), 0);
return sp.getInt(NPStringFog.decode("2535343E3D28202B2D273E32222F2F24203E22313928212F34"), 0);
}
int incrementSignInCancellations() {
int cancellations = getSignInCancellations();
SharedPreferences.Editor editor = this.mAppContext.getSharedPreferences(NPStringFog.decode("2931202426242B35373C2F3E292F3322212D3E2228273D"), 0).edit();
editor.putInt(NPStringFog.decode("2535343E3D28202B2D273E32222F2F24203E22313928212F34"), cancellations + 1);
editor.commit();
return cancellations + 1;
}
void resetSignInCancellations() {
SharedPreferences.Editor editor = this.mAppContext.getSharedPreferences(NPStringFog.decode("2931202426242B35373C2F3E292F3322212D3E2228273D"), 0).edit();
editor.putInt(NPStringFog.decode("2535343E3D28202B2D273E32222F2F24203E22313928212F34"), 0);
editor.commit();
}
@Override
public void onConnectionFailed(ConnectionResult result) {
boolean shouldResolve;
debugLog(NPStringFog.decode("011E2E0E000F020606071F03270F080B0016"));
this.mConnectionResult = result;
debugLog(NPStringFog.decode("2D1F030F0B02130C1D00500B00070D12171754"));
debugLog(NPStringFog.decode("4E504D4C4E020801175450") + GameHelperUtils.errorCodeToString(this.mConnectionResult.getErrorCode()));
debugLog(NPStringFog.decode("4E504D4C4E1302161D02060C0302045D45") + this.mConnectionResult.hasResolution());
debugLog(NPStringFog.decode("4E504D4C4E05021113071C1E5B4E") + this.mConnectionResult.toString());
int cancellations = getSignInCancellations();
if (this.mUserInitiatedSignIn) {
debugLog(NPStringFog.decode("011E2E0E000F020606071F03270F080B001654503A28222D4717171D1F01170B410500110F051E044E141400004E1903081A080611170A501E08090F4A0C1C40"));
shouldResolve = true;
} else if (this.mSignInCancelled) {
debugLog(NPStringFog.decode("011E2E0E000F020606071F03270F080B00164E27242D2241292A264E020812010D11005246051E041C410609000B1109184E02060B110B1C01040A41080B110B5943"));
shouldResolve = false;
} else if (cancellations < this.mMaxAutoSignInAttempts) {
debugLog(NPStringFog.decode("011E2E0E000F020606071F03270F080B001654503A28222D4717171D1F01170B410500110F051E044E1602451A0F0608410C040B0A054E0405044E0C061D514E1F0B410F1513001F1E041E4D4E") + cancellations + NPStringFog.decode("4E4C4D") + this.mMaxAutoSignInAttempts);
shouldResolve = true;
} else {
shouldResolve = false;
debugLog(NPStringFog.decode("011E2E0E000F020606071F03270F080B001654503A08020D472B3D3A501F041D0E0B13175550030E1A411216171C5D040F07150E04060B144D00000547081316500C151A040A15061D501F040F020F00165450") + cancellations + NPStringFog.decode("4E4E5041") + this.mMaxAutoSignInAttempts);
}
if (!shouldResolve) {
debugLog(NPStringFog.decode("011E2E0E000F020606071F03270F080B001654501E0800020245050B501A0E00461345000B03020D18044B45140F1901080006470B1D195E"));
this.mConnectionResult = result;
this.mConnecting = false;
notifyListener(false);
return;
}
debugLog(NPStringFog.decode("011E2E0E000F020606071F03270F080B001654501F041D0E0B131B00174D111C0E050917035E434F"));
resolveConnectionResult();
}
void resolveConnectionResult() {
if (this.mExpectingResolution) {
debugLog(NPStringFog.decode("39154A130B410609000B1109184E041F15170D04040F0941130D174E0208121B0D13451D08500C411E1302131B01051E411C04140A1E1B04040E004F"));
return;
}
debugLog(NPStringFog.decode("1C151E0E021702261D001E08021A08080B200B03180D1A5B471100171903064E150845000B03020D18044717171D0501155441") + this.mConnectionResult);
if (this.mConnectionResult.hasResolution()) {
debugLog(NPStringFog.decode("3C151E140215470D131D501F041D0E0B1006071F034F4E321304001A1903064E08134B"));
try {
this.mExpectingResolution = true;
this.mConnectionResult.startResolutionForResult(this.mActivity, RC_RESOLVE);
return;
} catch (IntentSender.SendIntentException e) {
debugLog(NPStringFog.decode("3D150305270F13001C1A3515020B11130C1D005C4D120141040A1C00150E15070F0045130911040F40"));
connect();
return;
}
}
debugLog(NPStringFog.decode("1C151E0E021702261D001E08021A08080B200B03180D1A5B4717171D0501154E09061652001F4D130B120809071A19020F4041200C04071E0A411B1149"));
giveUp(new SignInFailureReason(this.mConnectionResult.getErrorCode()));
}
public void disconnect() {
if (this.mGoogleApiClient.isConnected()) {
debugLog(NPStringFog.decode("2A191E02010F0900111A1903064E020B0C17000443"));
this.mGoogleApiClient.disconnect();
return;
}
Log.w(NPStringFog.decode("2911000426040B15171C"), "disconnect() called when client was already disconnected.");
}
void giveUp(SignInFailureReason reason) {
this.mConnectOnStart = false;
disconnect();
this.mSignInFailureReason = reason;
if (reason.mActivityResultCode == 10004) {
GameHelperUtils.printMisconfiguredDebugInfo(this.mAppContext);
}
showFailureDialog();
this.mConnecting = false;
notifyListener(false);
}
@Override
public void onConnectionSuspended(int cause) {
debugLog(NPStringFog.decode("011E2E0E000F020606071F03321B1217001C0A15094D4E020610010B4D") + cause);
disconnect();
this.mSignInFailureReason = null;
debugLog(NPStringFog.decode("23110608000647000A1A020C0E1C050E0B131C094D020F0D0B45060150020F3D08000B3B00360C0802040345110F1C01030F020C"));
this.mConnecting = false;
notifyListener(false);
}
public void showFailureDialog() {
if (this.mSignInFailureReason != null) {
int errorCode = this.mSignInFailureReason.getServiceErrorCode();
int actResp = this.mSignInFailureReason.getActivityResultCode();
if (this.mShowErrorDialogs) {
showFailureDialog(this.mActivity, actResp, errorCode);
} else {
debugLog(NPStringFog.decode("201F19411D0908121B00174D041C130817520A190C0D01064707170D1118120B410A361A010728131C0E15211B0F1C02061D5C5A03130203084F4E2415171D1C501A001D5B47") + this.mSignInFailureReason);
}
}
}
public static void showFailureDialog(Activity activity, int actResp, int errorCode) {
Dialog errorDialog;
if (activity == null) {
Log.e(NPStringFog.decode("2911000426040B15171C"), "*** No Activity. Can't show failure dialog!");
return;
}
switch (actResp) {
case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(activity, 1));
break;
case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(activity, 3));
break;
case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
errorDialog = makeSimpleDialog(activity, GameHelperUtils.getString(activity, 2));
break;
default:
errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, activity, RC_UNUSED, null);
if (errorDialog == null) {
Log.e(NPStringFog.decode("2911000426040B15171C"), "No standard error dialog available. Making fallback dialog.");
errorDialog = makeSimpleDialog(activity, String.valueOf(GameHelperUtils.getString(activity, 0)) + NPStringFog.decode("4E") + GameHelperUtils.errorCodeToString(errorCode));
break;
}
break;
}
errorDialog.show();
}
static Dialog makeSimpleDialog(Activity activity, String text) {
return new AlertDialog.Builder(activity).setMessage(text).setNeutralButton(17039370, (DialogInterface.OnClickListener) null).create();
}
static Dialog makeSimpleDialog(Activity activity, String title, String text) {
return new AlertDialog.Builder(activity).setMessage(text).setTitle(title).setNeutralButton(17039370, (DialogInterface.OnClickListener) null).create();
}
public Dialog makeSimpleDialog(String text) {
if (this.mActivity == null) {
logError(NPStringFog.decode("445A474103000C0021071D1D0D0B250E041E01174D070F080B00165450030E4E021217000B1E19412F02130C0407041440"));
return null;
}
return makeSimpleDialog(this.mActivity, text);
}
public Dialog makeSimpleDialog(String title, String text) {
if (this.mActivity == null) {
logError(NPStringFog.decode("445A474103000C0021071D1D0D0B250E041E01174D070F080B00165450030E4E021217000B1E19412F02130C0407041440"));
return null;
}
return makeSimpleDialog(this.mActivity, title, text);
}
void debugLog(String message) {
if (this.mDebugLog) {
Log.d(NPStringFog.decode("2911000426040B15171C"), NPStringFog.decode("2911000426040B15171C4A4D") + message);
}
}
void logWarn(String message) {
Log.w(NPStringFog.decode("2911000426040B15171C"), NPStringFog.decode("4F514C4129000A003A0B1C1D041C41302420203923265441") + message);
}
void logError(String message) {
Log.e(NPStringFog.decode("2911000426040B15171C"), NPStringFog.decode("445A474129000A003A0B1C1D041C4122372021225741") + message);
}
public static class SignInFailureReason {
public static final int NO_ACTIVITY_RESULT_CODE = -100;
int mActivityResultCode;
int mServiceErrorCode;
public int getServiceErrorCode() {
return this.mServiceErrorCode;
}
public int getActivityResultCode() {
return this.mActivityResultCode;
}
public SignInFailureReason(int serviceErrorCode, int activityResultCode) {
this.mServiceErrorCode = 0;
this.mActivityResultCode = -100;
this.mServiceErrorCode = serviceErrorCode;
this.mActivityResultCode = activityResultCode;
}
public SignInFailureReason(int serviceErrorCode) {
this(serviceErrorCode, -100);
}
public String toString() {
return NPStringFog.decode("3D190A0F270F21041B02051F043C0406161D00581E041C170E06172B021F0E1C2208011754") + GameHelperUtils.errorCodeToString(this.mServiceErrorCode) + (this.mActivityResultCode == -100 ? NPStringFog.decode("47") : NPStringFog.decode("42110E1507170E110B3C151E140215240A160B4A") + GameHelperUtils.activityResponseCodeToString(this.mActivityResultCode) + NPStringFog.decode("47"));
}
}
public void setConnectOnStart(boolean connectOnStart) {
debugLog(NPStringFog.decode("281F1F02070F00451F2D1F030F0B02132A1C3D040C131A5C") + connectOnStart);
this.mConnectOnStart = connectOnStart;
}
}