Skip to content

Commit 9c81e4b

Browse files
committed
feat: add opt-in config method for reading device info once in web bridge plugin
1 parent d05c09a commit 9c81e4b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Adjust/sdk-plugin-webbridge/src/main/assets/adjust_config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function AdjustConfig(appToken, environment, legacy) {
5757
this.coppaCompliantEnabled = null;
5858
this.finalAttributionEnabled = null;
5959
this.fbAppId = null;
60+
this.readDeviceInfoOnceEnabled = null;
6061
}
6162

6263
AdjustConfig.EnvironmentSandbox = 'sandbox';
@@ -270,3 +271,7 @@ AdjustConfig.prototype.setFinalAttributionEnabled = function(isEnabled) {
270271
AdjustConfig.prototype.setFbAppId = function(fbAppId) {
271272
this.fbAppId = fbAppId;
272273
};
274+
275+
AdjustConfig.prototype.setReadDeviceInfoOnceEnabled = function(isEnabled) {
276+
this.readDeviceInfoOnceEnabled = isEnabled;
277+
};

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ public void onCreate(String adjustConfigString) {
176176
Object coppaCompliantEnabledField = jsonAdjustConfig.get("coppaCompliantEnabled");
177177
Object finalAttributionEnabledField = jsonAdjustConfig.get("finalAttributionEnabled");
178178
Object fbAppIdField = jsonAdjustConfig.get("fbAppId");
179+
Object readDeviceInfoOnceEnabledField = jsonAdjustConfig.get("readDeviceInfoOnceEnabled");
179180

180181
String appToken = AdjustBridgeUtil.fieldToString(appTokenField);
181182
String environment = AdjustBridgeUtil.fieldToString(environmentField);
@@ -415,6 +416,12 @@ public boolean launchReceivedDeeplink(Uri deeplink) {
415416
adjustConfig.setFbAppId(fbAppId);
416417
}
417418

419+
// read device info once
420+
Boolean readDeviceInfoOnceEnabled = AdjustBridgeUtil.fieldToBoolean(readDeviceInfoOnceEnabledField);
421+
if (readDeviceInfoOnceEnabled != null) {
422+
adjustConfig.setReadDeviceInfoOnceEnabled(readDeviceInfoOnceEnabled);
423+
}
424+
418425
// Manually call onResume() because web view initialisation will happen a bit delayed.
419426
// With this delay, it will miss lifecycle callback onResume() initial firing.
420427
Adjust.onCreate(adjustConfig);

0 commit comments

Comments
 (0)