Skip to content

Commit cade748

Browse files
committed
Sets AndroidManifest.xml package values automatically
1 parent de0d4aa commit cade748

File tree

183 files changed

+111
-17
lines changed

Some content is hidden

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

183 files changed

+111
-17
lines changed

Unity4.6-4.7OneSignalSDK.unitypackage

-4.29 MB
Binary file not shown.

Unity4.6OneSignalExample/Assets/Plugins/OneSignal/VERSION

-1
This file was deleted.

Unity5OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifest.xml renamed to Unity4.7OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifestTemplate.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<!-- NOTE: Replace all 3 copies ${manifestApplicationId} below with your full Android package name before building! -->
1+
<!--
2+
WARNING: Do NOT Modify! Changes will be overwritten by the OneSignal plugin.
3+
Make your changes to Assets/Plugins/Android/AndroidManifest.xml instead.
4+
-->
25

36
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
47
package="com.onesignal.onesignalsdk"

Unity5OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifest.xml.meta renamed to Unity4.7OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifestTemplate.xml.meta

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Android Setup
22
=====================
33

4-
1. Open Plugins/Android/OneSignalConfig/AndroidManifest.xml and follow the insturctions.
5-
2. Replace the example small notification icons in the res folder with your own with by follwing the insturctions below.
4+
1. Replace the example small notification icons in the res folder with your own with by follwing the insturctions below.
65
- https://documentation.onesignal.com/docs/android-notification-customizations#small-notification-icon
7-
3. The large notification icon is optional, remove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.
6+
2. The large notification icon is optional, remove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.

Unity4.7OneSignalExample/Assets/Plugins/OneSignal/Editor.meta

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#if UNITY_ANDROID
2+
using UnityEditor;
3+
using System.IO;
4+
using UnityEngine;
5+
6+
[InitializeOnLoad]
7+
public class OneSignalEditorScript {
8+
9+
// Copies `AndroidManifestTemplate.xml` to `AndroidManifest.xml`
10+
// then replace `${manifestApplicationId}` with current packagename in the Unity settings.
11+
static OneSignalEditorScript () {
12+
string oneSignalConfigPath = "Assets/Plugins/Android/OneSignalConfig/";
13+
string manifestFullPath = oneSignalConfigPath + "AndroidManifest.xml";
14+
15+
File.Copy(oneSignalConfigPath + "AndroidManifestTemplate.xml", manifestFullPath, true);
16+
17+
StreamReader streamReader = new StreamReader(manifestFullPath);
18+
string body = streamReader.ReadToEnd();
19+
streamReader.Close();
20+
21+
body = body.Replace("${manifestApplicationId}", PlayerSettings.bundleIdentifier);
22+
using (var streamWriter = new StreamWriter(manifestFullPath, false))
23+
{
24+
streamWriter.Write(body);
25+
}
26+
}
27+
}
28+
#endif

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

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.15.1

Unity4.7OneSignalSDK.unitypackage

4.29 MB
Binary file not shown.

Unity5OneSignalExample/Assets/OneSignal/Editor.meta

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#if UNITY_ANDROID
2+
using UnityEditor;
3+
using System.IO;
4+
using UnityEngine;
5+
6+
[InitializeOnLoad]
7+
public class OneSignalEditorScript {
8+
9+
// Copies `AndroidManifestTemplate.xml` to `AndroidManifest.xml`
10+
// then replace `${manifestApplicationId}` with current packagename in the Unity settings.
11+
static OneSignalEditorScript () {
12+
string oneSignalConfigPath = "Assets/Plugins/Android/OneSignalConfig/";
13+
string manifestFullPath = oneSignalConfigPath + "AndroidManifest.xml";
14+
15+
File.Copy(oneSignalConfigPath + "AndroidManifestTemplate.xml", manifestFullPath, true);
16+
17+
StreamReader streamReader = new StreamReader(manifestFullPath);
18+
string body = streamReader.ReadToEnd();
19+
streamReader.Close();
20+
21+
body = body.Replace("${manifestApplicationId}", PlayerSettings.bundleIdentifier);
22+
using (var streamWriter = new StreamWriter(manifestFullPath, false))
23+
{
24+
streamWriter.Write(body);
25+
}
26+
}
27+
}
28+
#endif

Unity5OneSignalExample/Assets/OneSignal/Editor/OneSignalEditorScript.cs.meta

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.15.0
1+
1.15.1

Unity4.6OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifest.xml renamed to Unity5OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifestTemplate.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<!-- NOTE: Replace all 3 copies ${manifestApplicationId} below with your full Android package name before building! -->
1+
<!--
2+
WARNING: Do NOT Modify! Changes will be overwritten by the OneSignal plugin.
3+
Make your changes to Assets/Plugins/Android/AndroidManifest.xml instead.
4+
-->
25

36
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
47
package="com.onesignal.onesignalsdk"

Unity4.6OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifest.xml.meta renamed to Unity5OneSignalExample/Assets/Plugins/Android/OneSignalConfig/AndroidManifestTemplate.xml.meta

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Android Setup
22
=====================
33

4-
1. Open Plugins/Android/OneSignalConfig/AndroidManifest.xml and follow the insturctions.
5-
2. Replace the example small notification icons in the res folder with your own with by follwing the insturctions below.
4+
1. Replace the example small notification icons in the res folder with your own with by follwing the insturctions below.
65
- https://documentation.onesignal.com/docs/android-notification-customizations#small-notification-icon
7-
3. The large notification icon is optional, remove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.
6+
2. The large notification icon is optional, remove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 5.3.1f1
1+
m_EditorVersion: 5.3.4f1
22
m_StandardAssetsVersion: 0

Unity5OneSignalSDK.unitypackage

1.06 KB
Binary file not shown.

0 commit comments

Comments
 (0)