Skip to content

Commit 81432f6

Browse files
committed
feat: update store info logic
1 parent 32ca345 commit 81432f6

File tree

4 files changed

+26
-36
lines changed

4 files changed

+26
-36
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package com.adjust.sdk;
22

33
public class AdjustStoreInfo {
4-
String storeType;
5-
String appId;
4+
String storeName;
5+
String storeAppId;
66

7-
public AdjustStoreInfo(String storeType, String appId) {
8-
this.storeType = storeType;
9-
this.appId = appId;
7+
public AdjustStoreInfo(String storeName, String storeAppId) {
8+
this.storeName = storeName;
9+
this.storeAppId = storeAppId;
1010
}
1111

12-
public String getStoreType() {
13-
return storeType;
12+
public String getStoreName() {
13+
return storeName;
1414
}
1515

16-
public String getAppId() {
17-
return appId;
16+
public String getStoreAppId() {
17+
return storeAppId;
1818
}
1919
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ class DeviceInfo {
100100
int connectivityType;
101101
String mcc;
102102
String mnc;
103-
AdjustStoreInfo storeInfoApi;
104-
AdjustStoreInfo storeInfoManifest;
105-
String storeIdSystem;
103+
AdjustStoreInfo storeInfoFromClient;
104+
String storeIdFromSystem;
106105

107106
DeviceInfo(AdjustConfig adjustConfig) {
108107
Context context = adjustConfig.context;
@@ -140,9 +139,8 @@ class DeviceInfo {
140139
if (Util.canReadPlayIds(adjustConfig)) {
141140
appSetId = Reflection.getAppSetId(context);
142141
}
143-
storeInfoApi = StoreInfoUtil.getStoreInfoFromApi(adjustConfig);
144-
storeInfoManifest = StoreInfoUtil.getStoreInfoFromManifest(context);
145-
storeIdSystem = StoreInfoUtil.getStoreIdFromSystem(context);
142+
storeInfoFromClient = StoreInfoUtil.getStoreInfoFromClient(adjustConfig, context);
143+
storeIdFromSystem = StoreInfoUtil.getStoreIdFromSystem(context);
146144
}
147145

148146
void reloadPlayIds(final AdjustConfig adjustConfig) {

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,15 +1257,11 @@ private void injectFeatureFlagsWithParameters(Map<String, String> parameters) {
12571257
}
12581258

12591259
private void injectStoreInfoToParameters(Map<String, String> parameters) {
1260-
if (deviceInfo.storeInfoApi != null) {
1261-
PackageBuilder.addString(parameters, "store_api", deviceInfo.storeInfoApi.storeType);
1262-
PackageBuilder.addString(parameters, "app_id_api", deviceInfo.storeInfoApi.appId);
1260+
if (deviceInfo.storeInfoFromClient != null) {
1261+
PackageBuilder.addString(parameters, "store_name_from_client", deviceInfo.storeInfoFromClient.storeName);
1262+
PackageBuilder.addString(parameters, "store_app_id_from_client", deviceInfo.storeInfoFromClient.storeAppId);
12631263
}
1264-
if (deviceInfo.storeInfoManifest != null) {
1265-
PackageBuilder.addString(parameters, "store_manifest", deviceInfo.storeInfoManifest.storeType);
1266-
PackageBuilder.addString(parameters, "app_id_manifest", deviceInfo.storeInfoManifest.appId);
1267-
}
1268-
PackageBuilder.addString(parameters, "store_system", deviceInfo.storeIdSystem);
1264+
PackageBuilder.addString(parameters, "store_name_from_system", deviceInfo.storeIdFromSystem);
12691265
}
12701266

12711267
public static void addString(Map<String, String> parameters, String key, String value) {

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,24 @@ public static String getStoreIdFromSystem(final Context context) {
2424
}
2525
}
2626

27-
public static AdjustStoreInfo getStoreInfoFromManifest(final Context context) {
27+
public static AdjustStoreInfo getStoreInfoFromClient(final AdjustConfig adjustConfig, final Context context) {
2828
try {
2929
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
3030
Bundle metaData = applicationInfo.metaData;
3131
if (metaData == null) {
32-
return null;
32+
return adjustConfig.adjustStoreInfo;
3333
}
3434

35-
String storeType = metaData.getString("ADJUST_STORE_TYPE");
36-
String storeAppId = metaData.getString("ADJUST_STORE_APP_ID");
37-
38-
if (storeType == null || storeAppId == null) {
39-
return null;
35+
String storeName = metaData.getString("ADJUST_STORE_NAME");
36+
if (storeName == null || storeName.isEmpty()) {
37+
return adjustConfig.adjustStoreInfo;
4038
}
4139

42-
return new AdjustStoreInfo(storeType, storeAppId);
40+
String storeAppId = metaData.getString("ADJUST_STORE_APP_ID");
41+
42+
return new AdjustStoreInfo(storeName, storeAppId);
4343
} catch (Exception e) {
44-
return null;
44+
return adjustConfig.adjustStoreInfo;
4545
}
4646
}
47-
48-
public static AdjustStoreInfo getStoreInfoFromApi(final AdjustConfig adjustConfig) {
49-
return adjustConfig.adjustStoreInfo;
50-
}
5147
}

0 commit comments

Comments
 (0)