Skip to content

Commit

Permalink
Updating Unity plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenzhi committed Jan 17, 2018
1 parent 6f3d1a3 commit 5b4cf93
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 119 deletions.
8 changes: 0 additions & 8 deletions Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,5 @@
<category android:name="REPLACE_WITH_YOUR_BUNDLE_IDENTIFIER" />
</intent-filter>
</receiver>

<!-- Register an optional notification receiver here -->
<receiver android:name="com.appboy.unity.AppboyUnityGcmReceiver" android:exported="false" >
<intent-filter>
<action android:name="REPLACE_WITH_YOUR_BUNDLE_IDENTIFIER.intent.APPBOY_PUSH_RECEIVED" />
<action android:name="REPLACE_WITH_YOUR_BUNDLE_IDENTIFIER.intent.APPBOY_NOTIFICATION_OPENED" />
</intent-filter>
</receiver>
</application>
</manifest>
Binary file removed Assets/Plugins/Android/libs/android-support-v4.aar
Binary file not shown.
Binary file modified Assets/Plugins/Android/libs/appboy-ui.aar
100755 → 100644
Binary file not shown.
Binary file modified Assets/Plugins/Android/libs/appboy-unity.aar
100755 → 100644
Binary file not shown.
Binary file modified Assets/Plugins/Android/libs/appboy.aar
100755 → 100644
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
41 changes: 8 additions & 33 deletions Assets/Plugins/Appboy/AppboyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ void Start() {

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

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

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _displayNextInAppMessage(bool withDelegate);
Expand Down Expand Up @@ -278,10 +275,6 @@ public static void setUserTwitterData(int? twitterUserId, string twitterHandle,
public static void SubmitFeedback(string replyToEmail, string message, bool isReportingABug) {
_submitFeedback(replyToEmail, message, isReportingABug);
}

public static void RequestInAppMessage() {
_requestInAppMessage();
}

public static void DisplayNextInAppMessage(bool withDelegate) {
_displayNextInAppMessage(withDelegate);
Expand Down Expand Up @@ -369,7 +362,7 @@ private static AndroidJavaObject GetCurrentUser() {
}

public static void LogCustomEvent(string eventName) {
Appboy.Call<bool>("logCustomEvent", eventName);
Appboy.Call("logCustomEvent", eventName);
}

public static AndroidJavaObject ParsePropertiesToAppboyProperties(Dictionary<string, object> properties) {
Expand Down Expand Up @@ -405,22 +398,22 @@ public static AndroidJavaObject ParsePropertiesToAppboyProperties(Dictionary<str
/// </param>
public static void LogCustomEvent(string eventName, Dictionary<string, object> properties) {
AndroidJavaObject appboyProperties = ParsePropertiesToAppboyProperties(properties);
Appboy.Call<bool>("logCustomEvent", eventName, appboyProperties);
Appboy.Call("logCustomEvent", eventName, appboyProperties);
}

public static void LogPurchase(string productId, string currencyCode, decimal price, int quantity) {
var javaPrice = new AndroidJavaObject("java.math.BigDecimal", price.ToString());
Appboy.Call<bool>("logPurchase", productId, currencyCode, javaPrice, quantity);
Appboy.Call("logPurchase", productId, currencyCode, javaPrice, quantity);
}

public static void LogPurchase(string productId, string currencyCode, decimal price, int quantity, Dictionary<string, object> properties) {
var javaPrice = new AndroidJavaObject("java.math.BigDecimal", price.ToString());
AndroidJavaObject appboyProperties = ParsePropertiesToAppboyProperties(properties);
Appboy.Call<bool>("logPurchase", productId, currencyCode, javaPrice, quantity, appboyProperties);
Appboy.Call("logPurchase", productId, currencyCode, javaPrice, quantity, appboyProperties);
}

public static void ChangeUser(string userId) {
Appboy.Call<AndroidJavaObject>("changeUser", userId);
Appboy.Call("changeUser", userId);
}

public static void SetUserFirstName(string firstName) {
Expand Down Expand Up @@ -672,21 +665,13 @@ public static void RemoveFromCustomUserAttributeArray(string key, string value)

public static void SubmitFeedback(string replyToEmail, string message, bool isReportingABug) {
object[] args = new object[] { replyToEmail, message, isReportingABug };
Appboy.Call<bool>("submitFeedback", args);
Appboy.Call("submitFeedback", args);
}

public static void RegisterAppboyPushMessages(string registrationId) {
Appboy.Call("registerAppboyPushMessages", new object[] { registrationId });
}

public static void RequestSlideup() {
Appboy.Call("requestInAppMessageRefresh");
}

public static void RequestInAppMessage() {
Appboy.Call("requestInAppMessageRefresh");
}

public static void RequestFeedRefresh() {
Appboy.Call("requestFeedRefresh");
}
Expand Down Expand Up @@ -718,11 +703,11 @@ public static void LogSlideupImpression(string slideupJSONString) {
}

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

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

#elif UNITY_METRO
Expand Down Expand Up @@ -858,10 +843,6 @@ public static void RemoveFromCustomUserAttributeArray(string key, string value)
public static void SubmitFeedback(string replyToEmail, string message, bool isReportingABug) {
WindowsUniversalUnityAdapter.AppboyAdapter.SubmitFeedback(replyToEmail, message, isReportingABug);
}

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

public static void RequestFeedRefresh() {
WindowsUniversalUnityAdapter.AppboyAdapter.RequestFeedRefresh();
Expand Down Expand Up @@ -994,12 +975,6 @@ public static void SubmitFeedback(string replyToEmail, string message, bool isRe
public static void RegisterAppboyPushMessages(string registrationId) {
}

public static void RequestSlideup() {
}

public static void RequestInAppMessage() {
}

public static void RequestFeedRefresh() {
}

Expand Down
6 changes: 4 additions & 2 deletions Assets/Plugins/Appboy/Editor/PostBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ private static void ModifyProject(string projectPath) {
"QuartzCore.framework",
"libz.tbd",
"CoreImage.framework",
"CoreText.framework"
"CoreText.framework",
"WebKit.framework"
};

string[] optionalFrameworks = {
Expand All @@ -77,7 +78,8 @@ private static void ModifyProject(string projectPath) {
project.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
project.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "./Frameworks/Plugins/iOS");
project.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "./Libraries/Plugins/iOS");
project.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "./Libraries");
project.AddBuildProperty(target, "FRAMEWORK_SEARCH_PATHS", "./Libraries");
project.SetBuildProperty(target, "GCC_ENABLE_OBJC_EXCEPTIONS", "Yes");

// Add required frameworks
// Note: Unity's documentation for PBXProject.AddFrameworkToProject says that the boolean parameter
Expand Down
4 changes: 2 additions & 2 deletions Assets/Plugins/Appboy/models/Cards/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override string ToString() {
public void LogImpression() {
if (!string.IsNullOrEmpty(ID)) {
#if UNITY_ANDROID
AppboyBinding.Appboy.Call<bool>("logFeedCardImpression", ID);
AppboyBinding.Appboy.Call("logFeedCardImpression", ID);
#elif UNITY_IOS
AppboyBinding.LogCardImpression(JsonString);
#endif
Expand All @@ -85,7 +85,7 @@ public string CategoriesToString() {
public void LogClick() {
if (!string.IsNullOrEmpty(ID)) {
#if UNITY_ANDROID
AppboyBinding.Appboy.Call<bool>("logFeedCardClick", ID);
AppboyBinding.Appboy.Call("logFeedCardClick", ID);
#elif UNITY_IPHONE
AppboyBinding.LogCardClicked(JsonString);
#endif
Expand Down
4 changes: 0 additions & 4 deletions Assets/Plugins/iOS/AppboyBinding.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ void _logFeedbackDisplayed() {
[[AppboyUnityManager sharedInstance] logFeedbackDisplayed];
}

void _requestInAppMessage() {
[[AppboyUnityManager sharedInstance] requestInAppMessageRefresh];
}

void _displayNextInAppMessage(bool withDelegate) {
[[AppboyUnityManager sharedInstance] displayNextInAppMessageWithDelegate:withDelegate];
}
1 change: 0 additions & 1 deletion Assets/Plugins/iOS/AppboyUnityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static NSString *const ABKUnityHandleInAppMessageDisplayKey = @"DisplayInAppMess
- (void) logInAppMessageImpression:(NSString *)inAppMessageJSONString;
- (void) logCardImpression:(NSString *)cardJSONString;
- (void) logCardClicked:(NSString *)cardJSONString;
- (void) requestInAppMessageRefresh;
- (void) requestFeedRefresh;
- (void) requestFeedFromCache:(NSNotification *)notification;
- (void) logFeedDisplayed;
Expand Down
40 changes: 3 additions & 37 deletions Assets/Plugins/iOS/AppboyUnityManager.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "AppboyUnityManager.h"
#import "AppboyKit.h"
#import "ABKFeedbackViewControllerModalContext.h"
#import "ABKModalFeedbackViewController.h"
#import "ABKFeedViewControllerModalContext.h"
#import "ABKCard.h"
#import "ABKFacebookUser.h"
Expand All @@ -26,7 +26,7 @@ + (AppboyUnityManager*)sharedInstance {
}

- (void) showFeedbackForm {
ABKFeedbackViewControllerModalContext *feedbackViewController = [[ABKFeedbackViewControllerModalContext alloc] init];
ABKModalFeedbackViewController *feedbackViewController = [[ABKModalFeedbackViewController alloc] init];
[UnityGetGLViewController() presentViewController:feedbackViewController animated:YES completion:nil];
}

Expand Down Expand Up @@ -197,37 +197,7 @@ - (BOOL) submitFeedback:(NSString *)replyToEmail message:(NSString *)message isR
}

// ABKInAppMessageDelegate methods
- (BOOL) onInAppMessageReceived:(ABKInAppMessage *)inAppMessage {
if (self.unityInAppMessageGameObjectName == nil) {
NSLog(@"Not sending a Unity message in response to an in-app message being received because "
"no message receiver was defined. To implement custom behavior in response to a in-app"
"message being received, you must register a GameObject and method name with Appboy "
"by calling [[AppboyUnityManager sharedInstance] addInAppMessageListenerWithObjectName: callbackMethodName:].");
return NO;
}
if (self.unityInAppMessageCallbackFunctionName == nil) {
NSLog(@"Not sending a Unity message in response to a in-app message being received because "
"no method name was defined for the %@. To implement custom behavior in response to a in-app "
"message being received, you must register a GameObject and method name with Appboy "
"[[AppboyUnityManager sharedInstance] addInAppMessageListenerWithObjectName: callbackMethodName:].",
self.unityInAppMessageGameObjectName);
return NO;
}
NSLog(@"Sending an in-app message to %@:%@.", self.unityInAppMessageGameObjectName, self.unityInAppMessageCallbackFunctionName);

NSData *inAppMessageData = [inAppMessage serializeToData];
NSString *dataString = [[NSString alloc] initWithData:inAppMessageData encoding:NSUTF8StringEncoding];
NSLog(@"dataString is %@.", dataString);
UnitySendMessage([self.unityInAppMessageGameObjectName cStringUsingEncoding:NSUTF8StringEncoding],
[self.unityInAppMessageCallbackFunctionName cStringUsingEncoding:NSUTF8StringEncoding],
[dataString cStringUsingEncoding:NSUTF8StringEncoding]);
if ([self.appboyUnityPlist[ABKUnityHandleInAppMessageDisplayKey] boolValue]) {
return NO;
}
return YES;
}

- (ABKInAppMessageDisplayChoice)beforeInAppMessageDisplayed:(ABKInAppMessage *)inAppMessage withKeyboardIsUp:(BOOL)keyboardIsUp {
- (ABKInAppMessageDisplayChoice)beforeInAppMessageDisplayed:(ABKInAppMessage *)inAppMessage {
if (self.unityInAppMessageGameObjectName == nil) {
NSLog(@"Not sending a Unity message in response to an in-app message being received because "
"no message receiver was defined. To implement custom behavior in response to a in-app"
Expand Down Expand Up @@ -513,10 +483,6 @@ - (void) logFeedbackDisplayed {
[[Appboy sharedInstance] logFeedbackDisplayed];
}

- (void) requestInAppMessageRefresh {
[[Appboy sharedInstance] requestInAppMessageRefresh];
}

- (void) displayNextInAppMessageWithDelegate:(BOOL)withDelegate {
ABKInAppMessageController *delegate = nil;
if (withDelegate) {
Expand Down
Loading

0 comments on commit 5b4cf93

Please sign in to comment.