Skip to content

Commit

Permalink
Updating Unity plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Bucimis committed May 7, 2018
1 parent fe6ed52 commit 29b0f0e
Show file tree
Hide file tree
Showing 34 changed files with 217 additions and 260 deletions.
Binary file modified Assets/Plugins/Android/libs/appboy-ui.aar
Binary file not shown.
Binary file modified Assets/Plugins/Android/libs/appboy-unity.aar
Binary file not shown.
Binary file modified Assets/Plugins/Android/libs/appboy.aar
Binary file not shown.
Binary file not shown.
Binary file added Assets/Plugins/Android/libs/runtime-1.1.0.aar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Assets/Plugins/Android/libs/viewmodel-1.1.0.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Plugins/Android/res/values/appboy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
<!-- <string name="com_appboy_feed_listener_callback_method_name"></string> --> <!-- The callback method to be called when the news feed is received. -->

<!--- Internal Braze Usage -->
<string translatable="false" name="com_appboy_sdk_flavor">UNITY</string>
<string name="com_appboy_sdk_flavor">UNITY</string>
</resources>
217 changes: 39 additions & 178 deletions Assets/Plugins/Appboy/AppboyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ void Start() {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _displayNextInAppMessage(bool withDelegate);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _wipeData();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _enableSDK();

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _disableSDK();

public static void LogCustomEvent(string eventName) {
_logCustomEvent(eventName, null);
}
Expand Down Expand Up @@ -280,16 +289,6 @@ public static void DisplayNextInAppMessage(bool withDelegate) {
_displayNextInAppMessage(withDelegate);
}

[System.Obsolete("LogSlideupClicked is deprecated, please use LogInAppMessageClicked instead.")]
public static void LogSlideupClicked(string slideupJSONString) {
_logInAppMessageClicked(slideupJSONString);
}

[System.Obsolete("LogSlideupImpression is deprecated, please use LogInAppMessageImpression instead.")]
public static void LogSlideupImpression(string slideupJSONString) {
_logInAppMessageImpression(slideupJSONString);
}

public static void LogInAppMessageClicked(string inAppMessageJSONString) {
_logInAppMessageClicked(inAppMessageJSONString);
}
Expand Down Expand Up @@ -325,6 +324,18 @@ public static void LogFeedbackDisplayed() {
_logFeedbackDisplayed();
}

public static void WipeData() {
_wipeData();
}

public static void EnableSDK() {
_enableSDK();
}

public static void DisableSDK() {
_disableSDK();
}

#elif UNITY_ANDROID
private static AndroidJavaObject appboyUnityActivity;
private static AndroidJavaObject appboy;
Expand Down Expand Up @@ -692,180 +703,24 @@ public static void LogInAppMessageButtonClicked(string inAppMessageJSONString, i
AppboyUnityActivity.Call("logInAppMessageButtonClick", new object[] { inAppMessageJSONString, buttonID });
}

[System.Obsolete("LogSlideupClicked is deprecated, please use LogInAppMessageClicked instead.")]
public static void LogSlideupClicked(string slideupJSONString) {
AppboyUnityActivity.Call("logInAppMessageClick", new object[] { slideupJSONString });
}

[System.Obsolete("LogSlideupImpression is deprecated, please use LogInAppMessageImpression instead.")]
public static void LogSlideupImpression(string slideupJSONString) {
AppboyUnityActivity.Call("logInAppMessageImpression", new object[] { slideupJSONString });
}

public static void LogFeedDisplayed() {
Appboy.Call("logFeedDisplayed");
}

public static void LogFeedbackDisplayed() {
Appboy.Call("logFeedbackDisplayed");
}

#elif UNITY_METRO
void Start() {
Debug.Log("Starting Appboy binding for Windows Metro clients.");
}

public static void LogCustomEvent(string eventName) {
WindowsUniversalUnityAdapter.AppboyAdapter.LogCustomEvent(eventName);
public static void WipeData() {
Appboy.CallStatic("wipeData", appboyUnityActivity);
}

public static void LogPurchase(string productId, string currencyCode, decimal price, int quantity) {
WindowsUniversalUnityAdapter.AppboyAdapter.LogPurchase(productId, currencyCode, price, quantity);
public static void EnableSDK() {
Appboy.CallStatic("enableSdk", appboyUnityActivity);
}

public static void ChangeUser(string userId) {
WindowsUniversalUnityAdapter.AppboyAdapter.ChangeUser(userId);
}

public static void SetUserFirstName(string firstName) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserFirstName(firstName);
}

public static void SetUserLastName(string lastName) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserLastName(lastName);
}

public static void SetUserEmail(string email) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserEmail(email);
}

public static void SetUserBio(string bio) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserBio(bio);
}

public static void SetUserGender(Gender gender) {
if (gender == Gender.Female) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserGender("FEMALE");

} else {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserGender("MALE");
}
}

public static void SetUserDateOfBirth(int year, int month, int day) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserDateOfBirth(year, month, day);
}

