Skip to content

Commit 0c72231

Browse files
committed
feat: add ability to set custom store information
1 parent 8959b2f commit 0c72231

File tree

7 files changed

+79
-0
lines changed

7 files changed

+79
-0
lines changed

Assets/Adjust/Native/iOS/AdjustUnity.mm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ void _AdjustInitSdk(
8888
const char* defaultTracker,
8989
const char* externalDeviceId,
9090
const char* jsonUrlStrategyDomains,
91+
const char* storeName,
92+
const char* storeAppId,
9193
int allowSuppressLogLevel,
9294
int logLevel,
9395
int attConsentWaitingInterval,
@@ -117,6 +119,8 @@ void _AdjustInitSdk(
117119
NSString *strSdkPrefix = isStringValid(sdkPrefix) == true ? [NSString stringWithUTF8String:sdkPrefix] : nil;
118120
NSString *strDefaultTracker = isStringValid(defaultTracker) == true ? [NSString stringWithUTF8String:defaultTracker] : nil;
119121
NSString *strExternalDeviceId = isStringValid(externalDeviceId) == true ? [NSString stringWithUTF8String:externalDeviceId] : nil;
122+
NSString *strStoreName = isStringValid(storeName) == true ? [NSString stringWithUTF8String:storeName] : nil;
123+
NSString *strStoreAppId = isStringValid(storeAppId) == true ? [NSString stringWithUTF8String:storeAppId] : nil;
120124

121125
ADJConfig *adjustConfig;
122126

@@ -256,6 +260,15 @@ void _AdjustInitSdk(
256260
}
257261
}
258262

263+
// custom store
264+
if (strStoreName != nil) {
265+
ADJStoreInfo *storeInfo = [[ADJStoreInfo alloc] initWithStoreName:strStoreName];
266+
if (strStoreAppId != nil) {
267+
[storeInfo setStoreAppId:strStoreAppId];
268+
}
269+
[adjustConfig setStoreInfo:storeInfo];
270+
}
271+
259272
// initialize the SDK
260273
[Adjust initSdk:adjustConfig];
261274
}

Assets/Adjust/Scripts/AdjustAndroid.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,23 @@ public static void InitSdk(AdjustConfig adjustConfig)
187187
}
188188
}
189189

190+
// check if custom store info has been set
191+
if (adjustConfig.StoreInfo != null)
192+
{
193+
if (adjustConfig.StoreInfo.StoreName != null)
194+
{
195+
using (AndroidJavaObject ajoAdjustStoreInfo =
196+
new AndroidJavaObject("com.adjust.sdk.AdjustStoreInfo", adjustConfig.StoreInfo.StoreName))
197+
{
198+
if (adjustConfig.StoreInfo.StoreAppId != null)
199+
{
200+
ajoAdjustStoreInfo.Call("setStoreAppId", adjustConfig.StoreInfo.StoreAppId);
201+
}
202+
ajoAdjustConfig.Call("setStoreInfo", ajoAdjustStoreInfo);
203+
}
204+
}
205+
}
206+
190207
// check attribution changed delagate
191208
if (adjustConfig.AttributionChangedDelegate != null)
192209
{

Assets/Adjust/Scripts/AdjustConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class AdjustConfig
2222
public List<string> UrlStrategyDomains { get; private set; }
2323
public AdjustLogLevel? LogLevel { get; set; }
2424
public AdjustEnvironment Environment { get; private set; }
25+
public AdjustStoreInfo StoreInfo { get; set; }
2526
public Action<AdjustAttribution> AttributionChangedDelegate { get; set; }
2627
public Action<AdjustEventSuccess> EventSuccessDelegate { get; set; }
2728
public Action<AdjustEventFailure> EventFailureDelegate { get; set; }
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
namespace AdjustSdk
4+
{
5+
public class AdjustStoreInfo
6+
{
7+
public string StoreName { get; private set; }
8+
public string StoreAppId { get; set; }
9+
10+
public AdjustStoreInfo(string storeName)
11+
{
12+
this.StoreName = storeName;
13+
}
14+
}
15+
}

Assets/Adjust/Scripts/AdjustStoreInfo.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Adjust/Scripts/AdjustiOS.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ private static extern void _AdjustInitSdk(
4949
string defaultTracker,
5050
string externalDeviceId,
5151
string jsonUrlStrategyDomains,
52+
string storeName,
53+
string storeAppId,
5254
int allowSuppressLogLevel,
5355
int logLevel,
5456
int attConsentWaitingInterval,
@@ -270,6 +272,13 @@ public static void InitSdk(AdjustConfig adjustConfig)
270272
string externalDeviceId = adjustConfig.ExternalDeviceId != null ? adjustConfig.ExternalDeviceId : "ADJ_INVALID";
271273
string stringJsonUrlStrategyDomains = AdjustUtils.ConvertReadOnlyCollectionToJson(
272274
adjustConfig.UrlStrategyDomains != null ? adjustConfig.UrlStrategyDomains.AsReadOnly() : null);
275+
string storeName = "ADJ_INVALID";
276+
string storeAppId = "ADJ_INVALID";
277+
if (adjustConfig.StoreInfo != null)
278+
{
279+
storeName = adjustConfig.StoreInfo.StoreName != null ? adjustConfig.StoreInfo.StoreName : "ADJ_INVALID";
280+
storeAppId = adjustConfig.StoreInfo.StoreAppId != null ? adjustConfig.StoreInfo.StoreAppId : "ADJ_INVALID";
281+
}
273282
int attConsentWaitingInterval = AdjustUtils.ConvertInt(adjustConfig.AttConsentWaitingInterval);
274283
int eventDeduplicationIdsMaxSize = AdjustUtils.ConvertInt(adjustConfig.EventDeduplicationIdsMaxSize);
275284
int logLevel = AdjustUtils.ConvertLogLevel(adjustConfig.LogLevel);
@@ -302,6 +311,8 @@ public static void InitSdk(AdjustConfig adjustConfig)
302311
defaultTracker,
303312
externalDeviceId,
304313
stringJsonUrlStrategyDomains,
314+
storeName,
315+
storeAppId,
305316
allowSuppressLogLevel,
306317
logLevel,
307318
attConsentWaitingInterval,

Assets/Test/Scripts/CommandExecutor.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,17 @@ private void Config()
358358
adjustConfig.EventDeduplicationIdsMaxSize = eventDeduplicationIdsMaxSize;
359359
}
360360

361+
if (_command.ContainsParameter("storeName"))
362+
{
363+
var storeName = _command.GetFirstParameterValue("storeName");
364+
AdjustStoreInfo storeInfo = new AdjustStoreInfo(storeName);
365+
if (_command.ContainsParameter("storeAppId"))
366+
{
367+
storeInfo.StoreAppId = _command.GetFirstParameterValue("storeAppId");
368+
}
369+
adjustConfig.StoreInfo = storeInfo;
370+
}
371+
361372
if (_command.ContainsParameter("deferredDeeplinkCallback"))
362373
{
363374
bool launchDeferredDeeplink = _command.GetFirstParameterValue("deferredDeeplinkCallback") == "true";

0 commit comments

Comments
 (0)