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

Commit

Permalink
Release 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Str4tos committed Mar 15, 2021
1 parent 0215b07 commit 586b012
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 161 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Clever Ads Solutions Unity Plugin Change Log

## [1.2.0] - 2021-03-02
### Bug Fixes
- Fix `AppTrackingTransparency.Request()` in Unity Editor.

## [1.2.0] - 2021-03-02
### Dependencies
- CleverAdsSolutions - [2.0.0](https://github.com/cleveradssolutions/CAS-Unity/releases)
Expand Down
8 changes: 4 additions & 4 deletions Editor/CASSimpleLocalizeTextEditor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System;
using CAS.UEditor;
Expand Down
1 change: 1 addition & 0 deletions Editor/ConsentRequestParametersEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public static void CreateParameters()
var togglePrefab = LoadUITemplatePrefab( templateSettingsPrefabName );
if (togglePrefab)
asset.WithMediationSettingsTogglePrefab( togglePrefab.GetComponent<MediationPolicyUI>() );

AssetDatabase.CreateAsset( asset, assetPath );
}

Expand Down
6 changes: 3 additions & 3 deletions Editor/PostprocessiOSBuild.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#if UNITY_IOS || CASDeveloper
#if UNITY_IOS || CASDeveloper
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEngine;

using UnityEngine;

