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
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ if (FIREBASE_INCLUDE_FIRESTORE)
endif()
if (FIREBASE_INCLUDE_FUNCTIONS)
add_subdirectory(functions)
list(APPEND TARGET_LINK_LIB_NAMES "firebase_functions" "firebase_functions_swig")
list(APPEND DOCUMENTATION_ONLY_LIB_NAMES "firebase_functions_swig")
list(APPEND PROJECT_LIST_HEADER " X(Functions)")
endif()
if (FIREBASE_INCLUDE_MESSAGING)
add_subdirectory(messaging)
Expand Down
8 changes: 4 additions & 4 deletions app/src/internal/FirebaseInterops.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ internal static async Task<string> GetAuthTokenAsync(FirebaseApp firebaseApp)
}

// Adds the other Firebase tokens to the HttpRequest, as available.
internal static async Task AddFirebaseTokensAsync(HttpRequestMessage request, FirebaseApp firebaseApp)
internal static async Task AddFirebaseTokensAsync(HttpRequestMessage request, FirebaseApp firebaseApp, string authTokenPrefix = "Firebase")
{
string appCheckToken = await GetAppCheckTokenAsync(firebaseApp);
if (!string.IsNullOrEmpty(appCheckToken))
Expand All @@ -415,12 +415,12 @@ internal static async Task AddFirebaseTokensAsync(HttpRequestMessage request, Fi
string authToken = await GetAuthTokenAsync(firebaseApp);
if (!string.IsNullOrEmpty(authToken))
{
request.Headers.Add(authHeader, $"Firebase {authToken}");
request.Headers.Add(authHeader, $"{authTokenPrefix} {authToken}");
}
}

// Adds the other Firebase tokens to the WebSocket, as available.
internal static async Task AddFirebaseTokensAsync(ClientWebSocket socket, FirebaseApp firebaseApp)
internal static async Task AddFirebaseTokensAsync(ClientWebSocket socket, FirebaseApp firebaseApp, string authTokenPrefix = "Firebase")
{
string appCheckToken = await GetAppCheckTokenAsync(firebaseApp);
if (!string.IsNullOrEmpty(appCheckToken))
Expand All @@ -431,7 +431,7 @@ internal static async Task AddFirebaseTokensAsync(ClientWebSocket socket, Fireba
string authToken = await GetAuthTokenAsync(firebaseApp);
if (!string.IsNullOrEmpty(authToken))
{
socket.Options.SetRequestHeader(authHeader, $"Firebase {authToken}");
socket.Options.SetRequestHeader(authHeader, $"{authTokenPrefix} {authToken}");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/internal/HttpHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Firebase.Internal
// Helper functions to help handling the Http calls.
internal static class HttpHelpers
{
internal static async Task SetRequestHeaders(HttpRequestMessage request, FirebaseApp firebaseApp)
internal static async Task SetRequestHeaders(HttpRequestMessage request, FirebaseApp firebaseApp, string authPrefix = "Firebase")
{
request.Headers.Add("x-goog-api-key", firebaseApp.Options.ApiKey);
string version = FirebaseInterops.GetVersionInfoSdkVersion();
Expand All @@ -35,7 +35,7 @@ internal static async Task SetRequestHeaders(HttpRequestMessage request, Firebas
request.Headers.Add("X-Firebase-AppVersion", UnityEngine.Application.version);
}
// Add additional Firebase tokens to the header.
await FirebaseInterops.AddFirebaseTokensAsync(request, firebaseApp);
await FirebaseInterops.AddFirebaseTokensAsync(request, firebaseApp, authPrefix);
}

// Helper function to throw an exception if the Http Response indicates failure.
Expand Down
1 change: 1 addition & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Release Notes
breaking change for custom providers, which must now implement the new
`GetLimitedUseTokenAsync` method. If a custom provider does not support
this feature, it can return a standard token from this method.
- Functions: Rewrote internal serialization logic to C#. Removes dependency on internal C++ implementation.

### 13.8.0
- Changes
Expand Down
1 change: 0 additions & 1 deletion firebaseai/src/FunctionCalling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Firebase.AI.Internal;

namespace Firebase.AI
{
Expand Down
1 change: 0 additions & 1 deletion firebaseai/src/LiveGenerativeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Firebase.AI.Internal;
using Google.MiniJSON;

namespace Firebase.AI
Expand Down
90 changes: 14 additions & 76 deletions functions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,85 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# CMake file for the firebase functions library
# CMake file for the Firebase Functions library

include(build_shared)
# Firebase Functions is different from the other Firebase libraries,
# as instead of prebuilding, we provide it as a source library.

# Firebase Functions Swig input files
set(firebase_functions_swig
src/swig/functions.i
# Package every file under src, including subfolders, since we want them all.
unity_pack_folder(
"${FIREBASE_UNITY_DIR}/functions/src/"
PACK_PATH "Firebase/FirebaseFunctions"
)

# Firebase Functions CSharp files
set(firebase_functions_src
src/FirebaseFunctions.cs
src/FunctionsException.cs
src/HttpsCallableReference.cs
src/HttpsCallableResult.cs
)

firebase_swig_add_library(firebase_functions_swig
NAMESPACE
Firebase.Functions
MODULE
FirebaseCppFunctions
SOURCES
${firebase_functions_swig}
DEPENDS
firebase_functions
)

unity_pack_documentation_sources(functions
# For documentation, get all C# files recursively,
# which make up the public API.
file(GLOB_RECURSE firebase_functions_doc_src "src/*.cs")
# Filter out any files located in src/Internal
list(FILTER firebase_functions_doc_src EXCLUDE REGEX "src/Internal/")
unity_pack_documentation_sources(firebasefunctions
DOCUMENTATION_SOURCES
${firebase_functions_src}
${firebase_functions_swig_gen_src}
)
if (FIREBASE_GENERATE_SWIG_ONLY)
unity_pack_documentation_sources(functions
DOCUMENTATION_SOURCES
${firebase_functions_swig_gen_cpp_src}
)
return()
endif()

mono_add_library(firebase_functions_cs
MODULE
Firebase.Functions
SOURCES
${firebase_functions_src}
${firebase_functions_swig_gen_src}
REFERENCES
${FIREBASE_PLATFORM_REF}
DEPENDS
firebase_functions_swig
)

if(FIREBASE_IOS_BUILD)
ios_pack(firebase_lib_functions libFirebaseCppFunctions DEPS firebase_functions firebase_functions_swig)
else()
build_firebase_shared(
functions
functions
FirebaseCppFunctions
)
endif()

unity_pack_cs(firebase_functions_cs)

if (FIREBASE_INCLUDE_UNITY)
generate_dependencies_xml(Functions
FIREBASE_SPM_DEPS
"FirebaseFunctions|Firebase/Functions"
IOS_DEPS
"Firebase/Functions"
ANDROID_DEPS
${FIREBASE_FUNCTIONS_ANDROID_DEPS}
ANDROID_SPEC
"functions"
)
endif()

set_property(TARGET firebase_functions_cs
PROPERTY FOLDER
"Firebase ${FIREBASE_PLATFORM_NAME}"
${firebase_functions_doc_src}
)
Loading
Loading