Skip to content

Commit 418f4b9

Browse files
Cleaner warning logging and show warning popup
1 parent a3973c4 commit 418f4b9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Packages/Sequence-Unity/Editor/AndroidDependencyManager.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections.Generic;
12
using UnityEditor;
23
using UnityEditor.Build;
34
using UnityEditor.Build.Reporting;
@@ -16,6 +17,9 @@ public class AndroidDependencyManager : IPreprocessBuildWithReport
1617
{
1718
private const string SecureStoragePluginFilename = "AndroidKeyBridge.java";
1819

20+
private const string RelevantDocsUrl =
21+
"https://docs.sequence.xyz/sdk/unity/onboard/recovering-sessions#android";
22+
1923
public int callbackOrder => 0;
2024

2125
public void OnPreprocessBuild(BuildReport report)
@@ -29,17 +33,19 @@ public void OnPreprocessBuild(BuildReport report)
2933
string pluginPath = matchingAssets
3034
.Select(guid => AssetDatabase.GUIDToAssetPath(guid))
3135
.FirstOrDefault(path => path.EndsWith(SecureStoragePluginFilename));
32-
3336
if (string.IsNullOrEmpty(pluginPath))
3437
{
35-
Debug.LogWarning($"Secure Storage plugin '{SecureStoragePluginFilename}' not found in project.");
38+
if (config.StoreSessionPrivateKeyInSecureStorage)
39+
{
40+
ShowWarning($"Secure Storage plugin '{SecureStoragePluginFilename}' not found in project. Please make sure you have imported it via Samples in Package Manager");
41+
}
3642
return;
3743
}
3844

3945
PluginImporter pluginImporter = AssetImporter.GetAtPath(pluginPath) as PluginImporter;
4046
if (pluginImporter == null)
4147
{
42-
Debug.LogWarning($"Unable to create {nameof(PluginImporter)} instance at path: {pluginPath}");
48+
ShowWarning($"Unable to create {nameof(PluginImporter)} instance at path: {pluginPath}");
4349
return;
4450
}
4551

@@ -49,5 +55,11 @@ public void OnPreprocessBuild(BuildReport report)
4955
$"Secure Storage plugin compatibility set to {config.StoreSessionPrivateKeyInSecureStorage} for path: {pluginPath}");
5056
#endif
5157
}
58+
59+
private void ShowWarning(string warning)
60+
{
61+
Debug.LogWarning(warning);
62+
SequenceWarningPopup.ShowWindow(new List<string>() {warning}, RelevantDocsUrl);
63+
}
5264
}
5365
}

0 commit comments

Comments
 (0)