namespace CAS.UserConsent
{
internal class PostprocessiOSBuild
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Modify `Packages/manifest.json` to the following form:
}
],
"dependencies": {
"com.cleversolutions.ads.consent.unity": "https://github.com/cleveradssolutions/CAS-Unity-Consent.git#1.1.4"
"com.cleversolutions.ads.consent.unity": "https://github.com/cleveradssolutions/CAS-Unity-Consent.git#1.2.1"
}
}
```
Expand Down
4 changes: 3 additions & 1 deletion Runtime/AppTrackingTransparency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ public static void Request()
if (string.IsNullOrEmpty( settings.defaultIOSTrakingUsageDescription ))
throw new ArgumentNullException(
"Please set NSUserTrackingUsageDescription in 'Assets > CleverAdsSolutions > Consent Request parameters' menu to correct tracking authorization request." );
#endif
OnAuthorizationRequestComplete( Status.Authorized );
#else
CASURequestTracking( AuthorizationRequestComplete );
#endif
#else
OnAuthorizationRequestComplete( Status.Authorized );
#endif
Expand Down
164 changes: 82 additions & 82 deletions Runtime/AudienceDefinitionUI.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
using System;
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace CAS.UserConsent
using UnityEngine.UI;

namespace CAS.UserConsent
{
[AddComponentMenu( "CleverAdsSolutions/UserConsent/Audience Definition UI" )]
public sealed class AudienceDefinitionUI : MonoBehaviour
{
[Range( 0.05f, 1.0f )]
[AddComponentMenu( "CleverAdsSolutions/UserConsent/Audience Definition UI" )]
public sealed class AudienceDefinitionUI : MonoBehaviour
{
[Range( 0.05f, 1.0f )]
[SerializeField]
private float animationTime = 0.15f;
[SerializeField]
private int userInitialAge = 12;

[SerializeField]
[SerializeField]
private List<Text> components = new List<Text>();

[Header( "Optional" )]
public UnityEvent OnUnderAgeOfConsent;
public UnityEvent OnConsentRequired;

private Color selectedYearColor;
private Color defaultYearColor;
private Vector2[] textPositions;
private int currentYear;
private int selectedYear;
private int swipeProcess;

private void Start()
{
private Color defaultYearColor;
private Vector2[] textPositions;
private int currentYear;
private int selectedYear;
private int swipeProcess;

private void Start()
{
if (components.Count == 5)
{
defaultYearColor = components[1].color;
selectedYearColor = components[2].color;
}
}
else
{
defaultYearColor = Color.clear;
selectedYearColor = Color.clear;
}
currentYear = DateTime.Now.Year;
}
currentYear = DateTime.Now.Year;
textPositions = new Vector2[components.Count];
selectedYear = currentYear - userInitialAge;
selectedYear = currentYear - userInitialAge;
for (int i = 0; i < components.Count; i++)
{
textPositions[i] = components[i].transform.position;
components[i].text = ( selectedYear + 2 - i ).ToString();
}

SetTextColors();
}

SetTextColors();
}

public void OnBeginIncreasingYear()
{
swipeProcess = 1;
IncreaseYear();
}

}

public void OnEndIncreasingYear()
{
swipeProcess = 0;
}

}

public void OnBeginDecreasingYear()
{
swipeProcess = -1;
DecreaseYear();
}

}

public void OnEndDecreasingYear()
{
swipeProcess = 0;
Expand All @@ -86,73 +86,73 @@ public void ApplySelectedYear()
OnConsentRequired.Invoke();
}

private void DecreaseYear()
{
StopAllCoroutines();
for (int i = 1; i < components.Count; i++)
private void DecreaseYear()
{
StopAllCoroutines();
for (int i = 1; i < components.Count; i++)
StartCoroutine( MoveTexts( components[i].transform, textPositions[i - 1] ) );

selectedYear--;
var nextYear = selectedYear - 2;
Text text = components[0];
text.transform.position = textPositions[textPositions.Length - 1];
text.text = nextYear.ToString();
components.Remove( text );
components.Add( text );

SetTextColors();
}

private void IncreaseYear()
{
if (components[1].text == "")
selectedYear--;
var nextYear = selectedYear - 2;
Text text = components[0];
text.transform.position = textPositions[textPositions.Length - 1];
text.text = nextYear.ToString();
components.Remove( text );
components.Add( text );

SetTextColors();
}

private void IncreaseYear()
{
if (components[1].text == "")
return;

StopAllCoroutines();
StopAllCoroutines();
for (int i = 0; i < components.Count - 1; i++)
StartCoroutine( MoveTexts( components[i].transform, textPositions[i + 1] ) );

selectedYear++;
var nextYear = selectedYear + 2;

Text text = components[components.Count - 1];
text.transform.position = textPositions[0];
if (nextYear > currentYear)
var nextYear = selectedYear + 2;

Text text = components[components.Count - 1];
text.transform.position = textPositions[0];
if (nextYear > currentYear)
text.text = "";
else
text.text = nextYear.ToString();

components.Remove( text );
components.Insert( 0, text );

SetTextColors();
components.Remove( text );
components.Insert( 0, text );

SetTextColors();
}

private void SetTextColors()
private void SetTextColors()
{
if (selectedYearColor == Color.clear)
return;
for (int i = 0; i < components.Count; i++)
{
for (int i = 0; i < components.Count; i++)
{
if (i == 2)
components[i].color = selectedYearColor;
else
components[i].color = defaultYearColor;
}
}

private IEnumerator MoveTexts( Transform moveText, Vector3 pos )
else
components[i].color = defaultYearColor;
}
}

private IEnumerator MoveTexts( Transform moveText, Vector3 pos )
{
float multiplier = 1f / animationTime * ( pos - moveText.position ).magnitude;
while (moveText.transform.position != pos)
{
moveText.position = Vector3.MoveTowards( moveText.position, pos, multiplier * Time.unscaledDeltaTime );
yield return null;
}
if (swipeProcess < 0)
DecreaseYear();
else if (swipeProcess > 0)
IncreaseYear();
}
}
}
float multiplier = 1f / animationTime * ( pos - moveText.position ).magnitude;
while (moveText.transform.position != pos)
{
moveText.position = Vector3.MoveTowards( moveText.position, pos, multiplier * Time.unscaledDeltaTime );
yield return null;
}
if (swipeProcess < 0)
DecreaseYear();
else if (swipeProcess > 0)
IncreaseYear();
}
}
}
10 changes: 5 additions & 5 deletions Runtime/CASSimpleLocalizeText.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using UnityEngine;
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

using UnityEngine.UI;

namespace CAS.UserConsent
{
[AddComponentMenu( "CleverAdsSolutions/UserConsent/CAS Simple Localize Text" )]
Expand Down Expand Up @@ -31,4 +31,4 @@ private void Awake()
UpdateString.Invoke( newText );
}
}
}
}
22 changes: 11 additions & 11 deletions Runtime/ConsentRequestParameters.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand All @@ -9,18 +9,18 @@ namespace CAS.UserConsent
public sealed class ConsentRequestParameters : ScriptableObject
{
#region Fileds
public const string defaultAssetPath = "CASConsentRequestParameters";

public const string defaultAssetPath = "CASConsentRequestParameters";

public Action OnConsent;

#pragma warning disable 649 // is never assigned to, and will always have its default value null
[SerializeField]
internal bool showInEditor = true;
[SerializeField]
internal bool withAudienceDefinition = true;
[SerializeField]
internal bool withDeclineOption = false;
[SerializeField]
#pragma warning disable 649 // is never assigned to, and will always have its default value null
[SerializeField]
internal bool showInEditor = true;
[SerializeField]
internal bool withAudienceDefinition = true;
[SerializeField]
internal bool withDeclineOption = false;
[SerializeField]
internal bool withMediationSettings = true;
[SerializeField]
internal bool withRequestTrackingTransparency = false;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/MediationSettingsUI.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/UserConsent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace CAS.UserConsent
{
public static class UserConsent
{
public const string version = "1.2.0";
public const string version = "1.2.1";

/// <summary>
/// User latest consent status values.
Expand Down
Loading

0 comments on commit 586b012

Please sign in to comment.