Skip to content

Commit d1b5454

Browse files
committed
Updated native iOS to 2.5.2 and Android to 3.4.4
- Also updated to Google's unity jar resolver to 1.2.16.0 - Note, new iOS 2.5.0 method's haven't been added to C# interfaces - Will be part of a future update when Android has matching methods.
1 parent f816914 commit d1b5454

File tree

68 files changed

+1891
-226
lines changed

Some content is hidden

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

68 files changed

+1891
-226
lines changed

Unity4.7OneSignalExample/Assets/OneSignal/Editor/OneSignalEditorScript.cs

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,64 @@
2525
* THE SOFTWARE.
2626
*/
2727

28+
using System;
2829
using System.IO;
30+
2931
using UnityEditor;
3032

3133
#if UNITY_ANDROID && UNITY_EDITOR
32-
using Google.JarResolver;
34+
using System.Collections.Generic;
3335

3436
[InitializeOnLoad]
35-
public class OneSignalEditorScriptAndroid {
36-
37+
public class OneSignalEditorScriptAndroid : AssetPostprocessor {
38+
39+
/// <summary>Instance of the PlayServicesSupport resolver</summary>
40+
public static object svcSupport;
41+
3742
private static readonly string PluginName = "OneSignal";
38-
private static readonly string PLAY_SERVICES_VERSION = "9+";
39-
public static PlayServicesSupport svcSupport;
43+
private static readonly string PLAY_SERVICES_VERSION = "+";
4044

4145
static OneSignalEditorScriptAndroid() {
4246
createOneSignalAndroidManifest();
4347
addGMSLibrary();
4448
}
4549

4650
private static void addGMSLibrary() {
47-
svcSupport = PlayServicesSupport.CreateInstance(PluginName,
48-
EditorPrefs.GetString("AndroidSdkRoot"),
49-
"ProjectSettings");
50-
51-
svcSupport.DependOn("com.google.android.gms", "play-services-gcm", PLAY_SERVICES_VERSION);
52-
svcSupport.DependOn("com.google.android.gms", "play-services-location", PLAY_SERVICES_VERSION);
51+
Type playServicesSupport = Google.VersionHandler.FindClass(
52+
"Google.JarResolver", "Google.JarResolver.PlayServicesSupport");
53+
if (playServicesSupport == null)
54+
return;
55+
56+
svcSupport = svcSupport ?? Google.VersionHandler.InvokeStaticMethod(
57+
playServicesSupport, "CreateInstance",
58+
new object[] {
59+
PluginName,
60+
EditorPrefs.GetString("AndroidSdkRoot"),
61+
"ProjectSettings"
62+
});
63+
64+
Google.VersionHandler.InvokeInstanceMethod(
65+
svcSupport, "DependOn",
66+
new object[] {
67+
"com.google.android.gms",
68+
"play-services-gcm",
69+
PLAY_SERVICES_VERSION
70+
},
71+
namedArgs: new Dictionary<string, object>() {
72+
{"packageIds", new string[] { "extra-google-m2repository" } }
73+
});
74+
75+
Google.VersionHandler.InvokeInstanceMethod(
76+
svcSupport, "DependOn",
77+
new object[] {
78+
"com.google.android.gms",
79+
"play-services-location",
80+
PLAY_SERVICES_VERSION
81+
},
82+
namedArgs: new Dictionary<string, object>() {
83+
{"packageIds", new string[] { "extra-google-m2repository" } }
84+
});
85+
5386
// Adds play-services-base, play-services-basement, play-services-iid, and support-v4 will be automaticly added.
5487
// Also adds play-services-tasks but this isn't used by OneSignal, it just added as a depency from the above.
5588

@@ -75,7 +108,11 @@ private static void createOneSignalAndroidManifest() {
75108
string body = streamReader.ReadToEnd();
76109
streamReader.Close();
77110

78-
body = body.Replace("${manifestApplicationId}", PlayerSettings.bundleIdentifier);
111+
#if UNITY_4_7
112+
body = body.Replace("${manifestApplicationId}", PlayerSettings.bundleIdentifier);
113+
#else
114+
body = body.Replace("${manifestApplicationId}", PlayerSettings.applicationIdentifier);
115+
#endif
79116
using (var streamWriter = new StreamWriter(manifestFullPath, false))
80117
{
81118
streamWriter.Write(body);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.0
1+
2.2.1
Binary file not shown.

Unity4.7OneSignalExample/Assets/PlayServicesResolver/Editor/Google.VersionHandler_v1.2.9.0.dll.meta renamed to Unity4.7OneSignalExample/Assets/PlayServicesResolver/Editor/Google.IOSResolver.dll.meta

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

Unity4.7OneSignalExample/Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.9.0.dll.meta renamed to Unity4.7OneSignalExample/Assets/PlayServicesResolver/Editor/Google.JarResolver.dll.meta

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

Unity4.7OneSignalExample/Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.9.0.dll.meta renamed to Unity4.7OneSignalExample/Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll.meta

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)