Skip to content

Commit

Permalink
Updating Unity plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Bucimis committed Aug 29, 2019
1 parent 8181022 commit 32aeb3f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 35 deletions.
35 changes: 27 additions & 8 deletions Assets/Plugins/Appboy/AppboyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ void Start() {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _setUserTwitterData(int twitterUserId, string twitterHandle, string name, string description, int followerCount, int followingCount, int tweetCount, string profileImageUrl);

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _submitFeedback(string replyToEmail, string message, bool isReportingABug);

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

Expand All @@ -144,9 +141,6 @@ void Start() {
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void _logFeedDisplayed();

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

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

Expand Down Expand Up @@ -285,7 +279,7 @@ public static void setUserTwitterData(int? twitterUserId, string twitterHandle,
}

public static void SubmitFeedback(string replyToEmail, string message, bool isReportingABug) {
_submitFeedback(replyToEmail, message, isReportingABug);
// no-op
}

public static void DisplayNextInAppMessage(bool withDelegate) {
Expand Down Expand Up @@ -324,7 +318,7 @@ public static void LogFeedDisplayed() {
}

public static void LogFeedbackDisplayed() {
_logFeedbackDisplayed();
// no-op
}

public static void WipeData() {
Expand All @@ -348,9 +342,14 @@ public static void SetAttributionData(string network, string campaign, string ad
_setAttributionData(network, campaign, adgroup, creative);
}

public static void RequestLocationInitialization() {
// no-op
}

#elif UNITY_ANDROID
private static AndroidJavaObject appboyUnityActivity;
private static AndroidJavaObject inAppMessageUtils;
private static AndroidJavaObject appboyLocationService;

void Start() {
Debug.Log("Starting Appboy binding for Android clients.");
Expand Down Expand Up @@ -385,6 +384,15 @@ public static AndroidJavaObject InAppMessageUtils {
}
}

public static AndroidJavaObject AppboyLocationService {
get {
if (appboyLocationService == null) {
appboyLocationService = new AndroidJavaClass("com.appboy.services.AppboyLocationService");
}
return appboyLocationService;
}
}

#endregion

private static AndroidJavaObject GetCurrentUser() {
Expand Down Expand Up @@ -754,6 +762,14 @@ public static void SetAttributionData(string network, string campaign, string ad
GetCurrentUser().Call<bool>("setAttributionData", attributionData);
}

/// <summary>
/// When location permissions are granted, client app can call this method to request immediate
/// initialization of Braze geofences and also request a single location update.
/// </summary>
public static void RequestLocationInitialization() {
AppboyLocationService.CallStatic("requestInitialization", appboyUnityActivity);
}

#else

// Empty implementations of the API, in case the application is being compiled for a platform other than iOS or Android.
Expand Down Expand Up @@ -897,6 +913,9 @@ public static string GetInstallTrackingId() {

public static void SetAttributionData(string network, string campaign, string adgroup, string creative) {
}

public static void RequestLocationInitialization() {
}
#endif
}
}
8 changes: 0 additions & 8 deletions Assets/Plugins/iOS/AppboyBinding.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ void _setUserTwitterData(int twitterUserId, const char* twitterHandle, const cha
[[AppboyUnityManager sharedInstance] setUserTwitterData:twitterUserId twitterHandle:GetStringParam(twitterHandle) name:GetStringParam(name) description:GetStringParam(description) followerCount:followerCount followingCount:followingCount tweetCount:tweetCount profileImageUrl:GetStringParam(profileImageUrl)];
}

void _submitFeedback(const char* replyToEmail, const char* message, bool isReportingABug) {
[[AppboyUnityManager sharedInstance] submitFeedback:GetStringParam(replyToEmail) message:GetStringParam(message) isReportingABug:isReportingABug];
}

void _logInAppMessageClicked(const char* inAppMessageJSONString) {
[[AppboyUnityManager sharedInstance] logInAppMessageClicked:GetStringParam(inAppMessageJSONString)];
}
Expand Down Expand Up @@ -194,10 +190,6 @@ void _logFeedDisplayed() {
[[AppboyUnityManager sharedInstance] logFeedDisplayed];
}

void _logFeedbackDisplayed() {
[[AppboyUnityManager sharedInstance] logFeedbackDisplayed];
}

void _displayNextInAppMessage(bool withDelegate) {
[[AppboyUnityManager sharedInstance] displayNextInAppMessageWithDelegate:withDelegate];
}
Expand Down
3 changes: 0 additions & 3 deletions Assets/Plugins/iOS/AppboyUnityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ static NSString *const ABKUnityHandleInAppMessageDisplayKey = @"DisplayInAppMess

+ (AppboyUnityManager *) sharedInstance;
- (void) showStreamView;
- (void) showFeedbackForm;
- (void) logCustomEvent:(NSString *)eventName withProperties:(NSDictionary *)properties;
- (void) changeUser:(NSString *)userId;
- (void) logPurchase:(NSString *)productId inCurrency:(NSString *)currencyCode
Expand Down Expand Up @@ -61,7 +60,6 @@ static NSString *const ABKUnityHandleInAppMessageDisplayKey = @"DisplayInAppMess
- (void) setAttributionData:(NSString *)network campaign:(NSString *)campaign adgroup:(NSString *)adgroup creative:(NSString *)creative;
- (void) setUserFacebookData:(NSString *)facebookId firstName:(NSString *)firstName lastName:(NSString *)lastName email:(NSString *)email bio:(NSString *)bio cityName:(NSString *)cityName gender:(NSInteger)gender numberOfFriends:(NSInteger)numberOfFriends birthday:(NSString *)birthday;
- (void) setUserTwitterData:(NSInteger)twitterUserId twitterHandle:(NSString *)twitterHandle name:(NSString *)name description:(NSString *)description followerCount:(NSInteger)followerCount followingCount:(NSInteger)followingCount tweetCount:(NSInteger)tweetCount profileImageUrl:(NSString *)profileImageUrl;
- (BOOL) submitFeedback:(NSString *)replyToEmail message:(NSString *)message isReportingABug:(BOOL)isReportingABug;
- (void) parsePlist;
- (NSString *) getApiKeyFromUnity;
- (void) setListeners;
Expand All @@ -80,7 +78,6 @@ static NSString *const ABKUnityHandleInAppMessageDisplayKey = @"DisplayInAppMess
- (void) requestFeedRefresh;
- (void) requestFeedFromCache:(NSNotification *)notification;
- (void) logFeedDisplayed;
- (void) logFeedbackDisplayed;
- (void) displayNextInAppMessageWithDelegate:(BOOL)withDelegate;
+ (void) wipeDataAndDisableForAppRun;
+ (void) disableSDK;
Expand Down
14 changes: 0 additions & 14 deletions Assets/Plugins/iOS/AppboyUnityManager.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#import "AppboyUnityManager.h"
#import <Appboy_iOS_SDK/AppboyKit.h>
#import <Appboy_iOS_SDK/ABKModalFeedbackViewController.h>
#import <Appboy_iOS_SDK/ABKCard.h>
#import <Appboy_iOS_SDK/ABKFacebookUser.h>
#import <Appboy_iOS_SDK/ABKTwitterUser.h>
Expand All @@ -24,11 +23,6 @@ + (AppboyUnityManager*)sharedInstance {
return sharedInstance;
}

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

- (void) logCustomEvent:(NSString *)eventName withProperties:(NSDictionary *)properties {
[[Appboy sharedInstance] logCustomEvent:eventName withProperties:properties];
}
Expand Down Expand Up @@ -195,10 +189,6 @@ - (void) setUserTwitterData:(NSInteger)twitterUserId twitterHandle:(NSString *)t
[Appboy sharedInstance].user.twitterUser = twitterUser;
}

- (BOOL) submitFeedback:(NSString *)replyToEmail message:(NSString *)message isReportingABug:(BOOL)isReportingABug {
return [[Appboy sharedInstance] submitFeedback:replyToEmail message:message isReportingABug:isReportingABug];
}

// ABKInAppMessageDelegate methods
- (ABKInAppMessageDisplayChoice)beforeInAppMessageDisplayed:(ABKInAppMessage *)inAppMessage {
if (self.unityInAppMessageGameObjectName == nil) {
Expand Down Expand Up @@ -482,10 +472,6 @@ - (void) logFeedDisplayed {
[[Appboy sharedInstance] logFeedDisplayed];
}

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

- (void) displayNextInAppMessageWithDelegate:(BOOL)withDelegate {
ABKInAppMessageController *delegate = nil;
if (withDelegate) {
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 1.20.0

##### Breaking
- Updated the iOS plugin to use [Braze iOS SDK 3.18.0](https://github.com/Appboy/appboy-ios-sdk/releases/tag/3.18.0).
- Braze iOS SDK 3.18.0 removed the Feedback feature. As a result, all Feedback methods on the Appboy interface are now a no-op on iOS.

##### Added
- Added `RequestLocationInitialization` to the Appboy interface, which wraps `AppboyLocationService.requestInitialization(context)` on the Android SDK.

## 1.19.0

##### Breaking
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ To integrate Braze into your Android Unity application, complete our [Android Un
To integrate Braze into your iOS Unity application, complete our [iOS Unity integration instructions][2].

[1]: https://github.com/Appboy/appboy-unity-sdk/releases
[2]: https://www.braze.com/documentation/Unity/iOS/
[3]: https://documentation.braze.com/SDK_Integration/Unity/Android
[2]: https://www.braze.com/docs/developer_guide/platform_integration_guides/unity/ios/sdk_integration/
[3]: https://www.braze.com/docs/developer_guide/platform_integration_guides/unity/android/sdk_integration/

0 comments on commit 32aeb3f

Please sign in to comment.