Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "utils.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
_In_ wchar_t* command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "utils.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
_In_ wchar_t* command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# https://firebase.google.com/support/release-notes/android
FirebaseSDKVersion=34.0.0
FirebaseSDKVersion=34.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "utils.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
_In_ wchar_t* command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static std::string kLibraryName = "flutter-fire-core";

// static
void FirebaseCorePlugin::RegisterWithRegistrar(
flutter::PluginRegistrarWindows *registrar) {
flutter::PluginRegistrarWindows* registrar) {
auto plugin = std::make_unique<FirebaseCorePlugin>();

FirebaseCoreHostApi::SetUp(registrar->messenger(), plugin.get());
Expand All @@ -53,7 +53,7 @@ FirebaseCorePlugin::~FirebaseCorePlugin() = default;

// Convert a CoreFirebaseOptions to a Firebase Options.
firebase::AppOptions CoreFirebaseOptionsToAppOptions(
const CoreFirebaseOptions &pigeon_options) {
const CoreFirebaseOptions& pigeon_options) {
firebase::AppOptions options;
options.set_api_key(pigeon_options.api_key().c_str());
options.set_app_id(pigeon_options.app_id().c_str());
Expand All @@ -74,39 +74,39 @@ firebase::AppOptions CoreFirebaseOptionsToAppOptions(
}

// Convert a AppOptions to CoreFirebaseOptions
CoreFirebaseOptions optionsFromFIROptions(const firebase::AppOptions &options) {
CoreFirebaseOptions optionsFromFIROptions(const firebase::AppOptions& options) {
CoreFirebaseOptions pigeon_options =
CoreFirebaseOptions(options.api_key(), options.app_id(),
options.messaging_sender_id(), options.project_id());
// AppOptions initialises as empty char so we check to stop empty string to
// Flutter Same for storage bucket below
const char *db_url = options.database_url();
const char* db_url = options.database_url();
if (db_url != nullptr && db_url[0] != '\0') {
pigeon_options.set_database_u_r_l(db_url);
}
pigeon_options.set_tracking_id(nullptr);

const char *storage_bucket = options.storage_bucket();
const char* storage_bucket = options.storage_bucket();
if (storage_bucket != nullptr && storage_bucket[0] != '\0') {
pigeon_options.set_storage_bucket(storage_bucket);
}
return pigeon_options;
}

// Convert a firebase::App to CoreInitializeResponse
CoreInitializeResponse AppToCoreInitializeResponse(const App &app) {
CoreInitializeResponse AppToCoreInitializeResponse(const App& app) {
flutter::EncodableMap plugin_constants;
CoreInitializeResponse response = CoreInitializeResponse(
app.name(), optionsFromFIROptions(app.options()), plugin_constants);
return response;
}

void FirebaseCorePlugin::InitializeApp(
const std::string &app_name,
const CoreFirebaseOptions &initialize_app_request,
const std::string& app_name,
const CoreFirebaseOptions& initialize_app_request,
std::function<void(ErrorOr<CoreInitializeResponse> reply)> result) {
// Create an app
App *app =
App* app =
App::Create(CoreFirebaseOptionsToAppOptions(initialize_app_request),
app_name.c_str());

Expand All @@ -118,14 +118,14 @@ void FirebaseCorePlugin::InitializeCore(
std::function<void(ErrorOr<flutter::EncodableList> reply)> result) {
// TODO: Missing function to get the list of currently initialized apps
std::vector<CoreInitializeResponse> initializedApps;
std::vector<App *> all_apps = App::GetApps();
for (const App *app : all_apps) {
std::vector<App*> all_apps = App::GetApps();
for (const App* app : all_apps) {
initializedApps.push_back(AppToCoreInitializeResponse(*app));
}

flutter::EncodableList encodableList;

for (const auto &item : initializedApps) {
for (const auto& item : initializedApps) {
encodableList.push_back(flutter::CustomEncodableValue(item));
}
result(encodableList);
Expand All @@ -135,19 +135,19 @@ void FirebaseCorePlugin::OptionsFromResource(
std::function<void(ErrorOr<CoreFirebaseOptions> reply)> result) {}

void FirebaseCorePlugin::SetAutomaticDataCollectionEnabled(
const std::string &app_name, bool enabled,
const std::string& app_name, bool enabled,
std::function<void(std::optional<FlutterError> reply)> result) {
App *firebaseApp = App::GetInstance(app_name.c_str());
App* firebaseApp = App::GetInstance(app_name.c_str());
if (firebaseApp != nullptr) {
// TODO: Missing method
}
result(std::nullopt);
}

void FirebaseCorePlugin::SetAutomaticResourceManagementEnabled(
const std::string &app_name, bool enabled,
const std::string& app_name, bool enabled,
std::function<void(std::optional<FlutterError> reply)> result) {
App *firebaseApp = App::GetInstance(app_name.c_str());
App* firebaseApp = App::GetInstance(app_name.c_str());
if (firebaseApp != nullptr) {
// TODO: Missing method
}
Expand All @@ -156,9 +156,9 @@ void FirebaseCorePlugin::SetAutomaticResourceManagementEnabled(
}

void FirebaseCorePlugin::Delete(
const std::string &app_name,
const std::string& app_name,
std::function<void(std::optional<FlutterError> reply)> result) {
App *firebaseApp = App::GetInstance(app_name.c_str());
App* firebaseApp = App::GetInstance(app_name.c_str());
if (firebaseApp != nullptr) {
// TODO: Missing method
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ class FirebaseCorePlugin : public flutter::Plugin,
public FirebaseCoreHostApi,
public FirebaseAppHostApi {
public:
static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar);
static void RegisterWithRegistrar(flutter::PluginRegistrarWindows* registrar);

FirebaseCorePlugin();

virtual ~FirebaseCorePlugin();

// Disallow copy and assign.
FirebaseCorePlugin(const FirebaseCorePlugin &) = delete;
FirebaseCorePlugin &operator=(const FirebaseCorePlugin &) = delete;
FirebaseCorePlugin(const FirebaseCorePlugin&) = delete;
FirebaseCorePlugin& operator=(const FirebaseCorePlugin&) = delete;

// FirebaseCoreHostApi
virtual void InitializeApp(
const std::string &app_name,
const CoreFirebaseOptions &initialize_app_request,
const std::string& app_name,
const CoreFirebaseOptions& initialize_app_request,
std::function<void(ErrorOr<CoreInitializeResponse> reply)> result)
override;
virtual void InitializeCore(
Expand All @@ -45,13 +45,13 @@ class FirebaseCorePlugin : public flutter::Plugin,

// FirebaseAppHostApi
virtual void SetAutomaticDataCollectionEnabled(
const std::string &app_name, bool enabled,
const std::string& app_name, bool enabled,
std::function<void(std::optional<FlutterError> reply)> result) override;
virtual void SetAutomaticResourceManagementEnabled(
const std::string &app_name, bool enabled,
const std::string& app_name, bool enabled,
std::function<void(std::optional<FlutterError> reply)> result) override;
virtual void Delete(
const std::string &app_name,
const std::string& app_name,
std::function<void(std::optional<FlutterError> reply)> result) override;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "utils.h"

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
_In_ wchar_t* command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
Expand Down
Loading