More specific component error messaging and modes for native UI to prevent blocking dialog in some applications

This commit is contained in:
mgwynn
2021-06-23 21:05:17 -04:00
parent e357dea06c
commit fb3940fa31
16 changed files with 186 additions and 37 deletions
@@ -24,6 +24,11 @@ namespace AZ
{
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
{
if (m_mode == NativeUI::Mode::CONSOLE)
{
return {};
}
AZ::Android::JNI::Object object("com/amazon/lumberyard/NativeUI/LumberyardNativeUI");
object.RegisterStaticMethod("DisplayDialog", "(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V");
object.RegisterStaticMethod("GetUserSelection", "()Ljava/lang/String;");
@@ -28,6 +28,11 @@ namespace AZ
{
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
{
if (m_mode == NativeUI::Mode::CONSOLE)
{
return {};
}
__block NSModalResponse response = -1;
auto showDialog = ^()
@@ -247,6 +247,11 @@ namespace AZ
{
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
{
if (m_mode == NativeUI::Mode::CONSOLE)
{
return {};
}
if (options.size() >= MAX_ITEMS)
{
AZ_Assert(false, "Cannot create dialog box with more than %d buttons", (MAX_ITEMS - 1));
@@ -20,6 +20,11 @@ namespace AZ
{
AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector<AZStd::string>& options) const
{
if (m_mode == NativeUI::Mode::CONSOLE)
{
return {};
}
__block AZStd::string userSelection = "";
NSString* nsTitle = [NSString stringWithUTF8String:title.c_str()];