-
-
Notifications
You must be signed in to change notification settings - Fork 14
feat(editor): Add iOS export warning for minimum version #628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
130f0d2
Add export plugin for iOS
limbonaut 18505e7
Update CHANGELOG.md
limbonaut 9e7b479
Push error if exported with lower version
limbonaut 96a528f
Fix hard-coded version in strings
limbonaut 48dc024
Guard platform
limbonaut 2b80042
Update CHANGELOG.md
limbonaut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #pragma once | ||
|
|
||
| #include <godot_cpp/classes/editor_export_platform.hpp> | ||
| #include <godot_cpp/variant/variant.hpp> | ||
|
|
||
| using namespace godot; | ||
|
|
||
| namespace sentry::editor { | ||
|
|
||
| // Creates a dictionary with a fake export check option for Sentry export plugins. | ||
| // This is needed because Godot's export dialog only shows bottom-bar warnings for | ||
| // plugin-owned options, so a fake option allows us to display warnings for | ||
| // Godot Engine-owned export options through that code path. | ||
| // Option is hidden from view, so users don't actually see it in the UI. | ||
| inline Dictionary make_hidden_export_check_option() { | ||
| Dictionary option; | ||
| option["option"] = Dictionary(PropertyInfo( | ||
| Variant::BOOL, | ||
| "sentry/_export_check", | ||
| PROPERTY_HINT_NONE, | ||
| String(), | ||
limbonaut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| PROPERTY_USAGE_NONE)); | ||
| option["default_value"] = true; | ||
| return option; | ||
| } | ||
|
|
||
| // Checks if this option is either the builtin one we care about or our hidden sentry option. | ||
| // See make_hidden_export_check_option(). | ||
| inline bool is_builtin_option_or_hidden_export_option(const String &p_option, const String &p_builtin_option) { | ||
| return p_option == p_builtin_option || p_option == "sentry/_export_check"; | ||
| } | ||
|
|
||
| } //namespace sentry::editor | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #include "sentry_editor_export_plugin_ios.h" | ||
|
|
||
| #ifdef TOOLS_ENABLED | ||
|
|
||
| #include "export_utils.h" | ||
| #include "gen/sdk_version.gen.h" | ||
| #include "sentry/logging/print.h" | ||
|
|
||
| using namespace sentry::editor; | ||
|
|
||
| String SentryEditorExportPluginIOS::_get_name() const { | ||
| return "SentryEditorExportPluginIOS"; | ||
| } | ||
|
|
||
| bool SentryEditorExportPluginIOS::_supports_platform(const Ref<EditorExportPlatform> &p_platform) const { | ||
| return p_platform->get_os_name() == "iOS"; | ||
| } | ||
|
|
||
| TypedArray<Dictionary> SentryEditorExportPluginIOS::_get_export_options(const Ref<EditorExportPlatform> &p_platform) const { | ||
| TypedArray<Dictionary> options; | ||
| // HACK: Adding a hidden option so we can show a warning at the bottom of the export dialog. | ||
| options.push_back(make_hidden_export_check_option()); | ||
| return options; | ||
| } | ||
|
|
||
| String SentryEditorExportPluginIOS::_get_export_option_warning(const Ref<EditorExportPlatform> &p_platform, const String &p_option) const { | ||
| // HACK: Godot shows bottom-bar warnings through a separate code path that only checks plugin-owned options. | ||
| if (is_builtin_option_or_hidden_export_option(p_option, "application/min_ios_version")) { | ||
| String min_ios_version = get_option("application/min_ios_version"); | ||
| if (min_ios_version.to_float() < SENTRY_IOS_MIN_VERSION) { | ||
| return vformat("Sentry requires \"Min iOS version\" %.1f or higher. Please adjust this setting.", SENTRY_IOS_MIN_VERSION); | ||
| } | ||
| } | ||
| return String(); | ||
| } | ||
|
|
||
| void SentryEditorExportPluginIOS::_export_end() { | ||
| String min_ios_version = get_option("application/min_ios_version"); | ||
| if (min_ios_version.to_float() < SENTRY_IOS_MIN_VERSION) { | ||
| ERR_PRINT_ED(vformat("Sentry requires \"Min iOS version\" to be %.1f or higher. The export completed, but the app may fail App Store Connect validation. Please update this export setting before distributing your app.", SENTRY_IOS_MIN_VERSION)); | ||
| } | ||
| } | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #endif // TOOLS_ENABLED | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #pragma once | ||
|
|
||
| #ifdef TOOLS_ENABLED | ||
|
|
||
| #include <godot_cpp/classes/editor_export_platform.hpp> | ||
| #include <godot_cpp/classes/editor_export_plugin.hpp> | ||
|
|
||
| using namespace godot; | ||
|
|
||
| class SentryEditorExportPluginIOS : public EditorExportPlugin { | ||
| GDCLASS(SentryEditorExportPluginIOS, EditorExportPlugin); | ||
|
|
||
| protected: | ||
| static void _bind_methods() {} | ||
|
|
||
| public: | ||
| virtual String _get_name() const override; | ||
| virtual bool _supports_platform(const Ref<EditorExportPlatform> &p_platform) const override; | ||
| virtual TypedArray<Dictionary> _get_export_options(const Ref<EditorExportPlatform> &p_platform) const override; | ||
| virtual String _get_export_option_warning(const Ref<EditorExportPlatform> &p_platform, const String &p_option) const override; | ||
| virtual void _export_end() override; | ||
|
|
||
| SentryEditorExportPluginIOS() = default; | ||
| }; | ||
|
|
||
| #endif // TOOLS_ENABLED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.