Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist seen in-app campaign ids accross sessions #469

Merged
merged 1 commit into from
Jun 23, 2017

Conversation

patedit
Copy link
Contributor

@patedit patedit commented Jun 21, 2017

So in case there is no connectivity and the user opens up the app again later, the SDK will make sure we don't show the same in-app twice (i.e. decide won't know that the notification was seen until we flush again / connectivity is restored).

final SharedPreferences prefs = mLoadStoredPreferences.get();
final SharedPreferences.Editor editor = prefs.edit();
String campaignIds = prefs.getString("seen_campaign_ids", "");
editor.putString("seen_campaign_ids", campaignIds + notificationId + DELIMITER);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lame there's no default serialization/deserialization

mContext = context;
mToken = token;
mListener = listener;
mUpdatesFromMixpanel = updatesFromMixpanel;

mDistinctId = null;
mUnseenNotifications = new LinkedList<InAppNotification>();
mNotificationIds = new HashSet<Integer>();
mNotificationIds = new HashSet<Integer>(notificationIds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to make a copy here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for safety mainly

@patedit patedit merged commit 82a15fe into master Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants