diff --git a/popcorn/Assets/ExternalDependencyManager.meta b/popcorn/Assets/ExternalDependencyManager.meta new file mode 100644 index 00000000..2bef3d81 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a541636fe019e4287bbde9fc5406301a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor.meta b/popcorn/Assets/ExternalDependencyManager/Editor.meta new file mode 100644 index 00000000..4eafa420 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 949bf3efe84914b718a63835d0f934f3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/CHANGELOG.md b/popcorn/Assets/ExternalDependencyManager/Editor/CHANGELOG.md new file mode 100644 index 00000000..93580bfc --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/CHANGELOG.md @@ -0,0 +1,1301 @@ +# Version 1.2.164 - Feb 4, 2021 +## New Features +* Android Resolver - Added support for Android packages with classifier in their + namespaces. +* iOS Resolver - Added new settings in iOS Resolver to configure generated + Podfile. +* iOS Resolver - Added a new attribute `addToAllTargets` in Dependencies.xml. + +## Bug Fixes +* iOS Resolver - Fixed XML parsing for `bitcodeEnabled` attribute in + Dependencies.xml. + +# Version 1.2.163 - Dec 15, 2020 +## Bug Fixes +* Version Handler - Fixed measurement reporting + +# Version 1.2.162 - Nov 19, 2020 +## Bug Fixes +* Version Handler - Improved #413 by preventing Version Handler from running + from static constructor when it is disabled. +* Package Manager Resolver - Remove GPR + +# Version 1.2.161 - Oct 12, 2020 +## Bug Fixes +* Android Resolver - Fixed the issue that Android Resolver does not resolve + again before build in Unity 2020 if it failed to resolve previously. + +# Version 1.2.160 - Sep 30, 2020 +## Bug Fixes +* Android Resolver - Fixed a regression that gradleResolver can be null until + Initialize() is called. +* Android Resolver - Fixed a regression that Android Resolver failed in Unity + 2019.3+ due to `gradleTemplate.properties` not enabled when + `mainTemplate.gradle` is not enabled at all. + +# Version 1.2.159 - Sep 11, 2020 +## Bug Fixes +* Android Resolver - Fixed #322 where the Unity editor will lose its target SDK + setting between Unity restarts if `>28` is selected in 2019. This is due to + Unity AndroidSdkVersions enum does not contain values above 28. +* Android Resolver - Fixed #360 where building Android app with Untiy 2019.3+ + may fail due to Jetifier and AndroidX not enabled properly in generated + Gradle project. This fix requires the user to enable + `Custom Gradle Properties Template` found under + `Player Settings > Settings for Android > Publishing Settings`. + +# Version 1.2.158 - Sep 3, 2020 +## Bug Fixes +* Version Handler: Fixed editor freeze when `-executeMethod` is used in + non-batch mode. +* Android Resolver: Normalized file paths when generating local Maven repo + since the path may contains a mix of forward and backward slash on Windows. +* Export Unity Package: Fixed generation of .unitypackage with tarfile on + Windows. + +# Version 1.2.157 - Aug 6, 2020 +## Bug Fixes +* Android Resolver: Delay initialization until active build target is Android + and the editor is not in play mode. +* iOS Resolver: Delay initialization until active build target is iOS + and the editor is not in play mode. +* Export Unity Package: Workaround directory creation racy if multiple export + operations are spawned at the same time. + +# Version 1.2.156 - June 10, 2020 +## Bug Fixes +* Android Resolver: Fixed that the generated local repo assets contains + redundent labels which are causing Version Handler to failed while + uninstalling packages. +* Android Resolver: Fixed that the repo url injected into mainTemplate.gradle + is incorrect when Unity is configured to export gradle project. +* Android Resolver: Limited to only create local Maven repo when the source + repo contains ".srcaar" file. + +## Changes +* All: Described EDM4U analytics data usage in readme. + +# Version 1.2.155 - May 14, 2020 +## Bug Fixes +* All: Fixed compiler error when build with Unity 5.4 or below due to the + usage of Rect.zero. +* All: Ignore cases when checking command line arguments. + +# Version 1.2.154 - May 14, 2020 +## Bug Fixes +* All: Make each MultiSelectWindow for different purposes to have its own + unique window. + +## Changes +* All: Replace all dialog with DialogWindow which is implemented from + EditorWindow. +* Package Manager Resolver: Clarify how manifest.json will be changed in Package + Manager Resolver window. + +# Version 1.2.153 - Apr 24, 2020 +## Bug Fixes +* Android Resolver: Fixed an exception when repainting the Android resolution + window in Unity 2019.3.x. + +# Version 1.2.152 - Apr 17, 2020 +## Bug Fixes +* Version Handler: Fixed exception when waiting for enabled editor DLLs to + load. +* Android Resolver: Fixed regression when using a Custom Gradle Template + on Windows. + +# Version 1.2.151 - Apr 16, 2020 +## Bug Fixes +* Version Handler: When waiting for newly enabled editor DLLs to load, ignore + all DLLs that do not have a file-system location. +* Android Resolver: Fixed resolution when using a Custom Gradle Template with + libraries stored in a local maven repository distributed with a plugin + installed with the Unity Package Manager. + +# Version 1.2.150 - Apr 9, 2020 +## Bug Fixes +* All: The new packaging script when run on MacOS was generating a + .unitypackage archive that could not be read by Unity on Windows. + This release simply repackages the plugin with tar/gzip to fix the problem. + +# Version 1.2.149 - Apr 8, 2020 +## Bug Fixes +* Package Manager Resolver: Fixed spurious error message when resuming + migration after installing a UPM package. + +# Version 1.2.148 - Apr 8, 2020 +## Bug Fixes +* Package Manager Resolver: Fixed an exception when resuming migration + after installing a UPM package. + +# Version 1.2.147 - Apr 8, 2020 +## Bug Fixes +* Version Handler: Fixed alias traversal bug which caused problems when + migrating from installed .unitypackage files to UPM packages. + +# Version 1.2.146 - Apr 8, 2020 +## Bug Fixes +* Version Handler: Fixed exception in manifest parsing when a manifest is + detected with no aliases. + +# Version 1.2.145 - Apr 2, 2020 +## New Features +* Package Manager Resolver: Added a method to migrate Version Handler + managed packages installed via `.unitypackage` to Unity Package Manager + packages. This is initially used to migrate the External Dependency Manager + to UPM. + +## Changes +* All: Verbose logging is now no longer automatically enabled in batch mode + across all components. Instead logging can be configured using each + component's verbose logging setting or by using the `-gvh_log_debug` command + line flag when starting Unity. +* Version Handler: Sped up version handler updates when the app domain isn't + reloaded. + +## Bug Fixes +* Version Handler: Fixed the display of the obsolete files clean up dialog + when the asset database refreshes. +* Version Handler: Improved reliability of callback from + the VersionHandler.UpdateCompleteMethods event when an asset database + refresh occurs. +* Version Handler: Fixed duplicate exportPath labels when 'Assets/' is the + root of paths assigned to files. +* Version Handler: Handle empty lines in manifest files. + +# Version 1.2.144 - Mar 23, 2020 +## Changed +* iOS Resolver: Removed the ability to configure the Xcode target a Cocoapod + is added to. + +## Bug Fixes +* iOS Resolver: Reverted support for adding Cocoapods to multiple targets as + it caused a regression (exception thrown during post-build step) in some + versions of Unity. + +# Version 1.2.143 - Mar 20, 2020 +## Bug Fixes +* Android Resolver: Fixed caching of resolution state which was causing + the resolver to always run when no dependencies had changed. + +# Version 1.2.142 - Mar 19, 2020 +## Changes +* Package Manager Resolver: Enabled auto-add by default. + +# Version 1.2.141 - Mar 19, 2020 +## Bug Fixes +* Fixed a bug when retrieving project settings. If a plugin was configured + to fetch project settings, if a setting was fetched (e.g "foo") and this + setting existed in the system settings but not the project settings the + system value would override the default value leading to unexpected + behavior. +* Fixed a warning when caching web request classes in Unity 5.6. + +# Version 1.2.140 - Mar 19, 2020 +## Bug Fixes +* Fixed measurement reporting in Unity 5.x. +* Version Handler: Fixed NullReferenceException when an asset doesn't have + an AssetImporter. + +# Version 1.2.139 - Mar 18, 2020 +## Changed +* Added documentation to the built plugin. + +# Version 1.2.138 - Mar 17, 2020 +## New Features +* Package Manager Resolver: Added the Package Manager Resolver + component that allows developers to easily boostrap Unity Package Manager + (UPM) registry addition using unitypackage plugins. +* Version Handler: Added a window that allows plugins to managed by the + Version Handler to be uninstalled. +* Version Handler: Added support for displaying installed plugins. +* Version Handler: Added support for moving files in plugins to their install + locations (if the plugin has been configured to support this). +* iOS Resolver: Added the ability to configure the Xcode target a Cocoapod is + added to. + +## Bug Fixes +* Fixed upgrade from version 1.2.137 and below after the plugin rename to + EDM4U broke the upgrade process. +* Android Resolver: Worked around PlayerSettings.Android.targetSdkVersion + returning empty names for some values in 2019.x. +* Version Handler: Fixed the display of the obsolete files clean up window. +* Version Handler: Fixed managed file check when assets are modified in the + project after plugin import. + +# Version 1.2.137 - Mar 6, 2020 +## Changed +* Renamed package to External Package Manager for Unity (EDM4U). + We changed this to reflect what this plugin is doing today which is far more + than the original scope which just consisted of importing jar files from the + Android SDK maven repository. + Scripts that used to pull `play-services-resolver*.unitypackage` will now have + to request `external-dependency-manager*.unitypackage` instead. + We'll still be shipping a `play-services-resolver*_manifest.txt` file to + handle upgrading from older versions of the plugin. + +## New Features +* All Components: Added reporting of usage so that we can remotely detect + errors and target improvements. +* Android Resolver: Added support for *Dependencies.xml files in Unity Package + Manager packages. +* iOS Resolver: Added support for *Dependencies.xml files in Unity Package + Manager packages. + +## Bug Fixes +* Version Handler: Disabled attempts to disable asset metadata modification + when assets are in a Unity Package Manager managed package. + +# Version 1.2.136 - Feb 19, 2019 +## Bug Fixes +* Android Resolver: Fixed OpenJDK path discovery in Unity 2019.3.1. + +# Version 1.2.135 - Dec 5, 2019 +## Bug Fixes +* All Components: Fixed stack overflow when loading project settings. + +# Version 1.2.134 - Dec 4, 2019 +## Bug Fixes +* All Components: Fixed an issue which caused project settings to be cleared + when running in batch mode. + +# Version 1.2.133 - Nov 18, 2019 +## Bug Fixes +* All Components: Failure to save project settings will now report an error + to the log rather than throwing an exception. + +# Version 1.2.132 - Nov 11, 2019 +## Bug Fixes +* Android Resolver: Worked around expansion of DIR_UNITYPROJECT on Windows + breaking Gradle builds when used as part of a file URI. +* Android Resolver: mainTemplate.gradle is only written if it needs to be + modified. + +# Version 1.2.131 - Oct 29, 2019 +## Bug Fixes +* Version Handler: Improved execution of events on the main thread in batch + mode. +* Version Handler: Improved log level configuration at startup. +* Version Handler: Improved performance of class lookup in deferred method + calls. +* Version Handler: Fixed rename to enable / disable for editor assets. +* iOS Resolver: Improved log level configuration at startup. +* Android Resolver: Improved local maven repo path reference in + mainTemplate.gradle using DIR_UNITYPROJECT. DIR_UNITYPROJECT by Unity + to point to the local filesystem path of the Unity project when Unity + generates the Gradle project. + +# Version 1.2.130 - Oct 23, 2019 +## New Features +* iOS Resolver: Added support for modifying the Podfile before `pod install` + is executed. + +## Bug Fixes +* Version Handler: Fixed invalid classname error when calling + `VersionHandler.UpdateVersionedAssets()`. + +# Version 1.2.129 - Oct 2, 2019 +## Bug Fixes +* iOS Resolver: Changed Cocoapod integration in Unity 2019.3+ to + only add Pods to the UnityFramework target. + +# Version 1.2.128 - Oct 1, 2019 +## Bug Fixes +* iOS Resolver: Fixed Cocoapod project integration mode with Unity + 2019.3+. + +# Version 1.2.127 - Sep 30, 2019 +## Changes +* Android Resolver: All Android Resolver settings File paths are now + serialized with POSIX directory separators. + +# Version 1.2.126 - Sep 27, 2019 +## Changes +* Android Resolver: File paths are now serialized with POSIX directory + separators. +## Bug Fixes +* Android Resolver: Fixed resolution when the parent directory of a Unity + project contains a Gradle project (i.e `settings.gradle` file). + +# Version 1.2.125 - Sep 23, 2019 +## Bug Fixes +* All components: Silenced a warning about not being able to set the console + encoding to UTF8. +* Android Resolver: Worked around broken AndroidSDKTools class in some + versions of Unity. +* iOS Resolver: Fixed iOS target SDK version check +* Version Handler: Changed clean up obsolete files window so that it doesn't + exceed the screen size. + +# Version 1.2.124 - Jul 28, 2019 +## Bug Fixes +* All components: Fixed regression with source control integration when using + Unity 2019.1+. + +# Version 1.2.123 - Jul 23, 2019 +## New Features +* All components: Source control integration for project settings. +## Changes +* Android Resolver: Removed AAR cache as it now makes little difference to + incremental resolution performance. +* Android Resolver: Improved embedded resource management so that embedded + resources should upgrade when the plugin is updated without restarting + the Unity editor. +## Bug Fixes +* Version Handler: Fixed InvokeMethod() and InvokeStaticMethod() when calling + methods that have interface typed arguments. + +# Version 1.2.122 - Jul 2, 2019 +## Bug Fixes +* iOS Resolver: Worked around Unity not loading the iOS Resolver DLL as it + referenced the Xcode extension in a public interface. The iOS Resolver + DLL still references the Xcode extension internally and just handles + missing type exceptions dynamically. + +# Version 1.2.121 - Jun 27, 2019 +## Bug Fixes +* Android Resolver: Fixed warning about missing Packages folder when loading + XML dependencies files in versions of Unity without the package manager. +* Android Resolver: Fixed resolution window progress bar exceeding 100%. +* Android Resolver: If AndroidX is detected in the set of resolved libraries, + the user will be prompted to enable the Jetifier. +* Android Resolver: Improved text splitting in text area windows. +* iOS Resolver: Added support for Unity's breaking changes to the Xcode API + in 2019.3.+. Cocoapods are now added to build targets, Unity-iPhone and + UnityFramework in Unity 2019.3+. + +# Version 1.2.120 - Jun 26, 2019 +## New Features +* Android Resolver: Added support for loading *Dependencies.xml files from + Unity Package Manager packages. +* Android Resolver: Resolution window is now closed if resolution runs as + a pre-build step. +* iOS Resolver: Added support for loading *Dependencies.xml files from + Unity Package Manager packages. +## Bug Fixes +* Android Resolver: Fixed generation of relative repo paths when using + mainTemplate.gradle resolver. +* Android Resolver: Fixed copy of .srcaar to .aar files in repos embedded in a + project when a project path has characters (e.g whitespace) that are escaped + during conversion to URIs. +* Android Resolver: Fixed auto-resolution always running if the Android SDK + is managed by Unity Hub. + +# Version 1.2.119 - Jun 19, 2019 +## Bug Fixes +* Android Resolver: Fixed error reported when using Jetifier integration + in Unity 2018+ if the target SDK is set to "highest installed". + +# Version 1.2.118 - Jun 18, 2019 +## New Features +* Android Resolver: Added initial + [Jetifier](https://developer.android.com/studio/command-line/jetifier) + integration which simplifies + [migration](ttps://developer.android.com/jetpack/androidx/migrate) + to Jetpack ([AndroidX](https://developer.android.com/jetpack/androidx)) + libraries in cases where all dependencies are managed by the Android + Resolver. + This can be enabled via the `Use Jetifier` option in the + `Assets > Play Services Resolver > Android Resolver > Settings` menu. + Caveats: + - If your project contains legacy Android Support Library .jar and .aar + files, these files will need to be removed and replaced with references to + artifacts on Maven via `*Dependencies.xml` files so that the Jetifier + can map them to Jetpack (AndroidX) libraries. + For example, remove the file `support-v4-27.0.2.jar` and replace it with + `` in a + `*Dependencies.xml` file. + - If your project contains .jar or .aar files that use the legacy Android + Support Libraries, these will need to be moved into a local Maven repo + [See this guide](https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html) + and then these files should be removed from your Unity project and instead + referenced via `*Dependencies.xml` files so that the Jetifier can + patch them to reference the Jetpack lirbaries. + +## Bug Fixes +* Android Resolver: Disabled version locking of com.android.support:multidex + does not use the same versioning scheme as other legacy Android support + libraries. +* Version Handler: Made Google.VersionHandler.dll's asset GUID stable across + releases. This faciliates error-free import into projects where + Google.VersionHandler.dll is moved from the default install location. + +# Version 1.2.117 - Jun 12, 2019 +## Bug Fixes +* Android Resolver: Fix copying of .srcaar to .aar files for + mainTemplate.gradle resolution. PluginImporter configuration was previously + not being applied to .aar files unless the Unity project was saved. + +# Version 1.2.116 - Jun 7, 2019 +## Bug Fixes +* Android Resolver: Fixed resolution of Android dependencies without version + specifiers. +* Android Resolver: Fixed Maven repo not found warning in Android Resolver. +* Android Resolver: Fixed Android Player directory not found exception in + Unity 2019.x when the Android Player isn't installed. + +# Version 1.2.115 - May 28, 2019 +## Bug Fixes +* Android Resolver: Fixed exception due to Unity 2019.3.0a4 removing + x86 from the set of supported ABIs. + +# Version 1.2.114 - May 27, 2019 +## New Features +* Android Resolver: Added support for ABI stripping when using + mainTemplate.gradle. This only works with AARs stored in repos + on the local filesystem. + +# Version 1.2.113 - May 24, 2019 +## New Features +* Android Resolver: If local repos are moved, the plugin will search the + project for matching directories in an attempt to correct the error. +* Version Handler: Files can be now targeted to multiple build targets + using multiple "gvh_" asset labels. +## Bug Fixes +* Android Resolver: "implementation" or "compile" are now added correctly + to mainTemplate.gradle in Unity versions prior to 2019. + +# Version 1.2.112 - May 22, 2019 +## New Features +* Android Resolver: Added option to disable addition of dependencies to + mainTemplate.gradle. + See `Assets > Play Services Resolver > Android Resolver > Settings`. +* Android Resolver: Made paths to local maven repositories in + mainTemplate.gradle relative to the Unity project when a project is not + being exported. +## Bug Fixes +* Android Resolver: Fixed builds with mainTemplate.gradle integration in + Unity 2019. +* Android Resolver: Changed dependency inclusion in mainTemplate.gradle to + use "implementation" or "compile" depending upon the version of Gradle + included with Unity. +* Android Resolver: Gracefully handled exceptions if the console encoding + can't be modified. +* Android Resolver: Now gracefully fails if the AndroidPlayer directory + can't be found. + +# Version 1.2.111 - May 9, 2019 +## Bug Fixes +* Version Handler: Fixed invocation of methods with named arguments. +* Version Handler: Fixed occasional hang when the editor is compiling + while activating plugins. + +# Version 1.2.110 - May 7, 2019 +## Bug Fixes +* Android Resolver: Fixed inclusion of some srcaar artifacts in builds with + Gradle builds when using mainTemplate.gradle. + +# Version 1.2.109 - May 6, 2019 +## New Features: +* Added links to documentation from menu. +* Android Resolver: Added option to auto-resolve Android libraries on build. +* Android Resolver: Added support for packaging specs of Android libraries. +* Android Resolver: Pop up a window when displaying Android dependencies. + +## Bug Fixes +* Android Resolver: Support for Unity 2019 Android SDK and JDK install locations +* Android Resolver: e-enable AAR explosion if internal builds are enabled. +* Android Resolver: Gracefully handle exceptions on file deletion. +* Android Resolver: Fixed Android Resolver log spam on load. +* Android Resolver: Fixed save of Android Resolver PromptBeforeAutoResolution + setting. +* Android Resolver: Fixed AAR processing failure when an AAR without + classes.jar is found. +* Android Resolver: Removed use of EditorUtility.DisplayProgressBar which + was occasionally left displayed when resolution had completed. +* Version Handler: Fixed asset rename to disable when a disabled file exists. + +# Version 1.2.108 - May 3, 2019 +## Bug Fixes: +* Version Handler: Fixed occasional hang on startup. + +# Version 1.2.107 - May 3, 2019 +## New Features: +* Version Handler: Added support for enabling / disabling assets that do not + support the PluginImporter, based upon build target selection. +* Android Resolver: Added support for the global specification of maven repos. +* iOS Resolver: Added support for the global specification of Cocoapod sources. + +# Version 1.2.106 - May 1, 2019 +## New Features +* iOS Resolver: Added support for development pods in Xcode project integration + mode. +* iOS Resolver: Added support for source pods with resources in Xcode project + integration mode. + +# Version 1.2.105 - Apr 30, 2019 +## Bug fixes +* Android Resolver: Fixed reference to Java tool path in logs. +* Android and iOS Resolvers: Changed command line execution to emit a warning + rather than throwing an exception and failing, when it is not possible to + change the console input and output encoding to UTF-8. +* Android Resolver: Added menu option and API to delete resolved libraries. +* Android Resolver: Added menu option and API to log the repos and libraries + currently included in the project. +* Android Resolver: If Plugins/Android/mainTemplate.gradle file is present and + Gradle is selected as the build type, resolution will simply patch the file + with Android dependencies specified by plugins in the project. + +# Version 1.2.104 - Apr 10, 2019 +## Bug Fixes +* Android Resolver: Changed Android ABI selection method from using whitelisted + Unity versions to type availability. This fixes an exception on resolution + in some versions of Unity 2017.4. + +# Version 1.2.103 - Apr 2, 2019 +## Bug Fixes +* Android Resolver: Whitelisted Unity 2017.4 and above with ARM64 support. +* Android Resolver: Fixed Java version check to work with Java SE 12 and above. + +# Version 1.2.102 - Feb 13, 2019 +## Bug Fixes +* Android Resolver: Fixed the text overflow on the Android Resolver + prompt before initial run to fit inside the buttons for + smaller screens. + +# Version 1.2.101 - Feb 12, 2019 +## New Features +* Android Resolver: Prompt the user before the resolver runs for the + first time and allow the user to elect to disable from the prompt. +* Android Resolver: Change popup warning when resolver is disabled + to be a console warning. + +# Version 1.2.100 - Jan 25, 2019 +## Bug Fixes +* Android Resolver: Fixed AAR processing sometimes failing on Windows + due to file permissions. + +# Version 1.2.99 - Jan 23, 2019 +## Bug Fixes +* Android Resolver: Improved performance of project property polling. +* Version Handler: Fixed callback of VersionHandler.UpdateCompleteMethods + when the update process is complete. + +# Version 1.2.98 - Jan 9, 2019 +## New Features +* iOS Resolver: Pod declaration properties can now be set via XML pod + references. For example, this can enable pods for a subset of build + configurations. +## Bug Fixes +* iOS Resolver: Fixed incremental builds after local pods support caused + regression in 1.2.96. + +# Version 1.2.97 - Dec 17, 2018 +## Bug Fixes +* Android Resolver: Reduced memory allocation for logic that monitors build + settings when auto-resolution is enabled. If auto-resolution is disabled, + almost all build settings are no longer polled for changes. + +# Version 1.2.96 - Dec 17, 2018 +## Bug Fixes +* Android Resolver: Fixed repacking of AARs to exclude .meta files. +* Android Resolver: Only perform auto-resolution on the first scene while + building. +* Android Resolver: Fixed parsing of version ranges that include whitespace. +* iOS Resolver: Added support for local development pods. +* Version Handler: Fixed Version Handler failing to rename some files. + +# Version 1.2.95 - Oct 23, 2018 +## Bug Fixes: +* Android Resolver: Fixed auto-resolution running in a loop in some scenarios. + +# Version 1.2.94 - Oct 22, 2018 +## Bug Fixes +* iOS Resolver: Added support for PODS_TARGET_SRCROOT in source Cocoapods. + +# Version 1.2.93 - Oct 22, 2018 +## Bug Fixes +* Android Resolver: Fixed removal of Android libraries on auto-resolution when + `*Dependencies.xml` files are deleted. + +# Version 1.2.92 - Oct 2, 2018 +## Bug Fixes +* Android Resolver: Worked around auto-resolution hang on Windows if + resolution starts before compilation is finished. + +# Version 1.2.91 - Sep 27, 2018 +## Bug Fixes +* Android Resolver: Fixed Android Resolution when the selected build target + isn't Android. +* Added C# assembly symbols the plugin to simplify debugging bug reports. + +# Version 1.2.90 - Sep 21, 2018 +## Bug Fixes +* Android Resolver: Fixed transitive dependency selection of version locked + packages. + +# Version 1.2.89 - Aug 31, 2018 +## Bug Fixes +* Fixed FileLoadException in ResolveUnityEditoriOSXcodeExtension an assembly + can't be loaded. + +# Version 1.2.88 - Aug 29, 2018 +## Changed +* Improved reporting of resolution attempts and conflicts found in the Android + Resolver. +## Bug Fixes +* iOS Resolver now correctly handles sample code in CocoaPods. Previously it + would add all sample code to the project when using project level + integration. +* Android Resolver now correctly handles Gradle conflict resolution when the + resolution results in a package that is compatible with all requested + dependencies. + +# Version 1.2.87 - Aug 23, 2018 +## Bug Fixes +* Fixed Android Resolver "Processing AARs" dialog getting stuck in Unity 5.6. + +# Version 1.2.86 - Aug 22, 2018 +## Bug Fixes +* Fixed Android Resolver exception in OnPostProcessScene() when the Android + platform isn't selected. + +# Version 1.2.85 - Aug 17, 2018 +## Changes +* Added support for synchronous resolution in the Android Resolver. + PlayServicesResolver.ResolveSync() now performs resolution synchronously. +* Auto-resolution in the Android Resolver now results in synchronous resolution + of Android dependencies before the Android application build starts via + UnityEditor.Callbacks.PostProcessSceneAttribute. + +# Version 1.2.84 - Aug 16, 2018 +## Bug Fixes +* Fixed Android Resolver crash when the AndroidResolverDependencies.xml + file can't be written. +* Reduced log spam when a conflicting Android library is pinned to a + specific version. + +# Version 1.2.83 - Aug 15, 2018 +## Bug Fixes +* Fixed Android Resolver failures due to an in-accessible AAR / JAR explode + cache file. If the cache can't be read / written the resolver now continues + with reduced performance following recompilation / DLL reloads. +* Fixed incorrect version number in plugin manifest on install. + This was a minor issue since the version handler rewrote the metadata + after installation. + +# Version 1.2.82 - Aug 14, 2018 +## Changed +* Added support for alphanumeric versions in the Android Resolver. + +## Bug Fixes +* Fixed Android Resolver selection of latest duplicated library. +* Fixed Android Resolver conflict resolution when version locked and non-version + locked dependencies are specified. +* Fixed Android Resolver conflict resolution when non-existent artifacts are + referenced. + +# Version 1.2.81 - Aug 9, 2018 +## Bug Fixes +* Fixed editor error that would occur when when + `PlayerSettings.Android.targetArchitectures` was set to + `AndroidArchitecture.All`. + +# Version 1.2.80 - Jul 24, 2018 +## Bug Fixes +* Fixed project level settings incorrectly falling back to system wide settings + when default property values were set. + +# Version 1.2.79 - Jul 23, 2018 +## Bug Fixes +* Fixed AndroidManifest.xml patching on Android Resolver load in Unity 2018.x. + +# Version 1.2.78 - Jul 19, 2018 +## Changed +* Added support for overriding conflicting dependencies. + +# Version 1.2.77 - Jul 19, 2018 +## Changed +* Android Resolver now supports Unity's 2018 ABI filter (i.e arm64-v8a). +* Reduced Android Resolver build option polling frequency. +* Disabled Android Resolver auto-resolution in batch mode. Users now need + to explicitly kick off resolution through the API. +* All Android Resolver and Version Handler dialogs are now disabled in batch + mode. +* Verbose logging for all plugins is now enabled by default in batch mode. +* Version Handler bootstrapper has been improved to no longer call + UpdateComplete multiple times. However, since Unity can still reload the + app domain after plugins have been enabled, users still need to store their + plugin state to persistent storage to handle reloads. + +## Bug Fixes +* Android Resolver no longer incorrectly adds MANIFEST.MF files to AARs. +* Android Resolver auto-resolution jobs are now unscheduled when an explicit + resolve job is started. + +# Version 1.2.76 - Jul 16, 2018 +## Bug Fixes +* Fixed variable replacement in AndroidManifest.xml files in the Android + Resolver. + Version 1.2.75 introduced a regression which caused all variable replacement + to replace the *entire* property value rather than the component of the + property that referenced a variable. For example, + given "applicationId = com.my.app", "${applicationId}.foo" would be + incorrectly expanded as "com.my.app" rather than "com.my.app.foo". This + resulted in numerous issues for Android builds where content provider + initialization would fail and services may not start. + +## Changed +* Gradle prebuild experimental feature has been removed from the Android + Resolver. The feature has been broken for some time and added around 8MB + to the plugin size. +* Added better support for execution of plugin components in batch mode. + In batch mode UnityEditor.update is sometimes never called - like when a + single method is executed - so the new job scheduler will execute all jobs + synchronously from the main thread. + +# Version 1.2.75 - Jun 20, 2018 +## New Features +* Android Resolver now monitors the Android SDK path when + auto-resolution is enabled and triggers resolution when the path is + modified. + +## Changed +* Android auto-resolution is now delayed by 3 seconds when the following build + settings are changed: + - Target ABI. + - Gradle build vs. internal build. + - Project export. +* Added a progress bar display when AARs are being processed during Android + resolution. + +## Bug Fixes +* Fixed incorrect Android package version selection when a mix of + version-locked and non-version-locked packages are specified. +* Fixed non-deterministic Android package version selection to select + the highest version of a specified package rather than the last + package specification passed to the Gradle resolution script. + +# Version 1.2.74 - Jun 19, 2018 +## New Features +* Added workaround for broken AndroidManifest.xml variable replacement in + Unity 2018.x. By default ${applicationId} variables will be replaced by + the bundle ID in the Plugins/Android/AndroidManifest.xml file. The + behavior can be disabled via the Android Resolver settings menu. + +# Version 1.2.73 - May 30, 2018 +## Bug Fixes +* Fixed spurious warning message about missing Android plugins directory on + Windows. + +# Version 1.2.72 - May 23, 2018 +## Bug Fixes +* Fixed spurious warning message about missing Android plugins directory. + +# Version 1.2.71 - May 10, 2018 +## Bug Fixes +* Fixed resolution of Android dependencies when the `Assets/Plugins/Android` + directory is named in a different case e.g `Assets/plugins/Android`. + +# Version 1.2.70 - May 7, 2018 +## Bug Fixes +* Fixed bitcode flag being ignored for iOS pods. + +# Version 1.2.69 - May 7, 2018 +## Bug Fixes +* Fixed escaping of local repository paths in Android Resolver. + +# Version 1.2.68 - May 3, 2018 +## Changes +* Added support for granular builds of Google Play Services. + +# Version 1.2.67 - May 1, 2018 +## Changes +* Improved support for iOS source-only pods in Unity 5.5 and below. + +# Version 1.2.66 - April 27, 2018 +## Bug Fixes +* Fixed Version Handler renaming of Linux libraries with hyphens in filenames. + Previously, libraries named Foo-1.2.3.so were not being renamed to + libFoo-1.2.3.so on Linux which could break native library loading on some + versions of Unity. + +# Version 1.2.65 - April 26, 2018 +## Bug Fixes +* Fix CocoaPods casing in logs and comments. + +# Version 1.2.64 - Mar 16, 2018 +## Bug Fixes +* Fixed bug in download_artifacts.gradle (used by Android Resolver) which + reported a failure if required artifacts already exist. + +# Version 1.2.63 - Mar 15, 2018 +## Bug Fixes +* Fixed iOS Resolver include search paths taking precedence over system headers + when using project level resolution. +* Fixed iOS Resolver includes relative to library root, when using project level + resolution. + +# Version 1.2.62 - Mar 12, 2018 +## Changes +* Improved error reporting when a file can't be moved to trash by the + Version Handler. +## Bug Fixes +* Fixed Android Resolver throwing NullReferenceException when the Android SDK + path isn't set. +* Fixed Version Handler renaming files with underscores if the + "Rename to Canonical Filenames" setting is enabled. + +# Version 1.2.61 - Jan 22, 2018 +## Bug Fixes +* Fixed Android Resolver reporting non-existent conflicting dependencies when + Gradle build system is enabled. + +# Version 1.2.60 - Jan 12, 2018 +## Changes +* Added support for Maven / Ivy version specifications for Android packages. +* Added support for Android SNAPSHOT packages. + +## Bug Fixes +* Fixed Openjdk version check. +* Fixed non-deterministic Android package resolution when two packages contain + an artifact with the same name. + +# Version 1.2.59 - Oct 19, 2017 +## Bug Fixes +* Fixed execution of Android Gradle resolution script when it's located + in a path with whitespace. + +# Version 1.2.58 - Oct 19, 2017 +## Changes +* Removed legacy resolution method from Android Resolver. + It is now only possible to use the Gradle or Gradle prebuild resolution + methods. + +# Version 1.2.57 - Oct 18, 2017 +## Bug Fixes +* Updated Gradle wrapper to 4.2.1 to fix issues using Gradle with the + latest Openjdk. +* Android Gradle resolution now also uses gradle.properties to pass + parameters to Gradle in an attempt to workaround problems with + command line argument parsing on Windows 10. + +# Version 1.2.56 - Oct 12, 2017 +## Bug Fixes +* Fixed Gradle artifact download with non-version locked artifacts. +* Changed iOS resolver to only load dependencies at build time. + +# Version 1.2.55 - Oct 4, 2017 +## Bug Fixes +* Force Android Resolution when the "Install Android Packages" setting changes. + +# Version 1.2.54 - Oct 4, 2017 +## Bug Fixes +* Fixed execution of command line tools on Windows when the path to the tool + contains a single quote (apostrophe). In this case we fallback to executing + the tool via the system shell. + +# Version 1.2.53 - Oct 2, 2017 +## New Features +* Changed Android Resolver "resolution complete" dialog so that it now displays + failures. +* Android Resolver now detects conflicting libraries that it does not manage + warning the user if they're newer than the managed libraries and prompting + the user to clean them up if they're older or at the same version. + +## Bug Fixes +* Improved Android Resolver auto-resolution speed. +* Fixed bug in the Gradle Android Resolver which would result in resolution + succeeding when some dependencies are not found. + +# Version 1.2.52 - Sep 25, 2017 +## New Features +* Changed Android Resolver's Gradle resolution to resolve conflicting + dependencies across Google Play services and Android Support library packages. + +# Version 1.2.51 - Sep 20, 2017 +## Changes +* Changed iOS Resolver to execute the CocoaPods "pod" command via the shell + by default. Some developers customize their shell environment to use + custom ssh certs to access internal git repositories that host pods so + executing "pod" via the shell will work for these scenarios. + The drawback of executing "pod" via the shell could potentially cause + users problems if they break their shell environment. Though users who + customize their shell environments will be able to resolve these issues. + +# Version 1.2.50 - Sep 18, 2017 +## New Features +* Added option to disable the Gradle daemon in the Android Resolver. + This daemon is now disabled by default as some users are getting into a state + where multiple daemon instances are being spawned when changing dependencies + which eventually results in Android resolution failing until all daemon + processes are manually killed. + +## Bug Fixes +* Android resolution is now always executed if the user declines the update + of their Android SDK. This ensure users can continue to use out of date + Android SDK packages if they desire. + +# Version 1.2.49 - Sep 18, 2017 +## Bug Fixes +* Removed modulemap parsing in iOS Resolver. + The framework *.modulemap did not need to be parsed by the iOS Resolver + when injecting Cocoapods into a Xcode project. Simply adding a modular + framework to a Xcode project results in Xcode's Clang parsing the associated + modulemap and injecting any compile and link flags into the build process. + +# Version 1.2.48 - Sep 12, 2017 +## New Features +* Changed settings to be per-project by default. + +## Bug Fixes +* Added Google maven repository to fix GradlePrebuild resolution with Google + components. +* Fixed Android Resolution failure with spaces in paths. + +# Version 1.2.47 - Aug 29, 2017 +## New Features +* Android and iOS dependencies can now be specified using *Dependencies.xml + files. This is now the preferred method for registering dependencies, + we may remove the API for dependency addition in future. +* Added "Reset to Defaults" button to each settings dialog to restore default + settings. +* Android Resolver now validates the configured JDK is new enough to build + recently released Android libraries. +## Bug Fixes +* Fixed a bug that caused dependencies with the "LATEST" version specification + to be ignored when using the Gradle mode of the Android Resolver. +* Fixed a race condition when running Android Resolution. +* Fixed Android Resolver logging if a PlayServicesSupport instance is created + with no logging enabled before the Android Resolver is initialized. +* Fixed iOS resolver dialog in Unity 4. +* Fixed iOS Cocoapod Xcode project integration in Unity 4. + +# Version 1.2.46 - Aug 22, 2017 +## Bug Fixes +* GradlePrebuild Android resolver on Windows now correctly locates dependent + data files. + +# Version 1.2.45 - Aug 22, 2017 +## Bug Fixes +* Improved Android package auto-resolution and fixed clean up of stale + dependencies when using Gradle dependency resolution. + +# Version 1.2.44 - Aug 21, 2017 +## Bug Fixes +* Enabled autoresolution for Gradle Prebuild. +* Made the command line dialog windows have selectable text. +* Fixed incorrect "Android Settings" dialog disabled groups. +* Updated PlayServicesResolver android platform detection to use the package + manager instead of the 'android' tool. +* UnityCompat reflection methods 'GetAndroidPlatform' and + 'GetAndroidBuildToolsVersion' are now Obsolete due to dependence on the + obsolete 'android' build tool. + +# Version 1.2.43 - Aug 18, 2017 +## Bug Fixes +* Fixed Gradle resolution in the Android Resolver when running + PlayServicesResolver.Resolve() in parallel or spawning multiple + resolutions before the previous resolve completed. + +# Version 1.2.42 - Aug 17, 2017 +## Bug Fixes +* Fixed Xcode project level settings not being applied by IOS Resolver when + Xcode project pod integration is enabled. + +# Version 1.2.41 - Aug 15, 2017 +## Bug Fixes +* IOS Resolver's Xcode workspace pod integration is now disabled when Unity + Cloud Build is detected. Unity Cloud Build does not follow the same build + process as the Unity editor and fails to open the generated xcworkspace at + this time. + +# Version 1.2.40 - Aug 15, 2017 +## Bug Fixes +* Moved Android Resolver Gradle Prebuild scripts into Google.JarResolver.dll. + They are now extracted from the DLL when required. +* AARs / JARs are now cleaned up when switching the Android resolution + strategy. + +# Version 1.2.39 - Aug 10, 2017 +## New Features +* Android Resolver now supports resolution with Gradle. This enables support + for non-local artifacts. +## Bug Fixes +* Android Resolver's Gradle Prebuild now uses Android build tools to determine + the Android platform tools version rather than relying upon internal Unity + APIs. +* Android Resolver's Gradle Prebuild now correctly strips binaries that are + not required for the target ABI. + +# Version 1.2.38 - Aug 7, 2017 +## Bug Fixes +* Fixed an issue in VersionHandler where disabled targets are ignored if + the "Any Platform" flag is set on a plugin DLL. + +# Version 1.2.37 - Aug 3, 2017 +## New Features +* Exposed GooglePlayServices.PlayServicesResolver.Resolve() so that it's + possible for a script to be notified when AAR / Jar resolution is complete. + This makes it easier to setup a project to build from the command line. + +# Version 1.2.36 - Aug 3, 2017 +## New Features +* VersionHandler.UpdateCompleteMethods allows a user to provide a list of + methods to be called when VersionHandlerImpl has completed an update. + This makes it easier to import a plugin and wait for VersionHandler to + execute prior executing a build. + +# Version 1.2.35 - Jul 28, 2017 +## New Features +* VersionHandler will now rename Linux libraries so they can target Unity + versions that require different file naming. Libraries need to be labelled + gvh_linuxlibname-${basename} in order to be considered for renaming. + e.g gvh\_linuxlibname-MyLib will be named MyLib.so in Unity 5.5 and below and + libMyLib.so in Unity 5.6 and above. + +# Version 1.2.34 - Jul 28, 2017 +## Bug Fixes +* Made VersionHandler bootstrap module more robust when calling static + methods before the implementation DLL is loaded. + +# Version 1.2.33 - Jul 27, 2017 +## New Features +* Added a bootstrap module for VersionHandler so the implementation + of the VersionHandler module can be versioned without resulting in + a compile error when imported at different versions across multiple + plugins. + +# Version 1.2.32 - Jul 20, 2017 +## New Features +* Added support for build target selection based upon .NET framework + version in the VersionHandler. + When applying either gvh\_dotnet-3.5 or gvh\_dotnet-4.5 labels to + assets, the VersionHandler will only enable the asset for the + specified set of build targets when the matching .NET framework version + is selected in Unity 2017's project settings. This allows assets + to be provided in a plugin that need to differ based upon .NET version. + +# Version 1.2.31 - Jul 5, 2017 +## Bug Fixes +* Force expansion of AARs with native components when using Unity 2017 + with the internal build system. In contrast to Unity 5.x, Unity 2017's + internal build system does not include native libraries included in AARs. + Forcing expansion of AARs with native components generates an + Ant / Eclipse project for each AAR which is correctly included by Unity + 2017's internal build system. + +# Version 1.2.30 - Jul 5, 2017 +## Bug Fixes +* Fixed Cocoapods being installed when the build target isn't iOS. +* Added support for malformed AARs with missing classes.jar. + +# Version 1.2.29 - Jun 16, 2017 +## New Features +* Added support for the Android sdkmanager tool. + +# Version 1.2.28 - Jun 8, 2017 +## Bug Fixes +* Fixed non-shell command line execution (regression from + Cocoapod installation patch). + +# Version 1.2.27 - Jun 7, 2017 +## Bug Fixes +* Added support for stdout / stderr redirection when executing + commands in shell mode. + This fixes CocoaPod tool installation when shell mode is + enabled. +* Fixed incremental builds when additional sources are specified + in the Podfile. + +# Version 1.2.26 - Jun 7, 2017 +## Bug Fixes +* Fixed a crash when importing Version Handler into Unity 4.7.x. + +# Version 1.2.25 - Jun 7, 2017 +## Bug Fixes +* Fixed an issue in the Jar Resolver which incorrectly notified + event handlers of bundle ID changes when the currently selected + (not active) build target changed in Unity 5.6 and above. + +# Version 1.2.24 - Jun 6, 2017 +## New Features +* Added option to control file renaming in Version Handler settings. + Disabling file renaming (default option) significantly increases + the speed of file version management operations with the downside + that any files that are referenced directly by canonical filename + rather than asset ID will no longer be valid. +* Improved logging in the Version Handler. +## Bug Fixes +* Fixed an issue in the Version Handler which caused it to not + re-enable plugins when re-importing a custom package with disabled + version managed files. + +# Version 1.2.23 - May 26, 2017 +## Bug Fixes +* Fixed a bug with gradle prebuild resolver on windows. + +# Version 1.2.22 - May 19, 2017 +## Bug Fixes +* Fixed a bug in the iOS resolver with incremental builds. +* Fixed misdetection of Cocoapods support with Unity beta 5.6. + +# Version 1.2.21 - May 8, 2017 +## Bug Fixes +* Fix for https://github.com/googlesamples/unity-jar-resolver/issues/48 + Android dependency version number parsing when "-alpha" (etc.) are + included in dependency (AAR / JAR) versions. + +# Version 1.2.20 - May 8, 2017 +## Bug Fixes +* Attempted to fix + https://github.com/googlesamples/unity-jar-resolver/issues/48 + where a NullReferenceException could occur if a target file does not + have a valid version string. + +# Version 1.2.19 - May 4, 2017 +## Bug Fixes +* Fixed Jar Resolver exploding and deleting AAR files it isn't managing. + +# Version 1.2.18 - May 4, 2017 +## New Features +* Added support for preserving Unity pods such as when GVR is enabled. + +# Version 1.2.17 - Apr 20, 2017 +## Bug Fixes +* Fixed auto-resolution when an Android application ID is modified. + +# Version 1.2.16 - Apr 17, 2017 +## Bug Fixes +* Fixed Unity version number parsing on machines with a locale that uses + "," for decimal points. +* Fixed null reference exception if JDK path isn't set. + +# Version 1.2.15 - Mar 17, 2017 +## New Features +* Added warning when the Jar Resolver's background resolution is disabled. +## Bug Fixes +* Fixed support of AARs with native libraries when using Gradle. +* Fixed extra repository paths when resolving dependencies. + +# Version 1.2.14 - Mar 7, 2017 +## New Features +* Added experimental Android resolution using Gradle. + This alternative resolver supports proguard stripping with Unity's + internal build system. +* Added Android support for single ABI builds when using AARs include + native libraries. +* Disabled Android resolution on changes to all .cs and .js files. + File patterns that are monitored for auto-resolution can be added + using PlayServicesResolver.AddAutoResolutionFilePatterns(). +* Added tracking of resolved AARs and JARs so they can be cleaned up + if they're no longer referenced by a project. +* Added persistence of AAR / JAR version replacement for each Unity + session. +* Added settings dialog to the iOS resolver. +* Integrated Cocoapod tool installation in the iOS resolver. +* Added option to run pod tool via the shell. +## Bug Fixes +* Fixed build of some source Cocoapods (e.g Protobuf). +* VersionHandler no longer prompts to delete obsolete manifests. +* iOS resolver handles Cocoapod installation when using Ruby < 2.2.2. +* Added workaround for package version selection when including + Google Play Services on Android. +* Fixed support for pods that reference static libraries. +* Fixed support for resource-only pods. + +# Version 1.2.12 - Feb 14, 2017 +## Bug Fixes +* Fixed re-explosion of AARs when the bundle ID is modified. + +# Version 1.2.11 - Jan 30, 2017 +## New Features +* Added support for Android Studio builds. +* Added support for native (C/C++) shared libraries in AARs. + +# Version 1.2.10 - Jan 11, 2017 +## Bug Fixes +* Fixed SDK manager path retrieval. +* Also, report stderr when it's not possible to run the "pod" tool. +* Handle exceptions thrown by Unity.Cecil on asset rename +* Fixed IOSResolver to handle PlayerSettings.iOS.targetOSVersionString + +# Version 1.2.9 - Dec 7, 2016 +## Bug Fixes +* Improved error reporting when "pod repo update" fails. +* Added detection of xml format xcode projects generated by old Cocoapods + installations. + +# Version 1.2.8 - Dec 6, 2016 +## Bug Fixes +* Increased speed of JarResolver resolution. +* Fixed JarResolver caches getting out of sync with requested dependencies + by removing the caches. +* Fixed JarResolver explode cache always being rewritten even when no + dependencies change. + +# Version 1.2.7 - Dec 2, 2016 +## Bug Fixes +* Fixed VersionHandler build errors with Unity 5.5, due to the constantly + changing BuildTarget enum. +* Added support for Unity configured JDK Path rather than requiring + JAVA_HOME to be set in the Jar Resolver. + +# Version 1.2.6 - Nov 15, 2016 +## Bug Fixes +* Fixed IOSResolver errors when iOS support is not installed. +* Added fallback to "pod" executable search which queries the Ruby Gems + package manager for the binary install location. + +# Version 1.2.5 - Nov 3, 2016 +## Bug Fixes +* Added crude support for source only Cocoapods to the IOSResolver. + +# Version 1.2.4 - Oct 27, 2016 +## Bug Fixes +* Automated resolution of out of date pod repositories. + +# Version 1.2.3 - Oct 25, 2016 +## Bug Fixes +* Fixed exception when reporting conflicting dependencies. + +# Version 1.2.2 - Oct 17, 2016 +## Bug Fixes +* Fixed issue working with Unity 5.5 +* Fixed issue with PlayServicesResolver corrupting other iOS dependencies. +* Updated build script to use Unity distributed tools for building. + +# Version 1.2.1 - Jul 25, 2016 +## Bug Fixes +* Removed 1.2 Resolver and hardcoded whitelist of AARs to expand. +* Improved error reporting when the "jar" executable can't be found. +* Removed the need to set JAVA_HOME if "jar" is in the user's path. +* Fixed spurious copying of partially matching AARs. +* Changed resolver to only copy / expand when source AARs change. +* Auto-resolution of dependencies is now performed when the Android + build target is selected. + +## New Features +* Expand AARs that contain manifests with variable expansion like + ${applicationId}. +* Added optional logging in the JarResolverLib module. +* Integration with the Android SDK manager for dependencies that + declare required Android SDK packages. + +# Version 1.2.0 - May 11 2016 +## Bug Fixes +* Handles resolving dependencies when the artifacts are split across 2 repos. +* #4 Misdetecting version for versions like 1.2-alpha. These are now string + compared if alphanumeric +* Removed resolver creation via reflection since it did not work all the time. + Now a resolver needs to be loaded externally (which is existing behavior). + +## New Features +* Expose PlayServicesResolver properties to allow for script access. +* Explodes firebase-common and firebase-measurement aar files to support + ${applicationId} substitution. + +# Version 1.1.1 - 25 Feb 2016 +## Bug Fixes +* #1 Spaces in project path not handled when exploding Aar file. +* #2 Script compilation error: TypeLoadException. + +# Version 1.1.0 - 5 Feb 2016 +## New Features +* Adds friendly alert when JAVA_HOME is not set on Windows platforms. +* Adds flag for disabling background resolution. +* Expands play-services-measurement and replaces ${applicationId} with the + bundle Id. + + ## Bug Fixes +* Fixes infinite loop of resolution triggered by resolution. diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta b/popcorn/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta new file mode 100644 index 00000000..4cac943b --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 39dd59b7c002145379fd263f890f693f +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll b/popcorn/Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll new file mode 100644 index 00000000..3db1838d Binary files /dev/null and b/popcorn/Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll differ diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll.meta b/popcorn/Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll.meta new file mode 100644 index 00000000..0ddfff1b --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: abf765bf3ce5f4d189d796a59a689c18 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll b/popcorn/Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll new file mode 100644 index 00000000..ddc7169f Binary files /dev/null and b/popcorn/Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll differ diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll.meta b/popcorn/Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll.meta new file mode 100644 index 00000000..e1852e82 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: deecd3a85ccc84a13a0bf611ba4cdbac +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll b/popcorn/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll new file mode 100644 index 00000000..28852997 Binary files /dev/null and b/popcorn/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll differ diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll.meta b/popcorn/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll.meta new file mode 100644 index 00000000..0d5f387b --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 3a4e527f4fff0443887e8a099e7f5c02 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll new file mode 100644 index 00000000..6e0ccf14 Binary files /dev/null and b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll differ diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta new file mode 100644 index 00000000..e5bfbde6 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 592cfd036a2c941f9ad2da0e1eb567ba +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll new file mode 100644 index 00000000..021473d3 Binary files /dev/null and b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll differ diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll.meta b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll.meta new file mode 100644 index 00000000..587aaf72 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: b94960ef1b252403380dd890e1c05761 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/LICENSE b/popcorn/Assets/ExternalDependencyManager/Editor/LICENSE new file mode 100644 index 00000000..6258cc47 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/LICENSE @@ -0,0 +1,245 @@ +Copyright (C) 2014 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +==================================================================================================== +This package uses MiniJSON + +Copyright (c) 2013 Calvin Rien + +Based on the JSON parser by Patrick van Bergen +http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html + +Simplified it so that it doesn't throw exceptions +and can be used in Unity iPhone with maximum code stripping. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/LICENSE.meta b/popcorn/Assets/ExternalDependencyManager/Editor/LICENSE.meta new file mode 100644 index 00000000..37bc43c5 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/LICENSE.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 807495fed00f447198f5a6bc6a416c69 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/README.md b/popcorn/Assets/ExternalDependencyManager/Editor/README.md new file mode 100644 index 00000000..cbc98e19 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/README.md @@ -0,0 +1,768 @@ +External Dependency Manager for Unity +======== + +# Overview + +The External Dependency Manager for Unity (EDM4U) +(formerly Play Services Resolver / Jar Resolver) is intended to be used by any +Unity plugin that requires: + + * Android specific libraries (e.g + [AARs](https://developer.android.com/studio/projects/android-library.html)). + * iOS [CocoaPods](https://cocoapods.org/). + * Version management of transitive dependencies. + * Management of Package Manager (PM) Registries. + +Updated releases are available on +[GitHub](https://github.com/googlesamples/unity-jar-resolver) + +# Background + +Many Unity plugins have dependencies upon Android specific libraries, iOS +CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. +This causes the following problems: + + * Integrating platform specific (e.g Android and iOS) libraries within a + Unity project can be complex and a burden on a Unity plugin maintainer. + * The process of resolving conflicting dependencies on platform specific + libraries is pushed to the developer attempting to use a Unity plugin. + The developer trying to use you plugin is very likely to give up when + faced with Android or iOS specific build errors. + * The process of resolving conflicting Unity plugins (due to shared Unity + plugin components) is pushed to the developer attempting to use your Unity + plugin. In an effort to resolve conflicts, the developer will very likely + attempt to resolve problems by deleting random files in your plugin, + report bugs when that doesn't work and finally give up. + +EDM provides solutions for each of these problems. + +## Android Dependency Management + +The *Android Resolver* component of this plugin will download and integrate +Android library dependencies and handle any conflicts between plugins that share +the same dependencies. + +Without the Android Resolver, typically Unity plugins bundle their AAR and +JAR dependencies, e.g. a Unity plugin `SomePlugin` that requires the Google +Play Games Android library would redistribute the library and its transitive +dependencies in the folder `SomePlugin/Android/`. When a user imports +`SomeOtherPlugin` that includes the same libraries (potentially at different +versions) in `SomeOtherPlugin/Android/`, the developer using `SomePlugin` and +`SomeOtherPlugin` will see an error when building for Android that can be hard +to interpret. + +Using the Android Resolver to manage Android library dependencies: + + * Solves Android library conflicts between plugins. + * Handles all of the various processing steps required to use Android + libraries (AARs, JARs) in Unity 4.x and above projects. Almost all + versions of Unity have - at best - partial support for AARs. + * (Experimental) Supports minification of included Java components without + exporting a project. + +## iOS Dependency Management + +The *iOS Resolver* component of this plugin integrates with +[CocoaPods](https://cocoapods.org/) to download and integrate iOS libraries +and frameworks into the Xcode project Unity generates when building for iOS. +Using CocoaPods allows multiple plugins to utilize shared components without +forcing developers to fix either duplicate or incompatible versions of +libraries included through multiple Unity plugins in their project. + +## Package Manager Registry Setup + +The [Package Manager](https://docs.unity3d.com/Manual/Packages.html) +(PM) makes use of [NPM](https://www.npmjs.com/) registry servers for package +hosting and provides ways to discover, install, upgrade and uninstall packages. +This makes it easier for developers to manage plugins within their projects. + +However, installing additional package registries requires a few manual steps +that can potentially be error prone. The *Package Manager Resolver* +component of this plugin integrates with +[PM](https://docs.unity3d.com/Manual/Packages.html) to provide a way to +auto-install PM package registries when a `.unitypackage` is installed which +allows plugin maintainers to ship a `.unitypackage` that can provide access +to their own PM registry server to make it easier for developers to +manage their plugins. + +## Unity Plugin Version Management + +Finally, the *Version Handler* component of this plugin simplifies the process +of managing transitive dependencies of Unity plugins and each plugin's upgrade +process. + +For example, without the Version Handler plugin, if: + + * Unity plugin `SomePlugin` includes `EDM4U` plugin at + version 1.1. + * Unity plugin `SomeOtherPlugin` includes `EDM4U` + plugin at version 1.2. + +The version of `EDM4U` included in the developer's project depends upon the +order the developer imports `SomePlugin` or `SomeOtherPlugin`. + +This results in: + + * `EDM4U` at version 1.2, if `SomePlugin` is imported then `SomeOtherPlugin` + is imported. + * `EDM4U` at version 1.1, if `SomeOtherPlugin` is imported then + `SomePlugin` is imported. + +The Version Handler solves the problem of managing transitive dependencies by: + + * Specifying a set of packaging requirements that enable a plugin at + different versions to be imported into a Unity project. + * Providing activation logic that selects the latest version of a plugin + within a project. + +When using the Version Handler to manage `EDM4U` included in `SomePlugin` and +`SomeOtherPlugin`, from the prior example, version 1.2 will always be the +version activated in a developer's Unity project. + +Plugin creators are encouraged to adopt this library to ease integration for +their customers. For more information about integrating EDM4U +into your own plugin, see the [Plugin Redistribution](#plugin-redistribution) +section of this document. + +# Analytics + +The External Dependency Manager for Unity plugin by default logs usage to Google +Analytics. The purpose of the logging is to quantitatively measure the usage of +functionality, to gather reports on integration failures and to inform future +improvements to the developer experience of the External Dependency Manager +plugin. Note that the analytics collected are limited to the scope of the EDM4U +plugin’s usage. + +For details of what is logged, please refer to the usage of +`EditorMeasurement.Report()` in the source code. + +# Requirements + +The *Android Resolver* and *iOS Resolver* components of the plugin only work +with Unity version 4.6.8 or higher. + +The *Version Handler* component only works with Unity 5.x or higher as it +depends upon the `PluginImporter` UnityEditor API. + +The *Package Manager Resolver* component only works with +Unity 2018.4 or above, when +[scoped registry](https://docs.unity3d.com/Manual/upm-scoped.html) +support was added to the Package Manager. + +# Getting Started + +Before you import EDM4U into your plugin project, you first +need to consider whether you intend to *redistribute* `EDM4U` +along with your own plugin. + +## Plugin Redistribution + +If you're a plugin maintainer, redistributing `EDM4U` inside your own plugin +will ease the integration process for your users, by resolving dependency +conflicts between your plugin and other plugins in a user's project. + +If you wish to redistribute `EDM4U` inside your plugin, +you **must** follow these steps when importing the +`external-dependency-manager-*.unitypackage`, and when exporting your own plugin +package: + + 1. Import the `external-dependency-manager-*.unitypackage` into your plugin + project by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), ensuring that + you add the `-gvh_disable` option. + 1. Export your plugin by [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), ensuring that + you: + - Include the contents of the `Assets/PlayServicesResolver` and + `Assets/ExternalDependencyManager` directory. + - Add the `-gvh_disable` option. + +You **must** specify the `-gvh_disable` option in order for the Version +Handler to work correctly! + +For example, the following command will import the +`external-dependency-manager-1.2.46.0.unitypackage` into the project +`MyPluginProject` and export the entire Assets folder to +`MyPlugin.unitypackage`: + +``` +Unity -gvh_disable \ + -batchmode \ + -importPackage external-dependency-manager-1.2.46.0.unitypackage \ + -projectPath MyPluginProject \ + -exportPackage Assets MyPlugin.unitypackage \ + -quit +``` + +### Background + +The *Version Handler* component relies upon deferring the load of editor DLLs +so that it can run first and determine the latest version of a plugin component +to activate. The build of `EDM4U` plugin has Unity asset metadata that is +configured so that the editor components are not initially enabled when it's +imported into a Unity project. To maintain this configuration when importing +the `external-dependency-manager.unitypackage` into a Unity plugin project, you +*must* specify the command line option `-gvh_disable` which will prevent the +Version Handler component from running and changing the Unity asset metadata. + +# Android Resolver Usage + +The Android Resolver copies specified dependencies from local or remote Maven +repositories into the Unity project when a user selects Android as the build +target in the Unity editor. + + 1. Add the `external-dependency-manager-*.unitypackage` to your plugin + project (assuming you are developing a plugin). If you are redistributing + EDM4U with your plugin, you **must** follow the + import steps in the [Getting Started](#getting-started) section! + + 2. Copy and rename the + [SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) + file into your plugin and add the dependencies your plugin requires. + + The XML file just needs to be under an `Editor` directory and match the + name `*Dependencies.xml`. For example, + `MyPlugin/Editor/MyPluginDependencies.xml`. + + 3. Follow the steps in the [Getting Started](#getting-started) + section when you are exporting your plugin package. + +For example, to add the Google Play Games library +(`com.google.android.gms:play-services-games` package) at version `9.8.0` to +the set of a plugin's Android dependencies: + +``` + + + + + extra-google-m2repository + + + + +``` + +The version specification (last component) supports: + + * Specific versions e.g `9.8.0` + * Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most + recent version. + * Latest version using `LATEST` or `+`. We do *not* recommend using this + unless you're 100% sure the library you depend upon will not break your + Unity plugin in future. + +The above example specifies the dependency as a component of the Android SDK +manager such that the Android SDK manager will be executed to install the +package if it's not found. If your Android dependency is located on Maven +central it's possible to specify the package simply using the `androidPackage` +element: + +``` + + + + + +``` + +## Auto-resolution + +By default the Android Resolver automatically monitors the dependencies you have +specified and the `Plugins/Android` folder of your Unity project. The +resolution process runs when the specified dependencies are not present in your +project. + +The *auto-resolution* process can be disabled via the +`Assets > External Dependency Manager > Android Resolver > Settings` menu. + +Manual resolution can be performed using the following menu options: + + * `Assets > External Dependency Manager > Android Resolver > Resolve` + * `Assets > External Dependency Manager > Android Resolver > Force Resolve` + +## Deleting libraries + +Resolved packages are tracked via asset labels by the Android Resolver. +They can easily be deleted using the +`Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries` +menu item. + +## Android Manifest Variable Processing + +Some AAR files (for example play-services-measurement) contain variables that +are processed by the Android Gradle plugin. Unfortunately, Unity does not +perform the same processing when using Unity's Internal Build System, so the +Android Resolver plugin handles known cases of this variable substitution +by exploding the AAR into a folder and replacing `${applicationId}` with the +`bundleID`. + +Disabling AAR explosion and therefore Android manifest processing can be done +via the `Assets > External Dependency Manager > Android Resolver > Settings` +menu. You may want to disable explosion of AARs if you're exporting a project +to be built with Gradle / Android Studio. + +## ABI Stripping + +Some AAR files contain native libraries (.so files) for each ABI supported +by Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does +not strip native libraries for unused ABIs. To strip unused ABIs, the Android +Resolver plugin explodes an AAR into a folder and removes unused ABIs to +reduce the built APK size. Furthermore, if native libraries are not stripped +from an APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a +libraries) Android may attempt to load the wrong library for the current +runtime ABI completely breaking your plugin when targeting some architectures. + +AAR explosion and therefore ABI stripping can be disabled via the +`Assets > External Dependency Manager > Android Resolver > Settings` menu. +You may want to disable explosion of AARs if you're exporting a project to be +built with Gradle / Android Studio. + +## Resolution Strategies + +By default the Android Resolver will use Gradle to download dependencies prior +to integrating them into a Unity project. This works with Unity's internal +build system and Gradle / Android Studio project export. + +It's possible to change the resolution strategy via the +`Assets > External Dependency Manager > Android Resolver > Settings` menu. + +### Download Artifacts with Gradle + +Using the default resolution strategy, the Android resolver executes the +following operations: + + - Remove the result of previous Android resolutions. + e.g Delete all files and directories labeled with "gpsr" under + `Plugins/Android` from the project. + - Collect the set of Android dependencies (libraries) specified by a + project's `*Dependencies.xml` files. + - Run `download_artifacts.gradle` with Gradle to resolve conflicts and, + if successful, download the set of resolved Android libraries (AARs, JARs). + - Process each AAR / JAR so that it can be used with the currently selected + Unity build system (e.g Internal vs. Gradle, Export vs. No Export). + This involves patching each reference to `applicationId` in the + AndroidManifest.xml with the project's bundle ID. This means resolution + must be run if the bundle ID is changed again. + - Move the processed AARs to `Plugins/Android` so they will be included when + Unity invokes the Android build. + +### Integrate into mainTemplate.gradle + +Unity 5.6 introduced support for customizing the `build.gradle` used to build +Unity projects with Gradle. When the *Patch mainTemplate.gradle* setting is +enabled, rather than downloading artifacts before the build, Android resolution +results in the execution of the following operations: + + - Remove the result of previous Android resolutions. + e.g Delete all files and directories labeled with "gpsr" under + `Plugins/Android` from the project and remove sections delimited with + `// Android Resolver * Start` and `// Android Resolver * End` lines. + - Collect the set of Android dependencies (libraries) specified by a + project's `*Dependencies.xml` files. + - Rename any `.srcaar` files in the build to `.aar` and exclude them from + being included directly by Unity in the Android build as + `mainTemplate.gradle` will be patched to include them instead from their + local maven repositories. + - Inject the required Gradle repositories into `mainTemplate.gradle` at the + line matching the pattern + `.*apply plugin: 'com\.android\.(application|library)'.*` or the section + starting at the line `// Android Resolver Repos Start`. + If you want to control the injection point in the file, the section + delimited by the lines `// Android Resolver Repos Start` and + `// Android Resolver Repos End` should be placed in the global scope + before the `dependencies` section. + - Inject the required Android dependencies (libraries) into + `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or + the section starting at the line `// Android Resolver Dependencies Start`. + If you want to control the injection point in the file, the section + delimited by the lines `// Android Resolver Dependencies Start` and + `// Android Resolver Dependencies End` should be placed in the + `dependencies` section. + - Inject the packaging options logic, which excludes architecture specific + libraries based upon the selected build target, into `mainTemplate.gradle` + at the line matching the pattern `android +{` or the section starting at + the line `// Android Resolver Exclusions Start`. + If you want to control the injection point in the file, the section + delimited by the lines `// Android Resolver Exclusions Start` and + `// Android Resolver Exclusions End` should be placed in the global + scope before the `android` section. + +## Dependency Tracking + +The Android Resolver creates the +`ProjectSettings/AndroidResolverDependencies.xml` to quickly determine the set +of resolved dependencies in a project. This is used by the auto-resolution +process to only run the expensive resolution process when necessary. + +## Displaying Dependencies + +It's possible to display the set of dependencies the Android Resolver +would download and process in your project via the +`Assets > External Dependency Manager > Android Resolver > Display Libraries` +menu item. + +# iOS Resolver Usage + +The iOS resolver component of this plugin manages +[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and +the `pod` tool is executed as a post build process step to add dependencies +to the Xcode project exported by Unity. + +Dependencies for iOS are added by referring to CocoaPods. + + 1. Add the `external-dependency-manager-*.unitypackage` to your plugin + project (assuming you are developing a plugin). If you are redistributing + EDM4U with your plugin, you **must** follow the + import steps in the [Getting Started](#getting-started) section! + + 2. Copy and rename the + [SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) + file into your plugin and add the dependencies your plugin requires. + + The XML file just needs to be under an `Editor` directory and match the + name `*Dependencies.xml`. For example, + `MyPlugin/Editor/MyPluginDependencies.xml`. + + 3. Follow the steps in the [Getting Started](#getting-started) + section when you are exporting your plugin package. + +For example, to add the AdMob pod, version 7.0 or greater with bitcode enabled: + +``` + + + + + +``` + +## Integration Strategies + +The `CocoaPods` are either: + * Downloaded and injected into the Xcode project file directly, rather than + creating a separate xcworkspace. We call this `Xcode project` integration. + * If the Unity version supports opening a xcworkspace file, the `pod` tool + is used as intended to generate a xcworkspace which references the + CocoaPods. We call this `Xcode workspace` integration. + +The resolution strategy can be changed via the +`Assets > External Dependency Manager > iOS Resolver > Settings` menu. + +### Appending text to generated Podfile +In order to modify the generated Podfile you can create a script like this: +``` +using System.IO; +public class PostProcessIOS : MonoBehaviour { +[PostProcessBuildAttribute(45)]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50) +private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) +{ + if (target == BuildTarget.iOS) + { + + using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + { + //in this example I'm adding an app extension + sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + } + } +} +``` + +# Package Manager Resolver Usage + +Adding registries to the +[Package Manager](https://docs.unity3d.com/Manual/Packages.html) +(PM) is a manual process. The Package Manager Resolver (PMR) component +of this plugin makes it easy for plugin maintainers to distribute new PM +registry servers and easy for plugin users to manage PM registry servers. + +## Adding Registries + + 1. Add the `external-dependency-manager-*.unitypackage` to your plugin + project (assuming you are developing a plugin). If you are redistributing + EDM4U with your plugin, you **must** follow the + import steps in the [Getting Started](#getting-started) section! + + 2. Copy and rename the + [SampleRegistries.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/sample/Assets/ExternalDependencyManager/Editor/SampleRegistries.xml) + file into your plugin and add the registries your plugin requires. + + The XML file just needs to be under an `Editor` directory and match the + name `*Registries.xml` or labeled with `gumpr_registries`. For example, + `MyPlugin/Editor/MyPluginRegistries.xml`. + + 3. Follow the steps in the [Getting Started](#getting-started) + section when you are exporting your plugin package. + +For example, to add a registry for plugins in the scope `com.coolstuff`: + +``` + + + + com.coolstuff + + + +``` + +When PMR is loaded it will prompt the developer to add the registry to their +project if it isn't already present in the `Packages/manifest.json` file. + +For more information, see Unity's documentation on +[scoped package registries](https://docs.unity3d.com/Manual/upm-scoped.html). + +## Managing Registries + +It's possible to add and remove registries that are specified via PMR +XML configuration files via the following menu options: + +* `Assets > External Dependency Manager > Package Manager Resolver > + Add Registries` will prompt the user with a window which allows them to + add registries discovered in the project to the Package Manager. +* `Assets > External Dependency Manager > Package Manager Resolver > + Remove Registries` will prompt the user with a window which allows them to + remove registries discovered in the project from the Package Manager. +* `Assets > External Dependency Manager > Package Manager Resolver > + Modify Registries` will prompt the user with a window which allows them to + add or remove registries discovered in the project. + +## Migration + +PMR can migrate Version Handler packages installed in the `Assets` folder +to PM packages. This requires the plugins to implement the following: + +* `.unitypackage` must include a Version Handler manifests that describes + the components of the plugin. If the plugin has no dependencies + the manifest would just include the files in the plugin. +* The PM package JSON provided by the registry must include a keyword + (in the `versions.VERSION.keyword` list) that maps the PM package + to a Version Handler package using the format + `vh-name:VERSION_HANDLER_MANIFEST_NAME` where `VERSION_HANDLER_MANIFEST_NAME` + is the name of the manifest defined in the `.unitypackage`. For + more information see the description of the `gvhp_manifestname` asset label + in the *Version Handler Usage* section. + +When using the `Assets > External Dependency Manager > +Package Manager Resolver > Migrate Packages` menu option, PMR then +will: + +* List all Version Handler manager packages in the project. +* Search all available packages in the PM registries and fetch keywords + associated with each package parsing the Version Handler manifest names + for each package. +* Map each installed Version Handler package to a PM package. +* Prompt the user to migrate the discovered packages. +* Perform package migration for all selected packages if the user clicks + the `Apply` button. + +## Configuration + +PMR can be configured via the `Assets > External Dependency Manager > +Package Manager Resolver > Settings` menu option: + +* `Add package registries` when enabled, when the plugin loads or registry + configuration files change, this will prompt the user to add registries + that are not present in the Package Manager. +* `Prompt to add package registries` will cause a developer to be prompted + with a window that will ask for confirmation before adding registries. + When this is disabled registries are added silently to the project. +* `Prompt to migrate packages` will cause a developer to be prompted + with a window that will ask for confirmation before migrating packages + installed in the `Assets` directory to PM packages. +* `Enable Analytics Reporting` when enabled, reports the use of the plugin + to the developers so they can make imrpovements. +* `Verbose logging` when enabled prints debug information to the console + which can be useful when filing bug reports. + +# Version Handler Usage + +The Version Handler component of this plugin manages: + +* Shared Unity plugin dependencies. +* Upgrading Unity plugins by cleaning up old files from previous versions. +* Uninstallation of plugins that are distributed with manifest files. +* Restoration of plugin assets to their original install locations if assets + are tagged with the `exportpath` label. + +Since the Version Handler needs to modify Unity asset metadata (`.meta` files), +to enable / disable components, rename and delete asset files it does not +work with Package Manager installed packages. It's still possible to +include EDM4U in Package Manager packages, the Version Handler component +simply won't do anything to PM plugins in this case. + +## Using Version Handler Managed Plugins + +If a plugin is imported at multiple different versions into a project, if +the Version Handler is enabled, it will automatically check all managed +assets to determine the set of assets that are out of date and assets that +should be removed. To disable automatic checking managed assets disable +the `Enable version management` option in the +`Assets > External Dependency Manager > Version Handler > Settings` menu. + +If version management is disabled, it's possible to check managed assets +manually using the +`Assets > External Dependency Manager > Version Handler > Update` menu option. + +### Listing Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, +can displayed using the `Assets > External Dependency Manager > +Version Handler > Display Managed Packages` menu option. The list of plugins +are written to the console window along with the set of files used by each +plugin. + +### Uninstalling Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, +can be removed using the `Assets > External Dependency Manager > +Version Handler > Uninstall Managed Packages` menu option. This operation +will display a window that allows a developer to select a set of plugins to +remove which will remove all files owned by each plugin excluding those that +are in use by other installed plugins. + +Files managed by the Version Handler, those labeled with the `gvh` asset label, +can be checked to see whether anything needs to be upgraded, disabled or +removed using the `Assets > External Dependency Manager > +Version Handler > Update` menu option. + +### Restore Install Paths + +Some developers move assets around in their project which can make it +harder for plugin maintainers to debug issues if this breaks Unity's +[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. +If assets are labeled with their original install / export path +(see `gvhp_exportpath` below), Version Handler can restore assets to their +original locations when using the `Assets > External Dependency Manager > +Version Handler > Move Files To Install Locations` menu option. + +### Settings + +Some behavior of the Version Handler can be configured via the +`Assets > External Dependency Manager > Version Handler > Settings` menu +option. + +* `Enable version management` controls whether the plugin should automatically + check asset versions and apply changes. If this is disabled the process + should be run manually when installing or upgrading managed plugins using + `Assets > External Dependency Manager > Version Handler > Update`. +* `Rename to canonical filenames` is a legacy option that will rename files to + remove version numbers and other labels from filenames. +* `Prompt for obsolete file deletion` enables the display of a window when + obsolete files are deleted allowing the developer to select which files to + delete and those to keep. +* `Allow disabling files via renaming` controls whether obsolete or disabled + files should be disabled by renaming them to `myfilename_DISABLED`. + Renaming to disable files is required in some scenarios where Unity doesn't + support removing files from the build via the PluginImporter. +* `Enable Analytics Reporting` enables / disables usage reporting to plugin + developers to improve the product. +* `Verbose logging` enables _very_ noisy log output that is useful for + debugging while filing a bug report or building a new managed plugin. +* `Use project settings` saves settings for the plugin in the project rather + than system-wide. + +## Redistributing a Managed Plugin + +The Version Handler employs a couple of methods for managing version +selection, upgrade and removal of plugins. + +* Each plugin can ship with a manifest file that lists the files it includes. + This makes it possible for Version Handler to calculate the difference + in assets between the most recent release of a plugin and the previous + release installed in a project. If a files are removed the Version Handler + will prompt the user to clean up obsolete files. +* Plugins can ship using assets with unique names, unique GUIDs and version + number labels. Version numbers can be attached to assets using labels or + added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). + This allows the Version Handler to determine which set of files are the + same file at different versions, select the most recent version and prompt + the developer to clean up old versions. + +Unity plugins can be managed by the Version Handler using the following steps: + + 1. Add the `gvh` asset label to each asset (file) you want Version Handler + to manage. + 1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the + version of the plugin you're releasing (e.g 1.2.3). + 1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the + export path of the file when the `.unitypackage` is created. This is + used to track files if they're moved around in a project by developers. + 1. Optional: Add `gvh_targets-editor` label to each editor DLL in your + plugin and disable `editor` as a target platform for the DLL. + The Version Handler will enable the most recent version of this DLL when + the plugin is imported. + 1. Optional: If your plugin is included in other Unity plugins, you should + add the version number to each filename and change the GUID of each asset. + This allows multiple versions of your plugin to be imported into a Unity + project, with the Version Handler component activating only the most + recent version. + 1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` + that lists all the files in your plugin relative to the project root. + Then add the `gvh_manifest` label to the asset to indicate this file is + a plugin manifest. + 1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file + to provide a human readable name for your package. If this isn't provided + the name of the manifest file will be used as the package name. + NAME can match the pattern `[0-9]+[a-zA-Z -]' where a leading integer + will set the priority of the name where `0` is the highest priority + and preferably used as the display name. The lowest value (i.e highest + priority name) will be used as the display name and all other specified + names will be aliases of the display name. Aliases can refer to previous + names of the package allowing renaming across published versions. + 1. Redistribute EDM4U Unity plugin with your plugin. + See the [Plugin Redistribution](#plugin-redistribution) for the details. + +If you follow these steps: + + * When users import a newer version of your plugin, files referenced by the + older version's manifest are cleaned up. + * The latest version of the plugin will be selected when users import + multiple packages that include your plugin, assuming the steps in + [Plugin Redistribution](#plugin-redistribution) are followed. + +# Building from Source + +To build this plugin from source you need the following tools installed: + * Unity (with iOS and Android modules installed) + +You can build the plugin by running the following from your shell +(Linux / OSX): + +``` +./gradlew build +``` + +or Windows: + +``` +./gradlew.bat build +``` + +# Releasing + +Each time a new build of this plugin is checked into the source tree you +need to do the following: + + * Bump the plugin version variable `pluginVersion` in `build.gradle` + * Update `CHANGELOG.md` with the new version number and changes included in + the release. + * Build the release using `./gradlew release` which performs the following: + * Updates `external-dependency-manager-*.unitypackage` + * Copies the unpacked plugin to the `exploded` directory. + * Updates template metadata files in the `plugin` directory. + The GUIDs of all asset metadata is modified due to the version number + change. Each file within the plugin is versioned to allow multiple + versions of the plugin to be imported into a Unity project which allows + the most recent version to be activated by the Version Handler + component. + * Create release commit using `./gradlew gitCreateReleaseCommit` which + performs `git commit -a -m "description from CHANGELOG.md"` + * Once the release commit is merge, tag the release using + `./gradlew gitTagRelease` which performs the following: + * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. + * Update tags on remote branch using `git push --tag REMOTE HEAD:master` diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/README.md.meta b/popcorn/Assets/ExternalDependencyManager/Editor/README.md.meta new file mode 100644 index 00000000..fb6594e7 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 046625c64f6614014b29265dc01461c1 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.164_manifest.txt b/popcorn/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.164_manifest.txt new file mode 100644 index 00000000..9ced6bc8 --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.164_manifest.txt @@ -0,0 +1,13 @@ +Assets/ExternalDependencyManager/Editor/CHANGELOG.md +Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll +Assets/ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.164.dll.mdb +Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll +Assets/ExternalDependencyManager/Editor/Google.JarResolver_v1.2.164.dll.mdb +Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll +Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver_v1.2.164.dll.mdb +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb +Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll +Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.164.dll.mdb +Assets/ExternalDependencyManager/Editor/LICENSE +Assets/ExternalDependencyManager/Editor/README.md diff --git a/popcorn/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.164_manifest.txt.meta b/popcorn/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.164_manifest.txt.meta new file mode 100644 index 00000000..fd432a3b --- /dev/null +++ b/popcorn/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.164_manifest.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 102cb82df4d3147bf867693f29bc5a03 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource.meta b/popcorn/Assets/IronSource.meta new file mode 100644 index 00000000..1553f976 --- /dev/null +++ b/popcorn/Assets/IronSource.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8de7dc06d234246b388388a6760b3342 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/DemoScene.meta b/popcorn/Assets/IronSource/DemoScene.meta new file mode 100644 index 00000000..fe62dcc9 --- /dev/null +++ b/popcorn/Assets/IronSource/DemoScene.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 50d65beef4907445493567daa5ba2ecf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/DemoScene/IronSourceDemo.unity b/popcorn/Assets/IronSource/DemoScene/IronSourceDemo.unity new file mode 100644 index 00000000..a75afcc7 --- /dev/null +++ b/popcorn/Assets/IronSource/DemoScene/IronSourceDemo.unity @@ -0,0 +1,546 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &144620207 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 144620210} + - component: {fileID: 144620209} + - component: {fileID: 144620208} + - component: {fileID: 144620211} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &144620208 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144620207} + m_Enabled: 1 +--- !u!20 &144620209 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144620207} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.9487362, g: 0.9613346, b: 0.9811321, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_GateFitMode: 2 + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &144620210 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144620207} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1974370200} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &144620211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 144620207} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 191f5798a75bd42589f98898505e981f, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &484534187 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 484534191} + - component: {fileID: 484534190} + - component: {fileID: 484534189} + - component: {fileID: 484534188} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &484534188 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 484534187} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &484534189 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 484534187} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!223 &484534190 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 484534187} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &484534191 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 484534187} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &498045477 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 498045479} + - component: {fileID: 498045478} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &498045478 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 498045477} + m_Enabled: 1 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &498045479 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 498045477} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &910476656 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 910476659} + - component: {fileID: 910476658} + - component: {fileID: 910476657} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &910476657 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 910476656} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &910476658 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 910476656} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &910476659 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 910476656} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1488306033 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1488306034} + - component: {fileID: 1488306036} + - component: {fileID: 1488306035} + m_Layer: 5 + m_Name: RawImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1488306034 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1488306033} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1974370200} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -117} + m_SizeDelta: {x: 500, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1488306035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1488306033} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -98529514, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 2800000, guid: 5e326581693fd4e0db4c590543c3edc4, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &1488306036 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1488306033} + m_CullTransparentMesh: 0 +--- !u!1 &1974370199 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1974370200} + - component: {fileID: 1974370203} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1974370200 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1974370199} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1488306034} + m_Father: {fileID: 144620210} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &1974370203 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1974370199} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 diff --git a/popcorn/Assets/IronSource/DemoScene/IronSourceDemo.unity.meta b/popcorn/Assets/IronSource/DemoScene/IronSourceDemo.unity.meta new file mode 100644 index 00000000..cc9401e3 --- /dev/null +++ b/popcorn/Assets/IronSource/DemoScene/IronSourceDemo.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ccc0ac08126704384bdda74c26d99797 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/DemoScene/IronSourceDemoScript.cs b/popcorn/Assets/IronSource/DemoScene/IronSourceDemoScript.cs new file mode 100644 index 00000000..f1478258 --- /dev/null +++ b/popcorn/Assets/IronSource/DemoScene/IronSourceDemoScript.cs @@ -0,0 +1,427 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + + +// Example for IronSource Unity. +public class IronSourceDemoScript : MonoBehaviour +{ + + + + public void Start() + { + +#if UNITY_ANDROID + string appKey = "85460dcd"; +#elif UNITY_IPHONE + string appKey = "8545d445"; +#else + string appKey = "unexpected_platform"; +#endif + + + + Debug.Log("unity-script: IronSource.Agent.validateIntegration"); + IronSource.Agent.validateIntegration(); + + Debug.Log("unity-script: unity version" + IronSource.unityVersion()); + + // SDK init + Debug.Log("unity-script: IronSource.Agent.init"); + IronSource.Agent.init(appKey); + + } + + void OnEnable() + { + + //Add Rewarded Video Events + IronSourceEvents.onRewardedVideoAdOpenedEvent += RewardedVideoAdOpenedEvent; + IronSourceEvents.onRewardedVideoAdClosedEvent += RewardedVideoAdClosedEvent; + IronSourceEvents.onRewardedVideoAvailabilityChangedEvent += RewardedVideoAvailabilityChangedEvent; + IronSourceEvents.onRewardedVideoAdStartedEvent += RewardedVideoAdStartedEvent; + IronSourceEvents.onRewardedVideoAdEndedEvent += RewardedVideoAdEndedEvent; + IronSourceEvents.onRewardedVideoAdRewardedEvent += RewardedVideoAdRewardedEvent; + IronSourceEvents.onRewardedVideoAdShowFailedEvent += RewardedVideoAdShowFailedEvent; + IronSourceEvents.onRewardedVideoAdClickedEvent += RewardedVideoAdClickedEvent; + + //Add Rewarded Video DemandOnly Events + IronSourceEvents.onRewardedVideoAdOpenedDemandOnlyEvent += RewardedVideoAdOpenedDemandOnlyEvent; + IronSourceEvents.onRewardedVideoAdClosedDemandOnlyEvent += RewardedVideoAdClosedDemandOnlyEvent; + IronSourceEvents.onRewardedVideoAdLoadedDemandOnlyEvent += RewardedVideoAdLoadedDemandOnlyEvent; + IronSourceEvents.onRewardedVideoAdRewardedDemandOnlyEvent += RewardedVideoAdRewardedDemandOnlyEvent; + IronSourceEvents.onRewardedVideoAdShowFailedDemandOnlyEvent += RewardedVideoAdShowFailedDemandOnlyEvent; + IronSourceEvents.onRewardedVideoAdClickedDemandOnlyEvent += RewardedVideoAdClickedDemandOnlyEvent; + IronSourceEvents.onRewardedVideoAdLoadFailedDemandOnlyEvent += RewardedVideoAdLoadFailedDemandOnlyEvent; + + + // Add Offerwall Events + IronSourceEvents.onOfferwallClosedEvent += OfferwallClosedEvent; + IronSourceEvents.onOfferwallOpenedEvent += OfferwallOpenedEvent; + IronSourceEvents.onOfferwallShowFailedEvent += OfferwallShowFailedEvent; + IronSourceEvents.onOfferwallAdCreditedEvent += OfferwallAdCreditedEvent; + IronSourceEvents.onGetOfferwallCreditsFailedEvent += GetOfferwallCreditsFailedEvent; + IronSourceEvents.onOfferwallAvailableEvent += OfferwallAvailableEvent; + + + // Add Interstitial Events + IronSourceEvents.onInterstitialAdReadyEvent += InterstitialAdReadyEvent; + IronSourceEvents.onInterstitialAdLoadFailedEvent += InterstitialAdLoadFailedEvent; + IronSourceEvents.onInterstitialAdShowSucceededEvent += InterstitialAdShowSucceededEvent; + IronSourceEvents.onInterstitialAdShowFailedEvent += InterstitialAdShowFailedEvent; + IronSourceEvents.onInterstitialAdClickedEvent += InterstitialAdClickedEvent; + IronSourceEvents.onInterstitialAdOpenedEvent += InterstitialAdOpenedEvent; + IronSourceEvents.onInterstitialAdClosedEvent += InterstitialAdClosedEvent; + + // Add Interstitial DemandOnly Events + IronSourceEvents.onInterstitialAdReadyDemandOnlyEvent += InterstitialAdReadyDemandOnlyEvent; + IronSourceEvents.onInterstitialAdLoadFailedDemandOnlyEvent += InterstitialAdLoadFailedDemandOnlyEvent; + IronSourceEvents.onInterstitialAdShowFailedDemandOnlyEvent += InterstitialAdShowFailedDemandOnlyEvent; + IronSourceEvents.onInterstitialAdClickedDemandOnlyEvent += InterstitialAdClickedDemandOnlyEvent; + IronSourceEvents.onInterstitialAdOpenedDemandOnlyEvent += InterstitialAdOpenedDemandOnlyEvent; + IronSourceEvents.onInterstitialAdClosedDemandOnlyEvent += InterstitialAdClosedDemandOnlyEvent; + + + // Add Banner Events + IronSourceEvents.onBannerAdLoadedEvent += BannerAdLoadedEvent; + IronSourceEvents.onBannerAdLoadFailedEvent += BannerAdLoadFailedEvent; + IronSourceEvents.onBannerAdClickedEvent += BannerAdClickedEvent; + IronSourceEvents.onBannerAdScreenPresentedEvent += BannerAdScreenPresentedEvent; + IronSourceEvents.onBannerAdScreenDismissedEvent += BannerAdScreenDismissedEvent; + IronSourceEvents.onBannerAdLeftApplicationEvent += BannerAdLeftApplicationEvent; + + //Add ImpressionSuccess Event + IronSourceEvents.onImpressionSuccessEvent += ImpressionSuccessEvent; + } + + void OnApplicationPause(bool isPaused) + { + Debug.Log("unity-script: OnApplicationPause = " + isPaused); + IronSource.Agent.onApplicationPause(isPaused); + } + + public void OnGUI() + { + + GUI.backgroundColor = Color.blue; + GUI.skin.button.fontSize = (int)(0.035f * Screen.width); + + + + + + Rect showRewardedVideoButton = new Rect(0.10f * Screen.width, 0.15f * Screen.height, 0.80f * Screen.width, 0.08f * Screen.height); + if (GUI.Button(showRewardedVideoButton, "Show Rewarded Video")) + { + Debug.Log("unity-script: ShowRewardedVideoButtonClicked"); + if (IronSource.Agent.isRewardedVideoAvailable()) + { + IronSource.Agent.showRewardedVideo(); + } + else + { + Debug.Log("unity-script: IronSource.Agent.isRewardedVideoAvailable - False"); + } + } + + + + Rect showOfferwallButton = new Rect(0.10f * Screen.width, 0.25f * Screen.height, 0.80f * Screen.width, 0.08f * Screen.height); + if (GUI.Button(showOfferwallButton, "Show Offerwall")) + { + if (IronSource.Agent.isOfferwallAvailable()) + { + IronSource.Agent.showOfferwall(); + } + else + { + Debug.Log("IronSource.Agent.isOfferwallAvailable - False"); + } + } + + Rect loadInterstitialButton = new Rect(0.10f * Screen.width, 0.35f * Screen.height, 0.35f * Screen.width, 0.08f * Screen.height); + if (GUI.Button(loadInterstitialButton, "Load Interstitial")) + { + Debug.Log("unity-script: LoadInterstitialButtonClicked"); + IronSource.Agent.loadInterstitial(); + } + + Rect showInterstitialButton = new Rect(0.55f * Screen.width, 0.35f * Screen.height, 0.35f * Screen.width, 0.08f * Screen.height); + if (GUI.Button(showInterstitialButton, "Show Interstitial")) + { + Debug.Log("unity-script: ShowInterstitialButtonClicked"); + if (IronSource.Agent.isInterstitialReady()) + { + IronSource.Agent.showInterstitial(); + } + else + { + Debug.Log("unity-script: IronSource.Agent.isInterstitialReady - False"); + } + } + + Rect loadBannerButton = new Rect(0.10f * Screen.width, 0.45f * Screen.height, 0.35f * Screen.width, 0.08f * Screen.height); + if (GUI.Button(loadBannerButton, "Load Banner")) + { + Debug.Log("unity-script: loadBannerButtonClicked"); + IronSource.Agent.loadBanner(IronSourceBannerSize.BANNER, IronSourceBannerPosition.BOTTOM); + } + + Rect destroyBannerButton = new Rect(0.55f * Screen.width, 0.45f * Screen.height, 0.35f * Screen.width, 0.08f * Screen.height); + if (GUI.Button(destroyBannerButton, "Destroy Banner")) + { + Debug.Log("unity-script: loadBannerButtonClicked"); + IronSource.Agent.destroyBanner(); + } + + + + + } + + + #region RewardedAd callback handlers + + void RewardedVideoAvailabilityChangedEvent(bool canShowAd) + { + Debug.Log("unity-script: I got RewardedVideoAvailabilityChangedEvent, value = " + canShowAd); + } + + void RewardedVideoAdOpenedEvent() + { + Debug.Log("unity-script: I got RewardedVideoAdOpenedEvent"); + } + + void RewardedVideoAdRewardedEvent(IronSourcePlacement ssp) + { + Debug.Log("unity-script: I got RewardedVideoAdRewardedEvent, amount = " + ssp.getRewardAmount() + " name = " + ssp.getRewardName()); + + } + + void RewardedVideoAdClosedEvent() + { + Debug.Log("unity-script: I got RewardedVideoAdClosedEvent"); + } + + void RewardedVideoAdStartedEvent() + { + Debug.Log("unity-script: I got RewardedVideoAdStartedEvent"); + } + + void RewardedVideoAdEndedEvent() + { + Debug.Log("unity-script: I got RewardedVideoAdEndedEvent"); + } + + void RewardedVideoAdShowFailedEvent(IronSourceError error) + { + Debug.Log("unity-script: I got RewardedVideoAdShowFailedEvent, code : " + error.getCode() + ", description : " + error.getDescription()); + } + + void RewardedVideoAdClickedEvent(IronSourcePlacement ssp) + { + Debug.Log("unity-script: I got RewardedVideoAdClickedEvent, name = " + ssp.getRewardName()); + } + + /************* RewardedVideo DemandOnly Delegates *************/ + + void RewardedVideoAdLoadedDemandOnlyEvent(string instanceId) + { + + Debug.Log("unity-script: I got RewardedVideoAdLoadedDemandOnlyEvent for instance: " + instanceId); + } + + void RewardedVideoAdLoadFailedDemandOnlyEvent(string instanceId, IronSourceError error) + { + + Debug.Log("unity-script: I got RewardedVideoAdLoadFailedDemandOnlyEvent for instance: " + instanceId + ", code : " + error.getCode() + ", description : " + error.getDescription()); + } + + void RewardedVideoAdOpenedDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got RewardedVideoAdOpenedDemandOnlyEvent for instance: " + instanceId); + } + + void RewardedVideoAdRewardedDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got RewardedVideoAdRewardedDemandOnlyEvent for instance: " + instanceId); + } + + void RewardedVideoAdClosedDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got RewardedVideoAdClosedDemandOnlyEvent for instance: " + instanceId); + } + + void RewardedVideoAdShowFailedDemandOnlyEvent(string instanceId, IronSourceError error) + { + Debug.Log("unity-script: I got RewardedVideoAdShowFailedDemandOnlyEvent for instance: " + instanceId + ", code : " + error.getCode() + ", description : " + error.getDescription()); + } + + void RewardedVideoAdClickedDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got RewardedVideoAdClickedDemandOnlyEvent for instance: " + instanceId); + } + + + #endregion + + + + #region Interstitial callback handlers + + void InterstitialAdReadyEvent() + { + Debug.Log("unity-script: I got InterstitialAdReadyEvent"); + } + + void InterstitialAdLoadFailedEvent(IronSourceError error) + { + Debug.Log("unity-script: I got InterstitialAdLoadFailedEvent, code: " + error.getCode() + ", description : " + error.getDescription()); + } + + void InterstitialAdShowSucceededEvent() + { + Debug.Log("unity-script: I got InterstitialAdShowSucceededEvent"); + } + + void InterstitialAdShowFailedEvent(IronSourceError error) + { + Debug.Log("unity-script: I got InterstitialAdShowFailedEvent, code : " + error.getCode() + ", description : " + error.getDescription()); + } + + void InterstitialAdClickedEvent() + { + Debug.Log("unity-script: I got InterstitialAdClickedEvent"); + } + + void InterstitialAdOpenedEvent() + { + Debug.Log("unity-script: I got InterstitialAdOpenedEvent"); + } + + void InterstitialAdClosedEvent() + { + Debug.Log("unity-script: I got InterstitialAdClosedEvent"); + } + + /************* Interstitial DemandOnly Delegates *************/ + + void InterstitialAdReadyDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got InterstitialAdReadyDemandOnlyEvent for instance: " + instanceId); + } + + void InterstitialAdLoadFailedDemandOnlyEvent(string instanceId, IronSourceError error) + { + Debug.Log("unity-script: I got InterstitialAdLoadFailedDemandOnlyEvent for instance: " + instanceId + ", error code: " + error.getCode() + ",error description : " + error.getDescription()); + } + + void InterstitialAdShowFailedDemandOnlyEvent(string instanceId, IronSourceError error) + { + Debug.Log("unity-script: I got InterstitialAdShowFailedDemandOnlyEvent for instance: " + instanceId + ", error code : " + error.getCode() + ",error description : " + error.getDescription()); + } + + void InterstitialAdClickedDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got InterstitialAdClickedDemandOnlyEvent for instance: " + instanceId); + } + + void InterstitialAdOpenedDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got InterstitialAdOpenedDemandOnlyEvent for instance: " + instanceId); + } + + void InterstitialAdClosedDemandOnlyEvent(string instanceId) + { + Debug.Log("unity-script: I got InterstitialAdClosedDemandOnlyEvent for instance: " + instanceId); + } + + + + + #endregion + + #region Banner callback handlers + + void BannerAdLoadedEvent() + { + Debug.Log("unity-script: I got BannerAdLoadedEvent"); + } + + void BannerAdLoadFailedEvent(IronSourceError error) + { + Debug.Log("unity-script: I got BannerAdLoadFailedEvent, code: " + error.getCode() + ", description : " + error.getDescription()); + } + + void BannerAdClickedEvent() + { + Debug.Log("unity-script: I got BannerAdClickedEvent"); + } + + void BannerAdScreenPresentedEvent() + { + Debug.Log("unity-script: I got BannerAdScreenPresentedEvent"); + } + + void BannerAdScreenDismissedEvent() + { + Debug.Log("unity-script: I got BannerAdScreenDismissedEvent"); + } + + void BannerAdLeftApplicationEvent() + { + Debug.Log("unity-script: I got BannerAdLeftApplicationEvent"); + } + + #endregion + + + #region Offerwall callback handlers + + void OfferwallOpenedEvent() + { + Debug.Log("I got OfferwallOpenedEvent"); + } + + void OfferwallClosedEvent() + { + Debug.Log("I got OfferwallClosedEvent"); + } + + void OfferwallShowFailedEvent(IronSourceError error) + { + Debug.Log("I got OfferwallShowFailedEvent, code : " + error.getCode() + ", description : " + error.getDescription()); + } + + void OfferwallAdCreditedEvent(Dictionary dict) + { + Debug.Log("I got OfferwallAdCreditedEvent, current credits = " + dict["credits"] + " totalCredits = " + dict["totalCredits"]); + + } + + void GetOfferwallCreditsFailedEvent(IronSourceError error) + { + Debug.Log("I got GetOfferwallCreditsFailedEvent, code : " + error.getCode() + ", description : " + error.getDescription()); + } + + void OfferwallAvailableEvent(bool canShowOfferwal) + { + Debug.Log("I got OfferwallAvailableEvent, value = " + canShowOfferwal); + + } + + #endregion + + #region ImpressionSuccess callback handler + + void ImpressionSuccessEvent(IronSourceImpressionData impressionData) + { + Debug.Log("unity - script: I got ImpressionSuccessEvent ToString(): " + impressionData.ToString()); + Debug.Log("unity - script: I got ImpressionSuccessEvent allData: " + impressionData.allData); + } + + #endregion + +} diff --git a/popcorn/Assets/IronSource/DemoScene/IronSourceDemoScript.cs.meta b/popcorn/Assets/IronSource/DemoScene/IronSourceDemoScript.cs.meta new file mode 100644 index 00000000..39100480 --- /dev/null +++ b/popcorn/Assets/IronSource/DemoScene/IronSourceDemoScript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 191f5798a75bd42589f98898505e981f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/DemoScene/logo_small.png b/popcorn/Assets/IronSource/DemoScene/logo_small.png new file mode 100644 index 00000000..6dcdd635 Binary files /dev/null and b/popcorn/Assets/IronSource/DemoScene/logo_small.png differ diff --git a/popcorn/Assets/IronSource/DemoScene/logo_small.png.meta b/popcorn/Assets/IronSource/DemoScene/logo_small.png.meta new file mode 100644 index 00000000..22277c17 --- /dev/null +++ b/popcorn/Assets/IronSource/DemoScene/logo_small.png.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: 5e326581693fd4e0db4c590543c3edc4 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor.meta b/popcorn/Assets/IronSource/Editor.meta new file mode 100644 index 00000000..2c91f578 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc06ff225d2634d849a99e2c5f3eca8b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IAdapterSettings.cs b/popcorn/Assets/IronSource/Editor/IAdapterSettings.cs new file mode 100644 index 00000000..efb7a93f --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IAdapterSettings.cs @@ -0,0 +1,10 @@ +using UnityEditor; + +namespace IronSource.Editor +{ + public interface IAdapterSettings + { + void updateProject(BuildTarget buildTarget, string projectPath); + void updateProjectPlist(BuildTarget buildTarget, string plistPath); + } +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Editor/IAdapterSettings.cs.meta b/popcorn/Assets/IronSource/Editor/IAdapterSettings.cs.meta new file mode 100644 index 00000000..72052b7b --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IAdapterSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08c4ce248dc9b4ba2a62a14ef020cc17 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceBuildPostprocessor.cs b/popcorn/Assets/IronSource/Editor/IronSourceBuildPostprocessor.cs new file mode 100644 index 00000000..566eec4e --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceBuildPostprocessor.cs @@ -0,0 +1,88 @@ +#if UNITY_IOS + +using UnityEngine; +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEditor.iOS.Xcode; +using System; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Reflection; + +namespace IronSource.Editor +{ + public class IronSourceBuildPostprocessor + { + [PostProcessBuild] + public static void OnPostprocessBuild (BuildTarget buildTarget, string buildPath) + { + if (buildTarget == BuildTarget.iOS) { + string projectPath = buildPath + "/Unity-iPhone.xcodeproj/project.pbxproj"; + string dirpath = Application.dataPath + "/IronSource/Editor/"; + string currentNamespace = MethodBase.GetCurrentMethod().DeclaringType.Namespace; + + updateProject (buildTarget, projectPath); + + if (Directory.Exists (dirpath)) { + //Match the classes that has "Settings" in their name, and don't start with "I" + var files = Directory.GetFiles (dirpath, "*.cs", SearchOption.TopDirectoryOnly).Where (file => Regex.IsMatch (Path.GetFileName (file), "^(?!(IAdapter|IronSource)).+Settings.*$")); + + //Go over all the adapter settings classes, and call their updateProject method + foreach (string file in files) { + string classname = Path.GetFileNameWithoutExtension (file); + + if (!String.IsNullOrEmpty (classname)) { + IAdapterSettings adapter = (IAdapterSettings)Activator.CreateInstance (Type.GetType (currentNamespace + "." + classname)); + adapter.updateProject (buildTarget, projectPath); + } + } + } + } + + Debug.Log ("IronSource build postprocessor finished"); + } + + private static void updateProject (BuildTarget buildTarget, string projectPath) + { + Debug.Log ("IronSource - Update project for IronSource"); + + PBXProject project = new PBXProject (); + project.ReadFromString (File.ReadAllText (projectPath)); + + string targetId; +#if UNITY_2019_3_OR_NEWER + targetId = project.GetUnityMainTargetGuid(); +#else + targetId = project.TargetGuidByName(PBXProject.GetUnityTargetName()); +#endif + + // Required System Frameworks + project.AddFrameworkToProject (targetId, "AdSupport.framework", false); + project.AddFrameworkToProject (targetId, "AudioToolbox.framework", false); + project.AddFrameworkToProject (targetId, "AVFoundation.framework", false); + project.AddFrameworkToProject (targetId, "CoreGraphics.framework", false); + project.AddFrameworkToProject (targetId, "CoreMedia.framework", false); + project.AddFrameworkToProject (targetId, "CoreTelephony.framework", false); + project.AddFrameworkToProject (targetId, "CoreVideo.framework", false); + project.AddFrameworkToProject (targetId, "CFNetwork.framework", false); + project.AddFrameworkToProject (targetId, "Foundation.framework", false); + project.AddFrameworkToProject (targetId, "MobileCoreServices.framework", false); + project.AddFrameworkToProject (targetId, "QuartzCore.framework", false); + project.AddFrameworkToProject (targetId, "Security.framework", false); + project.AddFrameworkToProject (targetId, "StoreKit.framework", false); + project.AddFrameworkToProject (targetId, "SystemConfiguration.framework", false); + project.AddFrameworkToProject (targetId, "WebKit.framework", false); + + + project.AddFileToBuild (targetId, project.AddFile ("usr/lib/libz.tbd", "Frameworks/libz.tbd", PBXSourceTree.Sdk)); + + // Custom Link Flag + project.AddBuildProperty (targetId, "OTHER_LDFLAGS", "-ObjC"); + + File.WriteAllText (projectPath, project.WriteToString ()); + } + } +} +#endif + diff --git a/popcorn/Assets/IronSource/Editor/IronSourceBuildPostprocessor.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceBuildPostprocessor.cs.meta new file mode 100644 index 00000000..4e768d28 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceBuildPostprocessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 160c30613c17c4bc1a9dfcc2b2663ff4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceDependenciesManager.cs b/popcorn/Assets/IronSource/Editor/IronSourceDependenciesManager.cs new file mode 100644 index 00000000..cc8b34f3 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceDependenciesManager.cs @@ -0,0 +1,558 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using System.Xml; +using IronSourceJSON; +using UnityEditor; +using UnityEngine; +using UnityEngine.Networking; + +public class IronSourceDependenciesManager : EditorWindow +{ + private const string jsonURL = "http://ssa.public.s3.amazonaws.com/Ironsource-Integration-Manager/IronSourceSDKInfo.json"; + private const string ironSourceDownloadDir = "Assets/IronSource/Editor/"; + private const string sdk = "sdk"; + private const string errorMessage = "SDK and adapters data are not available right now. Try again soon."; + private const int Width = 760; + private const int Height = 760; + private const string Android = "Android"; + private const string iOS = "iOS"; + private readonly SortedSet providersSet = new SortedSet(new ProviderInfoComparor()); + private providerInfo ironSourceProviderInfo; + private UnityWebRequest downloadWebClient; + private string messageData; + private IronSourceEditorCoroutines mEditorCoroutines; + + private GUIStyle headerStyle; + private GUIStyle textStyle; + private GUIStyle boldTextStyle; + private readonly GUILayoutOption buttonWidth = GUILayout.Width(90); + + public class providerInfo + { + public Status currentStatues; + public string providerName; + public string currentUnityVersion; + public string latestUnityVersion; + public string downloadURL; + public string displayProviderName; + public bool isNewProvider; + public string fileName; + public Dictionary sdkVersionDic; + + public providerInfo() + { + isNewProvider = false; + fileName = string.Empty; + downloadURL = string.Empty; + currentUnityVersion = "none"; + sdkVersionDic = new Dictionary(); + } + + public enum Status + { + installed = 1, + none = 2, + updated = 3 + } + + public bool GetFromJson(string name, Dictionary dic) + { + providerName = name; + object obj; + + dic.TryGetValue("keyname", out obj); + if (obj != null) + { + this.displayProviderName = obj as string; + } + else this.displayProviderName = providerName; + + dic.TryGetValue("isNewProvider", out obj); + if (obj != null) + { + this.isNewProvider = bool.Parse(obj as string); + } + + //Get Unity versions + if (dic.TryGetValue("Unity", out obj)) + { + Dictionary remoteVersions = obj as Dictionary; + if (remoteVersions != null) + { + if (remoteVersions.TryGetValue("DownloadUrl", out obj)) + { + this.downloadURL = obj as string; + } + if (remoteVersions.TryGetValue("FileName", out obj)) + { + this.fileName = obj as string; + } + if (remoteVersions.TryGetValue("UnityAdapterVersion", out obj)) + { + this.latestUnityVersion = obj as string; + } + } + } + ////Get Android version + if (dic.TryGetValue(Android, out obj)) + { + Dictionary androidVersion = obj as Dictionary; + if (androidVersion != null) + { + androidVersion.TryGetValue("version", out obj); + androidVersion = obj as Dictionary; + if (androidVersion != null) + { + if (androidVersion.TryGetValue(sdk, out obj)) + { + this.sdkVersionDic.Add(Android, obj as string); + } + } + } + } + + //Get iOS version + dic.TryGetValue(iOS, out obj); + Dictionary iosVersion = obj as Dictionary; + if (iosVersion != null) + { + iosVersion.TryGetValue("version", out obj); + iosVersion = obj as Dictionary; + if (iosVersion != null) + { + if (iosVersion.TryGetValue(sdk, out obj)) + { + this.sdkVersionDic.Add(iOS, obj as string); + } + } + } + + currentUnityVersion = GetVersionFromXML(fileName); + + if (currentUnityVersion.Equals("none")) + { + currentStatues = Status.none; + } + + else + { + if (isNewerVersion(currentUnityVersion, latestUnityVersion)) + { + currentStatues = Status.installed; + } + else + { + currentStatues = Status.updated; + } + } + + return true; + } + } + + private static string GetVersionFromXML(string fileName) + { + XmlDocument xmlDoc = new XmlDocument(); + string version = "none"; + try + { + xmlDoc.LoadXml(File.ReadAllText(ironSourceDownloadDir + fileName)); + } + catch (Exception) + { + return version; + } + var unityVersion = xmlDoc.SelectSingleNode("dependencies/unityversion"); + if (unityVersion != null) + { + return (unityVersion.InnerText); + } + File.Delete(ironSourceDownloadDir + fileName); + return version; + } + + private IEnumerator GetVersions() + { + UnityWebRequest unityWebRequest = UnityWebRequest.Get(jsonURL); + var webRequest = unityWebRequest.SendWebRequest(); + + while (!webRequest.isDone) + { + yield return new WaitForSeconds(0.1f); + } + if (!unityWebRequest.isHttpError && !unityWebRequest.isNetworkError) + { + string json = unityWebRequest.downloadHandler.text; + providersSet.Clear(); + ironSourceProviderInfo = new providerInfo(); + Dictionary dic = new Dictionary(); + try + { + dic = Json.Deserialize(json) as Dictionary; + } + + catch (Exception e) + { + Debug.Log("Error getting response " + e.ToString()); + } + if (dic != null && dic.Count != 0) + { + object providersJson; + if (dic.TryGetValue("SDKSInfo", out providersJson)) + { + if (providersJson != null) + { + foreach (var item in providersJson as Dictionary) + { + providerInfo info = new providerInfo(); + if (info.GetFromJson(item.Key, item.Value as Dictionary)) + { + if (item.Key.ToLower().Contains("ironsource")) + { + ironSourceProviderInfo = info; + } + else + { + providersSet.Add(info); + } + } + } + } + } + + if (ironSourceProviderInfo.currentStatues == providerInfo.Status.installed || ironSourceProviderInfo.currentStatues == providerInfo.Status.none) + { + if (dic.TryGetValue("UpdateMessage", out providersJson)) + { + messageData = providersJson.ToString(); + } + } + else + { + if (dic.TryGetValue("LatestMessage", out providersJson)) + { + messageData = providersJson.ToString(); + } + } + } + } + + Repaint(); + } + + private void CancelDownload() + { + // if downloader object is still active + if (downloadWebClient != null) + { + downloadWebClient.Abort(); + return; + } + + if (mEditorCoroutines != null) + { + mEditorCoroutines.StopEditorCoroutine(); + mEditorCoroutines = null; + } + + downloadWebClient = null; + } + + public static void ShowISDependenciesManager() + { + var win = GetWindowWithRect(new Rect(0, 0, Width, Height), true); + win.titleContent = new GUIContent("ironSource Integration Manager"); + win.Focus(); + } + + void Awake() + { + headerStyle = new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold, + fontSize = 14, + fixedHeight = 20, + stretchWidth = true, + fixedWidth = Width / 4 + 5, + clipping = TextClipping.Overflow, + alignment = TextAnchor.MiddleLeft + }; + textStyle = new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Normal, + alignment = TextAnchor.MiddleLeft + + }; + boldTextStyle = new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold + }; + CancelDownload(); + } + + private void OnEnable() + { + mEditorCoroutines = IronSourceEditorCoroutines.StartEditorCoroutine(GetVersions()); + } + + private void OnDestroy() + { + CancelDownload(); + AssetDatabase.Refresh(); + } + + void DrawProviderItem(providerInfo providerData) + { + if (!providerData.Equals(default(providerInfo))) + { + using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false))) + { + GUI.enabled = true; + bool isNew = providerData.isNewProvider; + string isNewAddition = isNew ? " - New Network" : string.Empty; + string androidVersion = ""; + string iosVersion = ""; + string tooltipText = "Latest Version: \n " + providerData.providerName + " Adapter Version " + providerData.latestUnityVersion; + if (!providerData.sdkVersionDic.TryGetValue(Android, out androidVersion)) + { + androidVersion = ""; + } + else tooltipText = tooltipText + "\n Android SDK version " + androidVersion; + if (!providerData.sdkVersionDic.TryGetValue(iOS, out iosVersion)) + { + iosVersion = ""; + } + else tooltipText = tooltipText + "\n iOS SDK version " + iosVersion; + + EditorGUILayout.LabelField(providerData.displayProviderName + isNewAddition, isNew ? boldTextStyle : textStyle); + EditorGUILayout.LabelField(providerData.currentUnityVersion, textStyle); + EditorGUILayout.LabelField(providerData.latestUnityVersion, textStyle); + + if (providerData.currentStatues == providerInfo.Status.none) + { + bool btn = GUILayout.Button(new GUIContent + { + text = "Install", + tooltip = tooltipText + }, buttonWidth); + if (btn && downloadWebClient == null) + { + GUI.enabled = true; + IronSourceEditorCoroutines.StartEditorCoroutine(DownloadFile(providerData.downloadURL)); + } + + } + else if (providerData.currentStatues == providerInfo.Status.installed) + { + var btn = GUILayout.Button(new GUIContent + { + text= "Update", + tooltip = tooltipText + } + ,buttonWidth); + if (btn && downloadWebClient == null) + { + GUI.enabled = true; + IronSourceEditorCoroutines.StartEditorCoroutine(DownloadFile(providerData.downloadURL)); + } + } + else + { + GUI.enabled = false; + GUILayout.Button(new GUIContent + { + text = "Updated", + tooltip = tooltipText + }, buttonWidth); + } + GUILayout.Space(5); + GUI.enabled = true; + } + } + } + + void OnGUI() + { + if (ironSourceProviderInfo == null) + { + GUILayout.Label(errorMessage); + return; + } + + GUILayout.Space(10); + using (new EditorGUILayout.VerticalScope("box")) + { + DrawSDKHeader(); + GUILayout.Space(5); + GUILayout.BeginHorizontal(); + DrawProviderItem(ironSourceProviderInfo); + GUILayout.Space(5); + GUILayout.EndHorizontal(); + GUILayout.Space(5); + } + + GUILayout.Space(15); + DrawAdaptersHeader(); + GUILayout.Space(15); + + foreach (var provider in providersSet) + { + DrawProviderItem(provider); + GUILayout.Space(2); + } + GUILayout.Space(30); + if (!string.IsNullOrEmpty(messageData)) + { + using (new EditorGUILayout.VerticalScope("box", GUILayout.ExpandHeight(true))) + { + GUILayout.Space(5); + using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false))) + { + EditorGUILayout.SelectableLabel(messageData, EditorStyles.textField, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); + } + GUILayout.Space(5); + } + using (new EditorGUILayout.VerticalScope(GUILayout.ExpandHeight(false))) + { + GUILayout.Space(15); + } + } + + } + + private void DrawSDKHeader() + { + using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false))) + { + EditorGUILayout.LabelField("Current SDK Version", new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold, + fontSize = 13, + fixedHeight = 20, + stretchWidth = true, + fixedWidth = Width / 4, + clipping = TextClipping.Overflow, + padding = new RectOffset(Width / 4 + 15, 0, 0, 0) + }); + GUILayout.Space(85); + EditorGUILayout.LabelField("Latest SDK Version", new GUIStyle(EditorStyles.label) + { + fontStyle = FontStyle.Bold, + fontSize = 13, + fixedHeight = 20, + stretchWidth = true, + fixedWidth = Screen.width / 4, + clipping = TextClipping.Overflow, + }); + } + } + + private void DrawAdaptersHeader() + { + using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false))) + { + EditorGUILayout.LabelField("Network", headerStyle); + EditorGUILayout.LabelField("Current Adapter Version", headerStyle); + EditorGUILayout.LabelField("Latest Adapter Version", headerStyle); + GUILayout.Space(30); + EditorGUILayout.LabelField("Action", headerStyle); + } + } + + private IEnumerator DownloadFile(string downloadFileUrl) + { + int fileNameIndex = downloadFileUrl.LastIndexOf("/") + 1; + string downloadFileName = downloadFileUrl.Substring(fileNameIndex); + string fileDownloading = string.Format("Downloading {0}", downloadFileName); + string genericFileName = Regex.Replace(downloadFileName, @"_v+(\d\.\d\.\d\.\d|\d\.\d\.\d)", ""); + string path = Path.Combine(ironSourceDownloadDir, genericFileName); + bool isCancelled = false; + downloadWebClient = new UnityWebRequest(downloadFileUrl); + downloadWebClient.downloadHandler = new DownloadHandlerFile(path); + downloadWebClient.SendWebRequest(); + if (!downloadWebClient.isHttpError && !downloadWebClient.isNetworkError) + { + while (!downloadWebClient.isDone) + { + yield return new WaitForSeconds(0.1f); + if (EditorUtility.DisplayCancelableProgressBar("Download Manager", fileDownloading, downloadWebClient.downloadProgress)) + { + if (downloadWebClient.error != null) + { + Debug.LogError(downloadWebClient.error); + } + CancelDownload(); + isCancelled = true; + } + } + } + else + { + Debug.LogError("Error Downloading " + genericFileName + " : " + downloadWebClient.error); + } + + EditorUtility.ClearProgressBar(); + + if (genericFileName.EndsWith(".unitypackage") && !isCancelled) + { + AssetDatabase.ImportPackage(Path.Combine(ironSourceDownloadDir, genericFileName), true); + } + else + { + // in case the download was cancelled, delete the file + if(isCancelled && File.Exists(ironSourceDownloadDir + genericFileName)) + { + File.Delete(ironSourceDownloadDir + genericFileName); + } + + IronSourceEditorCoroutines.StartEditorCoroutine(GetVersions()); + } + + //clean the downloadWebClient object regardless of whether the request succeeded or failed + downloadWebClient.Dispose(); + downloadWebClient = null; + + IronSourceEditorCoroutines.StartEditorCoroutine(GetVersions()); + } + + private static bool isNewerVersion(string current, string latest) + { + bool isNewer = false; + try + { + int[] currentVersion = Array.ConvertAll(current.Split('.'), int.Parse); + int[] remoteVersion = Array.ConvertAll(latest.Split('.'), int.Parse); + int remoteBuild = 0; + int curBuild = 0; + if (currentVersion.Length > 3) + { + curBuild = currentVersion[3]; + } + if (remoteVersion.Length > 3) + { + remoteBuild = remoteVersion[3]; + + } + System.Version cur = new System.Version(currentVersion[0], currentVersion[1], currentVersion[2], curBuild); + System.Version remote = new System.Version(remoteVersion[0], remoteVersion[1], remoteVersion[2], remoteBuild); + isNewer = cur < remote; + } + catch (Exception) + { + + } + return isNewer; + + } + + internal class ProviderInfoComparor : IComparer + { + public int Compare(providerInfo x, providerInfo y) + { + return x.providerName.CompareTo(y.providerName); + } + } +} diff --git a/popcorn/Assets/IronSource/Editor/IronSourceDependenciesManager.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceDependenciesManager.cs.meta new file mode 100644 index 00000000..1409f7c1 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceDependenciesManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c6e4d9251bd484b8691739732905761c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceEditorCoroutines.cs b/popcorn/Assets/IronSource/Editor/IronSourceEditorCoroutines.cs new file mode 100644 index 00000000..60e26998 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceEditorCoroutines.cs @@ -0,0 +1,37 @@ +using UnityEditor; +using System.Collections; + +public class IronSourceEditorCoroutines +{ + readonly IEnumerator mRoutine; + + public static IronSourceEditorCoroutines StartEditorCoroutine( IEnumerator routine) + { + IronSourceEditorCoroutines coroutine = new IronSourceEditorCoroutines(routine); + coroutine.start(); + return coroutine; + } + + IronSourceEditorCoroutines(IEnumerator routine) + { + mRoutine = routine; + } + + void start() + { + EditorApplication.update += update; + } + + void update() + { + if(!mRoutine.MoveNext()) + { + StopEditorCoroutine(); + } + } + + public void StopEditorCoroutine() + { + EditorApplication.update -= update; + } +} diff --git a/popcorn/Assets/IronSource/Editor/IronSourceEditorCoroutines.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceEditorCoroutines.cs.meta new file mode 100644 index 00000000..31c1a992 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceEditorCoroutines.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 001447b23ecb34541b82b7d1874874d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceManifestProcessor.cs b/popcorn/Assets/IronSource/Editor/IronSourceManifestProcessor.cs new file mode 100644 index 00000000..482cc590 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceManifestProcessor.cs @@ -0,0 +1,134 @@ +#if UNITY_ANDROID +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Xml.Linq; +using UnityEditor; +using UnityEditor.Build; +#if UNITY_2018_1_OR_NEWER +using UnityEditor.Build.Reporting; +#endif +using UnityEngine; + + +#if UNITY_2018_1_OR_NEWER +public class IronSourceManifestProcessor : IPreprocessBuildWithReport +#else +public class IronSourceManifestProcessor : IPreprocessBuild +#endif +{ + private const string META_APPLICATION_ID = "com.google.android.gms.ads.APPLICATION_ID"; + + private XNamespace ns = "http://schemas.android.com/apk/res/android"; + + public int callbackOrder { get { return 0; } } + +#if UNITY_2018_1_OR_NEWER + public void OnPreprocessBuild(BuildReport report) +#else + public void OnPreprocessBuild(BuildTarget target, string path) +#endif + { + if (File.Exists(IronSourceMediatedNetworkSettings.MEDIATION_SETTINGS_ASSET_PATH)) + { + string appId = IronSourceMediatedNetworkSettingsInspector.IronSourceMediatedNetworkSettings.AdmobAndroidAppId; + + if (IronSourceMediatedNetworkSettingsInspector.IronSourceMediatedNetworkSettings.EnableAdmob) + { + string manifestPath = Path.Combine( + Application.dataPath, "IronSource/Plugins/Android/IronSource.plugin/AndroidManifest.xml"); + + XDocument manifest = null; + try + { + manifest = XDocument.Load(manifestPath); + } +#pragma warning disable 0168 + catch (IOException e) +#pragma warning restore 0168 + { + StopBuildWithMessage("AndroidManifest.xml is missing. Try re-importing the plugin."); + } + + XElement elemManifest = manifest.Element("manifest"); + if (elemManifest == null) + { + StopBuildWithMessage("AndroidManifest.xml is not valid. Try re-importing the plugin."); + } + + XElement elemApplication = elemManifest.Element("application"); + if (elemApplication == null) + { + StopBuildWithMessage("AndroidManifest.xml is not valid. Try re-importing the plugin."); + } + + IEnumerable metas = elemApplication.Descendants() + .Where(elem => elem.Name.LocalName.Equals("meta-data")); + + XElement elemAdMobEnabled = GetMetaElement(metas, META_APPLICATION_ID); + + if (appId.Length == 0) + { + StopBuildWithMessage( + "Android AdMob app ID is empty. Please enter your app ID to run ads properly"); + } + else if (!Regex.IsMatch(appId, "^[a-zA-Z0-9-~]*$")) + { + StopBuildWithMessage( + "Android AdMob app ID is not valid. Please enter a valid app ID to run ads properly"); + } + + else if (elemAdMobEnabled == null) + { + elemApplication.Add(CreateMetaElement(META_APPLICATION_ID, appId)); + } + else + { + elemAdMobEnabled.SetAttributeValue(ns + "value", appId); + } + + elemManifest.Save(manifestPath); + } + } + } + + private XElement CreateMetaElement(string name, object value) + { + return new XElement("meta-data", + new XAttribute(ns + "name", name), new XAttribute(ns + "value", value)); + } + + private XElement GetMetaElement(IEnumerable metas, string metaName) + { + foreach (XElement elem in metas) + { + IEnumerable attrs = elem.Attributes(); + foreach (XAttribute attr in attrs) + { + if (attr.Name.Namespace.Equals(ns) + && attr.Name.LocalName.Equals("name") && attr.Value.Equals(metaName)) + { + return elem; + } + } + } + return null; + } + + private void StopBuildWithMessage(string message) + { + string prefix = "[IronSourceApplicationSettings] "; + + EditorUtility.DisplayDialog( + "IronSource Developer Settings", "Error: " + message, "", ""); +#if UNITY_2017_1_OR_NEWER + throw new BuildPlayerWindow.BuildMethodException(prefix + message); +#else + throw new OperationCanceledException(prefix + message); +#endif + } +} + +#endif diff --git a/popcorn/Assets/IronSource/Editor/IronSourceManifestProcessor.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceManifestProcessor.cs.meta new file mode 100644 index 00000000..e9848a62 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceManifestProcessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b63a7ef12abd42eabd7c7b7c8250f83 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettings.cs b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettings.cs new file mode 100644 index 00000000..d1b037e8 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettings.cs @@ -0,0 +1,21 @@ +using System.IO; +using UnityEngine; + +public class IronSourceMediatedNetworkSettings : ScriptableObject +{ + public static readonly string MEDIATION_SETTINGS_ASSET_PATH = Path.Combine(IronSourceConstants.IRONSOURCE_RESOURCES_PATH, IronSourceConstants.IRONSOURCE_MEDIATED_NETWORK_SETTING_NAME + ".asset"); + + [Header("")] + [Header("AdMob Integration")] + [SerializeField] + [Tooltip("This will add AdMob Application ID to AndroidManifest.xml/info.plist")] + public bool EnableAdmob = false; + + [SerializeField] + [Tooltip("This Will be added to your AndroidManifest.xml")] + public string AdmobAndroidAppId = string.Empty; + + [SerializeField] + [Tooltip("This will be added to your info.plist")] + public string AdmobIOSAppId = string.Empty; +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettings.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettings.cs.meta new file mode 100644 index 00000000..98201f61 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6dcd730eacb2043e8a6f1c61c16243da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettingsInspector.cs b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettingsInspector.cs new file mode 100644 index 00000000..273988ca --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettingsInspector.cs @@ -0,0 +1,27 @@ +using System.IO; +using UnityEditor; + +[CustomEditor(typeof(IronSourceMediatedNetworkSettings))] +public class IronSourceMediatedNetworkSettingsInspector : UnityEditor.Editor +{ + private static IronSourceMediatedNetworkSettings ironSourceMediatedNetworkSettings; + public static IronSourceMediatedNetworkSettings IronSourceMediatedNetworkSettings + { + get + { + if (ironSourceMediatedNetworkSettings == null) + { + ironSourceMediatedNetworkSettings = AssetDatabase.LoadAssetAtPath(IronSourceMediatedNetworkSettings.MEDIATION_SETTINGS_ASSET_PATH); + if (ironSourceMediatedNetworkSettings == null) + { + IronSourceMediatedNetworkSettings asset = CreateInstance(); + Directory.CreateDirectory(IronSourceConstants.IRONSOURCE_RESOURCES_PATH); + AssetDatabase.CreateAsset(asset, IronSourceMediatedNetworkSettings.MEDIATION_SETTINGS_ASSET_PATH); + ironSourceMediatedNetworkSettings = asset; + } + } + + return ironSourceMediatedNetworkSettings; + } + } +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettingsInspector.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettingsInspector.cs.meta new file mode 100644 index 00000000..f10008dd --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMediatedNetworkSettingsInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6ddcb1096c420410ead13befae195114 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMediationSettingsInspector.cs b/popcorn/Assets/IronSource/Editor/IronSourceMediationSettingsInspector.cs new file mode 100644 index 00000000..d62f312b --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMediationSettingsInspector.cs @@ -0,0 +1,27 @@ +using System.IO; +using UnityEditor; + +[CustomEditor(typeof(IronSourceMediationSettings))] +public class IronSourceMediationSettingsInspector : UnityEditor.Editor +{ + private static IronSourceMediationSettings ironSourceMediationSettings; + public static IronSourceMediationSettings IronSourceMediationSettings + { + get + { + if (ironSourceMediationSettings == null) + { + ironSourceMediationSettings = AssetDatabase.LoadAssetAtPath(IronSourceMediationSettings.IRONSOURCE_SETTINGS_ASSET_PATH); + if (ironSourceMediationSettings == null) + { + IronSourceMediationSettings asset = CreateInstance(); + Directory.CreateDirectory(IronSourceConstants.IRONSOURCE_RESOURCES_PATH); + AssetDatabase.CreateAsset(asset, IronSourceMediationSettings.IRONSOURCE_SETTINGS_ASSET_PATH); + ironSourceMediationSettings = asset; + } + } + + return ironSourceMediationSettings; + } + } +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMediationSettingsInspector.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceMediationSettingsInspector.cs.meta new file mode 100644 index 00000000..1325fb42 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMediationSettingsInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4a5cecbf374304044822daeaa54c686c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMenu.cs b/popcorn/Assets/IronSource/Editor/IronSourceMenu.cs new file mode 100644 index 00000000..544c45c2 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMenu.cs @@ -0,0 +1,72 @@ +using System.IO; +using UnityEditor; +using UnityEngine; + +public class IronSourceMenu : UnityEditor.Editor +{ + + [MenuItem("IronSource/Documentation", false, 0)] + public static void Documentation() + { + Application.OpenURL("https://developers.ironsrc.com/ironsource-mobile/unity/unity-plugin/"); + } + + + [MenuItem("IronSource/SDK Change Log", false, 1)] + public static void ChangeLog() + { + Application.OpenURL("https://developers.ironsrc.com/ironsource-mobile/unity/sdk-change-log/"); + } + + + [MenuItem("IronSource/Integration Manager", false , 2)] + public static void SdkManagerProd() + { + IronSourceDependenciesManager.ShowISDependenciesManager(); + } + + [MenuItem("IronSource/Developer Settings/IronSource Mediation Settings", false, 3)] + public static void mediationSettings() + { + string path = "Assets/IronSource/Resources"; + + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + + + var ironSourceMediationSettings = Resources.Load(IronSourceConstants.IRONSOURCE_MEDIATION_SETTING_NAME); + if (ironSourceMediationSettings == null) + { + Debug.LogWarning(IronSourceConstants.IRONSOURCE_MEDIATION_SETTING_NAME + " can't be found, creating a new one..."); + ironSourceMediationSettings = CreateInstance(); + AssetDatabase.CreateAsset(ironSourceMediationSettings, IronSourceMediationSettings.IRONSOURCE_SETTINGS_ASSET_PATH); + ironSourceMediationSettings = Resources.Load(IronSourceConstants.IRONSOURCE_MEDIATION_SETTING_NAME); + } + + Selection.activeObject = ironSourceMediationSettings; + } + + [MenuItem("IronSource/Developer Settings/Mediated Network Settings", false, 4)] + public static void mediatedNetworkSettings() + { + string path = IronSourceConstants.IRONSOURCE_RESOURCES_PATH; + + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + + var ironSourceMediatedNetworkSettings = Resources.Load(IronSourceConstants.IRONSOURCE_MEDIATED_NETWORK_SETTING_NAME); + if (ironSourceMediatedNetworkSettings == null) + { + Debug.LogWarning(IronSourceConstants.IRONSOURCE_MEDIATED_NETWORK_SETTING_NAME + " can't be found, creating a new one..."); + ironSourceMediatedNetworkSettings = CreateInstance(); + AssetDatabase.CreateAsset(ironSourceMediatedNetworkSettings, IronSourceMediatedNetworkSettings.MEDIATION_SETTINGS_ASSET_PATH); + ironSourceMediatedNetworkSettings = Resources.Load(IronSourceConstants.IRONSOURCE_MEDIATED_NETWORK_SETTING_NAME); + } + + Selection.activeObject = ironSourceMediatedNetworkSettings; + } +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Editor/IronSourceMenu.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourceMenu.cs.meta new file mode 100644 index 00000000..d7da227f --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceMenu.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70dd99db2841b47fb8709e8e707d714a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourcePlistProcessor.cs b/popcorn/Assets/IronSource/Editor/IronSourcePlistProcessor.cs new file mode 100644 index 00000000..8a81f655 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourcePlistProcessor.cs @@ -0,0 +1,133 @@ + +#if UNITY_IOS || UNITY_IPHONE + +using System.IO; +using UnityEditor.Callbacks; +using UnityEditor; +using System; +using UnityEngine; +using UnityEditor.iOS.Xcode; +using System.Text.RegularExpressions; + +/// +/// PostProcessor script to automatically fill all required dependencies +/// +public class IronSourcePlistProcessor +{ + [PostProcessBuild] + public static void OnPostprocessBuild(BuildTarget buildTarget, string buildPath) + { + if (File.Exists(IronSourceMediationSettings.IRONSOURCE_SETTINGS_ASSET_PATH)) + { + if (buildTarget == BuildTarget.iOS) + { + /* + * PBXProject + */ + string plistPath = Path.Combine(buildPath, "Info.plist"); + PBXProject project = new PBXProject(); + string projectPath = PBXProject.GetPBXProjectPath(buildPath); + project.ReadFromFile(projectPath); + PlistDocument plist = new PlistDocument(); + plist.ReadFromString(File.ReadAllText(plistPath)); + if (plist != null) + { + // Get root + PlistElementDict rootDict = plist.root; + + // Check if SKAdNetworkItems already exists + PlistElementArray SKAdNetworkItems = null; + if (rootDict.values.ContainsKey("SKAdNetworkItems")) + { + try + { + SKAdNetworkItems = rootDict.values["SKAdNetworkItems"] as PlistElementArray; + } + catch (Exception e) + { + Debug.LogWarning(string.Format("Could not obtain SKAdNetworkItems PlistElementArray: {0}", e.Message)); + } + } + + //Add IronSource's SKAdNetwork ID + if (IronSourceMediationSettingsInspector.IronSourceMediationSettings.AddIronsourceSkadnetworkID) + { + // If not exists, create it + if (SKAdNetworkItems == null) + { + SKAdNetworkItems = rootDict.CreateArray("SKAdNetworkItems"); + } + + string plistContent = File.ReadAllText(plistPath); + if (!plistContent.Contains(IronSourceConstants.IRONSOURCE_SKAN_ID_KEY)) + { + PlistElementDict SKAdNetworkIdentifierDict = SKAdNetworkItems.AddDict(); + SKAdNetworkIdentifierDict.SetString("SKAdNetworkIdentifier", IronSourceConstants.IRONSOURCE_SKAN_ID_KEY); + } + } + + + + File.WriteAllText(plistPath, plist.WriteToString()); + } + } + } + if ( File.Exists(IronSourceMediatedNetworkSettings.MEDIATION_SETTINGS_ASSET_PATH)) + { + if (buildTarget == BuildTarget.iOS) + { + /* + * PBXProject + */ + string plistPath = Path.Combine(buildPath, "Info.plist"); + PBXProject project = new PBXProject(); + string projectPath = PBXProject.GetPBXProjectPath(buildPath); + project.ReadFromFile(projectPath); + PlistDocument plist = new PlistDocument(); + plist.ReadFromString(File.ReadAllText(plistPath)); + if (plist != null) + { + // Get root + PlistElementDict rootDict = plist.root; + + + //Adding AdMob App ID to Plist + if (IronSourceMediatedNetworkSettingsInspector.IronSourceMediatedNetworkSettings.EnableAdmob == true) + { + string appId = IronSourceMediatedNetworkSettingsInspector.IronSourceMediatedNetworkSettings.AdmobIOSAppId; + if (appId.Length == 0) + { + StopBuildWithMessage( + "iOS AdMob app ID is empty. Please enter your app ID to run ads properly"); + } + else if (!Regex.IsMatch(appId, "^[a-zA-Z0-9-~]*$")) + { + StopBuildWithMessage( + "iOS AdMob app ID is not valid. Please enter a valid app ID to run ads properly"); + } + else + { + plist.root.SetString("GADApplicationIdentifier", appId); + } + } + + File.WriteAllText(plistPath, plist.WriteToString()); + } + } + } + } + private static void StopBuildWithMessage(string message) + { + string prefix = "[IronSourceApplicationSettings] "; + + EditorUtility.DisplayDialog( + "IronSource Developer Settings", "Error: " + message, "", ""); + +#if UNITY_2017_1_OR_NEWER + throw new BuildPlayerWindow.BuildMethodException(prefix + message); +#else + throw new OperationCanceledException(prefix + message); +#endif + } +} +#endif \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Editor/IronSourcePlistProcessor.cs.meta b/popcorn/Assets/IronSource/Editor/IronSourcePlistProcessor.cs.meta new file mode 100644 index 00000000..053dfb10 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourcePlistProcessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 920ec5e5fa67e48c2a6380c2c2be88fc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Editor/IronSourceSDKDependencies.xml b/popcorn/Assets/IronSource/Editor/IronSourceSDKDependencies.xml new file mode 100644 index 00000000..ff85fd69 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceSDKDependencies.xml @@ -0,0 +1,42 @@ + + 7.1.12 + + + + https://android-sdk.is.com/ + + + + + + + + https://maven.google.com/ + + + + + + + + https://maven.google.com/ + + + + + + + + https://maven.google.com/ + + + + + + + + https://github.com/CocoaPods/Specs + + + + diff --git a/popcorn/Assets/IronSource/Editor/IronSourceSDKDependencies.xml.meta b/popcorn/Assets/IronSource/Editor/IronSourceSDKDependencies.xml.meta new file mode 100644 index 00000000..47a5d3b3 --- /dev/null +++ b/popcorn/Assets/IronSource/Editor/IronSourceSDKDependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d618a278f636e4718b9e6409b1f031eb +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins.meta b/popcorn/Assets/IronSource/Plugins.meta new file mode 100644 index 00000000..34a680b0 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 54543a6abf5c743eebffbdd3ab80a1e7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/Android.meta b/popcorn/Assets/IronSource/Plugins/Android.meta new file mode 100644 index 00000000..61b6d82a --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e68fc23b7584a4aeb9ad1faec8a8708c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin.meta b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin.meta new file mode 100644 index 00000000..f5ce407e --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin.meta @@ -0,0 +1,28 @@ +fileFormatVersion: 2 +guid: f1bc66601864e445e88faef50fa5886c +folderAsset: yes +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/AndroidManifest.xml b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/AndroidManifest.xml new file mode 100644 index 00000000..31f3d214 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/AndroidManifest.xml.meta b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/AndroidManifest.xml.meta new file mode 100644 index 00000000..f896b5c3 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/AndroidManifest.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9632a9cae064644419de54f10c604559 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs.meta b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs.meta new file mode 100644 index 00000000..88150830 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 52c96c6ebd65b44b3858b9ae1afdf87a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar new file mode 100644 index 00000000..a5d2bb2f Binary files /dev/null and b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar differ diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar.meta b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar.meta new file mode 100644 index 00000000..68a69fb4 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/libs/android-bridge.jar.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2dbf0193032a2473098de3a49a1e75f7 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/project.properties b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/project.properties new file mode 100644 index 00000000..823f52e6 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/project.properties @@ -0,0 +1 @@ +android.library=true diff --git a/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/project.properties.meta b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/project.properties.meta new file mode 100644 index 00000000..574798a0 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/Android/IronSource.plugin/project.properties.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 21b205bdddcad4558ab4a0831cb093f2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/iOS.meta b/popcorn/Assets/IronSource/Plugins/iOS.meta new file mode 100644 index 00000000..c03efe27 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d169a20af57cb4a47b056b3317f02f12 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/iOS/IronSourceUnityConfig.m b/popcorn/Assets/IronSource/Plugins/iOS/IronSourceUnityConfig.m new file mode 100644 index 00000000..4209bfc1 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/iOS/IronSourceUnityConfig.m @@ -0,0 +1,78 @@ +// +// iOSBridge +// +// Created by Ori on 5/13/15. +// + +#import +#import +#import + +@interface IronSourceUnityConfig:NSObject +//IronSource +- (void) setClientSideCallbacks:(bool)useClientSideCallbacks; +- (void) setLanguage:(NSString *)language; +- (void) setRewardedVideoCustomParams:(NSString *)rvParams; +- (void) setOfferwallCustomParams:(NSString *)owParams; + +@end + +@implementation IronSourceUnityConfig + +//IronSource +- (void) setClientSideCallbacks:(bool)useClientSideCallbacks { + NSNumber *ucsc = @0; + if (useClientSideCallbacks) + ucsc = @1; + + [ISSupersonicAdsConfiguration configurations].useClientSideCallbacks = ucsc; +} + +- (void) setLanguage:(NSString *)language { + [ISSupersonicAdsConfiguration configurations].language = language; +} + +- (void) setRewardedVideoCustomParams:(NSString *)rvParams { + NSError *jsonError; + NSData *objectData = [rvParams dataUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *json = [NSJSONSerialization JSONObjectWithData:objectData options:NSJSONReadingMutableContainers error:&jsonError]; + if (!jsonError) + [ISConfigurations configurations].rewardedVideoCustomParameters = json; +} + +- (void) setOfferwallCustomParams:(NSString *)owParams { + NSError *jsonError; + NSData *objectData = [owParams dataUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *json = [NSJSONSerialization JSONObjectWithData:objectData options:NSJSONReadingMutableContainers error:&jsonError]; + if (!jsonError) + [ISConfigurations configurations].offerwallCustomParameters = json; +} + + + +#ifdef __cplusplus +extern "C" { +#endif + +#define ParseNSStringParam( _x_ ) ( _x_ != NULL ) ? [NSString stringWithUTF8String:_x_] : [NSString stringWithUTF8String:""] + + //IronSource + void CFSetClientSideCallbacks(bool useClientSideCallbacks){ + [[IronSourceUnityConfig new] setClientSideCallbacks:useClientSideCallbacks]; + } + void CFSetLanguage(const char *language){ + [[IronSourceUnityConfig new] setLanguage:ParseNSStringParam(language)]; + } + void CFSetRewardedVideoCustomParams(const char *rvParams){ + [[IronSourceUnityConfig new] setRewardedVideoCustomParams:ParseNSStringParam(rvParams)]; + } + void CFSetOfferwallCustomParams(const char *owParam){ + [[IronSourceUnityConfig new] setOfferwallCustomParams:ParseNSStringParam(owParam)]; + } + + +#ifdef __cplusplus +} +#endif + +@end diff --git a/popcorn/Assets/IronSource/Plugins/iOS/IronSourceUnityConfig.m.meta b/popcorn/Assets/IronSource/Plugins/iOS/IronSourceUnityConfig.m.meta new file mode 100644 index 00000000..55d7028a --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/iOS/IronSourceUnityConfig.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: e0be82736da5a41d4af2ea3ac34d5ac4 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.h b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.h new file mode 100644 index 00000000..ac825625 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.h @@ -0,0 +1,17 @@ +// +// iOSBridge.h +// iOSBridge +// +// Created by Supersonic. +// Copyright (c) 2015 Supersonic. All rights reserved. +// + +#import +#import +static NSString * UnityGitHash = @"04bfbea"; + +@interface iOSBridge : NSObject + +@end + + diff --git a/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.h.meta b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.h.meta new file mode 100644 index 00000000..1b1aca3a --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 33123db285ad544b59cf1c18d83f66b8 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.m b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.m new file mode 100755 index 00000000..b6f22b15 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.m @@ -0,0 +1,1019 @@ +// +// iOSBridge.m +// iOSBridge +// +// Created by Supersonic. +// Copyright (c) 2015 Supersonic. All rights reserved. +// + +#import "iOSBridge.h" +#import + +// Converts NSString to C style string by way of copy (Mono will free it) +#define MakeStringCopy( _x_ ) ( _x_ != NULL && [_x_ isKindOfClass:[NSString class]] ) ? strdup( [_x_ UTF8String] ) : NULL + +// Converts C style string to NSString +#define GetStringParam( _x_ ) ( _x_ != NULL ) ? [NSString stringWithUTF8String:_x_] : [NSString stringWithUTF8String:""] + +#define BANNER_POSITION_TOP 1 +#define BANNER_POSITION_BOTTOM 2 + +#ifdef __cplusplus +extern "C" { +#endif + + extern void UnitySendMessage( const char *className, const char *methodName, const char *param ); + +#ifdef __cplusplus +} +#endif + +@interface iOSBridge () +{ + ISBannerView* _bannerView; + NSInteger _position; + UIViewController* _bannerViewController; +} + +@end + +@implementation iOSBridge + +char *const IRONSOURCE_EVENTS = "IronSourceEvents"; + ++ (iOSBridge *)start { + static iOSBridge *instance; + static dispatch_once_t onceToken; + dispatch_once( &onceToken, + ^{ + instance = [iOSBridge new]; + }); + + return instance; +} + +- (instancetype)init { + if(self = [super init]){ + [IronSource setRewardedVideoDelegate:self]; + [IronSource setInterstitialDelegate:self]; + [IronSource setISDemandOnlyInterstitialDelegate:self]; + [IronSource setISDemandOnlyRewardedVideoDelegate:self]; + [IronSource setOfferwallDelegate:self]; + [IronSource setBannerDelegate:self]; + [IronSource addImpressionDataDelegate:self]; + [IronSource setConsentViewWithDelegate:self]; + + _bannerView = nil; + _bannerViewController = nil; + _position = BANNER_POSITION_BOTTOM; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) + name:UIDeviceOrientationDidChangeNotification object:nil]; + } + + return self; +} + +- (void)setPluginDataWithType:(NSString *)pluginType pluginVersion:(NSString *)version pluginFrameworkVersion:(NSString *)frameworkVersion { + [ISConfigurations getConfigurations].plugin = pluginType; + [ISConfigurations getConfigurations].pluginVersion = version; + [ISConfigurations getConfigurations].pluginFrameworkVersion = frameworkVersion; +} + +#pragma mark Base API + +- (void)setMediationSegment:(NSString *)segment { + [IronSource setMediationSegment:segment]; +} + +- (const char *)getAdvertiserId { + NSString *advertiserId = [IronSource advertiserId]; + + return MakeStringCopy(advertiserId); +} + +- (void)validateIntegration { + [ISIntegrationHelper validateIntegration]; +} + +- (void)shouldTrackNetworkState:(BOOL)flag { + [IronSource shouldTrackReachability:flag]; +} + +- (BOOL)setDynamicUserId:(NSString *)dynamicUserId { + return [IronSource setDynamicUserId:dynamicUserId]; +} + +- (void)setAdaptersDebug:(BOOL)enabled { + [IronSource setAdaptersDebug:enabled]; +} + +- (void)setConsent:(BOOL)consent { + [IronSource setConsent:consent]; +} + +- (void)setMetaDataWithKey:(NSString *)key value:(NSString *)value { + [IronSource setMetaDataWithKey:key value:value]; +} + +- (void)setMetaDataWithKey:(NSString *)key values:(NSMutableArray *)valuesArray { + [IronSource setMetaDataWithKey:key values:valuesArray]; +} + +#pragma mark Init SDK + +- (void)setUserId:(NSString *)userId { + [IronSource setUserId:userId]; +} + +- (void)initWithAppKey:(NSString *)appKey { + [IronSource initWithAppKey:appKey]; +} + +- (void)initWithAppKey:(NSString *)appKey adUnits:(NSArray *)adUnits { + [IronSource initWithAppKey:appKey adUnits:adUnits]; +} + +- (void)initISDemandOnly:(NSString *)appKey adUnits:(NSArray *)adUnits { + [IronSource initISDemandOnly:appKey adUnits:adUnits]; +} + +#pragma mark Rewarded Video API + +- (void)showRewardedVideo { + [IronSource showRewardedVideoWithViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; +} + +- (void)showRewardedVideoWithPlacement:(NSString *)placementName { + [IronSource showRewardedVideoWithViewController:[UIApplication sharedApplication].keyWindow.rootViewController placement:placementName]; +} + +- (const char *) getPlacementInfo:(NSString *)placementName { + char *res = nil; + + if (placementName){ + ISPlacementInfo *placementInfo = [IronSource rewardedVideoPlacementInfo:placementName]; + if(placementInfo){ + NSDictionary *dict = @{@"placement_name": [placementInfo placementName], + @"reward_amount": [placementInfo rewardAmount], + @"reward_name": [placementInfo rewardName]}; + + res = MakeStringCopy([self getJsonFromObj:dict]); + } + } + + return res; +} + +- (BOOL)isRewardedVideoAvailable { + return [IronSource hasRewardedVideo]; +} + +- (BOOL)isRewardedVideoPlacementCapped:(NSString *)placementName { + return [IronSource isRewardedVideoCappedForPlacement:placementName]; +} + +- (void)setRewardedVideoServerParameters:(NSDictionary *)params { + [IronSource setRewardedVideoServerParameters:params]; +} + +- (void)clearRewardedVideoServerParameters { + [IronSource clearRewardedVideoServerParameters]; +} + +#pragma mark Rewarded Video DemanOnly API + +- (void)showISDemandOnlyRewardedVideo:(NSString *)instanceId { + [IronSource showISDemandOnlyRewardedVideo:[UIApplication sharedApplication].keyWindow.rootViewController instanceId:instanceId]; +} + +- (void)loadISDemandOnlyRewardedVideo:(NSString *)instanceId { + [IronSource loadISDemandOnlyRewardedVideo:instanceId]; +} + +- (BOOL)isDemandOnlyRewardedVideoAvailable:(NSString *)instanceId { + return [IronSource hasISDemandOnlyRewardedVideo:instanceId]; +} + +#pragma mark Rewarded Video Delegate + +- (void)rewardedVideoHasChangedAvailability:(BOOL)available { + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAvailabilityChanged", (available) ? "true" : "false"); +} + +- (void)didReceiveRewardForPlacement:(ISPlacementInfo *)placementInfo { + NSDictionary *dict = @{@"placement_reward_amount": placementInfo.rewardAmount, + @"placement_reward_name": placementInfo.rewardName, + @"placement_name": placementInfo.placementName}; + + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdRewarded", MakeStringCopy([self getJsonFromObj:dict])); +} + +- (void)rewardedVideoDidFailToShowWithError:(NSError *)error { + if (error) + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdShowFailed", MakeStringCopy([self parseErrorToEvent:error])); + else + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdShowFailed",""); +} + +- (void)rewardedVideoDidOpen { + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdOpened", ""); +} + +- (void)rewardedVideoDidClose { + [self centerBanner]; + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdClosed", ""); +} + +- (void)rewardedVideoDidStart { + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdStarted", ""); +} + +- (void)rewardedVideoDidEnd { + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdEnded", ""); +} + +- (void)didClickRewardedVideo:(ISPlacementInfo *)placementInfo { + NSDictionary *dict = @{@"placement_reward_amount": placementInfo.rewardAmount, + @"placement_reward_name": placementInfo.rewardName, + @"placement_name": placementInfo.placementName}; + + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdClicked", MakeStringCopy([self getJsonFromObj:dict])); +} + +#pragma mark Rewarded Video DemandOnly Delegate + +- (void)rewardedVideoDidLoad:(NSString *)instanceId{ + NSArray *params = @[instanceId]; + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdLoadedDemandOnly", MakeStringCopy([self getJsonFromObj:params])); +} + +- (void)rewardedVideoDidFailToLoadWithError:(NSError *)error instanceId:(NSString *)instanceId{ + NSArray *params; + if (error) + params = @[instanceId, [self parseErrorToEvent:error]]; + else + params = @[instanceId,@""]; + + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdLoadFailedDemandOnly", MakeStringCopy([self getJsonFromObj:params])); +} + +- (void)rewardedVideoAdRewarded:(NSString *)instanceId { + NSArray *params = @[instanceId]; + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdRewardedDemandOnly", MakeStringCopy([self getJsonFromObj:params])); +} + +- (void)rewardedVideoDidFailToShowWithError:(NSError *)error instanceId:(NSString *)instanceId { + + NSArray *params; + if (error) + params = @[instanceId, [self parseErrorToEvent:error]]; + else + params = @[instanceId,@""]; + + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdShowFailedDemandOnly", MakeStringCopy([self getJsonFromObj:params])); +} + +- (void)rewardedVideoDidOpen:(NSString *)instanceId { + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdOpenedDemandOnly", MakeStringCopy(instanceId)); + +} + +- (void)rewardedVideoDidClose:(NSString *)instanceId { + [self centerBanner]; + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdClosedDemandOnly", MakeStringCopy(instanceId)); +} + +- (void)rewardedVideoDidClick:(NSString *)instanceId { + NSArray *params = @[instanceId]; + UnitySendMessage(IRONSOURCE_EVENTS, "onRewardedVideoAdClickedDemandOnly", MakeStringCopy([self getJsonFromObj:params])); +} + +#pragma mark Interstitial API + +- (void)loadInterstitial { + [IronSource loadInterstitial]; +} + +- (void)showInterstitial { + [IronSource showInterstitialWithViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; +} + +- (void)showInterstitialWithPlacement:(NSString *)placementName { + [IronSource showInterstitialWithViewController:[UIApplication sharedApplication].keyWindow.rootViewController placement:placementName]; +} + +- (BOOL)isInterstitialReady { + return [IronSource hasInterstitial]; +} + +- (BOOL)isInterstitialPlacementCapped:(NSString *)placementName { + return [IronSource isInterstitialCappedForPlacement:placementName]; +} + +#pragma mark Interstitial DemandOnly API + +- (void)loadISDemandOnlyInterstitial:(NSString *)instanceId { + [IronSource loadISDemandOnlyInterstitial:instanceId]; +} + +- (void)showISDemandOnlyInterstitial:(NSString *)instanceId { + [IronSource showISDemandOnlyInterstitial:[UIApplication sharedApplication].keyWindow.rootViewController instanceId:instanceId]; +} + +- (BOOL)isISDemandOnlyInterstitialReady:(NSString *)instanceId { + return [IronSource hasISDemandOnlyInterstitial:instanceId]; +} + +#pragma mark Interstitial Delegate + +- (void)interstitialDidLoad { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdReady", ""); +} + +- (void)interstitialDidFailToLoadWithError:(NSError *)error { + if (error) + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdLoadFailed", MakeStringCopy([self parseErrorToEvent:error])); + else + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdLoadFailed",""); +} + +- (void)interstitialDidOpen { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdOpened", ""); +} + +- (void)interstitialDidClose { + [self centerBanner]; + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdClosed", ""); +} + +- (void)interstitialDidShow { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdShowSucceeded", ""); +} + +- (void)interstitialDidFailToShowWithError:(NSError *)error { + if (error) + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdShowFailed", MakeStringCopy([self parseErrorToEvent:error])); + else + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdShowFailed",""); +} + +- (void)didClickInterstitial { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdClicked", ""); +} + +#pragma mark Interstitial DemandOnly Delegate + +- (void)interstitialDidLoad:(NSString *)instanceId { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdReadyDemandOnly", MakeStringCopy(instanceId)); +} + +- (void)interstitialDidFailToLoadWithError:(NSError *)error instanceId:(NSString *)instanceId { + NSArray *parameters; + if (error) + parameters = @[instanceId, [self parseErrorToEvent:error]]; + else + parameters = @[instanceId, @""]; + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdLoadFailedDemandOnly",MakeStringCopy([self getJsonFromObj:parameters])); +} + +- (void)interstitialDidOpen:(NSString *)instanceId { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdOpenedDemandOnly", MakeStringCopy(instanceId)); +} + +- (void)interstitialDidClose:(NSString *)instanceId { + [self centerBanner]; + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdClosedDemandOnly", MakeStringCopy(instanceId)); +} + +- (void)interstitialDidShow:(NSString *)instanceId { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdShowSucceededDemandOnly", MakeStringCopy(instanceId)); +} + +- (void)interstitialDidFailToShowWithError:(NSError *)error instanceId:(NSString *)instanceId { + NSArray *parameters; + if (error) + parameters = @[instanceId, [self parseErrorToEvent:error]]; + else + parameters = @[instanceId, @""]; + + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdShowFailedDemandOnly", MakeStringCopy([self getJsonFromObj:parameters])); +} + +- (void)didClickInterstitial:(NSString *)instanceId { + UnitySendMessage(IRONSOURCE_EVENTS, "onInterstitialAdClickedDemandOnly", MakeStringCopy(instanceId)); +} + +#pragma mark Offerwall API + +- (void)showOfferwall { + [IronSource showOfferwallWithViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; +} + +- (void)showOfferwallWithPlacement:(NSString *)placementName { + [IronSource showOfferwallWithViewController:[UIApplication sharedApplication].keyWindow.rootViewController placement:placementName]; +} + +- (void)getOfferwallCredits { + [IronSource offerwallCredits]; +} + +- (BOOL)isOfferwallAvailable { + return [IronSource hasOfferwall]; +} + +#pragma mark Offerwall Delegate + +- (void)offerwallHasChangedAvailability:(BOOL)available { + UnitySendMessage(IRONSOURCE_EVENTS, "onOfferwallAvailable", (available) ? "true" : "false"); +} + +- (void)offerwallDidShow { + UnitySendMessage(IRONSOURCE_EVENTS, "onOfferwallOpened", ""); +} + +- (void)offerwallDidFailToShowWithError:(NSError *)error { + if (error) + UnitySendMessage(IRONSOURCE_EVENTS, "onOfferwallShowFailed", MakeStringCopy([self parseErrorToEvent:error])); + else + UnitySendMessage(IRONSOURCE_EVENTS, "onOfferwallShowFailed", ""); +} + +- (void)offerwallDidClose { + [self centerBanner]; + UnitySendMessage(IRONSOURCE_EVENTS, "onOfferwallClosed", ""); +} + +- (BOOL)didReceiveOfferwallCredits:(NSDictionary *)creditInfo { + if(creditInfo) + UnitySendMessage(IRONSOURCE_EVENTS, "onOfferwallAdCredited", [self getJsonFromObj:creditInfo].UTF8String); + + return YES; +} + +- (void)didFailToReceiveOfferwallCreditsWithError:(NSError *)error { + if (error) + UnitySendMessage(IRONSOURCE_EVENTS, "onGetOfferwallCreditsFailed", MakeStringCopy([self parseErrorToEvent:error])); + else + UnitySendMessage(IRONSOURCE_EVENTS, "onGetOfferwallCreditsFailed", ""); +} + +#pragma mark ConsentView API + +-(void)loadConsentViewWithType:(NSString *)consentViewType { + [IronSource loadConsentViewWithType: consentViewType]; +} + +-(void)showConsentViewWithType:(NSString *)consentViewType { + @synchronized(self) { + UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController; + [IronSource showConsentViewWithViewController:viewController andType:consentViewType]; + } +} + +#pragma mark Banner API + +- (void)loadBanner:(NSString *)description width:(NSInteger)width height:(NSInteger)height position:(NSInteger)position placement:(NSString *)placement { + @synchronized(self) { + _position = position; + ISBannerSize* size = [self getBannerSize:description width:width height:height]; + + _bannerViewController = [UIApplication sharedApplication].keyWindow.rootViewController; + [IronSource loadBannerWithViewController:_bannerViewController size:size placement:placement]; + } +} + +- (void)destroyBanner { + dispatch_async(dispatch_get_main_queue(), ^{ + @synchronized(self) { + if (_bannerView != nil) { + [IronSource destroyBanner:_bannerView]; + _bannerView = nil; + _bannerViewController = nil; + } + } + }); +} + +- (void)displayBanner { + dispatch_async(dispatch_get_main_queue(), ^{ + @synchronized(self) { + if (_bannerView != nil) { + [_bannerView setHidden:NO]; + } + } + }); +} + +- (void)hideBanner { + dispatch_async(dispatch_get_main_queue(), ^{ + @synchronized(self) { + if (_bannerView != nil) { + [_bannerView setHidden:YES]; + } + } + }); +} + +- (BOOL)isBannerPlacementCapped:(NSString *)placementName { + return [IronSource isBannerCappedForPlacement:placementName]; +} + +- (ISBannerSize *) getBannerSize:(NSString *)description width:(NSInteger)width height:(NSInteger)height { + if ([description isEqualToString:@"CUSTOM"]) { + return [[ISBannerSize alloc] initWithWidth:width andHeight:height]; + } + if ([description isEqualToString:@"SMART"]) { + return ISBannerSize_SMART; + } + if ([description isEqualToString:@"RECTANGLE"]) { + return ISBannerSize_RECTANGLE; + } + if ([description isEqualToString:@"LARGE"]) { + return ISBannerSize_LARGE; + } + else { + return ISBannerSize_BANNER; + } +} + +#pragma mark Banner Delegate + +- (CGPoint)getBannerCenter:(NSInteger)position rootView:(UIView *)rootView { + CGFloat y; + if (position == BANNER_POSITION_TOP) { + y = (_bannerView.frame.size.height / 2); + if (@available(ios 11.0, *)) { + y += rootView.safeAreaInsets.top; + } + } + else { + y = rootView.frame.size.height - (_bannerView.frame.size.height / 2); + if (@available(ios 11.0, *)) { + y -= rootView.safeAreaInsets.bottom; + } + } + + return CGPointMake(rootView.frame.size.width / 2, y); +} + +- (void)bannerDidLoad:(ISBannerView *)bannerView { + dispatch_async(dispatch_get_main_queue(), ^{ + @synchronized(self) { + _bannerView = bannerView; + [_bannerView setAccessibilityLabel:@"bannerContainer"]; + + _bannerView.center = [self getBannerCenter:_position rootView:_bannerViewController.view]; + [_bannerViewController.view addSubview:_bannerView]; + + UnitySendMessage(IRONSOURCE_EVENTS, "onBannerAdLoaded", ""); + } + }); +} + +- (void)bannerDidFailToLoadWithError:(NSError *)error { + if (error) + UnitySendMessage(IRONSOURCE_EVENTS, "onBannerAdLoadFailed", MakeStringCopy([self parseErrorToEvent:error])); + else + UnitySendMessage(IRONSOURCE_EVENTS, "onBannerAdLoadFailed", ""); +} + +- (void)didClickBanner { + UnitySendMessage(IRONSOURCE_EVENTS, "onBannerAdClicked", ""); +} + +- (void)bannerWillPresentScreen { + UnitySendMessage(IRONSOURCE_EVENTS, "onBannerAdScreenPresented", ""); +} + +- (void)bannerDidDismissScreen { + UnitySendMessage(IRONSOURCE_EVENTS, "onBannerAdScreenDismissed", ""); +} + +- (void)bannerWillLeaveApplication { + UnitySendMessage(IRONSOURCE_EVENTS, "onBannerAdLeftApplication", ""); +} + +- (void)centerBanner { + dispatch_async(dispatch_get_main_queue(), ^{ + @synchronized(self) { + if (_bannerView != nil && _bannerViewController != nil) { + _bannerView.center = [self getBannerCenter:_position rootView:_bannerViewController.view]; + } + } + }); +} + +- (void)orientationChanged:(NSNotification *)notification { + [self centerBanner]; +} + +#pragma mark Helper methods + +- (void) setSegment:(NSString*) segmentJSON { + [IronSource setSegmentDelegate:self]; + ISSegment *segment = [[ISSegment alloc] init]; + NSError* error; + if (!segmentJSON) + return; + + NSData *data = [segmentJSON dataUsingEncoding:NSUTF8StringEncoding]; + if (!data) + return; + + NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; + + if (!dict) + return; + + NSMutableArray *allKeys = [[dict allKeys] mutableCopy]; + for (id key in allKeys) + { + NSString* keyString = (NSString*)key; + NSString *object = [dict objectForKey: keyString]; + if ([keyString isEqualToString:@"age"]){ + segment.age = [object intValue] ; + } + else if([keyString isEqualToString:@"gender"]){ + if([object caseInsensitiveCompare:@"male"] == NSOrderedSame) + segment.gender = IRONSOURCE_USER_MALE ; + else if([object caseInsensitiveCompare:@"female"] == NSOrderedSame) + segment.gender = IRONSOURCE_USER_FEMALE; + + } + else if ([keyString isEqualToString:@"level"]){ + segment.level = [object intValue]; + } + else if ([keyString isEqualToString:@"isPaying"]){ + segment.paying = [object boolValue]; + } + else if ([keyString isEqualToString:@"userCreationDate"]){ + NSDate *date = [NSDate dateWithTimeIntervalSince1970: [object longLongValue]/1000]; + segment.userCreationDate = date; + + } + else if ([keyString isEqualToString:@"segmentName"]){ + segment.segmentName = object; + + } else if ([keyString isEqualToString:@"iapt"]){ + segment.iapTotal = [object doubleValue]; + } + else{ + [segment setCustomValue:object forKey:keyString]; + } + + } + + [IronSource setSegment:segment]; +} + +- (void)didReceiveSegement:(NSString *)segment{ + UnitySendMessage(IRONSOURCE_EVENTS, "onSegmentReceived", MakeStringCopy(segment)); +} + +- (NSString *)parseErrorToEvent:(NSError *)error{ + if (error){ + NSString* codeStr = [NSString stringWithFormat:@"%ld", (long)[error code]]; + + NSDictionary *dict = @{@"error_description": [error localizedDescription], + @"error_code": codeStr}; + + return [self getJsonFromObj:dict]; + } + + return nil; +} + +- (NSString *)getJsonFromObj:(id)obj { + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:obj options:0 error:&error]; + + if (!jsonData) { + NSLog(@"Got an error: %@", error); + return @""; + } else { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + return jsonString; + } +} + +#pragma mark ImpressionData Delegate + +- (void)impressionDataDidSucceed:(ISImpressionData *)impressionData { + UnitySendMessage(IRONSOURCE_EVENTS, "onImpressionSuccess", [self getJsonFromObj:[impressionData all_data]].UTF8String); + +} + +#pragma mark ConsentView Delegate + +- (void)consentViewDidAccept:(NSString *)consentViewType { + UnitySendMessage(IRONSOURCE_EVENTS, "onConsentViewDidAccept", MakeStringCopy(consentViewType)); +} + +- (void)consentViewDidDismiss:(NSString *)consentViewType { + UnitySendMessage(IRONSOURCE_EVENTS, "onConsentViewDidDismiss", MakeStringCopy(consentViewType)); +} + +- (void)consentViewDidFailToLoadWithError:(NSError *)error consentViewType:(NSString *)consentViewType { + NSArray *params; + if (error) + params = @[consentViewType, [self parseErrorToEvent:error]]; + else + params = @[consentViewType, @""]; + + UnitySendMessage(IRONSOURCE_EVENTS, "onConsentViewDidFailToLoadWithError", MakeStringCopy([self getJsonFromObj:params])); +} + +- (void)consentViewDidLoadSuccess:(NSString *)consentViewType { + UnitySendMessage(IRONSOURCE_EVENTS, "onConsentViewDidLoadSuccess", MakeStringCopy(consentViewType)); +} + +- (void)consentViewDidFailToShowWithError:(NSError *)error consentViewType:(NSString *)consentViewType { + NSArray *params; + if (error) + params = @[consentViewType, [self parseErrorToEvent:error]]; + else + params = @[consentViewType, @""]; + + UnitySendMessage(IRONSOURCE_EVENTS, "onConsentViewDidFailToShowWithError", MakeStringCopy([self getJsonFromObj:params])); +} + +- (void)consentViewDidShowSuccess:(NSString *)consentViewType { + UnitySendMessage(IRONSOURCE_EVENTS, "onConsentViewDidShowSuccess", MakeStringCopy(consentViewType)); +} + +#pragma mark ConversionValue API + +-(const char *) getConversionValue { + NSNumber *conversionValue = [IronSource getConversionValue]; + char *res = MakeStringCopy([conversionValue stringValue]); + return res; +} + +#pragma mark ILRD API +- (void)setAdRevenueData:(NSString *)dataSource impressionData:(NSData *)impressionData { + [IronSource setAdRevenueDataWithDataSource:dataSource impressionData:impressionData]; +} + +#pragma mark - C Section + +#ifdef __cplusplus +extern "C" { +#endif + + void CFSetPluginData(const char *pluginType, const char *pluginVersion, const char *pluginFrameworkVersion){ + [[iOSBridge start] setPluginDataWithType:GetStringParam(pluginType) pluginVersion:GetStringParam(pluginVersion) pluginFrameworkVersion:GetStringParam(pluginFrameworkVersion)]; + } + + + void CFSetMediationSegment(const char *segment){ + [[iOSBridge start] setMediationSegment:GetStringParam(segment)]; + } + + const char *CFGetAdvertiserId(){ + return [[iOSBridge start] getAdvertiserId]; + } + + void CFValidateIntegration(){ + [[iOSBridge start] validateIntegration]; + } + + void CFShouldTrackNetworkState(bool flag){ + [[iOSBridge start] shouldTrackNetworkState:flag]; + } + + bool CFSetDynamicUserId(char *dynamicUserId){ + return [[iOSBridge start] setDynamicUserId:GetStringParam(dynamicUserId)]; + } + + void CFSetAdaptersDebug(bool enabled){ + [[iOSBridge start] setAdaptersDebug:enabled]; + } + + void CFSetUserId(char *userId){ + return [[iOSBridge start] setUserId:GetStringParam(userId)]; + } + + void CFSetConsent (bool consent) { + [[iOSBridge start] setConsent:consent]; + } + + void CFSetMetaData (char *key, char *value) { + [[iOSBridge start] setMetaDataWithKey:GetStringParam(key) value:GetStringParam(value)]; + } + + void CFSetMetaDataWithValues (char *key,const char *values[]) { + NSMutableArray *valuesArray = [NSMutableArray new]; + if(values != nil ) { + int i = 0; + + while (values[i] != nil) { + [valuesArray addObject: [NSString stringWithCString: values[i] encoding:NSASCIIStringEncoding]]; + i++; + } + + [[iOSBridge start] setMetaDataWithKey:GetStringParam(key) values:valuesArray]; + } + } + +#pragma mark Init SDK + + void CFInit(const char *appKey){ + [[iOSBridge start] initWithAppKey:GetStringParam(appKey)]; + } + + void CFInitWithAdUnits(const char *appKey, const char *adUnits[]){ + NSMutableArray *adUnitsArray = [NSMutableArray new]; + + if(adUnits != nil ) { + int i = 0; + + while (adUnits[i] != nil) { + [adUnitsArray addObject: [NSString stringWithCString: adUnits[i] encoding:NSASCIIStringEncoding]]; + i++; + } + + [[iOSBridge start] initWithAppKey:GetStringParam(appKey) adUnits:adUnitsArray]; + } + } + + void CFInitISDemandOnly(const char *appKey, const char *adUnits[]){ + NSMutableArray *adUnitsArray = [NSMutableArray new]; + + if(adUnits != nil ) { + int i = 0; + + while (adUnits[i] != nil) { + [adUnitsArray addObject: [NSString stringWithCString: adUnits[i] encoding:NSASCIIStringEncoding]]; + i++; + } + [[iOSBridge start] initISDemandOnly:GetStringParam(appKey) adUnits:adUnitsArray]; + } + } + +#pragma mark RewardedVideo API + void CFShowRewardedVideo(){ + [[iOSBridge start] showRewardedVideo]; + } + + void CFShowRewardedVideoWithPlacementName(char *placementName){ + [[iOSBridge start] showRewardedVideoWithPlacement:GetStringParam(placementName)]; + } + + const char *CFGetPlacementInfo(char *placementName){ + return [[iOSBridge start] getPlacementInfo:GetStringParam(placementName)]; + } + + bool CFIsRewardedVideoAvailable(){ + return [[iOSBridge start] isRewardedVideoAvailable]; + } + + bool CFIsRewardedVideoPlacementCapped(char *placementName){ + return [[iOSBridge start] isRewardedVideoPlacementCapped:GetStringParam(placementName)]; + } + + void CFSetRewardedVideoServerParameters(char *jsonString) { + NSData *data = [GetStringParam(jsonString) dataUsingEncoding:NSUTF8StringEncoding]; + if (!data) { + return; + } + + NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; + if (dict) { + [[iOSBridge start] setRewardedVideoServerParameters:dict]; + } + } + + void CFClearRewardedVideoServerParameters() { + [[iOSBridge start] clearRewardedVideoServerParameters]; + } + +#pragma mark RewardedVideo DemandOnly API + + void CFShowISDemandOnlyRewardedVideo(char * instanceId){ + [[iOSBridge start] showISDemandOnlyRewardedVideo:GetStringParam(instanceId)]; + } + + void CFLoadISDemandOnlyRewardedVideo(char * instanceId) { + [[iOSBridge start] loadISDemandOnlyRewardedVideo:GetStringParam(instanceId)]; + } + + bool CFIsDemandOnlyRewardedVideoAvailable(char * instanceId) { + return [[iOSBridge start] isDemandOnlyRewardedVideoAvailable:GetStringParam(instanceId)]; + } + +#pragma mark Interstitial API + + void CFLoadInterstitial(){ + [[iOSBridge start] loadInterstitial]; + } + + void CFShowInterstitial(){ + [[iOSBridge start] showInterstitial]; + } + + void CFShowInterstitialWithPlacementName(char *placementName){ + [[iOSBridge start] showInterstitialWithPlacement:GetStringParam(placementName)]; + } + + bool CFIsInterstitialReady(){ + return [[iOSBridge start] isInterstitialReady]; + } + + bool CFIsInterstitialPlacementCapped(char *placementName){ + return [[iOSBridge start] isInterstitialPlacementCapped:GetStringParam(placementName)]; + } + +#pragma mark Interstitial DemandOnly API + + void CFLoadISDemandOnlyInterstitial(char * instanceId) { + [[iOSBridge start] loadISDemandOnlyInterstitial:GetStringParam(instanceId)]; + } + + void CFShowISDemandOnlyInterstitial(char * instanceId) { + [[iOSBridge start] showISDemandOnlyInterstitial:GetStringParam(instanceId)]; + + } + + bool CFIsDemandOnlyInterstitialReady(char * instanceId) { + return [[iOSBridge start] isISDemandOnlyInterstitialReady:GetStringParam(instanceId)]; + } + +#pragma mark Offerwall API + + void CFShowOfferwall(){ + [[iOSBridge start] showOfferwall]; + } + + void CFShowOfferwallWithPlacementName(char *placementName){ + [[iOSBridge start] showOfferwallWithPlacement:GetStringParam(placementName)]; + } + + void CFGetOfferwallCredits(){ + [[iOSBridge start] getOfferwallCredits]; + } + + bool CFIsOfferwallAvailable(){ + return [[iOSBridge start] isOfferwallAvailable]; + } + +#pragma mark Banner API + + void CFLoadBanner(char* description, int width, int height, int position, char* placementName){ + [[iOSBridge start] loadBanner:GetStringParam(description) width:width height:height position:position placement:GetStringParam(placementName)]; + } + + void CFDestroyBanner (){ + [[iOSBridge start] destroyBanner]; + } + + void CFDisplayBanner (){ + [[iOSBridge start] displayBanner]; + } + + void CFHideBanner (){ + [[iOSBridge start] hideBanner]; + } + + bool CFIsBannerPlacementCapped (char *placementName){ + return [[iOSBridge start] isBannerPlacementCapped:GetStringParam(placementName)]; + } + +#pragma mark Segment API + + void CFSetSegment (char* jsonString) { + [[iOSBridge start] setSegment:GetStringParam(jsonString)]; + } + +#pragma mark ConsentView API + + void CFLoadConsentViewWithType (char* consentViewType){ + [[iOSBridge start] loadConsentViewWithType:GetStringParam(consentViewType)]; + } + + void CFShowConsentViewWithType (char* consentViewType){ + [[iOSBridge start] showConsentViewWithType:GetStringParam(consentViewType)]; + } + +#pragma mark ConversionValue API + + const char *CFGetConversionValue(){ + return [[iOSBridge start] getConversionValue]; + } + +#pragma mark ILRD API + void CFSetAdRevenueData(char* datasource,char* impressiondata){ + NSData *data=[GetStringParam(impressiondata)dataUsingEncoding:NSUTF8StringEncoding]; + if (!data) { + return; + } + return [[iOSBridge start] setAdRevenueData:GetStringParam(datasource)impressionData:data]; + } + +#ifdef __cplusplus +} +#endif + +@end + + diff --git a/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.m.meta b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.m.meta new file mode 100644 index 00000000..a1c73f48 --- /dev/null +++ b/popcorn/Assets/IronSource/Plugins/iOS/iOSBridge.m.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 270589a8de1714a00bc20bfd059e4441 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts.meta b/popcorn/Assets/IronSource/Scripts.meta new file mode 100644 index 00000000..5428f14a --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1bbaa67142d994184844ed2864338043 +folderAsset: yes +timeCreated: 1486985218 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/AndroidAgent.cs b/popcorn/Assets/IronSource/Scripts/AndroidAgent.cs new file mode 100644 index 00000000..f6948319 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/AndroidAgent.cs @@ -0,0 +1,314 @@ +#if UNITY_ANDROID +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +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"; + + public AndroidAgent () + { + Debug.Log ("AndroidAgent ctr"); + } + +#region IronSourceIAgent implementation + public AndroidJavaObject getBridge () + { + if (_androidBridge == null) + using (var pluginClass = new AndroidJavaClass( AndroidBridge )) + _androidBridge = pluginClass.CallStatic ("getInstance"); + + return _androidBridge; + } + + //******************* Base API *******************// + + public void onApplicationPause (bool pause) + { + if (pause) + { + getBridge ().Call ("onPause"); + } + else + { + getBridge ().Call ("onResume"); + } + } + + public void setMediationSegment (string segment) + { + getBridge ().Call ("setMediationSegment", segment); + } + + public string getAdvertiserId () + { + return getBridge ().Call ("getAdvertiserId"); + } + + public void validateIntegration () + { + getBridge ().Call ("validateIntegration"); + } + + public void shouldTrackNetworkState (bool track) + { + getBridge ().Call ("shouldTrackNetworkState", track); + } + + public bool setDynamicUserId (string dynamicUserId) + { + return getBridge ().Call ("setDynamicUserId", dynamicUserId); + } + + public void setAdaptersDebug(bool enabled) + { + getBridge ().Call ("setAdaptersDebug", enabled); + } + + public void setMetaData(string key, string value) + { + getBridge().Call("setMetaData", key, value); + } + + public void setMetaData(string key, params string[] values) + { + getBridge().Call("setMetaData", key, values); + } + + public int? getConversionValue() + { + Debug.Log("Unsupported Platform"); + return null; + } + + //******************* SDK Init *******************// + + public void setUserId(string userId) { + getBridge ().Call ("setUserId", userId); + } + + public void init(string appKey) + { + getBridge ().Call ("setPluginData", "Unity", IronSource.pluginVersion (), IronSource.unityVersion ()); + Debug.Log ("IntegrationHelper pluginVersion: " + IronSource.pluginVersion ()); + getBridge ().Call ("init", appKey); + } + + public void init (string appKey, params string[] adUnits) + { + getBridge ().Call ("setPluginData", "Unity", IronSource.pluginVersion (), IronSource.unityVersion ()); + Debug.Log ("IntegrationHelper pluginVersion: " + IronSource.pluginVersion ()); + getBridge ().Call ("init", appKey, adUnits); + } + + public void initISDemandOnly (string appKey, params string[] adUnits) + { + getBridge ().Call ("setPluginData", "Unity", IronSource.pluginVersion (), IronSource.unityVersion ()); + Debug.Log ("IntegrationHelper pluginVersion: " + IronSource.pluginVersion ()); + getBridge ().Call ("initISDemandOnly", appKey, adUnits); + } + + //******************* RewardedVideo API *******************// + + public void showRewardedVideo () + { + getBridge ().Call ("showRewardedVideo"); + } + + public void showRewardedVideo (string placementName) + { + getBridge ().Call ("showRewardedVideo", placementName); + } + + public bool isRewardedVideoAvailable () + { + return getBridge ().Call ("isRewardedVideoAvailable"); + } + + public bool isRewardedVideoPlacementCapped (string placementName) + { + return getBridge ().Call ("isRewardedVideoPlacementCapped", placementName); + } + + public IronSourcePlacement getPlacementInfo (string placementName) + { + string placementInfo = getBridge ().Call ("getPlacementInfo", placementName); + IronSourcePlacement pInfo = null; + if (placementInfo != null) { + Dictionary pInfoDic = IronSourceJSON.Json.Deserialize (placementInfo) as Dictionary; + string pName = pInfoDic [PLACEMENT_NAME].ToString (); + string rName = pInfoDic [REWARD_NAME].ToString (); + int rAmount = Convert.ToInt32 (pInfoDic [REWARD_AMOUNT].ToString ()); + + pInfo = new IronSourcePlacement (pName, rName, rAmount); + } + return pInfo; + } + + public void setRewardedVideoServerParams(Dictionary parameters) { + string json = IronSourceJSON.Json.Serialize (parameters); + getBridge ().Call ("setRewardedVideoServerParams", json); + } + + public void clearRewardedVideoServerParams() { + getBridge ().Call ("clearRewardedVideoServerParams"); + } + + //******************* RewardedVideo DemandOnly API *******************// + + public void showISDemandOnlyRewardedVideo (string instanceId) + { + getBridge ().Call ("showISDemandOnlyRewardedVideo",instanceId); + } + + public void loadISDemandOnlyRewardedVideo (string instanceId) + { + getBridge ().Call ("loadISDemandOnlyRewardedVideo", instanceId); + } + + public bool isISDemandOnlyRewardedVideoAvailable (string instanceId) + { + return getBridge ().Call ("isISDemandOnlyRewardedVideoAvailable", instanceId); + } + + //******************* Interstitial API *******************// + + public void loadInterstitial () + { + getBridge ().Call ("loadInterstitial"); + } + + public void showInterstitial () + { + getBridge ().Call ("showInterstitial"); + } + + public void showInterstitial (string placementName) + { + getBridge ().Call ("showInterstitial", placementName); + } + + public bool isInterstitialReady () + { + return getBridge ().Call ("isInterstitialReady"); + } + + public bool isInterstitialPlacementCapped (string placementName) + { + return getBridge ().Call ("isInterstitialPlacementCapped", placementName); + } + + //******************* Interstitial DemandOnly API *******************// + + public void loadISDemandOnlyInterstitial (string instanceId) + { + getBridge ().Call ("loadISDemandOnlyInterstitial",instanceId); + } + + public void showISDemandOnlyInterstitial (string instanceId) + { + getBridge ().Call ("showISDemandOnlyInterstitial",instanceId); + } + + public bool isISDemandOnlyInterstitialReady (string instanceId) + { + return getBridge ().Call ("isISDemandOnlyInterstitialReady",instanceId); + } + + //******************* Offerwall API *******************// + + public void showOfferwall () + { + getBridge ().Call ("showOfferwall"); + } + + public void showOfferwall (string placementName) + { + getBridge ().Call ("showOfferwall", placementName); + } + + public void getOfferwallCredits () + { + getBridge ().Call ("getOfferwallCredits"); + } + + public bool isOfferwallAvailable () + { + return getBridge ().Call ("isOfferwallAvailable"); + } + + //******************* Banner API *******************// + + public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position) + { + loadBanner(size, position, ""); + } + + public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position, string placementName) + { + getBridge().Call("loadBanner", size.Description, (int)size.Width, (int)size.Height, (int)position, placementName); + } + + public void destroyBanner() + { + getBridge ().Call ("destroyBanner"); + } + + public void displayBanner() + { + getBridge ().Call ("displayBanner"); + } + + public void hideBanner() + { + getBridge ().Call ("hideBanner"); + } + + public bool isBannerPlacementCapped(string placementName) + { + return getBridge ().Call ("isBannerPlacementCapped", placementName); + } + + public void setSegment(IronSourceSegment segment) + { + Dictionary dict = segment.getSegmentAsDict (); + string json = IronSourceJSON.Json.Serialize (dict); + getBridge ().Call ("setSegment", json); + } + + public void setConsent(bool consent) + { + getBridge().Call("setConsent",consent); + } + + //******************* ConsentView API *******************// + + public void loadConsentViewWithType(string consentViewType) + { + Debug.Log("Unsupported Platform"); + } + + public void showConsentViewWithType(string consentViewType) + { + Debug.Log("Unsupported Platform"); + } + + //******************* ILRD API *******************// + + public void setAdRevenueData(string dataSource, Dictionary impressionData) + { + string json = IronSourceJSON.Json.Serialize(impressionData); + getBridge().Call("setAdRevenueData", dataSource, json); + } + + #endregion +} + +#endif + diff --git a/popcorn/Assets/IronSource/Scripts/AndroidAgent.cs.meta b/popcorn/Assets/IronSource/Scripts/AndroidAgent.cs.meta new file mode 100644 index 00000000..520e1f5f --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/AndroidAgent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 383e513a18bd7449994e83f8f434e950 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSource.cs b/popcorn/Assets/IronSource/Scripts/IronSource.cs new file mode 100644 index 00000000..bb9e3867 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSource.cs @@ -0,0 +1,317 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +public class IronSource : IronSourceIAgent +{ + private IronSourceIAgent _platformAgent; + private static IronSource _instance; + private const string UNITY_PLUGIN_VERSION = "7.1.12-r"; + private static bool isUnsupportedPlatform; + + private IronSource() + { + if (!isUnsupportedPlatform) + { +#if UNITY_EDITOR || UNITY_STANDALONE + _platformAgent = new UnsupportedPlatformAgent(); +#elif (UNITY_IPHONE || UNITY_IOS) + _platformAgent = new iOSAgent(); +#elif UNITY_ANDROID + _platformAgent = new AndroidAgent (); +#endif + } + + else + { + _platformAgent = new UnsupportedPlatformAgent(); + } + var type = typeof(IronSourceEvents); + var mgr = new GameObject("IronSourceEvents", type).GetComponent(); // Creates IronSourceEvents gameObject + } + + #region IronSourceIAgent implementation + public static IronSource Agent { + get { + if (_instance == null) { + _instance = new IronSource(); + } + return _instance; + } + } + + public static string pluginVersion() + { + return UNITY_PLUGIN_VERSION; + } + + public static string unityVersion() + { + return Application.unityVersion; + } + + public static void setUnsupportedPlatform() + { + isUnsupportedPlatform = true; + } + + //******************* Base API *******************// + + public void onApplicationPause(bool pause) + { + _platformAgent.onApplicationPause(pause); + } + + public void setMediationSegment(string segment) + { + _platformAgent.setMediationSegment(segment); + } + + public string getAdvertiserId() + { + return _platformAgent.getAdvertiserId(); + } + + public void validateIntegration() + { + _platformAgent.validateIntegration(); + } + + public void shouldTrackNetworkState(bool track) + { + _platformAgent.shouldTrackNetworkState(track); + } + + public bool setDynamicUserId(string dynamicUserId) + { + return _platformAgent.setDynamicUserId(dynamicUserId); + } + + public void setAdaptersDebug(bool enabled) + { + _platformAgent.setAdaptersDebug(enabled); + } + + public void setMetaData(string key, string value) + { + _platformAgent.setMetaData(key, value); + } + + public void setMetaData(string key, params string[] values) + { + _platformAgent.setMetaData(key, values); + } + + public int? getConversionValue() + { + return _platformAgent.getConversionValue(); + } + + //******************* SDK Init *******************// + + public void setUserId (string userId) + { + _platformAgent.setUserId (userId); + } + + public void init (string appKey) + { + _platformAgent.init (appKey); + } + + public void init (string appKey, params string[] adUnits) + { + _platformAgent.init (appKey, adUnits); + } + + public void initISDemandOnly (string appKey, params string[] adUnits) + { + _platformAgent.initISDemandOnly (appKey, adUnits); + } + + //******************* RewardedVideo API *******************// + + public void showRewardedVideo () + { + _platformAgent.showRewardedVideo (); + } + + public void showRewardedVideo (string placementName) + { + _platformAgent.showRewardedVideo (placementName); + } + + public IronSourcePlacement getPlacementInfo (string placementName) + { + return _platformAgent.getPlacementInfo (placementName); + } + + public bool isRewardedVideoAvailable () + { + return _platformAgent.isRewardedVideoAvailable (); + } + + public bool isRewardedVideoPlacementCapped (string placementName) + { + return _platformAgent.isRewardedVideoPlacementCapped (placementName); + } + + public void setRewardedVideoServerParams(Dictionary parameters) + { + _platformAgent.setRewardedVideoServerParams(parameters); + } + + public void clearRewardedVideoServerParams() + { + _platformAgent.clearRewardedVideoServerParams(); + } + + //******************* RewardedVideo DemandOnly API *******************// + + public void showISDemandOnlyRewardedVideo (string instanceId) + { + _platformAgent.showISDemandOnlyRewardedVideo(instanceId); + } + + public void loadISDemandOnlyRewardedVideo (string instanceId) + { + _platformAgent.loadISDemandOnlyRewardedVideo(instanceId); + } + + public bool isISDemandOnlyRewardedVideoAvailable (string instanceId) + { + return _platformAgent.isISDemandOnlyRewardedVideoAvailable(instanceId); + } + + //******************* Interstitial API *******************// + + public void loadInterstitial () + { + _platformAgent.loadInterstitial (); + } + + public void showInterstitial () + { + _platformAgent.showInterstitial (); + } + + public void showInterstitial (string placementName) + { + _platformAgent.showInterstitial (placementName); + } + + public bool isInterstitialReady () + { + return _platformAgent.isInterstitialReady (); + } + + public bool isInterstitialPlacementCapped (string placementName) + { + return _platformAgent.isInterstitialPlacementCapped (placementName); + } + + //******************* Interstitial DemandOnly API *******************// + + public void loadISDemandOnlyInterstitial (string instanceId) + { + _platformAgent.loadISDemandOnlyInterstitial(instanceId); + } + + public void showISDemandOnlyInterstitial (string instanceId) + { + _platformAgent.showISDemandOnlyInterstitial(instanceId); + } + + public bool isISDemandOnlyInterstitialReady (string instanceId) + { + return _platformAgent.isISDemandOnlyInterstitialReady(instanceId); + } + + //******************* Offerwall API *******************// + + public void showOfferwall () + { + _platformAgent.showOfferwall (); + } + + public void showOfferwall (string placementName) + { + _platformAgent.showOfferwall (placementName); + } + + public void getOfferwallCredits () + { + _platformAgent.getOfferwallCredits (); + } + + public bool isOfferwallAvailable () + { + return _platformAgent.isOfferwallAvailable (); + } + + //******************* Banner API *******************// + + public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position) + { + _platformAgent.loadBanner (size, position); + } + + public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position, string placementName) + { + _platformAgent.loadBanner (size, position, placementName); + } + + public void destroyBanner() + { + _platformAgent.destroyBanner (); + } + + public void displayBanner() + { + _platformAgent.displayBanner (); + } + + public void hideBanner() + { + _platformAgent.hideBanner (); + } + + + public bool isBannerPlacementCapped(string placementName) + { + return _platformAgent.isBannerPlacementCapped (placementName); + + } + + public void setSegment(IronSourceSegment segment) + { + _platformAgent.setSegment (segment); + } + + public void setConsent(bool consent) + { + _platformAgent.setConsent(consent); + } + + //******************* ConsentView API *******************// + + public void loadConsentViewWithType(string consentViewType) + { + _platformAgent.loadConsentViewWithType(consentViewType); + } + + public void showConsentViewWithType(string consentViewType) + { + _platformAgent.showConsentViewWithType(consentViewType); + } + + //******************* ILRD API *******************// + + public void setAdRevenueData(string dataSource, Dictionary impressionData) + { + _platformAgent.setAdRevenueData( dataSource , impressionData); + } + + #endregion +} diff --git a/popcorn/Assets/IronSource/Scripts/IronSource.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSource.cs.meta new file mode 100644 index 00000000..0d5f3458 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSource.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6ec69520ef1aa4f74b7695ff3da85a8b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceConfig.cs b/popcorn/Assets/IronSource/Scripts/IronSourceConfig.cs new file mode 100644 index 00000000..a43dc35e --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceConfig.cs @@ -0,0 +1,127 @@ +using System.Runtime.InteropServices; +using UnityEngine; +using System.Collections; + +using System.Collections.Generic; + +public class IronSourceConfig +{ + private const string unsupportedPlatformStr = "Unsupported Platform"; + private static IronSourceConfig _instance; + + public static IronSourceConfig Instance { + get { + if (_instance == null) { + _instance = new IronSourceConfig (); + } + return _instance; + } + } + + + #if UNITY_ANDROID && !UNITY_EDITOR + private static AndroidJavaObject _androidBridge; + private readonly static string AndroidBridge = "com.ironsource.unity.androidbridge.AndroidBridge"; + + public IronSourceConfig () + { + using (var pluginClass = new AndroidJavaClass( AndroidBridge )) + _androidBridge = pluginClass.CallStatic ("getInstance"); + } + + //Setters + public void setLanguage (string language) + { + _androidBridge.Call ("setLanguage", language); + } + + public void setClientSideCallbacks (bool status) + { + _androidBridge.Call ("setClientSideCallbacks", status); + } + + public void setRewardedVideoCustomParams (Dictionary rewardedVideoCustomParams) + { + string json = IronSourceJSON.Json.Serialize (rewardedVideoCustomParams); + _androidBridge.Call ("setRewardedVideoCustomParams", json); + } + + public void setOfferwallCustomParams (Dictionary offerwallCustomParams) + { + string json = IronSourceJSON.Json.Serialize (offerwallCustomParams); + _androidBridge.Call ("setOfferwallCustomParams", json); + } + + + #elif (UNITY_IPHONE || UNITY_IOS) && !UNITY_EDITOR + [DllImport("__Internal")] + private static extern void CFSetLanguage (string language); + + [DllImport("__Internal")] + private static extern void CFSetClientSideCallbacks (bool useClientSideCallbacks); + + [DllImport("__Internal")] + private static extern void CFSetRewardedVideoCustomParams (string rewardedVideoCustomParams); + + [DllImport("__Internal")] + private static extern void CFSetOfferwallCustomParams (string offerwallCustomParams); + + + public void setLanguage (string language) + { + CFSetLanguage (language); + } + + public void setClientSideCallbacks (bool status) + { + CFSetClientSideCallbacks (status); + } + + public void setRewardedVideoCustomParams (Dictionary rewardedVideoCustomParams) + { + string json = IronSourceJSON.Json.Serialize (rewardedVideoCustomParams); + CFSetRewardedVideoCustomParams (json); + } + + public void setOfferwallCustomParams (Dictionary offerwallCustomParams) + { + string json = IronSourceJSON.Json.Serialize (offerwallCustomParams); + CFSetOfferwallCustomParams (json); + } + + public IronSourceConfig () + { + + } + + + #else + public void setLanguage (string language) + { + Debug.Log (unsupportedPlatformStr); + } + + public void setClientSideCallbacks (bool status) + { + Debug.Log (unsupportedPlatformStr); + } + + public void setRewardedVideoCustomParams (Dictionary rewardedVideoCustomParams) + { + Debug.Log (unsupportedPlatformStr); + } + + public void setOfferwallCustomParams (Dictionary offerwallCustomParams) + { + Debug.Log (unsupportedPlatformStr); + } + + public IronSourceConfig () + { + Debug.Log (unsupportedPlatformStr); + } + + #endif +} + + diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceConfig.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceConfig.cs.meta new file mode 100644 index 00000000..58b3248f --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e25760c5c158c41b4aa31bffb0209769 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceConstants.cs b/popcorn/Assets/IronSource/Scripts/IronSourceConstants.cs new file mode 100644 index 00000000..287bd086 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceConstants.cs @@ -0,0 +1,35 @@ +public static class IronSourceConstants +{ + public const string interstitialBridgeListenerClass = "com.ironsource.unity.androidbridge.UnityInterstitialListener"; + public const string rewardedVideoBridgeListenerClass = "com.ironsource.unity.androidbridge.UnityRewardedVideoListener"; + public const string bridgeClass = "com.ironsource.unity.androidbridge.AndroidBridge"; + public const string offerwallBridgeListenerClass = "com.ironsource.unity.androidbridge.UnityOfferwallListener"; + public const string bannerBridgeListenerClass = "com.ironsource.unity.androidbridge.UnityBannerListener"; + public const string segmentBridgeListenerClass = "com.ironsource.unity.androidbridge.UnitySegmentListener"; + public const string ERROR_CODE = "error_code"; + public const string ERROR_DESCRIPTION = "error_description"; + public const string INSTANCE_ID_KEY = "instanceId"; + public const string PLACEMENT_KEY = "placement"; + public const string IMPRESSION_DATA_KEY_AUCTION_ID = "auctionId"; + public const string IMPRESSION_DATA_KEY_AD_UNIT = "adUnit"; + public const string IMPRESSION_DATA_KEY_COUNTRY = "country"; + public const string IMPRESSION_DATA_KEY_ABTEST = "ab"; + public const string IMPRESSION_DATA_KEY_SEGMENT_NAME = "segmentName"; + public const string IMPRESSION_DATA_KEY_PLACEMENT = "placement"; + public const string IMPRESSION_DATA_KEY_AD_NETWORK = "adNetwork"; + public const string IMPRESSION_DATA_KEY_INSTANCE_NAME = "instanceName"; + public const string IMPRESSION_DATA_KEY_INSTANCE_ID = "instanceId"; + public const string IMPRESSION_DATA_KEY_REVENUE = "revenue"; + public const string IMPRESSION_DATA_KEY_PRECISION = "precision"; + public const string IMPRESSION_DATA_KEY_LIFETIME_REVENUE = "lifetimeRevenue"; + public const string IMPRESSION_DATA_KEY_ENCRYPTED_CPM = "encryptedCPM"; + public const string IMPRESSION_DATA_KEY_CONVERSION_VALUE= "conversionValue"; + public const string GENDER_MALE = "male"; + public const string GENDER_FEMALE = "female"; + public const string GENDER_UNKNOWN = "unknown"; + + public const string IRONSOURCE_MEDIATION_SETTING_NAME = "IronSourceMediationSettings"; + public const string IRONSOURCE_MEDIATED_NETWORK_SETTING_NAME = "IronSourceMediatedNetworkSettings"; + public const string IRONSOURCE_RESOURCES_PATH = "Assets/IronSource/Resources"; + public const string IRONSOURCE_SKAN_ID_KEY = "su67r6k2v3.skadnetwork"; +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceConstants.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceConstants.cs.meta new file mode 100644 index 00000000..807a305e --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceConstants.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 86d04d1d517d942e79c31e208285c06a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceError.cs b/popcorn/Assets/IronSource/Scripts/IronSourceError.cs new file mode 100644 index 00000000..10bf9c32 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceError.cs @@ -0,0 +1,35 @@ + +using System; + +public class IronSourceError +{ + private string description; + private int code; + + public int getErrorCode () + { + return code; + } + + public string getDescription () + { + return description; + } + + public int getCode () + { + return code; + } + + public IronSourceError (int errorCode, string errorDescription) + { + code = errorCode; + description = errorDescription; + } + + public override string ToString () + { + return code + " : " + description; + } +} + diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceError.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceError.cs.meta new file mode 100644 index 00000000..1b3d1db6 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceError.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3eeee77c4aea4a979d85dcb1630fbe4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceEvents.cs b/popcorn/Assets/IronSource/Scripts/IronSourceEvents.cs new file mode 100644 index 00000000..0144a3c9 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceEvents.cs @@ -0,0 +1,1246 @@ + using UnityEngine; + using System; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Globalization; + + public class IronSourceEvents : MonoBehaviour + { + private const string ERROR_CODE = "error_code"; + private const string ERROR_DESCRIPTION = "error_description"; + private const string INSTANCE_ID_KEY = "instanceId"; + private const string PLACEMENT_KEY = "placement"; + + void Awake () + { + gameObject.name = "IronSourceEvents"; //Change the GameObject name to IronSourceEvents. + DontDestroyOnLoad (gameObject); //Makes the object not be destroyed automatically when loading a new scene. + } + + // ******************************* Rewarded Video Events ******************************* + private static event Action _onRewardedVideoAdShowFailedEvent; + + public static event Action onRewardedVideoAdShowFailedEvent { + add { + if (_onRewardedVideoAdShowFailedEvent == null || !_onRewardedVideoAdShowFailedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdShowFailedEvent += value; + } + } + + remove { + if (_onRewardedVideoAdShowFailedEvent != null || _onRewardedVideoAdShowFailedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdShowFailedEvent -= value; + } + } + } + + public void onRewardedVideoAdShowFailed (string description) + { + if (_onRewardedVideoAdShowFailedEvent != null) { + IronSourceError sse = getErrorFromErrorObject (description); + _onRewardedVideoAdShowFailedEvent (sse); + } + } + + private static event Action _onRewardedVideoAdOpenedEvent; + + public static event Action onRewardedVideoAdOpenedEvent { + add { + if (_onRewardedVideoAdOpenedEvent == null || !_onRewardedVideoAdOpenedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdOpenedEvent += value; + } + } + + remove { + if (_onRewardedVideoAdOpenedEvent != null || _onRewardedVideoAdOpenedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdOpenedEvent -= value; + } + } + } + + public void onRewardedVideoAdOpened (string empty) + { + if (_onRewardedVideoAdOpenedEvent != null) { + _onRewardedVideoAdOpenedEvent (); + } + } + + private static event Action _onRewardedVideoAdClosedEvent; + + public static event Action onRewardedVideoAdClosedEvent { + add { + if (_onRewardedVideoAdClosedEvent == null || !_onRewardedVideoAdClosedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClosedEvent += value; + } + } + + remove { + if (_onRewardedVideoAdClosedEvent != null || _onRewardedVideoAdClosedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClosedEvent -= value; + } + } + } + + public void onRewardedVideoAdClosed (string empty) + { + if (_onRewardedVideoAdClosedEvent != null) { + _onRewardedVideoAdClosedEvent (); + } + } + + private static event Action _onRewardedVideoAdStartedEvent; + + public static event Action onRewardedVideoAdStartedEvent { + add { + if (_onRewardedVideoAdStartedEvent == null || !_onRewardedVideoAdStartedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdStartedEvent += value; + } + } + + remove { + if (_onRewardedVideoAdStartedEvent != null || _onRewardedVideoAdStartedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdStartedEvent -= value; + } + } + } + + public void onRewardedVideoAdStarted (string empty) + { + if (_onRewardedVideoAdStartedEvent != null) { + _onRewardedVideoAdStartedEvent (); + } + } + + private static event Action _onRewardedVideoAdEndedEvent; + + public static event Action onRewardedVideoAdEndedEvent { + add { + if (_onRewardedVideoAdEndedEvent == null || !_onRewardedVideoAdEndedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdEndedEvent += value; + } + } + + remove { + if (_onRewardedVideoAdEndedEvent != null || _onRewardedVideoAdEndedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdEndedEvent -= value; + } + } + } + + public void onRewardedVideoAdEnded (string empty) + { + if (_onRewardedVideoAdEndedEvent != null) { + _onRewardedVideoAdEndedEvent (); + } + } + + private static event Action _onRewardedVideoAdRewardedEvent; + + public static event Action onRewardedVideoAdRewardedEvent { + add { + if (_onRewardedVideoAdRewardedEvent == null || !_onRewardedVideoAdRewardedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdRewardedEvent += value; + } + } + + remove { + if (_onRewardedVideoAdRewardedEvent != null || _onRewardedVideoAdRewardedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdRewardedEvent -= value; + } + } + } + + public void onRewardedVideoAdRewarded (string description) + { + if (_onRewardedVideoAdRewardedEvent != null) { + IronSourcePlacement ssp = getPlacementFromObject (description); + _onRewardedVideoAdRewardedEvent (ssp); + } + } + + private static event Action _onRewardedVideoAdClickedEvent; + + public static event Action onRewardedVideoAdClickedEvent { + add { + if (_onRewardedVideoAdClickedEvent == null || !_onRewardedVideoAdClickedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClickedEvent += value; + } + } + + remove { + if (_onRewardedVideoAdClickedEvent != null || _onRewardedVideoAdClickedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClickedEvent -= value; + } + } + } + + public void onRewardedVideoAdClicked (string description) + { + if (_onRewardedVideoAdClickedEvent != null) { + IronSourcePlacement ssp = getPlacementFromObject (description); + _onRewardedVideoAdClickedEvent (ssp); + } + } + + private static event Action _onRewardedVideoAvailabilityChangedEvent; + + public static event Action onRewardedVideoAvailabilityChangedEvent { + add { + if (_onRewardedVideoAvailabilityChangedEvent == null || !_onRewardedVideoAvailabilityChangedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAvailabilityChangedEvent += value; + } + } + + remove { + if (_onRewardedVideoAvailabilityChangedEvent != null || _onRewardedVideoAvailabilityChangedEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAvailabilityChangedEvent -= value; + } + } + } + + public void onRewardedVideoAvailabilityChanged (string stringAvailable) + { + bool isAvailable = (stringAvailable == "true") ? true : false; + if (_onRewardedVideoAvailabilityChangedEvent != null) + _onRewardedVideoAvailabilityChangedEvent (isAvailable); + } + + // ******************************* RewardedVideo DemandOnly Events ******************************* + + private static event Action _onRewardedVideoAdLoadedDemandOnlyEvent; + + public static event Action onRewardedVideoAdLoadedDemandOnlyEvent { + add { + if (_onRewardedVideoAdLoadedDemandOnlyEvent == null || !_onRewardedVideoAdLoadedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdLoadedDemandOnlyEvent += value; + } + } + + remove { + if (_onRewardedVideoAdLoadedDemandOnlyEvent != null || _onRewardedVideoAdLoadedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdLoadedDemandOnlyEvent -= value; + } + } + } + + public void onRewardedVideoAdLoadedDemandOnly (string instanceId) + { + if (_onRewardedVideoAdLoadedDemandOnlyEvent != null ) { + _onRewardedVideoAdLoadedDemandOnlyEvent (instanceId); + } + } + + private static event Action _onRewardedVideoAdLoadFailedDemandOnlyEvent; + + public static event Action onRewardedVideoAdLoadFailedDemandOnlyEvent { + add { + if (_onRewardedVideoAdLoadFailedDemandOnlyEvent == null || !_onRewardedVideoAdLoadFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdLoadFailedDemandOnlyEvent += value; + } + } + + remove { + if (_onRewardedVideoAdLoadFailedDemandOnlyEvent != null || _onRewardedVideoAdLoadFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdLoadFailedDemandOnlyEvent -= value; + } + } + } + + public void onRewardedVideoAdLoadFailedDemandOnly (string args) + { + if (_onRewardedVideoAdLoadFailedDemandOnlyEvent != null && !String.IsNullOrEmpty(args)) { + List argList = IronSourceJSON.Json.Deserialize (args) as List; + IronSourceError err = getErrorFromErrorObject(argList[1]); + string instanceId = argList[0].ToString(); + _onRewardedVideoAdLoadFailedDemandOnlyEvent (instanceId, err); + } + } + + private static event Action _onRewardedVideoAdOpenedDemandOnlyEvent; + + public static event Action onRewardedVideoAdOpenedDemandOnlyEvent { + add { + if (_onRewardedVideoAdOpenedDemandOnlyEvent == null || !_onRewardedVideoAdOpenedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdOpenedDemandOnlyEvent += value; + } + } + + remove { + if (_onRewardedVideoAdOpenedDemandOnlyEvent != null || _onRewardedVideoAdOpenedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdOpenedDemandOnlyEvent -= value; + } + } + } + + public void onRewardedVideoAdOpenedDemandOnly (string instanceId) + { + if (_onRewardedVideoAdOpenedDemandOnlyEvent != null) { + _onRewardedVideoAdOpenedDemandOnlyEvent (instanceId); + } + } + + private static event Action _onRewardedVideoAdClosedDemandOnlyEvent; + + public static event Action onRewardedVideoAdClosedDemandOnlyEvent { + add { + if (_onRewardedVideoAdClosedDemandOnlyEvent == null || !_onRewardedVideoAdClosedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClosedDemandOnlyEvent += value; + } + } + + remove { + if (_onRewardedVideoAdClosedDemandOnlyEvent != null || _onRewardedVideoAdClosedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClosedDemandOnlyEvent -= value; + } + } + } + + public void onRewardedVideoAdClosedDemandOnly (string instanceId) + { + if (_onRewardedVideoAdClosedDemandOnlyEvent != null) { + _onRewardedVideoAdClosedDemandOnlyEvent (instanceId); + } + } + + private static event Action _onRewardedVideoAdRewardedDemandOnlyEvent; + + public static event Action onRewardedVideoAdRewardedDemandOnlyEvent { + add { + if (_onRewardedVideoAdRewardedDemandOnlyEvent == null || !_onRewardedVideoAdRewardedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdRewardedDemandOnlyEvent += value; + } + } + + remove { + if (_onRewardedVideoAdRewardedDemandOnlyEvent != null || _onRewardedVideoAdRewardedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdRewardedDemandOnlyEvent -= value; + } + } + } + + public void onRewardedVideoAdRewardedDemandOnly (string instanceId) + { + if (_onRewardedVideoAdRewardedDemandOnlyEvent != null) { + _onRewardedVideoAdRewardedDemandOnlyEvent (instanceId); + } + } + + private static event Action _onRewardedVideoAdShowFailedDemandOnlyEvent; + + public static event Action onRewardedVideoAdShowFailedDemandOnlyEvent { + add { + if (_onRewardedVideoAdShowFailedDemandOnlyEvent == null || !_onRewardedVideoAdShowFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdShowFailedDemandOnlyEvent += value; + } + } + + remove { + if (_onRewardedVideoAdShowFailedDemandOnlyEvent != null || _onRewardedVideoAdShowFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdShowFailedDemandOnlyEvent -= value; + } + } + } + + public void onRewardedVideoAdShowFailedDemandOnly (string args) + { + if (_onRewardedVideoAdShowFailedDemandOnlyEvent != null && !String.IsNullOrEmpty(args)) { + List argList = IronSourceJSON.Json.Deserialize (args) as List; + IronSourceError err = getErrorFromErrorObject(argList[1]); + string instanceId = argList[0].ToString(); + _onRewardedVideoAdShowFailedDemandOnlyEvent (instanceId, err); + } + } + + private static event Action _onRewardedVideoAdClickedDemandOnlyEvent; + + public static event Action onRewardedVideoAdClickedDemandOnlyEvent { + add { + if (_onRewardedVideoAdClickedDemandOnlyEvent == null || !_onRewardedVideoAdClickedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClickedDemandOnlyEvent += value; + } + } + + remove { + if (_onRewardedVideoAdClickedDemandOnlyEvent != null || _onRewardedVideoAdClickedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onRewardedVideoAdClickedDemandOnlyEvent -= value; + } + } + } + + public void onRewardedVideoAdClickedDemandOnly (string instanceId) + { + if (_onRewardedVideoAdClickedDemandOnlyEvent != null) { + _onRewardedVideoAdClickedDemandOnlyEvent (instanceId); + } + } + + // ******************************* Interstitial Events ******************************* + + private static event Action _onInterstitialAdReadyEvent; + + public static event Action onInterstitialAdReadyEvent { + add { + if (_onInterstitialAdReadyEvent == null || !_onInterstitialAdReadyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdReadyEvent += value; + } + } + + remove { + if (_onInterstitialAdReadyEvent != null || _onInterstitialAdReadyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdReadyEvent -= value; + } + } + } + + public void onInterstitialAdReady () + { + if (_onInterstitialAdReadyEvent != null) + _onInterstitialAdReadyEvent (); + } + + private static event Action _onInterstitialAdLoadFailedEvent; + + public static event Action onInterstitialAdLoadFailedEvent { + add { + if (_onInterstitialAdLoadFailedEvent == null || !_onInterstitialAdLoadFailedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdLoadFailedEvent += value; + } + } + + remove { + if (_onInterstitialAdLoadFailedEvent != null || _onInterstitialAdLoadFailedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdLoadFailedEvent -= value; + } + } + } + + public void onInterstitialAdLoadFailed (string description) + { + if (_onInterstitialAdLoadFailedEvent != null) { + IronSourceError sse = getErrorFromErrorObject (description); + _onInterstitialAdLoadFailedEvent (sse); + } + } + + private static event Action _onInterstitialAdOpenedEvent; + + public static event Action onInterstitialAdOpenedEvent { + add { + if (_onInterstitialAdOpenedEvent == null || !_onInterstitialAdOpenedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdOpenedEvent += value; + } + } + + remove { + if (_onInterstitialAdOpenedEvent != null || _onInterstitialAdOpenedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdOpenedEvent -= value; + } + } + } + + public void onInterstitialAdOpened (string empty) + { + if (_onInterstitialAdOpenedEvent != null) { + _onInterstitialAdOpenedEvent (); + } + } + + private static event Action _onInterstitialAdClosedEvent; + + public static event Action onInterstitialAdClosedEvent { + add { + if (_onInterstitialAdClosedEvent == null || !_onInterstitialAdClosedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClosedEvent += value; + } + } + + remove { + if (_onInterstitialAdClosedEvent != null || _onInterstitialAdClosedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClosedEvent -= value; + } + } + } + + public void onInterstitialAdClosed (string empty) + { + if (_onInterstitialAdClosedEvent != null) { + _onInterstitialAdClosedEvent (); + } + } + + private static event Action _onInterstitialAdShowSucceededEvent; + + public static event Action onInterstitialAdShowSucceededEvent { + add { + if (_onInterstitialAdShowSucceededEvent == null || !_onInterstitialAdShowSucceededEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdShowSucceededEvent += value; + } + } + + remove { + if (_onInterstitialAdShowSucceededEvent != null || _onInterstitialAdShowSucceededEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdShowSucceededEvent -= value; + } + } + } + + public void onInterstitialAdShowSucceeded (string empty) + { + if (_onInterstitialAdShowSucceededEvent != null) { + _onInterstitialAdShowSucceededEvent (); + } + } + + private static event Action _onInterstitialAdShowFailedEvent; + + public static event Action onInterstitialAdShowFailedEvent { + add { + if (_onInterstitialAdShowFailedEvent == null || !_onInterstitialAdShowFailedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdShowFailedEvent += value; + } + } + + remove { + if (_onInterstitialAdShowFailedEvent != null || _onInterstitialAdShowFailedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdShowFailedEvent -= value; + } + } + } + + public void onInterstitialAdShowFailed (string description) + { + if (_onInterstitialAdShowFailedEvent != null) { + IronSourceError sse = getErrorFromErrorObject (description); + _onInterstitialAdShowFailedEvent (sse); + } + } + + private static event Action _onInterstitialAdClickedEvent; + + public static event Action onInterstitialAdClickedEvent { + add { + if (_onInterstitialAdClickedEvent == null || !_onInterstitialAdClickedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClickedEvent += value; + } + } + + remove { + if (_onInterstitialAdClickedEvent != null || _onInterstitialAdClickedEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClickedEvent -= value; + } + } + } + + public void onInterstitialAdClicked (string empty) + { + if (_onInterstitialAdClickedEvent != null) { + _onInterstitialAdClickedEvent (); + } + } + + // ******************************* Interstitial DemanOnly Events ******************************* + + private static event Action _onInterstitialAdReadyDemandOnlyEvent; + + public static event Action onInterstitialAdReadyDemandOnlyEvent { + add { + if (_onInterstitialAdReadyDemandOnlyEvent == null || !_onInterstitialAdReadyDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdReadyDemandOnlyEvent += value; + } + } + + remove { + if (_onInterstitialAdReadyDemandOnlyEvent != null || _onInterstitialAdReadyDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdReadyDemandOnlyEvent -= value; + } + } + } + + public void onInterstitialAdReadyDemandOnly (string instanceId) + { + if (_onInterstitialAdReadyDemandOnlyEvent != null) + _onInterstitialAdReadyDemandOnlyEvent (instanceId); + } + + + private static event Action _onInterstitialAdLoadFailedDemandOnlyEvent; + + public static event Action onInterstitialAdLoadFailedDemandOnlyEvent { + add { + if (_onInterstitialAdLoadFailedDemandOnlyEvent == null || !_onInterstitialAdLoadFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdLoadFailedDemandOnlyEvent += value; + } + } + + remove { + if (_onInterstitialAdLoadFailedDemandOnlyEvent != null || _onInterstitialAdLoadFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdLoadFailedDemandOnlyEvent -= value; + } + } + } + + public void onInterstitialAdLoadFailedDemandOnly (string args) + { + if (_onInterstitialAdLoadFailedDemandOnlyEvent != null && !String.IsNullOrEmpty(args)) { + List argList = IronSourceJSON.Json.Deserialize (args) as List; + IronSourceError err = getErrorFromErrorObject(argList[1]); + string instanceId = argList[0].ToString(); + _onInterstitialAdLoadFailedDemandOnlyEvent (instanceId, err); + } + } + + private static event Action _onInterstitialAdOpenedDemandOnlyEvent; + + public static event Action onInterstitialAdOpenedDemandOnlyEvent { + add { + if (_onInterstitialAdOpenedDemandOnlyEvent == null || !_onInterstitialAdOpenedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdOpenedDemandOnlyEvent += value; + } + } + + remove { + if (_onInterstitialAdOpenedDemandOnlyEvent != null || _onInterstitialAdOpenedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdOpenedDemandOnlyEvent -= value; + } + } + } + + public void onInterstitialAdOpenedDemandOnly (string instanceId) + { + if (_onInterstitialAdOpenedDemandOnlyEvent != null) { + _onInterstitialAdOpenedDemandOnlyEvent (instanceId); + } + } + + private static event Action _onInterstitialAdClosedDemandOnlyEvent; + + public static event Action onInterstitialAdClosedDemandOnlyEvent { + add { + if (_onInterstitialAdClosedDemandOnlyEvent == null || !_onInterstitialAdClosedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClosedDemandOnlyEvent += value; + } + } + + remove { + if (_onInterstitialAdClosedDemandOnlyEvent != null || _onInterstitialAdClosedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClosedDemandOnlyEvent -= value; + } + } + } + + public void onInterstitialAdClosedDemandOnly (string instanceId) + { + if (_onInterstitialAdClosedDemandOnlyEvent != null) { + _onInterstitialAdClosedDemandOnlyEvent (instanceId); + } + } + + private static event Action _onInterstitialAdShowFailedDemandOnlyEvent; + + public static event Action onInterstitialAdShowFailedDemandOnlyEvent { + add { + if (_onInterstitialAdShowFailedDemandOnlyEvent == null || !_onInterstitialAdShowFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdShowFailedDemandOnlyEvent += value; + } + } + + remove { + if (_onInterstitialAdShowFailedDemandOnlyEvent != null || _onInterstitialAdShowFailedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdShowFailedDemandOnlyEvent -= value; + } + } + } + + public void onInterstitialAdShowFailedDemandOnly (string args) + { + if (_onInterstitialAdLoadFailedDemandOnlyEvent != null && !String.IsNullOrEmpty (args)) { + List argList = IronSourceJSON.Json.Deserialize (args) as List; + IronSourceError sse = getErrorFromErrorObject(argList[1]); + string instanceId = argList[0].ToString(); + _onInterstitialAdShowFailedDemandOnlyEvent (instanceId, sse); + } + } + + private static event Action _onInterstitialAdClickedDemandOnlyEvent; + + public static event Action onInterstitialAdClickedDemandOnlyEvent { + add { + if (_onInterstitialAdClickedDemandOnlyEvent == null || !_onInterstitialAdClickedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClickedDemandOnlyEvent += value; + } + } + + remove { + if (_onInterstitialAdClickedDemandOnlyEvent != null || _onInterstitialAdClickedDemandOnlyEvent.GetInvocationList ().Contains (value)) { + _onInterstitialAdClickedDemandOnlyEvent -= value; + } + } + } + + public void onInterstitialAdClickedDemandOnly (string instanceId) + { + if (_onInterstitialAdClickedDemandOnlyEvent != null) { + _onInterstitialAdClickedDemandOnlyEvent (instanceId); + } + } + + // ******************************* Offerwall Events ******************************* + + private static event Action _onOfferwallOpenedEvent; + + public static event Action onOfferwallOpenedEvent { + add { + if (_onOfferwallOpenedEvent == null || !_onOfferwallOpenedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallOpenedEvent += value; + } + } + + remove { + if (_onOfferwallOpenedEvent != null || _onOfferwallOpenedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallOpenedEvent -= value; + } + } + } + + public void onOfferwallOpened (string empty) + { + if (_onOfferwallOpenedEvent != null) { + _onOfferwallOpenedEvent (); + } + } + + private static event Action _onOfferwallShowFailedEvent; + + public static event Action onOfferwallShowFailedEvent { + add { + if (_onOfferwallShowFailedEvent == null || !_onOfferwallShowFailedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallShowFailedEvent += value; + } + } + + remove { + if (_onOfferwallShowFailedEvent != null || _onOfferwallShowFailedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallShowFailedEvent -= value; + } + } + } + + public void onOfferwallShowFailed (string description) + { + if (_onOfferwallShowFailedEvent != null) { + IronSourceError sse = getErrorFromErrorObject (description); + _onOfferwallShowFailedEvent (sse); + } + } + + private static event Action _onOfferwallClosedEvent; + + public static event Action onOfferwallClosedEvent { + add { + if (_onOfferwallClosedEvent == null || !_onOfferwallClosedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallClosedEvent += value; + } + } + + remove { + if (_onOfferwallClosedEvent != null || _onOfferwallClosedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallClosedEvent -= value; + } + } + } + + public void onOfferwallClosed (string empty) + { + if (_onOfferwallClosedEvent != null) { + _onOfferwallClosedEvent (); + } + } + + private static event Action _onGetOfferwallCreditsFailedEvent; + + public static event Action onGetOfferwallCreditsFailedEvent { + add { + if (_onGetOfferwallCreditsFailedEvent == null || !_onGetOfferwallCreditsFailedEvent.GetInvocationList ().Contains (value)) { + _onGetOfferwallCreditsFailedEvent += value; + } + } + + remove { + if (_onGetOfferwallCreditsFailedEvent != null || _onGetOfferwallCreditsFailedEvent.GetInvocationList ().Contains (value)) { + _onGetOfferwallCreditsFailedEvent -= value; + } + } + } + + public void onGetOfferwallCreditsFailed (string description) + { + if (_onGetOfferwallCreditsFailedEvent != null) { + IronSourceError sse = getErrorFromErrorObject (description); + _onGetOfferwallCreditsFailedEvent (sse); + + } + } + + private static event Action> _onOfferwallAdCreditedEvent; + + public static event Action> onOfferwallAdCreditedEvent { + add { + if (_onOfferwallAdCreditedEvent == null || !_onOfferwallAdCreditedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallAdCreditedEvent += value; + } + } + + remove { + if (_onOfferwallAdCreditedEvent != null || _onOfferwallAdCreditedEvent.GetInvocationList ().Contains (value)) { + _onOfferwallAdCreditedEvent -= value; + } + } + } + + public void onOfferwallAdCredited (string json) + { + if (_onOfferwallAdCreditedEvent != null) + _onOfferwallAdCreditedEvent (IronSourceJSON.Json.Deserialize (json) as Dictionary); + } + + private static event Action _onOfferwallAvailableEvent; + + public static event Action onOfferwallAvailableEvent { + add { + if (_onOfferwallAvailableEvent == null || !_onOfferwallAvailableEvent.GetInvocationList ().Contains (value)) { + _onOfferwallAvailableEvent += value; + } + } + + remove { + if (_onOfferwallAvailableEvent != null || _onOfferwallAvailableEvent.GetInvocationList ().Contains (value)) { + _onOfferwallAvailableEvent -= value; + } + } + } + + public void onOfferwallAvailable (string stringAvailable) + { + bool isAvailable = (stringAvailable == "true") ? true : false; + if (_onOfferwallAvailableEvent != null) + _onOfferwallAvailableEvent (isAvailable); + } + + // ******************************* Banner Events ******************************* + private static event Action _onBannerAdLoadedEvent; + + public static event Action onBannerAdLoadedEvent { + add { + if (_onBannerAdLoadedEvent == null || !_onBannerAdLoadedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdLoadedEvent += value; + } + } + + remove { + if (_onBannerAdLoadedEvent != null || _onBannerAdLoadedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdLoadedEvent -= value; + } + } + } + + public void onBannerAdLoaded () + { + if (_onBannerAdLoadedEvent != null) + _onBannerAdLoadedEvent (); + } + + private static event Action _onBannerAdLoadFailedEvent; + + public static event Action onBannerAdLoadFailedEvent { + add { + if (_onBannerAdLoadFailedEvent == null || !_onBannerAdLoadFailedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdLoadFailedEvent += value; + } + } + + remove { + if (_onBannerAdLoadFailedEvent != null || _onBannerAdLoadFailedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdLoadFailedEvent -= value; + } + } + } + + public void onBannerAdLoadFailed (string description) + { + if (_onBannerAdLoadFailedEvent != null) { + IronSourceError sse = getErrorFromErrorObject (description); + _onBannerAdLoadFailedEvent (sse); + } + + } + + private static event Action _onBannerAdClickedEvent; + + public static event Action onBannerAdClickedEvent { + add { + if (_onBannerAdClickedEvent == null || !_onBannerAdClickedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdClickedEvent += value; + } + } + + remove { + if (_onBannerAdClickedEvent != null || _onBannerAdClickedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdClickedEvent -= value; + } + } + } + + public void onBannerAdClicked () + { + if (_onBannerAdClickedEvent != null) + _onBannerAdClickedEvent (); + } + + private static event Action _onBannerAdScreenPresentedEvent; + + public static event Action onBannerAdScreenPresentedEvent { + add { + if (_onBannerAdScreenPresentedEvent == null || !_onBannerAdScreenPresentedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdScreenPresentedEvent += value; + } + } + + remove { + if (_onBannerAdScreenPresentedEvent != null || _onBannerAdScreenPresentedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdScreenPresentedEvent -= value; + } + } + } + + public void onBannerAdScreenPresented () + { + if (_onBannerAdScreenPresentedEvent != null) + _onBannerAdScreenPresentedEvent (); + } + + private static event Action _onBannerAdScreenDismissedEvent; + + public static event Action onBannerAdScreenDismissedEvent { + add { + if (_onBannerAdScreenDismissedEvent == null || !_onBannerAdScreenDismissedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdScreenDismissedEvent += value; + } + } + + remove { + if (_onBannerAdScreenDismissedEvent != null || _onBannerAdScreenDismissedEvent.GetInvocationList ().Contains (value)) { + _onBannerAdScreenDismissedEvent -= value; + } + } + } + + public void onBannerAdScreenDismissed () + { + if (_onBannerAdScreenDismissedEvent != null) + _onBannerAdScreenDismissedEvent (); + } + + private static event Action _onBannerAdLeftApplicationEvent; + + public static event Action onBannerAdLeftApplicationEvent { + add { + if (_onBannerAdLeftApplicationEvent == null || !_onBannerAdLeftApplicationEvent.GetInvocationList ().Contains (value)) { + _onBannerAdLeftApplicationEvent += value; + } + } + + remove { + if (_onBannerAdLeftApplicationEvent != null || _onBannerAdLeftApplicationEvent.GetInvocationList ().Contains (value)) { + _onBannerAdLeftApplicationEvent -= value; + } + } + } + + public void onBannerAdLeftApplication () + { + if (_onBannerAdLeftApplicationEvent != null) + _onBannerAdLeftApplicationEvent (); + } + + private static event Action _onSegmentReceivedEvent; + public static event Action onSegmentReceivedEvent { + add { + if (_onSegmentReceivedEvent == null || !_onSegmentReceivedEvent.GetInvocationList ().Contains (value)) { + _onSegmentReceivedEvent += value; + } + } + + remove { + if (_onSegmentReceivedEvent != null || _onSegmentReceivedEvent.GetInvocationList ().Contains (value)) { + _onSegmentReceivedEvent -= value; + } + } + } + + public void onSegmentReceived (string segmentName) + { + if (_onSegmentReceivedEvent != null) + _onSegmentReceivedEvent (segmentName); + } + + // ******************************* ImpressionData Callbacks ******************************* + + private static event Action _onImpressionSuccessEvent; + + public static event Action onImpressionSuccessEvent + { + add + { + if (_onImpressionSuccessEvent == null || !_onImpressionSuccessEvent.GetInvocationList().Contains(value)) + { + _onImpressionSuccessEvent += value; + } + } + + remove + { + if (_onImpressionSuccessEvent != null || _onImpressionSuccessEvent.GetInvocationList().Contains(value)) + { + _onImpressionSuccessEvent -= value; + } + } + } + + public void onImpressionSuccess(string args) + { + if (_onImpressionSuccessEvent != null) + { + IronSourceImpressionData impressionData = new IronSourceImpressionData(args); + _onImpressionSuccessEvent(impressionData); + } + + } + + // ******************************* ConsentView Callbacks ******************************* + + //iOS callbacks only - in order to prevent using macro for iOS it's not only iOS + private static event Action _onConsentViewDidFailToLoadWithErrorEvent; + + public static event Action onConsentViewDidFailToLoadWithErrorEvent + { + add + { + if (_onConsentViewDidFailToLoadWithErrorEvent == null || !_onConsentViewDidFailToLoadWithErrorEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidFailToLoadWithErrorEvent += value; + } + } + + remove + { + if (_onConsentViewDidFailToLoadWithErrorEvent != null || _onConsentViewDidFailToLoadWithErrorEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidFailToLoadWithErrorEvent -= value; + } + } + } + + public void onConsentViewDidFailToLoadWithError(string args) + { + if (_onConsentViewDidFailToLoadWithErrorEvent != null && !String.IsNullOrEmpty(args)) + { + List argList = IronSourceJSON.Json.Deserialize(args) as List; + IronSourceError err = getErrorFromErrorObject(argList[1]); + string consentViewType = argList[0].ToString(); + _onConsentViewDidFailToLoadWithErrorEvent(consentViewType, err); + } + } + + private static event Action _onConsentViewDidFailToShowWithErrorEvent; + + public static event Action onConsentViewDidFailToShowWithErrorEvent + { + add + { + if (_onConsentViewDidFailToShowWithErrorEvent == null || !_onConsentViewDidFailToShowWithErrorEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidFailToShowWithErrorEvent += value; + } + } + + remove + { + if (_onConsentViewDidFailToShowWithErrorEvent != null || _onConsentViewDidFailToShowWithErrorEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidFailToShowWithErrorEvent -= value; + } + } + } + + public void onConsentViewDidFailToShowWithError(string args) + { + if (_onConsentViewDidFailToShowWithErrorEvent != null && !String.IsNullOrEmpty(args)) + { + List argList = IronSourceJSON.Json.Deserialize(args) as List; + IronSourceError err = getErrorFromErrorObject(argList[1]); + string consentViewType = argList[0].ToString(); + _onConsentViewDidFailToShowWithErrorEvent(consentViewType, err); + } + } + + private static event Action _onConsentViewDidAcceptEvent; + + public static event Action onConsentViewDidAcceptEvent + { + add + { + if (_onConsentViewDidAcceptEvent == null || !_onConsentViewDidAcceptEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidAcceptEvent += value; + } + } + + remove + { + if (_onConsentViewDidAcceptEvent != null || _onConsentViewDidAcceptEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidAcceptEvent -= value; + } + } + } + + public void onConsentViewDidAccept(string consentViewType) + { + if (_onConsentViewDidAcceptEvent != null) + { + _onConsentViewDidAcceptEvent(consentViewType); + } + } + + private static event Action _onConsentViewDidDismissEvent; + + public static event Action onConsentViewDidDismissEvent + { + add + { + if (_onConsentViewDidDismissEvent == null || !_onConsentViewDidDismissEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidDismissEvent += value; + } + } + + remove + { + if (_onConsentViewDidDismissEvent != null || _onConsentViewDidDismissEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidDismissEvent -= value; + } + } + } + + public void onConsentViewDidDismiss(string consentViewType) + { + if (_onConsentViewDidDismissEvent != null) + { + _onConsentViewDidDismissEvent(consentViewType); + } + } + + private static event Action _onConsentViewDidLoadSuccessEvent; + + public static event Action onConsentViewDidLoadSuccessEvent + { + add + { + if (_onConsentViewDidLoadSuccessEvent == null || !_onConsentViewDidLoadSuccessEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidLoadSuccessEvent += value; + } + } + + remove + { + if (_onConsentViewDidLoadSuccessEvent != null || _onConsentViewDidLoadSuccessEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidLoadSuccessEvent -= value; + } + } + } + + public void onConsentViewDidLoadSuccess(string consentViewType) + { + if (_onConsentViewDidLoadSuccessEvent != null) + { + _onConsentViewDidLoadSuccessEvent(consentViewType); + } + } + + private static event Action _onConsentViewDidShowSuccessEvent; + + public static event Action onConsentViewDidShowSuccessEvent + { + add + { + if (_onConsentViewDidShowSuccessEvent == null || !_onConsentViewDidShowSuccessEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidShowSuccessEvent += value; + } + } + + remove + { + if (_onConsentViewDidShowSuccessEvent != null || _onConsentViewDidShowSuccessEvent.GetInvocationList().Contains(value)) + { + _onConsentViewDidShowSuccessEvent -= value; + } + } + } + + public void onConsentViewDidShowSuccess(string consentViewType) + { + if (_onConsentViewDidShowSuccessEvent != null) + { + _onConsentViewDidShowSuccessEvent(consentViewType); + } + } + + // ******************************* Helper methods ******************************* + + private IronSourceError getErrorFromErrorObject (object descriptionObject) + { + Dictionary error = null; + if (descriptionObject is IDictionary) { + error = descriptionObject as Dictionary; + } + else if (descriptionObject is String && !String.IsNullOrEmpty (descriptionObject.ToString())) { + error = IronSourceJSON.Json.Deserialize (descriptionObject.ToString()) as Dictionary; + } + + IronSourceError sse = new IronSourceError (-1, ""); + if (error != null && error.Count > 0) { + int eCode = Convert.ToInt32 (error [ERROR_CODE].ToString ()); + string eDescription = error [ERROR_DESCRIPTION].ToString (); + sse = new IronSourceError (eCode, eDescription); + } + + return sse; + } + + private IronSourcePlacement getPlacementFromObject (object placementObject) + { + Dictionary placementJSON = null; + if (placementObject is IDictionary) { + placementJSON = placementObject as Dictionary; + } + else if (placementObject is String) { + placementJSON = IronSourceJSON.Json.Deserialize (placementObject.ToString()) as Dictionary; + } + + IronSourcePlacement ssp = null; + if (placementJSON != null && placementJSON.Count > 0) { + int rewardAmount = Convert.ToInt32 (placementJSON ["placement_reward_amount"].ToString ()); + string rewardName = placementJSON ["placement_reward_name"].ToString (); + string placementName = placementJSON ["placement_name"].ToString (); + + ssp = new IronSourcePlacement (placementName, rewardName, rewardAmount); + } + + return ssp; + } + } diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceEvents.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceEvents.cs.meta new file mode 100644 index 00000000..e7b4a105 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceEvents.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 06a7a5a9d456c4634864ec18b18f72dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceIAgent.cs b/popcorn/Assets/IronSource/Scripts/IronSourceIAgent.cs new file mode 100644 index 00000000..dd692561 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceIAgent.cs @@ -0,0 +1,176 @@ +using System.Collections.Generic; + +public interface IronSourceIAgent +{ + //******************* Base API *******************// + + void onApplicationPause (bool pause); + + void setMediationSegment (string segment); + + string getAdvertiserId (); + + void validateIntegration (); + + void shouldTrackNetworkState (bool track); + + bool setDynamicUserId (string dynamicUserId); + + void setAdaptersDebug(bool enabled); + + void setMetaData(string key, string value); + + void setMetaData(string key, params string[] values); + + int? getConversionValue(); + + //******************* SDK Init *******************// + + void setUserId (string userId); + + void init (string appKey); + + void init (string appKey, params string[] adUnits); + + void initISDemandOnly (string appKey, params string[] adUnits); + + //******************* RewardedVideo API *******************// + + void showRewardedVideo (); + + void showRewardedVideo (string placementName); + + bool isRewardedVideoAvailable (); + + bool isRewardedVideoPlacementCapped (string placementName); + + IronSourcePlacement getPlacementInfo (string name); + + void setRewardedVideoServerParams(Dictionary parameters); + + void clearRewardedVideoServerParams(); + + //******************* RewardedVideo DemandOnly API *******************// + + void showISDemandOnlyRewardedVideo (string instanceId); + + void loadISDemandOnlyRewardedVideo (string instanceId); + + bool isISDemandOnlyRewardedVideoAvailable (string instanceId); + + //******************* Interstitial API *******************// + + void loadInterstitial (); + + void showInterstitial (); + + void showInterstitial (string placementName); + + bool isInterstitialReady (); + + bool isInterstitialPlacementCapped (string placementName); + + //******************* Interstitial DemandOnly API *******************// + + void loadISDemandOnlyInterstitial (string instanceId); + + void showISDemandOnlyInterstitial (string instanceId); + + bool isISDemandOnlyInterstitialReady (string instanceId); + + //******************* Offerwall API *******************// + + void showOfferwall (); + + void showOfferwall (string placementName); + + bool isOfferwallAvailable (); + + void getOfferwallCredits (); + + //******************* Banner API *******************// + + void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position); + + void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position, string placementName); + + void destroyBanner(); + + void displayBanner(); + + void hideBanner(); + + bool isBannerPlacementCapped(string placementName); + + void setSegment(IronSourceSegment segment); + + void setConsent(bool consent); + + //******************* ConsentView API *******************// + + void loadConsentViewWithType(string consentViewType); + + void showConsentViewWithType(string consentViewType); + + //******************* ILRD API *******************// + + void setAdRevenueData(string dataSource, Dictionary impressionData); +} + +public static class dataSource +{ + public static string MOPUB { get { return "MoPub"; } } + +} + + +public static class IronSourceAdUnits +{ + public static string REWARDED_VIDEO { get { return "rewardedvideo"; } } + + public static string INTERSTITIAL { get { return "interstitial"; } } + + public static string OFFERWALL { get { return "offerwall"; } } + + public static string BANNER { get { return "banner"; } } +} + +public class IronSourceBannerSize +{ + private int width; + private int height; + private string description; + + public static IronSourceBannerSize BANNER = new IronSourceBannerSize("BANNER"); + public static IronSourceBannerSize LARGE = new IronSourceBannerSize("LARGE"); + public static IronSourceBannerSize RECTANGLE = new IronSourceBannerSize("RECTANGLE"); + public static IronSourceBannerSize SMART = new IronSourceBannerSize("SMART"); + + private IronSourceBannerSize() { + + } + + public IronSourceBannerSize(int width, int height) + { + this.width = width; + this.height = height; + this.description = "CUSTOM"; + } + + public IronSourceBannerSize(string description) + { + this.description = description; + this.width = 0; + this.height = 0; + } + + public string Description { get { return description; } } + public int Width { get { return width; } } + public int Height { get { return height; } } +}; + +public enum IronSourceBannerPosition +{ + TOP = 1, + BOTTOM = 2 +}; diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceIAgent.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceIAgent.cs.meta new file mode 100644 index 00000000..9fb1e9f8 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceIAgent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a69a6174c46124e04b4b27ac7fbdd78d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceImpressionData.cs b/popcorn/Assets/IronSource/Scripts/IronSourceImpressionData.cs new file mode 100644 index 00000000..56cc4b1b --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceImpressionData.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using UnityEngine; + +public class IronSourceImpressionData +{ + + public readonly string auctionId; + public readonly string adUnit; + public readonly string country; + public readonly string ab; + public readonly string segmentName; + public readonly string placement; + public readonly string adNetwork; + public readonly string instanceName; + public readonly string instanceId; + public readonly double? revenue; + public readonly string precision; + public readonly double? lifetimeRevenue; + public readonly string encryptedCPM; + public readonly int? conversionValue; + public readonly string allData; + + + public IronSourceImpressionData(string json) + { + if (json != null) + { + try + { + object obj; + double parsedDouble; + int parsedInt; + allData = json; + // Retrieve a CultureInfo object. + CultureInfo invCulture = CultureInfo.InvariantCulture; + Dictionary jsonDic = IronSourceJSON.Json.Deserialize(json) as Dictionary; + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_AUCTION_ID, out obj) && obj != null) + { + auctionId = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_AD_UNIT, out obj) && obj != null) + { + adUnit = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_COUNTRY, out obj) && obj != null) + { + country = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_ABTEST, out obj) && obj != null) + { + ab = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_SEGMENT_NAME, out obj) && obj != null) + { + segmentName = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_PLACEMENT, out obj) && obj != null) + { + placement = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_AD_NETWORK, out obj) && obj != null) + { + adNetwork = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_INSTANCE_NAME, out obj) && obj != null) + { + instanceName = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.INSTANCE_ID_KEY, out obj) && obj != null) + { + instanceId = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_PRECISION, out obj) && obj != null) + { + precision = obj.ToString(); + } + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_ENCRYPTED_CPM, out obj) && obj != null) + { + encryptedCPM = obj.ToString(); + } + + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_REVENUE, out obj) && obj != null && double.TryParse(string.Format(invCulture, "{0}", obj), NumberStyles.Any, invCulture, out parsedDouble)) + { + revenue = parsedDouble; + } + + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_LIFETIME_REVENUE, out obj) && obj != null && double.TryParse(string.Format(invCulture,"{0}",obj), NumberStyles.Any, invCulture, out parsedDouble)) + { + lifetimeRevenue = parsedDouble; + } + + if (jsonDic.TryGetValue(IronSourceConstants.IMPRESSION_DATA_KEY_CONVERSION_VALUE, out obj) && obj != null && int.TryParse(string.Format(invCulture, "{0}", obj), NumberStyles.Any, invCulture, out parsedInt)) + { + conversionValue = parsedInt; + } + + } + catch (Exception ex) + { + Debug.Log("error parsing impression " + ex.ToString()); + } + + } + } + + public override string ToString() + { + return "IronSourceImpressionData{" + + "auctionId='" + auctionId + '\'' + + ", adUnit='" + adUnit + '\'' + + ", country='" + country + '\'' + + ", ab='" + ab + '\'' + + ", segmentName='" + segmentName + '\'' + + ", placement='" + placement + '\'' + + ", adNetwork='" + adNetwork + '\'' + + ", instanceName='" + instanceName + '\'' + + ", instanceId='" + instanceId + '\'' + + ", revenue=" + revenue + + ", precision='" + precision + '\'' + + ", lifetimeRevenue=" + lifetimeRevenue + + ", encryptedCPM='" + encryptedCPM + '\'' + + ", conversionValue=" + conversionValue + + '}'; + } +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceImpressionData.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceImpressionData.cs.meta new file mode 100644 index 00000000..2450e9a8 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceImpressionData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ab0e9e995e4a4024abb4cee85c301ba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceInitilizer.cs b/popcorn/Assets/IronSource/Scripts/IronSourceInitilizer.cs new file mode 100644 index 00000000..e9b12e61 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceInitilizer.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +public class IronSourceInitilizer +{ +#if UNITY_IOS || UNITY_ANDROID + [RuntimeInitializeOnLoadMethod] + static void Initilize() + { + var developerSettings = Resources.Load(IronSourceConstants.IRONSOURCE_MEDIATION_SETTING_NAME); + if (developerSettings != null) + { +#if UNITY_ANDROID + string appKey = developerSettings.AndroidAppKey; +#elif UNITY_IOS + string appKey = developerSettings.IOSAppKey; +#endif + if (developerSettings.EnableIronsourceSDKInitAPI == true) + { + if (appKey.Equals(string.Empty)) + { + Debug.LogWarning("IronSourceInitilizer Cannot init without AppKey"); + } + else + { + IronSource.Agent.init(appKey); + } + + } + + if (developerSettings.EnableAdapterDebug) + { + IronSource.Agent.setAdaptersDebug(true); + } + + if (developerSettings.EnableIntegrationHelper) + { + IronSource.Agent.validateIntegration(); + } + } + } +#endif + +} diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceInitilizer.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceInitilizer.cs.meta new file mode 100644 index 00000000..da552e01 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceInitilizer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3e8e12247da34eafb182ebdfb06c10e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceJSON.cs b/popcorn/Assets/IronSource/Scripts/IronSourceJSON.cs new file mode 100644 index 00000000..433e440b --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceJSON.cs @@ -0,0 +1,495 @@ +/* + * Based on the miniJSON by Calvin Rien + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + +namespace IronSourceJSON +{ + public static class Json + { + public static object Deserialize (string json) + { + if (json == null) { + return null; + } + return Parser.Parse (json); + } + + sealed class Parser : IDisposable + { + const string WHITE_SPACE = " \t\n\r"; + const string WORD_BREAK = " \t\n\r{}[],:\""; + + enum TOKEN + { + NONE, + CURLY_OPEN, + CURLY_CLOSE, + SQUARED_OPEN, + SQUARED_CLOSE, + COLON, + COMMA, + STRING, + NUMBER, + TRUE, + FALSE, + NULL + } + ; + + StringReader json; + + Parser (string jsonString) + { + json = new StringReader (jsonString); + } + + public static object Parse (string jsonString) + { + using (var instance = new Parser(jsonString)) { + return instance.ParseValue (); + } + } + + public void Dispose () + { + json.Dispose (); + json = null; + } + + Dictionary ParseObject () + { + Dictionary table = new Dictionary (); + + // ditch opening brace + json.Read (); + + // { + while (true) { + switch (NextToken) { + case TOKEN.NONE: + return null; + case TOKEN.COMMA: + continue; + case TOKEN.CURLY_CLOSE: + return table; + default: + // name + string name = ParseString (); + if (name == null) { + return null; + } + + // : + if (NextToken != TOKEN.COLON) { + return null; + } + // ditch the colon + json.Read (); + + // value + table [name] = ParseValue (); + break; + } + } + } + + List ParseArray () + { + List array = new List (); + + // ditch opening bracket + json.Read (); + + // [ + var parsing = true; + while (parsing) { + TOKEN nextToken = NextToken; + + switch (nextToken) { + case TOKEN.NONE: + return null; + case TOKEN.COMMA: + continue; + case TOKEN.SQUARED_CLOSE: + parsing = false; + break; + default: + object value = ParseByToken (nextToken); + + array.Add (value); + break; + } + } + + return array; + } + + object ParseValue () + { + TOKEN nextToken = NextToken; + return ParseByToken (nextToken); + } + + object ParseByToken (TOKEN token) + { + switch (token) { + case TOKEN.STRING: + return ParseString (); + case TOKEN.NUMBER: + return ParseNumber (); + case TOKEN.CURLY_OPEN: + return ParseObject (); + case TOKEN.SQUARED_OPEN: + return ParseArray (); + case TOKEN.TRUE: + return true; + case TOKEN.FALSE: + return false; + case TOKEN.NULL: + return null; + default: + return null; + } + } + + string ParseString () + { + StringBuilder s = new StringBuilder (); + char c; + + // ditch opening quote + json.Read (); + + bool parsing = true; + while (parsing) { + + if (json.Peek () == -1) { + parsing = false; + break; + } + + c = NextChar; + switch (c) { + case '"': + parsing = false; + break; + case '\\': + if (json.Peek () == -1) { + parsing = false; + break; + } + + c = NextChar; + switch (c) { + case '"': + case '\\': + case '/': + s.Append (c); + break; + case 'b': + s.Append ('\b'); + break; + case 'f': + s.Append ('\f'); + break; + case 'n': + s.Append ('\n'); + break; + case 'r': + s.Append ('\r'); + break; + case 't': + s.Append ('\t'); + break; + case 'u': + var hex = new StringBuilder (); + + for (int i=0; i< 4; i++) { + hex.Append (NextChar); + } + + s.Append ((char)Convert.ToInt32 (hex.ToString (), 16)); + break; + } + break; + default: + s.Append (c); + break; + } + } + + return s.ToString (); + } + + object ParseNumber () + { + string number = NextWord; + + if (number.IndexOf ('.') == -1) { + long parsedInt; + Int64.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out parsedInt); + return parsedInt; + } + + double parsedDouble; + Double.TryParse (number, NumberStyles.Any, CultureInfo.InvariantCulture, out parsedDouble); + return parsedDouble; + } + + void EatWhitespace () + { + while (WHITE_SPACE.IndexOf(PeekChar) != -1) { + json.Read (); + + if (json.Peek () == -1) { + break; + } + } + } + + char PeekChar { + get { + return Convert.ToChar (json.Peek ()); + } + } + + char NextChar { + get { + return Convert.ToChar (json.Read ()); + } + } + + string NextWord { + get { + StringBuilder word = new StringBuilder (); + + while (WORD_BREAK.IndexOf(PeekChar) == -1) { + word.Append (NextChar); + + if (json.Peek () == -1) { + break; + } + } + + return word.ToString (); + } + } + + TOKEN NextToken { + get { + EatWhitespace (); + + if (json.Peek () == -1) { + return TOKEN.NONE; + } + + char c = PeekChar; + switch (c) { + case '{': + return TOKEN.CURLY_OPEN; + case '}': + json.Read (); + return TOKEN.CURLY_CLOSE; + case '[': + return TOKEN.SQUARED_OPEN; + case ']': + json.Read (); + return TOKEN.SQUARED_CLOSE; + case ',': + json.Read (); + return TOKEN.COMMA; + case '"': + return TOKEN.STRING; + case ':': + return TOKEN.COLON; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + return TOKEN.NUMBER; + } + + string word = NextWord; + + switch (word) { + case "false": + return TOKEN.FALSE; + case "true": + return TOKEN.TRUE; + case "null": + return TOKEN.NULL; + } + + return TOKEN.NONE; + } + } + } + + /// + /// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string + /// + /// A Dictionary<string, object> / List<object> + /// A JSON encoded string, or null if object 'json' is not serializable + public static string Serialize (object obj) + { + return Serializer.Serialize (obj); + } + + sealed class Serializer + { + StringBuilder builder; + + Serializer () + { + builder = new StringBuilder (); + } + + public static string Serialize (object obj) + { + var instance = new Serializer (); + + instance.SerializeValue (obj); + + return instance.builder.ToString (); + } + + void SerializeValue (object value) + { + IList asList; + IDictionary asDict; + string asStr; + + if (value == null) { + builder.Append ("null"); + } else if ((asStr = value as string) != null) { + SerializeString (asStr); + } else if (value is bool) { + builder.Append (value.ToString ().ToLower ()); + } else if ((asList = value as IList) != null) { + SerializeArray (asList); + } else if ((asDict = value as IDictionary) != null) { + SerializeObject (asDict); + } else if (value is char) { + SerializeString (value.ToString ()); + } else { + SerializeOther (value); + } + } + + void SerializeObject (IDictionary obj) + { + bool first = true; + + builder.Append ('{'); + + foreach (object e in obj.Keys) { + if (!first) { + builder.Append (','); + } + + SerializeString (e.ToString ()); + builder.Append (':'); + + SerializeValue (obj [e]); + + first = false; + } + + builder.Append ('}'); + } + + void SerializeArray (IList anArray) + { + builder.Append ('['); + + bool first = true; + + foreach (object obj in anArray) { + if (!first) { + builder.Append (','); + } + + SerializeValue (obj); + + first = false; + } + + builder.Append (']'); + } + + void SerializeString (string str) + { + builder.Append ('\"'); + + char[] charArray = str.ToCharArray (); + foreach (var c in charArray) { + switch (c) { + case '"': + builder.Append ("\\\""); + break; + case '\\': + builder.Append ("\\\\"); + break; + case '\b': + builder.Append ("\\b"); + break; + case '\f': + builder.Append ("\\f"); + break; + case '\n': + builder.Append ("\\n"); + break; + case '\r': + builder.Append ("\\r"); + break; + case '\t': + builder.Append ("\\t"); + break; + default: + int codepoint = Convert.ToInt32 (c); + if ((codepoint >= 32) && (codepoint <= 126)) { + builder.Append (c); + } else { + builder.Append ("\\u" + Convert.ToString (codepoint, 16).PadLeft (4, '0')); + } + break; + } + } + + builder.Append ('\"'); + } + + void SerializeOther (object value) + { + if (value is float + || value is int + || value is uint + || value is long + || value is double + || value is sbyte + || value is byte + || value is short + || value is ushort + || value is ulong + || value is decimal) { + builder.Append (value.ToString ()); + } else { + SerializeString (value.ToString ()); + } + } + } + } +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceJSON.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceJSON.cs.meta new file mode 100644 index 00000000..9aa06512 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceJSON.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6704b25b621ab47ebbfa013ced92bdb0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceMediationSettings.cs b/popcorn/Assets/IronSource/Scripts/IronSourceMediationSettings.cs new file mode 100644 index 00000000..93fda39c --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceMediationSettings.cs @@ -0,0 +1,26 @@ +using System.IO; +using UnityEngine; + +public class IronSourceMediationSettings : ScriptableObject +{ + public static readonly string IRONSOURCE_SETTINGS_ASSET_PATH = Path.Combine(IronSourceConstants.IRONSOURCE_RESOURCES_PATH, IronSourceConstants.IRONSOURCE_MEDIATION_SETTING_NAME + ".asset"); + + [Header("Ironsource AppKey")] + [Tooltip("Add your application AppKeys, as provided in Ironsource Platform")] + public string AndroidAppKey = string.Empty; + [Tooltip("Add your application AppKeys, as provided in Ironsource Platform")] + public string IOSAppKey = string.Empty; + + [Header("Automatic Initialization")] + [Tooltip("Use this flag when you wish to initialize all ad units (recommended)")] + public bool EnableIronsourceSDKInitAPI; + + [Header("Ironsource SKAdNetwork ID")] + [Tooltip("Add Ironsource SKAdNetworkIdentifier to your Info.plist for iOS 14+")] + public bool AddIronsourceSkadnetworkID; + + [Header("Project Features")] + public bool EnableAdapterDebug; + + public bool EnableIntegrationHelper; +} diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceMediationSettings.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceMediationSettings.cs.meta new file mode 100644 index 00000000..71bc284a --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceMediationSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d5a679b8640d04834b4f09b8c6adec7a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourcePlacement.cs b/popcorn/Assets/IronSource/Scripts/IronSourcePlacement.cs new file mode 100644 index 00000000..0467ae53 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourcePlacement.cs @@ -0,0 +1,37 @@ +using System; + +public class IronSourcePlacement +{ + private string rewardName; + private int rewardAmount; + private string placementName; + + public IronSourcePlacement (string placementName, string rewardName, int rewardAmount) + { + this.placementName = placementName; + this.rewardName = rewardName; + this.rewardAmount = rewardAmount; + } + + public string getRewardName () + { + return rewardName; + } + + public int getRewardAmount () + { + return rewardAmount; + } + + public string getPlacementName () + { + return placementName; + } + + public override string ToString () + { + return placementName + " : " + rewardName + " : " + rewardAmount; + } + + +} diff --git a/popcorn/Assets/IronSource/Scripts/IronSourcePlacement.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourcePlacement.cs.meta new file mode 100644 index 00000000..eaa50d3c --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourcePlacement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 984e6a9b75cea4626baa9dcb08114ebf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceSegment.cs b/popcorn/Assets/IronSource/Scripts/IronSourceSegment.cs new file mode 100644 index 00000000..332761b8 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceSegment.cs @@ -0,0 +1,66 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System.Linq; + + + + +public class IronSourceSegment +{ + + public int age; + public string gender = null; + public int level; + public int isPaying; + public long userCreationDate; + public double iapt; + public string segmentName = null; + public Dictionary customs; + + public IronSourceSegment () + { + customs = new Dictionary (); + age = -1; + level = -1; + isPaying = -1; + userCreationDate = -1; + iapt = 0; + } + + public void setCustom(string key, string value){ + customs.Add (key, value); + } + + public Dictionary getSegmentAsDict () + { + Dictionary temp = new Dictionary (); + if (age != -1) + temp.Add ("age", age + ""); + if (!string.IsNullOrEmpty(gender)) + temp.Add ("gender", gender); + if (level != -1) + temp.Add ("level", level + ""); + if (isPaying > -1 && isPaying < 2) + temp.Add ("isPaying", isPaying + ""); + if (userCreationDate != -1) + temp.Add ("userCreationDate", userCreationDate + ""); + if (!string.IsNullOrEmpty(segmentName)) + temp.Add ("segmentName", segmentName); + if (iapt > 0) + temp.Add ("iapt", iapt + ""); + + Dictionary result = temp.Concat (customs).GroupBy (d => d.Key).ToDictionary (d => d.Key, d => d.First ().Value); + + return result; + + } + + + + + + +} + + diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceSegment.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceSegment.cs.meta new file mode 100644 index 00000000..7c4793e6 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceSegment.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f060327917ac94f60857545bd54c308e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceUtils.cs b/popcorn/Assets/IronSource/Scripts/IronSourceUtils.cs new file mode 100644 index 00000000..163cfbf1 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceUtils.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +public class IronSourceUtils + { + private const string ERROR_CODE = "error_code"; + private const string ERROR_DESCRIPTION = "error_description"; + private const string INSTANCE_ID_KEY = "instanceId"; + private const string PLACEMENT_KEY = "placement"; + + public static IronSourceError getErrorFromErrorObject(object descriptionObject) + { + Dictionary error = null; + if (descriptionObject is IDictionary) + { + error = descriptionObject as Dictionary; + } + else if (descriptionObject is String && !String.IsNullOrEmpty(descriptionObject.ToString())) + { + error = IronSourceJSON.Json.Deserialize(descriptionObject.ToString()) as Dictionary; + } + + IronSourceError sse = new IronSourceError(-1, ""); + if (error != null && error.Count > 0) + { + int eCode = Convert.ToInt32(error[ERROR_CODE].ToString()); + string eDescription = error[ERROR_DESCRIPTION].ToString(); + sse = new IronSourceError(eCode, eDescription); + } + + return sse; + } + + public static IronSourcePlacement getPlacementFromObject(object placementObject) + { + Dictionary placementJSON = null; + if (placementObject is IDictionary) + { + placementJSON = placementObject as Dictionary; + } + else if (placementObject is String) + { + placementJSON = IronSourceJSON.Json.Deserialize(placementObject.ToString()) as Dictionary; + } + + IronSourcePlacement ssp = null; + if (placementJSON != null && placementJSON.Count > 0) + { + int rewardAmount = Convert.ToInt32(placementJSON["placement_reward_amount"].ToString()); + string rewardName = placementJSON["placement_reward_name"].ToString(); + string placementName = placementJSON["placement_name"].ToString(); + + ssp = new IronSourcePlacement(placementName, rewardName, rewardAmount); + } + + return ssp; + } +} diff --git a/popcorn/Assets/IronSource/Scripts/IronSourceUtils.cs.meta b/popcorn/Assets/IronSource/Scripts/IronSourceUtils.cs.meta new file mode 100644 index 00000000..fa70f690 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/IronSourceUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bba6a563b7b0746aea78a1ea9fea14fe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/UnsupportedPlatformAgent.cs b/popcorn/Assets/IronSource/Scripts/UnsupportedPlatformAgent.cs new file mode 100644 index 00000000..05394f72 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/UnsupportedPlatformAgent.cs @@ -0,0 +1,287 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +public class UnsupportedPlatformAgent : IronSourceIAgent +{ + public UnsupportedPlatformAgent () + { + Debug.Log ("Unsupported Platform"); + } + + #region IronSourceAgent implementation + + public void start () + { + Debug.Log ("Unsupported Platform"); + } + + //******************* Base API *******************// + + public void onApplicationPause (bool pause) + { + Debug.Log ("Unsupported Platform"); + } + + public void setMediationSegment (string segment) + { + Debug.Log ("Unsupported Platform"); + } + + public string getAdvertiserId () + { + Debug.Log ("Unsupported Platform"); + return ""; + } + + public void validateIntegration () + { + Debug.Log ("Unsupported Platform"); + } + + public void shouldTrackNetworkState (bool track) + { + Debug.Log ("Unsupported Platform"); + } + + public bool setDynamicUserId (string dynamicUserId) + { + Debug.Log ("Unsupported Platform"); + return false; + } + + public void setAdaptersDebug(bool enabled) + { + Debug.Log ("Unsupported Platform"); + } + + public void setMetaData(string key, string value) + { + Debug.Log("Unsupported Platform"); + } + + public void setMetaData(string key, params string[] values) + { + Debug.Log("Unsupported Platform"); + } + + public int? getConversionValue() + { + Debug.Log("Unsupported Platform"); + return null; + } + + //******************* SDK Init *******************// + + public void setUserId (string userId) + { + Debug.Log ("Unsupported Platform"); + } + + public void init (string appKey) + { + Debug.Log ("Unsupported Platform"); + } + + public void init (string appKey, params string[] adUnits) + { + Debug.Log ("Unsupported Platform"); + } + + public void initISDemandOnly (string appKey, params string[] adUnits) + { + Debug.Log ("Unsupported Platform"); + } + + //******************* RewardedVideo API *******************// + + public void showRewardedVideo () + { + Debug.Log ("Unsupported Platform"); + } + + public void showRewardedVideo (string placementName) + { + Debug.Log ("Unsupported Platform"); + } + + public bool isRewardedVideoAvailable () + { + Debug.Log ("Unsupported Platform"); + return false; + } + + public bool isRewardedVideoPlacementCapped (string placementName) + { + Debug.Log ("Unsupported Platform"); + return true; + } + + public IronSourcePlacement getPlacementInfo (string placementName) + { + Debug.Log ("Unsupported Platform"); + return null; + } + + public void setRewardedVideoServerParams(Dictionary parameters) + { + Debug.Log ("Unsupported Platform"); + } + + public void clearRewardedVideoServerParams() + { + Debug.Log ("Unsupported Platform"); + } + + //******************* RewardedVideo DemandOnly API *******************// + + public void showISDemandOnlyRewardedVideo (string instanceId) + { + Debug.Log ("Unsupported Platform"); + } + + public void loadISDemandOnlyRewardedVideo (string instanceId) + { + Debug.Log ("Unsupported Platform"); + + } + + public bool isISDemandOnlyRewardedVideoAvailable (string instanceId) + { + Debug.Log ("Unsupported Platform"); + return false; + } + + //******************* Interstitial API *******************// + + public void loadInterstitial () + { + Debug.Log ("Unsupported Platform"); + } + + public void showInterstitial () + { + Debug.Log ("Unsupported Platform"); + } + + public void showInterstitial (string placementName) + { + Debug.Log ("Unsupported Platform"); + } + + public bool isInterstitialReady () + { + Debug.Log ("Unsupported Platform"); + return false; + } + + public bool isInterstitialPlacementCapped (string placementName) + { + Debug.Log ("Unsupported Platform"); + return true; + } + + //******************* Interstitial DemandOnly API *******************// + + public void loadISDemandOnlyInterstitial (string instanceId) + { + Debug.Log ("Unsupported Platform"); + } + + public void showISDemandOnlyInterstitial (string instanceId) + { + Debug.Log ("Unsupported Platform"); + } + + public bool isISDemandOnlyInterstitialReady (string instanceId) + { + Debug.Log ("Unsupported Platform"); + return false; + } + + //******************* Offerwall API *******************// + + public void showOfferwall () + { + Debug.Log ("Unsupported Platform"); + } + + public void showOfferwall (string placementName) + { + Debug.Log ("Unsupported Platform"); + } + + public void getOfferwallCredits () + { + Debug.Log ("Unsupported Platform"); + } + + public bool isOfferwallAvailable () + { + Debug.Log ("Unsupported Platform"); + return false; + } + + //******************* Banner API *******************// + + public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position) + { + Debug.Log ("Unsupported Platform"); + } + + public void loadBanner (IronSourceBannerSize size, IronSourceBannerPosition position, string placementName) + { + Debug.Log ("Unsupported Platform"); + } + + public void destroyBanner() + { + Debug.Log ("Unsupported Platform"); + } + + public void displayBanner() + { + Debug.Log ("Unsupported Platform"); + } + + public void hideBanner() + { + Debug.Log ("Unsupported Platform"); + } + + public bool isBannerPlacementCapped(string placementName) + { + Debug.Log ("Unsupported Platform"); + return false; + } + + public void setSegment(IronSourceSegment segment){ + Debug.Log ("Unsupported Platform"); + } + + public void setConsent(bool consent) + { + Debug.Log ("Unsupported Platform"); + } + + //******************* ConsentView API *******************// + + public void loadConsentViewWithType(string consentViewType) + { + Debug.Log("Unsupported Platform"); + } + + public void showConsentViewWithType(string consentViewType) + { + Debug.Log("Unsupported Platform"); + } + + //******************* ILRD API *******************// + + public void setAdRevenueData(string dataSource, Dictionary impressionData) + { + Debug.Log("Unsupported Platform"); + } + + #endregion +} \ No newline at end of file diff --git a/popcorn/Assets/IronSource/Scripts/UnsupportedPlatformAgent.cs.meta b/popcorn/Assets/IronSource/Scripts/UnsupportedPlatformAgent.cs.meta new file mode 100644 index 00000000..126fe0c5 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/UnsupportedPlatformAgent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fa7a1bdde72c745a48f5ab116d847d96 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/IronSource/Scripts/iOSAgent.cs b/popcorn/Assets/IronSource/Scripts/iOSAgent.cs new file mode 100644 index 00000000..a8787d05 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/iOSAgent.cs @@ -0,0 +1,455 @@ +#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); + + [DllImport("__Internal")] + private static extern void CFSetMediationSegment (string segment); + + [DllImport("__Internal")] + private static extern string CFGetAdvertiserId (); + + [DllImport("__Internal")] + private static extern void CFValidateIntegration (); + + [DllImport("__Internal")] + private static extern void CFShouldTrackNetworkState (bool track); + + [DllImport("__Internal")] + private static extern bool CFSetDynamicUserId (string dynamicUserId); + + [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 CFSetMetaDataWithValues (string key, params string[] values); + + [DllImport("__Internal")] + private static extern string CFGetConversionValue(); + + //******************* SDK Init *******************// + + [DllImport("__Internal")] + private static extern void CFSetUserId (string userId); + + [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 CFInitISDemandOnly (string appKey, params string[] adUnits); + + //******************* RewardedVideo API *******************// + + [DllImport("__Internal")] + private static extern void CFShowRewardedVideo (); + + [DllImport("__Internal")] + private static extern void CFShowRewardedVideoWithPlacementName (string placementName); + + [DllImport("__Internal")] + private static extern bool CFIsRewardedVideoAvailable (); + + [DllImport("__Internal")] + private static extern bool CFIsRewardedVideoPlacementCapped (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 CFClearRewardedVideoServerParameters (); + + //******************* RewardedVideo DemandOnly API *******************// + + [DllImport("__Internal")] + private static extern void CFShowISDemandOnlyRewardedVideo (string instanceId); + + [DllImport("__Internal")] + private static extern void CFLoadISDemandOnlyRewardedVideo (string instanceId); + + [DllImport("__Internal")] + private static extern bool CFIsDemandOnlyRewardedVideoAvailable (string instanceId); + + //******************* Interstitial API *******************// + + [DllImport("__Internal")] + private static extern void CFLoadInterstitial (); + + [DllImport("__Internal")] + private static extern void CFShowInterstitial (); + + [DllImport("__Internal")] + private static extern void CFShowInterstitialWithPlacementName (string placementName); + + [DllImport("__Internal")] + private static extern bool CFIsInterstitialReady (); + + [DllImport("__Internal")] + private static extern bool CFIsInterstitialPlacementCapped (string placementName); + + //******************* Interstitial DemandOnly API *******************// + + [DllImport("__Internal")] + private static extern void CFLoadISDemandOnlyInterstitial (string instanceId); + + [DllImport("__Internal")] + private static extern void CFShowISDemandOnlyInterstitial(string instanceId); + + [DllImport("__Internal")] + private static extern bool CFIsDemandOnlyInterstitialReady (string instanceId); + + + //******************* Offerwall API *******************// + + [DllImport("__Internal")] + private static extern void CFShowOfferwall (); + + [DllImport("__Internal")] + private static extern void CFShowOfferwallWithPlacementName (string placementName); + + [DllImport("__Internal")] + private static extern void CFGetOfferwallCredits (); + + [DllImport("__Internal")] + private static extern bool CFIsOfferwallAvailable (); + + //******************* Banner API *******************// + + [DllImport("__Internal")] + private static extern void CFLoadBanner (string description, int width, int height, int position, string placementName); + + [DllImport("__Internal")] + private static extern void CFDestroyBanner (); + + [DllImport("__Internal")] + private static extern void CFDisplayBanner (); + + [DllImport("__Internal")] + private static extern void CFHideBanner (); + + [DllImport("__Internal")] + private static extern bool CFIsBannerPlacementCapped (string placementName); + + [DllImport("__Internal")] + private static extern void CFSetSegment(string json); + + [DllImport("__Internal")] + private static extern void CFSetConsent(bool consent); + + //******************* ConsentView API *******************// + + [DllImport("__Internal")] + private static extern void CFLoadConsentViewWithType(string consentViewType); + + [DllImport("__Internal")] + private static extern void CFShowConsentViewWithType(string consentViewType); + + //******************* ILRD API *******************// + + [DllImport("__Internal")] + private static extern void CFSetAdRevenueData(string dataSource, string impressionData); + + public iOSAgent () + { + } + +#region IronSourceIAgent implementation + + //******************* Base API *******************// + + public void onApplicationPause (bool pause) + { + + } + + public void setMediationSegment (string segment) + { + CFSetMediationSegment (segment); + } + + 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; + } + + //******************* 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 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); + } + + 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); + } + + #endregion +} +#endif diff --git a/popcorn/Assets/IronSource/Scripts/iOSAgent.cs.meta b/popcorn/Assets/IronSource/Scripts/iOSAgent.cs.meta new file mode 100644 index 00000000..648d0170 --- /dev/null +++ b/popcorn/Assets/IronSource/Scripts/iOSAgent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 39133b84cde1b42d8b4970f62fd20faa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/popcorn/Assets/MyGame/Scripts/AdManager.cs b/popcorn/Assets/MyGame/Scripts/AdManager.cs index 20f1cc34..1120fa43 100644 --- a/popcorn/Assets/MyGame/Scripts/AdManager.cs +++ b/popcorn/Assets/MyGame/Scripts/AdManager.cs @@ -5,17 +5,17 @@ public sealed class AdManager : SingletonMonoBehaviour { //-- ironSource --// #if UNITY_IOS - private static readonly string IRONSOURCE_APP_KEY = ""; + private static readonly string IRONSOURCE_APP_KEY = "11bc8b5ad"; #else - private static readonly string IRONSOURCE_APP_KEY = ""; + private static readonly string IRONSOURCE_APP_KEY = "11bc928bd"; #endif void Awake(){ #if DEVELOPMENT_BUILD - // IronSource.Agent.validateIntegration (); - // IronSource.Agent.setAdaptersDebug(true); + IronSource.Agent.validateIntegration (); + IronSource.Agent.setAdaptersDebug(true); #endif - // IronSource.Agent.init (IRONSOURCE_APP_KEY); + IronSource.Agent.init (IRONSOURCE_APP_KEY); } void Start(){ @@ -27,20 +27,20 @@ public sealed class AdManager : SingletonMonoBehaviour { } void OnApplicationPause(bool isPaused) { - // IronSource.Agent.onApplicationPause(isPaused); + IronSource.Agent.onApplicationPause(isPaused); } //-- Banners Ads --// public void LoadBannerAds(){ - // IronSource.Agent.loadBanner(IronSourceBannerSize.SMART, IronSourceBannerPosition.BOTTOM); + IronSource.Agent.loadBanner(IronSourceBannerSize.SMART, IronSourceBannerPosition.BOTTOM); } public void ShowBannerAd(){ - // IronSource.Agent.displayBanner(); + IronSource.Agent.displayBanner(); } public void HideBanner(){ - // IronSource.Agent.hideBanner(); + IronSource.Agent.hideBanner(); } @@ -48,30 +48,24 @@ public sealed class AdManager : SingletonMonoBehaviour { #if DEVELOPMENT_BUILD || UNITY_EDITOR return !UsayaStorageManager.LoadOrDefault(UsayaStorageFilename.Settings_Data, "DebugAlwaysVideoFailToLoad", false); #endif - return true; -// #if UNITY_EDITOR -// return true; -// #else -// return IronSource.Agent.isRewardedVideoAvailable(); -// #endif + return IronSource.Agent.isRewardedVideoAvailable(); } public void ShowRewardVideo(Action callback){ +#if UNITY_EDITOR callback(true); -// #if UNITY_EDITOR -// callback(true); -// #else -// _rewardAdCallback = callback; -// if(_rewardAdCallback == null){ -// return; -// }else if(IsLoadedRewardVideo()){ -// _rewardAdOpen = false; -// _rewardAdFinish = false; -// _rewardAdClose = false; -// _async_frame_count = 0; -// IronSource.Agent.showRewardedVideo(); -// }else{ -// _rewardAdCallback(false); -// } -// #endif +#else + _rewardAdCallback = callback; + if(_rewardAdCallback == null){ + return; + }else if(IsLoadedRewardVideo()){ + _rewardAdOpen = false; + _rewardAdFinish = false; + _rewardAdClose = false; + _async_frame_count = 0; + IronSource.Agent.showRewardedVideo(); + }else{ + _rewardAdCallback(false); + } +#endif } } \ No newline at end of file diff --git a/popcorn/Assets/USAYAUnityLib/Scripts/InitializeUnityEditorChecker.cs b/popcorn/Assets/USAYAUnityLib/Scripts/InitializeUnityEditorChecker.cs index d9233eef..138a61d7 100644 --- a/popcorn/Assets/USAYAUnityLib/Scripts/InitializeUnityEditorChecker.cs +++ b/popcorn/Assets/USAYAUnityLib/Scripts/InitializeUnityEditorChecker.cs @@ -10,9 +10,9 @@ public sealed class InitializeUnityEditorChecker : MonoBehaviour { UnityEditor.EditorApplication.isPlaying = false; } - var unityChecker = new GameObject("UnityChecker"); - DontDestroyOnLoad(unityChecker); - unityChecker.AddComponent(); + // var unityChecker = new GameObject("UnityChecker"); + // DontDestroyOnLoad(unityChecker); + // unityChecker.AddComponent(); #endif } } diff --git a/popcorn/ProjectSettings/GvhProjectSettings.xml b/popcorn/ProjectSettings/GvhProjectSettings.xml new file mode 100644 index 00000000..a4d74040 --- /dev/null +++ b/popcorn/ProjectSettings/GvhProjectSettings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file