mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-05 08:35:10 +00:00
Allow JSONObject in a NetworkPacket
Summary: Allow a mapping of fields to be a field of a NetworkPacket Reviewers: #kde_connect, albertvaka Reviewed By: #kde_connect, albertvaka Subscribers: albertvaka, #kde_connect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D11870
This commit is contained in:
committed by
Nicolas Fella
parent
d4d9e8ba6d
commit
4d2357f016
@@ -159,6 +159,17 @@ public class NetworkPacket {
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject getJSONObject(String key) {
|
||||
return mBody.optJSONObject(key);
|
||||
}
|
||||
|
||||
public void set(String key, JSONObject value) {
|
||||
try {
|
||||
mBody.put(key, value);
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getStringSet(String key) {
|
||||
JSONArray jsonArray = mBody.optJSONArray(key);
|
||||
if (jsonArray == null) return null;
|
||||
|
Reference in New Issue
Block a user