Skip to content

Commit 40e4464

Browse files
authored
Merge pull request #177 from antonargunov/master
version 0.6.2
2 parents bc85f0f + 8e6c4e0 commit 40e4464

File tree

18 files changed

+137
-91
lines changed

18 files changed

+137
-91
lines changed
0 Bytes
Binary file not shown.

AndroidWrapperProject/.idea/workspace.xml

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

AndroidWrapperProject/app/src/main/java/io/branch/unity/BranchUnityApp.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class BranchUnityApp extends Application {
1515
public void onCreate() {
1616
super.onCreate();
1717
BranchUtil.setPluginType(BranchUtil.PluginType.Unity);
18-
BranchUtil.setPluginVersion("0.6.1");
1918
Branch.getAutoInstance(this.getApplicationContext());
2019
Branch.disableInstantDeepLinking(true);
2120
}

AndroidWrapperProject/app/src/main/java/io/branch/unity/BranchUnityWrapper.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,19 @@
3838
* Created by grahammueller on 3/25/15.
3939
*/
4040
public class BranchUnityWrapper {
41-
public static void setBranchKey(String branchKey) {
41+
public static void setBranchKey(String branchKey, String sdkVersion) {
4242
_branchKey = branchKey;
43+
BranchUtil.setPluginType(BranchUtil.PluginType.Unity);
44+
BranchUtil.setPluginVersion(sdkVersion);
4345
}
4446

45-
private static Branch.ShareLinkBuilder linkBuilder = null;
4647

4748
private static String autoInitCallbackWithParams = "";
4849
private static String autoInitCallbackWithBUO = "";
4950
/**
5051
* InitSession methods
5152
*/
5253

53-
public static void getAutoInstance() {
54-
Activity unityActivity = UnityPlayer.currentActivity;
55-
BranchUtil.setPluginType(BranchUtil.PluginType.Unity);
56-
BranchUtil.setPluginVersion("0.6.1");
57-
Branch.getAutoInstance(unityActivity.getApplicationContext());
58-
}
59-
6054
public static void initSession() {
6155
Activity unityActivity = UnityPlayer.currentActivity;
6256
Branch.getInstance(unityActivity.getApplicationContext(), _branchKey).initSessionWithData(unityActivity.getIntent().getData(), unityActivity);
104 KB
Binary file not shown.

BranchUnityTestBed/Assets/Branch/Branch.cs

Lines changed: 7 additions & 21 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.6.1";
10+
public static string sdkVersion = "0.6.2";
1111

1212
public delegate void BranchCallbackWithParams(Dictionary<string, object> parameters, string error);
1313
public delegate void BranchCallbackWithUrl(string url, string error);
@@ -19,12 +19,6 @@ public class Branch : MonoBehaviour {
1919

2020
#region InitSession methods
2121

22-
/**
23-
*
24-
*/
25-
public static void getAutoInstance() {
26-
_getAutoInstance();
27-
}
2822

2923
/**
3024
* Initialize session and receive information about how it opened.
@@ -397,10 +391,10 @@ public void Awake() {
397391
DontDestroyOnLoad(gameObject);
398392

399393
if (BranchData.Instance.testMode) {
400-
_setBranchKey(BranchData.Instance.testBranchKey);
394+
_setBranchKey(BranchData.Instance.testBranchKey, sdkVersion);
401395
}
402396
else {
403-
_setBranchKey(BranchData.Instance.liveBranchKey);
397+
_setBranchKey(BranchData.Instance.liveBranchKey, sdkVersion);
404398
}
405399
}
406400

@@ -430,9 +424,7 @@ void OnApplicationPause(bool pauseStatus) {
430424
#if (UNITY_IOS || UNITY_IPHONE) && !UNITY_EDITOR
431425

432426
[DllImport ("__Internal")]
433-
private static extern void _setBranchKey(string branchKey);
434-
435-
private static void _getAutoInstance() {}
427+
private static extern void _setBranchKey(string branchKey, string sdkVersion);
436428

437429
[DllImport ("__Internal")]
438430
private static extern void _initSession();
@@ -547,14 +539,10 @@ private static void _getAutoInstance() {}
547539

548540
#elif UNITY_ANDROID && !UNITY_EDITOR
549541

550-
private static void _setBranchKey(string branchKey) {
551-
BranchAndroidWrapper.setBranchKey(branchKey);
542+
private static void _setBranchKey(string branchKey, string sdkVersion) {
543+
BranchAndroidWrapper.setBranchKey(branchKey, sdkVersion);
552544
}
553545

554-
private static void _getAutoInstance() {
555-
BranchAndroidWrapper.getAutoInstance();
556-
}
557-
558546
private static void _initSession() {
559547
BranchAndroidWrapper.initSession();
560548
}
@@ -703,9 +691,7 @@ private static void _getShortURLWithBranchUniversalObjectAndCallback(string univ
703691

704692
#else
705693

706-
private static void _setBranchKey(string branchKey) { }
707-
708-
private static void _getAutoInstance() { }
694+
private static void _setBranchKey(string branchKey, string sdkVersion) { }
709695

710696
private static void _initSession() {
711697
Debug.Log("Branch is not implemented on this platform");

BranchUnityTestBed/Assets/Branch/BranchAndroidWrapper.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@
66
public class BranchAndroidWrapper {
77
#if UNITY_ANDROID
88

9-
public static void setBranchKey(String branchKey) {
9+
public static void setBranchKey(String branchKey, String sdkVersion) {
1010
_runBlockOnThread(() => {
11-
_getBranchClass().CallStatic("setBranchKey", branchKey);
11+
_getBranchClass().CallStatic("setBranchKey", branchKey, sdkVersion);
1212
});
1313
}
14-
15-
public static void getAutoInstance() {
16-
_runBlockOnThread(() => {
17-
_getBranchClass().CallStatic("getAutoInstance");
18-
});
19-
}
2014

2115
#region InitSession methods
2216

0 Bytes
Binary file not shown.

BranchUnityTestBed/Assets/Branch/Editor/BranchEditor.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ public static void UpdateLinkDomainsFilter(XmlDocument doc, XmlNode unityActivit
364364
ifData.SetAttribute("android____scheme", "https");
365365
}
366366
else {
367-
ifData.SetAttribute("android____scheme", "http");
367+
ifData.SetAttribute("android____scheme", "https");
368368
}
369369

370370
ifData.SetAttribute("android____host", link);
@@ -391,7 +391,7 @@ public static void UpdateLinkDomainsFilter(XmlDocument doc, XmlNode unityActivit
391391
ifData.SetAttribute("android____scheme", "https");
392392
}
393393
else {
394-
ifData.SetAttribute("android____scheme", "http");
394+
ifData.SetAttribute("android____scheme", "https");
395395
}
396396

397397
ifData.SetAttribute("android____host", link);
@@ -479,17 +479,12 @@ public static void UpdateDebugModeMeta(XmlDocument doc, XmlNode appNode) {
479479

480480
XmlElement keyMetaData = doc.CreateElement("meta-data");
481481

482-
if (BranchData.Instance.simulateFreshInstalls) {
483-
keyMetaData.SetAttribute("android____name", "io.branch.sdk.BranchKey.test");
484-
}
485-
else {
486-
keyMetaData.SetAttribute("android____name", "io.branch.sdk.BranchKey");
487-
}
488-
489482
if (BranchData.Instance.testMode) {
483+
keyMetaData.SetAttribute("android____name", "io.branch.sdk.BranchKey.test");
490484
keyMetaData.SetAttribute("android____value", BranchData.Instance.testBranchKey);
491485
}
492486
else {
487+
keyMetaData.SetAttribute("android____name", "io.branch.sdk.BranchKey");
493488
keyMetaData.SetAttribute("android____value", BranchData.Instance.liveBranchKey);
494489
}
495490

BranchUnityTestBed/Assets/Branch/Editor/BranchPostProcessBuild.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,15 @@ public static void ChangeXcodeProject(string pathToBuiltProject) {
169169
PBXProject proj = new PBXProject();
170170
proj.ReadFromString(File.ReadAllText(pathToProject));
171171

172-
string target = proj.TargetGuidByName("Unity-iPhone");
172+
string target = "";
173+
#if UNITY_2019_3_OR_NEWER
174+
target = proj.GetUnityMainTargetGuid();
175+
#else
176+
target = proj.TargetGuidByName("Unity-iPhone");
177+
#endif
178+
173179

174-
#if UNITY_2017_1_OR_NEWER
180+
#if UNITY_2017_1_OR_NEWER
175181

176182
if (!proj.ContainsFramework(target, "AdSupport.framework")) {
177183
proj.AddFrameworkToProject(target, "AdSupport.framework", false);

0 commit comments

Comments
 (0)