Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Updated with crossdk-ios 3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lforner committed Aug 19, 2022
1 parent 9a82fed commit aa60e1b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/
/[Pp]ackages/
/[Pp]rojectSettings/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
Expand All @@ -21,6 +23,7 @@

# Visual Studio cache directory
.vs/
.vsconfig

# Gradle cache directory
.gradle/
Expand All @@ -47,6 +50,7 @@ ExportedObj/
*.pidb.meta
*.pdb.meta
*.mdb.meta
*.meta

# Unity3D generated file on crash reports
sysinfo.txt
Expand Down
24 changes: 16 additions & 8 deletions Assets/CrossDK/CrossDKConverter.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Runtime.InteropServices;
using UnityEngine;

Expand All @@ -11,6 +12,9 @@ public class CrossDKConverter
[DllImport("__Internal")]
private static extern void crossDKConfigWithAppId(string appId, string apiKey, string userId);

[DllImport("__Internal")]
private static extern void setDeviceId(string deviceId);

[DllImport("__Internal")]
private static extern void dismissOverlay();

Expand All @@ -21,14 +25,6 @@ public class CrossDKConverter
private const string CONFIG = "config";
private const string DISMISS = "dismissOverlay";
private const string DISPLAY = "displayOverlay";
//[DllImport("CrossDK")]
//private static extern void crossDKConfigWithAppId(string appId, string apiKey, string userId);

//[DllImport("CrossDK")]
//private static extern void dismissOverlay();

//[DllImport("CrossDK")]
//private static extern void displayOverlayWithFormat(int format, int position, bool withCloseButton, bool isRewarded);
#endif

/* Public interface for use inside C# code */
Expand All @@ -52,6 +48,18 @@ public static void CrossDKConfigWithAppId(string appId = "", string apiKey = "",
#endif
}

public static void SetDeviceId(string deviceId)
{
#if UNITY_EDITOR
Debug.Log("SetDeviceId called in editor");
#elif UNITY_IOS
setDeviceId(deviceId);
#endif
#if UNITY_ANDROID
// Not available yet
#endif
}

public static void DismissOverlay()
{
#if UNITY_EDITOR
Expand Down
11 changes: 9 additions & 2 deletions Assets/CrossDK/CrossDKSingleton.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using UnityEngine;
using UnityEngine.Networking.Types;

namespace CrossDK
{
Expand All @@ -23,7 +25,7 @@ public class CrossDKSingleton : MonoBehaviour
[SerializeField] private bool _autoCallConfig;
[SerializeField] private string _appId;
[SerializeField] private string _apiKey;
[SerializeField] private string _idfv;
[SerializeField] private string _userId;

private void Awake()
{
Expand All @@ -37,7 +39,7 @@ private void Awake()

if (_autoCallConfig)
{
Config(_appId, _apiKey, _idfv);
Config(_appId, _apiKey, _userId);
}
}

Expand All @@ -48,6 +50,11 @@ public static void Config(string appId = "", string apiKey = "", string userId =
CrossDKConverter.CrossDKConfigWithAppId(appId, apiKey, userId);
}

public static void SetDeviceId(string deviceId)
{
CrossDKConverter.SetDeviceId(deviceId);
}

public static void DismissOverlay()
{
CrossDKConverter.DismissOverlay();
Expand Down
2 changes: 1 addition & 1 deletion Assets/CrossDK/Editor/CrossDKDependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* "subspecs" (optional)
Subspecs to include for the pod.
-->
<iosPod name="CrossDK" version="3.2.0" addToAllTargets="true">
<iosPod name="CrossDK" version="3.2.2" addToAllTargets="true">
<sources>
<source>https://github.com/CocoaPods/Specs</source>
</sources>
Expand Down
9 changes: 9 additions & 0 deletions Assets/Plugins/iOS/CrossDKBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ void crossDKConfigWithAppId(const char *appId, const char *apiKey, const char *u
];
}

/// Set the device ID.
///
/// - Parameters:
/// - deviceId: current device ID
void setDeviceId(const char* deviceId) {
NSString *nsDeviceId = makeNSString(deviceId);
CrossDKConfig.shared.deviceId = nsDeviceId;
}

/// Displays an Overlay view.
///
/// - Parameters:
Expand Down

0 comments on commit aa60e1b

Please sign in to comment.