public static void SetUserCountry(string country) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserCountry(country);
}

public static void SetUserHomeCity(string city) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserHomeCity(city);
}

public static void SetUserIsSubscribedToEmails(bool isSubscribedToEmails) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserIsSubscribedToEmails(isSubscribedToEmails);
}

public static void SetUserEmailNotificationSubscriptionType(AppboyNotificationSubscriptionType emailNotificationSubscriptionType) {
if (emailNotificationSubscriptionType == AppboyNotificationSubscriptionType.OPTED_IN) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserPushNotificationSubscriptionType("OPTED_IN");
} else if (emailNotificationSubscriptionType == AppboyNotificationSubscriptionType.SUBSCRIBED) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserPushNotificationSubscriptionType("SUBSCRIBED");
} else {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserPushNotificationSubscriptionType("UNSUBSCRIBED");
}
}

public static void SetUserPushNotificationSubscriptionType(AppboyNotificationSubscriptionType pushNotificationSubscriptionType) {
if (pushNotificationSubscriptionType == AppboyNotificationSubscriptionType.OPTED_IN) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserPushNotificationSubscriptionType("OPTED_IN");
} else if (pushNotificationSubscriptionType == AppboyNotificationSubscriptionType.SUBSCRIBED) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserPushNotificationSubscriptionType("SUBSCRIBED");
} else {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserPushNotificationSubscriptionType("UNSUBSCRIBED");
}
}

public static void SetUserPhoneNumber(string phoneNumber) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserPhoneNumber(phoneNumber);
}

public static void SetUserAvatarImageURL(string imageURL) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetUserAvatarImageURL(imageURL);
}

public static void SetCustomUserAttribute(string key, bool value) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetCustomUserAttribute(key, value);
}

public static void SetCustomUserAttribute(string key, int value) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetCustomUserAttribute(key, value);
}

public static void SetCustomUserAttribute(string key, float value) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetCustomUserAttribute(key, value);
}

public static void SetCustomUserAttribute(string key, string value) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetCustomUserAttribute(key, value);
}

public static void SetCustomUserAttributeToNow(string key) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetCustomUserAttributeToNow(key);
}

public static void SetCustomUserAttributeToSecondsFromEpoch(string key, long secondsFromEpoch) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetCustomUserAttributeToSecondsFromEpoch(key, secondsFromEpoch);
}

public static void UnsetCustomUserAttribute(string key) {
WindowsUniversalUnityAdapter.AppboyAdapter.UnsetCustomUserAttribute(key);
}

public static void IncrementCustomUserAttribute(string key, int incrementValue) {
WindowsUniversalUnityAdapter.AppboyAdapter.IncrementCustomUserAttribute(key, incrementValue);
}

public static void SetCustomUserAttributeArray(string key, List<string> array, int size) {
WindowsUniversalUnityAdapter.AppboyAdapter.SetCustomUserAttributeArray(key, array, size);
}

public static void AddToCustomUserAttributeArray(string key, string value) {
WindowsUniversalUnityAdapter.AppboyAdapter.AddToCustomUserAttributeArray(key, value);
}

public static void RemoveFromCustomUserAttributeArray(string key, string value) {
WindowsUniversalUnityAdapter.AppboyAdapter.RemoveFromCustomUserAttributeArray(key, value);
}

public static void SubmitFeedback(string replyToEmail, string message, bool isReportingABug) {
WindowsUniversalUnityAdapter.AppboyAdapter.SubmitFeedback(replyToEmail, message, isReportingABug);
}

public static void RequestFeedRefresh() {
WindowsUniversalUnityAdapter.AppboyAdapter.RequestFeedRefresh();
}

public static void RequestFeedRefreshFromCache() {
WindowsUniversalUnityAdapter.AppboyAdapter.RequestFeedRefreshFromCache();
}

public static void LogSlideupClicked(string slideupJSONString) {
WindowsUniversalUnityAdapter.AppboyAdapter.LogSlideupClicked(slideupJSONString);
}

public static void LogSlideupImpression(string slideupJSONString) {
WindowsUniversalUnityAdapter.AppboyAdapter.LogSlideupImpression(slideupJSONString);
}

public static void LogFeedDisplayed() {
WindowsUniversalUnityAdapter.AppboyAdapter.LogFeedDisplayed();
}

