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 1 commit
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
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="14" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this changed on the Heyzap side?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's actually 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
6 changes: 1 addition & 5 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
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
10 changes: 3 additions & 7 deletions Assets/Plugins/Heyzap/HZShowOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ public string Tag {
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 Down Expand Up @@ -108,4 +104,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