File tree 4 files changed +58
-7
lines changed
OneSignalExample/Assets/Plugins/Android/OneSignalConfig.androidlib
com.onesignal.unity.android/Editor
OneSignalConfig.androidlib
4 files changed +58
-7
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ WARNING: Do NOT Modify! Changes will be overwritten by the OneSignal plugin.
3
+ */
4
+
1
5
apply plugin : ' com.android.library'
2
6
3
7
android {
8
+ namespace ' com.onesignal.onesignalsdk'
9
+
4
10
sourceSets {
5
11
main {
6
12
manifest. srcFile ' AndroidManifest.xml'
@@ -9,16 +15,16 @@ android {
9
15
10
16
def unityLib = project(' :unityLibrary' ). extensions. getByName(' android' )
11
17
12
- defaultConfig {
18
+ defaultConfig {
13
19
consumerProguardFiles " consumer-proguard.pro"
14
20
minSdkVersion unityLib. defaultConfig. minSdkVersion. mApiLevel
15
21
targetSdkVersion unityLib. defaultConfig. targetSdkVersion. mApiLevel
16
- }
22
+ }
17
23
18
24
compileSdkVersion unityLib. compileSdkVersion
19
25
buildToolsVersion unityLib. buildToolsVersion
20
26
21
27
lintOptions {
22
28
abortOnError false
23
29
}
24
- }
30
+ }
Original file line number Diff line number Diff line change
1
+ using System . IO ;
2
+ using UnityEditor ;
3
+
4
+ namespace OneSignalSDK {
5
+
6
+ [ InitializeOnLoad ]
7
+ sealed class MigrateAndroidResources {
8
+ static MigrateAndroidResources ( ) {
9
+ UpdateBuildDotGradleContains ( ) ;
10
+ }
11
+
12
+ /// <summary>
13
+ /// Updates Assets/Plugins/Android/OneSignalConfig.androidlib/build.gradle
14
+ /// with contains provided by OneSignal-Unity-SDK 5.1.13.
15
+ /// Includes compatibility with Unity 6, as it's Gradle version has new
16
+ /// requirements.
17
+ /// </summary>
18
+ private static void UpdateBuildDotGradleContains ( ) {
19
+ if ( ! Directory . Exists ( ExportAndroidResourcesStep . _pluginExportPath ) )
20
+ return ;
21
+
22
+ string exportedFilename = Path . Combine (
23
+ ExportAndroidResourcesStep . _pluginExportPath ,
24
+ "build.gradle"
25
+ ) ;
26
+ string exportedContains = File . ReadAllText ( exportedFilename ) ;
27
+
28
+ string packageFilename = Path . Combine (
29
+ ExportAndroidResourcesStep . _pluginPackagePath ,
30
+ "build.gradle"
31
+ ) ;
32
+ string packageContains = File . ReadAllText ( packageFilename ) ;
33
+
34
+ // We want to copy only when needed, otherwise it can reset file
35
+ // properties, such as permissions and timestamps
36
+ if ( exportedContains != packageContains ) {
37
+ File . Copy ( packageFilename , exportedFilename , true ) ;
38
+ }
39
+ }
40
+ }
41
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ WARNING: Do NOT Modify! Changes will be overwritten by the OneSignal plugin.
3
+ */
4
+
1
5
apply plugin : ' com.android.library'
2
6
3
7
android {
@@ -11,11 +15,11 @@ android {
11
15
12
16
def unityLib = project(' :unityLibrary' ). extensions. getByName(' android' )
13
17
14
- defaultConfig {
18
+ defaultConfig {
15
19
consumerProguardFiles " consumer-proguard.pro"
16
20
minSdkVersion unityLib. defaultConfig. minSdkVersion. mApiLevel
17
21
targetSdkVersion unityLib. defaultConfig. targetSdkVersion. mApiLevel
18
- }
22
+ }
19
23
20
24
compileSdkVersion unityLib. compileSdkVersion
21
25
buildToolsVersion unityLib. buildToolsVersion
Original file line number Diff line number Diff line change @@ -131,8 +131,8 @@ private void MigratePluginToAndroidlib() {
131
131
private static readonly string _packagePath = Path . Combine ( "Packages" , "com.onesignal.unity.android" , "Editor" ) ;
132
132
private static readonly string _androidPluginsPath = Path . Combine ( "Assets" , "Plugins" , "Android" ) ;
133
133
134
- private static readonly string _pluginPackagePath = Path . Combine ( _packagePath , _pluginName ) ;
135
- private static readonly string _pluginExportPath = Path . Combine ( _androidPluginsPath , _pluginName ) ;
134
+ internal static readonly string _pluginPackagePath = Path . Combine ( _packagePath , _pluginName ) ;
135
+ internal static readonly string _pluginExportPath = Path . Combine ( _androidPluginsPath , _pluginName ) ;
136
136
137
137
private static readonly string _manifestPackagePath = Path . Combine ( _pluginPackagePath , "AndroidManifest.xml" ) ;
138
138
private static readonly string _manifestExportPath = Path . Combine ( _pluginExportPath , "AndroidManifest.xml" ) ;
You can’t perform that action at this time.
0 commit comments