Skip to content

Commit 402cd42

Browse files
authored
Merge pull request #158 from antonargunov/master
version 0.5.10
2 parents 66917e8 + 164c4b0 commit 402cd42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+383
-2429
lines changed

BranchUnityTestBed/Assets/Branch/Branch.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class Branch : MonoBehaviour {
99

10-
public static string sdkVersion = "0.5.9";
10+
public static string sdkVersion = "0.5.10";
1111

1212
public delegate void BranchCallbackWithParams(Dictionary<string, object> parameters, string error);
1313
public delegate void BranchCallbackWithUrl(string url, string error);
@@ -272,10 +272,6 @@ public static void delayInitToCheckForSearchAds() {
272272
_delayInitToCheckForSearchAds();
273273
}
274274

275-
public static void setAppleSearchAdsDebugMode() {
276-
_setAppleSearchAdsDebugMode();
277-
}
278-
279275
#endregion
280276

281277
#region User Action methods
@@ -549,9 +545,6 @@ private static void _getAutoInstance() {}
549545
[DllImport ("__Internal")]
550546
private static extern void _delayInitToCheckForSearchAds();
551547

552-
[DllImport ("__Internal")]
553-
private static extern void _setAppleSearchAdsDebugMode();
554-
555548
[DllImport ("__Internal")]
556549
private static extern void _userCompletedAction(string action);
557550

@@ -694,8 +687,6 @@ private static void _setTrackingDisabled(bool value) {
694687

695688
private static void _delayInitToCheckForSearchAds() {}
696689

697-
private static void _setAppleSearchAdsDebugMode() {}
698-
699690
private static void _userCompletedAction(string action) {
700691
BranchAndroidWrapper.userCompletedAction(action);
701692
}
@@ -824,8 +815,6 @@ private static void _setTrackingDisabled(bool value) { }
824815

825816
private static void _delayInitToCheckForSearchAds() { }
826817

827-
private static void _setAppleSearchAdsDebugMode() { }
828-
829818
private static void _userCompletedAction(string action) { }
830819

831820
private static void _userCompletedActionWithState(string action, string stateDict) { }

BranchUnityTestBed/Assets/Branch/BranchEnums.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ public enum BranchEventType {
2929
ADD_PAYMENT_INFO,
3030
PURCHASE,
3131
SPEND_CREDITS,
32+
SUBSCRIBE,
33+
START_TRIAL,
34+
CLICK_AD,
35+
VIEW_AD,
3236

33-
// Content events
34-
SEARCH,
37+
// Content events
38+
SEARCH,
3539
VIEW_ITEM,
3640
VIEW_ITEMS,
3741
RATE,
@@ -41,7 +45,10 @@ public enum BranchEventType {
4145
COMPLETE_REGISTRATION,
4246
COMPLETE_TUTORIAL,
4347
ACHIEVE_LEVEL,
44-
UNLOCK_ACHIEVEMENT
48+
UNLOCK_ACHIEVEMENT,
49+
INVITE,
50+
LOGIN,
51+
RESERVE
4552
}
4653

4754
public enum BranchContentSchema {

BranchUnityTestBed/Assets/Branch/BranchEvent.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ public BranchEvent(BranchEventType branchEventType) {
1818
AddData("event_name", branchEventType.ToString ());
1919
}
2020

21+
// Set the alias
22+
public void SetAlias(string alias) {
23+
AddData("customer_event_alias", alias);
24+
}
25+
2126
// Set the transaction id associated with this event if there in any
2227
public void SetTransactionID(string transactionID) {
2328
AddData ("transaction_id", transactionID);

BranchUnityTestBed/Assets/Branch/Demo/Scripts/BranchDemo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public void OnBtn_RefreshRewards() {
164164
public void OnBtn_SendBuyEvent() {
165165
BranchEvent e = new BranchEvent (BranchEventType.PURCHASE);
166166

167+
e.SetAlias("my_alias");
167168
e.SetAffiliation("my_affilation");
168169
e.SetCoupon("my_coupon");
169170
e.SetCurrency(BranchCurrencyType.USD);
@@ -205,6 +206,7 @@ public void OnBtn_SimualteLogout() {
205206
public void OnBtn_SendComplexEvent() {
206207
BranchEvent e = new BranchEvent("MY_COMPLEX_EVENT");
207208

209+
e.SetAlias("my_alias");
208210
e.SetAffiliation("my_affilation");
209211
e.SetCoupon("my_coupon");
210212
e.SetCurrency(BranchCurrencyType.USD);

BranchUnityTestBed/Assets/Branch/Editor/BranchPostProcessBuild.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,11 @@ public static void ChangeXcodeProject(string pathToBuiltProject) {
189189
proj.AddFrameworkToProject(target, "Security.framework", false);
190190
}
191191

192-
#else
192+
if (!proj.ContainsFramework(target, "WebKit.framework")) {
193+
proj.AddFrameworkToProject(target, "WebKit.framework", false);
194+
}
195+
196+
#else
193197

194198
if (!proj.HasFramework("AdSupport.framework")) {
195199
proj.AddFrameworkToProject(target, "AdSupport.framework", false);
@@ -207,9 +211,9 @@ public static void ChangeXcodeProject(string pathToBuiltProject) {
207211
proj.AddFrameworkToProject(target, "Security.framework", false);
208212
}
209213

210-
#endif
214+
#endif
211215

212-
File.WriteAllText(pathToProject, proj.WriteToString());
216+
File.WriteAllText(pathToProject, proj.WriteToString());
213217
}
214218
}
215219
#endif
-80 Bytes
Binary file not shown.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// BNCAppleReceipt.h
3+
// Branch
4+
//
5+
// Created by Ernest Cho on 7/11/19.
6+
// Copyright © 2019 Branch, Inc. All rights reserved.
7+
//
8+
9+
#if __has_feature(modules)
10+
@import Foundation;
11+
#else
12+
#import <Foundation/Foundation.h>
13+
#endif
14+
15+
NS_ASSUME_NONNULL_BEGIN
16+
17+
@interface BNCAppleReceipt : NSObject
18+
19+
+ (BNCAppleReceipt *)instance;
20+
21+
// this is only available on builds from Apple
22+
- (nullable NSString *)installReceipt;
23+
- (BOOL)isTestFlight;
24+
25+
@end
26+
27+
NS_ASSUME_NONNULL_END

BranchUnityTestBed/Assets/Plugins/Branch/iOS/Branch-SDK/Branch-SDK/BNCFabricAnswers.h.meta renamed to BranchUnityTestBed/Assets/Plugins/Branch/iOS/Branch-SDK/Branch-SDK/BNCAppleReceipt.h.meta

Lines changed: 4 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// BNCAppleReceipt.m
3+
// Branch
4+
//
5+
// Created by Ernest Cho on 7/11/19.
6+
// Copyright © 2019 Branch, Inc. All rights reserved.
7+
//
8+
9+
#import "BNCAppleReceipt.h"
10+
11+
@interface BNCAppleReceipt()
12+
@property (nonatomic, copy, readwrite) NSString *receipt;
13+
@property (nonatomic, assign, readwrite) BOOL isSandboxReceipt;
14+
@end
15+
16+
@implementation BNCAppleReceipt
17+
18+
+ (BNCAppleReceipt *)instance {
19+
static BNCAppleReceipt *singleton;
20+
static dispatch_once_t onceToken;
21+
dispatch_once(&onceToken, ^{
22+
singleton = [[BNCAppleReceipt alloc] init];
23+
});
24+
return singleton;
25+
}
26+
27+
- (instancetype)init {
28+
self = [super init];
29+
if (self) {
30+
[self readReceipt];
31+
}
32+
return self;
33+
}
34+
35+
- (void)readReceipt {
36+
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
37+
if (receiptURL) {
38+
self.isSandboxReceipt = [receiptURL.lastPathComponent isEqualToString:@"sandboxReceipt"];
39+
}
40+
41+
NSData *receiptData = [NSData dataWithContentsOfURL:receiptURL];
42+
if (receiptData) {
43+
self.receipt = [receiptData base64EncodedStringWithOptions:0];
44+
}
45+
}
46+
47+
- (nullable NSString *)installReceipt {
48+
return self.receipt;
49+
}
50+
51+
- (BOOL)isTestFlight {
52+
// sandbox receipts are from testflight
53+
return self.isSandboxReceipt;
54+
}
55+
56+
@end

BranchUnityTestBed/Assets/Plugins/Branch/iOS/Branch-SDK/Branch-SDK/BranchView.h.meta renamed to BranchUnityTestBed/Assets/Plugins/Branch/iOS/Branch-SDK/Branch-SDK/BNCAppleReceipt.m.meta

Lines changed: 6 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)