Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gilmor-af committed Jul 25, 2023
1 parent 7399bf5 commit ce3b550
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions Assets/AppsflyerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ private RequestData CreateRequestData()
DeviceIDs[] deviceids = { deviceid };

string device_os_ver = SystemInfo.operatingSystem;
device_os_ver = TrimDeviceOsVer(device_os_ver);

RequestData req = new RequestData
{
timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString(),
device_os_version = device_os_ver,
device_model = SystemInfo.deviceModel,
app_version = "1.0.0", //TODO: Insert your app version
device_ids = deviceids,
request_id = GenerateGuid(),
limit_ad_tracking = false
};
return req;
}

private static string TrimDeviceOsVer(string device_os_ver)
{
if (device_os_ver.IndexOf(" (") > -1)
device_os_ver = device_os_ver.Replace(" (", "");
if (device_os_ver.IndexOf("(") > -1)
Expand All @@ -64,18 +81,7 @@ private RequestData CreateRequestData()
device_os_ver = device_os_ver.Substring(1, device_os_ver.Length - 1);
if (device_os_ver.Length > 23)
device_os_ver = device_os_ver.Substring(0, 23);

RequestData req = new RequestData
{
timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString(),
device_os_version = device_os_ver,
device_model = SystemInfo.deviceModel,
app_version = "1.0.0", //TODO: Insert your app version
device_ids = deviceids,
request_id = GenerateGuid(),
limit_ad_tracking = false
};
return req;
return device_os_ver;
}

// report first open event to AppsFlyer (or session if counter > 2)
Expand Down Expand Up @@ -185,7 +191,7 @@ private IEnumerator SendUnityPostReq(RequestData req, AppsflyerRequestType REQ_T
uwr.SetRequestHeader("Authorization", auth);
uwr.SetRequestHeader(
"user-agent",
"UnityGamesLaucnher/"
"UnityGamesLauncher/"
+ " ("
+ SystemInfo.operatingSystem.Replace("(", "").Replace(")", "")
+ ")"
Expand Down

0 comments on commit ce3b550

Please sign in to comment.