public static void LogFeedbackDisplayed() {
WindowsUniversalUnityAdapter.AppboyAdapter.LogFeedbackDisplayed();
public static void DisableSDK() {
Appboy.CallStatic("disableSdk", appboyUnityActivity);
}

#else
Expand Down Expand Up @@ -981,23 +836,29 @@ public static void RequestFeedRefresh() {
public static void RequestFeedRefreshFromCache() {
}

public static void LogSlideupClicked(string slideupJSONString) {
}

public static void LogSlideupImpression(string slideupJSONString) {
}

public static void LogInAppMessageClicked(string inAppMessageJSONString) {
}

public static void LogInAppMessageImpression(string inAppMessageJSONString) {
}

public static void LogInAppMessageButtonClicked(string inAppMessageJSONString, int buttonID) {
}

public static void LogFeedDisplayed() {
}

public static void LogFeedbackDisplayed() {
}

public static void WipeData() {
}

public static void EnableSDK() {
}

public static void DisableSDK() {
}
#endif
}
}
10 changes: 1 addition & 9 deletions Assets/Plugins/Appboy/models/InAppMessage/InAppMessageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Appboy.Models.InAppMessage {

// Use InAppMssageFactory.BuildInAppMessage(InAppMessageString) to get the in-app message with correct type from
// Use InAppMessageFactory.BuildInAppMessage(InAppMessageString) to get the in-app message with correct type from
// Appboy SDK.
public abstract class InAppMessageBase : IInAppMessage {
private const int DefaultDuration = 5000;
Expand Down Expand Up @@ -107,11 +107,7 @@ public InAppMessageBase(JSONClass json) {
public void LogClicked() {
if (!_clickLogged) {
_clickLogged = true;
#if (UNITY_IOS || UNITY_ANDROID)
AppboyBinding.LogInAppMessageClicked(_jsonString);
#else
AppboyBinding.LogSlideupClicked(_jsonString);
#endif
} else {
Debug.Log("The in-app message already logged a click.");
}
Expand All @@ -120,11 +116,7 @@ public void LogClicked() {
public void LogImpression() {
if (!_impressionLogged) {
_impressionLogged = true;
#if (UNITY_IOS || UNITY_ANDROID)
AppboyBinding.LogInAppMessageImpression(_jsonString);
#else
AppboyBinding.LogSlideupImpression(_jsonString);
#endif
} else {
Debug.Log("The in-app message already logged an impression.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ public InAppMessageImmersiveBase(JSONClass json) : base(json) {
public void LogButtonClicked(int buttonID) {
if (!_buttonClickLogged) {
_buttonClickLogged = true;
#if (UNITY_IOS || UNITY_ANDROID)
AppboyBinding.LogInAppMessageButtonClicked(_jsonString, buttonID);
#endif
} else {
Debug.Log("The in-app message already log a button clicked.");
}
Expand Down
Binary file removed Assets/Plugins/Metro/AppboyPlatform.PCL.dll
Binary file not shown.
Binary file removed Assets/Plugins/Metro/AppboyPlatform.Universal.dll
Binary file not shown.
Binary file removed Assets/Plugins/Metro/Lex.Db.dll
Binary file not shown.
Binary file removed Assets/Plugins/Metro/Newtonsoft.Json.dll
Binary file not shown.
Binary file removed Assets/Plugins/Metro/NodaTime.dll
Binary file not shown.
Binary file removed Assets/Plugins/Metro/System.Net.Http.Extensions.dll
Binary file not shown.
Binary file removed Assets/Plugins/Metro/System.Net.Http.Primitives.dll
Binary file not shown.
Binary file not shown.
Binary file removed Assets/Plugins/WindowsUniversalUnityAdapter.dll
Binary file not shown.
12 changes: 12 additions & 0 deletions Assets/Plugins/iOS/AppboyBinding.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,15 @@ void _logFeedbackDisplayed() {
void _displayNextInAppMessage(bool withDelegate) {
[[AppboyUnityManager sharedInstance] displayNextInAppMessageWithDelegate:withDelegate];
}

void _wipeData() {
[AppboyUnityManager wipeDataAndDisableForAppRun];
}

void _enableSDK() {
[AppboyUnityManager requestEnableSDKOnNextAppRun];
}

void _disableSDK() {
[AppboyUnityManager disableSDK];
}
3 changes: 3 additions & 0 deletions Assets/Plugins/iOS/AppboyUnityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,7 @@ static NSString *const ABKUnityHandleInAppMessageDisplayKey = @"DisplayInAppMess
- (void) logFeedDisplayed;
- (void) logFeedbackDisplayed;
- (void) displayNextInAppMessageWithDelegate:(BOOL)withDelegate;
+ (void) wipeDataAndDisableForAppRun;
+ (void) disableSDK;
+ (void) requestEnableSDKOnNextAppRun;
@end
12 changes: 12 additions & 0 deletions Assets/Plugins/iOS/AppboyUnityManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,16 @@ - (void) displayNextInAppMessageWithDelegate:(BOOL)withDelegate {
[[Appboy sharedInstance].inAppMessageController displayNextInAppMessageWithDelegate:delegate];
}

+ (void) wipeDataAndDisableForAppRun {
[Appboy wipeDataAndDisableForAppRun];
}

+ (void) disableSDK {
[Appboy disableSDK];
}

+ (void) requestEnableSDKOnNextAppRun {
[Appboy requestEnableSDKOnNextAppRun];
}

@end
Loading

0 comments on commit 29b0f0e

Please sign in to comment.