Skip to content
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

[WIP] Add windows support to remote config #10997

Draft
wants to merge 71 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
467586f
feat: integration of C++ desktop SDK
Lyokone Feb 21, 2023
b4d9126
add windows
Lyokone Mar 6, 2023
153c0d9
add windows
Lyokone Mar 6, 2023
8f19973
add windows
Lyokone Mar 6, 2023
7ffbf8c
add windows
Lyokone Mar 6, 2023
1efb81f
right position for google service file
Lyokone Mar 6, 2023
856a6df
add windows
Lyokone Mar 6, 2023
dca7958
feat: integration of C++ desktop SDK
Lyokone Feb 21, 2023
3ca3848
add windows
Lyokone Mar 6, 2023
73e93e2
add windows
Lyokone Mar 6, 2023
29700ce
add windows
Lyokone Mar 6, 2023
e9c3cbb
add windows
Lyokone Mar 6, 2023
9e7fdcf
right position for google service file
Lyokone Mar 6, 2023
f5517dc
add windows
Lyokone Mar 6, 2023
e1b75ca
feat(core, windows): add windows support to firebase_core
Lyokone Mar 14, 2023
1e9d473
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
a3f796f
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
f40b408
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
eee05da
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
c2a7db6
Merge branch 'feat/cpp' of https://github.com/firebase/flutterfire in…
Lyokone Mar 20, 2023
a8ed44f
feat: merge with main package
Lyokone Mar 20, 2023
a35e3e6
add intializeApp
Lyokone Mar 20, 2023
49dd1fb
initalizeCore
Lyokone Mar 20, 2023
1a5cd02
ready windows
Lyokone Mar 21, 2023
c8ffe08
feat: integration of C++ desktop SDK
Lyokone Feb 21, 2023
f351089
add windows
Lyokone Mar 6, 2023
b231635
add windows
Lyokone Mar 6, 2023
5ba84f8
add windows
Lyokone Mar 6, 2023
226d0db
add windows
Lyokone Mar 6, 2023
b6cb387
right position for google service file
Lyokone Mar 6, 2023
bd34981
add windows
Lyokone Mar 6, 2023
cb2fc58
add windows
Lyokone Mar 6, 2023
25d474e
add windows
Lyokone Mar 6, 2023
37e9e6a
add windows
Lyokone Mar 6, 2023
3e9ed95
feat(core, windows): add windows support to firebase_core
Lyokone Mar 14, 2023
9dd9781
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
276b7cb
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
9c6cbcc
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
6feecbf
feat(core, windows): update pigeon
Lyokone Mar 14, 2023
67621a9
feat: merge with main package
Lyokone Mar 20, 2023
f702e79
add intializeApp
Lyokone Mar 20, 2023
73ce28a
initalizeCore
Lyokone Mar 20, 2023
0999c3e
ready windows
Lyokone Mar 21, 2023
c03cb0d
Merge branch 'feat/cpp' of https://github.com/firebase/flutterfire in…
Lyokone Mar 21, 2023
e203061
app host
Lyokone Mar 21, 2023
33f2580
add licence headers
Lyokone Mar 21, 2023
d90af0d
format
Lyokone Mar 21, 2023
cac387a
format
Lyokone Mar 21, 2023
883cc12
formatting ui
Lyokone Mar 21, 2023
e59e241
formatting ui
Lyokone Mar 21, 2023
b4b4ee4
formatting ui
Lyokone Mar 21, 2023
4314033
feat: automatically download the C++ SDK
Lyokone Mar 24, 2023
26674eb
feat: auto download of the sdk
Lyokone Apr 13, 2023
3986c3f
Add windows to test folder
Lyokone Apr 13, 2023
0e985b3
tests working
Lyokone Apr 13, 2023
bec139f
ci: windows ci
Lyokone Apr 13, 2023
2ae5a11
ci: windows
Lyokone Apr 13, 2023
13a78b0
ci: tests
Lyokone Apr 13, 2023
7852dd8
remove old desktop service files
Lyokone Apr 13, 2023
9131867
add licence
Lyokone Apr 13, 2023
6844729
remove comment
Lyokone Apr 13, 2023
f138fad
remove file
Lyokone Apr 13, 2023
773bcf2
init commit for remote_config windows
cynthiajoan May 17, 2023
1d43636
Merge branch 'feat/cpp' into feat/rc_windows
cynthiajoan May 17, 2023
2df8b1d
Merge https://github.com/firebase/flutterfire into feat/rc_windows
cynthiajoan May 20, 2023
4361fd9
more pigoen change
cynthiajoan May 20, 2023
ac5d4c4
update on the async result handle and more
cynthiajoan May 26, 2023
0e90b9f
fix a compile error
cynthiajoan May 26, 2023
caca4f6
Merge https://github.com/firebase/flutterfire into feat/rc_windows
cynthiajoan Jun 22, 2023
ad3ab0e
hack to create firebaseApp
cynthiajoan Jun 23, 2023
acb2af4
better way to access FirebaseApp and FirebaseRemoteConfig
cynthiajoan Jun 27, 2023
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
14 changes: 13 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
{
"dart.runPubGetOnPubspecChanges": "always",
}
"C_Cpp.errorSquiggles": "disabled",
"files.associations": {
"chrono": "cpp",
"functional": "cpp",
"optional": "cpp",
"system_error": "cpp",
"type_traits": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xtr1common": "cpp",
"vector": "cpp"
},
}
1 change: 1 addition & 0 deletions packages/firebase_core/firebase_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ flutter:
windows:
pluginClass: FirebaseCorePluginCApi


