Skip to content

Commit c8aa1f2

Browse files
committed
add additional metadata accessor
1 parent c4d1d1d commit c8aa1f2

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.14.10]
5+
6+
### Changed
7+
- Added accessor to additional metadata
8+
49
## [0.14.9]
510

611
### Changes

core/src/main/java/io/snabble/sdk/Snabble.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,24 @@ public String getVersionName() {
146146
* notify the user that it will not function anymore.
147147
*/
148148
public boolean isOutdatedSDK() {
149+
JsonObject jsonObject = getAdditionalMetadata();
150+
if (jsonObject != null) {
151+
return JsonUtils.getBooleanOpt(jsonObject, "kill", false);
152+
}
153+
154+
return false;
155+
}
156+
157+
/** Returns additional metadata that may be provided for apps unrelated to the SDK **/
158+
public JsonObject getAdditionalMetadata() {
149159
JsonObject jsonObject = metadataDownloader.getJsonObject();
150160

151-
return jsonObject.has("metadata") &&
152-
JsonUtils.getBooleanOpt(jsonObject.get("metadata").getAsJsonObject(), "kill", false);
161+
JsonElement jsonElement = jsonObject.get("metadata");
162+
if (jsonElement != null) {
163+
return jsonElement.getAsJsonObject();
164+
}
165+
166+
return null;
153167
}
154168

155169
private synchronized void readMetadata() {

0 commit comments

Comments
 (0)