Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HZUNITY-16] Default placements #11

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.unity" xmlns:tools="http://schemas.android.com/tools" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="25" />
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="27" />

<!-- Features -->
<uses-feature android:glEsVersion="0x00020000" />
Expand Down
36 changes: 19 additions & 17 deletions Assets/Plugins/Android/Heyzap/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.heyzap">
<application>
<activity android:name="com.heyzap.sdk.ads.MediationTestActivity" />
<activity android:name="com.heyzap.sdk.ads.HeyzapProxyActivity" />
<activity android:name="com.heyzap.sdk.ads.VASTActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<activity android:name="com.heyzap.sdk.ads.HeyzapInterstitialActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<activity android:name="com.heyzap.sdk.ads.HeyzapVideoActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<receiver android:name="com.heyzap.sdk.ads.PackageAddedReceiver">
<intent-filter>
<data android:scheme="package"/>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="15" />

<application>
<activity android:name="com.heyzap.sdk.ads.MediationTestActivity" />
<activity android:name="com.heyzap.sdk.ads.HeyzapProxyActivity" />
<activity android:name="com.heyzap.sdk.ads.VASTActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<activity android:name="com.heyzap.sdk.ads.HeyzapInterstitialActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<activity android:name="com.heyzap.sdk.ads.HeyzapVideoActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<receiver android:name="com.heyzap.sdk.ads.PackageAddedReceiver">
<intent-filter>
<data android:scheme="package" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
</intent-filter>
</receiver>
</application>

