Skip to content

Commit 602ce41

Browse files
committed
refac: make store app id optional
1 parent 53ab1d3 commit 602ce41

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

Adjust/plugins/sdk-plugin-webbridge/src/main/java/com/adjust/sdk/webbridge/AdjustBridgeInstance.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,9 @@ public boolean launchReceivedDeeplink(Uri deeplink) {
382382
// store info
383383
String storeName = AdjustBridgeUtil.fieldToString(storeInfoNameField);
384384
String storeAppId = AdjustBridgeUtil.fieldToString(storeInfoAppIdField);
385-
if (storeName != null || storeAppId != null) {
386-
AdjustStoreInfo adjustStoreInfo = new AdjustStoreInfo(storeName, storeAppId);
385+
if (storeName != null) {
386+
AdjustStoreInfo adjustStoreInfo = new AdjustStoreInfo(storeName);
387+
adjustStoreInfo.setStoreAppId(storeAppId);
387388
adjustConfig.setAdjustStoreInfo(adjustStoreInfo);
388389
}
389390

Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustStoreInfo.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,29 @@ public class AdjustStoreInfo {
44
String storeName;
55
String storeAppId;
66

7-
public AdjustStoreInfo(String storeName, String storeAppId) {
7+
private static final ILogger logger = AdjustFactory.getLogger();
8+
9+
public AdjustStoreInfo(String storeName) {
10+
if (!isValidStore(storeName)) {
11+
return;
12+
}
13+
814
this.storeName = storeName;
9-
this.storeAppId = storeAppId;
1015
}
1116

12-
public String getStoreName() {
13-
return storeName;
17+
public void setStoreAppId(String storeAppId) {
18+
this.storeAppId = storeAppId;
1419
}
1520

16-
public String getStoreAppId() {
17-
return storeAppId;
21+
private boolean isValidStore(final String storeName) {
22+
if (storeName == null) {
23+
logger.error("Missing store name");
24+
return false;
25+
}
26+
if (storeName.isEmpty()) {
27+
logger.error("Store name can't be empty");
28+
return false;
29+
}
30+
return true;
1831
}
1932
}

Adjust/sdk-core/src/main/java/com/adjust/sdk/StoreInfoUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ public static AdjustStoreInfo getStoreInfoFromClient(final AdjustConfig adjustCo
3939

4040
String storeAppId = metaData.getString("ADJUST_STORE_APP_ID");
4141

42-
return new AdjustStoreInfo(storeName, storeAppId);
42+
AdjustStoreInfo storeInfo = new AdjustStoreInfo(storeName);
43+
storeInfo.setStoreAppId(storeAppId);
44+
return storeInfo;
45+
4346
} catch (Exception e) {
4447
return adjustConfig.adjustStoreInfo;
4548
}

0 commit comments

Comments
 (0)