-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
233 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tinodesdk/src/main/java/co/tinode/tinodesdk/model/ClientMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tinodesdk/src/main/java/co/tinode/tinodesdk/model/MsgClientSetSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package co.tinode.tinodesdk.model; | ||
|
||
import android.util.Log; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer; | ||
|
||
import java.io.IOException; | ||
|
||
import co.tinode.tinodesdk.Tinode; | ||
|
||
/** | ||
* Custom serializer for MsgSetMeta to serialize assigned NULL fields as Tinode.NULL_VALUE string. | ||
*/ | ||
public class MsgClientSetSerializer extends StdSerializer<MsgClientSet<?,?>> { | ||
public MsgClientSetSerializer() { | ||
super(MsgClientSet.class, false); | ||
} | ||
|
||
@Override | ||
public void serialize(MsgClientSet<?,?> value, JsonGenerator gen, SerializerProvider provider) throws IOException { | ||
gen.writeStartObject(); | ||
if (value.id != null && value.id.length() > 0) { | ||
gen.writeStringField("id", value.id); | ||
} | ||
if (value.topic != null && value.topic.length() > 0) { | ||
gen.writeStringField("topic", value.topic); | ||
} | ||
|
||
if (value.desc != null) { | ||
gen.writeObjectField("desc", value.desc); | ||
} else if (value.nulls[MsgSetMeta.NULL_DESC]) { | ||
gen.writeStringField("desc", Tinode.NULL_VALUE); | ||
} | ||
|
||
if (value.sub != null) { | ||
gen.writeObjectField("sub", value.sub); | ||
} else if (value.nulls[MsgSetMeta.NULL_SUB]) { | ||
gen.writeStringField("sub", Tinode.NULL_VALUE); | ||
} | ||
|
||
if (value.tags != null && value.tags.length != 0) { | ||
gen.writeFieldName("tags"); | ||
gen.writeArray(value.tags, 0, value.tags.length); | ||
} else if (value.nulls[MsgSetMeta.NULL_TAGS]) { | ||
gen.writeFieldName("tags"); | ||
gen.writeArray(new String[]{Tinode.NULL_VALUE}, 0, 1); | ||
} | ||
|
||
if (value.cred != null) { | ||
gen.writeObjectField("cred", value.cred); | ||
} else if (value.nulls[MsgSetMeta.NULL_CRED]) { | ||
gen.writeStringField("cred", Tinode.NULL_VALUE); | ||
} | ||
gen.writeEndObject(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
tinodesdk/src/main/java/co/tinode/tinodesdk/model/MsgClientSub.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.