</manifest>
2 changes: 1 addition & 1 deletion Assets/Plugins/Heyzap/HZBannerAd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class HZBannerAd : MonoBehaviour {
public delegate void AdDisplayListener(string state, string tag);

private static AdDisplayListener adDisplayListener;
private static HZBannerAd _instance = null;
private static HZBannerAd _instance;

// these are reproduced here for convenience since they were here in old SDK versions
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/Heyzap/HZDemographics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Heyzap {
/// </summary>
public class HZDemographics : MonoBehaviour {

private static HZDemographics _instance = null;
private static HZDemographics _instance;

public enum Gender {
UNKNOWN,
Expand Down
6 changes: 1 addition & 5 deletions Assets/Plugins/Heyzap/HZIncentivizedAd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class HZIncentivizedAd : MonoBehaviour {

public delegate void AdDisplayListener(string state, string tag);
private static AdDisplayListener adDisplayListener;
private static HZIncentivizedAd _instance = null;
private static HZIncentivizedAd _instance;

//provided since JS can't use default parameters
/// <summary>
Expand All @@ -52,8 +52,6 @@ public static void Fetch() {
/// </summary>
/// <param name="tag">The ad tag to fetch an ad for.</param>
public static void Fetch(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
HZIncentivizedAdAndroid.Fetch(tag);
Expand Down Expand Up @@ -107,8 +105,6 @@ public static bool IsAvailable() {
/// </summary>
/// <returns><c>true</c>, if an ad is available, <c>false</c> otherwise.</returns>
public static bool IsAvailable(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
return HZIncentivizedAdAndroid.IsAvailable(tag);
Expand Down
10 changes: 3 additions & 7 deletions Assets/Plugins/Heyzap/HZInterstitialAd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class HZInterstitialAd : MonoBehaviour {

public delegate void AdDisplayListener(string state, string tag);
private static AdDisplayListener adDisplayListener;
private static HZInterstitialAd _instance = null;
private static HZInterstitialAd _instance;

//provided since JS can't use default parameters
/// <summary>
Expand Down Expand Up @@ -80,8 +80,6 @@ public static void Fetch() {
/// </summary>
/// <param name="tag">The ad tag to fetch an ad for.</param>
public static void Fetch(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
HZInterstitialAdAndroid.Fetch(tag);
Expand All @@ -107,8 +105,6 @@ public static bool IsAvailable() {
/// </summary>
/// <returns><c>true</c>, if an ad is available, <c>false</c> otherwise.</returns>
public static bool IsAvailable(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
return HZInterstitialAdAndroid.IsAvailable(tag);
Expand Down Expand Up @@ -257,7 +253,7 @@ public static void ShowWithOptions(HZShowOptions showOptions) {
}
}

public static void Fetch(string tag="default") {
public static void Fetch(string tag) {
if(Application.platform != RuntimePlatform.Android) return;

AndroidJNIHelper.debug = false;
Expand All @@ -266,7 +262,7 @@ public static void Fetch(string tag="default") {
}
}

public static Boolean IsAvailable(string tag="default") {
public static Boolean IsAvailable(string tag) {
if(Application.platform != RuntimePlatform.Android) return false;

AndroidJNIHelper.debug = false;
Expand Down
6 changes: 1 addition & 5 deletions Assets/Plugins/Heyzap/HZOfferwallAd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class HZOfferWallAd : MonoBehaviour {
public delegate void VirtualCurrencyErrorListener(string errorMsg);
private static VirtualCurrencyErrorListener virtualCurrencyErrorListener;

private static HZOfferWallAd _instance = null;
private static HZOfferWallAd _instance;

//provided since JS can't use default parameters
/// <summary>
Expand Down Expand Up @@ -88,8 +88,6 @@ public static void Fetch() {
/// </summary>
/// <param name="tag">The ad tag to fetch an ad for.</param>
public static void Fetch(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
HZOfferWallAdAndroid.Fetch(tag);
Expand All @@ -115,8 +113,6 @@ public static bool IsAvailable() {
/// </summary>
/// <returns><c>true</c>, if an ad is available, <c>false</c> otherwise.</returns>
public static bool IsAvailable(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
return HZOfferWallAdAndroid.IsAvailable(tag);
Expand Down
15 changes: 4 additions & 11 deletions Assets/Plugins/Heyzap/HZShowOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,18 @@ namespace Heyzap {
public class HZShowOptions {

/// <summary>
/// An identifier for the location of the ad, which you can use to disable the ad from your dashboard. If not specified the tag "default" is always used.
/// Guaranteed to be non-null - will be set to the default value if the setter is called with `null`.
/// An identifier for the location of the ad, which you can use to disable the ad from your dashboard.
/// </summary>
/// <value>The tag.</value>
public string Tag {
get {
return tag;
}
set {
if (value != null) {
tag = value;
} else {
tag = HeyzapAds.DEFAULT_TAG;
}
tag = value;
}
}
private string tag = HeyzapAds.DEFAULT_TAG;
private string tag;
}

/// <summary>
Expand All @@ -36,7 +31,6 @@ public class HZIncentivizedShowOptions : HZShowOptions {
/// <summary>
/// When an incentivized video is completed, this string will be sent to your server via our server-to-server callbacks. Set it to anything you want to pass to your server regarding this incentivized video view (i.e.: a username, user ID, level name, etc.), or leave it empty if you don't need to use it / aren't using server callbacks for incentivized video.
/// More information about using this feature can be found at https://developers.heyzap.com/docs/advanced-publishing .
/// Guaranteed to be non-null - will be set to the default value if the setter is called with `null`.
/// </summary>
public string IncentivizedInfo {
get {
Expand Down Expand Up @@ -96,7 +90,6 @@ public class HZOfferWallShowOptions : HZShowOptions {
/// <summary>
/// When an incentivized video is completed, this string will be sent to your server via our server-to-server callbacks. Set it to anything you want to pass to your server regarding this incentivized video view (i.e.: a username, user ID, level name, etc.), or leave it empty if you don't need to use it / aren't using server callbacks for incentivized video.
/// More information about using this feature can be found at https://developers.heyzap.com/docs/advanced-publishing .
/// Guaranteed to be non-null - will be set to the default value if the setter is called with `null`.
/// </summary>
public bool ShouldCloseAfterFirstClick {
get {
Expand All @@ -108,4 +101,4 @@ public bool ShouldCloseAfterFirstClick {
}
private bool shouldCloseAfterFirstClick = HZOfferWallShowOptions.DEFAULT_SHOULD_CLOSE_AFTER_FIRST_CLICK;
}
}
}
6 changes: 1 addition & 5 deletions Assets/Plugins/Heyzap/HZVideoAd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class HZVideoAd : MonoBehaviour {

public delegate void AdDisplayListener(string state, string tag);
private static AdDisplayListener adDisplayListener;
private static HZVideoAd _instance = null;
private static HZVideoAd _instance;

//provided since JS can't use default parameters
/// <summary>
Expand Down Expand Up @@ -81,8 +81,6 @@ public static void Fetch() {
/// </summary>
/// <param name="tag">The ad tag to fetch an ad for.</param>
public static void Fetch(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
HZVideoAdAndroid.Fetch(tag);
Expand All @@ -108,8 +106,6 @@ public static bool IsAvailable() {
/// </summary>
/// <returns><c>true</c>, if an ad is available, <c>false</c> otherwise.</returns>
public static bool IsAvailable(string tag) {
tag = HeyzapAds.TagForString(tag);

#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
#if UNITY_ANDROID
return HZVideoAdAndroid.IsAvailable(tag);
Expand Down
20 changes: 5 additions & 15 deletions Assets/Plugins/Heyzap/HeyzapAds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class HeyzapAds : MonoBehaviour {
public delegate void NetworkCallbackListener(string network, string callback);

private static NetworkCallbackListener networkCallbackListener;
private static HeyzapAds _instance = null;
private static HeyzapAds _instance;

#region Flags for the call to HeyzapAds.StartWithOptions()
/// <summary>
Expand Down Expand Up @@ -76,8 +76,6 @@ public class HeyzapAds : MonoBehaviour {
/// </summary>
public const int FLAG_CHILD_DIRECTED_ADS = 1 << 6; // 64
#endregion

public const string DEFAULT_TAG = "default";

#region String constants to expect in Ad Listener & network callbacks
// `NetworkCallback` is a bit of a misnomer. The callback constants here are both for "network callbacks" and for ad listener callbacks. We should refactor these into two classes in the next major SDK.
Expand Down Expand Up @@ -300,7 +298,7 @@ public static void HideDebugLogs() {
/// </summary>
public static void ShowThirdPartyDebugLogs() {
#if UNITY_IPHONE && !UNITY_EDITOR
HeyzapAdsIOS.ShowThirdPartyDebugLogs();
HeyzapAdsIOS.ShowThirdPartyDebugLogs();
#endif
}

Expand All @@ -310,7 +308,7 @@ public static void ShowThirdPartyDebugLogs() {
/// </summary>
public static void HideThirdPartyDebugLogs() {
#if UNITY_IPHONE && !UNITY_EDITOR
HeyzapAdsIOS.HideThirdPartyDebugLogs();
HeyzapAdsIOS.HideThirdPartyDebugLogs();
#endif
}

Expand All @@ -337,7 +335,7 @@ public static void SetBundleIdentifier(string bundleID) {
/// <param name="device_id">The Device ID that FAN prints to the iOS console</param>
public static void AddFacebookTestDevice(string device_id) {
#if UNITY_IPHONE && !UNITY_EDITOR
HeyzapAdsIOS.AddFacebookTestDevice(device_id);
HeyzapAdsIOS.AddFacebookTestDevice(device_id);
#endif
}
#endregion
Expand All @@ -354,21 +352,13 @@ protected static void SetNetworkCallback(string network, string callback) {
}
}

public static void InitReceiver(){
public static void InitReceiver() {
if (_instance == null) {
GameObject receiverObject = new GameObject("HeyzapAds");
DontDestroyOnLoad(receiverObject);
_instance = receiverObject.AddComponent<HeyzapAds>();
}
}

public static string TagForString(string tag) {
if (tag == null) {
tag = HeyzapAds.DEFAULT_TAG;
}

return tag;
}
#endregion
}

Expand Down
Loading