-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
GoogleMobileAdsSettings.cs
113 lines (86 loc) · 3.29 KB
/
GoogleMobileAdsSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace GoogleMobileAds.Editor
{
internal class GoogleMobileAdsSettings : ScriptableObject
{
private const string MobileAdsSettingsResDir = "Assets/GoogleMobileAds/Resources";
private const string MobileAdsSettingsFile = "GoogleMobileAdsSettings";
private const string MobileAdsSettingsFileExtension = ".asset";
internal static GoogleMobileAdsSettings LoadInstance()
{
//Read from resources.
var instance = Resources.Load<GoogleMobileAdsSettings>(MobileAdsSettingsFile);
//Create instance if null.
if (instance == null)
{
Directory.CreateDirectory(MobileAdsSettingsResDir);
instance = ScriptableObject.CreateInstance<GoogleMobileAdsSettings>();
string assetPath = Path.Combine(
MobileAdsSettingsResDir,
MobileAdsSettingsFile + MobileAdsSettingsFileExtension);
AssetDatabase.CreateAsset(instance, assetPath);
AssetDatabase.SaveAssets();
Version agp = Version.Parse(Utils.AndroidGradlePluginVersion);
instance.validateGradleDependencies = true;
// Turn on Gradle Dependency Validation if AGP < 4.2.2
if (agp.Major > 4 || (agp.Major == 4 && agp.Minor >= 2 && agp.Build >= 2))
{
instance.validateGradleDependencies = false;
}
}
return instance;
}
[SerializeField]
private string adMobAndroidAppId = string.Empty;
[SerializeField]
private string adMobIOSAppId = string.Empty;
[SerializeField]
private bool enableKotlinXCoroutinesPackagingOption = true;
[SerializeField]
private bool optimizeInitialization;
[SerializeField]
private bool optimizeAdLoading;
[SerializeField]
private string userTrackingUsageDescription;
[SerializeField]
private bool validateGradleDependencies;
public string GoogleMobileAdsAndroidAppId
{
get { return adMobAndroidAppId; }
set { adMobAndroidAppId = value; }
}
public bool EnableKotlinXCoroutinesPackagingOption
{
get { return enableKotlinXCoroutinesPackagingOption; }
set { enableKotlinXCoroutinesPackagingOption = value; }
}
public string GoogleMobileAdsIOSAppId
{
get { return adMobIOSAppId; }
set { adMobIOSAppId = value; }
}
public bool OptimizeInitialization
{
get { return optimizeInitialization; }
set { optimizeInitialization = value; }
}
public bool OptimizeAdLoading
{
get { return optimizeAdLoading; }
set { optimizeAdLoading = value; }
}
public string UserTrackingUsageDescription
{
get { return userTrackingUsageDescription; }
set { userTrackingUsageDescription = value; }
}
public bool ValidateGradleDependencies
{
get { return validateGradleDependencies; }
set { validateGradleDependencies = value; }
}
}
}