use of com.onesignal.influence.data.OSChannelTracker in project OneSignal-Android-SDK by OneSignal.
the class SessionManagerUnitTests method testIndirectIAMInitInfluence.
@Test
public void testIndirectIAMInitInfluence() throws JSONException {
trackerFactory.saveInfluenceParams(new OneSignalPackagePrivateHelper.RemoteOutcomeParams());
sessionManager.initSessionFromCache();
OSChannelTracker iamTracker = trackerFactory.getIAMChannelTracker();
assertEquals(0, iamTracker.getLastReceivedIds().length());
sessionManager.onInAppMessageReceived(IAM_ID);
iamTracker = trackerFactory.getIAMChannelTracker();
OSInfluence influence = iamTracker.getCurrentSessionInfluence();
assertEquals(OSInfluenceType.INDIRECT, iamTracker.getInfluenceType());
assertEquals(IAM_ID, iamTracker.getLastReceivedIds().get(0));
assertEquals(OSInfluenceChannel.IAM, influence.getInfluenceChannel());
assertEquals(OSInfluenceType.INDIRECT, influence.getInfluenceType());
assertEquals(1, influence.getIds().length());
assertEquals(IAM_ID, influence.getIds().get(0));
}
use of com.onesignal.influence.data.OSChannelTracker in project OneSignal-Android-SDK by OneSignal.
the class SessionManagerUnitTests method testDirectIAMInitInfluence.
@Test
public void testDirectIAMInitInfluence() throws JSONException {
trackerFactory.saveInfluenceParams(new OneSignalPackagePrivateHelper.RemoteOutcomeParams());
sessionManager.initSessionFromCache();
OSChannelTracker iamTracker = trackerFactory.getIAMChannelTracker();
assertEquals(0, iamTracker.getLastReceivedIds().length());
sessionManager.onInAppMessageReceived(IAM_ID);
sessionManager.onDirectInfluenceFromIAMClick(IAM_ID);
iamTracker = trackerFactory.getIAMChannelTracker();
OSInfluence influence = iamTracker.getCurrentSessionInfluence();
assertEquals(OSInfluenceType.DIRECT, iamTracker.getInfluenceType());
assertEquals(IAM_ID, iamTracker.getLastReceivedIds().get(0));
assertEquals(OSInfluenceChannel.IAM, influence.getInfluenceChannel());
assertEquals(OSInfluenceType.DIRECT, influence.getInfluenceType());
assertEquals(1, influence.getIds().length());
assertEquals(IAM_ID, influence.getIds().get(0));
}
use of com.onesignal.influence.data.OSChannelTracker in project OneSignal-Android-SDK by OneSignal.
the class OSSessionManager method onDirectInfluenceFromIAMClick.
void onDirectInfluenceFromIAMClick(@NonNull String messageId) {
logger.debug("OneSignal SessionManager onDirectInfluenceFromIAMClick messageId: " + messageId);
OSChannelTracker inAppMessageTracker = trackerFactory.getIAMChannelTracker();
// We don't care about ending the session duration because IAM doesn't influence a session
setSession(inAppMessageTracker, OSInfluenceType.DIRECT, messageId, null);
}
use of com.onesignal.influence.data.OSChannelTracker in project OneSignal-Android-SDK by OneSignal.
the class OSSessionManager method onInAppMessageReceived.
void onInAppMessageReceived(@NonNull String messageId) {
logger.debug("OneSignal SessionManager onInAppMessageReceived messageId: " + messageId);
OSChannelTracker inAppMessageTracker = trackerFactory.getIAMChannelTracker();
inAppMessageTracker.saveLastId(messageId);
inAppMessageTracker.resetAndInitInfluence();
}
use of com.onesignal.influence.data.OSChannelTracker in project OneSignal-Android-SDK by OneSignal.
the class SessionManagerUnitTests method testIndirectNotificationInitInfluence.
@Test
public void testIndirectNotificationInitInfluence() throws JSONException {
trackerFactory.saveInfluenceParams(new OneSignalPackagePrivateHelper.RemoteOutcomeParams());
sessionManager.initSessionFromCache();
OSChannelTracker notificationTracker = trackerFactory.getNotificationChannelTracker();
assertEquals(0, notificationTracker.getLastReceivedIds().length());
sessionManager.onNotificationReceived(NOTIFICATION_ID);
sessionManager.attemptSessionUpgrade(OneSignal.AppEntryAction.APP_OPEN);
notificationTracker = trackerFactory.getNotificationChannelTracker();
OSInfluence influence = notificationTracker.getCurrentSessionInfluence();
assertEquals(OSInfluenceType.INDIRECT, notificationTracker.getInfluenceType());
assertEquals(NOTIFICATION_ID, notificationTracker.getLastReceivedIds().get(0));
assertEquals(OSInfluenceChannel.NOTIFICATION, influence.getInfluenceChannel());
assertEquals(OSInfluenceType.INDIRECT, influence.getInfluenceType());
assertEquals(1, influence.getIds().length());
assertEquals(NOTIFICATION_ID, influence.getIds().get(0));
}
Aggregations