firebase:
google_services_gradle_plugin_version: '4.3.10'
crashlytics_gradle_plugin_version: '2.8.1'
Expand Down
7 changes: 4 additions & 3 deletions packages/firebase_core/firebase_core/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# customers of the plugin.
cmake_minimum_required(VERSION 3.14)

set(FIREBASE_SDK_VERSION "10.5.0")
set(FIREBASE_SDK_VERSION "11.0.1")

if (EXISTS $ENV{FIREBASE_CPP_SDK_DIR}/include/firebase/version.h)
file(READ "$ENV{FIREBASE_CPP_SDK_DIR}/include/firebase/version.h" existing_version)
Expand Down Expand Up @@ -90,7 +90,7 @@ set(MSVC_RUNTIME_MODE MD)
add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL)
target_include_directories(${PLUGIN_NAME} INTERFACE
"${FIREBASE_CPP_SDK_DIR}/include")
set(firebase_libs firebase_auth firebase_database firebase_app)
set(firebase_libs firebase_auth firebase_database firebase_app firebase_remote_config)
foreach(firebase_lib IN ITEMS ${firebase_libs})
get_target_property(firebase_lib_path ${firebase_lib} IMPORTED_LOCATION)
string(REPLACE "Debug" "Release" firebase_lib_release_path ${firebase_lib_path})
Expand All @@ -99,8 +99,9 @@ foreach(firebase_lib IN ITEMS ${firebase_libs})
IMPORTED_LOCATION_RELEASE "${firebase_lib_release_path}"
)
endforeach()
set(ADDITIONAL_LIBS advapi32 ws2_32 crypt32 rpcrt4 ole32)

target_link_libraries(${PLUGIN_NAME} PRIVATE "${firebase_libs}")
target_link_libraries(${PLUGIN_NAME} PRIVATE "${firebase_libs}" "${ADDITIONAL_LIBS}")

target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright 2023, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#define _CRT_SECURE_NO_WARNINGS
#include "firebase_core_plugin.h"

// This must be included before many other Windows headers.
#include <windows.h>

#include "firebase/app.h"
#include "firebase/log.h"
#include "firebase/remote_config.h"
#include "messages.g.h"

// For getPlatformVersion; remove unless needed for your plugin implementation.
Expand All @@ -18,12 +20,14 @@

#include <future>
#include <iostream>
#include <map>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
using ::firebase::App;
using ::firebase::remote_config::RemoteConfig;

