Skip to content

Commit

Permalink
fix(auth, windows): fix a crash that could happen when using `sendEma…
Browse files Browse the repository at this point in the history
…ilVerification` or `sendPasswordResetEmail` (#12946)

* fix(auth, windows): fix a crash that could happen when using sendEmailVerification or sendPasswordResetEmail

* format
  • Loading branch information
Lyokone authored Jun 13, 2024
1 parent 747b0b6 commit a100829
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
28 changes: 20 additions & 8 deletions packages/firebase_auth/firebase_auth/windows/messages.g.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2856,10 +2856,16 @@ void FirebaseAuthHostApi::SetUp(flutter::BinaryMessenger* binary_messenger,
const auto& email_arg =
std::get<std::string>(encodable_email_arg);
const auto& encodable_action_code_settings_arg = args.at(2);
const auto* action_code_settings_arg =
&(std::any_cast<const PigeonActionCodeSettings&>(
std::get<CustomEncodableValue>(
encodable_action_code_settings_arg)));
// IF CODE REGENERATED, PLEASE REINSERT THIS. IF ARG IS NULL, APP
// CRASHES
const PigeonActionCodeSettings* action_code_settings_arg =
nullptr;
if (!encodable_action_code_settings_arg.IsNull()) {
action_code_settings_arg =
&(std::any_cast<const PigeonActionCodeSettings&>(
std::get<CustomEncodableValue>(
encodable_action_code_settings_arg)));
}
api->SendPasswordResetEmail(
app_arg, email_arg, action_code_settings_arg,
[reply](std::optional<FlutterError>&& output) {
Expand Down Expand Up @@ -3744,10 +3750,16 @@ void FirebaseAuthUserHostApi::SetUp(flutter::BinaryMessenger* binary_messenger,
const auto& app_arg = std::any_cast<const AuthPigeonFirebaseApp&>(
std::get<CustomEncodableValue>(encodable_app_arg));
const auto& encodable_action_code_settings_arg = args.at(1);
const auto* action_code_settings_arg =
&(std::any_cast<const PigeonActionCodeSettings&>(
std::get<CustomEncodableValue>(
encodable_action_code_settings_arg)));
// IF CODE REGENERATED, PLEASE REINSERT THIS. IF ARG IS NULL, APP
// CRASHES
const PigeonActionCodeSettings* action_code_settings_arg =
nullptr;
if (!encodable_action_code_settings_arg.IsNull()) {
action_code_settings_arg =
&(std::any_cast<const PigeonActionCodeSettings&>(
std::get<CustomEncodableValue>(
encodable_action_code_settings_arg)));
}
api->SendEmailVerification(
app_arg, action_code_settings_arg,
[reply](std::optional<FlutterError>&& output) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()

# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

Expand Down Expand Up @@ -92,7 +97,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
Expand Down

0 comments on commit a100829

Please sign in to comment.