-
Notifications
You must be signed in to change notification settings - Fork 33
[MOB-2606] persistent read state for inbox in-apps #323
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #323 +/- ##
==========================================
+ Coverage 70.35% 70.56% +0.20%
==========================================
Files 60 60
Lines 3701 3734 +33
Branches 430 437 +7
==========================================
+ Hits 2604 2635 +31
- Misses 832 833 +1
- Partials 265 266 +1
Continue to review full report at Codecov.
|
iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppManager.java
Outdated
Show resolved
Hide resolved
| changed = true; | ||
| } | ||
|
|
||
| if (storage.getMessage(message.getMessageId()) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we wont basically need the if condition at this point right? null check is already done and if null, there is a message added in storage above on line 315?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it like this because it's a discretely separate check (AKA should we overwrite), that happens through the null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the reason is for readability, I think the check should be stored in a named variable to express intent. It takes a while to understand what storage.getMessage(message.getMessageId()) == null and storage.getMessage(message.getMessageId()) != null mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add, that's a good idea.
iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppManager.java
Show resolved
Hide resolved
| remoteQueueMap.put(message.getMessageId(), message); | ||
| if (storage.getMessage(message.getMessageId()) == null) { | ||
|
|
||
| if (!isStoringInApp(message)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need a separate method. Just create a local variable like this:
boolean isExistingInApp = storage.getMessage(message.getMessageId()) != null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a boolean is only used within a single method, I think it's easier to define it inline rather than declaring a separate method.
iterableapi/src/test/java/com/iterable/iterableapi/IterableInAppManagerTest.java
Show resolved
Hide resolved
vbabenkoru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with one minor comment.
18fdc1d to
23fe3f8
Compare
[MOB-2606] persistent read state for inbox in-apps # Conflicts: # iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppManager.java
🔹 Jira Ticket(s) if any
✏️ Description