namespace firebase_core_windows {

Expand All @@ -38,7 +42,10 @@ void FirebaseCorePlugin::RegisterWithRegistrar(
registrar->AddPlugin(std::move(plugin));
}

FirebaseCorePlugin::FirebaseCorePlugin() {}
FirebaseCorePlugin::FirebaseCorePlugin() {
firebase::SetLogLevel(firebase::kLogLevelVerbose);
std::cout << "[C++] FirebaseCorePlugin::FirebaseCorePlugin" << std::endl;
}

FirebaseCorePlugin::~FirebaseCorePlugin() = default;

Expand Down Expand Up @@ -87,34 +94,50 @@ PigeonInitializeResponse AppToPigeonInitializeResponse(const App &app) {
PigeonInitializeResponse response = PigeonInitializeResponse();
response.set_name(app.name());
response.set_options(optionsFromFIROptions(app.options()));

// response.set_plugin_constants(registrar.);
return response;
}

void *FirebaseCorePlugin::GetFirebaseApp(std::string appName) {
return App::GetInstance(appName.c_str());
}

void *FirebaseCorePlugin::GetFirebaseRemoteConfig(std::string appName) {
App *app = App::GetInstance(appName.c_str());
RemoteConfig *rc = RemoteConfig::GetInstance(app);
return rc;
}

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

// Send back the result to Flutter
result(AppToPigeonInitializeResponse(*app));
}

void FirebaseCorePlugin::InitializeCore(
std::function<void(ErrorOr<flutter::EncodableList> reply)> result) {
// TODO: Missing function to get the list of currently initialized apps
std::vector<PigeonInitializeResponse> initializedApps;

std::vector<App *> all_apps = App::GetApps();
for (const App *app : all_apps) {
initializedApps.push_back(AppToPigeonInitializeResponse(*app));
}

flutter::EncodableList encodableList;

// Insert the contents of the vector into the EncodableList
// for (const auto &item : initializedApps) {
// encodableList.push_back(flutter::EncodableValue(item));
//}
result(flutter::EncodableList());
for (const auto &item : initializedApps) {
encodableList.push_back(flutter::CustomEncodableValue(item));
}
result(encodableList);
}

void FirebaseCorePlugin::OptionsFromResource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class FirebaseCorePlugin : public flutter::Plugin,
public FirebaseAppHostApi {
public:
static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar);
static void *GetFirebaseApp(std::string appName);
static void *GetFirebaseRemoteConfig(std::string appName);

FirebaseCorePlugin();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ void FirebaseCorePluginCApiRegisterWithRegistrar(
flutter::PluginRegistrarManager::GetInstance()
->GetRegistrar<flutter::PluginRegistrarWindows>(registrar));
}

FLUTTER_PLUGIN_EXPORT void* GetFirebaseApp(std::string appName) {
return firebase_core_windows::FirebaseCorePlugin::GetFirebaseApp(appName);
}

FLUTTER_PLUGIN_EXPORT void* GetFirebaseRemoteConfig(std::string appName) {
return firebase_core_windows::FirebaseCorePlugin::GetFirebaseApp(appName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@

#include <flutter_plugin_registrar.h>

#include <memory>
#include <string>
#include <vector>

#ifdef FLUTTER_PLUGIN_IMPL
#define FLUTTER_PLUGIN_EXPORT __declspec(dllexport)
#else
#define FLUTTER_PLUGIN_EXPORT __declspec(dllimport)
#endif

#if defined(__cplusplus)
extern "C" {
#endif

FLUTTER_PLUGIN_EXPORT void FirebaseCorePluginCApiRegisterWithRegistrar(
FlutterDesktopPluginRegistrarRef registrar);

#if defined(__cplusplus)
} // extern "C"
#endif
FLUTTER_PLUGIN_EXPORT void* GetFirebaseApp(std::string appName);

FLUTTER_PLUGIN_EXPORT void* GetFirebaseRemoteConfig(std::string appName);

#endif // FLUTTER_PLUGIN_FIREBASE_CORE_PLUGIN_C_API_H_
Loading
Loading