Skip to content

Commit

Permalink
Removing testing logs
Browse files Browse the repository at this point in the history
  • Loading branch information
markvdouw committed Jan 10, 2024
1 parent dbee5d0 commit d0e09cc
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
15 changes: 2 additions & 13 deletions android-core/src/main/java/com/mparticle/identity/IdentityApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ public MParticleTask<IdentityApiResult> login(@Nullable final IdentityApiRequest
public IdentityHttpResponse request(IdentityApiRequest request) throws Exception {
IdentityHttpResponse response = getApiClient().login(request);
timeoutSeconds = response.getTimeout();
Logger.debug("TIMEOUT - IDENTITY TIMEOUT SET (SEC): "+ timeoutSeconds);
return response;
}

Expand All @@ -239,7 +238,6 @@ public MParticleTask<IdentityApiResult> identify(@Nullable final IdentityApiRequ
public IdentityHttpResponse request(IdentityApiRequest request) throws Exception {
IdentityHttpResponse response = getApiClient().identify(request);
timeoutSeconds = response.getTimeout();
Logger.debug("TIMEOUT - IDENTITY TIMEOUT SET (SEC): "+ timeoutSeconds);
return response;
}

Expand Down Expand Up @@ -367,22 +365,17 @@ private void reset() {

private boolean shouldMakeRequest(IdentityApiRequest identityRequest, boolean acceptCachedResponse, long lastIdentityCall) {
if (!acceptCachedResponse) {
Logger.debug("TIMEOUT - SHOULD MAKE REQUEST: TRUE");
return true;
}
boolean hasTimedOut = lastIdentityCall==-1L || (lastIdentityCall + (timeoutSeconds * 1000) > System.currentTimeMillis()) ;
Logger.debug("TIMEOUT - REQUEST TIMED OUT: " + hasTimedOut);
boolean hasTimedOut = lastIdentityCall == -1L || (lastIdentityCall + (timeoutSeconds * 1000) > System.currentTimeMillis());
if (identityRequest != null && identityRequest.mpid != null) {
MParticleUser user = getUser(identityRequest.mpid);
if (hasTimedOut || isRequestDifferent(user, identityRequest)) {
Logger.debug("TIMEOUT - SHOULD MAKE REQUEST: TRUE");
return true;
} else {
Logger.debug("TIMEOUT - SHOULD MAKE REQUEST: FALSE");
return false;
}
} else {
Logger.debug("TIMEOUT - SHOULD MAKE REQUEST: TRUE");
return true;
}
}
Expand All @@ -396,13 +389,9 @@ private boolean mpIdNotKnown(MParticleUser user) {
}

private boolean areIdentitiesDifferent(MParticleUser user, IdentityApiRequest identityApiRequest) {
//TODO params such as device id, android id, and google id should be persisted in user or userIdentity to be compared.
if (user != null) {
Map<MParticle.IdentityType, String> userIdentities = user.getUserIdentities() != null ? user.getUserIdentities() : new HashMap<>();
Map<MParticle.IdentityType, String> requestUserIdentities = identityApiRequest.getUserIdentities() != null ? identityApiRequest.getUserIdentities() : new HashMap<>();
Logger.debug("TIMEOUT - USER IDENTITIES: " +userIdentities);
Logger.debug("TIMEOUT - REQUEST USER IDENTITIES: " +requestUserIdentities);
Logger.debug("TIMEOUT - RESULT DIFFERENT: " + !userIdentities.equals(requestUserIdentities));
return !userIdentities.equals(requestUserIdentities);
} else {
return true;
Expand All @@ -423,7 +412,7 @@ private BaseIdentityTask makeIdentityRequest(IdentityApiRequest request, final I
if (!shouldMakeRequest(identityApiRequest, acceptCachedResponse, lastIdentityCallTime)) {
//Set both current and prev user as the current one, no request was done.
task.setSuccessful(new IdentityApiResult(getUser(identityApiRequest.mpid), getCurrentUser()));
Logger.debug("Identity -Returning current user from cache");
Logger.debug("Identity - Returning current user from cache");
return task;
}
ConfigManager.setIdentityRequestInProgress(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public long getMpId() {
}

public long getTimeout() {
return 30L;
return timeout;
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class MParticleIdentityClientImpl extends MParticleBaseClientImpl impleme
private Context mContext;
private ConfigManager mConfigManager;

static final long IDENTITY_TIMEOUT = 24 * 60 * 60 * 1000L;
static final String LOGIN_PATH = "login";
static final String LOGOUT_PATH = "logout";
static final String IDENTIFY_PATH = "identify";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,6 @@ public void resetIdentityTypeCall() {
}

public void setLastIdentityTypeCall(String call) {
Logger.debug("TIMEOUT - SET LAST IDENTITY TIME CALL FOR " + call + " : " + System.currentTimeMillis());
sPreferences.edit().putLong(call, System.currentTimeMillis()).apply();
}

Expand Down

0 comments on commit d0e09cc

Please sign in to comment.