diff --git a/Assets/Editor/BFBuildProjectTools/Utils/BuildAndroidUtils.cs b/Assets/Editor/BFBuildProjectTools/Utils/BuildAndroidUtils.cs index 4b01307f6..17e56f1b7 100644 --- a/Assets/Editor/BFBuildProjectTools/Utils/BuildAndroidUtils.cs +++ b/Assets/Editor/BFBuildProjectTools/Utils/BuildAndroidUtils.cs @@ -410,7 +410,7 @@ namespace BFEditor.Build var gradleFilePath2 = Path.Combine(PublishAsProjectPath, "unityLibrary", "build.gradle"); var text2 = File.ReadAllText(gradleFilePath2); text2 = regex.Replace(text2, string.Format("versionCode {0}", versionCode)); - text2 = regex2.Replace(text, string.Format("versionName '{0}'", versionName)); + text2 = regex2.Replace(text2, string.Format("versionName '{0}'", versionName)); File.WriteAllText(gradleFilePath2, text2); } diff --git a/Assets/Editor/Package.cs b/Assets/Editor/Package.cs index 5b7cdd100..0b28ab617 100644 --- a/Assets/Editor/Package.cs +++ b/Assets/Editor/Package.cs @@ -171,547 +171,642 @@ public class Package { // "; // list.AddKey(UnityNotificationRequestAuthorizationOnAppLaunch); + // max专用的SKAdNetworkIdentifiers,可以直接覆盖替换 + string SKAdNetworkIdentifiersForMAX = @" + + SKAdNetworkIdentifier + 22mmun2rn5.skadnetwork + + + SKAdNetworkIdentifier + 238da6jt44.skadnetwork + + + SKAdNetworkIdentifier + 24t9a8vw3c.skadnetwork + + + SKAdNetworkIdentifier + 24zw6aqk47.skadnetwork + + + SKAdNetworkIdentifier + 252b5q8x7y.skadnetwork + + + SKAdNetworkIdentifier + 275upjj5gd.skadnetwork + + + SKAdNetworkIdentifier + 294l99pt4k.skadnetwork + + + SKAdNetworkIdentifier + 2fnua5tdw4.skadnetwork + + + SKAdNetworkIdentifier + 2u9pt9hc89.skadnetwork + + + SKAdNetworkIdentifier + 32z4fx6l9h.skadnetwork + + + SKAdNetworkIdentifier + 3l6bd9hu43.skadnetwork + + + SKAdNetworkIdentifier + 3qcr597p9d.skadnetwork + + + SKAdNetworkIdentifier + 3qy4746246.skadnetwork + + + SKAdNetworkIdentifier + 3rd42ekr43.skadnetwork + + + SKAdNetworkIdentifier + 3sh42y64q3.skadnetwork + + + SKAdNetworkIdentifier + 424m5254lk.skadnetwork + + + SKAdNetworkIdentifier + 4468km3ulz.skadnetwork + + + SKAdNetworkIdentifier + 44jx6755aq.skadnetwork + + + SKAdNetworkIdentifier + 44n7hlldy6.skadnetwork + + + SKAdNetworkIdentifier + 47vhws6wlr.skadnetwork + + + SKAdNetworkIdentifier + 488r3q3dtq.skadnetwork + + + SKAdNetworkIdentifier + 4dzt52r2t5.skadnetwork + + + SKAdNetworkIdentifier + 4fzdc2evr5.skadnetwork + + + SKAdNetworkIdentifier + 4mn522wn87.skadnetwork + + + SKAdNetworkIdentifier + 4pfyvq9l8r.skadnetwork + + + SKAdNetworkIdentifier + 4w7y6s5ca2.skadnetwork + + + SKAdNetworkIdentifier + 523jb4fst2.skadnetwork + + + SKAdNetworkIdentifier + 52fl2v3hgk.skadnetwork + + + SKAdNetworkIdentifier + 54nzkqm89y.skadnetwork + + + SKAdNetworkIdentifier + 578prtvx9j.skadnetwork + + + SKAdNetworkIdentifier + 5a6flpkh64.skadnetwork + + + SKAdNetworkIdentifier + 5l3tpt7t6e.skadnetwork + + + SKAdNetworkIdentifier + 5lm9lj6jb7.skadnetwork + + + SKAdNetworkIdentifier + 5tjdwbrq8w.skadnetwork + + + SKAdNetworkIdentifier + 6964rsfnh4.skadnetwork + + + SKAdNetworkIdentifier + 6g9af3uyq4.skadnetwork + + + SKAdNetworkIdentifier + 6p4ks3rnbw.skadnetwork + + + SKAdNetworkIdentifier + 6v7lgmsu45.skadnetwork + + + SKAdNetworkIdentifier + 6xzpu9s2p8.skadnetwork + + + SKAdNetworkIdentifier + 737z793b9f.skadnetwork + + + SKAdNetworkIdentifier + 74b6s63p6l.skadnetwork + + + SKAdNetworkIdentifier + 7953jerfzd.skadnetwork + + + SKAdNetworkIdentifier + 79pbpufp6p.skadnetwork + + + SKAdNetworkIdentifier + 7fmhfwg9en.skadnetwork + + + SKAdNetworkIdentifier + 7rz58n8ntl.skadnetwork + + + SKAdNetworkIdentifier + 7ug5zh24hu.skadnetwork + + + SKAdNetworkIdentifier + 84993kbrcf.skadnetwork + + + SKAdNetworkIdentifier + 89z7zv988g.skadnetwork + + + SKAdNetworkIdentifier + 8c4e2ghe7u.skadnetwork + + + SKAdNetworkIdentifier + 8m87ys6875.skadnetwork + + + SKAdNetworkIdentifier + 8r8llnkz5a.skadnetwork + + + SKAdNetworkIdentifier + 8s468mfl3y.skadnetwork + + + SKAdNetworkIdentifier + 97r2b46745.skadnetwork + + + SKAdNetworkIdentifier + 9b89h5y424.skadnetwork + + + SKAdNetworkIdentifier + 9g2aggbj52.skadnetwork + + + SKAdNetworkIdentifier + 9nlqeag3gk.skadnetwork + + + SKAdNetworkIdentifier + 9rd848q2bz.skadnetwork + + + SKAdNetworkIdentifier + 9t245vhmpl.skadnetwork + + + SKAdNetworkIdentifier + 9vvzujtq5s.skadnetwork + + + SKAdNetworkIdentifier + 9yg77x724h.skadnetwork + + + SKAdNetworkIdentifier + a2p9lx4jpn.skadnetwork + + + SKAdNetworkIdentifier + a7xqa6mtl2.skadnetwork + + + SKAdNetworkIdentifier + a8cz6cu7e5.skadnetwork + + + SKAdNetworkIdentifier + av6w8kgt66.skadnetwork + + + SKAdNetworkIdentifier + b9bk5wbcq9.skadnetwork + + + SKAdNetworkIdentifier + bxvub5ada5.skadnetwork + + + SKAdNetworkIdentifier + c3frkrj4fj.skadnetwork + + + SKAdNetworkIdentifier + c6k4g5qg8m.skadnetwork + + + SKAdNetworkIdentifier + cg4yq2srnc.skadnetwork + + + SKAdNetworkIdentifier + cj5566h2ga.skadnetwork + + + SKAdNetworkIdentifier + cp8zw746q7.skadnetwork + + + SKAdNetworkIdentifier + cs644xg564.skadnetwork + + + SKAdNetworkIdentifier + cstr6suwn9.skadnetwork + + + SKAdNetworkIdentifier + dbu4b84rxf.skadnetwork + + + SKAdNetworkIdentifier + dkc879ngq3.skadnetwork + + + SKAdNetworkIdentifier + dzg6xy7pwj.skadnetwork + + + SKAdNetworkIdentifier + e5fvkxwrpn.skadnetwork + + + SKAdNetworkIdentifier + ecpz2srf59.skadnetwork + + + SKAdNetworkIdentifier + eh6m2bh4zr.skadnetwork + + + SKAdNetworkIdentifier + ejvt5qm6ak.skadnetwork + + + SKAdNetworkIdentifier + f38h382jlk.skadnetwork + + + SKAdNetworkIdentifier + f73kdq92p3.skadnetwork + + + SKAdNetworkIdentifier + f7s53z58qe.skadnetwork + + + SKAdNetworkIdentifier + feyaarzu9v.skadnetwork + + + SKAdNetworkIdentifier + g28c52eehv.skadnetwork + + + SKAdNetworkIdentifier + g2y4y55b64.skadnetwork + + + SKAdNetworkIdentifier + ggvn48r87g.skadnetwork + + + SKAdNetworkIdentifier + glqzh8vgby.skadnetwork + + + SKAdNetworkIdentifier + gta8lk7p23.skadnetwork + + + SKAdNetworkIdentifier + gta9lk7p23.skadnetwork + + + SKAdNetworkIdentifier + gvmwg8q7h5.skadnetwork + + + SKAdNetworkIdentifier + h65wbv5k3f.skadnetwork + + + SKAdNetworkIdentifier + hb56zgv37p.skadnetwork + + + SKAdNetworkIdentifier + hdw39hrw9y.skadnetwork + + + SKAdNetworkIdentifier + hs6bdukanm.skadnetwork + + + SKAdNetworkIdentifier + k674qkevps.skadnetwork + + + SKAdNetworkIdentifier + kbd757ywx3.skadnetwork + + + SKAdNetworkIdentifier + kbmxgpxpgc.skadnetwork + + + SKAdNetworkIdentifier + klf5c3l5u5.skadnetwork + + + SKAdNetworkIdentifier + krvm3zuq6h.skadnetwork + + + SKAdNetworkIdentifier + lr83yxwka7.skadnetwork + + + SKAdNetworkIdentifier + ludvb6z3bs.skadnetwork + + + SKAdNetworkIdentifier + m297p6643m.skadnetwork + + + SKAdNetworkIdentifier + m5mvw97r93.skadnetwork + + + SKAdNetworkIdentifier + m8dbw4sv7c.skadnetwork + + + SKAdNetworkIdentifier + mlmmfzh3r3.skadnetwork + + + SKAdNetworkIdentifier + mls7yz5dvl.skadnetwork + + + SKAdNetworkIdentifier + mp6xlyr22a.skadnetwork + + + SKAdNetworkIdentifier + mtkv5xtk9e.skadnetwork + + + SKAdNetworkIdentifier + n38lu8286q.skadnetwork + + + SKAdNetworkIdentifier + n66cz3y3bx.skadnetwork + + + SKAdNetworkIdentifier + n6fk4nfna4.skadnetwork + + + SKAdNetworkIdentifier + n9x2a789qt.skadnetwork + + + SKAdNetworkIdentifier + nzq8sh4pbs.skadnetwork + + + SKAdNetworkIdentifier + p78axxw29g.skadnetwork + + + SKAdNetworkIdentifier + ppxm28t8ap.skadnetwork + + + SKAdNetworkIdentifier + prcb7njmu6.skadnetwork + + + SKAdNetworkIdentifier + pu4na253f3.skadnetwork + + + SKAdNetworkIdentifier + pwa73g5rt2.skadnetwork + + + SKAdNetworkIdentifier + pwdxu55a5a.skadnetwork + + + SKAdNetworkIdentifier + qqp299437r.skadnetwork + + + SKAdNetworkIdentifier + qu637u8glc.skadnetwork + + + SKAdNetworkIdentifier + r45fhb6rf7.skadnetwork + + + SKAdNetworkIdentifier + rvh3l7un93.skadnetwork + + + SKAdNetworkIdentifier + rx5hdcabgc.skadnetwork + + + SKAdNetworkIdentifier + s39g8k73mm.skadnetwork + + + SKAdNetworkIdentifier + s69wq72ugq.skadnetwork + + + SKAdNetworkIdentifier + su67r6k2v3.skadnetwork + + + SKAdNetworkIdentifier + t38b2kh725.skadnetwork + + + SKAdNetworkIdentifier + t6d3zquu66.skadnetwork + + + SKAdNetworkIdentifier + tl55sbb4fm.skadnetwork + + + SKAdNetworkIdentifier + u679fj5vs4.skadnetwork + + + SKAdNetworkIdentifier + uw77j35x4d.skadnetwork + + + SKAdNetworkIdentifier + v4nxqhlyqp.skadnetwork + + + SKAdNetworkIdentifier + v72qych5uu.skadnetwork + + + SKAdNetworkIdentifier + v79kvwwj4g.skadnetwork + + + SKAdNetworkIdentifier + v9wttpbfk9.skadnetwork + + + SKAdNetworkIdentifier + vcra2ehyfk.skadnetwork + + + SKAdNetworkIdentifier + vutu7akeur.skadnetwork + + + SKAdNetworkIdentifier + w9q455wk68.skadnetwork + + + SKAdNetworkIdentifier + wg4vff78zm.skadnetwork + + + SKAdNetworkIdentifier + wzmmz9fp6w.skadnetwork + + + SKAdNetworkIdentifier + x44k69ngh6.skadnetwork + + + SKAdNetworkIdentifier + x5l83yy675.skadnetwork + + + SKAdNetworkIdentifier + x8jxxk4ff5.skadnetwork + + + SKAdNetworkIdentifier + x8uqf25wch.skadnetwork + + + SKAdNetworkIdentifier + xy9t38ct57.skadnetwork + + + SKAdNetworkIdentifier + y45688jllp.skadnetwork + + + SKAdNetworkIdentifier + y5ghdn5j9k.skadnetwork + + + SKAdNetworkIdentifier + yclnxrl5pm.skadnetwork + + + SKAdNetworkIdentifier + ydx93a7ass.skadnetwork + + + SKAdNetworkIdentifier + yrqqpx2mcb.skadnetwork + + + SKAdNetworkIdentifier + z4gj7hsk7h.skadnetwork + + + SKAdNetworkIdentifier + z959bm4gru.skadnetwork + + + SKAdNetworkIdentifier + zmvfpc5aq8.skadnetwork + + + SKAdNetworkIdentifier + zq492l623r.skadnetwork + "; + string SKAdNetworkIdentifiers = @" SKAdNetworkItems - - - SKAdNetworkIdentifier - 2fnua5tdw4.skadnetwork - - - SKAdNetworkIdentifier - 2u9pt9hc89.skadnetwork - - - SKAdNetworkIdentifier - 3qcr597p9d.skadnetwork - - - SKAdNetworkIdentifier - 3qy4746246.skadnetwork - - - SKAdNetworkIdentifier - 3sh42y64q3.skadnetwork - - - SKAdNetworkIdentifier - 424m5254lk.skadnetwork - - - SKAdNetworkIdentifier - 4468km3ulz.skadnetwork - - - SKAdNetworkIdentifier - 4dzt52r2t5.skadnetwork - - - SKAdNetworkIdentifier - 4fzdc2evr5.skadnetwork - - - SKAdNetworkIdentifier - 578prtvx9j.skadnetwork - - - SKAdNetworkIdentifier - 5a6flpkh64.skadnetwork - - - SKAdNetworkIdentifier - 7ug5zh24hu.skadnetwork - - - SKAdNetworkIdentifier - 8c4e2ghe7u.skadnetwork - - - SKAdNetworkIdentifier - 8s468mfl3y.skadnetwork - - - SKAdNetworkIdentifier - 9rd848q2bz.skadnetwork - - - SKAdNetworkIdentifier - 9t245vhmpl.skadnetwork - - - SKAdNetworkIdentifier - av6w8kgt66.skadnetwork - - - SKAdNetworkIdentifier - c6k4g5qg8m.skadnetwork - - - SKAdNetworkIdentifier - cstr6suwn9.skadnetwork - - - SKAdNetworkIdentifier - e5fvkxwrpn.skadnetwork - - - SKAdNetworkIdentifier - f38h382jlk.skadnetwork - - - SKAdNetworkIdentifier - hs6bdukanm.skadnetwork - - - SKAdNetworkIdentifier - kbd757ywx3.skadnetwork - - - SKAdNetworkIdentifier - klf5c3l5u5.skadnetwork - - - SKAdNetworkIdentifier - n6fk4nfna4.skadnetwork - - - SKAdNetworkIdentifier - p78axxw29g.skadnetwork - - - SKAdNetworkIdentifier - ppxm28t8ap.skadnetwork - - - SKAdNetworkIdentifier - prcb7njmu6.skadnetwork - - - SKAdNetworkIdentifier - s39g8k73mm.skadnetwork - - - SKAdNetworkIdentifier - t38b2kh725.skadnetwork - - - SKAdNetworkIdentifier - uw77j35x4d.skadnetwork - - - SKAdNetworkIdentifier - v4nxqhlyqp.skadnetwork - - - SKAdNetworkIdentifier - v72qych5uu.skadnetwork - - - SKAdNetworkIdentifier - wzmmz9fp6w.skadnetwork - - - SKAdNetworkIdentifier - yclnxrl5pm.skadnetwork - - - SKAdNetworkIdentifier - ydx93a7ass.skadnetwork - - - SKAdNetworkIdentifier - zq492l623r.skadnetwork - - - SKAdNetworkIdentifier - 22mmun2rn5.skadnetwork - - - SKAdNetworkIdentifier - 24t9a8vw3c.skadnetwork - - - SKAdNetworkIdentifier - 275upjj5gd.skadnetwork - - - SKAdNetworkIdentifier - 294l99pt4k.skadnetwork - - - SKAdNetworkIdentifier - 32z4fx6l9h.skadnetwork - - - SKAdNetworkIdentifier - 3l6bd9hu43.skadnetwork - - - SKAdNetworkIdentifier - 3rd42ekr43.skadnetwork - - - SKAdNetworkIdentifier - 4pfyvq9l8r.skadnetwork - - - SKAdNetworkIdentifier - 523jb4fst2.skadnetwork - - - SKAdNetworkIdentifier - 52fl2v3hgk.skadnetwork - - - SKAdNetworkIdentifier - 54nzkqm89y.skadnetwork - - - SKAdNetworkIdentifier - 5l3tpt7t6e.skadnetwork - - - SKAdNetworkIdentifier - 5lm9lj6jb7.skadnetwork - - - SKAdNetworkIdentifier - 5tjdwbrq8w.skadnetwork - - - SKAdNetworkIdentifier - 6g9af3uyq4.skadnetwork - - - SKAdNetworkIdentifier - 6xzpu9s2p8.skadnetwork - - - SKAdNetworkIdentifier - 79pbpufp6p.skadnetwork - - - SKAdNetworkIdentifier - 7rz58n8ntl.skadnetwork - - - SKAdNetworkIdentifier - 9b89h5y424.skadnetwork - - - SKAdNetworkIdentifier - 9nlqeag3gk.skadnetwork - - - SKAdNetworkIdentifier - 9yg77x724h.skadnetwork - - - SKAdNetworkIdentifier - a8cz6cu7e5.skadnetwork - - - SKAdNetworkIdentifier - c3frkrj4fj.skadnetwork - - - SKAdNetworkIdentifier - cg4yq2srnc.skadnetwork - - - SKAdNetworkIdentifier - cj5566h2ga.skadnetwork - - - SKAdNetworkIdentifier - dkc879ngq3.skadnetwork - - - SKAdNetworkIdentifier - ejvt5qm6ak.skadnetwork - - - SKAdNetworkIdentifier - feyaarzu9v.skadnetwork - - - SKAdNetworkIdentifier - g28c52eehv.skadnetwork - - - SKAdNetworkIdentifier - ggvn48r87g.skadnetwork - - - SKAdNetworkIdentifier - glqzh8vgby.skadnetwork - - - SKAdNetworkIdentifier - gta9lk7p23.skadnetwork - - - SKAdNetworkIdentifier - k674qkevps.skadnetwork - - - SKAdNetworkIdentifier - kbmxgpxpgc.skadnetwork - - - SKAdNetworkIdentifier - ludvb6z3bs.skadnetwork - - - SKAdNetworkIdentifier - m5mvw97r93.skadnetwork - - - SKAdNetworkIdentifier - m8dbw4sv7c.skadnetwork - - - SKAdNetworkIdentifier - mlmmfzh3r3.skadnetwork - - - SKAdNetworkIdentifier - mtkv5xtk9e.skadnetwork - - - SKAdNetworkIdentifier - n66cz3y3bx.skadnetwork - - - SKAdNetworkIdentifier - n9x2a789qt.skadnetwork - - - SKAdNetworkIdentifier - nzq8sh4pbs.skadnetwork - - - SKAdNetworkIdentifier - pwa73g5rt2.skadnetwork - - - SKAdNetworkIdentifier - qqp299437r.skadnetwork - - - SKAdNetworkIdentifier - r45fhb6rf7.skadnetwork - - - SKAdNetworkIdentifier - rvh3l7un93.skadnetwork - - - SKAdNetworkIdentifier - tl55sbb4fm.skadnetwork - - - SKAdNetworkIdentifier - vcra2ehyfk.skadnetwork - - - SKAdNetworkIdentifier - wg4vff78zm.skadnetwork - - - SKAdNetworkIdentifier - x44k69ngh6.skadnetwork - - - SKAdNetworkIdentifier - x5l83yy675.skadnetwork - - - SKAdNetworkIdentifier - x8jxxk4ff5.skadnetwork - - - SKAdNetworkIdentifier - x8uqf25wch.skadnetwork - - - SKAdNetworkIdentifier - xy9t38ct57.skadnetwork - - - SKAdNetworkIdentifier - zmvfpc5aq8.skadnetwork - - - SKAdNetworkIdentifier - 44jx6755aq.skadnetwork - - - SKAdNetworkIdentifier - 44n7hlldy6.skadnetwork - - - SKAdNetworkIdentifier - 4w7y6s5ca2.skadnetwork - - - SKAdNetworkIdentifier - 6964rsfnh4.skadnetwork - - - SKAdNetworkIdentifier - 6p4ks3rnbw.skadnetwork - - - SKAdNetworkIdentifier - 737z793b9f.skadnetwork - - - SKAdNetworkIdentifier - 74b6s63p6l.skadnetwork - - - SKAdNetworkIdentifier - 84993kbrcf.skadnetwork - - - SKAdNetworkIdentifier - 97r2b46745.skadnetwork - - - SKAdNetworkIdentifier - a2p9lx4jpn.skadnetwork - - - SKAdNetworkIdentifier - a7xqa6mtl2.skadnetwork - - - SKAdNetworkIdentifier - b9bk5wbcq9.skadnetwork - - - SKAdNetworkIdentifier - bxvub5ada5.skadnetwork - - - SKAdNetworkIdentifier - dzg6xy7pwj.skadnetwork - - - SKAdNetworkIdentifier - f73kdq92p3.skadnetwork - - - SKAdNetworkIdentifier - g2y4y55b64.skadnetwork - - - SKAdNetworkIdentifier - hdw39hrw9y.skadnetwork - - - SKAdNetworkIdentifier - krvm3zuq6h.skadnetwork - - - SKAdNetworkIdentifier - lr83yxwka7.skadnetwork - - - SKAdNetworkIdentifier - mls7yz5dvl.skadnetwork - - - SKAdNetworkIdentifier - mp6xlyr22a.skadnetwork - - - SKAdNetworkIdentifier - pwdxu55a5a.skadnetwork - - - SKAdNetworkIdentifier - rx5hdcabgc.skadnetwork - - - SKAdNetworkIdentifier - s69wq72ugq.skadnetwork - - - SKAdNetworkIdentifier - su67r6k2v3.skadnetwork - - - SKAdNetworkIdentifier - u679fj5vs4.skadnetwork - - - SKAdNetworkIdentifier - w9q455wk68.skadnetwork - - - SKAdNetworkIdentifier - y45688jllp.skadnetwork - - - SKAdNetworkIdentifier - n38lu8286q.skadnetwork - - - SKAdNetworkIdentifier - v9wttpbfk9.skadnetwork - - - SKAdNetworkIdentifier - 252b5q8x7y.skadnetwork - - - SKAdNetworkIdentifier - 9g2aggbj52.skadnetwork - - - SKAdNetworkIdentifier - 238da6jt44.skadnetwork - - - SKAdNetworkIdentifier - x2jnk7ly8j.skadnetwork - - - SKAdNetworkIdentifier - 488r3q3dtq.skadnetwork - - - SKAdNetworkIdentifier - f7s53z58qe.skadnetwork - - - SKAdNetworkIdentifier - v79kvwwj4g.skadnetwork - - - SKAdNetworkIdentifier - ecpz2srf59.skadnetwork - - - SKAdNetworkIdentifier - gvmwg8q7h5.skadnetwork - - - SKAdNetworkIdentifier - pu4na253f3.skadnetwork - - - SKAdNetworkIdentifier - yrqqpx2mcb.skadnetwork - - - SKAdNetworkIdentifier - z4gj7hsk7h.skadnetwork - - - "; + " + + SKAdNetworkIdentifiersForMAX + + @" + SKAdNetworkIdentifier + x2jnk7ly8j.skadnetwork + " // 不知道哪儿来的,但是不删除 + + ""; list.AddKey(SKAdNetworkIdentifiers); ///*/facebook 深度连接 @@ -736,9 +831,9 @@ public class Package { fb fbapi fb-messenger-share-api + fbauth fbauth2 fbshareextension - fbapi20130214 fbapi20130410 fbapi20130702 @@ -749,8 +844,39 @@ public class Package { fbapi20150313 fbapi20150629 fbapi20160328 - fbauth - "; + fb-messenger-api + fb-messenger-api20140430 + fb-messenger-platform-20150128 + fb-messenger-platform-20150218 + fb-messenger-platform-20150305 + + NSAppTransportSecurity + + NSExceptionDomains + + facebook.com + + NSIncludesSubdomains + + NSThirdPartyExceptionRequiresForwardSecrecy + + + fbcdn.net + + NSIncludesSubdomains + + NSThirdPartyExceptionRequiresForwardSecrecy + + + akamaihd.net + + NSIncludesSubdomains + + NSThirdPartyExceptionRequiresForwardSecrecy + + + + "; list.AddKey(facebookStr); //*/ diff --git a/Assets/Plugins/Android/android-bridge.jar b/Assets/Plugins/Android/android-bridge.jar deleted file mode 100644 index d15783989..000000000 Binary files a/Assets/Plugins/Android/android-bridge.jar and /dev/null differ diff --git a/Assets/Plugins/Android/mainTemplate.gradle b/Assets/Plugins/Android/mainTemplate.gradle index 8ddf1fe3f..d792767dc 100644 --- a/Assets/Plugins/Android/mainTemplate.gradle +++ b/Assets/Plugins/Android/mainTemplate.gradle @@ -8,20 +8,29 @@ url "https://maven.google.com" } maven { - url "https://android-sdk.is.com/" // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:9, Assets/IronSource/Editor/ISAdColonyAdapterDependencies.xml:16, Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:16, Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:8, Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:8, Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:16, Assets/IronSource/Editor/ISFyberAdapterDependencies.xml:16, Assets/IronSource/Editor/ISLiftoffAdapterDependencies.xml:16, Assets/IronSource/Editor/ISPangleAdapterDependencies.xml:8, Assets/IronSource/Editor/ISTapJoyAdapterDependencies.xml:8, Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:8 + url "https://android-sdk.is.com/" // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:9, Assets/IronSource/Editor/ISAdColonyAdapterDependencies.xml:16, Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:16, Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:8, Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:8, Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:16, Assets/IronSource/Editor/ISFyberAdapterDependencies.xml:16, Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:48, Assets/IronSource/Editor/ISPangleAdapterDependencies.xml:8, Assets/IronSource/Editor/ISTapJoyAdapterDependencies.xml:8, Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:8, Assets/IronSource/Editor/ISVungleAdapterDependencies.xml:16, Assets/IronSourceAdQuality/Editor/IronSourceAdQualityDependencies.xml:9, Assets/IronSourceAdQuality/Editor/IronSourceAdQualityDependencies.xml:17 } maven { - url "https://maven.google.com/" // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:17, Assets/IronSource/Editor/IronSourceSDKDependencies.xml:25, Assets/IronSource/Editor/ISAdColonyAdapterDependencies.xml:8, Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:8, Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:15, Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:15, Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:8, Assets/IronSource/Editor/ISLiftoffAdapterDependencies.xml:8, Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:15 + url "https://maven.google.com/" // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:17, Assets/IronSource/Editor/IronSourceSDKDependencies.xml:25, Assets/IronSource/Editor/ISAdColonyAdapterDependencies.xml:8, Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:8, Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:15, Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:8, Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:40, Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:15 + } + maven { + url "https://cboost.jfrog.io/artifactory/chartboost-ads/" // Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:15 } maven { url "https://repo.maven.apache.org/maven2/" // Assets/IronSource/Editor/ISFyberAdapterDependencies.xml:8 } + maven { + url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea/" // Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:8, Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:16, Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:24, Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:32 + } maven { url "https://artifact.bytedance.com/repository/pangle/" // Assets/IronSource/Editor/ISPangleAdapterDependencies.xml:15 } maven { url "https://sdk.tapjoy.com/" // Assets/IronSource/Editor/ISTapJoyAdapterDependencies.xml:15 } + maven { + url "https://jitpack.io/" // Assets/IronSource/Editor/ISVungleAdapterDependencies.xml:8 + } mavenLocal() jcenter() mavenCentral() @@ -34,42 +43,50 @@ apply plugin: 'com.android.library' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // Android Resolver Dependencies Start + implementation 'androidx.recyclerview:recyclerview:1.2.1' // Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:40 implementation 'com.adcolony:sdk:4.8.0' // Assets/IronSource/Editor/ISAdColonyAdapterDependencies.xml:8 implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/ThirdParty/AppsFlyer/Editor/AppsFlyerDependencies.xml:10 implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency - implementation 'com.applovin:applovin-sdk:11.7.1' // Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:15 + implementation 'com.applovin:applovin-sdk:11.10.1' // Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:15 implementation 'com.appsflyer:af-android-sdk:6.4.1' // Assets/ThirdParty/AppsFlyer/Editor/AppsFlyerDependencies.xml:6 implementation 'com.appsflyer:unity-wrapper:6.4.1' // Assets/ThirdParty/AppsFlyer/Editor/AppsFlyerDependencies.xml:8 - implementation 'com.chartboost:chartboost-sdk:9.2.0' // Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:15 - implementation 'com.facebook.android:audience-network-sdk:6.12.0' // Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:8 + implementation 'com.chartboost:chartboost-sdk:9.3.1' // Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:15 + implementation 'com.facebook.android:audience-network-sdk:6.15.0' // Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:8 implementation 'com.facebook.android:facebook-applinks:[15.1,16)' // Assets/ThirdParty/FacebookSDK/Plugins/Editor/Dependencies.xml:6 implementation 'com.facebook.android:facebook-core:[15.1,16)' // Assets/ThirdParty/FacebookSDK/Plugins/Editor/Dependencies.xml:5 implementation 'com.facebook.android:facebook-gamingservices:[15.1,16)' // Assets/ThirdParty/FacebookSDK/Plugins/Editor/Dependencies.xml:9 implementation 'com.facebook.android:facebook-login:[15.1,16)' // Assets/ThirdParty/FacebookSDK/Plugins/Editor/Dependencies.xml:7 implementation 'com.facebook.android:facebook-share:[15.1,16)' // Assets/ThirdParty/FacebookSDK/Plugins/Editor/Dependencies.xml:8 - implementation 'com.fyber:marketplace-sdk:8.2.2' // Assets/IronSource/Editor/ISFyberAdapterDependencies.xml:8 - implementation 'com.google.android.gms:play-services-ads:21.5.0' // Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:8 + implementation 'com.fyber:marketplace-sdk:8.2.3' // Assets/IronSource/Editor/ISFyberAdapterDependencies.xml:8 + implementation 'com.google.android.gms:play-services-ads:22.2.0' // Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:8 implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:17 implementation 'com.google.android.gms:play-services-basement:18.1.0' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:25 implementation 'com.ironsource.adapters:adcolonyadapter:4.3.14' // Assets/IronSource/Editor/ISAdColonyAdapterDependencies.xml:16 - implementation 'com.ironsource.adapters:admobadapter:4.3.35' // Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:16 - implementation 'com.ironsource.adapters:applovinadapter:4.3.37' // Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:8 - implementation 'com.ironsource.adapters:chartboostadapter:4.3.11' // Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:8 - implementation 'com.ironsource.adapters:facebookadapter:4.3.39' // Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:16 - implementation 'com.ironsource.adapters:fyberadapter:4.3.24' // Assets/IronSource/Editor/ISFyberAdapterDependencies.xml:16 - implementation 'com.ironsource.adapters:liftoffadapter:4.3.5' // Assets/IronSource/Editor/ISLiftoffAdapterDependencies.xml:16 - implementation 'com.ironsource.adapters:pangleadapter:4.3.17' // Assets/IronSource/Editor/ISPangleAdapterDependencies.xml:8 - implementation 'com.ironsource.adapters:tapjoyadapter:4.1.24' // Assets/IronSource/Editor/ISTapJoyAdapterDependencies.xml:8 - implementation 'com.ironsource.adapters:unityadsadapter:4.3.27' // Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:8 - implementation 'com.ironsource.sdk:mediationsdk:7.3.0.1' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:9 - implementation 'com.pangle.global:ads-sdk:5.0.0.8' // Assets/IronSource/Editor/ISPangleAdapterDependencies.xml:15 + implementation 'com.ironsource.adapters:admobadapter:4.3.39' // Assets/IronSource/Editor/ISAdMobAdapterDependencies.xml:16 + implementation 'com.ironsource.adapters:applovinadapter:4.3.39' // Assets/IronSource/Editor/ISAppLovinAdapterDependencies.xml:8 + implementation 'com.ironsource.adapters:chartboostadapter:4.3.12' // Assets/IronSource/Editor/ISChartboostAdapterDependencies.xml:8 + implementation 'com.ironsource.adapters:facebookadapter:4.3.44' // Assets/IronSource/Editor/ISFacebookAdapterDependencies.xml:16 + implementation 'com.ironsource.adapters:fyberadapter:4.3.26' // Assets/IronSource/Editor/ISFyberAdapterDependencies.xml:16 + implementation 'com.ironsource.adapters:mintegraladapter:4.3.17' // Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:48 + implementation 'com.ironsource.adapters:pangleadapter:4.3.20' // Assets/IronSource/Editor/ISPangleAdapterDependencies.xml:8 + implementation 'com.ironsource.adapters:tapjoyadapter:4.1.25' // Assets/IronSource/Editor/ISTapJoyAdapterDependencies.xml:8 + implementation 'com.ironsource.adapters:unityadsadapter:4.3.31' // Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:8 + implementation 'com.ironsource.adapters:vungleadapter:4.3.21' // Assets/IronSource/Editor/ISVungleAdapterDependencies.xml:16 + implementation 'com.ironsource.sdk:mediationsdk:7.3.1.1' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:9 + implementation 'com.ironsource.unity:adqualitysdk:7.13.0' // Assets/IronSourceAdQuality/Editor/IronSourceAdQualityDependencies.xml:17 + implementation 'com.ironsource:adqualitysdk:7.13.0' // Assets/IronSourceAdQuality/Editor/IronSourceAdQualityDependencies.xml:9 + implementation 'com.mbridge.msdk.oversea:mbbanner:16.4.61' // Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:24 + implementation 'com.mbridge.msdk.oversea:mbbid:16.4.61' // Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:32 + implementation 'com.mbridge.msdk.oversea:newinterstitial:16.4.61' // Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:8 + implementation 'com.mbridge.msdk.oversea:reward:16.4.61' // Assets/IronSource/Editor/ISMintegralAdapterDependencies.xml:16 + implementation 'com.pangle.global:ads-sdk:5.2.0.6' // Assets/IronSource/Editor/ISPangleAdapterDependencies.xml:15 implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/ThirdParty/FacebookSDK/Plugins/Editor/Dependencies.xml:4 - implementation 'com.tapjoy:tapjoy-android-sdk:12.11.1' // Assets/IronSource/Editor/ISTapJoyAdapterDependencies.xml:15 - implementation 'com.unity3d.ads:unity-ads:4.6.1' // Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:15 - implementation 'io.liftoff:liftoffads:1.9.1' // Assets/IronSource/Editor/ISLiftoffAdapterDependencies.xml:8 + implementation 'com.tapjoy:tapjoy-android-sdk:13.0.1' // Assets/IronSource/Editor/ISTapJoyAdapterDependencies.xml:15 + implementation 'com.unity3d.ads:unity-ads:4.8.0' // Assets/IronSource/Editor/ISUnityAdsAdapterDependencies.xml:15 + implementation 'com.vungle:publisher-sdk-android:6.12.1' // Assets/IronSource/Editor/ISVungleAdapterDependencies.xml:8 // Android Resolver Dependencies End **DEPS**} diff --git a/Assets/Scripts/Common/SDK/BFIronSourceSDKManager.cs b/Assets/Scripts/Common/SDK/BFIronSourceSDKManager.cs index c76842d15..9334f4e0c 100644 --- a/Assets/Scripts/Common/SDK/BFIronSourceSDKManager.cs +++ b/Assets/Scripts/Common/SDK/BFIronSourceSDKManager.cs @@ -31,6 +31,7 @@ namespace BF // SDK init BFLog.Log("unity-script: IronSource.Agent.init"); + // IronSource.Agent.setMetaData("is_test_suite", "enable"); IronSource.Agent.init(appKey); IronSource.Agent.setManualLoadRewardedVideo(true); @@ -155,6 +156,8 @@ namespace BF void SdkInitializationCompletedEvent() { BFLog.Log("unity-script: I got SdkInitializationCompletedEvent"); + //Launch test suite + // IronSource.Agent.launchTestSuite(); } #endregion diff --git a/Assets/ThirdParty/IronSource/Editor/ISAdColonyAdapterDependencies.xml b/Assets/ThirdParty/IronSource/Editor/ISAdColonyAdapterDependencies.xml index 92430b2d4..8486dd659 100644 --- a/Assets/ThirdParty/IronSource/Editor/ISAdColonyAdapterDependencies.xml +++ b/Assets/ThirdParty/IronSource/Editor/ISAdColonyAdapterDependencies.xml @@ -1,5 +1,5 @@ - 4.3.19.0 + 4.3.19.1 @@ -17,7 +17,7 @@ + + + + + + \ No newline at end of file diff --git a/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/AndroidManifest.xml.meta b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/AndroidManifest.xml.meta new file mode 100644 index 000000000..6fefa34f8 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/AndroidManifest.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e46e3d39a8bec48d9ae81d0008842ad4 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs.meta b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs.meta new file mode 100644 index 000000000..87878ec88 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5936d92d17be4fde864e068dd13d202 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs/IronSource-bridge.jar b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs/IronSource-bridge.jar new file mode 100644 index 000000000..44dcadb64 Binary files /dev/null and b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs/IronSource-bridge.jar differ diff --git a/Assets/Plugins/Android/android-bridge.jar.meta b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs/IronSource-bridge.jar.meta similarity index 93% rename from Assets/Plugins/Android/android-bridge.jar.meta rename to Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs/IronSource-bridge.jar.meta index 03ad610d7..bd2869309 100644 --- a/Assets/Plugins/Android/android-bridge.jar.meta +++ b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/libs/IronSource-bridge.jar.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cbe75846a2b4da1459371181319ce8e3 +guid: f10a601320ff74e1e96ecfd77be278c5 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/project.properties b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/project.properties new file mode 100644 index 000000000..37b95eded --- /dev/null +++ b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/project.properties @@ -0,0 +1,2 @@ +target=android-9 +android.library=true \ No newline at end of file diff --git a/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/project.properties.meta b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/project.properties.meta new file mode 100644 index 000000000..3659560be --- /dev/null +++ b/Assets/ThirdParty/IronSource/Plugins/Android/IronSource.androidlib/project.properties.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f6d91e910c9af49d7a1d0254340e9dca +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Scripts/AdFormat.cs b/Assets/ThirdParty/IronSource/Scripts/AdFormat.cs new file mode 100644 index 000000000..87b7e2e3c --- /dev/null +++ b/Assets/ThirdParty/IronSource/Scripts/AdFormat.cs @@ -0,0 +1,22 @@ +using System; + +/// +/// Represents the available formats for displaying advertisements. +/// +public enum AdFormat +{ + /// + /// Represents a rewarded video ad format. + /// + RewardedVideo, + + /// + /// Represents an interstitial ad format. + /// + Interstitial, + + /// + /// Represents a banner ad format. + /// + Banner +} diff --git a/Assets/ThirdParty/IronSource/Scripts/AdFormat.cs.meta b/Assets/ThirdParty/IronSource/Scripts/AdFormat.cs.meta new file mode 100644 index 000000000..f7c929c45 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Scripts/AdFormat.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8124546645b9349f7858c4510ea7de78 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Scripts/AndroidAgent.cs b/Assets/ThirdParty/IronSource/Scripts/AndroidAgent.cs index 35cddf6cb..02822cbeb 100644 --- a/Assets/ThirdParty/IronSource/Scripts/AndroidAgent.cs +++ b/Assets/ThirdParty/IronSource/Scripts/AndroidAgent.cs @@ -2,15 +2,20 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System; public class AndroidAgent : IronSourceIAgent { - private static AndroidJavaObject _androidBridge; - private readonly static string AndroidBridge = "com.ironsource.unity.androidbridge.AndroidBridge"; - private const string REWARD_AMOUNT = "reward_amount"; - private const string REWARD_NAME = "reward_name"; - private const string PLACEMENT_NAME = "placement_name"; + static AndroidJavaObject _androidBridge; + readonly static string AndroidBridge = "com.ironsource.unity.androidbridge.AndroidBridge"; + const string REWARD_AMOUNT = "reward_amount"; + const string REWARD_NAME = "reward_name"; + const string PLACEMENT_NAME = "placement_name"; + + const string WATERFALL_CONFIG_FLOOR = "floor"; + const string WATERFALL_CONFIG_CEILING = "ceiling"; + const string WATERFALL_CONFIG_API = "setWaterfallConfiguration"; public AndroidAgent () { @@ -34,6 +39,48 @@ public class AndroidAgent : IronSourceIAgent //******************* Base API *******************// + /// + /// Allows publishers to set configurations for a waterfall of a given ad type. + /// + /// The configuration for the given ad types waterfall. + /// The AdFormat for which to configure the waterfall. + public void SetWaterfallConfiguration(WaterfallConfiguration waterfallConfiguration, AdFormat adFormat) + { + var ceiling = waterfallConfiguration.Ceiling; + var floor = waterfallConfiguration.Floor; + var dict = new Dictionary(); + + if (ceiling.HasValue) + { + dict.Add(WATERFALL_CONFIG_CEILING, ceiling.Value.ToString(CultureInfo.InvariantCulture)); + } + + if (floor.HasValue) + { + dict.Add(WATERFALL_CONFIG_FLOOR, floor.Value.ToString(CultureInfo.InvariantCulture)); + } + + var json = IronSourceJSON.Json.Serialize(dict); + string stringAdFormat; + + switch (adFormat) + { + case AdFormat.RewardedVideo: + stringAdFormat = "REWARDED_VIDEO"; + break; + case AdFormat.Interstitial: + stringAdFormat = "INTERSTITIAL"; + break; + case AdFormat.Banner: + stringAdFormat = "BANNER"; + break; + default: + return; + } + + getBridge().Call(WATERFALL_CONFIG_API, json, stringAdFormat); + } + public void onApplicationPause (bool pause) { if (pause) diff --git a/Assets/ThirdParty/IronSource/Scripts/IronSource.cs b/Assets/ThirdParty/IronSource/Scripts/IronSource.cs index 687c79d34..fb24165d0 100644 --- a/Assets/ThirdParty/IronSource/Scripts/IronSource.cs +++ b/Assets/ThirdParty/IronSource/Scripts/IronSource.cs @@ -7,7 +7,7 @@ public class IronSource : IronSourceIAgent { private IronSourceIAgent _platformAgent; private static IronSource _instance; - public static string UNITY_PLUGIN_VERSION = "7.3.0.1-r"; + public static string UNITY_PLUGIN_VERSION = "7.3.1.1-r"; private static bool isUnsupportedPlatform; private IronSource() @@ -67,6 +67,16 @@ public class IronSource : IronSourceIAgent //******************* Base API *******************// + /// + /// Allows publishers to set configurations for a waterfall of a given ad type. + /// + /// The configuration for the given ad types waterfall. + /// The AdFormat for which to configure the waterfall. + public void SetWaterfallConfiguration(WaterfallConfiguration waterfallConfiguration, AdFormat adFormat) + { + _platformAgent.SetWaterfallConfiguration(waterfallConfiguration, adFormat); + } + public void onApplicationPause(bool pause) { _platformAgent.onApplicationPause(pause); @@ -256,22 +266,26 @@ public class IronSource : IronSourceIAgent //******************* Offerwall API *******************// + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public void showOfferwall() { _platformAgent.showOfferwall(); } - public void showOfferwall(string placementName) + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] + public void showOfferwall(string placementName) { _platformAgent.showOfferwall(placementName); } - public void getOfferwallCredits() + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] + public void getOfferwallCredits() { _platformAgent.getOfferwallCredits(); } - public bool isOfferwallAvailable() + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] + public bool isOfferwallAvailable() { return _platformAgent.isOfferwallAvailable(); } diff --git a/Assets/ThirdParty/IronSource/Scripts/IronSourceEvents.cs b/Assets/ThirdParty/IronSource/Scripts/IronSourceEvents.cs index d779fc801..d1af2bc7d 100644 --- a/Assets/ThirdParty/IronSource/Scripts/IronSourceEvents.cs +++ b/Assets/ThirdParty/IronSource/Scripts/IronSourceEvents.cs @@ -83,11 +83,17 @@ public class IronSourceEvents : MonoBehaviour [Obsolete("This API has been deprecated as of SDK 7.3.0.1", false)] public static event Action onInterstitialAdShowFailedDemandOnlyEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallAvailableEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallOpenedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action> onOfferwallAdCreditedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onGetOfferwallCreditsFailedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallClosedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallShowFailedEvent; [Obsolete("This API has been deprecated as of SDK 7.3.0. Please use the alternate API in IronSourceBannerEvents listener instead.", false)] @@ -1643,6 +1649,7 @@ public class IronSourceEvents : MonoBehaviour private static event Action _onOfferwallOpenedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallOpenedEvent { add @@ -1672,6 +1679,7 @@ public class IronSourceEvents : MonoBehaviour private static event Action _onOfferwallShowFailedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallShowFailedEvent { add @@ -1702,6 +1710,7 @@ public class IronSourceEvents : MonoBehaviour private static event Action _onOfferwallClosedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallClosedEvent { add @@ -1731,6 +1740,7 @@ public class IronSourceEvents : MonoBehaviour private static event Action _onGetOfferwallCreditsFailedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onGetOfferwallCreditsFailedEvent { add @@ -1762,6 +1772,7 @@ public class IronSourceEvents : MonoBehaviour private static event Action> _onOfferwallAdCreditedEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action> onOfferwallAdCreditedEvent { add @@ -1789,6 +1800,7 @@ public class IronSourceEvents : MonoBehaviour private static event Action _onOfferwallAvailableEvent; + [Obsolete("This API call is for the ironSource Offerwall, which will soon be deprecated. Please migrate to the Tapjoy Offerwall using the 'Offerwall migration checklist'.", false)] public static event Action onOfferwallAvailableEvent { add diff --git a/Assets/ThirdParty/IronSource/Scripts/IronSourceIAgent.cs b/Assets/ThirdParty/IronSource/Scripts/IronSourceIAgent.cs index 606899da1..cf04746d4 100644 --- a/Assets/ThirdParty/IronSource/Scripts/IronSourceIAgent.cs +++ b/Assets/ThirdParty/IronSource/Scripts/IronSourceIAgent.cs @@ -4,6 +4,13 @@ public interface IronSourceIAgent { //******************* Base API *******************// + /// + /// Allows publishers to set configurations for a waterfall of a given ad type. + /// + /// The configuration for the given ad types waterfall. + /// The AdFormat for which to configure the waterfall. + void SetWaterfallConfiguration(WaterfallConfiguration waterfallConfiguration, AdFormat adFormat); + void onApplicationPause(bool pause); string getAdvertiserId(); diff --git a/Assets/ThirdParty/IronSource/Scripts/UnsupportedPlatformAgent.cs b/Assets/ThirdParty/IronSource/Scripts/UnsupportedPlatformAgent.cs index 9ded181d7..49498facc 100644 --- a/Assets/ThirdParty/IronSource/Scripts/UnsupportedPlatformAgent.cs +++ b/Assets/ThirdParty/IronSource/Scripts/UnsupportedPlatformAgent.cs @@ -10,6 +10,15 @@ public class UnsupportedPlatformAgent : IronSourceIAgent } #region IronSourceAgent implementation + + /// + /// This function is not supported on the current platform and does nothing. + /// + /// The configuration for the given ad types waterfall. + /// The AdFormat for which to configure the waterfall. + public void SetWaterfallConfiguration(WaterfallConfiguration waterfallConfiguration, AdFormat adFormat) + { + } public void start() { diff --git a/Assets/ThirdParty/IronSource/Scripts/WaterfallConfiguration.cs b/Assets/ThirdParty/IronSource/Scripts/WaterfallConfiguration.cs new file mode 100644 index 000000000..a3da4edc5 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Scripts/WaterfallConfiguration.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using System; + +/// +/// Configuration class which allows users to customize or filter a Waterfall. +/// +public class WaterfallConfiguration +{ + readonly double? ceiling; + readonly double? floor; + + /// + /// Gets the ceiling value. + /// + public double? Ceiling { get { return ceiling; } } + + /// + /// Gets the floor value. + /// + public double? Floor { get { return floor; } } + + /// + /// Initializes a new instance of the WaterfallConfiguration class. + /// + /// The ceiling value. + /// The floor value. + private WaterfallConfiguration(double? ceiling, double? floor) + { + this.ceiling = ceiling; + this.floor = floor; + } + + /// + /// Gets a builder for creating instances of WaterfallConfiguration. + /// + /// The WaterfallConfigurationBuilder. + public static WaterfallConfigurationBuilder Builder() + { + return new WaterfallConfigurationBuilder(); + } + + /// + /// Creates an empty instance of WaterfallConfiguration. + /// + /// The empty WaterfallConfiguration. + public static WaterfallConfiguration Empty() + { + return new WaterfallConfiguration(double.NaN, double.NaN); + } + + /// + /// Builder class which to create a WaterfallConfiguration. + /// + public class WaterfallConfigurationBuilder + { + double? ceiling; + double? floor; + + internal WaterfallConfigurationBuilder() {} + + /// + /// Sets the ceiling value. + /// + /// The ceiling value. + /// The WaterfallConfigurationBuilder. + public WaterfallConfigurationBuilder SetCeiling(double ceiling) + { + this.ceiling = ceiling; + return this; + } + + /// + /// Sets the floor value. + /// + /// The floor value. + /// The WaterfallConfigurationBuilder. + public WaterfallConfigurationBuilder SetFloor(double floor) + { + this.floor = floor; + return this; + } + + /// + /// Builds an instance of WaterfallConfiguration based on the configured values. + /// + /// The created WaterfallConfiguration. + public WaterfallConfiguration Build() + { + return new WaterfallConfiguration(ceiling, floor); + } + } +} diff --git a/Assets/ThirdParty/IronSource/Scripts/WaterfallConfiguration.cs.meta b/Assets/ThirdParty/IronSource/Scripts/WaterfallConfiguration.cs.meta new file mode 100644 index 000000000..0874d8447 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Scripts/WaterfallConfiguration.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 354652886a99945cba942b569effe7bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Scripts/iOSAgent.cs b/Assets/ThirdParty/IronSource/Scripts/iOSAgent.cs index 4c02b6bf2..ab8bde2d6 100644 --- a/Assets/ThirdParty/IronSource/Scripts/iOSAgent.cs +++ b/Assets/ThirdParty/IronSource/Scripts/iOSAgent.cs @@ -1,508 +1,533 @@ #if UNITY_IPHONE || UNITY_IOS using UnityEngine; -using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; -using System.Linq; using System; using System.Globalization; + // public class iOSAgent : IronSourceIAgent // { - // [DllImport("__Internal")] - // private static extern void CFSetPluginData(string pluginType, string pluginVersion, string pluginFrameworkVersion); + +// struct IOSWaterfallConfiguration +// { +// public double Floor; +// public double Ceiling; +// } + +// [DllImport("__Internal")] +// private static extern void LPPSetWaterfallConfiguration(IOSWaterfallConfiguration configurationParams, AdFormat adFormat); + +// [DllImport("__Internal")] +// private static extern void CFSetPluginData(string pluginType, string pluginVersion, string pluginFrameworkVersion); - // [DllImport("__Internal")] - // private static extern string CFGetAdvertiserId(); +// [DllImport("__Internal")] +// private static extern string CFGetAdvertiserId(); - // [DllImport("__Internal")] - // private static extern void CFValidateIntegration(); +// [DllImport("__Internal")] +// private static extern void CFValidateIntegration(); - // [DllImport("__Internal")] - // private static extern void CFShouldTrackNetworkState(bool track); +// [DllImport("__Internal")] +// private static extern void CFShouldTrackNetworkState(bool track); - // [DllImport("__Internal")] - // private static extern bool CFSetDynamicUserId(string dynamicUserId); +// [DllImport("__Internal")] +// private static extern bool CFSetDynamicUserId(string dynamicUserId); - // [DllImport("__Internal")] - // private static extern void CFSetAdaptersDebug(bool enabled); +// [DllImport("__Internal")] +// private static extern void CFSetAdaptersDebug(bool enabled); - // [DllImport("__Internal")] - // private static extern void CFSetMetaData(string key, string value); +// [DllImport("__Internal")] +// private static extern void CFSetMetaData(string key, string value); - // [DllImport("__Internal")] - // private static extern void CFSetMetaDataWithValues(string key, params string[] values); +// [DllImport("__Internal")] +// private static extern void CFSetMetaDataWithValues(string key, params string[] values); - // [DllImport("__Internal")] - // private static extern string CFGetConversionValue(); +// [DllImport("__Internal")] +// private static extern string CFGetConversionValue(); - // [DllImport("__Internal")] - // private static extern void CFSetManualLoadRewardedVideo(bool isOn); +// [DllImport("__Internal")] +// private static extern void CFSetManualLoadRewardedVideo(bool isOn); - // [DllImport("__Internal")] - // private static extern void CFSetNetworkData(string networkKey, string networkData); +// [DllImport("__Internal")] +// private static extern void CFSetNetworkData(string networkKey, string networkData); - // delegate void ISUnityPauseGame(bool pause); - // [DllImport("__Internal")] - // private static extern void RegisterPauseGameFunction(bool pasue); +// delegate void ISUnityPauseGame(bool pause); +// [DllImport("__Internal")] +// private static extern void RegisterPauseGameFunction(bool pasue); - // //******************* SDK Init *******************// +// //******************* SDK Init *******************// - // [DllImport("__Internal")] - // private static extern void CFSetUserId(string userId); +// [DllImport("__Internal")] +// private static extern void CFSetUserId(string userId); - // [DllImport("__Internal")] - // private static extern void CFInit(string appKey); +// [DllImport("__Internal")] +// private static extern void CFInit(string appKey); - // [DllImport("__Internal")] - // private static extern void CFInitWithAdUnits(string appKey, params string[] adUnits); +// [DllImport("__Internal")] +// private static extern void CFInitWithAdUnits(string appKey, params string[] adUnits); - // [DllImport("__Internal")] - // private static extern void CFInitISDemandOnly(string appKey, params string[] adUnits); +// [DllImport("__Internal")] +// private static extern void CFInitISDemandOnly(string appKey, params string[] adUnits); - // //******************* RewardedVideo API *******************// +// //******************* RewardedVideo API *******************// - // [DllImport("__Internal")] - // private static extern void CFLoadRewardedVideo(); +// [DllImport("__Internal")] +// private static extern void CFLoadRewardedVideo(); - // [DllImport("__Internal")] - // private static extern void CFShowRewardedVideo(); +// [DllImport("__Internal")] +// private static extern void CFShowRewardedVideo(); - // [DllImport("__Internal")] - // private static extern void CFShowRewardedVideoWithPlacementName(string placementName); +// [DllImport("__Internal")] +// private static extern void CFShowRewardedVideoWithPlacementName(string placementName); - // [DllImport("__Internal")] - // private static extern bool CFIsRewardedVideoAvailable(); +// [DllImport("__Internal")] +// private static extern bool CFIsRewardedVideoAvailable(); - // [DllImport("__Internal")] - // private static extern bool CFIsRewardedVideoPlacementCapped(string placementName); +// [DllImport("__Internal")] +// private static extern bool CFIsRewardedVideoPlacementCapped(string placementName); - // [DllImport("__Internal")] - // private static extern string CFGetPlacementInfo(string placementName); +// [DllImport("__Internal")] +// private static extern string CFGetPlacementInfo(string placementName); - // [DllImport("__Internal")] - // private static extern void CFSetRewardedVideoServerParameters(string jsonString); +// [DllImport("__Internal")] +// private static extern void CFSetRewardedVideoServerParameters(string jsonString); - // [DllImport("__Internal")] - // private static extern void CFClearRewardedVideoServerParameters(); +// [DllImport("__Internal")] +// private static extern void CFClearRewardedVideoServerParameters(); - // //******************* RewardedVideo DemandOnly API *******************// +// //******************* RewardedVideo DemandOnly API *******************// - // [DllImport("__Internal")] - // private static extern void CFShowISDemandOnlyRewardedVideo(string instanceId); +// [DllImport("__Internal")] +// private static extern void CFShowISDemandOnlyRewardedVideo(string instanceId); - // [DllImport("__Internal")] - // private static extern void CFLoadISDemandOnlyRewardedVideo(string instanceId); +// [DllImport("__Internal")] +// private static extern void CFLoadISDemandOnlyRewardedVideo(string instanceId); - // [DllImport("__Internal")] - // private static extern bool CFIsDemandOnlyRewardedVideoAvailable(string instanceId); +// [DllImport("__Internal")] +// private static extern bool CFIsDemandOnlyRewardedVideoAvailable(string instanceId); - // //******************* Interstitial API *******************// +// //******************* Interstitial API *******************// - // [DllImport("__Internal")] - // private static extern void CFLoadInterstitial(); +// [DllImport("__Internal")] +// private static extern void CFLoadInterstitial(); - // [DllImport("__Internal")] - // private static extern void CFShowInterstitial(); +// [DllImport("__Internal")] +// private static extern void CFShowInterstitial(); - // [DllImport("__Internal")] - // private static extern void CFShowInterstitialWithPlacementName(string placementName); +// [DllImport("__Internal")] +// private static extern void CFShowInterstitialWithPlacementName(string placementName); - // [DllImport("__Internal")] - // private static extern bool CFIsInterstitialReady(); +// [DllImport("__Internal")] +// private static extern bool CFIsInterstitialReady(); - // [DllImport("__Internal")] - // private static extern bool CFIsInterstitialPlacementCapped(string placementName); +// [DllImport("__Internal")] +// private static extern bool CFIsInterstitialPlacementCapped(string placementName); - // //******************* Interstitial DemandOnly API *******************// +// //******************* Interstitial DemandOnly API *******************// - // [DllImport("__Internal")] - // private static extern void CFLoadISDemandOnlyInterstitial(string instanceId); +// [DllImport("__Internal")] +// private static extern void CFLoadISDemandOnlyInterstitial(string instanceId); - // [DllImport("__Internal")] - // private static extern void CFShowISDemandOnlyInterstitial(string instanceId); +// [DllImport("__Internal")] +// private static extern void CFShowISDemandOnlyInterstitial(string instanceId); - // [DllImport("__Internal")] - // private static extern bool CFIsDemandOnlyInterstitialReady(string instanceId); +// [DllImport("__Internal")] +// private static extern bool CFIsDemandOnlyInterstitialReady(string instanceId); - // //******************* Offerwall API *******************// +// //******************* Offerwall API *******************// - // [DllImport("__Internal")] - // private static extern void CFShowOfferwall(); +// [DllImport("__Internal")] +// private static extern void CFShowOfferwall(); - // [DllImport("__Internal")] - // private static extern void CFShowOfferwallWithPlacementName(string placementName); +// [DllImport("__Internal")] +// private static extern void CFShowOfferwallWithPlacementName(string placementName); - // [DllImport("__Internal")] - // private static extern void CFGetOfferwallCredits(); +// [DllImport("__Internal")] +// private static extern void CFGetOfferwallCredits(); - // [DllImport("__Internal")] - // private static extern bool CFIsOfferwallAvailable(); +// [DllImport("__Internal")] +// private static extern bool CFIsOfferwallAvailable(); - // //******************* Banner API *******************// +// //******************* Banner API *******************// - // [DllImport("__Internal")] - // private static extern void CFLoadBanner(string description, int width, int height, int position, string placementName, bool isAdaptive); +// [DllImport("__Internal")] +// private static extern void CFLoadBanner(string description, int width, int height, int position, string placementName, bool isAdaptive); - // [DllImport("__Internal")] - // private static extern void CFDestroyBanner(); +// [DllImport("__Internal")] +// private static extern void CFDestroyBanner(); - // [DllImport("__Internal")] - // private static extern void CFDisplayBanner(); +// [DllImport("__Internal")] +// private static extern void CFDisplayBanner(); - // [DllImport("__Internal")] - // private static extern void CFHideBanner(); +// [DllImport("__Internal")] +// private static extern void CFHideBanner(); - // [DllImport("__Internal")] - // private static extern bool CFIsBannerPlacementCapped(string placementName); +// [DllImport("__Internal")] +// private static extern bool CFIsBannerPlacementCapped(string placementName); - // [DllImport("__Internal")] - // private static extern void CFSetSegment(string json); +// [DllImport("__Internal")] +// private static extern void CFSetSegment(string json); - // [DllImport("__Internal")] - // private static extern void CFSetConsent(bool consent); +// [DllImport("__Internal")] +// private static extern void CFSetConsent(bool consent); - // //******************* ConsentView API *******************// +// //******************* ConsentView API *******************// - // [DllImport("__Internal")] - // private static extern void CFLoadConsentViewWithType(string consentViewType); +// [DllImport("__Internal")] +// private static extern void CFLoadConsentViewWithType(string consentViewType); - // [DllImport("__Internal")] - // private static extern void CFShowConsentViewWithType(string consentViewType); +// [DllImport("__Internal")] +// private static extern void CFShowConsentViewWithType(string consentViewType); - // //******************* ILRD API *******************// +// //******************* ILRD API *******************// - // [DllImport("__Internal")] - // private static extern void CFSetAdRevenueData(string dataSource, string impressionData); +// [DllImport("__Internal")] +// private static extern void CFSetAdRevenueData(string dataSource, string impressionData); - // //******************* TestSuite API *******************// +// //******************* TestSuite API *******************// - // [DllImport("__Internal")] - // private static extern void CFLaunchTestSuite(); +// [DllImport("__Internal")] +// private static extern void CFLaunchTestSuite(); - // public iOSAgent() - // { - // } +// public iOSAgent() +// { +// } - // #region IronSourceIAgent implementation +// #region IronSourceIAgent implementation - // //******************* Base API *******************// +// //******************* Base API *******************// - // public void onApplicationPause(bool pause) - // { +// /// +// /// Allows publishers to set configurations for a waterfall of a given ad type. +// /// +// /// The AdFormat for which to configure the waterfall. +// /// The configuration for the given ad types waterfall. +// public void SetWaterfallConfiguration(WaterfallConfiguration waterfallConfiguration, AdFormat adFormat) +// { +// var config = new IOSWaterfallConfiguration +// { +// Floor = waterfallConfiguration.Floor ?? 0.0, +// Ceiling = waterfallConfiguration.Ceiling ?? 0.0 +// }; + +// LPPSetWaterfallConfiguration(config, adFormat); +// } - // } +// public void onApplicationPause(bool pause) +// { - // public string getAdvertiserId() - // { - // return CFGetAdvertiserId(); - // } +// } - // public void validateIntegration() - // { - // CFValidateIntegration(); - // } - - // public void shouldTrackNetworkState(bool track) - // { - // CFShouldTrackNetworkState(track); - // } - - // public bool setDynamicUserId(string dynamicUserId) - // { - // return CFSetDynamicUserId(dynamicUserId); - // } - - // public void setAdaptersDebug(bool enabled) - // { - // CFSetAdaptersDebug(enabled); - // } - - // public void setMetaData(string key, params string[] values) - // { - // CFSetMetaDataWithValues(key, values); - // } - - // public void setMetaData(string key, string value) - // { - // CFSetMetaData(key, value); - // } - - // public int? getConversionValue() - // { - // CultureInfo invCulture = CultureInfo.InvariantCulture; - // int parsedInt; - // if (int.TryParse(string.Format(invCulture, "{0}", CFGetConversionValue()), NumberStyles.Any, invCulture, out parsedInt)) - // { - // return parsedInt; - // } - - // return null; - // } - - // public void setManualLoadRewardedVideo(bool isOn) - // { - // CFSetManualLoadRewardedVideo(isOn); - // } - - // public void setNetworkData(string networkKey, string networkData) - // { - // CFSetNetworkData(networkKey, networkData); - // } - - // [AOT.MonoPInvokeCallback(typeof(ISUnityPauseGame))] - // public void SetPauseGame(bool pause) - // { - // RegisterPauseGameFunction(pause); - // if (pause) - // { - // setMetaData("IS_PAUSE_GAME_FLAG", "true"); - // } - // else - // { - // setMetaData("IS_PAUSE_GAME_FLAG", "false"); - // } - // } - - // //******************* SDK Init *******************// - - // public void setUserId(string userId) - // { - // CFSetUserId(userId); - // } - - // public void init(string appKey) - // { - // CFSetPluginData("Unity", IronSource.pluginVersion(), IronSource.unityVersion()); - // Debug.Log("IntegrationHelper pluginVersion: " + IronSource.pluginVersion()); - // CFInit(appKey); - // } - - // public void init(string appKey, params string[] adUnits) - // { - // CFSetPluginData("Unity", IronSource.pluginVersion(), IronSource.unityVersion()); - // Debug.Log("IntegrationHelper pluginVersion: " + IronSource.pluginVersion()); - // CFInitWithAdUnits(appKey, adUnits); - // } - - // public void initISDemandOnly(string appKey, params string[] adUnits) - // { - // CFSetPluginData("Unity", IronSource.pluginVersion(), IronSource.unityVersion()); - // Debug.Log("IntegrationHelper pluginVersion: " + IronSource.pluginVersion()); - // CFInitISDemandOnly(appKey, adUnits); - // } - - // //******************* RewardedVideo API *******************// - - // public void loadRewardedVideo() - // { - // CFLoadRewardedVideo(); - // } - - // public void showRewardedVideo() - // { - // CFShowRewardedVideo(); - // } - - // public void showRewardedVideo(string placementName) - // { - // CFShowRewardedVideoWithPlacementName(placementName); - // } - - // public bool isRewardedVideoAvailable() - // { - // return CFIsRewardedVideoAvailable(); - // } - - // public bool isRewardedVideoPlacementCapped(string placementName) - // { - // return CFIsRewardedVideoPlacementCapped(placementName); - // } - - // public IronSourcePlacement getPlacementInfo(string placementName) - // { - // IronSourcePlacement sp = null; - - // string spString = CFGetPlacementInfo(placementName); - // if (spString != null) - // { - // Dictionary spDic = IronSourceJSON.Json.Deserialize(spString) as Dictionary; - // string pName = spDic["placement_name"].ToString(); - // string rewardName = spDic["reward_name"].ToString(); - // int rewardAmount = Convert.ToInt32(spDic["reward_amount"].ToString()); - // sp = new IronSourcePlacement(pName, rewardName, rewardAmount); - // } - - // return sp; - // } - - // public void setRewardedVideoServerParams(Dictionary parameters) - // { - // string json = IronSourceJSON.Json.Serialize(parameters); - // CFSetRewardedVideoServerParameters(json); - // } - - // public void clearRewardedVideoServerParams() - // { - // CFClearRewardedVideoServerParameters(); - // } - - // //******************* RewardedVideo DemandOnly API *******************// - - // public void showISDemandOnlyRewardedVideo(string instanceId) - // { - // CFShowISDemandOnlyRewardedVideo(instanceId); - // } - - // public void loadISDemandOnlyRewardedVideo(string instanceId) - // { - // CFLoadISDemandOnlyRewardedVideo(instanceId); - // } - - // public bool isISDemandOnlyRewardedVideoAvailable(string instanceId) - // { - // return CFIsDemandOnlyRewardedVideoAvailable(instanceId); - // } - - // //******************* Interstitial API *******************// - - // public void loadInterstitial() - // { - // CFLoadInterstitial(); - // } - - // public void showInterstitial() - // { - // CFShowInterstitial(); - // } - - // public void showInterstitial(string placementName) - // { - // CFShowInterstitialWithPlacementName(placementName); - // } - - // public bool isInterstitialReady() - // { - // return CFIsInterstitialReady(); - // } - - // public bool isInterstitialPlacementCapped(string placementName) - // { - // return CFIsInterstitialPlacementCapped(placementName); - // } - - // //******************* Interstitial DemandOnly API *******************// - - // public void loadISDemandOnlyInterstitial(string instanceId) - // { - // CFLoadISDemandOnlyInterstitial(instanceId); - // } - - // public void showISDemandOnlyInterstitial(string instanceId) - // { - // CFShowISDemandOnlyInterstitial(instanceId); - // } - - // public bool isISDemandOnlyInterstitialReady(string instanceId) - // { - // return CFIsDemandOnlyInterstitialReady(instanceId); - // } - - // //******************* Offerwall API *******************// - - // public void showOfferwall() - // { - // CFShowOfferwall(); - // } - - // public void showOfferwall(string placementName) - // { - // CFShowOfferwallWithPlacementName(placementName); - // } - - // public void getOfferwallCredits() - // { - // CFGetOfferwallCredits(); - // } - - // public bool isOfferwallAvailable() - // { - // return CFIsOfferwallAvailable(); - // } - - // //******************* Banner API *******************// - - // public void loadBanner(IronSourceBannerSize size, IronSourceBannerPosition position) - // { - // loadBanner(size, position, ""); - // } - - // public void loadBanner(IronSourceBannerSize size, IronSourceBannerPosition position, string placementName) - // { - // CFLoadBanner(size.Description, (int)size.Width, (int)size.Height, (int)position, placementName, (bool)size.IsAdaptiveEnabled()); - // } - - // public void destroyBanner() - // { - // CFDestroyBanner(); - // } - - // public void displayBanner() - // { - // CFDisplayBanner(); - // } - - // public void hideBanner() - // { - // CFHideBanner(); - // } - - // public bool isBannerPlacementCapped(string placementName) - // { - // return CFIsBannerPlacementCapped(placementName); - // } - - // public void setSegment(IronSourceSegment segment) - // { - // Dictionary dict = segment.getSegmentAsDict(); - // string json = IronSourceJSON.Json.Serialize(dict); - // CFSetSegment(json); - // } - - // public void setConsent(bool consent) - // { - // CFSetConsent(consent); - // } - - // public void loadConsentViewWithType(string consentViewType) - // { - // CFLoadConsentViewWithType(consentViewType); - // } - - // public void showConsentViewWithType(string consentViewType) - // { - // CFShowConsentViewWithType(consentViewType); - // } - - // //******************* ILRD API *******************// - - // public void setAdRevenueData(string dataSource, Dictionary impressionData) - // { - // string json = IronSourceJSON.Json.Serialize(impressionData); - // CFSetAdRevenueData(dataSource, json); - // } - - // //******************* TestSuite API *******************// - - // public void launchTestSuite() - // { - // Debug.Log("iOSAgent: launching TestSuite"); - // CFLaunchTestSuite(); - // } - - // #endregion +// public string getAdvertiserId() +// { +// return CFGetAdvertiserId(); +// } + +// public void validateIntegration() +// { +// CFValidateIntegration(); +// } + +// public void shouldTrackNetworkState(bool track) +// { +// CFShouldTrackNetworkState(track); +// } + +// public bool setDynamicUserId(string dynamicUserId) +// { +// return CFSetDynamicUserId(dynamicUserId); +// } + +// public void setAdaptersDebug(bool enabled) +// { +// CFSetAdaptersDebug(enabled); +// } + +// public void setMetaData(string key, params string[] values) +// { +// CFSetMetaDataWithValues(key, values); +// } + +// public void setMetaData(string key, string value) +// { +// CFSetMetaData(key, value); +// } + +// public int? getConversionValue() +// { +// CultureInfo invCulture = CultureInfo.InvariantCulture; +// int parsedInt; +// if (int.TryParse(string.Format(invCulture, "{0}", CFGetConversionValue()), NumberStyles.Any, invCulture, out parsedInt)) +// { +// return parsedInt; +// } + +// return null; +// } + +// public void setManualLoadRewardedVideo(bool isOn) +// { +// CFSetManualLoadRewardedVideo(isOn); +// } + +// public void setNetworkData(string networkKey, string networkData) +// { +// CFSetNetworkData(networkKey, networkData); +// } + +// [AOT.MonoPInvokeCallback(typeof(ISUnityPauseGame))] +// public void SetPauseGame(bool pause) +// { +// RegisterPauseGameFunction(pause); +// if (pause) +// { +// setMetaData("IS_PAUSE_GAME_FLAG", "true"); +// } +// else +// { +// setMetaData("IS_PAUSE_GAME_FLAG", "false"); +// } +// } + +// //******************* SDK Init *******************// + +// public void setUserId(string userId) +// { +// CFSetUserId(userId); +// } + +// public void init(string appKey) +// { +// CFSetPluginData("Unity", IronSource.pluginVersion(), IronSource.unityVersion()); +// Debug.Log("IntegrationHelper pluginVersion: " + IronSource.pluginVersion()); +// CFInit(appKey); +// } + +// public void init(string appKey, params string[] adUnits) +// { +// CFSetPluginData("Unity", IronSource.pluginVersion(), IronSource.unityVersion()); +// Debug.Log("IntegrationHelper pluginVersion: " + IronSource.pluginVersion()); +// CFInitWithAdUnits(appKey, adUnits); +// } + +// public void initISDemandOnly(string appKey, params string[] adUnits) +// { +// CFSetPluginData("Unity", IronSource.pluginVersion(), IronSource.unityVersion()); +// Debug.Log("IntegrationHelper pluginVersion: " + IronSource.pluginVersion()); +// CFInitISDemandOnly(appKey, adUnits); +// } + +// //******************* RewardedVideo API *******************// + +// public void loadRewardedVideo() +// { +// CFLoadRewardedVideo(); +// } + +// public void showRewardedVideo() +// { +// CFShowRewardedVideo(); +// } + +// public void showRewardedVideo(string placementName) +// { +// CFShowRewardedVideoWithPlacementName(placementName); +// } + +// public bool isRewardedVideoAvailable() +// { +// return CFIsRewardedVideoAvailable(); +// } + +// public bool isRewardedVideoPlacementCapped(string placementName) +// { +// return CFIsRewardedVideoPlacementCapped(placementName); +// } + +// public IronSourcePlacement getPlacementInfo(string placementName) +// { +// IronSourcePlacement sp = null; + +// string spString = CFGetPlacementInfo(placementName); +// if (spString != null) +// { +// Dictionary spDic = IronSourceJSON.Json.Deserialize(spString) as Dictionary; +// string pName = spDic["placement_name"].ToString(); +// string rewardName = spDic["reward_name"].ToString(); +// int rewardAmount = Convert.ToInt32(spDic["reward_amount"].ToString()); +// sp = new IronSourcePlacement(pName, rewardName, rewardAmount); +// } + +// return sp; +// } + +// public void setRewardedVideoServerParams(Dictionary parameters) +// { +// string json = IronSourceJSON.Json.Serialize(parameters); +// CFSetRewardedVideoServerParameters(json); +// } + +// public void clearRewardedVideoServerParams() +// { +// CFClearRewardedVideoServerParameters(); +// } + +// //******************* RewardedVideo DemandOnly API *******************// + +// public void showISDemandOnlyRewardedVideo(string instanceId) +// { +// CFShowISDemandOnlyRewardedVideo(instanceId); +// } + +// public void loadISDemandOnlyRewardedVideo(string instanceId) +// { +// CFLoadISDemandOnlyRewardedVideo(instanceId); +// } + +// public bool isISDemandOnlyRewardedVideoAvailable(string instanceId) +// { +// return CFIsDemandOnlyRewardedVideoAvailable(instanceId); +// } + +// //******************* Interstitial API *******************// + +// public void loadInterstitial() +// { +// CFLoadInterstitial(); +// } + +// public void showInterstitial() +// { +// CFShowInterstitial(); +// } + +// public void showInterstitial(string placementName) +// { +// CFShowInterstitialWithPlacementName(placementName); +// } + +// public bool isInterstitialReady() +// { +// return CFIsInterstitialReady(); +// } + +// public bool isInterstitialPlacementCapped(string placementName) +// { +// return CFIsInterstitialPlacementCapped(placementName); +// } + +// //******************* Interstitial DemandOnly API *******************// + +// public void loadISDemandOnlyInterstitial(string instanceId) +// { +// CFLoadISDemandOnlyInterstitial(instanceId); +// } + +// public void showISDemandOnlyInterstitial(string instanceId) +// { +// CFShowISDemandOnlyInterstitial(instanceId); +// } + +// public bool isISDemandOnlyInterstitialReady(string instanceId) +// { +// return CFIsDemandOnlyInterstitialReady(instanceId); +// } + +// //******************* Offerwall API *******************// + +// public void showOfferwall() +// { +// CFShowOfferwall(); +// } + +// public void showOfferwall(string placementName) +// { +// CFShowOfferwallWithPlacementName(placementName); +// } + +// public void getOfferwallCredits() +// { +// CFGetOfferwallCredits(); +// } + +// public bool isOfferwallAvailable() +// { +// return CFIsOfferwallAvailable(); +// } + +// //******************* Banner API *******************// + +// public void loadBanner(IronSourceBannerSize size, IronSourceBannerPosition position) +// { +// loadBanner(size, position, ""); +// } + +// public void loadBanner(IronSourceBannerSize size, IronSourceBannerPosition position, string placementName) +// { +// CFLoadBanner(size.Description, (int)size.Width, (int)size.Height, (int)position, placementName, (bool)size.IsAdaptiveEnabled()); +// } + +// public void destroyBanner() +// { +// CFDestroyBanner(); +// } + +// public void displayBanner() +// { +// CFDisplayBanner(); +// } + +// public void hideBanner() +// { +// CFHideBanner(); +// } + +// public bool isBannerPlacementCapped(string placementName) +// { +// return CFIsBannerPlacementCapped(placementName); +// } + +// public void setSegment(IronSourceSegment segment) +// { +// Dictionary dict = segment.getSegmentAsDict(); +// string json = IronSourceJSON.Json.Serialize(dict); +// CFSetSegment(json); +// } + +// public void setConsent(bool consent) +// { +// CFSetConsent(consent); +// } + +// public void loadConsentViewWithType(string consentViewType) +// { +// CFLoadConsentViewWithType(consentViewType); +// } + +// public void showConsentViewWithType(string consentViewType) +// { +// CFShowConsentViewWithType(consentViewType); +// } + +// //******************* ILRD API *******************// + +// public void setAdRevenueData(string dataSource, Dictionary impressionData) +// { +// string json = IronSourceJSON.Json.Serialize(impressionData); +// CFSetAdRevenueData(dataSource, json); +// } + +// //******************* TestSuite API *******************// + +// public void launchTestSuite() +// { +// Debug.Log("iOSAgent: launching TestSuite"); +// CFLaunchTestSuite(); +// } + +// #endregion // } #endif diff --git a/Assets/ThirdParty/MaxSdk/AppLovin/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/AppLovin/Editor/Dependencies.xml index cd1ad3ea2..961447f0b 100644 --- a/Assets/ThirdParty/MaxSdk/AppLovin/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/AppLovin/Editor/Dependencies.xml @@ -1,9 +1,9 @@ - + - + diff --git a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h index 87e5b6803..ef99b5ab9 100644 --- a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h +++ b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h @@ -16,6 +16,7 @@ typedef void (*ALUnityBackgroundCallback)(const char* args); - (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)bannerPosition; - (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; +- (void)loadBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setBannerBackgroundColorForAdUnitIdentifier:(NSString *)adUnitIdentifier hexColorCode:(NSString *)hexColorCode; - (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)startBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; @@ -34,6 +35,7 @@ typedef void (*ALUnityBackgroundCallback)(const char* args); - (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)mrecPosition; - (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; +- (void)loadMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)startMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)stopMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifer; @@ -61,6 +63,12 @@ typedef void (*ALUnityBackgroundCallback)(const char* args); - (void)setInterstitialExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; - (void)setInterstitialLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; +- (void)loadAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; +- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; +- (void)showAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; +- (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; +- (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; + - (void)loadRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)showRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; @@ -85,8 +93,11 @@ typedef void (*ALUnityBackgroundCallback)(const char* args); // User Service - (void)didDismissUserConsentDialog; +// Consent Flow +- (void)startConsentFlow; + // Utils -+ (NSString *)serializeParameters:(NSDictionary *)dict; ++ (NSString *)serializeParameters:(NSDictionary *)dict; /** * Creates an instance of @c MAUnityAdManager if needed and returns the singleton instance. diff --git a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta index 30ef626d9..aef1db553 100644 --- a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta +++ b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta @@ -3,7 +3,6 @@ guid: 4209563f82b8a4f7dabf03705ab761c6 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h -- al_max_export_path-MaxSdk\AppLovin\Plugins\iOS\MAUnityAdManager.h PluginImporter: externalObjects: {} serializedVersion: 2 @@ -16,7 +15,7 @@ PluginImporter: validateReferences: 1 platformData: - first: - : Any + '': Any second: enabled: 0 settings: diff --git a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m index 70e86a6dc..ca86eb997 100644 --- a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m +++ b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m @@ -5,7 +5,7 @@ #import "MAUnityAdManager.h" -#define VERSION @"5.4.5" +#define VERSION @"5.10.1" #define KEY_WINDOW [UIApplication sharedApplication].keyWindow #define DEVICE_SPECIFIC_ADVIEW_AD_FORMAT ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? MAAdFormat.leader : MAAdFormat.banner @@ -42,13 +42,14 @@ extern "C" { } #endif -@interface MAUnityAdManager() +@interface MAUnityAdManager() // Parent Fields @property (nonatomic, weak) ALSdk *sdk; // Fullscreen Ad Fields @property (nonatomic, strong) NSMutableDictionary *interstitials; +@property (nonatomic, strong) NSMutableDictionary *appOpenAds; @property (nonatomic, strong) NSMutableDictionary *rewardedAds; @property (nonatomic, strong) NSMutableDictionary *rewardedInterstitialAds; @@ -67,6 +68,7 @@ extern "C" { @property (nonatomic, strong) NSMutableDictionary *adViewCustomDataToSetAfterCreate; @property (nonatomic, strong) NSMutableArray *adUnitIdentifiersToShowAfterCreate; @property (nonatomic, strong) NSMutableSet *disabledAdaptiveBannerAdUnitIdentifiers; +@property (nonatomic, strong) NSMutableSet *disabledAutoRefreshAdViewAdUnitIdentifiers; @property (nonatomic, strong) UIView *safeAreaBackground; @property (nonatomic, strong, nullable) UIColor *publisherBannerBackgroundColor; @@ -107,6 +109,7 @@ static ALUnityBackgroundCallback backgroundCallback; if ( self ) { self.interstitials = [NSMutableDictionary dictionaryWithCapacity: 2]; + self.appOpenAds = [NSMutableDictionary dictionaryWithCapacity: 2]; self.rewardedAds = [NSMutableDictionary dictionaryWithCapacity: 2]; self.rewardedInterstitialAds = [NSMutableDictionary dictionaryWithCapacity: 2]; self.adViews = [NSMutableDictionary dictionaryWithCapacity: 2]; @@ -123,6 +126,7 @@ static ALUnityBackgroundCallback backgroundCallback; self.adViewCustomDataToSetAfterCreate = [NSMutableDictionary dictionaryWithCapacity: 1]; self.adUnitIdentifiersToShowAfterCreate = [NSMutableArray arrayWithCapacity: 2]; self.disabledAdaptiveBannerAdUnitIdentifiers = [NSMutableSet setWithCapacity: 2]; + self.disabledAutoRefreshAdViewAdUnitIdentifiers = [NSMutableSet setWithCapacity: 2]; self.adInfoDict = [NSMutableDictionary dictionary]; self.adInfoDictLock = [[NSObject alloc] init]; @@ -172,7 +176,15 @@ static ALUnityBackgroundCallback backgroundCallback; backgroundCallback = unityBackgroundCallback; NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; NSString *sdkKey = infoDict[@"AppLovinSdkKey"]; - self.sdk = [ALSdk sharedWithKey: sdkKey settings: [self generateSDKSettingsForAdUnitIdentifiers: serializedAdUnitIdentifiers metaData: serializedMetaData]]; + if ( [sdkKey al_isValidString] ) + { + self.sdk = [ALSdk sharedWithKey: sdkKey settings: [self generateSDKSettingsForAdUnitIdentifiers: serializedAdUnitIdentifiers metaData: serializedMetaData]]; + } + else + { + self.sdk = [ALSdk sharedWithSettings:[self generateSDKSettingsForAdUnitIdentifiers:serializedAdUnitIdentifiers metaData:serializedMetaData]]; + } + self.sdk.variableService.delegate = self; [self.sdk setPluginVersion: [@"Max-Unity-" stringByAppendingString: VERSION]]; self.sdk.mediationProvider = @"max"; @@ -187,7 +199,8 @@ static ALUnityBackgroundCallback backgroundCallback; @"consentDialogState" : consentDialogStateStr, @"countryCode" : configuration.countryCode, @"appTrackingStatus" : appTrackingStatus, - @"isSuccessfullyInitialized" : ([self.sdk isInitialized] ? @"true" : @"false")}]; + @"isSuccessfullyInitialized" : @([self.sdk isInitialized]), + @"isTestModeEnabled" : @([configuration isTestModeEnabled])}]; }]; return self.sdk; @@ -205,6 +218,11 @@ static ALUnityBackgroundCallback backgroundCallback; [self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)]; } +- (void)loadBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier +{ + [self loadAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; +} + - (void)setBannerBackgroundColorForAdUnitIdentifier:(NSString *)adUnitIdentifier hexColorCode:(NSString *)hexColorCode { [self setAdViewBackgroundColorForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] hexColorCode: hexColorCode]; @@ -292,6 +310,11 @@ static ALUnityBackgroundCallback backgroundCallback; [self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)]; } +- (void)loadMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier +{ + [self loadAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; +} + - (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier { [self setAdViewPlacement: placement forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; @@ -302,9 +325,9 @@ static ALUnityBackgroundCallback backgroundCallback; [self startAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; } -- (void)stopMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifer +- (void)stopMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier { - [self stopAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifer adFormat: MAAdFormat.mrec]; + [self stopAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; } - (void)updateMRecPosition:(NSString *)mrecPosition forAdUnitIdentifier:(NSString *)adUnitIdentifier @@ -427,6 +450,38 @@ static ALUnityBackgroundCallback backgroundCallback; [interstitial setLocalExtraParameterForKey: key value: value]; } +#pragma mark - App Open Ads + +- (void)loadAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier +{ + MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; + [appOpenAd loadAd]; +} + +- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier +{ + MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; + return [appOpenAd isReady]; +} + +- (void)showAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData +{ + MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; + [appOpenAd showAdForPlacement: placement customData: customData]; +} + +- (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value +{ + MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; + [appOpenAd setExtraParameterForKey: key value: value]; +} + +- (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value +{ + MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; + [appOpenAd setLocalExtraParameterForKey: key value: value]; +} + #pragma mark - Rewarded - (void)loadRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier @@ -568,6 +623,7 @@ static ALUnityBackgroundCallback backgroundCallback; } networkResponseDict[@"credentials"] = response.credentials; + networkResponseDict[@"isBidding"] = @([response isBidding]); MAError *error = response.error; if ( error ) @@ -636,6 +692,10 @@ static ALUnityBackgroundCallback backgroundCallback; { name = @"OnInterstitialLoadedEvent"; } + else if ( MAAdFormat.appOpen == adFormat ) + { + name = @"OnAppOpenAdLoadedEvent"; + } else if ( MAAdFormat.rewarded == adFormat ) { name = @"OnRewardedAdLoadedEvent"; @@ -688,6 +748,10 @@ static ALUnityBackgroundCallback backgroundCallback; { name = @"OnInterstitialLoadFailedEvent"; } + else if ( self.appOpenAds[adUnitIdentifier] ) + { + name = @"OnAppOpenAdLoadFailedEvent"; + } else if ( self.rewardedAds[adUnitIdentifier] ) { name = @"OnRewardedAdLoadFailedEvent"; @@ -735,6 +799,10 @@ static ALUnityBackgroundCallback backgroundCallback; { name = @"OnInterstitialClickedEvent"; } + else if ( MAAdFormat.appOpen == adFormat ) + { + name = @"OnAppOpenAdClickedEvent"; + } else if ( MAAdFormat.rewarded == adFormat ) { name = @"OnRewardedAdClickedEvent"; @@ -768,6 +836,10 @@ static ALUnityBackgroundCallback backgroundCallback; { name = @"OnInterstitialDisplayedEvent"; } + else if ( MAAdFormat.appOpen == adFormat ) + { + name = @"OnAppOpenAdDisplayedEvent"; + } else if ( MAAdFormat.rewarded == adFormat ) { name = @"OnRewardedAdDisplayedEvent"; @@ -792,6 +864,10 @@ static ALUnityBackgroundCallback backgroundCallback; { name = @"OnInterstitialAdFailedToDisplayEvent"; } + else if ( MAAdFormat.appOpen == adFormat ) + { + name = @"OnAppOpenAdFailedToDisplayEvent"; + } else if ( MAAdFormat.rewarded == adFormat ) { name = @"OnRewardedAdFailedToDisplayEvent"; @@ -825,6 +901,10 @@ static ALUnityBackgroundCallback backgroundCallback; { name = @"OnInterstitialHiddenEvent"; } + else if ( MAAdFormat.appOpen == adFormat ) + { + name = @"OnAppOpenAdHiddenEvent"; + } else if ( MAAdFormat.rewarded == adFormat ) { name = @"OnRewardedAdHiddenEvent"; @@ -952,6 +1032,10 @@ static ALUnityBackgroundCallback backgroundCallback; { name = @"OnInterstitialAdRevenuePaidEvent"; } + else if ( MAAdFormat.appOpen == adFormat ) + { + name = @"OnAppOpenAdRevenuePaidEvent"; + } else if ( MAAdFormat.rewarded == adFormat ) { name = @"OnRewardedAdRevenuePaidEvent"; @@ -970,6 +1054,41 @@ static ALUnityBackgroundCallback backgroundCallback; [MAUnityAdManager forwardUnityEventWithArgs: args forwardInBackground: [adFormat isFullscreenAd]]; } +- (void)didGenerateCreativeIdentifier:(NSString *)creativeIdentifier forAd:(MAAd *)ad +{ + NSString *name; + MAAdFormat *adFormat = ad.format; + if ( MAAdFormat.banner == adFormat || MAAdFormat.leader == adFormat ) + { + name = @"OnBannerAdReviewCreativeIdGeneratedEvent"; + } + else if ( MAAdFormat.mrec == adFormat ) + { + name = @"OnMRecAdReviewCreativeIdGeneratedEvent"; + } + else if ( MAAdFormat.interstitial == adFormat ) + { + name = @"OnInterstitialAdReviewCreativeIdGeneratedEvent"; + } + else if ( MAAdFormat.rewarded == adFormat ) + { + name = @"OnRewardedAdReviewCreativeIdGeneratedEvent"; + } + else if ( MAAdFormat.rewardedInterstitial == adFormat ) + { + name = @"OnRewardedInterstitialAdReviewCreativeIdGeneratedEvent"; + } + else + { + [self logInvalidAdFormat: adFormat]; + return; + } + + NSMutableDictionary *args = [self defaultAdEventParametersForName: name withAd: ad]; + args[@"adReviewCreativeId"] = creativeIdentifier; + [MAUnityAdManager forwardUnityEventWithArgs: args]; +} + - (NSMutableDictionary *)defaultAdEventParametersForName:(NSString *)name withAd:(MAAd *)ad { NSMutableDictionary *args = [[self adInfoForAd: ad] mutableCopy]; @@ -985,6 +1104,11 @@ static ALUnityBackgroundCallback backgroundCallback; max_unity_dispatch_on_main_thread(^{ [self log: @"Creating %@ with ad unit identifier \"%@\" and position: \"%@\"", adFormat, adUnitIdentifier, adViewPosition]; + if ( self.adViews[adUnitIdentifier] ) + { + [self log: @"Trying to create a %@ that was already created. This will cause the current ad to be hidden.", adFormat.label]; + } + // Retrieve ad view from the map MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat atPosition: adViewPosition withOffset: offset]; adView.hidden = YES; @@ -1040,6 +1164,12 @@ static ALUnityBackgroundCallback backgroundCallback; [adView loadAd]; + // Disable auto-refresh if publisher sets it before creating the ad view. + if ( [self.disabledAutoRefreshAdViewAdUnitIdentifiers containsObject: adUnitIdentifier] ) + { + [adView stopAutoRefresh]; + } + // The publisher may have requested to show the banner before it was created. Now that the banner is created, show it. if ( [self.adUnitIdentifiersToShowAfterCreate containsObject: adUnitIdentifier] ) { @@ -1049,6 +1179,32 @@ static ALUnityBackgroundCallback backgroundCallback; }); } +- (void)loadAdViewWithAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat +{ + max_unity_dispatch_on_main_thread(^{ + MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; + if ( !adView ) + { + [self log: @"%@ does not exist for ad unit identifier %@.", adFormat.label, adUnitIdentifier]; + return; + } + + if ( ![self.disabledAutoRefreshAdViewAdUnitIdentifiers containsObject: adUnitIdentifier] ) + { + if ( [adView isHidden] ) + { + [self log: @"Auto-refresh will resume when the %@ ad is shown. You should only call LoadBanner() or LoadMRec() if you explicitly pause auto-refresh and want to manually load an ad.", adFormat.label]; + return; + } + + [self log: @"You must stop auto-refresh if you want to manually load %@ ads.", adFormat.label]; + return; + } + + [adView loadAd]; + }); +} + - (void)setAdViewBackgroundColorForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:(MAAdFormat *)adFormat hexColorCode:(NSString *)hexColorCode { max_unity_dispatch_on_main_thread(^{ @@ -1082,6 +1238,8 @@ static ALUnityBackgroundCallback backgroundCallback; max_unity_dispatch_on_main_thread(^{ [self log: @"Starting %@ auto refresh for ad unit identifier \"%@\"", adFormat.label, adUnitIdentifier]; + [self.disabledAutoRefreshAdViewAdUnitIdentifiers removeObject: adUnitIdentifier]; + MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; if ( !adView ) { @@ -1098,6 +1256,8 @@ static ALUnityBackgroundCallback backgroundCallback; max_unity_dispatch_on_main_thread(^{ [self log: @"Stopping %@ auto refresh for ad unit identifier \"%@\"", adFormat.label, adUnitIdentifier]; + [self.disabledAutoRefreshAdViewAdUnitIdentifiers addObject: adUnitIdentifier]; + MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; if ( !adView ) { @@ -1272,7 +1432,10 @@ static ALUnityBackgroundCallback backgroundCallback; self.safeAreaBackground.hidden = NO; view.hidden = NO; - [view startAutoRefresh]; + if ( ![self.disabledAutoRefreshAdViewAdUnitIdentifiers containsObject: adUnitIdentifier] ) + { + [view startAutoRefresh]; + } }); } @@ -1317,6 +1480,7 @@ static ALUnityBackgroundCallback backgroundCallback; MAAdView *view = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; view.delegate = nil; view.revenueDelegate = nil; + view.adReviewDelegate = nil; [view removeFromSuperview]; @@ -1355,6 +1519,7 @@ static ALUnityBackgroundCallback backgroundCallback; result = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk]; result.delegate = self; result.revenueDelegate = self; + result.adReviewDelegate = self; self.interstitials[adUnitIdentifier] = result; } @@ -1362,6 +1527,21 @@ static ALUnityBackgroundCallback backgroundCallback; return result; } +- (MAAppOpenAd *)retrieveAppOpenAdForAdUnitIdentifier:(NSString *)adUnitIdentifier +{ + MAAppOpenAd *result = self.appOpenAds[adUnitIdentifier]; + if ( !result ) + { + result = [[MAAppOpenAd alloc] initWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk]; + result.delegate = self; + result.revenueDelegate = self; + + self.appOpenAds[adUnitIdentifier] = result; + } + + return result; +} + - (MARewardedAd *)retrieveRewardedAdForAdUnitIdentifier:(NSString *)adUnitIdentifier { MARewardedAd *result = self.rewardedAds[adUnitIdentifier]; @@ -1370,6 +1550,7 @@ static ALUnityBackgroundCallback backgroundCallback; result = [MARewardedAd sharedWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk]; result.delegate = self; result.revenueDelegate = self; + result.adReviewDelegate = self; self.rewardedAds[adUnitIdentifier] = result; } @@ -1385,6 +1566,7 @@ static ALUnityBackgroundCallback backgroundCallback; result = [[MARewardedInterstitialAd alloc] initWithAdUnitIdentifier: adUnitIdentifier sdk: self.sdk]; result.delegate = self; result.revenueDelegate = self; + result.adReviewDelegate = self; self.rewardedInterstitialAds[adUnitIdentifier] = result; } @@ -1408,6 +1590,7 @@ static ALUnityBackgroundCallback backgroundCallback; result.translatesAutoresizingMaskIntoConstraints = NO; result.delegate = self; result.revenueDelegate = self; + result.adReviewDelegate = self; self.adViews[adUnitIdentifier] = result; self.adViewPositions[adUnitIdentifier] = adViewPosition; @@ -1415,6 +1598,9 @@ static ALUnityBackgroundCallback backgroundCallback; UIViewController *rootViewController = [self unityViewController]; [rootViewController.view addSubview: result]; + + // Allow pubs to pause auto-refresh immediately, by default. + [result setExtraParameterForKey: @"allow_pause_auto_refresh_immediately" value: @"true"]; } return result; @@ -1829,6 +2015,25 @@ static ALUnityBackgroundCallback backgroundCallback; [MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnSdkConsentDialogDismissedEvent"}]; } +#pragma mark - Consent Flow + +- (void)startConsentFlow +{ + [self.sdk.cfService scfWithCompletionHander:^(ALCFError * _Nullable error) { + + NSMutableDictionary *args = [NSMutableDictionary dictionaryWithCapacity: 3]; + args[@"name"] = @"OnSdkConsentFlowCompletedEvent"; + + if ( error ) + { + args[@"code"] = @(error.code); + args[@"message"] = error.message; + } + + [MAUnityAdManager forwardUnityEventWithArgs: args]; + }]; +} + #pragma mark - Variable Service (Deprecated) - (void)loadVariables diff --git a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta index c8812d615..8c3581e8b 100644 --- a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta +++ b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta @@ -3,7 +3,6 @@ guid: 2973e70bd2fa74984b35aea07ae9db52 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m -- al_max_export_path-MaxSdk\AppLovin\Plugins\iOS\MAUnityAdManager.m PluginImporter: externalObjects: {} serializedVersion: 2 @@ -16,7 +15,7 @@ PluginImporter: validateReferences: 1 platformData: - first: - : Any + '': Any second: enabled: 0 settings: diff --git a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm index c905bbac4..f4be2fc6a 100644 --- a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm +++ b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm @@ -37,11 +37,20 @@ extern "C" static NSNumber *_creativeDebuggerEnabledToSet; static NSNumber *_exceptionHandlerEnabledToSet; static NSNumber *_locationCollectionEnabledToSet; + static NSNumber *_targetingYearOfBirth; + static NSString *_targetingGender; + static NSNumber *_targetingMaximumAdContentRating; + static NSString *_targetingEmail; + static NSString *_targetingPhoneNumber; + static NSArray *_targetingKeywords; + static NSArray *_targetingInterests; static NSMutableDictionary *_extraParametersToSet = [NSMutableDictionary dictionary]; static NSObject *_extraParametersToSetLock = [[NSObject alloc] init]; // Helper method to create C string copy static const char * cStringCopy(NSString *string); + // Helper method to log errors + void logUninitializedAccessError(char *callingMethod); bool isPluginInitialized() { @@ -66,6 +75,42 @@ extern "C" return array; } + + ALGender getAppLovinGender(NSString *genderString) + { + if ( [@"F" al_isEqualToStringIgnoringCase: genderString] ) + { + return ALGenderFemale; + } + else if ( [@"M" al_isEqualToStringIgnoringCase: genderString] ) + { + return ALGenderMale; + } + else if ( [@"O" al_isEqualToStringIgnoringCase: genderString] ) + { + return ALGenderOther; + } + + return ALGenderUnknown; + } + + ALAdContentRating getAppLovinAdContentRating(int maximumAdContentRating) + { + if ( maximumAdContentRating == 1 ) + { + return ALAdContentRatingAllAudiences; + } + else if ( maximumAdContentRating == 2 ) + { + return ALAdContentRatingEveryoneOverTwelve; + } + else if ( maximumAdContentRating == 3 ) + { + return ALAdContentRatingMatureAudiences; + } + + return ALAdContentRatingNone; + } void setPendingExtraParametersIfNeeded(ALSdkSettings *settings) { @@ -129,7 +174,7 @@ extern "C" if ( _verboseLoggingToSet ) { - _sdk.settings.isVerboseLogging = _verboseLoggingToSet.boolValue; + _sdk.settings.verboseLoggingEnabled = _verboseLoggingToSet.boolValue; _verboseLoggingToSet = nil; } @@ -151,6 +196,48 @@ extern "C" _locationCollectionEnabledToSet = nil; } + if ( _targetingYearOfBirth ) + { + _sdk.targetingData.yearOfBirth = _targetingYearOfBirth.intValue <= 0 ? nil : _targetingYearOfBirth; + _targetingYearOfBirth = nil; + } + + if ( _targetingGender ) + { + _sdk.targetingData.gender = getAppLovinGender(_targetingGender); + _targetingGender = nil; + } + + if ( _targetingMaximumAdContentRating ) + { + _sdk.targetingData.maximumAdContentRating = getAppLovinAdContentRating(_targetingMaximumAdContentRating.intValue); + _targetingMaximumAdContentRating = nil; + } + + if ( _targetingEmail ) + { + _sdk.targetingData.email = _targetingEmail; + _targetingEmail = nil; + } + + if ( _targetingPhoneNumber ) + { + _sdk.targetingData.phoneNumber = _targetingPhoneNumber; + _targetingPhoneNumber = nil; + } + + if ( _targetingKeywords ) + { + _sdk.targetingData.keywords = _targetingKeywords; + _targetingKeywords = nil; + } + + if ( _targetingInterests ) + { + _sdk.targetingData.interests = _targetingInterests; + _targetingInterests = nil; + } + setPendingExtraParametersIfNeeded( _sdk.settings ); } @@ -195,6 +282,17 @@ extern "C" [_sdk showMediationDebugger]; } + void _MaxShowCreativeDebugger() + { + if ( !_sdk ) + { + NSLog(@"[%@] Failed to show creative debugger - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG); + return; + } + + [_sdk showCreativeDebugger]; + } + void _MaxShowConsentDialog() { NSLog(@"[%@] Failed to show consent dialog - Unavailable on iOS, please use the consent flow: https://dash.applovin.com/documentation/mediation/unity/getting-started/consent-flow", TAG); @@ -236,82 +334,98 @@ extern "C" void _MaxSetTargetingDataYearOfBirth(const int yearOfBirth) { - if ( !isPluginInitialized() ) return; + if ( !_sdk ) + { + _targetingYearOfBirth = @(yearOfBirth); + return; + } + _sdk.targetingData.yearOfBirth = yearOfBirth <= 0 ? nil : @(yearOfBirth); } - void _MaxSetTargetingDataGender(const char *gender) + void _MaxSetTargetingDataGender(char *gender) { - if ( !isPluginInitialized() ) return; + if ( !_sdk ) + { + _targetingGender = NSSTRING(gender); + return; + } NSString *genderString = NSSTRING(gender); - ALGender alGender = ALGenderUnknown; - - if ( [genderString isEqualToString: @"F"] ) - { - alGender = ALGenderFemale; - } - else if ( [genderString isEqualToString: @"M"] ) - { - alGender = ALGenderMale; - } - else if ( [genderString isEqualToString: @"O"] ) - { - alGender = ALGenderOther; - } - - _sdk.targetingData.gender = alGender; + _sdk.targetingData.gender = getAppLovinGender(genderString); } void _MaxSetTargetingDataMaximumAdContentRating(const int maximumAdContentRating) { - if ( !isPluginInitialized() ) return; - - ALAdContentRating rating = ALAdContentRatingNone; - - if ( maximumAdContentRating == 1 ) + if ( !_sdk ) { - rating = ALAdContentRatingAllAudiences; - } - else if ( maximumAdContentRating == 2 ) - { - rating = ALAdContentRatingEveryoneOverTwelve; - } - else if ( maximumAdContentRating == 3 ) - { - rating = ALAdContentRatingMatureAudiences; + _targetingMaximumAdContentRating = @(maximumAdContentRating); + return; } - _sdk.targetingData.maximumAdContentRating = rating; + _sdk.targetingData.maximumAdContentRating = getAppLovinAdContentRating(maximumAdContentRating); } - void _MaxSetTargetingDataEmail(const char *email) + void _MaxSetTargetingDataEmail(char *email) { - if ( !isPluginInitialized() ) return; + if ( !_sdk ) + { + _targetingEmail = NSSTRING(email); + return; + } + _sdk.targetingData.email = NSSTRING(email); } - void _MaxSetTargetingDataPhoneNumber(const char *phoneNumber) + void _MaxSetTargetingDataPhoneNumber(char *phoneNumber) { - if ( !isPluginInitialized() ) return; + if ( !_sdk ) + { + _targetingPhoneNumber = NSSTRING(phoneNumber); + return; + } + _sdk.targetingData.phoneNumber = NSSTRING(phoneNumber); } void _MaxSetTargetingDataKeywords(char **keywords, int size) { - if ( !isPluginInitialized() ) return; - _sdk.targetingData.keywords = toStringArray(keywords, size); + NSArray *keywordsArray = keywords ? toStringArray(keywords, size) : nil; + if ( !_sdk ) + { + _targetingKeywords = keywordsArray; + return; + } + + _sdk.targetingData.keywords = keywordsArray; } void _MaxSetTargetingDataInterests(char **interests, int size) { - if ( !isPluginInitialized() ) return; - _sdk.targetingData.interests = toStringArray(interests, size); + NSArray *interestsArray = interests ? toStringArray(interests, size) : nil; + if ( !_sdk ) + { + _targetingInterests = interestsArray; + return; + } + + _sdk.targetingData.interests = interestsArray; } void _MaxClearAllTargetingData() { - if ( !isPluginInitialized() ) return; + if ( !_sdk ) + { + _targetingYearOfBirth = nil; + _targetingGender = nil; + _targetingMaximumAdContentRating = nil; + _targetingEmail = nil; + _targetingPhoneNumber = nil; + _targetingKeywords = nil; + _targetingInterests = nil; + return; + } + [_sdk.targetingData clearAll]; } @@ -319,7 +433,7 @@ extern "C" { if ( !_sdk ) { - NSLog(@"[%@] Failed to get SDK configuration - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG); + logUninitializedAccessError("_MaxGetSdkConfiguration"); return cStringCopy(@""); } @@ -329,7 +443,8 @@ extern "C" return cStringCopy([MAUnityAdManager serializeParameters: @{@"consentDialogState" : consentDialogStateStr, @"countryCode" : _sdk.configuration.countryCode, @"appTrackingStatus" : appTrackingStatus, - @"isSuccessfullyInitialized" : ([_sdk isInitialized] ? @"true" : @"false")}]); + @"isSuccessfullyInitialized" : @([_sdk isInitialized]), + @"isTestModeEnabled" : @([_sdk.configuration isTestModeEnabled])}]); } void _MaxSetHasUserConsent(bool hasUserConsent) @@ -391,6 +506,13 @@ extern "C" [_adManager createBannerWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) x: x y: y]; } + void _MaxLoadBanner(const char *adUnitIdentifier) + { + if (!isPluginInitialized()) return; + + [_adManager loadBannerWithAdUnitIdentifier: NSSTRING(adUnitIdentifier)]; + } + void _MaxSetBannerBackgroundColor(const char *adUnitIdentifier, const char *hexColorCode) { if (!isPluginInitialized()) return; @@ -493,6 +615,13 @@ extern "C" [_adManager createMRecWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) x: x y: y]; } + void _MaxLoadMRec(const char *adUnitIdentifier) + { + if (!isPluginInitialized()) return; + + [_adManager loadMRecWithAdUnitIdentifier: NSSTRING(adUnitIdentifier)]; + } + void _MaxSetMRecPlacement(const char *adUnitIdentifier, const char *placement) { [_adManager setMRecPlacement: NSSTRING(placement) forAdUnitIdentifier: NSSTRING(adUnitIdentifier)]; @@ -649,6 +778,41 @@ extern "C" [_adManager showInterstitialWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) placement: NSSTRING(placement) customData: NSSTRING(customData)]; } + void _MaxLoadAppOpenAd(const char *adUnitIdentifier) + { + if (!isPluginInitialized()) return; + + [_adManager loadAppOpenAdWithAdUnitIdentifier: NSSTRING(adUnitIdentifier)]; + } + + void _MaxSetAppOpenAdExtraParameter(const char *adUnitIdentifier, const char *key, const char *value) + { + [_adManager setAppOpenAdExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) + key: NSSTRING(key) + value: NSSTRING(value)]; + } + + void _MaxSetAppOpenAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) + { + [_adManager setAppOpenAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) + key: NSSTRING(key) + value: (__bridge id)value]; + } + + bool _MaxIsAppOpenAdReady(const char *adUnitIdentifier) + { + if (!isPluginInitialized()) return false; + + return [_adManager isAppOpenAdReadyWithAdUnitIdentifier: NSSTRING(adUnitIdentifier)]; + } + + void _MaxShowAppOpenAd(const char *adUnitIdentifier, const char *placement, const char *customData) + { + if (!isPluginInitialized()) return; + + [_adManager showAppOpenAdWithAdUnitIdentifier: NSSTRING(adUnitIdentifier) placement: NSSTRING(placement) customData: NSSTRING(customData)]; + } + void _MaxLoadRewardedAd(const char *adUnitIdentifier) { if (!isPluginInitialized()) return; @@ -789,7 +953,7 @@ extern "C" { if ( _sdk ) { - _sdk.settings.isVerboseLogging = enabled; + _sdk.settings.verboseLoggingEnabled = enabled; _verboseLoggingToSet = nil; } else @@ -802,7 +966,7 @@ extern "C" { if ( _sdk ) { - return _sdk.settings.isVerboseLogging; + return [_sdk.settings isVerboseLoggingEnabled]; } else if ( _verboseLoggingToSet ) { @@ -890,11 +1054,38 @@ extern "C" } } + const char * _MaxGetCFType() + { + if ( !_sdk ) + { + NSLog(@"[%@] Failed to get available mediated networks - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG); + return cStringCopy(@(ALCFTypeUnknown).stringValue); + } + + return cStringCopy(@(_sdk.cfService.cfType).stringValue); + } + + void _MaxStartConsentFlow() + { + if (!isPluginInitialized()) + { + logUninitializedAccessError("_MaxStartConsentFlow"); + return; + } + + [_adManager startConsentFlow]; + } + float _MaxGetAdaptiveBannerHeight(const float width) { return [MAUnityAdManager adaptiveBannerHeightForWidth: width]; } + void logUninitializedAccessError(char *callingMethod) + { + NSLog(@"[%@] Failed to execute: %s - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG, callingMethod); + } + [[deprecated("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.")]] void _MaxLoadVariables() { diff --git a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta index 8bfbf4d22..5ea08ff04 100644 --- a/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta +++ b/Assets/ThirdParty/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta @@ -3,7 +3,6 @@ guid: 7e373ed7168b243e6b706e991ab5a643 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm -- al_max_export_path-MaxSdk\AppLovin\Plugins\iOS\MAUnityPlugin.mm PluginImporter: externalObjects: {} serializedVersion: 2 @@ -16,7 +15,7 @@ PluginImporter: validateReferences: 1 platformData: - first: - : Any + '': Any second: enabled: 0 settings: diff --git a/Assets/ThirdParty/MaxSdk/Mediation.meta b/Assets/ThirdParty/MaxSdk/Mediation.meta index 4d03dfc9a..103dd6f48 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation.meta @@ -3,7 +3,6 @@ guid: dcf2020c4018447c9b91170c0f62d799 labels: - al_max - al_max_export_path-MaxSdk/Mediation -- al_max_export_path-MaxSdk\Mediation folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml index 18353020c..d2aa21cfa 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml @@ -1,9 +1,9 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml.meta index f20150d5e..e1bb2a859 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: a351b114cfc11494ba8c131833b1bf74 labels: - al_max - al_max_export_path-MaxSdk/Mediation/AdColony/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\AdColony\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor.meta index 4d1f83987..e54a76641 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor.meta @@ -3,7 +3,6 @@ guid: ef8467ffb0e4447b79a8804884a7520a labels: - al_max - al_max_export_path-MaxSdk/Mediation/ByteDance/Editor -- al_max_export_path-MaxSdk\Mediation\ByteDance\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml index dbef7e9e3..781d16e2c 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml @@ -1,13 +1,13 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml.meta index e4c832ce3..520523321 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 0828555cb1ce94702a4af6f3dce3d735 labels: - al_max - al_max_export_path-MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\ByteDance\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor.meta index bd878bc4b..38bff8d54 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor.meta @@ -3,7 +3,6 @@ guid: a90f13141c35746f5a2996c8ad068fe9 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Chartboost/Editor -- al_max_export_path-MaxSdk\Mediation\Chartboost\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml index 408de7fe8..40bd08071 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml @@ -1,10 +1,14 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml.meta index 593706387..02628eb04 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 93b0a4618bd884871af0981a7867bb2f labels: - al_max - al_max_export_path-MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\Chartboost\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor.meta index 7d238a6c9..4beff5e4c 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor.meta @@ -3,7 +3,6 @@ guid: 28880992a399a48b7abe95b66649d711 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Facebook/Editor -- al_max_export_path-MaxSdk\Mediation\Facebook\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml index 8160079dd..f867a945a 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml @@ -5,9 +5,9 @@ Since FAN SDK depends on older versions of a few support and play service versions `com.applovin.mediation:facebook-adapter:x.y.z.a` resolves to `com.applovin.mediation:facebook-adapter:+` which pulls down the beta versions of FAN SDK. Note that forcing the adapter is enough to stop Jar Resolver from pulling the latest FAN SDK. --> - + - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml.meta index f9e6d001e..69b5d2c8c 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: aea9bdf974328420db5ae118ef0d2b87 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Facebook/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\Facebook\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor.meta index 688cd8bc4..315e8c8e0 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor.meta @@ -3,7 +3,6 @@ guid: e076e4ef7e2874ba69b108cc7a346c2a labels: - al_max - al_max_export_path-MaxSdk/Mediation/Fyber/Editor -- al_max_export_path-MaxSdk\Mediation\Fyber\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml index 235b092da..77c160fcf 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml @@ -1,9 +1,9 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml.meta index 03f1ae972..fd0bbbf22 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 5e123cdc08e804dffb2c40c4fbc83caf labels: - al_max - al_max_export_path-MaxSdk/Mediation/Fyber/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\Fyber\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor.meta index 9e2371a75..ea8dd5579 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor.meta @@ -3,7 +3,6 @@ guid: e8015bd045cea462c8f39c8a05867d08 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Google/Editor -- al_max_export_path-MaxSdk\Mediation\Google\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml index 99ff89042..baa767d8c 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml @@ -2,9 +2,9 @@ - - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml.meta index b95c37826..36bef7225 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 053b810d3594744e38b6fd0fa378fb57 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Google/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\Google\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs deleted file mode 100644 index c5cc077c4..000000000 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// MaxGoogleInitialize.cs -// AppLovin MAX Unity Plugin -// -// Created by Santosh Bagadi on 10/5/20. -// Copyright © 2020 AppLovin. All rights reserved. -// - -using System.IO; -using UnityEditor; -using UnityEngine; - -namespace AppLovinMax.Mediation.Google.Editor -{ - [InitializeOnLoad] - public class MaxGoogleInitialize - { - private static readonly string LegacyMaxMediationGoogleDir = Path.Combine("Assets", "Plugins/Android/MaxMediationGoogle"); - - static MaxGoogleInitialize() - { - // 安卓不处理 - if (true) - { - return; - } - // Check if the MaxMediationGoogle directory exists and append .androidlib to it. - if (Directory.Exists(LegacyMaxMediationGoogleDir)) - { - Debug.Log("[AppLovin MAX] Updating Google Android library directory name to make it compatible with Unity 2020+ versions."); - - FileUtil.MoveFileOrDirectory(LegacyMaxMediationGoogleDir, LegacyMaxMediationGoogleDir + ".androidlib"); - FileUtil.MoveFileOrDirectory(LegacyMaxMediationGoogleDir + ".meta", LegacyMaxMediationGoogleDir + ".androidlib" + ".meta"); - AssetDatabase.Refresh(); - } - } - } -} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs.meta b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs.meta deleted file mode 100644 index 21e40e7d2..000000000 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs.meta +++ /dev/null @@ -1,15 +0,0 @@ -fileFormatVersion: 2 -guid: 2376824a26af1414bbc62440698ccc89 -labels: -- al_max -- al_max_export_path-MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs -- al_max_export_path-MaxSdk\Mediation\Google\Editor\MaxGoogleInitialize.cs -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs deleted file mode 100644 index 3647aff8e..000000000 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// MaxMediationGoogleUtils.cs -// AppLovin MAX Unity Plugin -// -// Created by Santosh Bagadi on 11/7/19. -// Copyright © 2019 AppLovin. All rights reserved. -// - -using System; -using System.IO; -using UnityEditor; -using UnityEngine; - -namespace AppLovinMax.Mediation.Google.Editor -{ - /// - /// An Utils class containing shared convenience methods. - /// - public static class MaxMediationGoogleUtils - { - private const string AppLovinSettingsExportPath = "MaxSdk/Resources/AppLovinSettings.asset"; - - /// - /// Loads the AppLovin Settings asset if it is available and returns the value for the given property name. - /// - /// The name of the property for which to get the value of from AppLovinSettings.asset file. - /// The string value of the property if found. - public static string GetAppIdFromAppLovinSettings(string property) - { - var settingsFileName = GetAppLovinSettingsAssetPath(); - if (!File.Exists(settingsFileName)) - { - Debug.LogError("[AppLovin MAX] The current plugin version is incompatible with the AdMob adapter. Please update the AppLovin MAX plugin to version 2.4.0 or higher."); - return null; - } - - var instance = AssetDatabase.LoadAssetAtPath(settingsFileName, Type.GetType("AppLovinSettings, MaxSdk.Scripts.IntegrationManager.Editor")); - if (instance == null) - { - Debug.LogError("[AppLovin MAX] The current plugin version is incompatible with the AdMob adapter. Please update the AppLovin MAX plugin to version 2.4.15 or higher"); - return null; - } - - var adMobAppIdProperty = instance.GetType().GetProperty(property); - return adMobAppIdProperty == null ? null : adMobAppIdProperty.GetValue(instance, null).ToString(); - } - - private static string GetAppLovinSettingsAssetPath() - { - // Since the settings asset is generated during compile time, the asset label will contain platform specific path separator. So, use platform specific export path. - var assetLabel = "l:al_max_export_path-" + AppLovinSettingsExportPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); - var guids = AssetDatabase.FindAssets(assetLabel); - - var defaultPath = Path.Combine("Assets", AppLovinSettingsExportPath); - - return guids.Length > 0 ? AssetDatabase.GUIDToAssetPath(guids[0]) : defaultPath; - } - } -} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs.meta b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs.meta deleted file mode 100644 index ece03b3e8..000000000 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs.meta +++ /dev/null @@ -1,15 +0,0 @@ -fileFormatVersion: 2 -guid: 6de4e4d420b14431a7d169724e23361e -labels: -- al_max -- al_max_export_path-MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs -- al_max_export_path-MaxSdk\Mediation\Google\Editor\MaxMediationGoogleUtils.cs -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PostProcessor.cs b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PostProcessor.cs deleted file mode 100644 index 833ccc2ae..000000000 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PostProcessor.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// PostProcessor.cs -// AppLovin MAX Unity Plugin -// -// Created by Santosh Bagadi on 6/4/19. -// Copyright © 2019 AppLovin. All rights reserved. -// - -#if UNITY_IPHONE || UNITY_IOS - -using System.IO; -using UnityEditor; -using UnityEditor.Callbacks; -using UnityEditor.iOS.Xcode; -using UnityEngine; - -namespace AppLovinMax.Mediation.Google.Editor -{ - /// - /// A post processor that will add the AdMob App ID to the info.plist file. - /// - public class PostProcessor - { - [PostProcessBuild] - public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath) - { - var appId = MaxMediationGoogleUtils.GetAppIdFromAppLovinSettings("AdMobIosAppId"); - - // Log error if the App ID is not set. - if (string.IsNullOrEmpty(appId) || !appId.StartsWith("ca-app-pub-")) - { - Debug.LogError("[AppLovin MAX] AdMob App ID is not set. Please enter a valid app ID within the AppLovin Integration Manager window."); - return; - } - - var plistPath = Path.Combine(buildPath, "Info.plist"); - var plist = new PlistDocument(); - plist.ReadFromFile(plistPath); - - // Actually set (then write) AdMob app id to Info.plist if valid - plist.root.SetString("GADApplicationIdentifier", appId); - - File.WriteAllText(plistPath, plist.WriteToString()); - } - } -} - -#endif diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PreProcessor.cs b/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PreProcessor.cs deleted file mode 100644 index 28ea32fde..000000000 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PreProcessor.cs +++ /dev/null @@ -1,115 +0,0 @@ -// -// PreProcessor.cs -// AppLovin MAX Unity Plugin -// -// Created by Santosh Bagadi on 11/7/19. -// Copyright © 2019 AppLovin. All rights reserved. -// - -#if UNITY_ANDROID - -using System.IO; -using System.Linq; -using System.Xml.Linq; -using UnityEditor; -using UnityEditor.Build; -#if UNITY_2018_1_OR_NEWER -using UnityEditor.Build.Reporting; -#endif -using UnityEngine; - -namespace AppLovinMax.Mediation.Google.Editor -{ - /// - /// A pre processor that will add the AdMob App ID to the AndroidManifest.xml file. - /// - public class PreProcessor : -#if UNITY_2018_1_OR_NEWER - IPreprocessBuildWithReport -#else - IPreprocessBuild -#endif - { -#if UNITY_2018_1_OR_NEWER - public void OnPreprocessBuild(BuildReport report) -#else - public void OnPreprocessBuild(BuildTarget target, string path) -#endif - { - // 安卓先不处理 - if (true) - { - return; - } - var appId = MaxMediationGoogleUtils.GetAppIdFromAppLovinSettings("AdMobAndroidAppId"); - if (string.IsNullOrEmpty(appId)) - { - Debug.LogError("[AppLovin MAX] AdMob App ID is not set. Please enter a valid app ID within the "); - return; - } - - var manifestPath = Path.Combine(Application.dataPath, "Plugins/Android/MaxMediationGoogle.androidlib/AndroidManifest.xml"); - - XDocument manifest; - try - { - manifest = XDocument.Load(manifestPath); - } -#pragma warning disable 0168 - catch (IOException exception) -#pragma warning restore 0168 - { - Debug.LogError("[AppLovin MAX] Google mediation AndroidManifest.xml is missing. Ensure that MAX Google mediation plugin is imported correctly."); - return; - } - - // Get the `manifest` element. - var elementManifest = manifest.Element("manifest"); - if (elementManifest == null) - { - Debug.LogError("[AppLovin MAX] Google mediation AndroidManifest.xml is invalid. Ensure that MAX Google mediation plugin is imported correctly."); - return; - } - - // Get the `application` element under `manifest`. - var elementApplication = elementManifest.Element("application"); - if (elementApplication == null) - { - Debug.LogError("[AppLovin MAX] Google mediation AndroidManifest.xml is invalid. Ensure that MAX Google mediation plugin is imported correctly."); - return; - } - - // Get all the `meta-data` elements under `application`. - var adMobMetaData = elementApplication.Descendants().First(element => element.Name.LocalName.Equals("meta-data")); - XNamespace androidNamespace = "http://schemas.android.com/apk/res/android"; - - if (!adMobMetaData.FirstAttribute.Name.Namespace.Equals(androidNamespace) || - !adMobMetaData.FirstAttribute.Name.LocalName.Equals("name") || - !adMobMetaData.FirstAttribute.Value.Equals("com.google.android.gms.ads.APPLICATION_ID")) - { - Debug.LogError("[AppLovin MAX] Google mediation AndroidManifest.xml is invalid. Ensure that MAX Google mediation plugin is imported correctly."); - return; - } - - var lastAttribute = adMobMetaData.LastAttribute; - // Log error if the AdMob App ID is not set. - if (!lastAttribute.Name.LocalName.Equals("value")) - { - Debug.LogError("[AppLovin MAX] Google mediation AndroidManifest.xml is invalid. Ensure that MAX Google mediation plugin is imported correctly."); - } - - // Set the App ID value. - lastAttribute.Value = appId; - - // Save the updated manifest file. - manifest.Save(manifestPath); - } - - public int callbackOrder - { - get { return 0; } - } - } -} - -#endif \ No newline at end of file diff --git a/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor.meta index 532f49af6..a998cfd2e 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor.meta @@ -3,7 +3,6 @@ guid: a141703acd55a48c2a3e6e6599f90c64 labels: - al_max - al_max_export_path-MaxSdk/Mediation/InMobi/Editor -- al_max_export_path-MaxSdk\Mediation\InMobi\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml index 94e655462..593d704b5 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml @@ -1,12 +1,12 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml.meta index 9c00820c5..1b62e827c 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/InMobi/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: bc66a0ef4503843ee9b1bf1b1e867367 labels: - al_max - al_max_export_path-MaxSdk/Mediation/InMobi/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\InMobi\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor.meta index 2add572db..327f5d6b4 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor.meta @@ -3,7 +3,6 @@ guid: 531d860cac61f47d19e32f526470ae43 labels: - al_max - al_max_export_path-MaxSdk/Mediation/IronSource/Editor -- al_max_export_path-MaxSdk\Mediation\IronSource\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml index e31bb7f37..e583d657a 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml @@ -1,13 +1,13 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml.meta index fc9a532ad..f77e6f040 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 19262406303f04f05b14b31b3c734d35 labels: - al_max - al_max_export_path-MaxSdk/Mediation/IronSource/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\IronSource\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor.meta index 1277a36e2..d189ce000 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor.meta @@ -3,7 +3,6 @@ guid: db1de4066dc4e4290b3879b34fa87de2 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Mintegral/Editor -- al_max_export_path-MaxSdk\Mediation\Mintegral\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml index 078fd407c..2009654ae 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml @@ -1,7 +1,7 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml.meta index 678876140..415c4aba6 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 221b2a20a58a04f2cb4afb0779587206 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\Mintegral\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor.meta index d723bf56f..bce5c4961 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor.meta @@ -3,7 +3,6 @@ guid: 6b21a711d751f4e1d9c77b5fb984e112 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Tapjoy/Editor -- al_max_export_path-MaxSdk\Mediation\Tapjoy\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml index 87ef82f69..9ab257a52 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml @@ -1,13 +1,13 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml.meta index 087df67f2..14fe3dd2e 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: c5268a136291a461aad1c0175bccb266 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\Tapjoy\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor.meta index 4c3f69772..b66e84693 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor.meta @@ -3,7 +3,6 @@ guid: 30751f2dc322a40e588edfb7c978c9c0 labels: - al_max - al_max_export_path-MaxSdk/Mediation/UnityAds/Editor -- al_max_export_path-MaxSdk\Mediation\UnityAds\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml index 6c7850488..a59b7de12 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml @@ -1,9 +1,9 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml.meta index 3072dfa69..937df6e2a 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 9950f1cb0da1e43efbeca604db142076 labels: - al_max - al_max_export_path-MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\UnityAds\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor.meta index 26930deb8..1ea75cceb 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor.meta @@ -3,7 +3,6 @@ guid: 77b6ea05736a9458f8ef8762ee9b64bb labels: - al_max - al_max_export_path-MaxSdk/Mediation/Vungle/Editor -- al_max_export_path-MaxSdk\Mediation\Vungle\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml index f2ee0d2ee..3157552f3 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml +++ b/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml @@ -1,9 +1,9 @@ - + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml.meta index 614bb1de6..7038186f8 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml.meta +++ b/Assets/ThirdParty/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml.meta @@ -3,7 +3,6 @@ guid: 0d8ad3a6ddc4f44fab2efe607fe14f26 labels: - al_max - al_max_export_path-MaxSdk/Mediation/Vungle/Editor/Dependencies.xml -- al_max_export_path-MaxSdk\Mediation\Vungle\Editor\Dependencies.xml TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Prefabs/BannerBottom.prefab.meta b/Assets/ThirdParty/MaxSdk/Prefabs/BannerBottom.prefab.meta index 59cf96ad0..153cfcf5f 100644 --- a/Assets/ThirdParty/MaxSdk/Prefabs/BannerBottom.prefab.meta +++ b/Assets/ThirdParty/MaxSdk/Prefabs/BannerBottom.prefab.meta @@ -3,7 +3,6 @@ guid: 54c062c0526b148efa2ea2e9489b3aa0 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/BannerBottom.prefab -- al_max_export_path-MaxSdk\Prefabs\BannerBottom.prefab PrefabImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Prefabs/BannerTop.prefab.meta b/Assets/ThirdParty/MaxSdk/Prefabs/BannerTop.prefab.meta index e45cd6527..52ef4649e 100644 --- a/Assets/ThirdParty/MaxSdk/Prefabs/BannerTop.prefab.meta +++ b/Assets/ThirdParty/MaxSdk/Prefabs/BannerTop.prefab.meta @@ -3,7 +3,6 @@ guid: 6521750c87fd14f709d09a1e38ffde47 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/BannerTop.prefab -- al_max_export_path-MaxSdk\Prefabs\BannerTop.prefab PrefabImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab b/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab index ad0c1e5de..10c7c7ba2 100644 --- a/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab +++ b/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab @@ -199,6 +199,7 @@ GameObject: - component: {fileID: 1672649117655046507} - component: {fileID: 2484422763836779945} - component: {fileID: 1332063313327512547} + - component: {fileID: 9160434328933334999} m_Layer: 5 m_Name: EventSystem m_TagString: Untagged @@ -227,7 +228,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6155160063690407013} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: @@ -254,6 +255,18 @@ MonoBehaviour: m_InputActionsPerSecond: 10 m_RepeatDelay: 0.5 m_ForceModuleActive: 0 +--- !u!114 &9160434328933334999 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6155160063690407013} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0acf281ba86b4929a6942ecd998395b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &6462551400748024402 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab.meta b/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab.meta index 98b54c31e..4fa240bcf 100644 --- a/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab.meta +++ b/Assets/ThirdParty/MaxSdk/Prefabs/Interstitial.prefab.meta @@ -3,7 +3,6 @@ guid: 3fc0c2627ce8a4490b8e319326f8a535 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/Interstitial.prefab -- al_max_export_path-MaxSdk\Prefabs\Interstitial.prefab PrefabImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab b/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab index 1d85a9b9e..dd3457eff 100644 --- a/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab +++ b/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab @@ -355,6 +355,7 @@ GameObject: - component: {fileID: 3074011789293951898} - component: {fileID: 301935380126337495} - component: {fileID: 535359239537776472} + - component: {fileID: 1463999766055390634} m_Layer: 5 m_Name: EventSystem m_TagString: Untagged @@ -383,7 +384,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4010021198786516228} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: @@ -410,6 +411,18 @@ MonoBehaviour: m_InputActionsPerSecond: 10 m_RepeatDelay: 0.5 m_ForceModuleActive: 0 +--- !u!114 &1463999766055390634 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4010021198786516228} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0acf281ba86b4929a6942ecd998395b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &5668641863723001099 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab.meta b/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab.meta index 28c3fc07a..214bea119 100644 --- a/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab.meta +++ b/Assets/ThirdParty/MaxSdk/Prefabs/Rewarded.prefab.meta @@ -3,7 +3,6 @@ guid: a28c1544d6f094d5eafc8da2343c9119 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/Rewarded.prefab -- al_max_export_path-MaxSdk\Prefabs\Rewarded.prefab PrefabImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Resources/AppLovinSettings.asset b/Assets/ThirdParty/MaxSdk/Resources/AppLovinSettings.asset index 476470d58..9a0add4bb 100644 --- a/Assets/ThirdParty/MaxSdk/Resources/AppLovinSettings.asset +++ b/Assets/ThirdParty/MaxSdk/Resources/AppLovinSettings.asset @@ -16,6 +16,7 @@ MonoBehaviour: sdkKey: 9uHgeBwag3NXva9MC23ToO3q11Ve59bF1uwg4qGltdGmCQ7OSByFZ_3b1ZF7krMlkHQo5gXzIokVDsvg1rwbr- setAttributionReportEndpoint: 0 consentFlowEnabled: 0 + consentFlowPlatform: 0 consentFlowPrivacyPolicyUrl: consentFlowTermsOfServiceUrl: userTrackingUsageDescriptionEn: @@ -29,4 +30,4 @@ MonoBehaviour: userTrackingUsageDescriptionZhHant: adMobAndroidAppId: adMobIosAppId: ca-app-pub-8252390069143459~7358844489 - snapAppStoreAppId: 0 + showInternalSettingsInIntegrationManager: 0 diff --git a/Assets/ThirdParty/MaxSdk/Resources/Images/alert_icon.png.meta b/Assets/ThirdParty/MaxSdk/Resources/Images/alert_icon.png.meta index c6c04ba73..634d2904d 100644 --- a/Assets/ThirdParty/MaxSdk/Resources/Images/alert_icon.png.meta +++ b/Assets/ThirdParty/MaxSdk/Resources/Images/alert_icon.png.meta @@ -3,11 +3,10 @@ guid: 572fee4574afa4f6dbf2846e0c152fe8 labels: - al_max - al_max_export_path-MaxSdk/Resources/Images/alert_icon.png -- al_max_export_path-MaxSdk\Resources\Images\alert_icon.png TextureImporter: internalIDToNameTable: [] externalObjects: {} - serializedVersion: 11 + serializedVersion: 10 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -27,7 +26,6 @@ TextureImporter: isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 - vTOnly: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -36,12 +34,12 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -59,13 +57,9 @@ TextureImporter: textureType: 0 textureShape: 1 singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 1 platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform diff --git a/Assets/ThirdParty/MaxSdk/Resources/Images/uninstall_icon.png.meta b/Assets/ThirdParty/MaxSdk/Resources/Images/uninstall_icon.png.meta index d6689c7cc..0f398163b 100644 --- a/Assets/ThirdParty/MaxSdk/Resources/Images/uninstall_icon.png.meta +++ b/Assets/ThirdParty/MaxSdk/Resources/Images/uninstall_icon.png.meta @@ -3,11 +3,10 @@ guid: d24994f48fdd0430692e3d49279cd782 labels: - al_max - al_max_export_path-MaxSdk/Resources/Images/uninstall_icon.png -- al_max_export_path-MaxSdk\Resources\Images\uninstall_icon.png TextureImporter: internalIDToNameTable: [] externalObjects: {} - serializedVersion: 11 + serializedVersion: 10 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -27,7 +26,6 @@ TextureImporter: isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 - vTOnly: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -36,12 +34,12 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -59,13 +57,9 @@ TextureImporter: textureType: 0 textureShape: 1 singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 1 platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform diff --git a/Assets/ThirdParty/MaxSdk/Resources/Images/warning_icon.png.meta b/Assets/ThirdParty/MaxSdk/Resources/Images/warning_icon.png.meta index 50a37a83e..ee4941c37 100644 --- a/Assets/ThirdParty/MaxSdk/Resources/Images/warning_icon.png.meta +++ b/Assets/ThirdParty/MaxSdk/Resources/Images/warning_icon.png.meta @@ -3,11 +3,10 @@ guid: b504c956e7ed744b6b0e7f014e1cac5a labels: - al_max - al_max_export_path-MaxSdk/Resources/Images/warning_icon.png -- al_max_export_path-MaxSdk\Resources\Images\warning_icon.png TextureImporter: - internalIDToNameTable: [] + fileIDToRecycleName: {} externalObjects: {} - serializedVersion: 11 + serializedVersion: 9 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -27,7 +26,6 @@ TextureImporter: isReadable: 0 streamingMipmaps: 0 streamingMipmapsPriority: 0 - vTOnly: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -36,12 +34,12 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -59,15 +57,11 @@ TextureImporter: textureType: 0 textureShape: 1 singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 1 platformSettings: - - serializedVersion: 3 + - serializedVersion: 2 buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 @@ -78,7 +72,6 @@ TextureImporter: allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 1 spriteSheet: serializedVersion: 2 sprites: [] @@ -86,12 +79,10 @@ TextureImporter: physicsShape: [] bones: [] spriteID: - internalID: 0 vertices: [] indices: edges: [] weights: [] - secondaryTextures: [] spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor.meta b/Assets/ThirdParty/MaxSdk/Scripts/Editor.meta index 1bcbeed7c..7adfefb8b 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor.meta @@ -3,7 +3,6 @@ guid: b6903b66cb8984df289e6d66f9c52ddc labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor -- al_max_export_path-MaxSdk\Scripts\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs index 20f5f175f..709ec0009 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs @@ -17,39 +17,45 @@ namespace AppLovinMax.Scripts.Editor [InitializeOnLoad] public class MaxInitialize { - private const string AndroidChangelog = "ANDROID_CHANGELOG.md"; - private const string IosChangelog = "IOS_CHANGELOG.md"; - - private static readonly List Networks = new List - { - "AdColony", - "Amazon", - "ByteDance", - "Chartboost", - "Facebook", - "Fyber", - "Google", - "InMobi", - "IronSource", - "Maio", - "Mintegral", - "MyTarget", - "Nend", - "Ogury", - "Smaato", - "Tapjoy", - "TencentGDT", - "UnityAds", - "VerizonAds", - "Vungle", - "Yandex" - }; - private static readonly List ObsoleteNetworks = new List { + "Snap", "VoodooAds" }; +#if UNITY_2018_2_OR_NEWER + private static readonly List ObsoleteFileExportPathsToDelete = new List + { + // The `EventSystemChecker` has been renamed to `MaxEventSystemChecker`. + "MaxSdk/Scripts/EventSystemChecker.cs", + "MaxSdk/Scripts/EventSystemChecker.cs.meta", + + // Google AdMob adapter pre/post process scripts. The logic has been migrated to the main plugin. + "MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs", + "MaxSdk/Mediation/Google/Editor/MaxGoogleInitialize.cs.meta", + "MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs", + "MaxSdk/Mediation/Google/Editor/MaxMediationGoogleUtils.cs.meta", + "MaxSdk/Mediation/Google/Editor/PostProcessor.cs", + "MaxSdk/Mediation/Google/Editor/PostProcessor.cs.meta", + "MaxSdk/Mediation/Google/Editor/PreProcessor.cs", + "MaxSdk/Mediation/Google/Editor/PreProcessor.cs.meta", + "MaxSdk/Mediation/Google/Editor/MaxSdk.Mediation.Google.Editor.asmdef", + "MaxSdk/Mediation/Google/MaxSdk.Mediation.Google.Editor.asmdef.meta", + "Plugins/Android/MaxMediationGoogle.androidlib", + "Plugins/Android/MaxMediationGoogle.androidlib.meta", + + // Google Ad Manager adapter pre/post process scripts. The logic has been migrated to the main plugin + "MaxSdk/Mediation/GoogleAdManager/Editor/MaxGoogleAdManagerInitialize.cs", + "MaxSdk/Mediation/GoogleAdManager/Editor/MaxGoogleAdManagerInitialize.cs.meta", + "MaxSdk/Mediation/GoogleAdManager/Editor/PostProcessor.cs", + "MaxSdk/Mediation/GoogleAdManager/Editor/PostProcessor.cs.meta", + "MaxSdk/Mediation/GoogleAdManager/Editor/MaxSdk.Mediation.GoogleAdManager.Editor.asmdef", + "MaxSdk/Mediation/GoogleAdManager/Editor/MaxSdk.Mediation.GoogleAdManager.Editor.asmdef.meta", + "Plugins/Android/MaxMediationGoogleAdManager.androidlib", + "Plugins/Android/MaxMediationGoogleAdManager.androidlib.meta" + }; +#endif + static MaxInitialize() { #if UNITY_IOS @@ -77,29 +83,18 @@ namespace AppLovinMax.Scripts.Editor AppLovinIntegrationManager.AddLabelsToAssetsIfNeeded(pluginParentDir, isPluginOutsideAssetsDir); - // Check if we have legacy adapter CHANGELOGs. - foreach (var network in Networks) +#if UNITY_2018_2_OR_NEWER + foreach (var obsoleteFileExportPathToDelete in ObsoleteFileExportPathsToDelete) { - var mediationAdapterDir = Path.Combine(pluginParentDir, "MaxSdk/Mediation/" + network); - - // If new directory exists - if (CheckExistence(mediationAdapterDir)) + var pathToDelete = MaxSdkUtils.GetAssetPathForExportPath(obsoleteFileExportPathToDelete); + if (CheckExistence(pathToDelete)) { - var androidChangelogFile = Path.Combine(mediationAdapterDir, AndroidChangelog); - if (CheckExistence(androidChangelogFile)) - { - FileUtil.DeleteFileOrDirectory(androidChangelogFile); - changesMade = true; - } - - var iosChangelogFile = Path.Combine(mediationAdapterDir, IosChangelog); - if (CheckExistence(iosChangelogFile)) - { - FileUtil.DeleteFileOrDirectory(iosChangelogFile); - changesMade = true; - } + MaxSdkLogger.UserDebug("Deleting obsolete file '" + pathToDelete + "' that are no longer needed."); + FileUtil.DeleteFileOrDirectory(pathToDelete); + changesMade = true; } } +#endif // Check if any obsolete networks are installed foreach (var obsoleteNetwork in ObsoleteNetworks) diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta index 8a1a24450..a96a57714 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta @@ -3,7 +3,6 @@ guid: bc0c5693335e0408a95293c0d7b61137 labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxInitialization.cs -- al_max_export_path-MaxSdk\Scripts\Editor\MaxInitialization.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs index 6a8d58021..9b719383f 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs @@ -7,152 +7,266 @@ // #if UNITY_ANDROID && UNITY_2018_2_OR_NEWER - +using AppLovinMax.Scripts.IntegrationManager.Editor; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Linq; +using AppLovinMax.ThirdParty.MiniJson; using UnityEditor; using UnityEditor.Android; +using UnityEngine; namespace AppLovinMax.Scripts.Editor { /// /// A post processor used to update the Android project once it is generated. /// - public class MaxPostProcessBuildAndroid : IPostGenerateGradleAndroidProject - { -#if UNITY_2019_3_OR_NEWER - private const string PropertyAndroidX = "android.useAndroidX"; - private const string PropertyJetifier = "android.enableJetifier"; - private const string EnableProperty = "=true"; -#endif - private const string PropertyDexingArtifactTransform = "android.enableDexingArtifactTransform"; - private const string DisableProperty = "=false"; - private const string AppLovinVerboseLoggingOnKey = "applovin.sdk.verbose_logging"; +// public class MaxPostProcessBuildAndroid : IPostGenerateGradleAndroidProject +// { +// #if UNITY_2019_3_OR_NEWER +// private const string PropertyAndroidX = "android.useAndroidX"; +// private const string PropertyJetifier = "android.enableJetifier"; +// private const string EnableProperty = "=true"; +// #endif +// private const string PropertyDexingArtifactTransform = "android.enableDexingArtifactTransform"; +// private const string DisableProperty = "=false"; - public void OnPostGenerateGradleAndroidProject(string path) - { -#if UNITY_2019_3_OR_NEWER - var gradlePropertiesPath = Path.Combine(path, "../gradle.properties"); -#else - var gradlePropertiesPath = Path.Combine(path, "gradle.properties"); -#endif - var gradlePropertiesUpdated = new List(); +// private const string KeyMetaDataAppLovinSdkKey = "applovin.sdk.key"; +// private const string KeyMetaDataAppLovinVerboseLoggingOn = "applovin.sdk.verbose_logging"; +// private const string KeyMetaDataGoogleApplicationId = "com.google.android.gms.ads.APPLICATION_ID"; +// private const string KeyMetaDataGoogleAdManagerApp = "com.google.android.gms.ads.AD_MANAGER_APP"; - // If the gradle properties file already exists, make sure to add any previous properties. - if (File.Exists(gradlePropertiesPath)) - { - var lines = File.ReadAllLines(gradlePropertiesPath); +// private static readonly XNamespace AndroidNamespace = "http://schemas.android.com/apk/res/android"; -#if UNITY_2019_3_OR_NEWER - // Add all properties except AndroidX, Jetifier, and DexingArtifactTransform since they may already exist. We will re-add them below. - gradlePropertiesUpdated.AddRange(lines.Where(line => !line.Contains(PropertyAndroidX) && !line.Contains(PropertyJetifier) && !line.Contains(PropertyDexingArtifactTransform))); -#else - // Add all properties except DexingArtifactTransform since it may already exist. We will re-add it below. - gradlePropertiesUpdated.AddRange(lines.Where(line => !line.Contains(PropertyDexingArtifactTransform))); -#endif - } +// private static string PluginMediationDirectory +// { +// get +// { +// var pluginParentDir = AppLovinIntegrationManager.MediationSpecificPluginParentDirectory; +// return Path.Combine(pluginParentDir, "MaxSdk/Mediation/"); +// } +// } -#if UNITY_2019_3_OR_NEWER - // Enable AndroidX and Jetifier properties - gradlePropertiesUpdated.Add(PropertyAndroidX + EnableProperty); - gradlePropertiesUpdated.Add(PropertyJetifier + EnableProperty); -#endif - // Disable dexing using artifact transform (it causes issues for ExoPlayer with Gradle plugin 3.5.0+) - gradlePropertiesUpdated.Add(PropertyDexingArtifactTransform + DisableProperty); +// public void OnPostGenerateGradleAndroidProject(string path) +// { +// #if UNITY_2019_3_OR_NEWER +// var gradlePropertiesPath = Path.Combine(path, "../gradle.properties"); +// #else +// var gradlePropertiesPath = Path.Combine(path, "gradle.properties"); +// #endif +// var gradlePropertiesUpdated = new List(); - try - { - File.WriteAllText(gradlePropertiesPath, string.Join("\n", gradlePropertiesUpdated.ToArray()) + "\n"); - } - catch (Exception exception) - { - MaxSdkLogger.UserError("Failed to enable AndroidX and Jetifier. gradle.properties file write failed."); - Console.WriteLine(exception); - } - - EnableVerboseLoggingIfNeeded(path); - } +// // If the gradle properties file already exists, make sure to add any previous properties. +// if (File.Exists(gradlePropertiesPath)) +// { +// var lines = File.ReadAllLines(gradlePropertiesPath); - public int callbackOrder - { - get { return int.MaxValue; } - } +// #if UNITY_2019_3_OR_NEWER +// // Add all properties except AndroidX, Jetifier, and DexingArtifactTransform since they may already exist. We will re-add them below. +// gradlePropertiesUpdated.AddRange(lines.Where(line => !line.Contains(PropertyAndroidX) && !line.Contains(PropertyJetifier) && !line.Contains(PropertyDexingArtifactTransform))); +// #else +// // Add all properties except DexingArtifactTransform since it may already exist. We will re-add it below. +// gradlePropertiesUpdated.AddRange(lines.Where(line => !line.Contains(PropertyDexingArtifactTransform))); +// #endif +// } - private static void EnableVerboseLoggingIfNeeded(string path) - { - if (!EditorPrefs.HasKey(MaxSdkLogger.KeyVerboseLoggingEnabled)) return; +// #if UNITY_2019_3_OR_NEWER +// // Enable AndroidX and Jetifier properties +// gradlePropertiesUpdated.Add(PropertyAndroidX + EnableProperty); +// gradlePropertiesUpdated.Add(PropertyJetifier + EnableProperty); +// #endif +// // Disable dexing using artifact transform (it causes issues for ExoPlayer with Gradle plugin 3.5.0+) +// gradlePropertiesUpdated.Add(PropertyDexingArtifactTransform + DisableProperty); - var enabled = EditorPrefs.GetBool(MaxSdkLogger.KeyVerboseLoggingEnabled); - var manifestPath = Path.Combine(path, "src/main/AndroidManifest.xml"); - XDocument manifest; - try - { - manifest = XDocument.Load(manifestPath); - } -#pragma warning disable 0168 - catch (IOException exception) -#pragma warning restore 0168 - { - MaxSdkLogger.UserWarning("[AppLovin MAX] AndroidManifest.xml is missing."); - return; - } +// try +// { +// File.WriteAllText(gradlePropertiesPath, string.Join("\n", gradlePropertiesUpdated.ToArray()) + "\n"); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("Failed to enable AndroidX and Jetifier. gradle.properties file write failed."); +// Console.WriteLine(exception); +// } - // Get the `manifest` element. - var elementManifest = manifest.Element("manifest"); - if (elementManifest == null) - { - MaxSdkLogger.UserWarning("[AppLovin MAX] AndroidManifest.xml is invalid."); - return; - } +// ProcessAndroidManifest(path); - var elementApplication = elementManifest.Element("application"); - if (elementApplication == null) - { - MaxSdkLogger.UserWarning("[AppLovin MAX] AndroidManifest.xml is invalid."); - return; - } +// var rawResourceDirectory = Path.Combine(path, "src/main/res/raw"); +// if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) +// { +// // For Unity 2018.1 or older, the consent flow is enabled in AppLovinPreProcessAndroid. +// AppLovinPreProcessAndroid.EnableConsentFlowIfNeeded(rawResourceDirectory); +// } +// else +// { +// AppLovinPreProcessAndroid.EnableTermsFlowIfNeeded(rawResourceDirectory); +// } +// } - var descendants = elementApplication.Descendants(); - var verboseLoggingMetaData = descendants.FirstOrDefault(descendant => descendant.FirstAttribute != null && - descendant.FirstAttribute.Name.LocalName.Equals("name") && - descendant.FirstAttribute.Value.Equals(AppLovinVerboseLoggingOnKey) && - descendant.LastAttribute != null && - descendant.LastAttribute.Name.LocalName.Equals("value")); - - // check if applovin.sdk.verbose_logging meta data exists. - if (verboseLoggingMetaData != null) - { - if (enabled) - { - // update applovin.sdk.verbose_logging meta data value. - verboseLoggingMetaData.LastAttribute.Value = enabled.ToString(); - } - else - { - // remove applovin.sdk.verbose_logging meta data. - verboseLoggingMetaData.Remove(); - } - } - else - { - if (enabled) - { - // add applovin.sdk.verbose_logging meta data if it does not exist. - var metaData = new XElement("meta-data"); - XNamespace androidNamespace = "http://schemas.android.com/apk/res/android"; - metaData.Add(new XAttribute(androidNamespace + "name", AppLovinVerboseLoggingOnKey)); - metaData.Add(new XAttribute(androidNamespace + "value", enabled.ToString())); - elementApplication.Add(metaData); - } - } +// public int callbackOrder +// { +// get { return int.MaxValue; } +// } - // Save the updated manifest file. - manifest.Save(manifestPath); - } - } +// private static void ProcessAndroidManifest(string path) +// { +// var manifestPath = Path.Combine(path, "src/main/AndroidManifest.xml"); +// XDocument manifest; +// try +// { +// manifest = XDocument.Load(manifestPath); +// } +// #pragma warning disable 0168 +// catch (IOException exception) +// #pragma warning restore 0168 +// { +// MaxSdkLogger.UserWarning("[AppLovin MAX] AndroidManifest.xml is missing."); +// return; +// } + +// // Get the `manifest` element. +// var elementManifest = manifest.Element("manifest"); +// if (elementManifest == null) +// { +// MaxSdkLogger.UserWarning("[AppLovin MAX] AndroidManifest.xml is invalid."); +// return; +// } + +// var elementApplication = elementManifest.Element("application"); +// if (elementApplication == null) +// { +// MaxSdkLogger.UserWarning("[AppLovin MAX] AndroidManifest.xml is invalid."); +// return; +// } + +// var metaDataElements = elementApplication.Descendants().Where(element => element.Name.LocalName.Equals("meta-data")); + +// AddSdkKeyIfNeeded(elementApplication); +// EnableVerboseLoggingIfNeeded(elementApplication); +// AddGoogleApplicationIdIfNeeded(elementApplication, metaDataElements); + +// // Save the updated manifest file. +// manifest.Save(manifestPath); +// } + +// private static void AddSdkKeyIfNeeded(XElement elementApplication) +// { +// var sdkKey = AppLovinSettings.Instance.SdkKey; +// if (string.IsNullOrEmpty(sdkKey)) return; + +// var descendants = elementApplication.Descendants(); +// var sdkKeyMetaData = descendants.FirstOrDefault(descendant => descendant.FirstAttribute != null && +// descendant.FirstAttribute.Name.LocalName.Equals("name") && +// descendant.FirstAttribute.Value.Equals(KeyMetaDataAppLovinSdkKey) && +// descendant.LastAttribute != null && +// descendant.LastAttribute.Name.LocalName.Equals("value")); + +// // check if applovin.sdk.key meta data exists. +// if (sdkKeyMetaData != null) +// { +// sdkKeyMetaData.LastAttribute.Value = sdkKey; +// } +// else +// { +// // add applovin.sdk.key meta data if it does not exist. +// var metaData = CreateMetaDataElement(KeyMetaDataAppLovinSdkKey, sdkKey); +// elementApplication.Add(metaData); +// } +// } + +// private static void EnableVerboseLoggingIfNeeded(XElement elementApplication) +// { +// var enabled = EditorPrefs.GetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, false); + +// var descendants = elementApplication.Descendants(); +// var verboseLoggingMetaData = descendants.FirstOrDefault(descendant => descendant.FirstAttribute != null && +// descendant.FirstAttribute.Name.LocalName.Equals("name") && +// descendant.FirstAttribute.Value.Equals(KeyMetaDataAppLovinVerboseLoggingOn) && +// descendant.LastAttribute != null && +// descendant.LastAttribute.Name.LocalName.Equals("value")); + +// // check if applovin.sdk.verbose_logging meta data exists. +// if (verboseLoggingMetaData != null) +// { +// if (enabled) +// { +// // update applovin.sdk.verbose_logging meta data value. +// verboseLoggingMetaData.LastAttribute.Value = enabled.ToString(); +// } +// else +// { +// // remove applovin.sdk.verbose_logging meta data. +// verboseLoggingMetaData.Remove(); +// } +// } +// else +// { +// if (enabled) +// { +// // add applovin.sdk.verbose_logging meta data if it does not exist. +// var metaData = CreateMetaDataElement(KeyMetaDataAppLovinVerboseLoggingOn, enabled.ToString()); +// elementApplication.Add(metaData); +// } +// } +// } + +// private static void AddGoogleApplicationIdIfNeeded(XElement elementApplication, IEnumerable metaDataElements) +// { +// if (!AppLovinIntegrationManager.IsAdapterInstalled("Google") && !AppLovinIntegrationManager.IsAdapterInstalled("GoogleAdManager")) return; + +// var googleApplicationIdMetaData = GetMetaDataElement(metaDataElements, KeyMetaDataGoogleApplicationId); +// var appId = AppLovinSettings.Instance.AdMobAndroidAppId; +// // Log error if the App ID is not set. +// if (string.IsNullOrEmpty(appId) || !appId.StartsWith("ca-app-pub-")) +// { +// MaxSdkLogger.UserError("Google App ID is not set. Please enter a valid app ID within the AppLovin Integration Manager window."); +// return; +// } + +// // Check if the Google App ID meta data already exists. Update if it already exists. +// if (googleApplicationIdMetaData != null) +// { +// googleApplicationIdMetaData.SetAttributeValue(AndroidNamespace + "value", appId); +// } +// // Meta data doesn't exist, add it. +// else +// { +// elementApplication.Add(CreateMetaDataElement(KeyMetaDataGoogleApplicationId, appId)); +// } +// } + +// /// +// /// Creates and returns a meta-data element with the given name and value. +// /// +// private static XElement CreateMetaDataElement(string name, object value) +// { +// var metaData = new XElement("meta-data"); +// metaData.Add(new XAttribute(AndroidNamespace + "name", name)); +// metaData.Add(new XAttribute(AndroidNamespace + "value", value)); + +// return metaData; +// } + +// /// +// /// Looks through all the given meta-data elements to check if the required one exists. Returns null if it doesn't exist. +// /// +// private static XElement GetMetaDataElement(IEnumerable metaDataElements, string metaDataName) +// { +// foreach (var metaDataElement in metaDataElements) +// { +// var attributes = metaDataElement.Attributes(); +// if (attributes.Any(attribute => attribute.Name.Namespace.Equals(AndroidNamespace) +// && attribute.Name.LocalName.Equals("name") +// && attribute.Value.Equals(metaDataName))) +// { +// return metaDataElement; +// } +// } + +// return null; +// } +// } } #endif diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta index 2ed7bd92f..07e4133b4 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta @@ -3,7 +3,6 @@ guid: 75fed160a41749d4990cee871ee618a4 labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs -- al_max_export_path-MaxSdk\Scripts\Editor\MaxPostProcessBuildAndroid.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs index 8b251adae..9dd3d7d3e 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs @@ -40,63 +40,44 @@ namespace AppLovinMax.Scripts.Editor private const string AppLovinMaxResourcesDirectoryName = "AppLovinMAXResources"; private const string AppLovinAdvertisingAttributionEndpoint = "https://postbacks-app.com"; - private static readonly List AtsRequiringNetworks = new List + private const string AppLovinSettingsPlistFileName = "AppLovin-Settings.plist"; + private const string KeyConsentFlowInfo = "ConsentFlowInfo"; + private const string KeyConsentFlowEnabled = "ConsentFlowEnabled"; + private const string KeyConsentFlowTermsOfService = "ConsentFlowTermsOfService"; + private const string KeyConsentFlowPrivacyPolicy = "ConsentFlowPrivacyPolicy"; + private const string KeyConsentFlowAdvertisingPartners = "ConsentFlowAdvertisingPartners"; + private const string KeyConsentFlowIncludeDefaultAdvertisingPartners = "ConsentFlowIncludeDefaultAdvertisingPartners"; + private const string KeyConsentFlowAnalyticsPartners = "ConsentFlowAnalyticsPartners"; + private const string KeyConsentFlowIncludeDefaultAnalyticsPartners = "ConsentFlowIncludeDefaultAnalyticsPartners"; + + private static readonly List DynamicLibrariesToEmbed = new List { - "AdColony", - "ByteDance", - "Fyber", - "Google", - "GoogleAdManager", - "HyprMX", - "InMobi", - "IronSource", - "Smaato" + "DTBiOSSDK.xcframework", + "FBSDKCoreKit_Basics.xcframework", + "HyprMX.xcframework", + "IASDKCore.xcframework", + "MobileFuseSDK.xcframework", + "OMSDK_Appodeal.xcframework", + "OMSDK_Ogury.xcframework", + "OMSDK_Pubnativenet.xcframework", + "OMSDK_Smaato.xcframework" }; - private static List DynamicLibraryPathsToEmbed - { - get - { - var dynamicLibraryPathsToEmbed = new List(2); - dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "HyprMX/HyprMX.xcframework")); - dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "smaato-ios-sdk/vendor/OMSDK_Smaato.xcframework")); - dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "FBSDKCoreKit_Basics/XCFrameworks/FBSDKCoreKit_Basics.xcframework")); - dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "OguryAds/OguryAds/OMSDK_Ogury.xcframework")); - - if (ShouldEmbedSnapSdk()) - { - dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "SAKSDK/SAKSDK.framework")); - dynamicLibraryPathsToEmbed.Add(Path.Combine("Pods/", "SAKSDK/SAKSDK.xcframework")); - } - - return dynamicLibraryPathsToEmbed; - } - } - - /// - /// Some library paths might contain versions and can't be hardcoded. So, we'll instead search for these libraries in the Pods/ directory. - /// - private static List DynamicLibrariesToSearchToEmbed - { - get - { - return new List() - { - "OMSDK_Pubnativenet.xcframework" - }; - } - } - private static List SwiftLanguageNetworks { get { - var swiftLanguageNetworks = new List(1); - if (ShouldAddSwiftSupportForFacebook()) + var swiftLanguageNetworks = new List(); + if (AppLovinIntegrationManager.IsAdapterInstalled("Facebook", "6.9.0.0")) { swiftLanguageNetworks.Add("Facebook"); } + if (AppLovinIntegrationManager.IsAdapterInstalled("UnityAds", "4.4.0.0")) + { + swiftLanguageNetworks.Add("UnityAds"); + } + return swiftLanguageNetworks; } } @@ -104,6 +85,7 @@ namespace AppLovinMax.Scripts.Editor private static readonly List EmbedSwiftStandardLibrariesNetworks = new List { "Facebook", + "UnityAds" }; private static string PluginMediationDirectory @@ -131,38 +113,48 @@ namespace AppLovinMax.Scripts.Editor #endif EmbedDynamicLibrariesIfNeeded(buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionDe, "de", buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionEn, "en", buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionEs, "es", buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionFr, "fr", buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionJa, "ja", buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionKo, "ko", buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHans, "zh-Hans", buildPath, project, unityMainTargetGuid); - LocalizeUserTrackingDescriptionIfNeeded(AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant, "zh-Hant", buildPath, project, unityMainTargetGuid); + var internalSettingsEnabled = AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager; + var userTrackingUsageDescriptionDe = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionDe : AppLovinSettings.Instance.UserTrackingUsageDescriptionDe; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionDe, "de", buildPath, project, unityMainTargetGuid); + var userTrackingUsageDescriptionEn = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEn : AppLovinSettings.Instance.UserTrackingUsageDescriptionEn; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionEn, "en", buildPath, project, unityMainTargetGuid); + var userTrackingUsageDescriptionEs = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEs : AppLovinSettings.Instance.UserTrackingUsageDescriptionEs; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionEs, "es", buildPath, project, unityMainTargetGuid); + var userTrackingUsageDescriptionFr = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionFr : AppLovinSettings.Instance.UserTrackingUsageDescriptionFr; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionFr, "fr", buildPath, project, unityMainTargetGuid); + var userTrackingUsageDescriptionJa = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionJa : AppLovinSettings.Instance.UserTrackingUsageDescriptionJa; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionJa, "ja", buildPath, project, unityMainTargetGuid); + var userTrackingUsageDescriptionKo = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionKo : AppLovinSettings.Instance.UserTrackingUsageDescriptionKo; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionKo, "ko", buildPath, project, unityMainTargetGuid); + var userTrackingUsageDescriptionZhHans = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHans : AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHans; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionZhHans, "zh-Hans", buildPath, project, unityMainTargetGuid); + var userTrackingUsageDescriptionZhHant = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHant : AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant; + LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionZhHant, "zh-Hant", buildPath, project, unityMainTargetGuid); AddSwiftSupportIfNeeded(buildPath, project, unityFrameworkTargetGuid); EmbedSwiftStandardLibrariesIfNeeded(buildPath, project, unityMainTargetGuid); + AddYandexSettingsIfNeeded(project, unityMainTargetGuid); project.WriteToFile(projectPath); } private static void EmbedDynamicLibrariesIfNeeded(string buildPath, PBXProject project, string targetGuid) { - var dynamicLibraryPathsPresentInProject = DynamicLibraryPathsToEmbed.Where(dynamicLibraryPath => Directory.Exists(Path.Combine(buildPath, dynamicLibraryPath))).ToList(); - var podsDirectory = Path.Combine(buildPath, "Pods"); // Check that the Pods directory exists (it might not if a publisher is building with Generate Podfile setting disabled in EDM). - if (Directory.Exists(podsDirectory)) - { - foreach (var dynamicLibraryToSearch in DynamicLibrariesToSearchToEmbed) - { - // both .framework and .xcframework are directories, not files - var directories = Directory.GetDirectories(podsDirectory, dynamicLibraryToSearch, SearchOption.AllDirectories); - if (directories.Length <= 0) continue; + var podsDirectory = Path.Combine(buildPath, "Pods"); + if (!Directory.Exists(podsDirectory)) return; - var index = directories[0].LastIndexOf("Pods"); - var relativePath = directories[0].Substring(index); - dynamicLibraryPathsPresentInProject.Add(relativePath); - } + var dynamicLibraryPathsPresentInProject = new List(); + foreach (var dynamicLibraryToSearch in DynamicLibrariesToEmbed) + { + // both .framework and .xcframework are directories, not files + var directories = Directory.GetDirectories(podsDirectory, dynamicLibraryToSearch, SearchOption.AllDirectories); + if (directories.Length <= 0) continue; + + var dynamicLibraryAbsolutePath = directories[0]; + var index = dynamicLibraryAbsolutePath.LastIndexOf("Pods"); + var relativePath = dynamicLibraryAbsolutePath.Substring(index); + dynamicLibraryPathsPresentInProject.Add(relativePath); } if (dynamicLibraryPathsPresentInProject.Count <= 0) return; @@ -192,12 +184,6 @@ namespace AppLovinMax.Scripts.Editor runpathSearchPaths += "@executable_path/Frameworks"; project.SetBuildProperty(targetGuid, "LD_RUNPATH_SEARCH_PATHS", runpathSearchPaths); #endif - - if (ShouldEmbedSnapSdk()) - { - // Needed to build successfully on Xcode 12+, as Snap was build with latest Xcode but not as an xcframework - project.AddBuildProperty(targetGuid, "VALIDATE_WORKSPACE", "YES"); - } } private static void LocalizeUserTrackingDescriptionIfNeeded(string localizedUserTrackingDescription, string localeCode, string buildPath, PBXProject project, string targetGuid) @@ -210,8 +196,7 @@ namespace AppLovinMax.Scripts.Editor var infoPlistStringsFilePath = Path.Combine(localeSpecificDirectoryPath, "InfoPlist.strings"); // Check if localization has been disabled between builds, and remove them as needed. - var settings = AppLovinSettings.Instance; - if (!settings.ConsentFlowEnabled || !settings.UserTrackingUsageLocalizationEnabled || string.IsNullOrEmpty(localizedUserTrackingDescription)) + if (ShouldRemoveLocalization(localizedUserTrackingDescription)) { if (!File.Exists(infoPlistStringsFilePath)) return; @@ -268,6 +253,21 @@ namespace AppLovinMax.Scripts.Editor project.AddFileToBuild(targetGuid, guid); } + private static bool ShouldRemoveLocalization(string localizedUserTrackingDescription) + { + if (string.IsNullOrEmpty(localizedUserTrackingDescription)) return true; + + var settings = AppLovinSettings.Instance; + var internalSettingsEnabled = settings.ShowInternalSettingsInIntegrationManager; + if (internalSettingsEnabled) + { + var internalSettings = AppLovinInternalSettings.Instance; + return !internalSettings.ConsentFlowEnabled || !internalSettings.UserTrackingUsageLocalizationEnabled; + } + + return !settings.ConsentFlowEnabled || !settings.UserTrackingUsageLocalizationEnabled; + } + private static void AddSwiftSupportIfNeeded(string buildPath, PBXProject project, string targetGuid) { var swiftFileRelativePath = "Classes/MAXSwiftSupport.swift"; @@ -353,19 +353,30 @@ namespace AppLovinMax.Scripts.Editor var plist = new PlistDocument(); plist.ReadFromFile(plistPath); + SetSdkKeyIfNeeded(plist); SetAttributionReportEndpointIfNeeded(plist); #if UNITY_2018_2_OR_NEWER EnableVerboseLoggingIfNeeded(plist); + AddGoogleApplicationIdIfNeeded(plist); #endif - EnableConsentFlowIfNeeded(plist); + + AddSdkSettingsIfNeeded(plist, path); + EnableTermsFlowIfNeeded(plist); AddSkAdNetworksInfoIfNeeded(plist); - UpdateAppTransportSecuritySettingsIfNeeded(plist); - AddSnapAppStoreAppIdIfNeeded(plist); plist.WriteToFile(plistPath); } + private static void SetSdkKeyIfNeeded(PlistDocument plist) + { + var sdkKey = AppLovinSettings.Instance.SdkKey; + if (string.IsNullOrEmpty(sdkKey)) return; + + const string AppLovinVerboseLoggingOnKey = "AppLovinSdkKey"; + plist.root.SetString(AppLovinVerboseLoggingOnKey, sdkKey); + } + private static void SetAttributionReportEndpointIfNeeded(PlistDocument plist) { if (AppLovinSettings.Instance.SetAttributionReportEndpoint) @@ -401,14 +412,135 @@ namespace AppLovinMax.Scripts.Editor plist.root.values.Remove(AppLovinVerboseLoggingOnKey); } } + + private static void AddGoogleApplicationIdIfNeeded(PlistDocument plist) + { + if (!AppLovinIntegrationManager.IsAdapterInstalled("Google") && !AppLovinIntegrationManager.IsAdapterInstalled("GoogleAdManager")) return; + + const string googleApplicationIdentifier = "GADApplicationIdentifier"; + var appId = AppLovinSettings.Instance.AdMobIosAppId; + // Log error if the App ID is not set. + if (string.IsNullOrEmpty(appId) || !appId.StartsWith("ca-app-pub-")) + { + Debug.LogError("[AppLovin MAX] Google App ID is not set. Please enter a valid app ID within the AppLovin Integration Manager window."); + return; + } + + plist.root.SetString(googleApplicationIdentifier, appId); + } #endif - private static void EnableConsentFlowIfNeeded(PlistDocument plist) + private static void AddYandexSettingsIfNeeded(PBXProject project, string unityMainTargetGuid) { - // Check if consent flow is enabled. No need to update info.plist if consent flow is disabled. + if (!AppLovinIntegrationManager.IsAdapterInstalled("Yandex")) return; + + if (MaxSdkUtils.CompareVersions(PlayerSettings.iOS.targetOSVersionString, "12.0") == MaxSdkUtils.VersionComparisonResult.Lesser) + { + Debug.LogWarning("Your iOS target version is under the minimum required version by Yandex. Please update it to 12.0 or newer in your ProjectSettings and rebuild your project."); + return; + } + + project.SetBuildProperty(unityMainTargetGuid, "GENERATE_INFOPLIST_FILE", "NO"); + } + + private static void AddSdkSettingsIfNeeded(PlistDocument infoPlist, string buildPath) + { + if (!AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) return; + + // Right now internal settings is only needed for Consent Flow. Remove this setting once we add more settings. + if (!AppLovinInternalSettings.Instance.ConsentFlowEnabled) return; + + var sdkSettingsPlistPath = Path.Combine(buildPath, AppLovinSettingsPlistFileName); + var sdkSettingsPlist = new PlistDocument(); + if (File.Exists(sdkSettingsPlistPath)) + { + sdkSettingsPlist.ReadFromFile(sdkSettingsPlistPath); + } + + EnableConsentFlowIfNeeded(sdkSettingsPlist, infoPlist); + + sdkSettingsPlist.WriteToFile(sdkSettingsPlistPath); + + var projectPath = PBXProject.GetPBXProjectPath(buildPath); + var project = new PBXProject(); + project.ReadFromFile(projectPath); + +#if UNITY_2019_3_OR_NEWER + var unityMainTargetGuid = project.GetUnityMainTargetGuid(); +#else + var unityMainTargetGuid = project.TargetGuidByName(UnityMainTargetName); +#endif + + var guid = project.AddFile(AppLovinSettingsPlistFileName, AppLovinSettingsPlistFileName, PBXSourceTree.Source); + project.AddFileToBuild(unityMainTargetGuid, guid); + project.WriteToFile(projectPath); + } + + private static void EnableConsentFlowIfNeeded(PlistDocument applovinSettingsPlist, PlistDocument infoPlist) + { + var consentFlowEnabled = AppLovinInternalSettings.Instance.ConsentFlowEnabled; + var userTrackingUsageDescription = AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEn; + var privacyPolicyUrl = AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl; + if (string.IsNullOrEmpty(userTrackingUsageDescription) || string.IsNullOrEmpty(privacyPolicyUrl)) + { + AppLovinIntegrationManager.ShowBuildFailureDialog("You cannot use the AppLovin SDK's consent flow without defining a Privacy Policy URL and the `User Tracking Usage Description` in the AppLovin Integration Manager. \n\n" + + "Both values must be included to enable the SDK's consent flow."); + + // No need to update the info.plist here. Default consent flow state will be determined on the SDK side. + return; + } + + var consentFlowInfoRoot = applovinSettingsPlist.root.CreateDict(KeyConsentFlowInfo); + consentFlowInfoRoot.SetBoolean(KeyConsentFlowEnabled, consentFlowEnabled); + consentFlowInfoRoot.SetString(KeyConsentFlowPrivacyPolicy, privacyPolicyUrl); + + var termsOfServiceUrl = AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl; + if (!string.IsNullOrEmpty(termsOfServiceUrl)) + { + consentFlowInfoRoot.SetString(KeyConsentFlowTermsOfService, termsOfServiceUrl); + } + + var advertisingPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls; + if (MaxSdkUtils.IsValidString(advertisingPartnerUrls)) + { + var advertisingPartnerUrlsList = advertisingPartnerUrls.Split(','); + var advertisingPartnersArray = consentFlowInfoRoot.CreateArray(KeyConsentFlowAdvertisingPartners); + foreach (var advertisingPartner in advertisingPartnerUrlsList) + { + advertisingPartnersArray.AddString(advertisingPartner); + } + } + + consentFlowInfoRoot.SetBoolean(KeyConsentFlowIncludeDefaultAdvertisingPartners, AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls); + + var analyticsPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls; + if (MaxSdkUtils.IsValidString(analyticsPartnerUrls)) + { + var analyticsPartnerUrlsList = analyticsPartnerUrls.Split(','); + var analyticsPartnersArray = consentFlowInfoRoot.CreateArray(KeyConsentFlowAnalyticsPartners); + foreach (var analyticsPartnerUrl in analyticsPartnerUrlsList) + { + analyticsPartnersArray.AddString(analyticsPartnerUrl); + } + } + + consentFlowInfoRoot.SetBoolean(KeyConsentFlowIncludeDefaultAnalyticsPartners, AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls); + + infoPlist.root.SetString("NSUserTrackingUsageDescription", userTrackingUsageDescription); + } + + private static void EnableTermsFlowIfNeeded(PlistDocument plist) + { + if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) return; + + // Check if terms flow is enabled. No need to update info.plist if consent flow is disabled. var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled; if (!consentFlowEnabled) return; + // Check if terms flow is enabled for this format. + var consentFlowPlatform = AppLovinSettings.Instance.ConsentFlowPlatform; + if (consentFlowPlatform != Platform.All && consentFlowPlatform != Platform.iOS) return; + var userTrackingUsageDescription = AppLovinSettings.Instance.UserTrackingUsageDescriptionEn; var privacyPolicyUrl = AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl; if (string.IsNullOrEmpty(userTrackingUsageDescription) || string.IsNullOrEmpty(privacyPolicyUrl)) @@ -508,109 +640,38 @@ namespace AppLovinMax.Scripts.Editor } } - var unityWebRequest = UnityWebRequest.Get(uriBuilder.ToString()); - + using (var unityWebRequest = UnityWebRequest.Get(uriBuilder.ToString())) + { #if UNITY_2017_2_OR_NEWER - var operation = unityWebRequest.SendWebRequest(); + var operation = unityWebRequest.SendWebRequest(); #else - var operation = unityWebRequest.Send(); + var operation = unityWebRequest.Send(); #endif - // Wait for the download to complete or the request to timeout. - while (!operation.isDone) { } - + // Wait for the download to complete or the request to timeout. + while (!operation.isDone) { } #if UNITY_2020_1_OR_NEWER - if (unityWebRequest.result != UnityWebRequest.Result.Success) + if (unityWebRequest.result != UnityWebRequest.Result.Success) #elif UNITY_2017_2_OR_NEWER - if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) + if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #else - if (unityWebRequest.isError) + if (unityWebRequest.isError) #endif - { - MaxSdkLogger.UserError("Failed to retrieve SKAdNetwork IDs with error: " + unityWebRequest.error); - return new SkAdNetworkData(); + { + MaxSdkLogger.UserError("Failed to retrieve SKAdNetwork IDs with error: " + unityWebRequest.error); + return new SkAdNetworkData(); + } + + try + { + return JsonUtility.FromJson(unityWebRequest.downloadHandler.text); + } + catch (Exception exception) + { + MaxSdkLogger.UserError("Failed to parse data '" + unityWebRequest.downloadHandler.text + "' with exception: " + exception); + return new SkAdNetworkData(); + } } - - try - { - return JsonUtility.FromJson(unityWebRequest.downloadHandler.text); - } - catch (Exception exception) - { - MaxSdkLogger.UserError("Failed to parse data '" + unityWebRequest.downloadHandler.text + "' with exception: " + exception); - return new SkAdNetworkData(); - } - } - - private static void UpdateAppTransportSecuritySettingsIfNeeded(PlistDocument plist) - { - var mediationDir = PluginMediationDirectory; - var projectHasAtsRequiringNetworks = AtsRequiringNetworks.Any(atsRequiringNetwork => Directory.Exists(Path.Combine(mediationDir, atsRequiringNetwork))); - if (!projectHasAtsRequiringNetworks) return; - - var root = plist.root.values; - PlistElement atsRoot; - root.TryGetValue("NSAppTransportSecurity", out atsRoot); - - if (atsRoot == null || atsRoot.GetType() != typeof(PlistElementDict)) - { - // Add the missing App Transport Security settings for publishers if needed. - MaxSdkLogger.UserDebug("Adding App Transport Security settings..."); - atsRoot = plist.root.CreateDict("NSAppTransportSecurity"); - atsRoot.AsDict().SetBoolean("NSAllowsArbitraryLoads", true); - } - - var atsRootDict = atsRoot.AsDict().values; - // Check if both NSAllowsArbitraryLoads and NSAllowsArbitraryLoadsInWebContent are present and remove NSAllowsArbitraryLoadsInWebContent if both are present. - if (atsRootDict.ContainsKey("NSAllowsArbitraryLoads") && atsRootDict.ContainsKey("NSAllowsArbitraryLoadsInWebContent")) - { - MaxSdkLogger.UserDebug("Removing NSAllowsArbitraryLoadsInWebContent"); - atsRootDict.Remove("NSAllowsArbitraryLoadsInWebContent"); - } - } - - private static void AddSnapAppStoreAppIdIfNeeded(PlistDocument plist) - { - var snapDependencyPath = Path.Combine(PluginMediationDirectory, "Snap/Editor/Dependencies.xml"); - if (!File.Exists(snapDependencyPath)) return; - - // App Store App ID is only needed for iOS versions 2.0.0.0 or newer. - var currentVersion = AppLovinIntegrationManager.GetCurrentVersions(snapDependencyPath); - var iosVersionComparison = MaxSdkUtils.CompareVersions(currentVersion.Ios, AppLovinSettings.SnapAppStoreAppIdMinVersion); - if (iosVersionComparison == MaxSdkUtils.VersionComparisonResult.Lesser) return; - - if (AppLovinSettings.Instance.SnapAppStoreAppId <= 0) - { - MaxSdkLogger.UserError("Snap App Store App ID is not set. Please enter a valid App ID within the AppLovin Integration Manager window."); - return; - } - - plist.root.SetInteger("SCAppStoreAppID", AppLovinSettings.Instance.SnapAppStoreAppId); - } - - private static bool ShouldAddSwiftSupportForFacebook() - { - var facebookDependencyPath = Path.Combine(PluginMediationDirectory, "Facebook/Editor/Dependencies.xml"); - if (!File.Exists(facebookDependencyPath)) return false; - - var currentVersion = AppLovinIntegrationManager.GetCurrentVersions(facebookDependencyPath); - var iosVersionComparison = MaxSdkUtils.CompareVersions(currentVersion.Ios, "6.9.0.0"); - return iosVersionComparison != MaxSdkUtils.VersionComparisonResult.Lesser; - } - - private static bool ShouldEmbedSnapSdk() - { - var snapDependencyPath = Path.Combine(PluginMediationDirectory, "Snap/Editor/Dependencies.xml"); - if (!File.Exists(snapDependencyPath)) return false; - - // Return true for UNITY_2019_3_OR_NEWER because app will crash on launch unless embedded. -#if UNITY_2019_3_OR_NEWER - return true; -#else - var currentVersion = AppLovinIntegrationManager.GetCurrentVersions(snapDependencyPath); - var iosVersionComparison = MaxSdkUtils.CompareVersions(currentVersion.Ios, "1.0.7.2"); - return iosVersionComparison != MaxSdkUtils.VersionComparisonResult.Lesser; -#endif } #if UNITY_2019_3_OR_NEWER diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta index 43b19c281..78d2f6d56 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta @@ -3,7 +3,6 @@ guid: 29959b3cd36c484a9d57d6b7ca7f7bfa labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs -- al_max_export_path-MaxSdk\Scripts\Editor\MaxPostProcessBuildiOS.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta index 954f5327d..b13c71a33 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta @@ -3,9 +3,4 @@ guid: 691e0eb4b7a542dba2219d48c3254f1c labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef -- al_max_export_path-MaxSdk\Scripts\Editor\MaxSdk.Scripts.Editor.asmdef -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: +timeCreated: 1591749791 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager.meta index 9834ed9c0..39f65ccda 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager.meta @@ -3,7 +3,6 @@ guid: e01816bc45c944d03afb95d035caf0e1 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager -- al_max_export_path-MaxSdk\Scripts\IntegrationManager folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor.meta index 0a73f6957..1d8400ae3 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor.meta @@ -3,7 +3,6 @@ guid: 0da229e279400497786c39933fe02e52 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs index 6f5dd66bc..01cc63978 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs @@ -19,6 +19,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor public class AppLovinAutoUpdater { public const string KeyAutoUpdateEnabled = "com.applovin.auto_update_enabled"; +#if !UNITY_2018_2_OR_NEWER + private const string KeyOldUnityVersionWarningShown = "com.applovin.old_unity_version_warning_shown"; +#endif private const string KeyLastUpdateCheckTime = "com.applovin.last_update_check_time_v2"; // Updated to v2 to force adapter version checks in plugin version 3.1.10. private static readonly DateTime EpochTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); private static readonly int SecondsInADay = (int) TimeSpan.FromDays(1).TotalSeconds; @@ -61,6 +64,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor // Update last checked time. EditorPrefs.SetInt(KeyLastUpdateCheckTime, now); +#if !UNITY_2018_2_OR_NEWER + ShowNotSupportingOldUnityVersionsIfNeeded(); +#endif + // Load the plugin data AppLovinEditorCoroutine.StartCoroutine(AppLovinIntegrationManager.Instance.LoadPluginData(data => { @@ -149,6 +156,27 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor AppLovinIntegrationManager.ShowBuildFailureDialog(message); } +#if !UNITY_2018_2_OR_NEWER + private static void ShowNotSupportingOldUnityVersionsIfNeeded() + { + // Check if publisher has seen the warning before + if (EditorPrefs.GetBool(KeyOldUnityVersionWarningShown, false)) return; + + // Show a dialog if they haven't seen the warning yet. + var option = EditorUtility.DisplayDialog( + "WARNING: Old Unity Version Detected", + "AppLovin MAX Unity plugin will soon require Unity 2018.2 or newer to function. Please upgrade to a newer Unity version.", + "Ok", + "Don't Ask Again" + ); + + if (!option) // 'false' means `Don't Ask Again` was clicked. + { + EditorPrefs.SetBool(KeyOldUnityVersionWarningShown, true); + } + } +#endif + private static bool GoogleNetworkAdaptersCompatible(string googleVersion, string googleAdManagerVersion, string breakingVersion) { var googleResult = MaxSdkUtils.CompareVersions(googleVersion, breakingVersion); diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta index b210611f6..0070e745c 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta @@ -3,7 +3,6 @@ guid: 8bcdd5226273242c5bd9ec79568202e6 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinAutoUpdater.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta index 4479579e6..2c3ff20ed 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta @@ -3,7 +3,6 @@ guid: 2d0aa55f9a7d2440f871dfb256372a33 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinCommandLine.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs.meta index 8d5d0cd51..5a697759c 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs.meta @@ -3,7 +3,6 @@ guid: c85c3812a13e04838951767c1285e4da labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinDownloadHandler.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs index 1cc63d9ba..f5be9398e 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs @@ -7,6 +7,7 @@ // using System.Collections; +using System.Collections.Generic; using UnityEditor; namespace AppLovinMax.Scripts.IntegrationManager.Editor @@ -16,7 +17,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// public class AppLovinEditorCoroutine { - private readonly IEnumerator enumerator; + /// + /// Keeps track of the coroutine currently running. + /// + private IEnumerator enumerator; + + /// + /// Keeps track of coroutines that have yielded to the current enumerator. + /// + private readonly List history = new List(); private AppLovinEditorCoroutine(IEnumerator enumerator) { @@ -52,10 +61,30 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor private void OnEditorUpdate() { - // Coroutine has ended, stop updating. - if (!enumerator.MoveNext()) + if (enumerator.MoveNext()) { - Stop(); + // If there is a coroutine to yield for inside the coroutine, add the initial one to history and continue the second one + if (enumerator.Current is IEnumerator) + { + history.Add(enumerator); + enumerator = (IEnumerator) enumerator.Current; + } + } + else + { + // Current coroutine has ended, check if we have more coroutines in history to be run. + if (history.Count == 0) + { + // No more coroutines to run, stop updating. + Stop(); + } + // Step out and finish the code in the coroutine that yielded to it + else + { + var index = history.Count - 1; + enumerator = history[index]; + history.RemoveAt(index); + } } } } diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta index 3318d92eb..c622babf1 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta @@ -3,7 +3,6 @@ guid: 95747c688378548eeb92aeb528ac96ff labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinEditorCoroutine.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs index 94719e3b2..4eb0805a7 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs @@ -121,8 +121,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor public static readonly string GradleTemplatePath = Path.Combine("Assets/Plugins/Android", "mainTemplate.gradle"); public static readonly string DefaultPluginExportPath = Path.Combine("Assets", "MaxSdk"); - private const string DefaultMaxSdkAssetExportPath = "MaxSdk/Scripts/MaxSdk.cs"; - private static readonly string MaxSdkAssetExportPath = Path.Combine("MaxSdk", "Scripts/MaxSdk.cs"); + private const string MaxSdkAssetExportPath = "MaxSdk/Scripts/MaxSdk.cs"; /// /// Some publishers might re-export our plugin via Unity Package Manager and the plugin will not be under the Assets folder. This means that the mediation adapters, settings files should not be moved to the packages folder, @@ -164,16 +163,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor { // Search for the asset with the default exported path first, In most cases, we should be able to find the asset. // In some cases where we don't, use the platform specific export path to search for the asset (in case of migrating a project from Windows to Mac or vice versa). - var maxSdkScriptAssetPath = MaxSdkUtils.GetAssetPathForExportPath(DefaultMaxSdkAssetExportPath); - if (File.Exists(maxSdkScriptAssetPath)) - { - // maxSdkScriptAssetPath will always have AltDirectorySeparatorChar (/) as the path separator. Convert to platform specific path. - return maxSdkScriptAssetPath.Replace(DefaultMaxSdkAssetExportPath, "") - .Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); - } - - // We should never reach this line but leaving this in out of paranoia. - return MaxSdkUtils.GetAssetPathForExportPath(MaxSdkAssetExportPath).Replace(MaxSdkAssetExportPath, "") + var maxSdkScriptAssetPath = MaxSdkUtils.GetAssetPathForExportPath(MaxSdkAssetExportPath); + + // maxSdkScriptAssetPath will always have AltDirectorySeparatorChar (/) as the path separator. Convert to platform specific path. + return maxSdkScriptAssetPath.Replace(MaxSdkAssetExportPath, "") .Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); } } @@ -287,54 +280,55 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor public IEnumerator LoadPluginData(Action callback) { var url = string.Format("https://dash.applovin.com/docs/v1/unity_integration_manager?plugin_version={0}", GetPluginVersionForUrl()); - var www = UnityWebRequest.Get(url); - + using (var www = UnityWebRequest.Get(url)) + { #if UNITY_2017_2_OR_NEWER - var operation = www.SendWebRequest(); + var operation = www.SendWebRequest(); #else - var operation = www.Send(); + var operation = www.Send(); #endif - while (!operation.isDone) yield return new WaitForSeconds(0.1f); // Just wait till www is done. Our coroutine is pretty rudimentary. + while (!operation.isDone) yield return new WaitForSeconds(0.1f); // Just wait till www is done. Our coroutine is pretty rudimentary. #if UNITY_2020_1_OR_NEWER - if (www.result != UnityWebRequest.Result.Success) + if (www.result != UnityWebRequest.Result.Success) #elif UNITY_2017_2_OR_NEWER - if (www.isNetworkError || www.isHttpError) + if (www.isNetworkError || www.isHttpError) #else - if (www.isError) + if (www.isError) #endif - { - callback(null); - } - else - { - PluginData pluginData; - try { - pluginData = JsonUtility.FromJson(www.downloadHandler.text); + callback(null); } - catch (Exception exception) + else { - Console.WriteLine(exception); - pluginData = null; - } - - if (pluginData != null) - { - // Get current version of the plugin - var appLovinMax = pluginData.AppLovinMax; - UpdateCurrentVersions(appLovinMax, PluginParentDirectory); - - // Get current versions for all the mediation networks. - var mediationPluginParentDirectory = MediationSpecificPluginParentDirectory; - foreach (var network in pluginData.MediatedNetworks) + PluginData pluginData; + try { - UpdateCurrentVersions(network, mediationPluginParentDirectory); + pluginData = JsonUtility.FromJson(www.downloadHandler.text); + } + catch (Exception exception) + { + Console.WriteLine(exception); + pluginData = null; } - } - callback(pluginData); + if (pluginData != null) + { + // Get current version of the plugin + var appLovinMax = pluginData.AppLovinMax; + UpdateCurrentVersions(appLovinMax, PluginParentDirectory); + + // Get current versions for all the mediation networks. + var mediationPluginParentDirectory = MediationSpecificPluginParentDirectory; + foreach (var network in pluginData.MediatedNetworks) + { + UpdateCurrentVersions(network, mediationPluginParentDirectory); + } + } + + callback(pluginData); + } } } @@ -407,8 +401,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// Downloads the plugin file for a given network. /// /// Network for which to download the current version. + /// Whether or not to show the import window when downloading. Defaults to true. /// - public IEnumerator DownloadPlugin(Network network) + public IEnumerator DownloadPlugin(Network network, bool showImport = true) { var path = Path.Combine(Application.temporaryCachePath, GetPluginFileName(network)); // TODO: Maybe delete plugin file after finishing import. #if UNITY_2017_2_OR_NEWER @@ -425,16 +420,14 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor #if UNITY_2017_2_OR_NEWER var operation = webRequest.SendWebRequest(); #else - var operation = webRequest.Send(); + var operation = webRequest.Send(); #endif - while (!operation.isDone) { yield return new WaitForSeconds(0.1f); // Just wait till webRequest is completed. Our coroutine is pretty rudimentary. CallDownloadPluginProgressCallback(network.DisplayName, operation.progress, operation.isDone); } - #if UNITY_2020_1_OR_NEWER if (webRequest.result != UnityWebRequest.Result.Success) #elif UNITY_2017_2_OR_NEWER @@ -448,9 +441,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor else { importingNetwork = network; - AssetDatabase.ImportPackage(path, true); + AssetDatabase.ImportPackage(path, showImport); } + webRequest.Dispose(); webRequest = null; } @@ -479,6 +473,25 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor MaxSdkLogger.UserError(message); } + /// + /// Checks whether or not an adapter with the given version or newer exists. + /// + /// The name of the network (the root adapter folder name in "MaxSdk/Mediation/" folder. + /// The min adapter version to check for. Can be null if we want to check for any version. + /// true if an adapter with the min version is installed. + public static bool IsAdapterInstalled(string adapterName, string version = null) + { + var dependencyFilePath = MaxSdkUtils.GetAssetPathForExportPath("MaxSdk/Mediation/" + adapterName + "/Editor/Dependencies.xml"); + if (!File.Exists(dependencyFilePath)) return false; + + // If version is null, we just need the adapter installed. We don't have to check for a specific version. + if (version == null) return true; + + var currentVersion = AppLovinIntegrationManager.GetCurrentVersions(dependencyFilePath); + var iosVersionComparison = MaxSdkUtils.CompareVersions(currentVersion.Ios, version); + return iosVersionComparison != MaxSdkUtils.VersionComparisonResult.Lesser; + } + #region Utility Methods /// @@ -640,7 +653,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor didAddLabels = true; } - var exportPathLabel = "al_max_export_path-" + assetPath.Replace(pluginParentDir, ""); + var exportPathLabel = "al_max_export_path-" + assetPath.Replace(pluginParentDir, "").Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); if (!labels.Contains(exportPathLabel)) { labelsToAdd.Add(exportPathLabel); diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta index 9286246f1..e9e360309 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta @@ -3,7 +3,6 @@ guid: c5b874c1e65274159bcc0dc15d9458cc labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinIntegrationManager.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs index 98b198b34..59a3911e0 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs @@ -7,6 +7,7 @@ // using System; +using System.Collections; using System.IO; using System.Linq; using UnityEditor; @@ -32,23 +33,25 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor private const string qualityServiceRequiresGradleBuildErrorMsg = "AppLovin Quality Service integration via AppLovin Integration Manager requires Custom Gradle Template enabled or Unity 2018.2 or higher.\n" + "If you would like to continue using your existing setup, please add Quality Service Plugin to your build.gradle manually."; + + private readonly string[] termsFlowPlatforms = new string[3] {"Both", "Android", "iOS"}; private Vector2 scrollPosition; private static readonly Vector2 windowMinSize = new Vector2(750, 750); private const float actionFieldWidth = 60f; + private const float upgradeAllButtonWidth = 80f; private const float networkFieldMinWidth = 100f; private const float versionFieldMinWidth = 190f; - private const float privacySettingLabelWidth = 200f; + private const float privacySettingLabelWidth = 250f; private const float networkFieldWidthPercentage = 0.22f; private const float versionFieldWidthPercentage = 0.36f; // There are two version fields. Each take 40% of the width, network field takes the remaining 20%. private static float previousWindowWidth = windowMinSize.x; private static GUILayoutOption networkWidthOption = GUILayout.Width(networkFieldMinWidth); private static GUILayoutOption versionWidthOption = GUILayout.Width(versionFieldMinWidth); - private static GUILayoutOption sdkKeyTextFieldWidthOption = GUILayout.Width(520); - private static GUILayoutOption privacySettingFieldWidthOption = GUILayout.Width(400); private static readonly GUILayoutOption fieldWidth = GUILayout.Width(actionFieldWidth); + private static readonly GUILayoutOption upgradeAllButtonFieldWidth = GUILayout.Width(upgradeAllButtonWidth); private static readonly Color darkModeTextColor = new Color(0.29f, 0.6f, 0.8f); @@ -62,8 +65,8 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor private PluginData pluginData; private bool pluginDataLoadFailed; private bool isPluginMoved; - private bool shouldMarkNewLocalizations; private bool shouldShowGoogleWarning; + private bool networkButtonsEnabled = true; private AppLovinEditorCoroutine loadDataCoroutine; private Texture2D uninstallIcon; @@ -138,24 +141,22 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor private void OnEnable() { - shouldMarkNewLocalizations = !EditorPrefs.GetBool(keyNewLocalizationsMarked, false); - AppLovinIntegrationManager.downloadPluginProgressCallback = OnDownloadPluginProgress; // Plugin downloaded and imported. Update current versions for the imported package. AppLovinIntegrationManager.importPackageCompletedCallback = OnImportPackageCompleted; + // Disable old consent flow if internal settings are enabled. + if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) + { + AppLovinSettings.Instance.ConsentFlowEnabled = false; + } + Load(); } private void OnDisable() { - // New localizations have been shown to the publisher, now remove them. - if (shouldMarkNewLocalizations) - { - EditorPrefs.SetBool(keyNewLocalizationsMarked, true); - } - if (loadDataCoroutine != null) { loadDataCoroutine.Stop(); @@ -190,11 +191,16 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor DrawPluginDetails(); // Draw mediated networks - EditorGUILayout.LabelField("Mediated Networks", titleLabelStyle); + using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandHeight(false))) + { + EditorGUILayout.LabelField("Mediated Networks", titleLabelStyle); + DrawUpgradeAllButton(); + } + DrawMediatedNetworks(); // Draw AppLovin Quality Service settings - EditorGUILayout.LabelField("AppLovin Quality Service", titleLabelStyle); + EditorGUILayout.LabelField("SDK Settings", titleLabelStyle); DrawQualityServiceSettings(); EditorGUILayout.LabelField("Privacy Settings", titleLabelStyle); @@ -218,6 +224,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor if (GUI.changed) { AppLovinSettings.Instance.SaveAsync(); + AppLovinInternalSettings.Instance.Save(); } } @@ -306,6 +313,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.Space(5); } + +#if !UNITY_2018_2_OR_NEWER + EditorGUILayout.HelpBox("AppLovin MAX Unity plugin will soon require Unity 2018.2 or newer to function. Please upgrade to a newer Unity version.", MessageType.Warning); +#endif } GUILayout.Space(5); @@ -378,7 +389,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor DrawNetworkDetailRow(network); } - GUILayout.Space(5); + GUILayout.Space(10); } } @@ -448,7 +459,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.Label(new GUIContent {image = warningIcon, tooltip = "You may see unexpected errors if you use different versions of the AdMob and Google Ad Manager adapter SDKs."}, iconStyle); } - GUI.enabled = isActionEnabled; + GUI.enabled = networkButtonsEnabled && isActionEnabled; if (GUILayout.Button(new GUIContent(action), fieldWidth)) { // Download the plugin. @@ -458,7 +469,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUI.enabled = true; GUILayout.Space(2); - GUI.enabled = isInstalled; + GUI.enabled = networkButtonsEnabled && isInstalled; if (GUILayout.Button(new GUIContent {image = uninstallIcon, tooltip = "Uninstall"}, iconStyle)) { EditorUtility.DisplayProgressBar("Integration Manager", "Deleting " + network.Name + "...", 0.5f); @@ -481,68 +492,60 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor if (isInstalled) { - // Custom integration for AdMob where the user can enter the Android and iOS App IDs. - if (network.Name.Equals("ADMOB_NETWORK")) - { - // Custom integration requires Google AdMob adapter version newer than android_19.0.1.0_ios_7.57.0.0. - if (MaxSdkUtils.CompareUnityMediationVersions(network.CurrentVersions.Unity, "android_19.0.1.0_ios_7.57.0.0") == VersionComparisonResult.Greater) - { - GUILayout.BeginHorizontal(); - GUILayout.Space(20); - using (new EditorGUILayout.VerticalScope("box")) - { - string requiredVersion; - string warningMessage; - if (isPluginMoved) - { - requiredVersion = "android_19.6.0.1_ios_7.69.0.0"; - warningMessage = "Looks like the MAX plugin has been moved to a different directory. This requires Google adapter version newer than " + requiredVersion + " for auto-export of AdMob App ID to work correctly."; - } - else - { - requiredVersion = "android_19.2.0.0_ios_7.61.0.0"; - warningMessage = "The current version of AppLovin MAX plugin requires Google adapter version newer than " + requiredVersion + " to enable auto-export of AdMob App ID."; - } - - GUILayout.Space(2); - if (MaxSdkUtils.CompareUnityMediationVersions(network.CurrentVersions.Unity, requiredVersion) == VersionComparisonResult.Greater) - { - AppLovinSettings.Instance.AdMobAndroidAppId = DrawTextField("App ID (Android)", AppLovinSettings.Instance.AdMobAndroidAppId, networkWidthOption); - AppLovinSettings.Instance.AdMobIosAppId = DrawTextField("App ID (iOS)", AppLovinSettings.Instance.AdMobIosAppId, networkWidthOption); - } - else - { - EditorGUILayout.HelpBox(warningMessage, MessageType.Warning); - } - } - - GUILayout.EndHorizontal(); - } - } - // Snap requires SCAppStoreAppID to be set starting adapter version 2.0.0.0 or newer. Show a text field for the publisher to input the App ID. - else if (network.Name.Equals("SNAP_NETWORK") && - MaxSdkUtils.CompareVersions(network.CurrentVersions.Ios, AppLovinSettings.SnapAppStoreAppIdMinVersion) != VersionComparisonResult.Lesser) - { - GUILayout.BeginHorizontal(); - GUILayout.Space(20); - using (new EditorGUILayout.VerticalScope("box")) - { - GUILayout.Space(2); - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - EditorGUILayout.LabelField(new GUIContent("App Store App ID (iOS)"), networkWidthOption); - GUILayout.Space(4); - AppLovinSettings.Instance.SnapAppStoreAppId = EditorGUILayout.IntField(AppLovinSettings.Instance.SnapAppStoreAppId); - GUILayout.Space(4); - GUILayout.EndHorizontal(); - GUILayout.Space(2); - } - - GUILayout.EndHorizontal(); - } + DrawGoogleAppIdTextBoxIfNeeded(network); } } + private void DrawGoogleAppIdTextBoxIfNeeded(Network network) + { + // Custom integration for AdMob where the user can enter the Android and iOS App IDs. + if (network.Name.Equals("ADMOB_NETWORK")) + { + // Show only one set of text boxes if both ADMOB and GAM are installed + if (AppLovinIntegrationManager.IsAdapterInstalled("GoogleAdManager")) return; + + DrawGoogleAppIdTextBox(); + } + + // Custom integration for GAM where the user can enter the Android and iOS App IDs. + else if (network.Name.Equals("GOOGLE_AD_MANAGER_NETWORK")) + { + DrawGoogleAppIdTextBox(); + } + } + + /// + /// Draws the text box for GAM or ADMOB to input the App ID + /// + private void DrawGoogleAppIdTextBox() + { + GUILayout.BeginHorizontal(); + GUILayout.Space(20); + using (new EditorGUILayout.VerticalScope("box")) + { + GUILayout.Space(2); + AppLovinSettings.Instance.AdMobAndroidAppId = DrawTextField("App ID (Android)", AppLovinSettings.Instance.AdMobAndroidAppId, networkWidthOption); + AppLovinSettings.Instance.AdMobIosAppId = DrawTextField("App ID (iOS)", AppLovinSettings.Instance.AdMobIosAppId, networkWidthOption); + } + + GUILayout.EndHorizontal(); + } + + /// + /// Draws the upgrade all button + /// + private void DrawUpgradeAllButton() + { + GUI.enabled = NetworksRequireUpgrade(); + if (GUILayout.Button(new GUIContent("Upgrade All"), upgradeAllButtonFieldWidth)) + { + AppLovinEditorCoroutine.StartCoroutine(UpgradeAllNetworks()); + } + + GUI.enabled = true; + GUILayout.Space(10); + } + private void DrawQualityServiceSettings() { GUILayout.BeginHorizontal(); @@ -550,15 +553,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor using (new EditorGUILayout.VerticalScope("box")) { GUILayout.Space(4); - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - AppLovinSettings.Instance.QualityServiceEnabled = GUILayout.Toggle(AppLovinSettings.Instance.QualityServiceEnabled, " Enable MAX Ad Review"); - GUILayout.EndHorizontal(); - GUILayout.Space(4); - if (!AppLovinIntegrationManager.CanProcessAndroidQualityServiceSettings) { - GUILayout.Space(2); + GUILayout.Space(4); GUILayout.BeginHorizontal(); GUILayout.Space(4); EditorGUILayout.HelpBox(qualityServiceRequiresGradleBuildErrorMsg, MessageType.Warning); @@ -568,8 +565,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.Space(4); } - GUI.enabled = AppLovinSettings.Instance.QualityServiceEnabled; - AppLovinSettings.Instance.SdkKey = DrawTextField("AppLovin SDK Key", AppLovinSettings.Instance.SdkKey, networkWidthOption, sdkKeyTextFieldWidthOption); + AppLovinSettings.Instance.SdkKey = DrawTextField("AppLovin SDK Key", AppLovinSettings.Instance.SdkKey, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); GUILayout.BeginHorizontal(); GUILayout.Space(4); GUILayout.Button("You can find your SDK key here: ", wrapTextLabelStyle, GUILayout.Width(185)); // Setting a fixed width since Unity adds arbitrary padding at the end leaving a space between link and text. @@ -580,7 +576,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); - GUI.enabled = true; + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinSettings.Instance.QualityServiceEnabled = GUILayout.Toggle(AppLovinSettings.Instance.QualityServiceEnabled, " Enable MAX Ad Review"); + GUILayout.EndHorizontal(); + GUILayout.Space(4); GUILayout.Space(4); } @@ -589,13 +591,28 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.EndHorizontal(); } - private string DrawTextField(string fieldTitle, string text, GUILayoutOption labelWidth, GUILayoutOption textFieldWidthOption = null) + private string DrawTextField(string fieldTitle, string text, GUILayoutOption labelWidth, GUILayoutOption textFieldWidthOption = null, bool isTextFieldEditable = true) { GUILayout.BeginHorizontal(); GUILayout.Space(4); EditorGUILayout.LabelField(new GUIContent(fieldTitle), labelWidth); GUILayout.Space(4); - text = (textFieldWidthOption == null) ? GUILayout.TextField(text) : GUILayout.TextField(text, textFieldWidthOption); + if (isTextFieldEditable) + { + text = (textFieldWidthOption == null) ? GUILayout.TextField(text) : GUILayout.TextField(text, textFieldWidthOption); + } + else + { + if (textFieldWidthOption == null) + { + GUILayout.Label(text); + } + else + { + GUILayout.Label(text, textFieldWidthOption); + } + } + GUILayout.Space(4); GUILayout.EndHorizontal(); GUILayout.Space(4); @@ -609,74 +626,183 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.Space(10); using (new EditorGUILayout.VerticalScope("box")) { - GUILayout.Space(4); - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - AppLovinSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinSettings.Instance.ConsentFlowEnabled, " Enable Consent Flow (iOS Only)"); - GUILayout.EndHorizontal(); - GUILayout.Space(4); - - GUI.enabled = AppLovinSettings.Instance.ConsentFlowEnabled; - - AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl = DrawTextField("Privacy Policy URL", AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - AppLovinSettings.Instance.ConsentFlowTermsOfServiceUrl = DrawTextField("Terms of Service URL (optional)", AppLovinSettings.Instance.ConsentFlowTermsOfServiceUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - AppLovinSettings.Instance.UserTrackingUsageDescriptionEn = DrawTextField("User Tracking Usage Description", AppLovinSettings.Instance.UserTrackingUsageDescriptionEn, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - AppLovinSettings.Instance.UserTrackingUsageLocalizationEnabled = GUILayout.Toggle(AppLovinSettings.Instance.UserTrackingUsageLocalizationEnabled, " Localize User Tracking Usage Description"); - GUILayout.EndHorizontal(); - GUILayout.Space(4); - - if (AppLovinSettings.Instance.UserTrackingUsageLocalizationEnabled) + var shouldDrawInternalSettings = AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager; + if (shouldDrawInternalSettings) { - AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHans = DrawTextField("Chinese, Simplified (zh-Hans)", AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHans, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant = DrawTextField("Chinese, Traditional (zh-Hant)" + (shouldMarkNewLocalizations ? " *" : ""), AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); // TODO: Remove new mark for next release. - AppLovinSettings.Instance.UserTrackingUsageDescriptionFr = DrawTextField("French (fr)", AppLovinSettings.Instance.UserTrackingUsageDescriptionFr, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - AppLovinSettings.Instance.UserTrackingUsageDescriptionDe = DrawTextField("German (de)", AppLovinSettings.Instance.UserTrackingUsageDescriptionDe, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - AppLovinSettings.Instance.UserTrackingUsageDescriptionJa = DrawTextField("Japanese (ja)", AppLovinSettings.Instance.UserTrackingUsageDescriptionJa, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - AppLovinSettings.Instance.UserTrackingUsageDescriptionKo = DrawTextField("Korean (ko)", AppLovinSettings.Instance.UserTrackingUsageDescriptionKo, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - AppLovinSettings.Instance.UserTrackingUsageDescriptionEs = DrawTextField("Spanish (es)", AppLovinSettings.Instance.UserTrackingUsageDescriptionEs, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); - - GUILayout.Space(4); - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - EditorGUILayout.HelpBox((shouldMarkNewLocalizations ? "* " : "") + "MAX may add more localized strings to this list in the future, which will set the default value of the User Tracking Usage Description string for more locales. If you are overriding these with your own custom translations, you may want to review this list whenever you upgrade the plugin to see if there are new entries you may want to customize.", MessageType.Info); - GUILayout.Space(4); - GUILayout.EndHorizontal(); - - GUILayout.Space(4); - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - EditorGUILayout.HelpBox("If you have your own implementation of InfoPlist.strings localization implementation, please use that instead. Using both at the same time may cause conflicts.", MessageType.Info); - GUILayout.Space(4); - GUILayout.EndHorizontal(); + DrawConsentFlowSettings(); } - - GUI.enabled = true; - - GUILayout.Space(4); - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - GUILayout.Button("Click the link below for more information about User Tracking Usage Description: ", wrapTextLabelStyle); - GUILayout.Space(4); - GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.Space(4); - if (GUILayout.Button(new GUIContent(userTrackingUsageDescriptionDocsLink), linkLabelStyle)) + else { - Application.OpenURL(userTrackingUsageDescriptionDocsLink); + DrawTermsFlowSettings(); } - - GUILayout.Space(4); - GUILayout.EndHorizontal(); - GUILayout.Space(4); } GUILayout.Space(5); GUILayout.EndHorizontal(); } + private void DrawTermsFlowSettings() + { + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinSettings.Instance.ConsentFlowEnabled, " Enable Terms Flow"); + GUILayout.FlexibleSpace(); + GUI.enabled = AppLovinSettings.Instance.ConsentFlowEnabled; + AppLovinSettings.Instance.ConsentFlowPlatform = (Platform) EditorGUILayout.Popup((int) AppLovinSettings.Instance.ConsentFlowPlatform, termsFlowPlatforms); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + + AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl = DrawTextField("Privacy Policy URL", AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinSettings.Instance.ConsentFlowTermsOfServiceUrl = DrawTextField("Terms of Service URL (optional)", AppLovinSettings.Instance.ConsentFlowTermsOfServiceUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinSettings.Instance.UserTrackingUsageDescriptionEn = DrawTextField("User Tracking Usage Description (iOS only)", AppLovinSettings.Instance.UserTrackingUsageDescriptionEn, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinSettings.Instance.UserTrackingUsageLocalizationEnabled = GUILayout.Toggle(AppLovinSettings.Instance.UserTrackingUsageLocalizationEnabled, " Localize User Tracking Usage Description (iOS only)"); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + + if (AppLovinSettings.Instance.UserTrackingUsageLocalizationEnabled) + { + AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHans = DrawTextField("Chinese, Simplified (zh-Hans)", AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHans, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant = DrawTextField("Chinese, Traditional (zh-Hant)", AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); // TODO: Remove new mark for next release. + AppLovinSettings.Instance.UserTrackingUsageDescriptionFr = DrawTextField("French (fr)", AppLovinSettings.Instance.UserTrackingUsageDescriptionFr, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinSettings.Instance.UserTrackingUsageDescriptionDe = DrawTextField("German (de)", AppLovinSettings.Instance.UserTrackingUsageDescriptionDe, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinSettings.Instance.UserTrackingUsageDescriptionJa = DrawTextField("Japanese (ja)", AppLovinSettings.Instance.UserTrackingUsageDescriptionJa, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinSettings.Instance.UserTrackingUsageDescriptionKo = DrawTextField("Korean (ko)", AppLovinSettings.Instance.UserTrackingUsageDescriptionKo, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinSettings.Instance.UserTrackingUsageDescriptionEs = DrawTextField("Spanish (es)", AppLovinSettings.Instance.UserTrackingUsageDescriptionEs, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + EditorGUILayout.HelpBox("MAX may add more localized strings to this list in the future, which will set the default value of the User Tracking Usage Description string for more locales. If you are overriding these with your own custom translations, you may want to review this list whenever you upgrade the plugin to see if there are new entries you may want to customize.", MessageType.Info); + GUILayout.Space(4); + GUILayout.EndHorizontal(); + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + EditorGUILayout.HelpBox("If you have your own implementation of InfoPlist.strings localization implementation, please use that instead. Using both at the same time may cause conflicts.", MessageType.Info); + GUILayout.Space(4); + GUILayout.EndHorizontal(); + } + + GUI.enabled = true; + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + GUILayout.Button("Click the link below for more information about User Tracking Usage Description: ", wrapTextLabelStyle); + GUILayout.Space(4); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + if (GUILayout.Button(new GUIContent(userTrackingUsageDescriptionDocsLink), linkLabelStyle)) + { + Application.OpenURL(userTrackingUsageDescriptionDocsLink); + } + + GUILayout.Space(4); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + } + + private void DrawConsentFlowSettings() + { + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinInternalSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinInternalSettings.Instance.ConsentFlowEnabled, " Enable Consent Flow"); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + GUI.enabled = true; + + if (!AppLovinInternalSettings.Instance.ConsentFlowEnabled) return; + + AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl = DrawTextField("Privacy Policy URL", AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl = DrawTextField("Terms of Service URL (optional)", AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls = GUILayout.Toggle(AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls, " Include Default Advertising Partner URLs"); + GUILayout.EndHorizontal(); + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls = DrawTextField("Advertising Partner URLs (CSV)", AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + GUILayout.EndHorizontal(); + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls = GUILayout.Toggle(AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls, " Include Default Analytics Partner URLs"); + GUILayout.EndHorizontal(); + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls = DrawTextField("Analytics Partner URLs (CSV)", AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + EditorGUILayout.LabelField("iOS specific settings:", headerLabelStyle); + GUILayout.EndHorizontal(); + + var isEditableTextField = AppLovinInternalSettings.Instance.OverrideDefaultUserTrackingUsageDescriptions; + + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinInternalSettings.Instance.OverrideDefaultUserTrackingUsageDescriptions = GUILayout.Toggle(AppLovinInternalSettings.Instance.OverrideDefaultUserTrackingUsageDescriptions, " Override Default User Tracking Usage Description"); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + + GUILayout.Space(4); + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEn = DrawTextField("User Tracking Usage Description", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEn, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + AppLovinInternalSettings.Instance.UserTrackingUsageLocalizationEnabled = GUILayout.Toggle(AppLovinInternalSettings.Instance.UserTrackingUsageLocalizationEnabled, " Localize User Tracking Usage Description"); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + + if (AppLovinInternalSettings.Instance.UserTrackingUsageLocalizationEnabled) + { + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHans = DrawTextField("Chinese, Simplified (zh-Hans)", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHans, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHant = DrawTextField("Chinese, Traditional (zh-Hant)", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHant, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionFr = DrawTextField("French (fr)", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionFr, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionDe = DrawTextField("German (de)", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionDe, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionJa = DrawTextField("Japanese (ja)", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionJa, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionKo = DrawTextField("Korean (ko)", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionKo, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEs = DrawTextField("Spanish (es)", AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEs, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption, isEditableTextField); + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + EditorGUILayout.HelpBox("If you have your own implementation of InfoPlist.strings localization implementation, please use that instead. Using both at the same time may cause conflicts.", MessageType.Info); + GUILayout.Space(4); + GUILayout.EndHorizontal(); + } + + GUILayout.Space(4); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + GUILayout.Button("Click the link below for more information about User Tracking Usage Description: ", wrapTextLabelStyle); + GUILayout.Space(4); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.Space(4); + if (GUILayout.Button(new GUIContent(userTrackingUsageDescriptionDocsLink), linkLabelStyle)) + { + Application.OpenURL(userTrackingUsageDescriptionDocsLink); + } + + GUILayout.Space(4); + GUILayout.EndHorizontal(); + GUILayout.Space(4); + } + private void DrawOtherSettings() { GUILayout.BeginHorizontal(); @@ -761,9 +887,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor versionWidthOption = GUILayout.Width(versionLabelWidth); const int textFieldOtherUiElementsWidth = 45; // NOTE: Magic number alert. This is the sum of all the spacing the fields and other UI elements. - var availableTextFieldWidth = currentWidth - networkLabelWidth - textFieldOtherUiElementsWidth; - sdkKeyTextFieldWidthOption = GUILayout.Width(availableTextFieldWidth); - var availableUserDescriptionTextFieldWidth = currentWidth - privacySettingLabelWidth - textFieldOtherUiElementsWidth; privacySettingFieldWidthOption = GUILayout.Width(availableUserDescriptionTextFieldWidth); } @@ -849,6 +972,42 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor } } + /// + /// Upgrades all outdated networks + /// + private IEnumerator UpgradeAllNetworks() + { + networkButtonsEnabled = false; + EditorApplication.LockReloadAssemblies(); + var networks = pluginData.MediatedNetworks; + foreach (var network in networks) + { + var comparison = network.CurrentToLatestVersionComparisonResult; + // A newer version is available + if (!string.IsNullOrEmpty(network.CurrentVersions.Unity) && comparison == VersionComparisonResult.Lesser) + { + yield return AppLovinIntegrationManager.Instance.DownloadPlugin(network, false); + } + } + + EditorApplication.UnlockReloadAssemblies(); + networkButtonsEnabled = true; + + // The pluginData becomes stale after the networks have been updated, and we should re-load it. + Load(); + } + + /// + /// Returns whether any network adapter needs to be upgraded + /// + private bool NetworksRequireUpgrade() + { + if (pluginData == null || pluginData.AppLovinMax.CurrentVersions == null) return false; + + var networks = pluginData.MediatedNetworks; + return networks.Any(network => !string.IsNullOrEmpty(network.CurrentVersions.Unity) && network.CurrentToLatestVersionComparisonResult == VersionComparisonResult.Lesser); + } + #endregion } } diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta index 75b29e466..d7996fddb 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta @@ -3,7 +3,6 @@ guid: 84c61b4c05e114cec91df447d1b585f8 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinIntegrationManagerWindow.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs new file mode 100644 index 000000000..61962f3b6 --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs @@ -0,0 +1,329 @@ +// +// AppLovinInternalSettigns.cs +// AppLovin User Engagement Unity Plugin +// +// Created by Santosh Bagadi on 9/15/22. +// Copyright © 2022 AppLovin. All rights reserved. +// + +using System; +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +namespace AppLovinMax.Scripts.IntegrationManager.Editor +{ + /// + /// A representing the AppLovin internal settings that can be set in the Integration Manager Window. + /// + /// The scriptable object asset is saved under ProjectSettings as AppLovinInternalSettings.json. + /// + public class AppLovinInternalSettings : ScriptableObject + { + private static AppLovinInternalSettings instance; + + public const string DefaultUserTrackingDescriptionEn = "This uses device info for more personalized ads and content"; + public const string DefaultUserTrackingDescriptionDe = "Dies benutzt Gerätinformationen für relevantere Werbeinhalte"; + public const string DefaultUserTrackingDescriptionEs = "Esto utiliza la información del dispositivo para anuncios y contenido más personalizados"; + public const string DefaultUserTrackingDescriptionFr = "Cela permet d'utiliser les informations du téléphone pour afficher des contenus publicitaires plus pertinents."; + public const string DefaultUserTrackingDescriptionJa = "これはユーザーデータをもとに、より関連性の高い広告コンテンツをお客様に提供します"; + public const string DefaultUserTrackingDescriptionKo = "보다 개인화된 광고 및 콘텐츠를 위해 기기 정보를 사용합니다."; + public const string DefaultUserTrackingDescriptionZhHans = "我们使用设备信息来提供个性化的广告和内容。"; + public const string DefaultUserTrackingDescriptionZhHant = "我們使用設備信息來提供個性化的廣告和內容。"; + + [SerializeField] private bool consentFlowEnabled; + [SerializeField] private string consentFlowPrivacyPolicyUrl = string.Empty; + [SerializeField] private string consentFlowTermsOfServiceUrl = string.Empty; + [SerializeField] private string consentFlowAdvertisingPartnerUrls = string.Empty; + [SerializeField] private bool includeDefaultAdvertisingPartnerUrls = true; + [SerializeField] private string consentFlowAnalyticsPartnerUrls = string.Empty; + [SerializeField] private bool consentFlowIncludeDefaultAnalyticsPartnerUrls = true; + [SerializeField] private bool overrideDefaultUserTrackingUsageDescriptions; + [SerializeField] private string userTrackingUsageDescriptionEn = string.Empty; + [SerializeField] private bool userTrackingUsageLocalizationEnabled; + [SerializeField] private string userTrackingUsageDescriptionDe = string.Empty; + [SerializeField] private string userTrackingUsageDescriptionEs = string.Empty; + [SerializeField] private string userTrackingUsageDescriptionFr = string.Empty; + [SerializeField] private string userTrackingUsageDescriptionJa = string.Empty; + [SerializeField] private string userTrackingUsageDescriptionKo = string.Empty; + [SerializeField] private string userTrackingUsageDescriptionZhHans = string.Empty; + [SerializeField] private string userTrackingUsageDescriptionZhHant = string.Empty; + + private const string SettingsFilePath = "ProjectSettings/AppLovinInternalSettings.json"; + + public static AppLovinInternalSettings Instance + { + get + { + if (instance != null) return instance; + + instance = CreateInstance(); + + var projectRootPath = Path.GetDirectoryName(Application.dataPath); + var settingsFilePath = Path.Combine(projectRootPath, SettingsFilePath); + if (!File.Exists(settingsFilePath)) + { + instance.Save(); + return instance; + } + + var settingsJson = File.ReadAllText(settingsFilePath); + if (string.IsNullOrEmpty(settingsJson)) + { + instance.Save(); + return instance; + } + + JsonUtility.FromJsonOverwrite(settingsJson, instance); + return instance; + } + } + + public void Save() + { + var settingsJson = JsonUtility.ToJson(instance); + try + { + var projectRootPath = Path.GetDirectoryName(Application.dataPath); + var settingsFilePath = Path.Combine(projectRootPath, SettingsFilePath); + File.WriteAllText(settingsFilePath, settingsJson); + } + catch (Exception exception) + { + MaxSdkLogger.UserError("Failed to save internal settings."); + Console.WriteLine(exception); + } + } + + /// + /// Whether or not AppLovin Consent Flow is enabled. + /// + public bool ConsentFlowEnabled + { + get { return consentFlowEnabled; } + set + { + var previousValue = consentFlowEnabled; + consentFlowEnabled = value; + + if (value) + { + // If the value didn't change, we don't need to update anything. + if (previousValue) return; + + UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEn; + UserTrackingUsageLocalizationEnabled = true; + } + else + { + ConsentFlowPrivacyPolicyUrl = string.Empty; + ConsentFlowTermsOfServiceUrl = string.Empty; + UserTrackingUsageDescriptionEn = string.Empty; + UserTrackingUsageLocalizationEnabled = false; + OverrideDefaultUserTrackingUsageDescriptions = false; + ConsentFlowIncludeDefaultAdvertisingPartnerUrls = true; + ConsentFlowIncludeDefaultAnalyticsPartnerUrls = true; + } + } + } + + /// + /// A URL pointing to the Privacy Policy for the app to be shown when prompting the user for consent. + /// + public string ConsentFlowPrivacyPolicyUrl + { + get { return consentFlowPrivacyPolicyUrl; } + set { consentFlowPrivacyPolicyUrl = value; } + } + + /// + /// An optional URL pointing to the Terms of Service for the app to be shown when prompting the user for consent. + /// + public string ConsentFlowTermsOfServiceUrl + { + get { return consentFlowTermsOfServiceUrl; } + set { consentFlowTermsOfServiceUrl = value; } + } + + /// + /// An array of advertising partner URLs. These URLs list are shown during the GDPR flow. + /// + public string ConsentFlowAdvertisingPartnerUrls + { + get { return consentFlowAdvertisingPartnerUrls; } + set { consentFlowAdvertisingPartnerUrls = value; } + } + + /// + /// Whether or not to include a default set of advertising partners. Defaults to true. + /// + public bool ConsentFlowIncludeDefaultAdvertisingPartnerUrls + { + get { return includeDefaultAdvertisingPartnerUrls; } + set { includeDefaultAdvertisingPartnerUrls = value; } + } + + /// + /// An array of analytics partner URLs. These URLs list are shown during the GDPR flow. + /// + public string ConsentFlowAnalyticsPartnerUrls + { + get { return consentFlowAnalyticsPartnerUrls; } + set { consentFlowAnalyticsPartnerUrls = value; } + } + + /// + /// Whether or not to include a default set of analytics partners. Defaults to true. + /// + public bool ConsentFlowIncludeDefaultAnalyticsPartnerUrls + { + get { return consentFlowIncludeDefaultAnalyticsPartnerUrls; } + set { consentFlowIncludeDefaultAnalyticsPartnerUrls = value; } + } + + /// + /// A User Tracking Usage Description in English to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionEn + { + get { return userTrackingUsageDescriptionEn; } + set { userTrackingUsageDescriptionEn = value; } + } + + public bool OverrideDefaultUserTrackingUsageDescriptions + { + get { return overrideDefaultUserTrackingUsageDescriptions; } + set + { + var previousValue = overrideDefaultUserTrackingUsageDescriptions; + overrideDefaultUserTrackingUsageDescriptions = value; + + if (!value) + { + if (!previousValue) return; + + UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEn; + UserTrackingUsageDescriptionDe = DefaultUserTrackingDescriptionDe; + UserTrackingUsageDescriptionEs = DefaultUserTrackingDescriptionEs; + UserTrackingUsageDescriptionFr = DefaultUserTrackingDescriptionFr; + UserTrackingUsageDescriptionJa = DefaultUserTrackingDescriptionJa; + UserTrackingUsageDescriptionKo = DefaultUserTrackingDescriptionKo; + UserTrackingUsageDescriptionZhHans = DefaultUserTrackingDescriptionZhHans; + UserTrackingUsageDescriptionZhHant = DefaultUserTrackingDescriptionZhHant; + } + } + } + + /// + /// Whether or not to localize User Tracking Usage Description. + /// For more information see Apple's documentation. + /// + public bool UserTrackingUsageLocalizationEnabled + { + get { return userTrackingUsageLocalizationEnabled; } + set + { + var previousValue = userTrackingUsageLocalizationEnabled; + userTrackingUsageLocalizationEnabled = value; + + if (value) + { + // If the value didn't change, don't do anything + if (previousValue) return; + + // Don't set the default values if they are being overriden. + if (OverrideDefaultUserTrackingUsageDescriptions) return; + + UserTrackingUsageDescriptionDe = DefaultUserTrackingDescriptionDe; + UserTrackingUsageDescriptionEs = DefaultUserTrackingDescriptionEs; + UserTrackingUsageDescriptionFr = DefaultUserTrackingDescriptionFr; + UserTrackingUsageDescriptionJa = DefaultUserTrackingDescriptionJa; + UserTrackingUsageDescriptionKo = DefaultUserTrackingDescriptionKo; + UserTrackingUsageDescriptionZhHans = DefaultUserTrackingDescriptionZhHans; + UserTrackingUsageDescriptionZhHant = DefaultUserTrackingDescriptionZhHant; + } + else + { + UserTrackingUsageDescriptionDe = string.Empty; + UserTrackingUsageDescriptionEs = string.Empty; + UserTrackingUsageDescriptionFr = string.Empty; + UserTrackingUsageDescriptionJa = string.Empty; + UserTrackingUsageDescriptionKo = string.Empty; + UserTrackingUsageDescriptionZhHans = string.Empty; + UserTrackingUsageDescriptionZhHant = string.Empty; + } + } + } + + /// + /// A User Tracking Usage Description in German to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionDe + { + get { return userTrackingUsageDescriptionDe; } + set { userTrackingUsageDescriptionDe = value; } + } + + /// + /// A User Tracking Usage Description in Spanish to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionEs + { + get { return userTrackingUsageDescriptionEs; } + set { userTrackingUsageDescriptionEs = value; } + } + + /// + /// A User Tracking Usage Description in French to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionFr + { + get { return userTrackingUsageDescriptionFr; } + set { userTrackingUsageDescriptionFr = value; } + } + + /// + /// A User Tracking Usage Description in Japanese to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionJa + { + get { return userTrackingUsageDescriptionJa; } + set { userTrackingUsageDescriptionJa = value; } + } + + /// + /// A User Tracking Usage Description in Korean to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionKo + { + get { return userTrackingUsageDescriptionKo; } + set { userTrackingUsageDescriptionKo = value; } + } + + /// + /// A User Tracking Usage Description in Chinese (Simplified) to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionZhHans + { + get { return userTrackingUsageDescriptionZhHans; } + set { userTrackingUsageDescriptionZhHans = value; } + } + + /// + /// A User Tracking Usage Description in Chinese (Traditional) to be shown to users when requesting permission to use data for tracking. + /// For more information see Apple's documentation. + /// + public string UserTrackingUsageDescriptionZhHant + { + get { return userTrackingUsageDescriptionZhHant; } + set { userTrackingUsageDescriptionZhHant = value; } + } + } +} diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PreProcessor.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs.meta similarity index 55% rename from Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PreProcessor.cs.meta rename to Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs.meta index d9ea49b36..a863905bd 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PreProcessor.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs.meta @@ -1,9 +1,8 @@ fileFormatVersion: 2 -guid: bfbc947903224d09a77085f74b86a409 +guid: 65c51e21887ae42c2839962fb9585e9f labels: - al_max -- al_max_export_path-MaxSdk/Mediation/Google/Editor/PreProcessor.cs -- al_max_export_path-MaxSdk\Mediation\Google\Editor\PreProcessor.cs +- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinMenuItems.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinMenuItems.cs.meta index ad2fc2cc1..30fb834e0 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinMenuItems.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinMenuItems.cs.meta @@ -3,7 +3,6 @@ guid: 02c2d277874f649d18a59d382420bf65 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinMenuItems.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinMenuItems.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs index 596977252..2711639b4 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs @@ -17,40 +17,49 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// /// Adds Quality Service plugin to the Gradle project once the project has been exported. See for more details. /// - public class AppLovinPostProcessGradleProject : AppLovinProcessGradleBuildFile, IPostGenerateGradleAndroidProject - { - public void OnPostGenerateGradleAndroidProject(string path) - { -#if UNITY_2019_3_OR_NEWER - // On Unity 2019.3+, the path returned is the path to the unityLibrary's module. - // The AppLovin Quality Service buildscript closure related lines need to be added to the root build.gradle file. - var rootGradleBuildFilePath = Path.Combine(path, "../build.gradle"); - var buildScriptChangesAdded = AddQualityServiceBuildScriptLines(rootGradleBuildFilePath); - if (!buildScriptChangesAdded) return; +// public class AppLovinPostProcessGradleProject : AppLovinProcessGradleBuildFile, IPostGenerateGradleAndroidProject +// { +// public void OnPostGenerateGradleAndroidProject(string path) +// { +// if (!AppLovinSettings.Instance.QualityServiceEnabled) return; - // The plugin needs to be added to the application module (named launcher) - var applicationGradleBuildFilePath = Path.Combine(path, "../launcher/build.gradle"); -#else - // If Gradle template is enabled, we would have already updated the plugin. - if (AppLovinIntegrationManager.GradleTemplateEnabled) return; +// #if UNITY_2019_3_OR_NEWER +// // On Unity 2019.3+, the path returned is the path to the unityLibrary's module. +// // The AppLovin Quality Service buildscript closure related lines need to be added to the root build.gradle file. +// var rootGradleBuildFilePath = Path.Combine(path, "../build.gradle"); +// #if UNITY_2022_2_OR_NEWER +// if (!AddPluginToRootGradleBuildFile(rootGradleBuildFilePath)) return; + +// var rootSettingsGradleFilePath = Path.Combine(path, "../settings.gradle"); +// if (!AddAppLovinRepository(rootSettingsGradleFilePath)) return; +// #else +// var buildScriptChangesAdded = AddQualityServiceBuildScriptLines(rootGradleBuildFilePath); +// if (!buildScriptChangesAdded) return; +// #endif - var applicationGradleBuildFilePath = Path.Combine(path, "build.gradle"); -#endif +// // The plugin needs to be added to the application module (named launcher) +// var applicationGradleBuildFilePath = Path.Combine(path, "../launcher/build.gradle"); +// #else +// // If Gradle template is enabled, we would have already updated the plugin. +// if (AppLovinIntegrationManager.GradleTemplateEnabled) return; - if (!File.Exists(applicationGradleBuildFilePath)) - { - MaxSdkLogger.UserWarning("Couldn't find build.gradle file. Failed to add AppLovin Quality Service plugin to the gradle project."); - return; - } +// var applicationGradleBuildFilePath = Path.Combine(path, "build.gradle"); +// #endif - AddAppLovinQualityServicePlugin(applicationGradleBuildFilePath); - } +// if (!File.Exists(applicationGradleBuildFilePath)) +// { +// MaxSdkLogger.UserWarning("Couldn't find build.gradle file. Failed to add AppLovin Quality Service plugin to the gradle project."); +// return; +// } - public int callbackOrder - { - get { return int.MaxValue; } - } - } +// AddAppLovinQualityServicePlugin(applicationGradleBuildFilePath); +// } + +// public int callbackOrder +// { +// get { return int.MaxValue; } +// } +// } } #endif diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta index adf7e350f..c167f0ceb 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta @@ -3,7 +3,6 @@ guid: f75e54e2eb78f427ca8643c97684387b labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinPostProcessAndroidGradle.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs index f9ade3ef1..078ae4a7a 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs @@ -59,49 +59,48 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor var uploadHandler = new UploadHandlerRaw(bodyRaw); uploadHandler.contentType = "application/json"; - var unityWebRequest = new UnityWebRequest("https://api2.safedk.com/v1/build/ios_setup2") + using (var unityWebRequest = new UnityWebRequest("https://api2.safedk.com/v1/build/ios_setup2")) { - method = UnityWebRequest.kHttpVerbPOST, - downloadHandler = downloadHandler, - uploadHandler = uploadHandler - }; - + unityWebRequest.method = UnityWebRequest.kHttpVerbPOST; + unityWebRequest.downloadHandler = downloadHandler; + unityWebRequest.uploadHandler = uploadHandler; #if UNITY_2017_2_OR_NEWER - var operation = unityWebRequest.SendWebRequest(); + var operation = unityWebRequest.SendWebRequest(); #else - var operation = webRequest.Send(); + var operation = webRequest.Send(); #endif - // Wait for the download to complete or the request to timeout. - while (!operation.isDone) { } + // Wait for the download to complete or the request to timeout. + while (!operation.isDone) { } #if UNITY_2020_1_OR_NEWER - if (unityWebRequest.result != UnityWebRequest.Result.Success) + if (unityWebRequest.result != UnityWebRequest.Result.Success) #elif UNITY_2017_2_OR_NEWER - if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) + if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #else - if (webRequest.isError) + if (webRequest.isError) #endif - { - MaxSdkLogger.UserError("AppLovin Quality Service installation failed. Failed to download script with error: " + unityWebRequest.error); - return; + { + MaxSdkLogger.UserError("AppLovin Quality Service installation failed. Failed to download script with error: " + unityWebRequest.error); + return; + } + + // Check if Ruby is installed + var rubyVersion = AppLovinCommandLine.Run("ruby", "--version", buildPath); + if (rubyVersion.ExitCode != 0) + { + MaxSdkLogger.UserError("AppLovin Quality Service installation requires Ruby. Please install Ruby, export it to your system PATH and re-export the project."); + return; + } + + // Ruby is installed, run `ruby AppLovinQualityServiceSetup.rb` + var result = AppLovinCommandLine.Run("ruby", OutputFileName, buildPath); + + // Check if we have an error. + if (result.ExitCode != 0) MaxSdkLogger.UserError("Failed to set up AppLovin Quality Service"); + + MaxSdkLogger.UserDebug(result.Message); } - - // Check if Ruby is installed - var rubyVersion = AppLovinCommandLine.Run("ruby", "--version", buildPath); - if (rubyVersion.ExitCode != 0) - { - MaxSdkLogger.UserError("AppLovin Quality Service installation requires Ruby. Please install Ruby, export it to your system PATH and re-export the project."); - return; - } - - // Ruby is installed, run `ruby AppLovinQualityServiceSetup.rb` - var result = AppLovinCommandLine.Run("ruby", OutputFileName, buildPath); - - // Check if we have an error. - if (result.ExitCode != 0) MaxSdkLogger.UserError("Failed to set up AppLovin Quality Service"); - - MaxSdkLogger.UserDebug(result.Message); } } } diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta index 38aecbcc0..8182708b9 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta @@ -3,7 +3,6 @@ guid: d5d209f90444f4a90830b48b5f3f3ff4 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinPostProcessiOS.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs index 7ff51f606..9011499aa 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs @@ -8,10 +8,17 @@ #if UNITY_ANDROID +using System.Linq; +using System; +using System.Collections.Generic; +using System.IO; +using AppLovinMax.ThirdParty.MiniJson; using UnityEditor; using UnityEditor.Build; #if UNITY_2018_1_OR_NEWER using UnityEditor.Build.Reporting; +using UnityEngine; + #endif namespace AppLovinMax.Scripts.IntegrationManager.Editor @@ -19,36 +26,166 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// /// Adds the AppLovin Quality Service plugin to the gradle template file. See for more details. /// - public class AppLovinPreProcessAndroid : AppLovinProcessGradleBuildFile, -#if UNITY_2018_1_OR_NEWER - IPreprocessBuildWithReport -#else - IPreprocessBuild -#endif - { -#if UNITY_2018_1_OR_NEWER - public void OnPreprocessBuild(BuildReport report) -#else - public void OnPreprocessBuild(BuildTarget target, string path) -#endif - { - // We can only process gradle template file here. If it is not available, we will try again in post build on Unity IDEs newer than 2018_2 (see AppLovinPostProcessGradleProject). - if (!AppLovinIntegrationManager.GradleTemplateEnabled) return; +// public class AppLovinPreProcessAndroid : AppLovinProcessGradleBuildFile, +// #if UNITY_2018_1_OR_NEWER +// IPreprocessBuildWithReport +// #else +// IPreprocessBuild +// #endif +// { +// private const string AppLovinSettingsFileName = "applovin_settings.json"; -#if UNITY_2019_3_OR_NEWER - // The publisher could be migrating from older Unity versions to 2019_3 or newer. - // If so, we should delete the plugin from the template. The plugin will be added to the project's application module in the post processing script (AppLovinPostProcessGradleProject). - RemoveAppLovinQualityServiceOrSafeDkPlugin(AppLovinIntegrationManager.GradleTemplatePath); -#else - AddAppLovinQualityServicePlugin(AppLovinIntegrationManager.GradleTemplatePath); -#endif - } +// private const string KeyTermsFlowSettings = "terms_flow_settings"; +// private const string KeyTermsFlowEnabled = "terms_flow_enabled"; +// private const string KeyTermsFlowTermsOfService = "terms_flow_terms_of_service"; +// private const string KeyTermsFlowPrivacyPolicy = "terms_flow_privacy_policy"; - public int callbackOrder - { - get { return int.MaxValue; } - } - } +// private const string KeyConsentFlowSettings = "consent_flow_settings"; +// private const string KeyConsentFlowEnabled = "consent_flow_enabled"; +// private const string KeyConsentFlowTermsOfService = "consent_flow_terms_of_service"; +// private const string KeyConsentFlowPrivacyPolicy = "consent_flow_privacy_policy"; +// private const string KeyConsentFlowAdvertisingPartners = "consent_flow_advertising_partners"; +// private const string KeyConsentFlowIncludeDefaultAdvertisingPartners = "consent_flow_should_include_default_advertising_partners"; +// private const string KeyConsentFlowAnalyticsPartners = "consent_flow_analytics_partners"; +// private const string KeyConsentFlowIncludeDefaultAnalyticsPartners = "consent_flow_should_include_default_analytics_partners"; + +// #if UNITY_2018_1_OR_NEWER +// public void OnPreprocessBuild(BuildReport report) +// #else +// public void OnPreprocessBuild(BuildTarget target, string path) +// #endif +// { +// // We can only process gradle template file here. If it is not available, we will try again in post build on Unity IDEs newer than 2018_2 (see AppLovinPostProcessGradleProject). +// if (!AppLovinIntegrationManager.GradleTemplateEnabled) return; + +// #if UNITY_2019_3_OR_NEWER +// // The publisher could be migrating from older Unity versions to 2019_3 or newer. +// // If so, we should delete the plugin from the template. The plugin will be added to the project's application module in the post processing script (AppLovinPostProcessGradleProject). +// RemoveAppLovinQualityServiceOrSafeDkPlugin(AppLovinIntegrationManager.GradleTemplatePath); +// #else +// AddAppLovinQualityServicePlugin(AppLovinIntegrationManager.GradleTemplatePath); +// #endif + +// // For Unity 2018.2 or newer, the consent flow is enabled in MaxPostProcessBuildAndroid. +// #if !UNITY_2018_2_OR_NEWER +// if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) +// { +// var consentFlowSettingsFilePath = Path.Combine("Assets", "Plugin/Android/res/raw/"); +// EnableConsentFlowIfNeeded(consentFlowSettingsFilePath); +// } +// #endif +// } + +// public static void EnableConsentFlowIfNeeded(string rawResourceDirectory) +// { +// // Check if consent flow is enabled. No need to create the applovin_consent_flow_settings.json if consent flow is disabled. +// var consentFlowEnabled = AppLovinInternalSettings.Instance.ConsentFlowEnabled; +// if (!consentFlowEnabled) return; + +// var privacyPolicyUrl = AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl; +// if (string.IsNullOrEmpty(privacyPolicyUrl)) +// { +// AppLovinIntegrationManager.ShowBuildFailureDialog("You cannot use the AppLovin SDK's consent flow without defining a Privacy Policy URL in the AppLovin Integration Manager."); + +// // No need to update the applovin_consent_flow_settings.json here. Default consent flow state will be determined on the SDK side. +// return; +// } + +// var consentFlowSettings = new Dictionary(); +// consentFlowSettings[KeyConsentFlowEnabled] = consentFlowEnabled; +// consentFlowSettings[KeyConsentFlowPrivacyPolicy] = privacyPolicyUrl; + +// var termsOfServiceUrl = AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl; +// if (MaxSdkUtils.IsValidString(termsOfServiceUrl)) +// { +// consentFlowSettings[KeyConsentFlowTermsOfService] = termsOfServiceUrl; +// } + +// consentFlowSettings[KeyConsentFlowIncludeDefaultAdvertisingPartners] = AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls; +// var advertisingPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls; +// if (MaxSdkUtils.IsValidString(advertisingPartnerUrls)) +// { +// var advertisingPartnerUrlsList = advertisingPartnerUrls.Split(',').ToList(); +// consentFlowSettings[KeyConsentFlowAdvertisingPartners] = advertisingPartnerUrlsList; +// } + +// consentFlowSettings[KeyConsentFlowIncludeDefaultAnalyticsPartners] = AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls; +// var analyticsPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls; +// if (MaxSdkUtils.IsValidString(analyticsPartnerUrls)) +// { +// var analyticsPartnerUrlsList = analyticsPartnerUrls.Split(',').ToList(); +// consentFlowSettings[KeyConsentFlowAnalyticsPartners] = analyticsPartnerUrlsList; +// } + +// var applovinSdkSettings = new Dictionary(); +// applovinSdkSettings[KeyConsentFlowSettings] = consentFlowSettings; + +// var applovinSdkSettingsJson = Json.Serialize(applovinSdkSettings); +// WriteAppLovinSettingsRawResourceFile(applovinSdkSettingsJson, rawResourceDirectory); +// } + +// public static void EnableTermsFlowIfNeeded(string rawResourceDirectory) +// { +// if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) return; + +// // Check if terms flow is enabled. No need to create the applovin_consent_flow_settings.json if consent flow is disabled. +// var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled; +// if (!consentFlowEnabled) return; + +// // Check if terms flow is enabled for this format. +// var consentFlowPlatform = AppLovinSettings.Instance.ConsentFlowPlatform; +// if (consentFlowPlatform != Platform.All && consentFlowPlatform != Platform.Android) return; + +// var privacyPolicyUrl = AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl; +// if (string.IsNullOrEmpty(privacyPolicyUrl)) +// { +// AppLovinIntegrationManager.ShowBuildFailureDialog("You cannot use the AppLovin SDK's consent flow without defining a Privacy Policy URL in the AppLovin Integration Manager."); + +// // No need to update the applovin_consent_flow_settings.json here. Default consent flow state will be determined on the SDK side. +// return; +// } + +// var consentFlowSettings = new Dictionary(); +// consentFlowSettings[KeyTermsFlowEnabled] = consentFlowEnabled; +// consentFlowSettings[KeyTermsFlowPrivacyPolicy] = privacyPolicyUrl; + +// var termsOfServiceUrl = AppLovinSettings.Instance.ConsentFlowTermsOfServiceUrl; +// if (MaxSdkUtils.IsValidString(termsOfServiceUrl)) +// { +// consentFlowSettings[KeyTermsFlowTermsOfService] = termsOfServiceUrl; +// } + +// var applovinSdkSettings = new Dictionary(); +// applovinSdkSettings[KeyTermsFlowSettings] = consentFlowSettings; + +// var applovinSdkSettingsJson = Json.Serialize(applovinSdkSettings); +// WriteAppLovinSettingsRawResourceFile(applovinSdkSettingsJson, rawResourceDirectory); +// } + +// private static void WriteAppLovinSettingsRawResourceFile(string applovinSdkSettingsJson, string rawResourceDirectory) +// { +// if (!Directory.Exists(rawResourceDirectory)) +// { +// Directory.CreateDirectory(rawResourceDirectory); +// } + +// var consentFlowSettingsFilePath = Path.Combine(rawResourceDirectory, AppLovinSettingsFileName); +// try +// { +// File.WriteAllText(consentFlowSettingsFilePath, applovinSdkSettingsJson + "\n"); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("applovin_settings.json file write failed due to: " + exception.Message); +// Console.WriteLine(exception); +// } +// } + +// public int callbackOrder +// { +// get { return int.MaxValue; } +// } +// } } #endif diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta index da6aed06e..4dd79e876 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta @@ -3,7 +3,6 @@ guid: 8ccaf444d0d4f4cadb5debe7c41b20c4 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinPreProcessAndroid.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs index 172dabc69..f47f54f5b 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs @@ -12,437 +12,568 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; +using UnityEditorInternal; using UnityEngine; using UnityEngine.Networking; using Debug = UnityEngine.Debug; namespace AppLovinMax.Scripts.IntegrationManager.Editor { - [Serializable] - public class AppLovinQualityServiceData - { - public string api_key; - } +// [Serializable] +// public class AppLovinQualityServiceData +// { +// public string api_key; +// } - /// - /// Adds or updates the AppLovin Quality Service plugin to the provided build.gradle file. - /// If the gradle file already has the plugin, the API key is updated. - /// - public abstract class AppLovinProcessGradleBuildFile - { - private static readonly Regex TokenBuildScriptRepositories = new Regex(".*repositories.*"); - private static readonly Regex TokenBuildScriptDependencies = new Regex(".*classpath \'com.android.tools.build:gradle.*"); - private static readonly Regex TokenApplicationPlugin = new Regex(".*apply plugin: \'com.android.application\'.*"); - private static readonly Regex TokenApiKey = new Regex(".*apiKey.*"); - private static readonly Regex TokenAppLovinPlugin = new Regex(".*apply plugin:.+?(?=applovin-quality-service).*"); +// /// +// /// Adds or updates the AppLovin Quality Service plugin to the provided build.gradle file. +// /// If the gradle file already has the plugin, the API key is updated. +// /// +// public abstract class AppLovinProcessGradleBuildFile +// { +// private static readonly Regex TokenBuildScriptRepositories = new Regex(".*repositories.*"); +// private static readonly Regex TokenBuildScriptDependencies = new Regex(".*classpath \'com.android.tools.build:gradle.*"); +// private static readonly Regex TokenApplicationPlugin = new Regex(".*apply plugin: \'com.android.application\'.*"); +// private static readonly Regex TokenApiKey = new Regex(".*apiKey.*"); +// private static readonly Regex TokenAppLovinPlugin = new Regex(".*apply plugin:.+?(?=applovin-quality-service).*"); - private const string BuildScriptMatcher = "buildscript"; - private const string QualityServiceMavenRepo = "maven { url 'https://artifacts.applovin.com/android' }"; - private const string QualityServiceDependencyClassPath = "classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:+'"; - private const string QualityServiceApplyPlugin = "apply plugin: 'applovin-quality-service'"; - private const string QualityServicePlugin = "applovin {"; - private const string QualityServiceApiKey = " apiKey '{0}'"; - private const string QualityServiceBintrayMavenRepo = "https://applovin.bintray.com/Quality-Service"; +// #if UNITY_2022_2_OR_NEWER +// private const string PluginsMatcher = "plugins"; +// private const string PluginManagementMatcher = "pluginManagement"; +// private const string QualityServicePluginRoot = " id 'com.applovin.quality' version '+' apply false // NOTE: Requires version 4.8.3+ for Gradle version 7.2+"; +// #endif - // Legacy plugin detection variables - private const string QualityServiceDependencyClassPathV3 = "classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:3.+'"; - private static readonly Regex TokenSafeDkLegacyApplyPlugin = new Regex(".*apply plugin:.+?(?=safedk).*"); - private const string SafeDkLegacyPlugin = "safedk {"; - private const string SafeDkLegacyMavenRepo = "http://download.safedk.com"; - private const string SafeDkLegacyDependencyClassPath = "com.safedk:SafeDKGradlePlugin:"; +// private const string BuildScriptMatcher = "buildscript"; +// private const string QualityServiceMavenRepo = "maven { url 'https://artifacts.applovin.com/android'; content { includeGroupByRegex 'com.applovin.*' } }"; +// private const string QualityServiceDependencyClassPath = "classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:+'"; +// private const string QualityServiceApplyPlugin = "apply plugin: 'applovin-quality-service'"; +// private const string QualityServicePlugin = "applovin {"; +// private const string QualityServiceApiKey = " apiKey '{0}'"; +// private const string QualityServiceBintrayMavenRepo = "https://applovin.bintray.com/Quality-Service"; +// private const string QualityServiceNoRegexMavenRepo = "maven { url 'https://artifacts.applovin.com/android' }"; - /// - /// Updates the provided Gradle script to add Quality Service plugin. - /// - /// The gradle file to update. - protected void AddAppLovinQualityServicePlugin(string applicationGradleBuildFilePath) - { - if (!AppLovinSettings.Instance.QualityServiceEnabled) return; +// // Legacy plugin detection variables +// private const string QualityServiceDependencyClassPathV3 = "classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:3.+'"; +// private static readonly Regex TokenSafeDkLegacyApplyPlugin = new Regex(".*apply plugin:.+?(?=safedk).*"); +// private const string SafeDkLegacyPlugin = "safedk {"; +// private const string SafeDkLegacyMavenRepo = "http://download.safedk.com"; +// private const string SafeDkLegacyDependencyClassPath = "com.safedk:SafeDKGradlePlugin:"; - var sdkKey = AppLovinSettings.Instance.SdkKey; - if (string.IsNullOrEmpty(sdkKey)) - { - MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. SDK Key is empty. Please enter the AppLovin SDK Key in the Integration Manager."); - return; - } +// /// +// /// Updates the provided Gradle script to add Quality Service plugin. +// /// +// /// The gradle file to update. +// protected void AddAppLovinQualityServicePlugin(string applicationGradleBuildFilePath) +// { +// if (!AppLovinSettings.Instance.QualityServiceEnabled) return; - // Retrieve the API Key using the SDK Key. - var qualityServiceData = RetrieveQualityServiceData(sdkKey); - var apiKey = qualityServiceData.api_key; - if (string.IsNullOrEmpty(apiKey)) - { - MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. API Key is empty."); - return; - } +// var sdkKey = AppLovinSettings.Instance.SdkKey; +// if (string.IsNullOrEmpty(sdkKey)) +// { +// MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. SDK Key is empty. Please enter the AppLovin SDK Key in the Integration Manager."); +// return; +// } - // Generate the updated Gradle file that needs to be written. - var lines = File.ReadAllLines(applicationGradleBuildFilePath).ToList(); - var sanitizedLines = RemoveLegacySafeDkPlugin(lines); - var outputLines = GenerateUpdatedBuildFileLines( - sanitizedLines, - apiKey, -#if UNITY_2019_3_OR_NEWER - false // On Unity 2019.3+, the buildscript closure related lines will to be added to the root build.gradle file. -#else - true -#endif - ); - // outputLines can be null if we couldn't add the plugin. - if (outputLines == null) return; +// // Retrieve the API Key using the SDK Key. +// var qualityServiceData = RetrieveQualityServiceData(sdkKey); +// var apiKey = qualityServiceData.api_key; +// if (string.IsNullOrEmpty(apiKey)) +// { +// MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. API Key is empty."); +// return; +// } - try - { - File.WriteAllText(applicationGradleBuildFilePath, string.Join("\n", outputLines.ToArray()) + "\n"); - } - catch (Exception exception) - { - MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. Gradle file write failed."); - Console.WriteLine(exception); - } - } +// // Generate the updated Gradle file that needs to be written. +// var lines = File.ReadAllLines(applicationGradleBuildFilePath).ToList(); +// var sanitizedLines = RemoveLegacySafeDkPlugin(lines); +// var outputLines = GenerateUpdatedBuildFileLines( +// sanitizedLines, +// apiKey, +// #if UNITY_2019_3_OR_NEWER +// false // On Unity 2019.3+, the buildscript closure related lines will to be added to the root build.gradle file. +// #else +// true +// #endif +// ); +// // outputLines can be null if we couldn't add the plugin. +// if (outputLines == null) return; -#if UNITY_2019_3_OR_NEWER - /// - /// Adds the necessary AppLovin Quality Service dependency and maven repo lines to the provided root build.gradle file. - /// - /// The root build.gradle file path - /// true if the build script lines were applied correctly. - protected bool AddQualityServiceBuildScriptLines(string rootGradleBuildFile) - { - var lines = File.ReadAllLines(rootGradleBuildFile).ToList(); - var outputLines = GenerateUpdatedBuildFileLines(lines, null, true); +// try +// { +// File.WriteAllText(applicationGradleBuildFilePath, string.Join("\n", outputLines.ToArray()) + "\n"); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. Gradle file write failed."); +// Console.WriteLine(exception); +// } +// } +// #if UNITY_2022_2_OR_NEWER +// /// +// /// Adds AppLovin Quality Service plugin DSL element to the project's root build.gradle file. +// /// +// /// The path to project's root build.gradle file. +// /// true when the plugin was added successfully. +// protected bool AddPluginToRootGradleBuildFile(string rootGradleBuildFile) +// { +// var lines = File.ReadAllLines(rootGradleBuildFile).ToList(); +// var outputLines = new List(); +// var pluginAdded = false; +// var insidePluginsClosure = false; +// foreach (var line in lines) +// { +// if (line.Contains(PluginsMatcher)) +// { +// insidePluginsClosure = true; +// } - // outputLines will be null if we couldn't add the build script lines. - if (outputLines == null) return false; +// if (!pluginAdded && insidePluginsClosure && line.Contains("}")) +// { +// outputLines.Add(QualityServicePluginRoot); +// pluginAdded = true; +// insidePluginsClosure = false; +// } - try - { - File.WriteAllText(rootGradleBuildFile, string.Join("\n", outputLines.ToArray()) + "\n"); - } - catch (Exception exception) - { - MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. Root Gradle file write failed."); - Console.WriteLine(exception); - return false; - } +// outputLines.Add(line); +// } - return true; - } +// if (!pluginAdded) +// { +// MaxSdkLogger.UserError("Failed to add AppLovin Quality Service plugin to root gradle file."); +// return false; +// } - /// - /// Removes the AppLovin Quality Service Plugin or Legacy SafeDK plugin from the given gradle template file if either of them are present. - /// - /// The gradle template file from which to remove the plugin from - protected static void RemoveAppLovinQualityServiceOrSafeDkPlugin(string gradleTemplateFile) - { - var lines = File.ReadAllLines(gradleTemplateFile).ToList(); - lines = RemoveLegacySafeDkPlugin(lines); - lines = RemoveAppLovinQualityServicePlugin(lines); +// try +// { +// File.WriteAllText(rootGradleBuildFile, string.Join("\n", outputLines.ToArray()) + "\n"); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. Root Gradle file write failed."); +// Console.WriteLine(exception); +// return false; +// } - try - { - File.WriteAllText(gradleTemplateFile, string.Join("\n", lines.ToArray()) + "\n"); - } - catch (Exception exception) - { - MaxSdkLogger.UserError("Failed to remove AppLovin Quality Service Plugin from mainTemplate.gradle. Please remove the Quality Service plugin from the mainTemplate.gradle manually."); - Console.WriteLine(exception); - } - } -#endif +// return true; +// } - private static AppLovinQualityServiceData RetrieveQualityServiceData(string sdkKey) - { - var postJson = string.Format("{{\"sdk_key\" : \"{0}\"}}", sdkKey); - var bodyRaw = Encoding.UTF8.GetBytes(postJson); - var uploadHandler = new UploadHandlerRaw(bodyRaw); - uploadHandler.contentType = "application/json"; +// /// +// /// Adds the AppLovin maven repository to the project's settings.gradle file. +// /// +// /// The path to the project's settings.gradle file. +// /// true if the repository was added successfully. +// protected bool AddAppLovinRepository(string settingsGradleFile) +// { +// var lines = File.ReadLines(settingsGradleFile).ToList(); +// var outputLines = new List(); +// var mavenRepoAdded = false; +// var pluginManagementClosureDepth = 0; +// var insidePluginManagementClosure = false; +// var pluginManagementMatched = false; +// foreach (var line in lines) +// { +// outputLines.Add(line); - var unityWebRequest = new UnityWebRequest("https://api2.safedk.com/v1/build/cred") - { - method = UnityWebRequest.kHttpVerbPOST, - uploadHandler = uploadHandler, - downloadHandler = new DownloadHandlerBuffer() - }; +// if (!pluginManagementMatched && line.Contains(PluginManagementMatcher)) +// { +// pluginManagementMatched = true; +// insidePluginManagementClosure = true; +// } -#if UNITY_2017_2_OR_NEWER - var operation = unityWebRequest.SendWebRequest(); -#else - var operation = webRequest.Send(); -#endif +// if (insidePluginManagementClosure) +// { +// if (line.Contains("{")) +// { +// pluginManagementClosureDepth++; +// } - // Wait for the download to complete or the request to timeout. - while (!operation.isDone) { } +// if (line.Contains("}")) +// { +// pluginManagementClosureDepth--; +// } -#if UNITY_2020_1_OR_NEWER - if (unityWebRequest.result != UnityWebRequest.Result.Success) -#elif UNITY_2017_2_OR_NEWER - if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) -#else - if (webRequest.isError) -#endif - { - MaxSdkLogger.UserError("Failed to retrieve API Key for SDK Key: " + sdkKey + "with error: " + unityWebRequest.error); - return new AppLovinQualityServiceData(); - } +// if (pluginManagementClosureDepth == 0) +// { +// insidePluginManagementClosure = false; +// } +// } - try - { - return JsonUtility.FromJson(unityWebRequest.downloadHandler.text); - } - catch (Exception exception) - { - MaxSdkLogger.UserError("Failed to parse API Key." + exception); - return new AppLovinQualityServiceData(); - } - } +// if (insidePluginManagementClosure) +// { +// if (!mavenRepoAdded && TokenBuildScriptRepositories.IsMatch(line)) +// { +// outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo)); +// mavenRepoAdded = true; +// } +// } +// } - private static List RemoveLegacySafeDkPlugin(List lines) - { - return RemovePlugin(lines, SafeDkLegacyPlugin, SafeDkLegacyMavenRepo, SafeDkLegacyDependencyClassPath, TokenSafeDkLegacyApplyPlugin); - } +// if (!mavenRepoAdded) +// { +// MaxSdkLogger.UserError("Failed to add AppLovin Quality Service plugin maven repo to settings gradle file."); +// return false; +// } - private static List RemoveAppLovinQualityServicePlugin(List lines) - { - return RemovePlugin(lines, QualityServicePlugin, QualityServiceMavenRepo, QualityServiceDependencyClassPath, TokenAppLovinPlugin); - } +// try +// { +// File.WriteAllText(settingsGradleFile, string.Join("\n", outputLines.ToArray()) + "\n"); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. Setting Gradle file write failed."); +// Console.WriteLine(exception); +// return false; +// } - private static List RemovePlugin(List lines, string pluginLine, string mavenRepo, string dependencyClassPath, Regex applyPluginToken) - { - var sanitizedLines = new List(); - var legacyRepoRemoved = false; - var legacyDependencyClassPathRemoved = false; - var legacyPluginRemoved = false; - var legacyPluginMatched = false; - var insideLegacySafeDkClosure = false; - foreach (var line in lines) - { - if (!legacyPluginMatched && line.Contains(pluginLine)) - { - legacyPluginMatched = true; - insideLegacySafeDkClosure = true; - } +// return true; +// } +// #endif - if (insideLegacySafeDkClosure && line.Contains("}")) - { - insideLegacySafeDkClosure = false; - continue; - } +// #if UNITY_2019_3_OR_NEWER +// /// +// /// Adds the necessary AppLovin Quality Service dependency and maven repo lines to the provided root build.gradle file. +// /// +// /// The root build.gradle file path +// /// true if the build script lines were applied correctly. +// protected bool AddQualityServiceBuildScriptLines(string rootGradleBuildFile) +// { +// var lines = File.ReadAllLines(rootGradleBuildFile).ToList(); +// var outputLines = GenerateUpdatedBuildFileLines(lines, null, true); - if (insideLegacySafeDkClosure) - { - continue; - } +// // outputLines will be null if we couldn't add the build script lines. +// if (outputLines == null) return false; - if (!legacyRepoRemoved && line.Contains(mavenRepo)) - { - legacyRepoRemoved = true; - continue; - } +// try +// { +// File.WriteAllText(rootGradleBuildFile, string.Join("\n", outputLines.ToArray()) + "\n"); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("Failed to install AppLovin Quality Service plugin. Root Gradle file write failed."); +// Console.WriteLine(exception); +// return false; +// } - if (!legacyDependencyClassPathRemoved && line.Contains(dependencyClassPath)) - { - legacyDependencyClassPathRemoved = true; - continue; - } +// return true; +// } - if (!legacyPluginRemoved && applyPluginToken.IsMatch(line)) - { - legacyPluginRemoved = true; - continue; - } +// /// +// /// Removes the AppLovin Quality Service Plugin or Legacy SafeDK plugin from the given gradle template file if either of them are present. +// /// +// /// The gradle template file from which to remove the plugin from +// protected static void RemoveAppLovinQualityServiceOrSafeDkPlugin(string gradleTemplateFile) +// { +// var lines = File.ReadAllLines(gradleTemplateFile).ToList(); +// lines = RemoveLegacySafeDkPlugin(lines); +// lines = RemoveAppLovinQualityServicePlugin(lines); - sanitizedLines.Add(line); - } +// try +// { +// File.WriteAllText(gradleTemplateFile, string.Join("\n", lines.ToArray()) + "\n"); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("Failed to remove AppLovin Quality Service Plugin from mainTemplate.gradle. Please remove the Quality Service plugin from the mainTemplate.gradle manually."); +// Console.WriteLine(exception); +// } +// } +// #endif - return sanitizedLines; - } +// private static AppLovinQualityServiceData RetrieveQualityServiceData(string sdkKey) +// { +// var postJson = string.Format("{{\"sdk_key\" : \"{0}\"}}", sdkKey); +// var bodyRaw = Encoding.UTF8.GetBytes(postJson); +// // Upload handler is automatically disposed when UnityWebRequest is disposed +// var uploadHandler = new UploadHandlerRaw(bodyRaw); +// uploadHandler.contentType = "application/json"; - private static List GenerateUpdatedBuildFileLines(List lines, string apiKey, bool addBuildScriptLines) - { - var addPlugin = !string.IsNullOrEmpty(apiKey); - // A sample of the template file. - // ... - // allprojects { - // repositories {**ARTIFACTORYREPOSITORY** - // google() - // jcenter() - // flatDir { - // dirs 'libs' - // } - // } - // } - // - // apply plugin: 'com.android.application' - // **APPLY_PLUGINS** - // - // dependencies { - // implementation fileTree(dir: 'libs', include: ['*.jar']) - // **DEPS**} - // ... - var outputLines = new List(); - // Check if the plugin exists, if so, update the SDK Key. - var pluginExists = lines.Any(line => TokenAppLovinPlugin.IsMatch(line)); - if (pluginExists) - { - var pluginMatched = false; - var insideAppLovinClosure = false; - var updatedApiKey = false; - var mavenRepoUpdated = false; - var dependencyClassPathUpdated = false; - foreach (var line in lines) - { - // Bintray maven repo is no longer being used. Update to s3 maven repo. - if (!mavenRepoUpdated && line.Contains(QualityServiceBintrayMavenRepo)) - { - outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo)); - mavenRepoUpdated = true; - continue; - } +// using (var unityWebRequest = new UnityWebRequest("https://api2.safedk.com/v1/build/cred")) +// { +// unityWebRequest.method = UnityWebRequest.kHttpVerbPOST; +// unityWebRequest.uploadHandler = uploadHandler; +// unityWebRequest.downloadHandler = new DownloadHandlerBuffer(); - // We no longer use version specific dependency class path. Just use + for version to always pull the latest. - if (!dependencyClassPathUpdated && line.Contains(QualityServiceDependencyClassPathV3)) - { - outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath)); - dependencyClassPathUpdated = true; - continue; - } +// #if UNITY_2017_2_OR_NEWER +// var operation = unityWebRequest.SendWebRequest(); +// #else +// var operation = webRequest.Send(); +// #endif - if (!pluginMatched && line.Contains(QualityServicePlugin)) - { - insideAppLovinClosure = true; - pluginMatched = true; - } +// // Wait for the download to complete or the request to timeout. +// while (!operation.isDone) { } - if (insideAppLovinClosure && line.Contains("}")) - { - insideAppLovinClosure = false; - } +// #if UNITY_2020_1_OR_NEWER +// if (unityWebRequest.result != UnityWebRequest.Result.Success) +// #elif UNITY_2017_2_OR_NEWER +// if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) +// #else +// if (webRequest.isError) +// #endif +// { +// MaxSdkLogger.UserError("Failed to retrieve API Key for SDK Key: " + sdkKey + "with error: " + unityWebRequest.error); +// return new AppLovinQualityServiceData(); +// } - // Update the API key. - if (insideAppLovinClosure && !updatedApiKey && TokenApiKey.IsMatch(line)) - { - outputLines.Add(string.Format(QualityServiceApiKey, apiKey)); - updatedApiKey = true; - } - // Keep adding the line until we find and update the plugin. - else - { - outputLines.Add(line); - } - } - } - // Plugin hasn't been added yet, add it. - else - { - var buildScriptClosureDepth = 0; - var insideBuildScriptClosure = false; - var buildScriptMatched = false; - var qualityServiceRepositoryAdded = false; - var qualityServiceDependencyClassPathAdded = false; - var qualityServicePluginAdded = false; - foreach (var line in lines) - { - // Add the line to the output lines. - outputLines.Add(line); +// try +// { +// return JsonUtility.FromJson(unityWebRequest.downloadHandler.text); +// } +// catch (Exception exception) +// { +// MaxSdkLogger.UserError("Failed to parse API Key." + exception); +// return new AppLovinQualityServiceData(); +// } +// } +// } - // Check if we need to add the build script lines and add them. - if (addBuildScriptLines) - { - if (!buildScriptMatched && line.Contains(BuildScriptMatcher)) - { - buildScriptMatched = true; - insideBuildScriptClosure = true; - } +// private static List RemoveLegacySafeDkPlugin(List lines) +// { +// return RemovePlugin(lines, SafeDkLegacyPlugin, SafeDkLegacyMavenRepo, SafeDkLegacyDependencyClassPath, TokenSafeDkLegacyApplyPlugin); +// } - // Match the parenthesis to track if we are still inside the buildscript closure. - if (insideBuildScriptClosure) - { - if (line.Contains("{")) - { - buildScriptClosureDepth++; - } +// private static List RemoveAppLovinQualityServicePlugin(List lines) +// { +// return RemovePlugin(lines, QualityServicePlugin, QualityServiceMavenRepo, QualityServiceDependencyClassPath, TokenAppLovinPlugin); +// } - if (line.Contains("}")) - { - buildScriptClosureDepth--; - } +// private static List RemovePlugin(List lines, string pluginLine, string mavenRepo, string dependencyClassPath, Regex applyPluginToken) +// { +// var sanitizedLines = new List(); +// var legacyRepoRemoved = false; +// var legacyDependencyClassPathRemoved = false; +// var legacyPluginRemoved = false; +// var legacyPluginMatched = false; +// var insideLegacySafeDkClosure = false; +// foreach (var line in lines) +// { +// if (!legacyPluginMatched && line.Contains(pluginLine)) +// { +// legacyPluginMatched = true; +// insideLegacySafeDkClosure = true; +// } - if (buildScriptClosureDepth == 0) - { - insideBuildScriptClosure = false; +// if (insideLegacySafeDkClosure && line.Contains("}")) +// { +// insideLegacySafeDkClosure = false; +// continue; +// } - // There may be multiple buildscript closures and we need to keep looking until we added both the repository and classpath. - buildScriptMatched = qualityServiceRepositoryAdded && qualityServiceDependencyClassPathAdded; - } - } +// if (insideLegacySafeDkClosure) +// { +// continue; +// } - if (insideBuildScriptClosure) - { - // Add the build script dependency repositories. - if (!qualityServiceRepositoryAdded && TokenBuildScriptRepositories.IsMatch(line)) - { - outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo)); - qualityServiceRepositoryAdded = true; - } - // Add the build script dependencies. - else if (!qualityServiceDependencyClassPathAdded && TokenBuildScriptDependencies.IsMatch(line)) - { - outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath)); - qualityServiceDependencyClassPathAdded = true; - } - } - } +// if (!legacyRepoRemoved && line.Contains(mavenRepo)) +// { +// legacyRepoRemoved = true; +// continue; +// } - // Check if we need to add the plugin and add it. - if (addPlugin) - { - // Add the plugin. - if (!qualityServicePluginAdded && TokenApplicationPlugin.IsMatch(line)) - { - outputLines.Add(QualityServiceApplyPlugin); - outputLines.AddRange(GenerateAppLovinPluginClosure(apiKey)); - qualityServicePluginAdded = true; - } - } - } +// if (!legacyDependencyClassPathRemoved && line.Contains(dependencyClassPath)) +// { +// legacyDependencyClassPathRemoved = true; +// continue; +// } - if ((addBuildScriptLines && (!qualityServiceRepositoryAdded || !qualityServiceDependencyClassPathAdded)) || (addPlugin && !qualityServicePluginAdded)) - { - MaxSdkLogger.UserError("Failed to add AppLovin Quality Service plugin. Quality Service Plugin Added?: " + qualityServicePluginAdded + ", Quality Service Repo added?: " + qualityServiceRepositoryAdded + ", Quality Service dependency added?: " + qualityServiceDependencyClassPathAdded); - return null; - } - } +// if (!legacyPluginRemoved && applyPluginToken.IsMatch(line)) +// { +// legacyPluginRemoved = true; +// continue; +// } - return outputLines; - } +// sanitizedLines.Add(line); +// } - private static string GetFormattedBuildScriptLine(string buildScriptLine) - { -#if UNITY_2019_3_OR_NEWER - return " " -#else - return " " -#endif - + buildScriptLine; - } +// return sanitizedLines; +// } - private static IEnumerable GenerateAppLovinPluginClosure(string apiKey) - { - // applovin { - // // NOTE: DO NOT CHANGE - this is NOT your AppLovin MAX SDK key - this is a derived key. - // apiKey "456...a1b" - // } - var linesToInject = new List(5); - linesToInject.Add(""); - linesToInject.Add("applovin {"); - linesToInject.Add(" // NOTE: DO NOT CHANGE - this is NOT your AppLovin MAX SDK key - this is a derived key."); - linesToInject.Add(string.Format(QualityServiceApiKey, apiKey)); - linesToInject.Add("}"); +// private static List GenerateUpdatedBuildFileLines(List lines, string apiKey, bool addBuildScriptLines) +// { +// var addPlugin = !string.IsNullOrEmpty(apiKey); +// // A sample of the template file. +// // ... +// // allprojects { +// // repositories {**ARTIFACTORYREPOSITORY** +// // google() +// // jcenter() +// // flatDir { +// // dirs 'libs' +// // } +// // } +// // } +// // +// // apply plugin: 'com.android.application' +// // **APPLY_PLUGINS** +// // +// // dependencies { +// // implementation fileTree(dir: 'libs', include: ['*.jar']) +// // **DEPS**} +// // ... +// var outputLines = new List(); +// // Check if the plugin exists, if so, update the SDK Key. +// var pluginExists = lines.Any(line => TokenAppLovinPlugin.IsMatch(line)); +// if (pluginExists) +// { +// var pluginMatched = false; +// var insideAppLovinClosure = false; +// var updatedApiKey = false; +// var mavenRepoUpdated = false; +// var dependencyClassPathUpdated = false; +// foreach (var line in lines) +// { +// // Bintray maven repo is no longer being used. Update to s3 maven repo with regex check +// if (!mavenRepoUpdated && (line.Contains(QualityServiceBintrayMavenRepo) || line.Contains(QualityServiceNoRegexMavenRepo))) +// { +// outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo)); +// mavenRepoUpdated = true; +// continue; +// } - return linesToInject; - } - } +// // We no longer use version specific dependency class path. Just use + for version to always pull the latest. +// if (!dependencyClassPathUpdated && line.Contains(QualityServiceDependencyClassPathV3)) +// { +// outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath)); +// dependencyClassPathUpdated = true; +// continue; +// } + +// if (!pluginMatched && line.Contains(QualityServicePlugin)) +// { +// insideAppLovinClosure = true; +// pluginMatched = true; +// } + +// if (insideAppLovinClosure && line.Contains("}")) +// { +// insideAppLovinClosure = false; +// } + +// // Update the API key. +// if (insideAppLovinClosure && !updatedApiKey && TokenApiKey.IsMatch(line)) +// { +// outputLines.Add(string.Format(QualityServiceApiKey, apiKey)); +// updatedApiKey = true; +// } +// // Keep adding the line until we find and update the plugin. +// else +// { +// outputLines.Add(line); +// } +// } +// } +// // Plugin hasn't been added yet, add it. +// else +// { +// var buildScriptClosureDepth = 0; +// var insideBuildScriptClosure = false; +// var buildScriptMatched = false; +// var qualityServiceRepositoryAdded = false; +// var qualityServiceDependencyClassPathAdded = false; +// var qualityServicePluginAdded = false; +// foreach (var line in lines) +// { +// // Add the line to the output lines. +// outputLines.Add(line); + +// // Check if we need to add the build script lines and add them. +// if (addBuildScriptLines) +// { +// if (!buildScriptMatched && line.Contains(BuildScriptMatcher)) +// { +// buildScriptMatched = true; +// insideBuildScriptClosure = true; +// } + +// // Match the parenthesis to track if we are still inside the buildscript closure. +// if (insideBuildScriptClosure) +// { +// if (line.Contains("{")) +// { +// buildScriptClosureDepth++; +// } + +// if (line.Contains("}")) +// { +// buildScriptClosureDepth--; +// } + +// if (buildScriptClosureDepth == 0) +// { +// insideBuildScriptClosure = false; + +// // There may be multiple buildscript closures and we need to keep looking until we added both the repository and classpath. +// buildScriptMatched = qualityServiceRepositoryAdded && qualityServiceDependencyClassPathAdded; +// } +// } + +// if (insideBuildScriptClosure) +// { +// // Add the build script dependency repositories. +// if (!qualityServiceRepositoryAdded && TokenBuildScriptRepositories.IsMatch(line)) +// { +// outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo)); +// qualityServiceRepositoryAdded = true; +// } +// // Add the build script dependencies. +// else if (!qualityServiceDependencyClassPathAdded && TokenBuildScriptDependencies.IsMatch(line)) +// { +// outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath)); +// qualityServiceDependencyClassPathAdded = true; +// } +// } +// } + +// // Check if we need to add the plugin and add it. +// if (addPlugin) +// { +// // Add the plugin. +// if (!qualityServicePluginAdded && TokenApplicationPlugin.IsMatch(line)) +// { +// outputLines.Add(QualityServiceApplyPlugin); +// outputLines.AddRange(GenerateAppLovinPluginClosure(apiKey)); +// qualityServicePluginAdded = true; +// } +// } +// } + +// if ((addBuildScriptLines && (!qualityServiceRepositoryAdded || !qualityServiceDependencyClassPathAdded)) || (addPlugin && !qualityServicePluginAdded)) +// { +// MaxSdkLogger.UserError("Failed to add AppLovin Quality Service plugin. Quality Service Plugin Added?: " + qualityServicePluginAdded + ", Quality Service Repo added?: " + qualityServiceRepositoryAdded + ", Quality Service dependency added?: " + qualityServiceDependencyClassPathAdded); +// return null; +// } +// } + +// return outputLines; +// } + +// private static string GetFormattedBuildScriptLine(string buildScriptLine) +// { +// #if UNITY_2022_2_OR_NEWER +// return " " +// #elif UNITY_2019_3_OR_NEWER +// return " " +// #else +// return " " +// #endif +// + buildScriptLine; +// } + +// private static IEnumerable GenerateAppLovinPluginClosure(string apiKey) +// { +// // applovin { +// // // NOTE: DO NOT CHANGE - this is NOT your AppLovin MAX SDK key - this is a derived key. +// // apiKey "456...a1b" +// // } +// var linesToInject = new List(5); +// linesToInject.Add(""); +// linesToInject.Add("applovin {"); +// linesToInject.Add(" // NOTE: DO NOT CHANGE - this is NOT your AppLovin MAX SDK key - this is a derived key."); +// linesToInject.Add(string.Format(QualityServiceApiKey, apiKey)); +// linesToInject.Add("}"); + +// return linesToInject; +// } +// } } #endif diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta index 3eaf90782..5e4984448 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta @@ -3,7 +3,6 @@ guid: 732b7510bc9c94aafb3fd3b8c0dc5d2d labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinProcessGradleBuildFile.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs index 70654359b..94bc0d0ba 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs @@ -12,6 +12,17 @@ using UnityEditor; using UnityEngine; using UnityEngine.Serialization; + +namespace AppLovinMax.Scripts.IntegrationManager.Editor +{ + public enum Platform + { + All, + Android, + iOS + } +} + /// /// A representing the AppLovin Settings that can be set in the Integration Manager Window. /// @@ -26,6 +37,7 @@ public class AppLovinSettings : ScriptableObject public const string DefaultUserTrackingDescriptionEnV0 = "Pressing \\\"Allow\\\" uses device info for more relevant ad content"; public const string DefaultUserTrackingDescriptionEnV1 = "This only uses device info for less annoying, more relevant ads"; public const string DefaultUserTrackingDescriptionEnV2 = "This only uses device info for more interesting and relevant ads"; + public const string DefaultUserTrackingDescriptionEnV3 = "This uses device info for more personalized ads and content"; public const string DefaultUserTrackingDescriptionDe = "\\\"Erlauben\\\" drücken benutzt Gerätinformationen für relevantere Werbeinhalte"; public const string DefaultUserTrackingDescriptionEs = "Presionando \\\"Permitir\\\", se usa la información del dispositivo para obtener contenido publicitario más relevante"; @@ -35,8 +47,6 @@ public class AppLovinSettings : ScriptableObject public const string DefaultUserTrackingDescriptionZhHans = "点击\\\"允许\\\"以使用设备信息获得更加相关的广告内容"; public const string DefaultUserTrackingDescriptionZhHant = "點擊\\\"允許\\\"以使用設備信息獲得更加相關的廣告內容"; - public const string SnapAppStoreAppIdMinVersion = "2.0.0.0"; - /// /// A placeholder constant to be replaced with the actual default localization or an empty string based on whether or not localization is enabled when when the getter is called. /// @@ -50,6 +60,7 @@ public class AppLovinSettings : ScriptableObject [SerializeField] private bool setAttributionReportEndpoint; [SerializeField] private bool consentFlowEnabled; + [SerializeField] private Platform consentFlowPlatform; [SerializeField] private string consentFlowPrivacyPolicyUrl = string.Empty; [SerializeField] private string consentFlowTermsOfServiceUrl = string.Empty; [FormerlySerializedAs("userTrackingUsageDescription")] [SerializeField] private string userTrackingUsageDescriptionEn = string.Empty; @@ -65,7 +76,7 @@ public class AppLovinSettings : ScriptableObject [SerializeField] private string adMobAndroidAppId = string.Empty; [SerializeField] private string adMobIosAppId = string.Empty; - [SerializeField] private int snapAppStoreAppId; + [SerializeField] private bool showInternalSettingsInIntegrationManager; /// /// An instance of AppLovin Setting. @@ -76,6 +87,21 @@ public class AppLovinSettings : ScriptableObject { if (instance == null) { + // Check for an existing AppLovinSettings somewhere in the project + var guids = AssetDatabase.FindAssets("AppLovinSettings t:ScriptableObject"); + if (guids.Length > 1) + { + MaxSdkLogger.UserWarning("Multiple AppLovinSettings found. This may cause unexpected results."); + } + + if (guids.Length != 0) + { + var path = AssetDatabase.GUIDToAssetPath(guids[0]); + instance = AssetDatabase.LoadAssetAtPath(path); + return instance; + } + + // If there is no existing AppLovinSettings asset, create one in the default location string settingsFilePath; // The settings file should be under the Assets/ folder so that it can be version controlled and cannot be overriden when updating. // If the plugin is outside the Assets folder, create the settings asset at the default location. @@ -101,11 +127,9 @@ public class AppLovinSettings : ScriptableObject Directory.CreateDirectory(settingsDir); } - instance = AssetDatabase.LoadAssetAtPath(settingsFilePath); - if (instance != null) return instance; - instance = CreateInstance(); AssetDatabase.CreateAsset(instance, settingsFilePath); + MaxSdkLogger.D("Creating new AppLovinSettings asset at path: " + settingsFilePath); } return instance; @@ -148,9 +172,10 @@ public class AppLovinSettings : ScriptableObject { // Update the default EN description if an old version of the description is still being used. if (DefaultUserTrackingDescriptionEnV0.Equals(Instance.UserTrackingUsageDescriptionEn) - || DefaultUserTrackingDescriptionEnV1.Equals(Instance.UserTrackingUsageDescriptionEn)) + || DefaultUserTrackingDescriptionEnV1.Equals(Instance.UserTrackingUsageDescriptionEn) + || DefaultUserTrackingDescriptionEnV2.Equals(Instance.UserTrackingUsageDescriptionEn)) { - Instance.UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEnV2; + Instance.UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEnV3; } return Instance.consentFlowEnabled; @@ -165,11 +190,12 @@ public class AppLovinSettings : ScriptableObject // If the value didn't change, we don't need to update anything. if (previousValue) return; - Instance.UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEnV2; + Instance.UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEnV3; Instance.UserTrackingUsageLocalizationEnabled = true; } else { + Instance.ConsentFlowPlatform = Platform.All; Instance.ConsentFlowPrivacyPolicyUrl = string.Empty; Instance.ConsentFlowTermsOfServiceUrl = string.Empty; Instance.UserTrackingUsageDescriptionEn = string.Empty; @@ -178,6 +204,12 @@ public class AppLovinSettings : ScriptableObject } } + public Platform ConsentFlowPlatform + { + get { return Instance.consentFlowEnabled ? Instance.consentFlowPlatform : Platform.All; } + set { Instance.consentFlowPlatform = value; } + } + /// /// A URL pointing to the Privacy Policy for the app to be shown when prompting the user for consent. /// @@ -221,7 +253,7 @@ public class AppLovinSettings : ScriptableObject if (value) { // If the value didn't change or the english localization text is not the default one, we don't need to update anything. - if (previousValue || !DefaultUserTrackingDescriptionEnV2.Equals(Instance.UserTrackingUsageDescriptionEn)) return; + if (previousValue || !DefaultUserTrackingDescriptionEnV3.Equals(Instance.UserTrackingUsageDescriptionEn)) return; Instance.UserTrackingUsageDescriptionDe = DefaultUserTrackingDescriptionDe; Instance.UserTrackingUsageDescriptionEs = DefaultUserTrackingDescriptionEs; @@ -342,13 +374,10 @@ public class AppLovinSettings : ScriptableObject set { Instance.adMobIosAppId = value; } } - /// - /// Snap App Store App ID. - /// - public int SnapAppStoreAppId + public bool ShowInternalSettingsInIntegrationManager { - get { return Instance.snapAppStoreAppId; } - set { Instance.snapAppStoreAppId = value; } + get { return Instance.showInternalSettingsInIntegrationManager; } + set { Instance.showInternalSettingsInIntegrationManager = value; } } /// diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta index 5efa24d3e..7e40d7375 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta @@ -3,7 +3,6 @@ guid: ebc0ba1b5ef6b4a6b9dd53d7eadfea16 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\AppLovinSettings.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta index 320f855a6..272b87278 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta @@ -3,9 +3,4 @@ guid: a10a05a8449c42519fd80f2b8b580de3 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef -- al_max_export_path-MaxSdk\Scripts\IntegrationManager\Editor\MaxSdk.IntegrationManager.Editor.asmdef -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: +timeCreated: 1591749873 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxEventSystemChecker.cs b/Assets/ThirdParty/MaxSdk/Scripts/MaxEventSystemChecker.cs new file mode 100644 index 000000000..19a082f2b --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxEventSystemChecker.cs @@ -0,0 +1,37 @@ +// +// EventSystemChecker.cs +// AppLovin MAX Unity Plugin +// +// Created by Jonathan Liu on 10/23/2022. +// Copyright © 2022 AppLovin. All rights reserved. +// + +#if UNITY_EDITOR +using UnityEngine; +using UnityEngine.EventSystems; + +namespace AppLovinMax.Scripts +{ + /// + /// A script to check and enable event system as needed for the AppLovin MAX ad prefabs. + /// + [RequireComponent(typeof(EventSystem))] + public class MaxEventSystemChecker : MonoBehaviour + { + private void Awake() + { + // Enable the EventSystem if there is no other EventSystem in the scene + var eventSystem = GetComponent(); + var currentSystem = UnityEngine.EventSystems.EventSystem.current; + if (currentSystem == null || currentSystem == eventSystem) + { + eventSystem.enabled = true; + } + else + { + eventSystem.enabled = false; + } + } + } +} +#endif diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PostProcessor.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxEventSystemChecker.cs.meta similarity index 55% rename from Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PostProcessor.cs.meta rename to Assets/ThirdParty/MaxSdk/Scripts/MaxEventSystemChecker.cs.meta index 4b466af8f..12874b697 100644 --- a/Assets/ThirdParty/MaxSdk/Mediation/Google/Editor/PostProcessor.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxEventSystemChecker.cs.meta @@ -1,9 +1,8 @@ fileFormatVersion: 2 -guid: 42aa959278164e1683addd3bd5ff03d2 +guid: e0acf281ba86b4929a6942ecd998395b labels: - al_max -- al_max_export_path-MaxSdk/Mediation/Google/Editor/PostProcessor.cs -- al_max_export_path-MaxSdk\Mediation\Google\Editor\PostProcessor.cs +- al_max_export_path-MaxSdk/Scripts/MaxEventSystemChecker.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxEvents.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxEvents.cs.meta index 8327c7f2b..bfb6ad5d4 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxEvents.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxEvents.cs.meta @@ -3,7 +3,6 @@ guid: 67ec2f620c6b0405ba16ea2c032dc9a2 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxEvents.cs -- al_max_export_path-MaxSdk\Scripts\MaxEvents.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta index 2c412e6f3..b55da7247 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta @@ -3,7 +3,6 @@ guid: a4cfc1a18fa3a469b96d885db522f42e labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdk.Scripts.asmdef -- al_max_export_path-MaxSdk\Scripts\MaxSdk.Scripts.asmdef AssemblyDefinitionImporter: externalObjects: {} userData: diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs index 779486d97..8e8715857 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs @@ -18,7 +18,7 @@ public class MaxSdk : MaxSdkUnityEditor #endif { - private const string _version = "5.4.5"; + private const string _version = "5.10.1"; /// /// Returns the current plugin version. diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs.meta index 93a6a6eb6..c1c32f444 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdk.cs.meta @@ -3,7 +3,6 @@ guid: 2fc7aa576843c44e68c7ab14b475bb82 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdk.cs -- al_max_export_path-MaxSdk\Scripts\MaxSdk.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs index 19a3efa16..cd1a0f883 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs @@ -122,6 +122,17 @@ public class MaxSdkAndroid : MaxSdkBase MaxUnityPluginClass.CallStatic("showMediationDebugger"); } + /// + /// Present the creative debugger UI. + /// This debugger tool provides information for recently displayed ads. + /// + /// Please call this method after the SDK has initialized. + /// + public static void ShowCreativeDebugger() + { + MaxUnityPluginClass.CallStatic("showCreativeDebugger"); + } + /// /// Returns the arbitrary ad value for a given ad unit identifier with key. Returns null if no ad is loaded. /// @@ -156,7 +167,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Set whether or not user has provided consent for information sharing with AppLovin and other providers. /// - /// true if the user has provided consent for information sharing with AppLovin. false by default. + /// true if the user has provided consent for information sharing with AppLovin. false by default. public static void SetHasUserConsent(bool hasUserConsent) { MaxUnityPluginClass.CallStatic("setHasUserConsent", hasUserConsent); @@ -165,7 +176,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Check if user has provided consent for information sharing with AppLovin and other providers. /// - /// true if user has provided consent for information sharing. false if the user declined to share information or the consent value has not been set . + /// true if user has provided consent for information sharing. false if the user declined to share information or the consent value has not been set . public static bool HasUserConsent() { return MaxUnityPluginClass.CallStatic("hasUserConsent"); @@ -174,7 +185,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Check if user has set consent for information sharing. /// - /// true if user has set a value of consent for information sharing. + /// true if user has set a value of consent for information sharing. public static bool IsUserConsentSet() { return MaxUnityPluginClass.CallStatic("isUserConsentSet"); @@ -183,7 +194,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Mark user as age restricted (i.e. under 16). /// - /// true if the user is age restricted (i.e. under 16). + /// true if the user is age restricted (i.e. under 16). public static void SetIsAgeRestrictedUser(bool isAgeRestrictedUser) { MaxUnityPluginClass.CallStatic("setIsAgeRestrictedUser", isAgeRestrictedUser); @@ -192,7 +203,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Check if user is age restricted. /// - /// true if the user is age-restricted. false if the user is not age-restricted or the age-restriction has not been set. + /// true if the user is age-restricted. false if the user is not age-restricted or the age-restriction has not been set. public static bool IsAgeRestrictedUser() { return MaxUnityPluginClass.CallStatic("isAgeRestrictedUser"); @@ -201,7 +212,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Check if the user has set its age restricted settings. /// - /// true if the user has set its age restricted settings. + /// true if the user has set its age restricted settings. public static bool IsAgeRestrictedUserSet() { return MaxUnityPluginClass.CallStatic("isAgeRestrictedUserSet"); @@ -210,7 +221,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Set whether or not user has opted out of the sale of their personal information. /// - /// true if the user has opted out of the sale of their personal information. + /// true if the user has opted out of the sale of their personal information. public static void SetDoNotSell(bool doNotSell) { MaxUnityPluginClass.CallStatic("setDoNotSell", doNotSell); @@ -219,7 +230,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Check if the user has opted out of the sale of their personal information. /// - /// true if the user has opted out of the sale of their personal information. false if the user opted in to the sell of their personal information or the value has not been set . + /// true if the user has opted out of the sale of their personal information. false if the user opted in to the sell of their personal information or the value has not been set . public static bool IsDoNotSell() { return MaxUnityPluginClass.CallStatic("isDoNotSell"); @@ -228,7 +239,7 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Check if the user has set the option to sell their personal information. /// - /// true if user has chosen an option to sell their personal information. + /// true if user has chosen an option to sell their personal information. public static bool IsDoNotSellSet() { return MaxUnityPluginClass.CallStatic("isDoNotSellSet"); @@ -264,6 +275,18 @@ public class MaxSdkAndroid : MaxSdkBase MaxUnityPluginClass.CallStatic("createBanner", adUnitIdentifier, x, y); } + /// + /// Load a new banner ad. + /// NOTE: The method loads the first banner ad and initiates an automated banner refresh process. + /// You only need to call this method if you pause banner refresh. + /// + /// Ad unit identifier of the banner to load + public static void LoadBanner(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "load banner"); + MaxUnityPluginClass.CallStatic("loadBanner", adUnitIdentifier); + } + /// /// Set the banner placement for an ad unit identifier to tie the future ad events to. /// @@ -459,6 +482,18 @@ public class MaxSdkAndroid : MaxSdkBase MaxUnityPluginClass.CallStatic("createMRec", adUnitIdentifier, x, y); } + /// + /// Load a new MREC ad. + /// NOTE: The method loads the first MREC ad and initiates an automated MREC refresh process. + /// You only need to call this method if you pause MREC refresh. + /// + /// Ad unit identifier of the MREC to load + public static void LoadMRec(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "load MREC"); + MaxUnityPluginClass.CallStatic("loadMRec", adUnitIdentifier); + } + /// /// Set the MREC placement for an ad unit identifier to tie the future ad events to. /// @@ -771,6 +806,81 @@ public class MaxSdkAndroid : MaxSdkBase #endregion + #region App Open + + /// + /// Start loading an app open ad. + /// + /// Ad unit identifier of the app open ad to load + public static void LoadAppOpenAd(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "load app open ad"); + MaxUnityPluginClass.CallStatic("loadAppOpenAd", adUnitIdentifier); + } + + /// + /// Check if app open ad ad is loaded and ready to be displayed. + /// + /// Ad unit identifier of the app open ad to load + /// True if the ad is ready to be displayed + public static bool IsAppOpenAdReady(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "check app open ad loaded"); + return MaxUnityPluginClass.CallStatic("isAppOpenAdReady", adUnitIdentifier); + } + + /// + /// Present loaded app open ad for a given placement to tie ad events to. Note: if the app open ad is not ready to be displayed nothing will happen. + /// + /// Ad unit identifier of the app open ad to load + /// The placement to tie the showing ad's events to + /// The custom data to tie the showing ad's events to. Maximum size is 8KB. + public static void ShowAppOpenAd(string adUnitIdentifier, string placement = null, string customData = null) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "show app open ad"); + + if (IsAppOpenAdReady(adUnitIdentifier)) + { + MaxUnityPluginClass.CallStatic("showAppOpenAd", adUnitIdentifier, placement, customData); + } + else + { + MaxSdkLogger.UserWarning("Not showing MAX Ads app open ad: ad not ready"); + } + } + + /// + /// Set an extra parameter for the ad. + /// + /// Ad unit identifier of the app open ad to set the extra parameter for. + /// The key for the extra parameter. + /// The value for the extra parameter. + public static void SetAppOpenAdExtraParameter(string adUnitIdentifier, string key, string value) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "set app open ad extra parameter"); + MaxUnityPluginClass.CallStatic("setAppOpenAdExtraParameter", adUnitIdentifier, key, value); + } + + /// + /// Set a local extra parameter for the ad. + /// + /// Ad unit identifier of the app open ad to set the local extra parameter for. + /// The key for the local extra parameter. + /// The value for the extra parameter. Needs to be of type or null + public static void SetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, object value) + { + if (value != null && value.GetType() != typeof(AndroidJavaObject)) + { + MaxSdkLogger.E("Failed to set local extra parameter. Android local extra parameters need to be of type AndroidJavaObject"); + return; + } + + ValidateAdUnitIdentifier(adUnitIdentifier, "set app open ad local extra parameter"); + MaxUnityPluginClass.CallStatic("setAppOpenAdLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value); + } + + #endregion + #region Rewarded /// @@ -1114,7 +1224,14 @@ public class MaxSdkAndroid : MaxSdkBase public void onEvent(string propsStr) { - MaxSdkCallbacks.Instance.ForwardEvent(propsStr); + try + { + MaxSdkCallbacks.Instance.ForwardEvent(propsStr); + } + catch (Exception exception) + { + MaxSdkLogger.UserError("Unable to notify ad delegate due to exception: " + exception.Message); + } } } } diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs.meta index cd86fd696..2cf54482b 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkAndroid.cs.meta @@ -3,7 +3,6 @@ guid: 10335fad6bfef47b8819a411aa591dc8 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkAndroid.cs -- al_max_export_path-MaxSdk\Scripts\MaxSdkAndroid.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs index 0f950fa5c..99f331d77 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs @@ -1,39 +1,21 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Text; using AppLovinMax.ThirdParty.MiniJson; using UnityEngine; +#if UNITY_IOS && !UNITY_EDITOR +using System.Runtime.InteropServices; +#endif + public abstract class MaxSdkBase { // Shared Properties protected static readonly MaxUserSegment SharedUserSegment = new MaxUserSegment(); protected static readonly MaxTargetingData SharedTargetingData = new MaxTargetingData(); - /// - /// This enum represents whether or not the consent dialog should be shown for this user. - /// The state where no such determination could be made is represented by . - /// - /// NOTE: This version of the iOS consent flow has been deprecated and is only available on UNITY_ANDROID as of MAX Unity Plugin v4.0.0 + iOS SDK v7.0.0, please refer to our documentation for enabling the new consent flow. - /// - public enum ConsentDialogState - { - /// - /// The consent dialog state could not be determined. This is likely due to SDK failing to initialize. - /// - Unknown, - - /// - /// This user should be shown a consent dialog. - /// - Applies, - - /// - /// This user should not be shown a consent dialog. - /// - DoesNotApply - } #if UNITY_EDITOR || UNITY_IPHONE || UNITY_IOS /// @@ -99,23 +81,42 @@ public abstract class MaxSdkBase /// /// Whether or not the SDK has been initialized successfully. /// - public bool IsSuccessfullyInitialized; - - /// - /// Get the consent dialog state for this user. If no such determination could be made, `ALConsentDialogStateUnknown` will be returned. - /// - public ConsentDialogState ConsentDialogState; + public bool IsSuccessfullyInitialized { get; private set; } /// /// Get the country code for this user. /// - public string CountryCode; + public string CountryCode { get; private set; } #if UNITY_EDITOR || UNITY_IPHONE || UNITY_IOS /// /// App tracking status values. Primarily used in conjunction with iOS14's AppTrackingTransparency.framework. /// - public AppTrackingStatus AppTrackingStatus; + public AppTrackingStatus AppTrackingStatus { get; private set; } +#endif + + public bool IsTestModeEnabled { get; private set; } + + [Obsolete("This API has been deprecated and will be removed in a future release.")] + public ConsentDialogState ConsentDialogState { get; private set; } + +#if UNITY_EDITOR || !(UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS) + public static SdkConfiguration CreateEmpty() + { + var sdkConfiguration = new SdkConfiguration(); + sdkConfiguration.IsSuccessfullyInitialized = true; +#pragma warning disable 0618 + sdkConfiguration.ConsentDialogState = ConsentDialogState.Unknown; +#pragma warning restore 0618 +#if UNITY_EDITOR + sdkConfiguration.AppTrackingStatus = AppTrackingStatus.Authorized; +#endif + var currentRegion = RegionInfo.CurrentRegion; + sdkConfiguration.CountryCode = currentRegion != null ? currentRegion.TwoLetterISORegionName : "US"; + sdkConfiguration.IsTestModeEnabled = false; + + return sdkConfiguration; + } #endif public static SdkConfiguration Create(IDictionary eventProps) @@ -124,7 +125,9 @@ public abstract class MaxSdkBase sdkConfiguration.IsSuccessfullyInitialized = MaxSdkUtils.GetBoolFromDictionary(eventProps, "isSuccessfullyInitialized"); sdkConfiguration.CountryCode = MaxSdkUtils.GetStringFromDictionary(eventProps, "countryCode", ""); + sdkConfiguration.IsTestModeEnabled = MaxSdkUtils.GetBoolFromDictionary(eventProps, "isTestModeEnabled"); +#pragma warning disable 0618 var consentDialogStateStr = MaxSdkUtils.GetStringFromDictionary(eventProps, "consentDialogState", ""); if ("1".Equals(consentDialogStateStr)) { @@ -138,6 +141,7 @@ public abstract class MaxSdkBase { sdkConfiguration.ConsentDialogState = ConsentDialogState.Unknown; } +#pragma warning restore 0618 #if UNITY_IPHONE || UNITY_IOS var appTrackingStatusStr = MaxSdkUtils.GetStringFromDictionary(eventProps, "appTrackingStatus", "-1"); @@ -343,7 +347,7 @@ public abstract class MaxSdkBase return "[MediatedNetworkInfo: name = " + Name + ", testName = " + TestName + ", latency = " + LatencyMillis + - ", networkResponse = " + NetworkResponses + "]"; + ", networkResponse = " + string.Join(", ", NetworkResponses.Select(networkResponseInfo => networkResponseInfo.ToString()).ToArray()) + "]"; } } @@ -352,6 +356,7 @@ public abstract class MaxSdkBase public MaxAdLoadState AdLoadState { get; private set; } public MediatedNetworkInfo MediatedNetwork { get; private set; } public Dictionary Credentials { get; private set; } + public bool IsBidding { get; private set; } public long LatencyMillis { get; private set; } public ErrorInfo Error { get; private set; } @@ -361,6 +366,7 @@ public abstract class MaxSdkBase MediatedNetwork = mediatedNetworkInfoDict != null ? new MediatedNetworkInfo(mediatedNetworkInfoDict) : null; Credentials = MaxSdkUtils.GetDictionaryFromDictionary(networkResponseInfoDict, "credentials", new Dictionary()); + IsBidding = MaxSdkUtils.GetBoolFromDictionary(networkResponseInfoDict, "isBidding"); LatencyMillis = MaxSdkUtils.GetLongFromDictionary(networkResponseInfoDict, "latencyMillis"); AdLoadState = (MaxAdLoadState) MaxSdkUtils.GetIntFromDictionary(networkResponseInfoDict, "adLoadState"); @@ -372,7 +378,7 @@ public abstract class MaxSdkBase { var stringBuilder = new StringBuilder("[NetworkResponseInfo: adLoadState = ").Append(AdLoadState); stringBuilder.Append(", mediatedNetwork = ").Append(MediatedNetwork); - stringBuilder.Append(", credentials = ").Append(Credentials); + stringBuilder.Append(", credentials = ").Append(string.Join(", ", Credentials.Select(keyValuePair => keyValuePair.ToString()).ToArray())); switch (AdLoadState) { @@ -497,6 +503,14 @@ public abstract class MaxSdkBase return new Rect(originX, originY, width, height); } + + [Obsolete("This API has been deprecated and will be removed in a future release.")] + public enum ConsentDialogState + { + Unknown, + Applies, + DoesNotApply + } } /// @@ -584,3 +598,154 @@ internal static class AdPositionExtenstion } } } + +namespace AppLovinMax.Internal.API +{ + public class CFError + { + /// + /// Indicates that the flow ended in an unexpected state. + /// + public const int ErrorCodeUnspecified = -1; + + /// + /// Indicates that the consent flow has not been integrated correctly. + /// + public const int ErrorCodeInvalidIntegration = -100; + + /// + /// Indicates that the consent flow is already being shown. + /// + public const int ErrorCodeFlowAlreadyInProgress = -200; + + /// + /// Indicates that the user is not in a GDPR region. + /// + public const int ErrorCodeNotInGdprRegion = -300; + + /// + /// The error code for this error. Will be one of the error codes listed in this file. + /// + public int Code { get; private set; } + + /// + /// The error message for this error. + /// + public string Message { get; private set; } + + public static CFError Create(IDictionary errorObject) + { + if (!errorObject.ContainsKey("code") && !errorObject.ContainsKey("message")) return null; + + var code = MaxSdkUtils.GetIntFromDictionary(errorObject, "code", ErrorCodeUnspecified); + var message = MaxSdkUtils.GetStringFromDictionary(errorObject, "message"); + return new CFError(code, message); + } + + private CFError(int code, string message) + { + Code = code; + Message = message; + } + + public override string ToString() + { + return "[CFError Code: " + Code + + ", Message: " + Message + "]"; + } + } + + public enum CFType + { + /// + /// The flow type is not known. + /// + Unknown, + + /// + /// A standard flow where a TOS/PP alert is shown. + /// + Standard, + + /// + /// A detailed modal shown to users in GDPR region. + /// + Detailed + } + + public class CFService + { + private static Action OnConsentFlowCompletedAction; + +#if UNITY_EDITOR +#elif UNITY_ANDROID + private static readonly AndroidJavaClass MaxUnityPluginClass = new AndroidJavaClass("com.applovin.mediation.unity.MaxUnityPlugin"); +#elif UNITY_IOS + [DllImport("__Internal")] + private static extern string _MaxGetCFType(); + + [DllImport("__Internal")] + private static extern void _MaxStartConsentFlow(); +#endif + + /// + /// The consent flow type that will be displayed. + /// + public static CFType CFType + { + get + { + var cfType = "0"; +#if UNITY_EDITOR +#elif UNITY_ANDROID + cfType = MaxUnityPluginClass.CallStatic("getCFType"); +#elif UNITY_IOS + cfType = _MaxGetCFType(); +#endif + + if ("1".Equals(cfType)) + { + return CFType.Standard; + } + else if ("2".Equals(cfType)) + { + return CFType.Detailed; + } + + return CFType.Unknown; + } + } + + /// + /// Starts the consent flow. Call this method to re-show the consent flow for a user in GDPR region. + /// + /// Note: The flow will only be shown to users in GDPR regions. + /// + /// Called when we finish showing the consent flow. Error object will be null if the flow completed successfully. + public static void SCF(Action onFlowCompletedAction) + { + OnConsentFlowCompletedAction = onFlowCompletedAction; + +#if UNITY_EDITOR + var errorDict = new Dictionary() + { + {"code", CFError.ErrorCodeUnspecified}, + {"message", "Consent flow is not supported in Unity Editor."} + }; + + NotifyConsentFlowCompletedIfNeeded(errorDict); +#elif UNITY_ANDROID + MaxUnityPluginClass.CallStatic("startConsentFlow"); +#elif UNITY_IOS + _MaxStartConsentFlow(); +#endif + } + + public static void NotifyConsentFlowCompletedIfNeeded(IDictionary error) + { + if (OnConsentFlowCompletedAction == null) return; + + OnConsentFlowCompletedAction(CFError.Create(error)); + } + } +} diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs.meta index 7d28de10e..f27f76996 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkBase.cs.meta @@ -3,7 +3,6 @@ guid: 893e4e55a7e394274957f1034f7afc45 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkBase.cs -- al_max_export_path-MaxSdk\Scripts\MaxSdkBase.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs index 64a29ec4e..acd6db9a8 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs @@ -6,11 +6,31 @@ using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; -using AppLovinMax.ThirdParty.MiniJson; +using AppLovinMax.Internal.API; +using AppLovinMax.ThirdParty.MiniJson; public class MaxSdkCallbacks : MonoBehaviour { - public static MaxSdkCallbacks Instance { get; private set; } +#if UNITY_EDITOR + private static MaxSdkCallbacks instance; +#endif + + public static MaxSdkCallbacks Instance + { +#if UNITY_EDITOR + get + { + if (instance != null) return instance; + + instance = new GameObject("MaxSdkCallbacks", typeof(MaxSdkCallbacks)).GetComponent(); + DontDestroyOnLoad(instance); + + return instance; + } +#else + get; private set; +#endif + } // Fired when the SDK has finished initializing private static Action _onSdkInitializedEvent; @@ -30,6 +50,7 @@ public class MaxSdkCallbacks : MonoBehaviour // Fire when the MaxVariableService has finished loading the latest set of variables. private static Action _onVariablesUpdatedEvent; + [System.Obsolete("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.")] public static event Action OnVariablesUpdatedEvent { add @@ -66,6 +87,7 @@ public class MaxSdkCallbacks : MonoBehaviour private static Action _onInterstitialAdFailedToDisplayEventV2; private static Action _onInterstitialAdClickedEventV2; private static Action _onInterstitialAdRevenuePaidEvent; + private static Action _onInterstitialAdReviewCreativeIdGeneratedEvent; private static Action _onInterstitialAdHiddenEventV2; public class Interstitial @@ -99,7 +121,7 @@ public class MaxSdkCallbacks : MonoBehaviour } /** - * Fired when an rewarded ad is displayed (may not be received by Unity until the rewarded ad closes). + * Fired when an interstitial ad is displayed (may not be received by Unity until the interstitial ad closes). */ public static event Action OnAdDisplayedEvent { @@ -161,6 +183,24 @@ public class MaxSdkCallbacks : MonoBehaviour } } + /// + /// Fired when an Ad Review Creative ID has been generated. + /// The parameters returned are the adUnitIdentifier, adReviewCreativeId, and adInfo in that respective order. + /// + public static event Action OnAdReviewCreativeIdGeneratedEvent + { + add + { + LogSubscribedToEvent("OnInterstitialAdReviewCreativeIdGeneratedEvent"); + _onInterstitialAdReviewCreativeIdGeneratedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnInterstitialAdReviewCreativeIdGeneratedEvent"); + _onInterstitialAdReviewCreativeIdGeneratedEvent -= value; + } + } + public static event Action OnAdHiddenEvent { add @@ -176,12 +216,129 @@ public class MaxSdkCallbacks : MonoBehaviour } } + private static Action _onAppOpenAdLoadedEvent; + private static Action _onAppOpenAdLoadFailedEvent; + private static Action _onAppOpenAdDisplayedEvent; + private static Action _onAppOpenAdFailedToDisplayEvent; + private static Action _onAppOpenAdClickedEvent; + private static Action _onAppOpenAdRevenuePaidEvent; + private static Action _onAppOpenAdHiddenEvent; + + public class AppOpen + { + public static event Action OnAdLoadedEvent + { + add + { + LogSubscribedToEvent("OnAppOpenAdLoadedEvent"); + _onAppOpenAdLoadedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnAppOpenAdLoadedEvent"); + _onAppOpenAdLoadedEvent -= value; + } + } + + public static event Action OnAdLoadFailedEvent + { + add + { + LogSubscribedToEvent("OnAppOpenAdLoadFailedEvent"); + _onAppOpenAdLoadFailedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnAppOpenAdLoadFailedEvent"); + _onAppOpenAdLoadFailedEvent -= value; + } + } + + /** + * Fired when an app open ad is displayed (may not be received by Unity until the app open ad closes). + */ + public static event Action OnAdDisplayedEvent + { + add + { + LogSubscribedToEvent("OnAppOpenAdDisplayedEvent"); + _onAppOpenAdDisplayedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnAppOpenAdDisplayedEvent"); + _onAppOpenAdDisplayedEvent -= value; + } + } + + public static event Action OnAdDisplayFailedEvent + { + add + { + LogSubscribedToEvent("OnAppOpenAdDisplayFailedEvent"); + _onAppOpenAdFailedToDisplayEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnAppOpenAdDisplayFailedEvent"); + _onAppOpenAdFailedToDisplayEvent -= value; + } + } + + public static event Action OnAdClickedEvent + { + add + { + LogSubscribedToEvent("OnAppOpenAdClickedEvent"); + _onAppOpenAdClickedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnAppOpenAdClickedEvent"); + _onAppOpenAdClickedEvent -= value; + } + } + + /// + /// Fired when an app open ad impression was validated and revenue will be paid. + /// Executed on a background thread to avoid any delays in execution. + /// + public static event Action OnAdRevenuePaidEvent + { + add + { + LogSubscribedToEvent("OnAppOpenAdRevenuePaidEvent"); + _onAppOpenAdRevenuePaidEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnAppOpenAdRevenuePaidEvent"); + _onAppOpenAdRevenuePaidEvent -= value; + } + } + + public static event Action OnAdHiddenEvent + { + add + { + LogSubscribedToEvent("OnAppOpenAdHiddenEvent"); + _onAppOpenAdHiddenEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnAppOpenAdHiddenEvent"); + _onAppOpenAdHiddenEvent -= value; + } + } + } + private static Action _onRewardedAdLoadedEventV2; private static Action _onRewardedAdLoadFailedEventV2; private static Action _onRewardedAdDisplayedEventV2; private static Action _onRewardedAdFailedToDisplayEventV2; private static Action _onRewardedAdClickedEventV2; private static Action _onRewardedAdRevenuePaidEvent; + private static Action _onRewardedAdReviewCreativeIdGeneratedEvent; private static Action _onRewardedAdReceivedRewardEventV2; private static Action _onRewardedAdHiddenEventV2; @@ -216,7 +373,7 @@ public class MaxSdkCallbacks : MonoBehaviour } /** - * Fired when an rewarded ad is displayed (may not be received by Unity until the rewarded ad closes). + * Fired when a rewarded ad is displayed (may not be received by Unity until the rewarded ad closes). */ public static event Action OnAdDisplayedEvent { @@ -278,6 +435,24 @@ public class MaxSdkCallbacks : MonoBehaviour } } + /// + /// Fired when an Ad Review Creative ID has been generated. + /// The parameters returned are the adUnitIdentifier, adReviewCreativeId, and adInfo in that respective order. + /// + public static event Action OnAdReviewCreativeIdGeneratedEvent + { + add + { + LogSubscribedToEvent("OnRewardedAdReviewCreativeIdGeneratedEvent"); + _onRewardedAdReviewCreativeIdGeneratedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnRewardedAdReviewCreativeIdGeneratedEvent"); + _onRewardedAdReviewCreativeIdGeneratedEvent -= value; + } + } + public static event Action OnAdReceivedRewardEvent { add @@ -313,6 +488,7 @@ public class MaxSdkCallbacks : MonoBehaviour private static Action _onRewardedInterstitialAdFailedToDisplayEvent; private static Action _onRewardedInterstitialAdClickedEvent; private static Action _onRewardedInterstitialAdRevenuePaidEvent; + private static Action _onRewardedInterstitialAdReviewCreativeIdGeneratedEvent; private static Action _onRewardedInterstitialAdReceivedRewardEvent; private static Action _onRewardedInterstitialAdHiddenEvent; @@ -347,7 +523,8 @@ public class MaxSdkCallbacks : MonoBehaviour } /** - * Fired when an rewarded ad is displayed (may not be received by Unity until the rewarded ad closes). + * Fired when a rewarded interstitial ad is displayed (may not be received by Unity until + * the rewarded interstitial ad closes). */ public static event Action OnAdDisplayedEvent { @@ -409,6 +586,24 @@ public class MaxSdkCallbacks : MonoBehaviour } } + /// + /// Fired when an Ad Review Creative ID has been generated. + /// The parameters returned are the adUnitIdentifier, adReviewCreativeId, and adInfo in that respective order. + /// + public static event Action OnAdReviewCreativeIdGeneratedEvent + { + add + { + LogSubscribedToEvent("OnRewardedInterstitialAdReviewCreativeIdGeneratedEvent"); + _onRewardedInterstitialAdReviewCreativeIdGeneratedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnRewardedInterstitialAdReviewCreativeIdGeneratedEvent"); + _onRewardedInterstitialAdReviewCreativeIdGeneratedEvent -= value; + } + } + public static event Action OnAdReceivedRewardEvent { add @@ -442,6 +637,7 @@ public class MaxSdkCallbacks : MonoBehaviour private static Action _onBannerAdLoadFailedEventV2; private static Action _onBannerAdClickedEventV2; private static Action _onBannerAdRevenuePaidEvent; + private static Action _onBannerAdReviewCreativeIdGeneratedEvent; private static Action _onBannerAdExpandedEventV2; private static Action _onBannerAdCollapsedEventV2; @@ -503,6 +699,24 @@ public class MaxSdkCallbacks : MonoBehaviour } } + /// + /// Fired when an Ad Review Creative ID has been generated. + /// The parameters returned are the adUnitIdentifier, adReviewCreativeId, and adInfo in that respective order. + /// + public static event Action OnAdReviewCreativeIdGeneratedEvent + { + add + { + LogSubscribedToEvent("OnBannerAdReviewCreativeIdGeneratedEvent"); + _onBannerAdReviewCreativeIdGeneratedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnBannerAdReviewCreativeIdGeneratedEvent"); + _onBannerAdReviewCreativeIdGeneratedEvent -= value; + } + } + public static event Action OnAdExpandedEvent { add @@ -536,6 +750,7 @@ public class MaxSdkCallbacks : MonoBehaviour private static Action _onMRecAdLoadFailedEventV2; private static Action _onMRecAdClickedEventV2; private static Action _onMRecAdRevenuePaidEvent; + private static Action _onMRecAdReviewCreativeIdGeneratedEvent; private static Action _onMRecAdExpandedEventV2; private static Action _onMRecAdCollapsedEventV2; @@ -597,6 +812,24 @@ public class MaxSdkCallbacks : MonoBehaviour } } + /// + /// Fired when an Ad Review Creative ID has been generated. + /// The parameters returned are the adUnitIdentifier, adReviewCreativeId, and adInfo in that respective order. + /// + public static event Action OnAdReviewCreativeIdGeneratedEvent + { + add + { + LogSubscribedToEvent("OnMRecAdReviewCreativeIdGeneratedEvent"); + _onMRecAdReviewCreativeIdGeneratedEvent += value; + } + remove + { + LogUnsubscribedToEvent("OnMRecAdReviewCreativeIdGeneratedEvent"); + _onMRecAdReviewCreativeIdGeneratedEvent -= value; + } + } + public static event Action OnAdExpandedEvent { add @@ -1094,6 +1327,7 @@ public class MaxSdkCallbacks : MonoBehaviour } } +#if !UNITY_EDITOR void Awake() { if (Instance == null) @@ -1102,6 +1336,7 @@ public class MaxSdkCallbacks : MonoBehaviour DontDestroyOnLoad(gameObject); } } +#endif public void ForwardEvent(string eventPropsStr) { @@ -1116,15 +1351,19 @@ public class MaxSdkCallbacks : MonoBehaviour if (eventName == "OnSdkInitializedEvent") { var sdkConfiguration = MaxSdkBase.SdkConfiguration.Create(eventProps); - InvokeEvent(_onSdkInitializedEvent, sdkConfiguration); + InvokeEvent(_onSdkInitializedEvent, sdkConfiguration, eventName); } else if (eventName == "OnVariablesUpdatedEvent") { - InvokeEvent(_onVariablesUpdatedEvent); + InvokeEvent(_onVariablesUpdatedEvent, eventName); } else if (eventName == "OnSdkConsentDialogDismissedEvent") { - InvokeEvent(_onSdkConsentDialogDismissedEvent); + InvokeEvent(_onSdkConsentDialogDismissedEvent, eventName); + } + else if (eventName == "OnSdkConsentFlowCompletedEvent") + { + CFService.NotifyConsentFlowCompletedIfNeeded(eventProps); } // Ad Events else @@ -1133,173 +1372,223 @@ public class MaxSdkCallbacks : MonoBehaviour var adUnitIdentifier = MaxSdkUtils.GetStringFromDictionary(eventProps, "adUnitId", ""); if (eventName == "OnBannerAdLoadedEvent") { - InvokeEvent(_onBannerAdLoadedEvent, adUnitIdentifier); - InvokeEvent(_onBannerAdLoadedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onBannerAdLoadedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onBannerAdLoadedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnBannerAdLoadFailedEvent") { var errorCode = MaxSdkUtils.GetIntFromDictionary(eventProps, "errorCode", -1); - InvokeEvent(_onBannerAdLoadFailedEvent, adUnitIdentifier, errorCode); + InvokeEvent(_onBannerAdLoadFailedEvent, adUnitIdentifier, errorCode, eventName); var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onBannerAdLoadFailedEventV2, adUnitIdentifier, errorInfo); + InvokeEvent(_onBannerAdLoadFailedEventV2, adUnitIdentifier, errorInfo, eventName); } else if (eventName == "OnBannerAdClickedEvent") { - InvokeEvent(_onBannerAdClickedEvent, adUnitIdentifier); - InvokeEvent(_onBannerAdClickedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onBannerAdClickedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onBannerAdClickedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnBannerAdRevenuePaidEvent") { - InvokeEvent(_onBannerAdRevenuePaidEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onBannerAdRevenuePaidEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnBannerAdReviewCreativeIdGeneratedEvent") + { + var adReviewCreativeId = MaxSdkUtils.GetStringFromDictionary(eventProps, "adReviewCreativeId", ""); + InvokeEvent(_onBannerAdReviewCreativeIdGeneratedEvent, adUnitIdentifier, adReviewCreativeId, adInfo, eventName); } else if (eventName == "OnBannerAdExpandedEvent") { - InvokeEvent(_onBannerAdExpandedEvent, adUnitIdentifier); - InvokeEvent(_onBannerAdExpandedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onBannerAdExpandedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onBannerAdExpandedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnBannerAdCollapsedEvent") { - InvokeEvent(_onBannerAdCollapsedEvent, adUnitIdentifier); - InvokeEvent(_onBannerAdCollapsedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onBannerAdCollapsedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onBannerAdCollapsedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnMRecAdLoadedEvent") { - InvokeEvent(_onMRecAdLoadedEvent, adUnitIdentifier); - InvokeEvent(_onMRecAdLoadedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onMRecAdLoadedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onMRecAdLoadedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnMRecAdLoadFailedEvent") { var errorCode = MaxSdkUtils.GetIntFromDictionary(eventProps, "errorCode", -1); - InvokeEvent(_onMRecAdLoadFailedEvent, adUnitIdentifier, errorCode); + InvokeEvent(_onMRecAdLoadFailedEvent, adUnitIdentifier, errorCode, eventName); var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onMRecAdLoadFailedEventV2, adUnitIdentifier, errorInfo); + InvokeEvent(_onMRecAdLoadFailedEventV2, adUnitIdentifier, errorInfo, eventName); } else if (eventName == "OnMRecAdClickedEvent") { - InvokeEvent(_onMRecAdClickedEvent, adUnitIdentifier); - InvokeEvent(_onMRecAdClickedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onMRecAdClickedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onMRecAdClickedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnMRecAdRevenuePaidEvent") { - InvokeEvent(_onMRecAdRevenuePaidEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onMRecAdRevenuePaidEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnMRecAdReviewCreativeIdGeneratedEvent") + { + var adReviewCreativeId = MaxSdkUtils.GetStringFromDictionary(eventProps, "adReviewCreativeId", ""); + InvokeEvent(_onMRecAdReviewCreativeIdGeneratedEvent, adUnitIdentifier, adReviewCreativeId, adInfo, eventName); } else if (eventName == "OnMRecAdExpandedEvent") { - InvokeEvent(_onMRecAdExpandedEvent, adUnitIdentifier); - InvokeEvent(_onMRecAdExpandedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onMRecAdExpandedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onMRecAdExpandedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnMRecAdCollapsedEvent") { - InvokeEvent(_onMRecAdCollapsedEvent, adUnitIdentifier); - InvokeEvent(_onMRecAdCollapsedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onMRecAdCollapsedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onMRecAdCollapsedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnCrossPromoAdLoadedEvent") { - InvokeEvent(_onCrossPromoAdLoadedEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onCrossPromoAdLoadedEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnCrossPromoAdLoadFailedEvent") { var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onCrossPromoAdLoadFailedEvent, adUnitIdentifier, errorInfo); + InvokeEvent(_onCrossPromoAdLoadFailedEvent, adUnitIdentifier, errorInfo, eventName); } else if (eventName == "OnCrossPromoAdClickedEvent") { - InvokeEvent(_onCrossPromoAdClickedEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onCrossPromoAdClickedEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnCrossPromoAdRevenuePaidEvent") { - InvokeEvent(_onCrossPromoAdRevenuePaidEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onCrossPromoAdRevenuePaidEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnCrossPromoAdExpandedEvent") { - InvokeEvent(_onCrossPromoAdExpandedEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onCrossPromoAdExpandedEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnCrossPromoAdCollapsedEvent") { - InvokeEvent(_onCrossPromoAdCollapsedEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onCrossPromoAdCollapsedEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnInterstitialLoadedEvent") { - InvokeEvent(_onInterstitialAdLoadedEvent, adUnitIdentifier); - InvokeEvent(_onInterstitialAdLoadedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onInterstitialAdLoadedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onInterstitialAdLoadedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnInterstitialLoadFailedEvent") { var errorCode = MaxSdkUtils.GetIntFromDictionary(eventProps, "errorCode", -1); - InvokeEvent(_onInterstitialLoadFailedEvent, adUnitIdentifier, errorCode); + InvokeEvent(_onInterstitialLoadFailedEvent, adUnitIdentifier, errorCode, eventName); var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onInterstitialAdLoadFailedEventV2, adUnitIdentifier, errorInfo); + InvokeEvent(_onInterstitialAdLoadFailedEventV2, adUnitIdentifier, errorInfo, eventName); } else if (eventName == "OnInterstitialHiddenEvent") { - InvokeEvent(_onInterstitialAdHiddenEvent, adUnitIdentifier); - InvokeEvent(_onInterstitialAdHiddenEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onInterstitialAdHiddenEvent, adUnitIdentifier, eventName); + InvokeEvent(_onInterstitialAdHiddenEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnInterstitialDisplayedEvent") { - InvokeEvent(_onInterstitialAdDisplayedEvent, adUnitIdentifier); - InvokeEvent(_onInterstitialAdDisplayedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onInterstitialAdDisplayedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onInterstitialAdDisplayedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnInterstitialAdFailedToDisplayEvent") { var errorCode = MaxSdkUtils.GetIntFromDictionary(eventProps, "errorCode", -1); - InvokeEvent(_onInterstitialAdFailedToDisplayEvent, adUnitIdentifier, errorCode); + InvokeEvent(_onInterstitialAdFailedToDisplayEvent, adUnitIdentifier, errorCode, eventName); var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onInterstitialAdFailedToDisplayEventV2, adUnitIdentifier, errorInfo, adInfo); + InvokeEvent(_onInterstitialAdFailedToDisplayEventV2, adUnitIdentifier, errorInfo, adInfo, eventName); } else if (eventName == "OnInterstitialClickedEvent") { - InvokeEvent(_onInterstitialAdClickedEvent, adUnitIdentifier); - InvokeEvent(_onInterstitialAdClickedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onInterstitialAdClickedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onInterstitialAdClickedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnInterstitialAdRevenuePaidEvent") { - InvokeEvent(_onInterstitialAdRevenuePaidEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onInterstitialAdRevenuePaidEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnInterstitialAdReviewCreativeIdGeneratedEvent") + { + var adReviewCreativeId = MaxSdkUtils.GetStringFromDictionary(eventProps, "adReviewCreativeId", ""); + InvokeEvent(_onInterstitialAdReviewCreativeIdGeneratedEvent, adUnitIdentifier, adReviewCreativeId, adInfo, eventName); + } + else if (eventName == "OnAppOpenAdLoadedEvent") + { + InvokeEvent(_onAppOpenAdLoadedEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnAppOpenAdLoadFailedEvent") + { + var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); + InvokeEvent(_onAppOpenAdLoadFailedEvent, adUnitIdentifier, errorInfo, eventName); + } + else if (eventName == "OnAppOpenAdHiddenEvent") + { + InvokeEvent(_onAppOpenAdHiddenEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnAppOpenAdDisplayedEvent") + { + InvokeEvent(_onAppOpenAdDisplayedEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnAppOpenAdFailedToDisplayEvent") + { + var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); + InvokeEvent(_onAppOpenAdFailedToDisplayEvent, adUnitIdentifier, errorInfo, adInfo, eventName); + } + else if (eventName == "OnAppOpenAdClickedEvent") + { + InvokeEvent(_onAppOpenAdClickedEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnAppOpenAdRevenuePaidEvent") + { + InvokeEvent(_onAppOpenAdRevenuePaidEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedAdLoadedEvent") { - InvokeEvent(_onRewardedAdLoadedEvent, adUnitIdentifier); - InvokeEvent(_onRewardedAdLoadedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedAdLoadedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onRewardedAdLoadedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedAdLoadFailedEvent") { var errorCode = MaxSdkUtils.GetIntFromDictionary(eventProps, "errorCode", -1); - InvokeEvent(_onRewardedAdLoadFailedEvent, adUnitIdentifier, errorCode); + InvokeEvent(_onRewardedAdLoadFailedEvent, adUnitIdentifier, errorCode, eventName); var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onRewardedAdLoadFailedEventV2, adUnitIdentifier, errorInfo); + InvokeEvent(_onRewardedAdLoadFailedEventV2, adUnitIdentifier, errorInfo, eventName); } else if (eventName == "OnRewardedAdDisplayedEvent") { - InvokeEvent(_onRewardedAdDisplayedEvent, adUnitIdentifier); - InvokeEvent(_onRewardedAdDisplayedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedAdDisplayedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onRewardedAdDisplayedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedAdHiddenEvent") { - InvokeEvent(_onRewardedAdHiddenEvent, adUnitIdentifier); - InvokeEvent(_onRewardedAdHiddenEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedAdHiddenEvent, adUnitIdentifier, eventName); + InvokeEvent(_onRewardedAdHiddenEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedAdClickedEvent") { - InvokeEvent(_onRewardedAdClickedEvent, adUnitIdentifier); - InvokeEvent(_onRewardedAdClickedEventV2, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedAdClickedEvent, adUnitIdentifier, eventName); + InvokeEvent(_onRewardedAdClickedEventV2, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedAdRevenuePaidEvent") { - InvokeEvent(_onRewardedAdRevenuePaidEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedAdRevenuePaidEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnRewardedAdReviewCreativeIdGeneratedEvent") + { + var adReviewCreativeId = MaxSdkUtils.GetStringFromDictionary(eventProps, "adReviewCreativeId", ""); + InvokeEvent(_onRewardedAdReviewCreativeIdGeneratedEvent, adUnitIdentifier, adReviewCreativeId, adInfo, eventName); } else if (eventName == "OnRewardedAdFailedToDisplayEvent") { var errorCode = MaxSdkUtils.GetIntFromDictionary(eventProps, "errorCode", -1); - InvokeEvent(_onRewardedAdFailedToDisplayEvent, adUnitIdentifier, errorCode); + InvokeEvent(_onRewardedAdFailedToDisplayEvent, adUnitIdentifier, errorCode, eventName); var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onRewardedAdFailedToDisplayEventV2, adUnitIdentifier, errorInfo, adInfo); + InvokeEvent(_onRewardedAdFailedToDisplayEventV2, adUnitIdentifier, errorInfo, adInfo, eventName); } else if (eventName == "OnRewardedAdReceivedRewardEvent") { @@ -1309,40 +1598,45 @@ public class MaxSdkCallbacks : MonoBehaviour Amount = MaxSdkUtils.GetIntFromDictionary(eventProps, "rewardAmount", 0) }; - InvokeEvent(_onRewardedAdReceivedRewardEvent, adUnitIdentifier, reward); - InvokeEvent(_onRewardedAdReceivedRewardEventV2, adUnitIdentifier, reward, adInfo); + InvokeEvent(_onRewardedAdReceivedRewardEvent, adUnitIdentifier, reward, eventName); + InvokeEvent(_onRewardedAdReceivedRewardEventV2, adUnitIdentifier, reward, adInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdLoadedEvent") { - InvokeEvent(_onRewardedInterstitialAdLoadedEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedInterstitialAdLoadedEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdLoadFailedEvent") { var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onRewardedInterstitialAdLoadFailedEvent, adUnitIdentifier, errorInfo); + InvokeEvent(_onRewardedInterstitialAdLoadFailedEvent, adUnitIdentifier, errorInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdDisplayedEvent") { - InvokeEvent(_onRewardedInterstitialAdDisplayedEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedInterstitialAdDisplayedEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdHiddenEvent") { - InvokeEvent(_onRewardedInterstitialAdHiddenEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedInterstitialAdHiddenEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdClickedEvent") { - InvokeEvent(_onRewardedInterstitialAdClickedEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedInterstitialAdClickedEvent, adUnitIdentifier, adInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdRevenuePaidEvent") { - InvokeEvent(_onRewardedInterstitialAdRevenuePaidEvent, adUnitIdentifier, adInfo); + InvokeEvent(_onRewardedInterstitialAdRevenuePaidEvent, adUnitIdentifier, adInfo, eventName); + } + else if (eventName == "OnRewardedInterstitialAdReviewCreativeIdGeneratedEvent") + { + var adReviewCreativeId = MaxSdkUtils.GetStringFromDictionary(eventProps, "adReviewCreativeId", ""); + InvokeEvent(_onRewardedInterstitialAdReviewCreativeIdGeneratedEvent, adUnitIdentifier, adReviewCreativeId, adInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdFailedToDisplayEvent") { var errorInfo = new MaxSdkBase.ErrorInfo(eventProps); - InvokeEvent(_onRewardedInterstitialAdFailedToDisplayEvent, adUnitIdentifier, errorInfo, adInfo); + InvokeEvent(_onRewardedInterstitialAdFailedToDisplayEvent, adUnitIdentifier, errorInfo, adInfo, eventName); } else if (eventName == "OnRewardedInterstitialAdReceivedRewardEvent") { @@ -1352,7 +1646,7 @@ public class MaxSdkCallbacks : MonoBehaviour Amount = MaxSdkUtils.GetIntFromDictionary(eventProps, "rewardAmount", 0) }; - InvokeEvent(_onRewardedInterstitialAdReceivedRewardEvent, adUnitIdentifier, reward, adInfo); + InvokeEvent(_onRewardedInterstitialAdReceivedRewardEvent, adUnitIdentifier, reward, adInfo, eventName); } else { @@ -1364,48 +1658,41 @@ public class MaxSdkCallbacks : MonoBehaviour #if UNITY_EDITOR public static void EmitSdkInitializedEvent() { - if(_onSdkInitializedEvent == null) return; + if (_onSdkInitializedEvent == null) return; - var sdkConfiguration = new MaxSdkBase.SdkConfiguration(); - sdkConfiguration.IsSuccessfullyInitialized = true; - sdkConfiguration.ConsentDialogState = MaxSdkBase.ConsentDialogState.Unknown; - sdkConfiguration.AppTrackingStatus = MaxSdkBase.AppTrackingStatus.Authorized; - var currentRegion = RegionInfo.CurrentRegion; - sdkConfiguration.CountryCode = currentRegion != null ? currentRegion.TwoLetterISORegionName : "US"; - - _onSdkInitializedEvent(sdkConfiguration); + _onSdkInitializedEvent(MaxSdkBase.SdkConfiguration.CreateEmpty()); } #endif - private static void InvokeEvent(Action evt) + private static void InvokeEvent(Action evt, string eventName) { if (!CanInvokeEvent(evt)) return; - MaxSdkLogger.UserDebug("Invoking event: " + evt); + MaxSdkLogger.UserDebug("Invoking event: " + eventName); evt(); } - private static void InvokeEvent(Action evt, T param) + private static void InvokeEvent(Action evt, T param, string eventName) { if (!CanInvokeEvent(evt)) return; - MaxSdkLogger.UserDebug("Invoking event: " + evt + ". Param: " + param); + MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Param: " + param); evt(param); } - private static void InvokeEvent(Action evt, T1 param1, T2 param2) + private static void InvokeEvent(Action evt, T1 param1, T2 param2, string eventName) { if (!CanInvokeEvent(evt)) return; - MaxSdkLogger.UserDebug("Invoking event: " + evt + ". Params: " + param1 + ", " + param2); + MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Params: " + param1 + ", " + param2); evt(param1, param2); } - private static void InvokeEvent(Action evt, T1 param1, T2 param2, T3 param3) + private static void InvokeEvent(Action evt, T1 param1, T2 param2, T3 param3, string eventName) { if (!CanInvokeEvent(evt)) return; - MaxSdkLogger.UserDebug("Invoking event: " + evt + ". Params: " + param1 + ", " + param2 + ", " + param3); + MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Params: " + param1 + ", " + param2 + ", " + param3); evt(param1, param2, param3); } @@ -1431,4 +1718,104 @@ public class MaxSdkCallbacks : MonoBehaviour { MaxSdkLogger.D("Listener has been removed from callback: " + eventName); } + +#if UNITY_EDITOR && UNITY_2019_2_OR_NEWER + /// + /// Resets static event handlers so they still get reset even if Domain Reloading is disabled + /// + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] + private static void ResetOnDomainReload() + { + _onSdkInitializedEvent = null; + _onVariablesUpdatedEvent = null; + _onSdkConsentDialogDismissedEvent = null; + + _onInterstitialAdLoadedEventV2 = null; + _onInterstitialAdLoadFailedEventV2 = null; + _onInterstitialAdDisplayedEventV2 = null; + _onInterstitialAdFailedToDisplayEventV2 = null; + _onInterstitialAdClickedEventV2 = null; + _onInterstitialAdRevenuePaidEvent = null; + _onInterstitialAdReviewCreativeIdGeneratedEvent = null; + _onInterstitialAdHiddenEventV2 = null; + + _onAppOpenAdLoadedEvent = null; + _onAppOpenAdLoadFailedEvent = null; + _onAppOpenAdDisplayedEvent = null; + _onAppOpenAdFailedToDisplayEvent = null; + _onAppOpenAdClickedEvent = null; + _onAppOpenAdRevenuePaidEvent = null; + _onAppOpenAdHiddenEvent = null; + + _onRewardedAdLoadedEventV2 = null; + _onRewardedAdLoadFailedEventV2 = null; + _onRewardedAdDisplayedEventV2 = null; + _onRewardedAdFailedToDisplayEventV2 = null; + _onRewardedAdClickedEventV2 = null; + _onRewardedAdRevenuePaidEvent = null; + _onRewardedAdReviewCreativeIdGeneratedEvent = null; + _onRewardedAdReceivedRewardEventV2 = null; + _onRewardedAdHiddenEventV2 = null; + + _onRewardedInterstitialAdLoadedEvent = null; + _onRewardedInterstitialAdLoadFailedEvent = null; + _onRewardedInterstitialAdDisplayedEvent = null; + _onRewardedInterstitialAdFailedToDisplayEvent = null; + _onRewardedInterstitialAdClickedEvent = null; + _onRewardedInterstitialAdRevenuePaidEvent = null; + _onRewardedInterstitialAdReviewCreativeIdGeneratedEvent = null; + _onRewardedInterstitialAdReceivedRewardEvent = null; + _onRewardedInterstitialAdHiddenEvent = null; + + _onBannerAdLoadedEventV2 = null; + _onBannerAdLoadFailedEventV2 = null; + _onBannerAdClickedEventV2 = null; + _onBannerAdRevenuePaidEvent = null; + _onBannerAdReviewCreativeIdGeneratedEvent = null; + _onBannerAdExpandedEventV2 = null; + _onBannerAdCollapsedEventV2 = null; + + _onMRecAdLoadedEventV2 = null; + _onMRecAdLoadFailedEventV2 = null; + _onMRecAdClickedEventV2 = null; + _onMRecAdRevenuePaidEvent = null; + _onMRecAdReviewCreativeIdGeneratedEvent = null; + _onMRecAdExpandedEventV2 = null; + _onMRecAdCollapsedEventV2 = null; + + _onCrossPromoAdLoadedEvent = null; + _onCrossPromoAdLoadFailedEvent = null; + _onCrossPromoAdClickedEvent = null; + _onCrossPromoAdRevenuePaidEvent = null; + _onCrossPromoAdExpandedEvent = null; + _onCrossPromoAdCollapsedEvent = null; + + _onBannerAdLoadedEvent = null; + _onBannerAdLoadFailedEvent = null; + _onBannerAdClickedEvent = null; + _onBannerAdExpandedEvent = null; + _onBannerAdCollapsedEvent = null; + + _onMRecAdLoadedEvent = null; + _onMRecAdLoadFailedEvent = null; + _onMRecAdClickedEvent = null; + _onMRecAdExpandedEvent = null; + _onMRecAdCollapsedEvent = null; + + _onInterstitialAdLoadedEvent = null; + _onInterstitialLoadFailedEvent = null; + _onInterstitialAdDisplayedEvent = null; + _onInterstitialAdFailedToDisplayEvent = null; + _onInterstitialAdClickedEvent = null; + _onInterstitialAdHiddenEvent = null; + + _onRewardedAdLoadedEvent = null; + _onRewardedAdLoadFailedEvent = null; + _onRewardedAdDisplayedEvent = null; + _onRewardedAdFailedToDisplayEvent = null; + _onRewardedAdClickedEvent = null; + _onRewardedAdReceivedRewardEvent = null; + _onRewardedAdHiddenEvent = null; + } +#endif } diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta index 8a8aa155a..dd08049e3 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta @@ -3,7 +3,6 @@ guid: 4dc129a60049645f7a492a0a658a6c22 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkCallbacks.cs -- al_max_export_path-MaxSdk\Scripts\MaxSdkCallbacks.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkLogger.cs.meta b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkLogger.cs.meta index 07dffce3f..01a3427c7 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkLogger.cs.meta +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkLogger.cs.meta @@ -3,7 +3,6 @@ guid: ff2b160afdfd4a74b731954323772a90 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkLogger.cs -- al_max_export_path-MaxSdk\Scripts\MaxSdkLogger.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkUnityEditor.cs b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkUnityEditor.cs index f6bfac006..87685f1a9 100644 --- a/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkUnityEditor.cs +++ b/Assets/ThirdParty/MaxSdk/Scripts/MaxSdkUnityEditor.cs @@ -42,9 +42,11 @@ public class MaxSdkUnityEditor : MaxSdkBase get { return MaxUserServiceUnityEditor.Instance; } } - static MaxSdkUnityEditor() + [RuntimeInitializeOnLoadMethod] + public static void InitializeMaxSdkUnityEditorOnLoad() { - InitCallbacks(); + // Unity destroys the stub banners each time the editor exits play mode, but the StubBanners stays in memory if Enter Play Mode settings is enabled. + StubBanners.Clear(); } /// @@ -166,6 +168,24 @@ public class MaxSdkUnityEditor : MaxSdkBase } } + /// + /// Present the mediation debugger UI. + /// + /// Please call this method after the SDK has initialized. + /// + public static void ShowCreativeDebugger() + { + if (!_isInitialized) + { + MaxSdkLogger.UserWarning("The creative debugger cannot be shown before the MAX SDK has been initialized." + + "\nCall 'MaxSdk.InitializeSdk();' and listen for 'MaxSdkCallbacks.OnSdkInitializedEvent' before showing the mediation debugger."); + } + else + { + MaxSdkLogger.UserWarning("The creative debugger cannot be shown in the Unity Editor. Please export the project to Android or iOS first."); + } + } + /// /// Returns the arbitrary ad value for a given ad unit identifier with key. Returns null if no ad is loaded. /// @@ -188,21 +208,13 @@ public class MaxSdkUnityEditor : MaxSdkBase /// public static SdkConfiguration GetSdkConfiguration() { - var sdkConfiguration = new SdkConfiguration(); - sdkConfiguration.IsSuccessfullyInitialized = _isInitialized; - sdkConfiguration.ConsentDialogState = ConsentDialogState.Unknown; -#if UNITY_EDITOR - sdkConfiguration.AppTrackingStatus = AppTrackingStatus.Authorized; -#endif - sdkConfiguration.CountryCode = RegionInfo.CurrentRegion.TwoLetterISORegionName; - - return sdkConfiguration; + return SdkConfiguration.CreateEmpty(); } /// /// Set whether or not user has provided consent for information sharing with AppLovin and other providers. /// - /// true if the user has provided consent for information sharing with AppLovin. false by default. + /// true if the user has provided consent for information sharing with AppLovin. false by default. public static void SetHasUserConsent(bool hasUserConsent) { _hasUserConsent = hasUserConsent; @@ -212,7 +224,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Check if user has provided consent for information sharing with AppLovin and other providers. /// - /// true if user has provided consent for information sharing. false if the user declined to share information or the consent value has not been set . + /// true if user has provided consent for information sharing. false if the user declined to share information or the consent value has not been set . public static bool HasUserConsent() { return _hasUserConsent; @@ -221,7 +233,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Check if user has set consent for information sharing. /// - /// true if user has set a value of consent for information sharing. + /// true if user has set a value of consent for information sharing. public static bool IsUserConsentSet() { return _isUserConsentSet; @@ -230,7 +242,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Mark user as age restricted (i.e. under 16). /// - /// true if the user is age restricted (i.e. under 16). + /// true if the user is age restricted (i.e. under 16). public static void SetIsAgeRestrictedUser(bool isAgeRestrictedUser) { _isAgeRestrictedUser = isAgeRestrictedUser; @@ -240,7 +252,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Check if user is age restricted. /// - /// true if the user is age-restricted. false if the user is not age-restricted or the age-restriction has not been set. + /// true if the user is age-restricted. false if the user is not age-restricted or the age-restriction has not been set. public static bool IsAgeRestrictedUser() { return _isAgeRestrictedUser; @@ -249,7 +261,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Check if user set its age restricted settings. /// - /// true if user has set its age restricted settings. + /// true if user has set its age restricted settings. public static bool IsAgeRestrictedUserSet() { return _isAgeRestrictedUserSet; @@ -258,7 +270,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Set whether or not user has opted out of the sale of their personal information. /// - /// true if the user has opted out of the sale of their personal information. + /// true if the user has opted out of the sale of their personal information. public static void SetDoNotSell(bool doNotSell) { _doNotSell = doNotSell; @@ -268,7 +280,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Check if the user has opted out of the sale of their personal information. /// - /// true if the user has opted out of the sale of their personal information. false if the user opted in to the sell of their personal information or the value has not been set . + /// true if the user has opted out of the sale of their personal information. false if the user opted in to the sell of their personal information or the value has not been set . public static bool IsDoNotSell() { return _doNotSell; @@ -277,7 +289,7 @@ public class MaxSdkUnityEditor : MaxSdkBase /// /// Check if the user has set the option to sell their personal information. /// - /// true if user has chosen an option to sell their personal information. + /// true if user has chosen an option to sell their personal information. public static bool IsDoNotSellSet() { return _isDoNotSellSet; @@ -338,6 +350,23 @@ public class MaxSdkUnityEditor : MaxSdkBase #endif } + /// + /// Load a new banner ad. + /// NOTE: The method loads the first banner ad and initiates an automated banner refresh process. + /// You only need to call this method if you pause banner refresh. + /// + /// Ad unit identifier of the banner to load + public static void LoadBanner(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "load banner"); + + ExecuteWithDelay(1f, () => + { + var eventProps = Json.Serialize(CreateBaseEventPropsDictionary("OnBannerAdLoadedEvent", adUnitIdentifier)); + MaxSdkCallbacks.Instance.ForwardEvent(eventProps); + }); + } + /// /// Set the banner placement for an ad unit identifier to tie the future ad events to. /// @@ -546,6 +575,23 @@ public class MaxSdkUnityEditor : MaxSdkBase RequestAdUnit(adUnitIdentifier); } + /// + /// Load a new MREC ad. + /// NOTE: The method loads the first MREC ad and initiates an automated MREC refresh process. + /// You only need to call this method if you pause MREC refresh. + /// + /// Ad unit identifier of the MREC to load + public static void LoadMRec(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "load MREC"); + + ExecuteWithDelay(1f, () => + { + var eventProps = Json.Serialize(CreateBaseEventPropsDictionary("OnMRecAdLoadedEvent", adUnitIdentifier)); + MaxSdkCallbacks.Instance.ForwardEvent(eventProps); + }); + } + /// /// Set the MREC placement for an ad unit identifier to tie the future ad events to. /// @@ -886,6 +932,123 @@ public class MaxSdkUnityEditor : MaxSdkBase #endregion + #region App Open Ads + + /// + /// Start loading an app open ad. + /// + /// Ad unit identifier of the app open ad to load + public static void LoadAppOpenAd(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "load app open ad"); + RequestAdUnit(adUnitIdentifier); + + ExecuteWithDelay(1f, () => + { + AddReadyAdUnit(adUnitIdentifier); + + var eventProps = Json.Serialize(CreateBaseEventPropsDictionary("OnAppOpenAdLoadedEvent", adUnitIdentifier)); + MaxSdkCallbacks.Instance.ForwardEvent(eventProps); + }); + } + + /// + /// Check if app open ad ad is loaded and ready to be displayed. + /// + /// Ad unit identifier of the app open ad to load + /// True if the ad is ready to be displayed + public static bool IsAppOpenAdReady(string adUnitIdentifier) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "check app open ad loaded"); + + if (!IsAdUnitRequested(adUnitIdentifier)) + { + MaxSdkLogger.UserWarning("App Open Ad '" + adUnitIdentifier + + "' was not requested, can not check if it is loaded"); + return false; + } + + return IsAdUnitReady(adUnitIdentifier); + } + + /// + /// Present loaded app open ad for a given placement to tie ad events to. Note: if the app open ad is not ready to be displayed nothing will happen. + /// + /// Ad unit identifier of the app open ad to load + /// The placement to tie the showing ad's events to + /// The custom data to tie the showing ad's events to. Maximum size is 8KB. + public static void ShowAppOpenAd(string adUnitIdentifier, string placement = null, string customData = null) + { + ValidateAdUnitIdentifier(adUnitIdentifier, "show app open ad"); + + if (!IsAdUnitRequested(adUnitIdentifier)) + { + MaxSdkLogger.UserWarning( + "App Open Ad '" + adUnitIdentifier + "' was not requested, can not show it"); + return; + } + + if (!IsAppOpenAdReady(adUnitIdentifier)) + { + MaxSdkLogger.UserWarning("App Open Ad '" + adUnitIdentifier + "' is not ready, please check IsAppOpenAdReady() before showing."); + return; + } + + RemoveReadyAdUnit(adUnitIdentifier); + + if (_showStubAds) + { + ShowStubAppOpenAd(adUnitIdentifier); + } + } + + private static void ShowStubAppOpenAd(string adUnitIdentifier) + { +#if UNITY_EDITOR + var prefabPath = MaxSdkUtils.GetAssetPathForExportPath("MaxSdk/Prefabs/Interstitial.prefab"); + var appOpenAdPrefab = AssetDatabase.LoadAssetAtPath(prefabPath); + var stubAppOpenAd = Object.Instantiate(appOpenAdPrefab, Vector3.zero, Quaternion.identity); + var appOpenAdText = GameObject.Find("MaxInterstitialTitle").GetComponent(); + var closeButton = GameObject.Find("MaxInterstitialCloseButton").GetComponent