32
32
33
33
namespace OneSignalSDK {
34
34
/// <summary>
35
- /// Copies the OneSignalConfig.plugin to Assets/Plugins/Android/*
35
+ /// Copies the OneSignal SDK default Android resources to Assets/Plugins/Android/*
36
36
/// </summary>
37
37
public sealed class ExportAndroidResourcesStep : OneSignalSetupStep {
38
38
public override string Summary
39
- => "Copy Android plugin to Assets" ;
39
+ => "Copy Android resources to Assets" ;
40
40
41
41
public override string Details
42
- => $ "Will create a plugin directory of { _pluginExportPath } filled with files necessary for the OneSignal SDK " +
43
- "to operate on Android." ;
42
+ => $ "Will export necessary files (such as default notification icons) to { _androidPluginPath } ";
44
43
45
44
public override bool IsRequired
46
- => true ;
45
+ => false ;
47
46
48
47
protected override bool _getIsStepCompleted ( ) {
49
- if ( ! Directory . Exists ( _pluginExportPath ) )
48
+ if ( ! Directory . Exists ( _androidPluginPath ) )
50
49
return false ;
51
50
52
- var packagePaths = Directory . GetFiles ( _pluginPackagePath , "*" , SearchOption . AllDirectories )
53
- . Select ( path => path . Remove ( 0 , path . LastIndexOf ( _pluginName , StringComparison . InvariantCulture ) ) ) ;
51
+ var packagePaths = Directory . GetFiles ( _exportsPath , "*" , SearchOption . AllDirectories )
52
+ . Select ( path => path . Remove ( 0 , _exportsPath . Length + 1 ) ) ;
54
53
55
- var exportPaths = Directory . GetFiles ( _pluginExportPath , "*" , SearchOption . AllDirectories )
56
- . Select ( path => path . Remove ( 0 , path . LastIndexOf ( _pluginName , StringComparison . InvariantCulture ) ) ) ;
54
+ var exportPaths = Directory . GetFiles ( _androidPluginPath , "*" , SearchOption . AllDirectories )
55
+ . Select ( path => path . Remove ( 0 , _androidPluginPath . Length + 1 ) ) ;
57
56
58
57
var fileDiff = packagePaths . Except ( exportPaths ) ;
59
58
60
59
return ! fileDiff . Any ( ) ;
61
60
}
62
61
63
62
protected override void _runStep ( ) {
64
- var files = Directory . GetFiles ( _pluginPackagePath , "*" , SearchOption . AllDirectories ) ;
63
+ var files = Directory . GetFiles ( _exportsPath , "*" , SearchOption . AllDirectories ) ;
65
64
var filteredFiles = files . Where ( file => ! file . EndsWith ( ".meta" ) ) ;
66
65
67
66
foreach ( var file in filteredFiles ) {
68
- var trimmedPath = file . Remove ( 0 , _pluginPackagePath . Length + 1 ) ;
69
- var fileExportPath = Path . Combine ( _pluginExportPath , trimmedPath ) ;
67
+ var trimmedPath = file . Remove ( 0 , _exportsPath . Length + 1 ) ;
68
+ var fileExportPath = Path . Combine ( _androidPluginPath , trimmedPath ) ;
70
69
var containingPath = fileExportPath . Remove ( fileExportPath . LastIndexOf ( Path . DirectorySeparatorChar ) ) ;
71
70
72
71
/*
@@ -85,10 +84,8 @@ protected override void _runStep() {
85
84
AssetDatabase . Refresh ( ) ;
86
85
}
87
86
88
- private const string _pluginName = "OneSignalConfig" ;
89
- private static readonly string _packagePath = Path . Combine ( "Packages" , "com.onesignal.unity.android" , "Editor" ) ;
90
- private static readonly string _androidPluginsPath = Path . Combine ( "Assets" , "Plugins" , "Android" ) ;
91
- private static readonly string _pluginPackagePath = Path . Combine ( _packagePath , _pluginName ) ;
92
- private static readonly string _pluginExportPath = Path . Combine ( _androidPluginsPath , _pluginName ) ;
87
+
88
+ private static readonly string _exportsPath = Path . Combine ( "Packages" , "com.onesignal.unity.android" , "Editor" , "Exports" ) ;
89
+ private static readonly string _androidPluginPath = Path . Combine ( "Assets" , "Plugins" , "Android" ) ;
93
90
}
94
91
}
0 commit comments