Skip to content

Commit

Permalink
Move icons and .wav file to /src/main
Browse files Browse the repository at this point in the history
  • Loading branch information
shepherd-l committed Oct 3, 2023
1 parent 9cc3338 commit 9f6c33c
Showing 1 changed file with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,29 @@ protected override void _runStep() {
private void migratePluginToAndroidlib() {
if (Directory.Exists(_pluginV3ExportPath)) {
if (!Directory.Exists(_pluginExportPath)) {
// Remove project.properties
if (File.Exists(_projectPropertiesV3ExportPath)) {
AssetDatabase.DeleteAsset(_projectPropertiesV3ExportPath);
try
{
AssetDatabase.StartAssetEditing();

// Remove project.properties
if (File.Exists(_projectPropertiesV3ExportPath)) {
AssetDatabase.DeleteAsset(_projectPropertiesV3ExportPath);
}

// Rename OneSignalConfig.plugin to OneSignalConfig.androidlib
AssetDatabase.MoveAsset(_pluginV3ExportPath, _pluginExportPath);
}
finally
{
AssetDatabase.StopAssetEditing();
}

// Move the icons and .wav file to /src/main
if (Directory.Exists(_resV3ExportPath)) {
Directory.CreateDirectory(Path.GetDirectoryName(_resExportPath));

// Rename OneSignalConfig.plugin to OneSignalConfig.androidlib
AssetDatabase.MoveAsset(_pluginV3ExportPath, _pluginExportPath);
FileUtil.MoveFileOrDirectory(_resV3ExportPath, _resExportPath);
}
} else {
AssetDatabase.DeleteAsset(_pluginV3ExportPath);
}
Expand All @@ -119,9 +135,14 @@ private void migratePluginToAndroidlib() {
private static readonly string _manifestPackagePath = Path.Combine(_pluginPackagePath, "AndroidManifest.xml");
private static readonly string _manifestExportPath = Path.Combine(_pluginExportPath, "AndroidManifest.xml");

private const string _resPath = "src/main/res";
private static readonly string _resExportPath = Path.Combine(_pluginExportPath, _resPath);

// Old OneSignalConfig name used from 3.x.x to 5.0.2
private const string _pluginNamev3 = "OneSignalConfig.plugin";
private static readonly string _pluginV3ExportPath = Path.Combine(_androidPluginsPath, _pluginNamev3);
private const string _pluginNameV3 = "OneSignalConfig.plugin";
private static readonly string _pluginV3ExportPath = Path.Combine(_androidPluginsPath, _pluginNameV3);
private static readonly string _projectPropertiesV3ExportPath = Path.Combine(_pluginV3ExportPath, "project.properties");
private const string _resV3Path = "res";
private static readonly string _resV3ExportPath = Path.Combine(_pluginExportPath, _resV3Path);
}
}

0 comments on commit 9f6c33c

Please sign in to comment.