Skip to content

Commit 209ae14

Browse files
author
Max Presman
committed
fix up publish
1 parent 7a13f70 commit 209ae14

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎src/main/java/com/pubnub/api/endpoints/pubsub/Publish.java‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public Publish(PubNub pubnub, PublishSequenceManager providedPublishSequenceMana
4545

4646
this.publishSequenceManager = providedPublishSequenceManager;
4747
this.replicate = true;
48-
this.shouldStore = true;
4948
}
5049

5150
@Override
@@ -86,13 +85,16 @@ protected final Call<List<Object>> doWork(Map<String, String> params) throws Pub
8685
}
8786
}
8887

89-
if (shouldStore) {
90-
params.put("store", "1");
91-
if (ttl != null) {
92-
params.put("ttl", String.valueOf(ttl));
88+
if (shouldStore != null) {
89+
if (shouldStore) {
90+
params.put("store", "1");
91+
} else {
92+
params.put("store", "0");
9393
}
94-
} else {
95-
params.put("store", "0");
94+
}
95+
96+
if (ttl != null) {
97+
params.put("ttl", String.valueOf(ttl));
9698
}
9799

98100
params.put("seqn", String.valueOf(publishSequenceManager.getNextSequence()));
@@ -101,7 +103,6 @@ protected final Call<List<Object>> doWork(Map<String, String> params) throws Pub
101103
params.put("norep", "true");
102104
}
103105

104-
105106
if (this.getPubnub().getConfiguration().getCipherKey() != null) {
106107
Crypto crypto = new Crypto(this.getPubnub().getConfiguration().getCipherKey());
107108
stringifiedMessage = crypto.encrypt(stringifiedMessage).replace("\n", "");

0 commit comments

Comments
 (0)