Skip to content

Commit

Permalink
Merge pull request #9 from qonversion/release/2.1.1
Browse files Browse the repository at this point in the history
Release/2.1.1
  • Loading branch information
suriksarkisyan authored Apr 13, 2021
2 parents dac849b + 4435747 commit db6582e
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Editor/QonversionDependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<androidPackage spec="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61" />
</androidPackages>
<iosPods>
<iosPod name="Qonversion" version="2.11.2" />
<iosPod name="Qonversion" version="2.13.2" />
</iosPods>
</dependencies>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Just add this line to the `Packages/manifest.json` file of your Unity Project:

```json
"dependencies": {
"com.qonversion.unity": "https://github.com/qonversion/unity-sdk.git#2.1.0"
"com.qonversion.unity": "https://github.com/qonversion/unity-sdk.git#2.1.1"
}
```

Expand Down
12 changes: 9 additions & 3 deletions Runtime/Android/QonversionWrapperAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace QonversionUnity
internal class QonversionWrapperAndroid : IQonversionWrapper
{
public void Launch(string gameObjectName, string projectKey, bool observerMode)
{
{
CallQonversion("launch", gameObjectName, projectKey, observerMode);
}

Expand Down Expand Up @@ -34,6 +34,10 @@ public void SyncPurchases()
}
}

public void SetAdvertisingID()
{
}

public void AddAttributionData(string conversionData, AttributionSource source)
{
string attibutionSource;
Expand Down Expand Up @@ -98,8 +102,10 @@ public void Offerings(string callbackName)

private static void CallQonversion(string methodName, params object[] args)
{
using var qonversion = new AndroidJavaClass(QonversionWrapper);
qonversion.CallStatic(methodName, args);
using (var qonversion = new AndroidJavaClass(QonversionWrapper))
{
qonversion.CallStatic(methodName, args);
}
}
}
}
1 change: 1 addition & 0 deletions Runtime/Scripts/IQonversionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
internal interface IQonversionWrapper
{
void SetDebugMode();
void SetAdvertisingID();
void Launch(string gameObjectName, string projectKey, bool observerMode);
void SetUserID(string userID);
void SyncPurchases();
Expand Down
41 changes: 31 additions & 10 deletions Runtime/Scripts/Models/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,38 @@ public override string ToString()
private QProductType FormatType(object productType) =>
(QProductType)Convert.ToInt32(productType);

private QProductDuration FormatDuration(object duration) =>
Convert.ToInt32(duration) switch
private QProductDuration FormatDuration(object duration)
{
Int32 value = Convert.ToInt32(duration);
var result = QProductDuration.Unknown;

switch (value)
{
0 => QProductDuration.Weekly,
1 => QProductDuration.Monthly,
2 => QProductDuration.ThreeMonths,
3 => QProductDuration.SixMonths,
4 => QProductDuration.Annual,
5 => QProductDuration.Lifetime,
_ => QProductDuration.Unknown
};
case 0:
result = QProductDuration.Weekly;
break;
case 1:
result = QProductDuration.Monthly;
break;
case 2:
result = QProductDuration.ThreeMonths;
break;
case 3:
result = QProductDuration.SixMonths;
break;
case 4:
result = QProductDuration.Annual;
break;
case 5:
result = QProductDuration.Lifetime;
break;
default:
result = QProductDuration.Unknown;
break;
}

return result;
}

private QTrialDuration FormatTrialDuration(object trialDuration) =>
(QTrialDuration)Convert.ToInt32(trialDuration);
Expand Down
6 changes: 6 additions & 0 deletions Runtime/Scripts/Qonversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public static void SetDebugMode()
instance.SetDebugMode();
}

public static void SetAdvertisingID()
{
IQonversionWrapper instance = getFinalInstance();
instance.SetAdvertisingID();
}

public static void SetUserID(string userID)
{
IQonversionWrapper instance = getFinalInstance();
Expand Down
4 changes: 4 additions & 0 deletions Runtime/Scripts/QonversionWrapperNoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public void SyncPurchases()
{
}

public void SetAdvertisingID()
{
}

public void CheckPermissions(string callbackName)
{
}
Expand Down
4 changes: 4 additions & 0 deletions Runtime/iOS/Plugins/QonversionBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ void _launchWithKey(const char* unityListener, const char* key)
[Qonversion launchWithKey:[UtilityBridge сonvertCStringToNSString:key]];
}

void _setAdvertisingID() {
[Qonversion setAdvertisingID];
}

void _setUserID(const char* userID)
{
[Qonversion setUserID:[UtilityBridge сonvertCStringToNSString:userID]];
Expand Down
11 changes: 11 additions & 0 deletions Runtime/iOS/QonversionWrapperIOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ internal class QonversionWrapperIOS : IQonversionWrapper
[DllImport("__Internal")]
private static extern void _setDebugMode();

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

[DllImport("__Internal")]
private static extern void _setUserID(string userID);

Expand Down Expand Up @@ -55,6 +58,14 @@ public void SetDebugMode()
#endif
}

public void SetAdvertisingID()
{
#if UNITY_IOS
_setAdvertisingID();
#endif
}


public void SetUserID(string userID)
{
#if UNITY_IOS
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.qonversion.unity",
"displayName": "Qonversion",
"version": "2.1.0",
"version": "2.1.1",
"unity": "2018.3",
"description": "Empower your mobile app marketing and product decisions with precise subscription data.",
"author": {
Expand Down

0 comments on commit db6582e

Please sign in to comment.