Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Gather device info on start <PIX-2854>
Browse files Browse the repository at this point in the history
  • Loading branch information
grooze committed Sep 1, 2021
1 parent 48546fd commit c37af79
Show file tree
Hide file tree
Showing 17 changed files with 555 additions and 53 deletions.
Binary file not shown.
Binary file not shown.
40 changes: 24 additions & 16 deletions Assets/ThirdParty/Appmetr/AppMetr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ namespace Appmetr.Unity
/// </summary>
public static class AppMetr
{
/// <summary>
/// Setting up plugin.
/// </summary>
/// <param name="token">
/// Parameter which is needed for data upload.
/// </param>
public static void Setup(string token)
{
AppmetrPlatformPlugin.SetupWithToken(token, null);
}

/// <summary>
/// Sets mandatory plugin parameters
/// </summary>
/// <param name="token">Deploy token as assigned on backend</param>
/// <param name="platform">Platform or store name. Changes behaviour of
/// certain events, especially payment tracking.</param>
public static void Setup(string token, string platform)
/// certain events, especially payment tracking. Optional</param>
public static void Setup(string token, string platform = null)
{
AppmetrPlatformPlugin.SetupWithToken(token, platform);
AppmetrPlatformPlugin.AttachProperties(new Dictionary<string, object>
{
{"cpu", SystemInfo.processorType},
{"cpu_cores", SystemInfo.processorCount},
{"cpu_frequency", SystemInfo.processorFrequency},
{"gpu", SystemInfo.graphicsDeviceName},
{"ram", SystemInfo.systemMemorySize},
{"screen_size", GetScreenDiagonal()},
{"screen_resolution", $"{Screen.currentResolution.width}x{Screen.currentResolution.height}"},
{"device_model", SystemInfo.deviceModel}
});
}


Expand Down Expand Up @@ -203,7 +203,7 @@ public static void Identify(string userId)
{
AppmetrPlatformPlugin.Identify(userId);
}

/// <summary>
/// Method for attaching properties to separate entity instead of user
/// </summary>
Expand Down Expand Up @@ -238,7 +238,7 @@ public static void Flush()
{
AppmetrPlatformPlugin.Flush();
}

/// <summary>
/// Force flush events to disk. Flushing execute in new thread.
/// </summary>
Expand All @@ -254,7 +254,7 @@ public static string GetInstanceIdentifier()
{
return AppmetrPlatformPlugin.GetInstanceIdentifier();
}

/// <summary>
/// Return a set of device ids, encoded in a query string
/// </summary>
Expand All @@ -264,5 +264,13 @@ public static string GetDeviceKey()
}

public const string AppmetrPropertyTimestamp = "timestamp";

private static double GetScreenDiagonal()
{
var width = Screen.width / Screen.dpi;
var height = Screen.height / Screen.dpi;
var diagonal = Mathf.Sqrt(width * width + height * height);
return Math.Round(diagonal, 2);
}
}
}
Binary file modified Assets/ThirdParty/Appmetr/Sample/TestScene.unity
Binary file not shown.
3 changes: 2 additions & 1 deletion Assets/ThirdParty/Appmetr/Sample/UserIdentifier.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections;
using UnityEngine;
using UnityEngine.UI;

namespace Appmetr.Unity.Sample
{
Expand All @@ -12,7 +13,7 @@ IEnumerator Start()
AppMetr.Identify("testUserId");
string userId = AppMetr.GetInstanceIdentifier();
string deviceKey = AppMetr.GetDeviceKey() ?? "null";
GetComponent<GUIText>().text += string.Format("UID: {0}\nDevice key: {1}", userId, deviceKey);
GetComponent<Text>().text += string.Format("UID: {0}\nDevice key: {1}", userId, deviceKey);
Debug.Log("Device key 1: " + deviceKey);
yield return new WaitForSeconds(4);
deviceKey = AppMetr.GetDeviceKey() ?? "null";
Expand Down
Binary file modified Assets/ThirdParty/Appmetr/iOS/libAppMetr.a
Binary file not shown.
86 changes: 57 additions & 29 deletions Assets/ThirdParty/Appmetr/x86/AppmetrCS.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Logs/Packages-Update.log
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,28 @@ The following packages were added:
com.unity.modules.vr@1.0.0
com.unity.modules.wind@1.0.0
com.unity.modules.xr@1.0.0

=== Mon Aug 30 19:24:18 2021

Packages were changed.
Update Mode: updateDependencies

The following packages were added:
com.unity.2d.sprite@1.0.0
com.unity.2d.tilemap@1.0.0
com.unity.ide.rider@1.1.4
com.unity.ide.vscode@1.2.3
com.unity.modules.androidjni@1.0.0
com.unity.multiplayer-hlapi@1.0.8
com.unity.test-framework@1.1.22
com.unity.timeline@1.2.18
com.unity.ugui@1.0.0
com.unity.xr.legacyinputhelpers@2.1.7
The following packages were updated:
com.unity.ads from version 2.0.8 to 3.6.1
com.unity.analytics from version 3.2.2 to 3.3.5
com.unity.collab-proxy from version 1.2.15 to 1.2.16
com.unity.purchasing from version 2.0.3 to 2.2.2
com.unity.textmeshpro from version 1.4.1 to 2.0.1
The following packages were removed:
com.unity.package-manager-ui@2.0.8
21 changes: 15 additions & 6 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
{
"dependencies": {
"com.unity.ads": "2.0.8",
"com.unity.analytics": "3.2.2",
"com.unity.collab-proxy": "1.2.15",
"com.unity.package-manager-ui": "2.0.8",
"com.unity.purchasing": "2.0.3",
"com.unity.textmeshpro": "1.4.1",
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "3.6.1",
"com.unity.analytics": "3.3.5",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.3",
"com.unity.multiplayer-hlapi": "1.0.8",
"com.unity.purchasing": "2.2.2",
"com.unity.test-framework": "1.1.22",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.18",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "2.1.7",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
Expand Down
Loading

0 comments on commit c37af79

Please sign in to comment.