From 1fc6b994fe798c20fc2444334a69c18ffa47f4a8 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Thu, 17 Oct 2024 13:27:15 -0700 Subject: [PATCH 1/9] Refactor Analytics swig logic (#1108) * Refactor Analytics swig logic * Update CMakeLists.txt * Add a deprecated ParameterGroupId * Add generated headers to the doc only logic * Update generate_constants.py --- CMakeLists.txt | 2 +- analytics/CMakeLists.txt | 47 +++ analytics/generate_constants.py | 83 +++++ analytics/src/Consent.cs | 38 ++ analytics/src/FirebaseAnalytics.cs | 301 +++++++++++++++ analytics/src/Parameter.cs | 108 ++++++ analytics/src/swig/analytics.i | 352 +++--------------- .../Firebase/Sample/Analytics/UIHandler.cs | 2 +- docs/readme.md | 8 + 9 files changed, 642 insertions(+), 299 deletions(-) create mode 100644 analytics/generate_constants.py create mode 100644 analytics/src/Consent.cs create mode 100644 analytics/src/FirebaseAnalytics.cs create mode 100644 analytics/src/Parameter.cs diff --git a/CMakeLists.txt b/CMakeLists.txt index e7a049782..a0d0dee02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -273,7 +273,7 @@ endif() if (FIREBASE_INCLUDE_ANALYTICS) add_subdirectory(analytics) list(APPEND TARGET_LINK_LIB_NAMES "firebase_analytics" "firebase_analytics_swig") - list(APPEND DOCUMENTATION_ONLY_LIB_NAMES "firebase_analytics_swig") + list(APPEND DOCUMENTATION_ONLY_LIB_NAMES "firebase_analytics_swig" FIREBASE_UNITY_ANALYTICS_GENERATED_FILES) list(APPEND PROJECT_LIST_HEADER " X(Analytics)") endif() if (FIREBASE_INCLUDE_APP_CHECK) diff --git a/analytics/CMakeLists.txt b/analytics/CMakeLists.txt index 99c10f239..46affb27d 100644 --- a/analytics/CMakeLists.txt +++ b/analytics/CMakeLists.txt @@ -21,8 +21,54 @@ set(firebase_analytics_swig src/swig/analytics.i ) +# Generate CSharp files for the various Analytics constants +set(analytics_cpp_generated_headers_dir + "${CMAKE_BINARY_DIR}/generated/analytics/src/include/firebase/analytics") +set(analytics_csharp_generated_dir + "${CMAKE_BINARY_DIR}/analytics/generated") +file(MAKE_DIRECTORY ${analytics_csharp_generated_dir}) + +# Generate the header file by invoking the generate_constants python script. +function(generate_analytics_unity_file CPP_FILE CSHARP_FILE) + add_custom_command( + OUTPUT ${CSHARP_FILE} + COMMAND ${FIREBASE_PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/generate_constants.py" + "--cpp_header=${CPP_FILE}" + "--csharp_file=${CSHARP_FILE}" + DEPENDS FIREBASE_ANALYTICS_GENERATED_HEADERS + ${CPP_FILE} + COMMENT "Generating ${CSHARP_FILE}" + ) +endfunction() + +# Call the above function for all of the files to generate. +generate_analytics_unity_file( + "${analytics_cpp_generated_headers_dir}/event_names.h" + "${analytics_csharp_generated_dir}/EventNames.cs" +) +generate_analytics_unity_file( + "${analytics_cpp_generated_headers_dir}/parameter_names.h" + "${analytics_csharp_generated_dir}/ParameterNames.cs" +) +generate_analytics_unity_file( + "${analytics_cpp_generated_headers_dir}/user_property_names.h" + "${analytics_csharp_generated_dir}/UserPropertyNames.cs" +) +add_custom_target(FIREBASE_UNITY_ANALYTICS_GENERATED_FILES + DEPENDS + ${analytics_csharp_generated_dir}/EventNames.cs + ${analytics_csharp_generated_dir}/ParameterNames.cs + ${analytics_csharp_generated_dir}/UserPropertyNames.cs +) + # Firebase Analytics CSharp files set(firebase_analytics_src + src/Consent.cs + src/FirebaseAnalytics.cs + src/Parameter.cs + ${analytics_csharp_generated_dir}/EventNames.cs + ${analytics_csharp_generated_dir}/ParameterNames.cs + ${analytics_csharp_generated_dir}/UserPropertyNames.cs ) firebase_swig_add_library(firebase_analytics_swig @@ -59,6 +105,7 @@ mono_add_library(firebase_analytics_cs ${FIREBASE_PLATFORM_REF} DEPENDS firebase_analytics_swig + FIREBASE_UNITY_ANALYTICS_GENERATED_FILES ) if(FIREBASE_IOS_BUILD) diff --git a/analytics/generate_constants.py b/analytics/generate_constants.py new file mode 100644 index 000000000..5c561f7a6 --- /dev/null +++ b/analytics/generate_constants.py @@ -0,0 +1,83 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Convert C++ headers of Analytics constants to C# files.""" + +import datetime +import os +import re +import subprocess + +from absl import app +from absl import flags + +FLAGS = flags.FLAGS + +# Required args +flags.DEFINE_string('cpp_header', '', 'C++ header file containing a ' + 'set of constants to convert to C#.') +flags.register_validator( + 'cpp_header', + lambda x: x and os.path.exists(x), + message=('Must reference an existing C++ header file')) +flags.DEFINE_string('csharp_file', '', 'Full path of the C# file to write ' + 'out.') +flags.register_validator( + 'csharp_file', lambda x: x, message='Output C# file must be specified') + +CPP_NAMESPACE = 'namespace analytics' + +DOC_REPLACEMENTS = [ + ('static const char\*const k', 'public static string ') +] + + +def main(unused_argv): + """Convert the C++ file into C#, going line-by-line to edit it.""" + with open(FLAGS.cpp_header) as input_file: + with open(FLAGS.csharp_file, 'w') as output_file: + # Write the initial lines at the top + output_file.write('// Copyright %s Google LLC\n\n' % + str(datetime.date.today().year)) + output_file.write('namespace Firebase.Analytics {\n\n') + output_file.write('public static partial class FirebaseAnalytics {\n\n') + + found_namespace = False + for line in input_file: + line = line.rstrip() + + # Ignore everything in the C++ file until inside the namespaces + if not found_namespace: + if re.search(CPP_NAMESPACE, line): + found_namespace = True + continue + # Stop copying when finding the next namespace (we assume it is closing) + if re.search(CPP_NAMESPACE, line): + break + + for replace_from, replace_to in DOC_REPLACEMENTS: + if (re.search(replace_from, line)): + line = re.sub(replace_from, replace_to, line) + output_file.write(line + '\n') + + # Write the lines at the end + # Close the class + output_file.write('}\n\n') + # close the namespace + output_file.write('}\n') + + return 0 + +if __name__ == '__main__': + app.run(main) diff --git a/analytics/src/Consent.cs b/analytics/src/Consent.cs new file mode 100644 index 000000000..966f95008 --- /dev/null +++ b/analytics/src/Consent.cs @@ -0,0 +1,38 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Firebase.Analytics { + +/// @brief The type of consent to set. +/// +/// Supported consent types are mapped to corresponding constants in the Android +/// and iOS SDKs. Omitting a type retains its previous status. +public enum ConsentType { + AdStorage = 0, + AnalyticsStorage, + AdUserData, + AdPersonalization +} + +/// @brief The status value of the consent type. +/// +/// Supported statuses are ConsentStatus.Granted and ConsentStatus.Denied. +public enum ConsentStatus { + Granted = 0, + Denied +} + +} diff --git a/analytics/src/FirebaseAnalytics.cs b/analytics/src/FirebaseAnalytics.cs new file mode 100644 index 000000000..d3c600db9 --- /dev/null +++ b/analytics/src/FirebaseAnalytics.cs @@ -0,0 +1,301 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Threading.Tasks; + +namespace Firebase.Analytics { + +public static partial class FirebaseAnalytics { + + /// Get the instance ID from the analytics service. + /// + /// @returns A Task with the Analytics instance ID. + public static System.Threading.Tasks.Task GetAnalyticsInstanceIdAsync() { + return FirebaseAnalyticsInternal.GetAnalyticsInstanceIdAsync(); + } + + /// Asynchronously retrieves the identifier of the current app + /// session. + /// + /// The session ID retrieval could fail due to Analytics collection + /// disabled, or if the app session was expired. + /// + /// @returns A Task with the identifier of the current app session. + public static System.Threading.Tasks.Task GetSessionIdAsync() { + return FirebaseAnalyticsInternal.GetSessionIdAsync(); + } + + /// Initiates on-device conversion measurement given a user email address on iOS + /// and tvOS (no-op on Android). On iOS and tvOS, this method requires the + /// dependency GoogleAppMeasurementOnDeviceConversion to be linked in, + /// otherwise the invocation results in a no-op. + /// + /// @param emailAddress User email address. Include a domain name for all + /// email addresses (e.g. gmail.com or hotmail.co.jp). + public static void InitiateOnDeviceConversionMeasurementWithEmailAddress(string emailAddress) { + FirebaseAnalyticsInternal.InitiateOnDeviceConversionMeasurementWithEmailAddress(emailAddress); + } + + /// Initiates on-device conversion measurement given a sha256-hashed user email address. + /// Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is + /// a no-op. + /// + /// @param hashedEmailAddress User email address as a UTF8-encoded string normalized and + /// hashed according to the instructions at + /// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3. + public static void InitiateOnDeviceConversionMeasurementWithHashedEmailAddress(byte[] hashedEmailAddress) { + FirebaseAnalyticsInternal.InitiateOnDeviceConversionMeasurementWithHashedEmailAddress(new CharVector(hashedEmailAddress)); + } + + /// Initiates on-device conversion measurement given a sha256-hashed phone number in E.164 + /// format. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, + /// otherwise it is a no-op. + /// + /// @param hashedPhoneNumber UTF8-encoded user phone number in E.164 format and then hashed + /// according to the instructions at + /// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3. + public static void InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber(byte[] hashedPhoneNumber) { + FirebaseAnalyticsInternal.InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber(new CharVector(hashedPhoneNumber)); + } + + /// Initiates on-device conversion measurement given a phone number in E.164 + /// format on iOS (no-op on Android). On iOS, requires dependency + /// GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is a + /// no-op. + /// + /// @param phoneNumber User phone number. Must be in E.164 format, which means + /// it must be + /// limited to a maximum of 15 digits and must include a plus sign (+) prefix + /// and country code with no dashes, parentheses, or spaces. + public static void InitiateOnDeviceConversionMeasurementWithPhoneNumber(string phoneNumber) { + FirebaseAnalyticsInternal.InitiateOnDeviceConversionMeasurementWithPhoneNumber(phoneNumber); + } + + /// @brief Log an event with one string parameter. + /// + /// @param[in] name Name of the event to log. Should contain 1 to 40 + /// alphanumeric characters or underscores. The name must start with an + /// alphabetic character. Some event names are reserved. + /// See the FirebaseAnalytics.Event properties for the list of reserved event + /// names. + /// The "firebase_" prefix is reserved and should not be used. Note that event + /// names are case-sensitive and that logging two events whose names differ + /// only in case will result in two distinct events. + /// + /// @param[in] parameterName Name of the parameter to log. + /// For more information, see @ref Parameter. + /// + /// @param[in] parameterValue Value of the parameter to log. + /// + /// @see LogEvent(string, Parameter[]) + public static void LogEvent(string name, string parameterName, string parameterValue) { + FirebaseAnalyticsInternal.LogEvent(name, parameterName, parameterValue); + } + + /// @brief Log an event with one float parameter. + /// + /// @param[in] name Name of the event to log. Should contain 1 to 40 + /// alphanumeric characters or underscores. The name must start with an + /// alphabetic character. Some event names are reserved. + /// See the FirebaseAnalytics.Event properties for the list of reserved event + /// names. + /// The "firebase_" prefix is reserved and should not be used. Note that event + /// names are case-sensitive and that logging two events whose names differ + /// only in case will result in two distinct events. + /// + /// @param[in] parameterName Name of the parameter to log. + /// For more information, see @ref Parameter. + /// + /// @param[in] parameterValue Value of the parameter to log. + /// + /// @see LogEvent(string, Parameter[]) + public static void LogEvent(string name, string parameterName, double parameterValue) { + FirebaseAnalyticsInternal.LogEvent(name, parameterName, parameterValue); + } + + /// @brief Log an event with one 64-bit integer parameter. + /// + /// @param[in] name Name of the event to log. Should contain 1 to 40 + /// alphanumeric characters or underscores. The name must start with an + /// alphabetic character. Some event names are reserved. + /// See the FirebaseAnalytics.Event properties for the list of reserved event + /// names. + /// The "firebase_" prefix is reserved and should not be used. Note that event + /// names are case-sensitive and that logging two events whose names differ + /// only in case will result in two distinct events. + /// + /// @param[in] parameterName Name of the parameter to log. + /// For more information, see @ref Parameter. + /// + /// @param[in] parameterValue Value of the parameter to log. + /// + /// @see LogEvent(string, Parameter[]) + public static void LogEvent(string name, string parameterName, long parameterValue) { + FirebaseAnalyticsInternal.LogEvent(name, parameterName, parameterValue); + } + + /// @brief Log an event with one integer parameter + /// (stored as a 64-bit integer). + /// + /// @param[in] name Name of the event to log. Should contain 1 to 40 + /// alphanumeric characters or underscores. The name must start with an + /// alphabetic character. Some event names are reserved. + /// See the FirebaseAnalytics.Event properties for the list of reserved event + /// names. + /// The "firebase_" prefix is reserved and should not be used. Note that event + /// names are case-sensitive and that logging two events whose names differ + /// only in case will result in two distinct events. + /// + /// @param[in] parameterName Name of the parameter to log. + /// For more information, see @ref Parameter. + /// + /// @param[in] parameterValue Value of the parameter to log. + /// + /// @see LogEvent(string, Parameter[]) + public static void LogEvent(string name, string parameterName, int parameterValue) { + FirebaseAnalyticsInternal.LogEvent(name, parameterName, parameterValue); + } + + /// @brief Log an event with no parameters. + /// + /// @param[in] name Name of the event to log. Should contain 1 to 40 + /// alphanumeric characters or underscores. The name must start with an + /// alphabetic character. Some event names are reserved. + /// See the FirebaseAnalytics.Event properties for the list of reserved event + /// names. + /// The "firebase_" prefix is reserved and should not be used. Note that event + /// names are case-sensitive and that logging two events whose names differ + /// only in case will result in two distinct events. + /// + /// @see LogEvent(string, Parameter[]) + public static void LogEvent(string name) { + FirebaseAnalyticsInternal.LogEvent(name); + } + + /// @brief Log an event with associated parameters. + /// + /// An Event is an important occurrence in your app that you want to measure. + /// You can report up to 500 different types of events per app and you can + /// associate up to 25 unique parameters with each Event type. + /// + /// Some common events are in the reference guide via the + /// FirebaseAnalytics.Event* constants, but you may also choose to specify + /// custom event types that are associated with your specific app. + /// + /// @param[in] name Name of the event to log. Should contain 1 to 40 + /// alphanumeric characters or underscores. The name must start with an + /// alphabetic character. Some event names are reserved. + /// See the FirebaseAnalytics.Event properties for the list of reserved event + /// names. + /// The "firebase_" prefix is reserved and should not be used. Note that event + /// names are case-sensitive and that logging two events whose names differ + /// only in case will result in two distinct events. + /// + /// @param[in] parameters A parameter array of `Parameter` instances. + public static void LogEvent(string name, params Parameter[] parameters) { + // Convert the Parameter array into a StringList and VariantList to pass to C++ + StringList parameterNames = new StringList(); + VariantList parameterValues = new VariantList(); + + foreach (Parameter p in parameters) { + parameterNames.Add(p.Name); + parameterValues.Add(Firebase.Variant.FromObject(p.Value)); + } + + FirebaseAnalyticsInternal.LogEvent(name, parameterNames, parameterValues); + } + + /// Clears all analytics data for this app from the device and resets the app + /// instance id. + public static void ResetAnalyticsData() { + FirebaseAnalyticsInternal.ResetAnalyticsData(); + } + + /// @brief Sets whether analytics collection is enabled for this app on this + /// device. + /// + /// This setting is persisted across app sessions. By default it is enabled. + /// + /// @param[in] enabled true to enable analytics collection, false to disable. + public static void SetAnalyticsCollectionEnabled(bool enabled) { + FirebaseAnalyticsInternal.SetAnalyticsCollectionEnabled(enabled); + } + + /// @brief Sets the applicable end user consent state (e.g., for device + /// identifiers) for this app on this device. + /// + /// Use the consent map to specify individual consent type values. Settings are + /// persisted across app sessions. By default consent types are set to + /// "granted". + public static void SetConsent(System.Collections.Generic.IDictionary< ConsentType, ConsentStatus > consentSettings) { + IntIntMap consentSettingsMap = new IntIntMap(); + foreach (var kv in consentSettings) { + consentSettingsMap[(int)kv.Key] = (int)kv.Value; + } + FirebaseAnalyticsInternal.SetConsentWithInts(consentSettingsMap); + } + + /// @brief Sets the duration of inactivity that terminates the current session. + /// + /// @note The default value is 30 minutes. + /// + /// @param timeSpan The duration of inactivity that terminates the current + /// session. + public static void SetSessionTimeoutDuration(System.TimeSpan timeSpan) { + FirebaseAnalyticsInternal.SetSessionTimeoutDuration((long)timeSpan.TotalMilliseconds); + } + + /// @brief Sets the user ID property. + /// + /// This feature must be used in accordance with + /// Google's Privacy + /// Policy + /// + /// @param[in] userId The user ID associated with the user of this app on this + /// device. The user ID must be non-empty and no more than 256 characters long. + /// Setting userId to null removes the user ID. + public static void SetUserId(string userId) { + FirebaseAnalyticsInternal.SetUserId(userId); + } + + /// @brief Set a user property to the given value. + /// + /// Properties associated with a user allow a developer to segment users + /// into groups that are useful to their application. Up to 25 properties + /// can be associated with a user. + /// + /// Suggested property names are listed @ref user_property_names + /// (%user_property_names.h) but you're not limited to this set. For example, + /// the "gamertype" property could be used to store the type of player where + /// a range of values could be "casual", "mid_core", or "core". + /// + /// @param[in] name Name of the user property to set. This must be a + /// combination of letters and digits (matching the regular expression + /// [a-zA-Z0-9] between 1 and 40 characters long starting with a letter + /// [a-zA-Z] character. + /// @param[in] property Value to set the user property to. Set this + /// argument to NULL or nullptr to remove the user property. The value can be + /// between 1 to 100 characters long. + public static void SetUserProperty(string name, string property) { + FirebaseAnalyticsInternal.SetUserProperty(name, property); + } + + /// @deprecated Use ParameterGroupID instead + [System.Obsolete("Use ParameterGroupID instead.")] + public static string ParameterGroupId { get { return ParameterGroupID; } } +} + +} diff --git a/analytics/src/Parameter.cs b/analytics/src/Parameter.cs new file mode 100644 index 000000000..5b14f008f --- /dev/null +++ b/analytics/src/Parameter.cs @@ -0,0 +1,108 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Firebase.Analytics { + +/// @brief Event parameter. +/// +/// Parameters supply information that contextualize events (see @ref LogEvent). +/// You can associate up to 25 unique Parameters with each event type (name). +/// +/// Common event types are provided as static properties of the +/// FirebaseAnalytics class (e.g FirebaseAnalytics.EventPostScore) where +/// parameters of these events are also provided in this FirebaseAnalytics +/// class (e.g FirebaseAnalytics.ParameterScore). +/// +/// You are not limited to the set of event types and parameter names +/// suggested in FirebaseAnalytics class properties. Additional Parameters can +/// be supplied for suggested event types or custom Parameters for custom event +/// types. +/// +/// Parameter names must be a combination of letters and digits +/// (matching the regular expression [a-zA-Z0-9]) between 1 and 40 characters +/// long starting with a letter [a-zA-Z] character. The "firebase_", +/// "google_" and "ga_" prefixes are reserved and should not be used. +/// +/// Parameter string values can be up to 100 characters long. +/// +/// An array of Parameter class instances can be passed to LogEvent in order +/// to associate parameters's of an event with values where each value can be +/// a double, 64-bit integer or string. +/// +/// For example, a game may log an achievement event along with the +/// character the player is using and the level they're currently on: +/// +/// @code{.cs} +/// using Firebase.Analytics; +/// +/// int currentLevel = GetCurrentLevel(); +/// Parameter[] AchievementParameters = { +/// new Parameter(FirebaseAnalytics.ParameterAchievementID, +/// "ultimate_wizard"), +/// new Parameter(FirebaseAnalytics.ParameterCharacter, "mysterion"), +/// new Parameter(FirebaseAnalytics.ParameterLevel, currentLevel), +/// }; +/// FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLevelUp, +/// AchievementParameters); +/// @endcode +/// +public class Parameter : System.IDisposable { + + internal string Name { get; set; } + + internal object Value { get; set; } + + public Parameter(string parameterName, string parameterValue) { + Name = parameterName; + Value = parameterValue; + } + + public Parameter(string parameterName, long parameterValue) { + Name = parameterName; + Value = parameterValue; + } + + public Parameter(string parameterName, double parameterValue) { + Name = parameterName; + Value = parameterValue; + } + + // TODO: Implement accepting maps and vectors in C++ Analytics before enabling these. + /* + public Parameter(string parameterName, IDictionary parameterValue) { + Name = parameterName; + Value = parameterValue; + } + + public Parameter(string parameterName, IEnumerable> parameterValue) { + Name = parameterName; + Value = parameterValue; + } + */ + + /// @deprecated No longer needed, will be removed in the future. + [System.Obsolete("No longer needed, will be removed in the future.")] + public void Dispose() {} + + /// @deprecated No longer needed, will be removed in the future. + [System.Obsolete("No longer needed, will be removed in the future.")] + public void Dispose(bool disposing) {} + +} + +} diff --git a/analytics/src/swig/analytics.i b/analytics/src/swig/analytics.i index 4329fa03b..866f6d4fb 100644 --- a/analytics/src/swig/analytics.i +++ b/analytics/src/swig/analytics.i @@ -8,10 +8,9 @@ // interface stores references, and the C# strings are marshalled as temporary // since they have to be converted from unicode strings anyway. // -// TODO(butterfield): Replace with %ignoreall/%unignoreall //swiglint: disable include-h-allglobals -%module FirebaseAnalytics +%module FirebaseAnalyticsInternal #ifdef USE_EXPORT_FIX // Generate a function that we can reference to force linker @@ -23,48 +22,24 @@ %include "std_map.i" -%pragma(csharp) moduleclassmodifiers="public sealed class" +%pragma(csharp) moduleclassmodifiers="internal static class" %pragma(csharp) modulecode=%{ // Hold a reference to the default app when methods from this module are // referenced. static Firebase.FirebaseApp app; - static FirebaseAnalytics() { app = Firebase.FirebaseApp.DefaultInstance; } + static FirebaseAnalyticsInternal() { app = Firebase.FirebaseApp.DefaultInstance; } /// Get the app used by this module. /// @return FirebaseApp instance referenced by this module. static Firebase.FirebaseApp App { get { return app; } } - - private FirebaseAnalytics() {} %} %feature("flatnested"); -// These are directly included in the generated code -// it's necessary to put them here so that the generated code knows what we're -// dealing with. -%{ -#include "analytics/src/include/firebase/analytics.h" -#include "analytics/src/include/firebase/analytics/event_names.h" -#include "analytics/src/include/firebase/analytics/parameter_names.h" -#include "analytics/src/include/firebase/analytics/user_property_names.h" -%} - -%rename(kConsentTypeAdStorage) firebase::analytics::kConsentTypeAdStorage; -%rename(kConsentTypeAnalyticsStorage) firebase::analytics::kConsentTypeAnalyticsStorage; -%rename(kConsentStatusGranted) firebase::analytics::kConsentStatusGranted; -%rename(kConsentStatusDenied) firebase::analytics::kConsentStatusDenied; - -// Constant renaming must happen before SWIG_CONSTANT_HEADERS is included. -%rename(kParameterAchievementId) firebase::analytics::kParameterAchievementID; -%rename(kParameterGroupId) firebase::analytics::kParameterGroupID; -%rename(kParameterItemId) firebase::analytics::kParameterItemID; -%rename(kParameterItemLocationId) firebase::analytics::kParameterItemLocationID; -%rename(kParameterTransactionId) firebase::analytics::kParameterTransactionID; +// Change the default class modifier to internal, so that new classes are not accidentally exposed +%typemap(csclassmodifiers) SWIGTYPE "internal class" %import "app/src/swig/app.i" %include "app/src/swig/null_check_this.i" %include "app/src/swig/serial_dispose.i" -%include "firebase/analytics/event_names.h" -%include "firebase/analytics/parameter_names.h" -%include "firebase/analytics/user_property_names.h" // Including cstdint before stdint.i ensures the int64_t typedef is correct, // otherwise on some platforms it is defined as "long long int" instead of @@ -72,296 +47,79 @@ #include %include "stdint.i" -namespace firebase { -namespace analytics { - -// ctype is equivalent to java's "jni" -// This is specific to C# - -// This is kind of hacky, but we can sneak in an extra argument while -// we're still on the C++ side -// The sneaky input is named with the $1 to allow this hack to hopefully work -// with multiple array inputs pairs if ever it were needed -%typemap(ctype) (const Parameter* parameters, size_t number_of_parameters) - "firebase::analytics::Parameter** $1_ptr_array, size_t" - -// to match the function prototype, we need to do the hack in the -// intermediary code as well. -%typemap(imtype) (const Parameter* parameters, size_t number_of_parameters) - "System.IntPtr arg, int" - -// In C# though, we're just Parameter[], as C# arrays have known .Length -%typemap(cstype) (const Parameter* parameters, size_t number_of_parameters) - "params Parameter[]" - -// We need to add code in C# to modify the Proxy array into an array of C ptrs -// before we pass it in. We can do that with the csin, pre attribute. -%typemap(csin, pre= -" // First copy the array of proxy classes containing C pointers - // to an array of c pointers - System.IntPtr[] swig_unwrap_$csinput = new System.IntPtr[$csinput.Length]; - for (int i = 0; i < $csinput.Length; ++i) { - swig_unwrap_$csinput[i] = (System.IntPtr)Parameter.getCPtr($csinput[i]); - } - fixed ( System.IntPtr* swig_ptrTo_$csinput = swig_unwrap_$csinput ) -") (const Parameter* parameters, size_t number_of_parameters) - "(System.IntPtr)swig_ptrTo_$csinput, $csinput.Length" - -%typemap(in) (const Parameter* parameters, size_t number_of_parameters) %{ - // The csin typemap above extracted the pointers to the C++ classes from the - // C# Parameter proxy classes. The array of pointers is provided here via: - // $1_ptr_array: Array of pointers to the C class - // $input: re-assigned to the size of the array of pointers - - // Copy into an array of Parameter structs prior to calling LogEvent. - // This array is deleted using the - // %typemap(freearg)(parameter, number_of_paramters) typemap below. - firebase::analytics::Parameter* $1_array = - new firebase::analytics::Parameter[$input]; - for (size_t i = 0; i < $input; ++i) { - ParameterCopy::AsParameterCopy($1_ptr_array[i])->CopyToParameter( - &$1_array[i]); - } - - $1 = $1_array; - $2 = $input; -%} - -// The 'in' typemap is really just code up to the point when the C++ function is -// invoked, so we actually need this to follow up and free the temporary memory. -// The short-lived nature of this is ok, because we know java's jni copies it by -// the time we get back from the C invocation -%typemap(freearg) (const Parameter* parameters, size_t number_of_parameters) %{ - if ($1_array) delete [] $1_array; -%} - +// Start of the code added to the C++ module file %{ -// Parameter which maintains a copy of strings provided on construction. -// This requires a copy of any strings construction as strings passed to the -// constructor are temporarily allocated by the SWIG binding code and -// deallocated after construction. -class ParameterCopy : private firebase::analytics::Parameter { - public: - ParameterCopy(const char *parameter_name, const char *parameter_value) : - Parameter(nullptr, 0) { - Initialize(parameter_name, parameter_value); - } - - ParameterCopy(const char *parameter_name, int64_t parameter_value) : - Parameter(nullptr, 0) { - Initialize(parameter_name, parameter_value); - } - - ParameterCopy(const char *parameter_name, double parameter_value) : - Parameter(nullptr, 0) { - Initialize(parameter_name, parameter_value); - } - - ~ParameterCopy() {} - - // Initialize this parameter with a new name and value. - void Initialize(const char *parameter_name, - firebase::Variant parameter_value) { - SetString(parameter_name, &name_copy, &name); - if (parameter_value.is_string()) { - const char* string_value = parameter_value.string_value(); - // Make `value` store its own bytes. - value = firebase::Variant::MutableStringFromStaticString( - string_value ? string_value : ""); - } else { - value = parameter_value; - } - } - - // Copy to a Parameter. - // IMPORTANT: Since the supplied parameter simply references pointers within - // this object, the lifetime of the parameter must exceed this instance. - void CopyToParameter(firebase::analytics::Parameter *parameter) const { - *parameter = *AsParameter(); - } - - // This is only non-const so the Parameter can be cast to ParameterCopy in - // order to delete the object. - // IMPORTANT: Do *not* mutate the returned Parameter use accessors on this - // object instead. - firebase::analytics::Parameter* AsParameter() { return this; } - const firebase::analytics::Parameter* AsParameter() const { return this; } +#include +#include "analytics/src/include/firebase/analytics.h" +#include "app/src/log.h" - // Convert a Parameter* (assuming it was allocated as a copy there is no - // checking here so be careful) to a ParameterCopy pointer. - static ParameterCopy* AsParameterCopy( - firebase::analytics::Parameter* parameter) { - return static_cast(parameter); - } +namespace firebase { +namespace analytics { - private: - // Copy the specified string value into string_storage with the C pointer - // to the string stored in output. - template - static void SetString(const char *value, std::string * const string_storage, - T *output) { - if (value) { - *string_storage = value; - } else { - string_storage->clear(); - } - *output = string_storage->c_str(); +// Internal version of LogEvent that takes in two vectors of known types, +// and converts them into C++ Parameters to pass into the public LogEvent instead. +void LogEvent(const char* name, std::vector parameter_names, + std::vector parameter_values) { + if (parameter_names.size() != parameter_values.size()) { + firebase::LogError("LogEvent for %s given different list sizes (%d, %d)", + name, parameter_names.size(), parameter_values.size()); + return; } - std::string name_copy; -}; -%} + size_t number_of_parameters = parameter_names.size(); + Parameter* parameters = new Parameter[number_of_parameters]; -%extend Parameter { - Parameter(const char *parameter_name, const char *parameter_value) { - return (new ParameterCopy(parameter_name, parameter_value))->AsParameter(); + for (size_t i = 0; i < number_of_parameters; ++i) { + parameters[i] = Parameter(parameter_names[i].c_str(), parameter_values[i]); } - Parameter(const char* parameter_name, int64_t parameter_value) { - return (new ParameterCopy(parameter_name, parameter_value))->AsParameter(); - } + LogEvent(name, parameters, number_of_parameters); - Parameter(const char* parameter_name, double parameter_value) { - return (new ParameterCopy(parameter_name, parameter_value))->AsParameter(); - } + delete[] parameters; +} - ~Parameter() { - delete ParameterCopy::AsParameterCopy($self); +// Converts from a generic int, int map to the C++ Consent enums +void SetConsentWithInts(const std::map& settings) { + std::map converted; + for (const auto& pair : settings) { + converted[static_cast(pair.first)] = static_cast(pair.second); } + SetConsent(converted); } -// Overridden in the class extension methods above. -%ignore Parameter::Parameter(const char* parameter_name, - const char* parameter_value); -%ignore Parameter::Parameter(const char* parameter_name, - int parameter_value); -%ignore Parameter::Parameter(const char* parameter_name, - int64_t parameter_value); -%ignore Parameter::Parameter(const char* parameter_name, - double parameter_value); -// Initialize / Terminate implicitly called when App is created / destroyed. -%ignore Initialize; -%ignore Terminate; -// SetConsent handled via SetConsentInternal below. -%ignore SetConsent; - -} // namespace analytics -} // namespace firebase - -%typemap(csclassmodifiers) firebase::analytics::Parameter "public sealed class"; -// This is a hack that overrides this specific log function, which is currently -// the only `unsafe` function that gets generated. -%csmethodmodifiers - firebase::analytics::LogEvent(const char *name, - const Parameter *parameters, - size_t number_of_parameters) - "/// @brief Log an event with associated parameters. - /// - /// An Event is an important occurrence in your app that you want to measure. - /// You can report up to 500 different types of events per app and you can - /// associate up to 25 unique parameters with each Event type. - /// - /// Some common events are in the reference guide via the - /// FirebaseAnalytics.Event* constants, but you may also choose to specify - /// custom event types that are associated with your specific app. - /// - /// @param[in] name Name of the event to log. Should contain 1 to 32 - /// alphanumeric characters or underscores. The name must start with an - /// alphabetic character. Some event names are reserved. See - /// `Analytics Events` for the list of reserved event - /// names. The \"firebase_\" prefix is reserved and should not be used. - /// Note that event names are case-sensitive and that logging two events - /// whose names differ only in case will result in two distinct events. - /// @param[in] parameters A parameter array of `Parameter` instances. - public unsafe"; +} // namespace analytics +} // namespace firebase -%rename(SetUserId) firebase::analytics::SetUserID; -%rename(SetSessionTimeoutDurationInternal) SetSessionTimeoutDuration; -%csmethodmodifiers firebase::analytics::SetSessionTimeoutDuration(int64_t milliseconds) "internal"; +%} // End of the code added to the C++ module file -%pragma(csharp) modulecode=%{ - /// @brief Sets the duration of inactivity that terminates the current session. - /// - /// @note The default value is 30 minutes. - /// - /// @param timeSpan The duration of inactivity that terminates the current - /// session. - public static void SetSessionTimeoutDuration(System.TimeSpan timeSpan) { - SetSessionTimeoutDurationInternal((long)timeSpan.TotalMilliseconds); - } -%} - -// Mark these as internal, so that we can do the conversion of types manually -%rename(InitiateOnDeviceConversionMeasurementWithHashedEmailAddressInternal) firebase::analytics::InitiateOnDeviceConversionMeasurementWithHashedEmailAddress; -%rename(InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberInternal) firebase::analytics::InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber; +// Initialize / Terminate implicitly called when App is created / destroyed. +%ignore firebase::analytics::Initialize; +%ignore firebase::analytics::Terminate; +// Ignore the SendEvent that takes a Parameter array, as we handle it +// with a custom version instead. +%ignore firebase::analytics::LogEvent(const char*, const Parameter*, size_t); +// Ignore SetConsent, in order to convert the types with our own function. +%ignore firebase::analytics::SetConsent; +// Ignore the Parameter class, as we don't want to expose that to C# at all. +%ignore firebase::analytics::Parameter; // GetSessionId returns Future in SWIG. %include "app/src/swig/future.i" %SWIG_FUTURE(Future_LongLong, long, internal, long long, FirebaseException) -%include "analytics/src/include/firebase/analytics.h" +// Ignore the Consent enums, so we can use commented ones in C# +%ignore firebase::analytics::ConsentType; +%ignore firebase::analytics::ConsentStatus; +%template(IntIntMap) std::map; -%rename(ConsentType) firebase::analytics::ConsentType; -%rename(ConsentStatus) firebase::analytics::ConsentStatus; -// Add a swig C++ function to call into the Analytics C++ implementation. -%{ -namespace firebase { -namespace analytics { - - void SetConsentInternal(std::map *ptr) { - firebase::analytics::SetConsent(*ptr); - } - -} // namespace analytics -} // namespace firebase -%} -// The definition on the C++ side, so that swig is aware of the function's existence. -void SetConsentInternal(std::map *ptr); - -%typemap(csclassmodifiers) firebase::analytics::ConsentType "enum"; -%typemap(csclassmodifiers) firebase::analytics::ConsentStatus "enum"; - -%typemap(csclassmodifiers) std::map "internal class" -%template(ConsentMap) std::map; +%include "analytics/src/include/firebase/analytics.h" +// Declare the new C++ functions we added in this file that we want +// to expose to C#. namespace firebase { namespace analytics { - -%pragma(csharp) modulecode=%{ - /// @brief Sets the applicable end user consent state (e.g., for device - /// identifiers) for this app on this device. - /// - /// Use the consent map to specify individual consent type values. Settings are - /// persisted across app sessions. By default consent types are set to - /// "granted". - public static void SetConsent(System.Collections.Generic.IDictionary consentSettings) { - ConsentMap consentSettingsMap = new ConsentMap(); - foreach(var kv in consentSettings) { - consentSettingsMap[kv.Key] = kv.Value; - } - SetConsentInternal(consentSettingsMap); - } - - /// Initiates on-device conversion measurement given a sha256-hashed user email address. - /// Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is - /// a no-op. - /// @param hashedEmailAddress User email address as a UTF8-encoded string normalized and - /// hashed according to the instructions at - /// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3. - public static void InitiateOnDeviceConversionMeasurementWithHashedEmailAddress(byte[] hashedEmailAddress) { - InitiateOnDeviceConversionMeasurementWithHashedEmailAddressInternal(new CharVector(hashedEmailAddress)); - } - - /// Initiates on-device conversion measurement given a sha256-hashed phone number in E.164 - /// format. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, - /// otherwise it is a no-op. - /// @param hashedPhoneNumber UTF8-encoded user phone number in E.164 format and then hashed - /// according to the instructions at - /// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3. - public static void InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber(byte[] hashedPhoneNumber) { - InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberInternal(new CharVector(hashedPhoneNumber)); - } -%} - +void LogEvent(const char* name, std::vector parameter_names, + std::vector parameter_values); +void SetConsentWithInts(const std::map& settings); } // namespace analytics } // namespace firebase diff --git a/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs b/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs index c598806f0..25cb7dfd1 100644 --- a/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs +++ b/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs @@ -104,7 +104,7 @@ public void AnalyticsScore() { public void AnalyticsGroupJoin() { // Log an event with a string parameter. DebugLog("Logging a group join event."); - FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventJoinGroup, FirebaseAnalytics.ParameterGroupId, + FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventJoinGroup, FirebaseAnalytics.ParameterGroupID, "spoon_welders"); } diff --git a/docs/readme.md b/docs/readme.md index 6ff0ab0d5..f2d2c8d31 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -71,6 +71,14 @@ Support Release Notes ------------- +### Upcoming +- Changes + - Analytics: Renamed ParameterGroupId to ParameterGroupID, to be + consistent with other similarly named variables. ParameterGroupId + is considered deprecated, and will be removed in the future. + - Analytics: Deprecated the Dispose functions, as they are no longer + necessary for cleaning up memory. + ### 12.3.0 - Changes - General: Update to Firebase C++ SDK version 12.3.0. From c8fde34333a73aab1f83df6f9b3244ed8e99ec07 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Mon, 21 Oct 2024 14:35:12 -0700 Subject: [PATCH 2/9] Add support for Analytics Parameters of Lists (#1126) --- analytics/src/Parameter.cs | 3 --- .../Firebase/Sample/Analytics/UIHandler.cs | 23 +++++++++++++++++++ .../Sample/Analytics/UIHandlerAutomated.cs | 8 +++++++ docs/readme.md | 3 +++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/analytics/src/Parameter.cs b/analytics/src/Parameter.cs index 5b14f008f..ce8096449 100644 --- a/analytics/src/Parameter.cs +++ b/analytics/src/Parameter.cs @@ -82,8 +82,6 @@ public Parameter(string parameterName, double parameterValue) { Value = parameterValue; } - // TODO: Implement accepting maps and vectors in C++ Analytics before enabling these. - /* public Parameter(string parameterName, IDictionary parameterValue) { Name = parameterName; Value = parameterValue; @@ -93,7 +91,6 @@ public Parameter(string parameterName, IEnumerable> Name = parameterName; Value = parameterValue; } - */ /// @deprecated No longer needed, will be removed in the future. [System.Obsolete("No longer needed, will be removed in the future.")] diff --git a/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs b/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs index 25cb7dfd1..08564b79d 100644 --- a/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs +++ b/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandler.cs @@ -118,6 +118,26 @@ public void AnalyticsLevelUp() { new Parameter("hit_accuracy", 3.14f)); } + public void AnalyticsViewCart() { + // Log an event that includes a parameter with a list + DebugLog("Logging a view cart event."); + FirebaseAnalytics.LogEvent( + FirebaseAnalytics.EventViewCart, + new Parameter(FirebaseAnalytics.ParameterCurrency, "USD"), + new Parameter(FirebaseAnalytics.ParameterValue, 30.03), + new Parameter(FirebaseAnalytics.ParameterItems, new [] { + new Dictionary { + { FirebaseAnalytics.ParameterItemID, "SKU_12345" }, + { FirebaseAnalytics.ParameterItemName, "Horse Armor DLC" }, + }, + new Dictionary { + { FirebaseAnalytics.ParameterItemID, "SKU_67890" }, + { FirebaseAnalytics.ParameterItemName, "Gold Horse Armor DLC" }, + } + }) + ); + } + // Reset analytics data for this app instance. public void ResetAnalyticsData() { DebugLog("Reset analytics data."); @@ -222,6 +242,9 @@ void GUIDisplayControls() { if (GUILayout.Button("Log Level Up")) { AnalyticsLevelUp(); } + if (GUILayout.Button("Log View Cart")) { + AnalyticsViewCart(); + } if (GUILayout.Button("Reset Analytics Data")) { ResetAnalyticsData(); } diff --git a/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandlerAutomated.cs b/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandlerAutomated.cs index b4356bcea..e101771ab 100644 --- a/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandlerAutomated.cs +++ b/analytics/testapp/Assets/Firebase/Sample/Analytics/UIHandlerAutomated.cs @@ -30,6 +30,7 @@ public override void Start() { TestAnalyticsScoreDoesNotThrow, TestAnalyticsGroupJoinDoesNotThrow, TestAnalyticsLevelUpDoesNotThrow, + TestAnalyticsViewCartDoesNotThrow, // This test regularly fails on iOS simulator, and there isn't a great way // to determine if this is on a device or simulator, so just disable on // GHA iOS and tvOS for now. @@ -94,6 +95,13 @@ Task TestAnalyticsLevelUpDoesNotThrow() { }); } + Task TestAnalyticsViewCartDoesNotThrow() { + return WrapWithTask(() => { + base.AnalyticsViewCart(); + return true; + }); + } + Task TestAnalyticsSetConsentDoesNotThrow() { return WrapWithTask(() => { base.AnalyticsSetConsent(); diff --git a/docs/readme.md b/docs/readme.md index f2d2c8d31..7758ea146 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -73,6 +73,9 @@ Release Notes ------------- ### Upcoming - Changes + - Analytics: Add support for Parameters of Lists of Dictionaries, needed + by some events such as ViewCart. + ([#1056](https://github.com/firebase/firebase-unity-sdk/issues/1056)). - Analytics: Renamed ParameterGroupId to ParameterGroupID, to be consistent with other similarly named variables. ParameterGroupId is considered deprecated, and will be removed in the future. From 39f450271db9776dd02d0afcea3c9eb4eb6e1e01 Mon Sep 17 00:00:00 2001 From: "firebase-workflow-trigger[bot]" <80733318+firebase-workflow-trigger[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:00:36 -0700 Subject: [PATCH 3/9] Update Unity SDK dependencies - Tue Oct 29 2024 (#1134) * Update Unity SDK dependencies - Tue Oct 29 2024 > Created by [Firebase Unity SDK build workflow](https://github.com/firebase/firebase-unity-sdk/actions/runs/11581853354). * Update Guids ID * Update readme.md --------- Co-authored-by: firebase-workflow-trigger-bot Co-authored-by: a-maurice --- cmake/android_dependencies.cmake | 38 +++++++++++++------------- cmake/firebase_unity_version.cmake | 6 ++--- docs/readme.md | 8 ++++++ unity_packer/guids.json | 43 ++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 22 deletions(-) diff --git a/cmake/android_dependencies.cmake b/cmake/android_dependencies.cmake index d40e04610..07c6b9a91 100644 --- a/cmake/android_dependencies.cmake +++ b/cmake/android_dependencies.cmake @@ -16,71 +16,71 @@ set(FIREBASE_APP_ANDROID_DEPS "com.google.firebase:firebase-common:21.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-analytics:22.1.2" "com.google.android.gms:play-services-base:18.5.0" ) set(FIREBASE_ANALYTICS_ANDROID_DEPS - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_APP_CHECK_ANDROID_DEPS "com.google.firebase:firebase-appcheck:18.0.0" "com.google.firebase:firebase-appcheck-debug:18.0.0" "com.google.firebase:firebase-appcheck-playintegrity:18.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_AUTH_ANDROID_DEPS - "com.google.firebase:firebase-auth:23.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-auth:23.1.0" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_CRASHLYTICS_ANDROID_DEPS - "com.google.firebase:firebase-crashlytics-ndk:19.1.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-crashlytics-ndk:19.2.1" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_DATABASE_ANDROID_DEPS "com.google.firebase:firebase-database:21.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-analytics:22.1.2" "com.google.android.gms:play-services-base:18.5.0" ) set(FIREBASE_DYNAMIC_LINKS_ANDROID_DEPS "com.google.firebase:firebase-dynamic-links:22.1.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_FIRESTORE_ANDROID_DEPS - "com.google.firebase:firebase-firestore:25.1.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-firestore:25.1.1" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_FUNCTIONS_ANDROID_DEPS "com.google.firebase:firebase-functions:21.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_INSTALLATIONS_ANDROID_DEPS "com.google.firebase:firebase-installations:18.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-analytics:22.1.2" ) # iid is needed by messaging to avoid a conflict with functions set(FIREBASE_MESSAGING_ANDROID_DEPS - "com.google.firebase:firebase-messaging:24.0.1" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-messaging:24.0.3" + "com.google.firebase:firebase-analytics:22.1.2" "com.google.firebase:firebase-iid:21.1.0" "com.google.flatbuffers:flatbuffers-java:1.12.0" ) set(FIREBASE_REMOTE_CONFIG_ANDROID_DEPS - "com.google.firebase:firebase-config:22.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-config:22.0.1" + "com.google.firebase:firebase-analytics:22.1.2" ) set(FIREBASE_STORAGE_ANDROID_DEPS - "com.google.firebase:firebase-storage:21.0.0" - "com.google.firebase:firebase-analytics:22.1.0" + "com.google.firebase:firebase-storage:21.0.1" + "com.google.firebase:firebase-analytics:22.1.2" ) diff --git a/cmake/firebase_unity_version.cmake b/cmake/firebase_unity_version.cmake index 33319762e..679ba53ba 100644 --- a/cmake/firebase_unity_version.cmake +++ b/cmake/firebase_unity_version.cmake @@ -14,10 +14,10 @@ # This file defines the version numbers used by the Firebase Unity SDK. -set(FIREBASE_UNITY_SDK_VERSION "12.3.0" +set(FIREBASE_UNITY_SDK_VERSION "12.4.0" CACHE STRING "The version of the Unity SDK, used in the names of files.") -set(FIREBASE_IOS_POD_VERSION "11.2.0" +set(FIREBASE_IOS_POD_VERSION "11.4.2" CACHE STRING "The version of the top-level Firebase Cocoapod to use.") # https://github.com/googlesamples/unity-jar-resolver @@ -27,7 +27,7 @@ set(FIREBASE_UNITY_JAR_RESOLVER_VERSION "1.2.183" ) # https://github.com/firebase/firebase-cpp-sdk -set(FIREBASE_CPP_SDK_PRESET_VERSION "v12.3.0" +set(FIREBASE_CPP_SDK_PRESET_VERSION "v12.4.0" CACHE STRING "Version tag of Firebase CPP SDK to download (if no local or not passed in) and use (no trailing .0)" ) diff --git a/docs/readme.md b/docs/readme.md index 7758ea146..d45e924c0 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -73,6 +73,10 @@ Release Notes ------------- ### Upcoming - Changes + - General: Update to Firebase C++ SDK version 12.4.0. + - General (iOS): Update to Firebase Cocoapods version 11.4.2. + - General (Android): Update to Firebase Android BoM version 33.5.1. + - General (Android): Reduced minSdkVersion back to 23. - Analytics: Add support for Parameters of Lists of Dictionaries, needed by some events such as ViewCart. ([#1056](https://github.com/firebase/firebase-unity-sdk/issues/1056)). @@ -81,6 +85,10 @@ Release Notes is considered deprecated, and will be removed in the future. - Analytics: Deprecated the Dispose functions, as they are no longer necessary for cleaning up memory. + - Auth (Android): Setting PhotoUrl to empty string or null with + UpdateUserProfile clears the field, making it consistent with the + other platforms. + ([#1112](https://github.com/firebase/firebase-unity-sdk/issues/1112)). ### 12.3.0 - Changes diff --git a/unity_packer/guids.json b/unity_packer/guids.json index 39cd2ad24..4fc795373 100644 --- a/unity_packer/guids.json +++ b/unity_packer/guids.json @@ -1302,6 +1302,49 @@ "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.3.0/firebase-storage-unity-12.3.0.pom": "4597b167599f4416b926c00b66bded07", "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.3.0/firebase-storage-unity-12.3.0.srcaar": "bbb5fb86b32947d9a44ba347f60d8697" }, + "12.4.0": { + "Firebase/Editor/FirebaseAnalytics_version-12.4.0_manifest.txt": "77f69e39e9db4575bfb96161be66622b", + "Firebase/Editor/FirebaseAppCheck_version-12.4.0_manifest.txt": "324488512e974b6f9762d07b8ba2f4f2", + "Firebase/Editor/FirebaseAuth_version-12.4.0_manifest.txt": "6b0e1e7427ea402aa33d17b4b653eb37", + "Firebase/Editor/FirebaseCrashlytics_version-12.4.0_manifest.txt": "cea3f11fcb9e4f269064e669ce5643c7", + "Firebase/Editor/FirebaseDatabase_version-12.4.0_manifest.txt": "e78f2460de7b435985ad22300a24f632", + "Firebase/Editor/FirebaseDynamicLinks_version-12.4.0_manifest.txt": "a5f4a0c4d9dc419da46246f7f30b86c3", + "Firebase/Editor/FirebaseFirestore_version-12.4.0_manifest.txt": "baa60b4b70f142e6af37506e12332608", + "Firebase/Editor/FirebaseFunctions_version-12.4.0_manifest.txt": "9d495a333ee547ee8dd8aaa813cce948", + "Firebase/Editor/FirebaseInstallations_version-12.4.0_manifest.txt": "e90fe5de07cc486d90e54923f5eab99f", + "Firebase/Editor/FirebaseMessaging_version-12.4.0_manifest.txt": "5074acf6707541a8beab2e0b268594fd", + "Firebase/Editor/FirebaseRemoteConfig_version-12.4.0_manifest.txt": "bee3fe1ee55a4ef9bacd5cfead2dd8cc", + "Firebase/Editor/FirebaseStorage_version-12.4.0_manifest.txt": "15fe1d02680e432085dda2b59507c695", + "Firebase/Plugins/x86_64/FirebaseCppApp-12_4_0.bundle": "578c22d4208a44fa83a7dae9515ac206", + "Firebase/Plugins/x86_64/FirebaseCppApp-12_4_0.dll": "6d56ce68d47449e9bee1157cf0dc67df", + "Firebase/Plugins/x86_64/FirebaseCppApp-12_4_0.so": "bbface0bba714e00ab148bb75022679d", + "Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.4.0/firebase-analytics-unity-12.4.0.pom": "6d3702dcd15748c1850b9498d47206ce", + "Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.4.0/firebase-analytics-unity-12.4.0.srcaar": "97962b6feb754515883a44f1fe703fc8", + "Firebase/m2repository/com/google/firebase/firebase-app-unity/12.4.0/firebase-app-unity-12.4.0.pom": "ed2a107a75534d08a7dff3a9024f03c7", + "Firebase/m2repository/com/google/firebase/firebase-app-unity/12.4.0/firebase-app-unity-12.4.0.srcaar": "2ca72cf1cc41419db967300cf572ceed", + "Firebase/m2repository/com/google/firebase/firebase-appcheck-unity/12.4.0/firebase-appcheck-unity-12.4.0.pom": "d024363c62714694872377298cdb3be9", + "Firebase/m2repository/com/google/firebase/firebase-appcheck-unity/12.4.0/firebase-appcheck-unity-12.4.0.srcaar": "05764152de114e5a82fe15b117753885", + "Firebase/m2repository/com/google/firebase/firebase-auth-unity/12.4.0/firebase-auth-unity-12.4.0.pom": "fe28143b75144640a858f5373bc96245", + "Firebase/m2repository/com/google/firebase/firebase-auth-unity/12.4.0/firebase-auth-unity-12.4.0.srcaar": "fdebf4b82ec7418e947ac04783db02d6", + "Firebase/m2repository/com/google/firebase/firebase-config-unity/12.4.0/firebase-config-unity-12.4.0.pom": "3a77b9b125104822a655910dadfc4fed", + "Firebase/m2repository/com/google/firebase/firebase-config-unity/12.4.0/firebase-config-unity-12.4.0.srcaar": "87a7b4d300db4403be054b094d0e2856", + "Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.4.0/firebase-crashlytics-unity-12.4.0.pom": "86fa6c1a45fa44b28d1a6678e429cdf8", + "Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.4.0/firebase-crashlytics-unity-12.4.0.srcaar": "531977eb2cd14f0c8a299fcf11811637", + "Firebase/m2repository/com/google/firebase/firebase-database-unity/12.4.0/firebase-database-unity-12.4.0.pom": "43a0513296b84465b8e0b9e36f3bf0fa", + "Firebase/m2repository/com/google/firebase/firebase-database-unity/12.4.0/firebase-database-unity-12.4.0.srcaar": "a53c38ce8b0b4ea7889a2db7d105d113", + "Firebase/m2repository/com/google/firebase/firebase-dynamic-links-unity/12.4.0/firebase-dynamic-links-unity-12.4.0.pom": "515e928b84d949998b1353b13e91a5bf", + "Firebase/m2repository/com/google/firebase/firebase-dynamic-links-unity/12.4.0/firebase-dynamic-links-unity-12.4.0.srcaar": "84c3c7dcc6fe4cdf8e969f73bbd74e87", + "Firebase/m2repository/com/google/firebase/firebase-firestore-unity/12.4.0/firebase-firestore-unity-12.4.0.pom": "3e498e277676457fb37dbf9a7789cea1", + "Firebase/m2repository/com/google/firebase/firebase-firestore-unity/12.4.0/firebase-firestore-unity-12.4.0.srcaar": "74ce2a5413384f8f8f9fe7e5d9b6b74c", + "Firebase/m2repository/com/google/firebase/firebase-functions-unity/12.4.0/firebase-functions-unity-12.4.0.pom": "54db32e55f9d4ba7bac463c3a546761a", + "Firebase/m2repository/com/google/firebase/firebase-functions-unity/12.4.0/firebase-functions-unity-12.4.0.srcaar": "9a77240700af4f4c82285f4a6688a3a0", + "Firebase/m2repository/com/google/firebase/firebase-installations-unity/12.4.0/firebase-installations-unity-12.4.0.pom": "11d1ee30f17142a2b0ca359223ecd033", + "Firebase/m2repository/com/google/firebase/firebase-installations-unity/12.4.0/firebase-installations-unity-12.4.0.srcaar": "986dd58adaf041e38df70ccf50dfb213", + "Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.4.0/firebase-messaging-unity-12.4.0.pom": "0f520f4ceac94f6c8d93eb80a5331006", + "Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.4.0/firebase-messaging-unity-12.4.0.srcaar": "87fb297bc3214827b13c82fa15dee75b", + "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.4.0/firebase-storage-unity-12.4.0.pom": "dbac6f76b805499cbd59c362a80d1e95", + "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.4.0/firebase-storage-unity-12.4.0.srcaar": "8130d10833744b70ae3063e833329111" + }, "3.0.0": { "Firebase/Editor/FirebaseAnalytics_v3.0.0_manifest.txt": "13c9ba8e35174de78ad7ca9a48cba9f0", "Firebase/Editor/FirebaseAuth_v3.0.0_manifest.txt": "eaa139bec35e491da653b612e67134ad", From 446d14173a224464e6df865a2bcc86e5fa69a6b7 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Thu, 31 Oct 2024 11:24:07 -0700 Subject: [PATCH 4/9] Update readme.md --- docs/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/readme.md b/docs/readme.md index d45e924c0..49cc6898d 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -71,7 +71,7 @@ Support Release Notes ------------- -### Upcoming +### 12.4.0 - Changes - General: Update to Firebase C++ SDK version 12.4.0. - General (iOS): Update to Firebase Cocoapods version 11.4.2. From b835ddac87f1cd29d23a3f12919a2f8f6d6dee06 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Tue, 5 Nov 2024 16:36:54 -0800 Subject: [PATCH 5/9] Specify using v1 Cloud Functions (#1140) --- .../Firebase/Sample/Functions/.functions/functions/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/testapp/Assets/Firebase/Sample/Functions/.functions/functions/index.js b/functions/testapp/Assets/Firebase/Sample/Functions/.functions/functions/index.js index ebafe6348..a8d1905df 100644 --- a/functions/testapp/Assets/Firebase/Sample/Functions/.functions/functions/index.js +++ b/functions/testapp/Assets/Firebase/Sample/Functions/.functions/functions/index.js @@ -15,9 +15,9 @@ */ 'use strict'; -const functions = require('firebase-functions'); +const functions = require('firebase-functions/v1'); const admin = require('firebase-admin'); -admin.initializeApp(functions.config().firebase); +admin.initializeApp(); // Adds two numbers to each other. exports.addNumbers = functions.https.onCall((data) => { From 44cd79b3df43afd9240d5be727717d774aa35002 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Wed, 13 Nov 2024 12:43:25 -0800 Subject: [PATCH 6/9] Update the upload download actions to v4 (#1143) --- .github/workflows/build_android.yml | 2 +- .github/workflows/build_ios.yml | 2 +- .github/workflows/build_linux.yml | 4 +- .github/workflows/build_macos.yml | 2 +- .github/workflows/build_tvos.yml | 2 +- .github/workflows/build_windows.yml | 2 +- .github/workflows/generate_swig.yml | 2 +- .github/workflows/integration_tests.yml | 51 +++++++++++++------------ .github/workflows/package.yml | 8 ++-- 9 files changed, 38 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 08cbf8734..4613f6af4 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -135,7 +135,7 @@ jobs: fi - name: Upload Build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: android_unity path: android_unity/*.zip diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml index f7a4b83aa..11db28f6e 100644 --- a/.github/workflows/build_ios.yml +++ b/.github/workflows/build_ios.yml @@ -109,7 +109,7 @@ jobs: fi - name: Upload Build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ios_unity path: ios_unity/*.zip diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 459706886..9a602c251 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -117,13 +117,13 @@ jobs: fi - name: Upload Build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: linux_unity path: linux_unity/*Linux.zip - name: Upload Documentation Sources - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: documentation_sources path: linux_unity/documentation_sources.zip diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index abbe02364..798365ab7 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -132,7 +132,7 @@ jobs: fi - name: Upload Build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macos_unity path: macos_unity/*.zip diff --git a/.github/workflows/build_tvos.yml b/.github/workflows/build_tvos.yml index 9d547be12..9706dd8aa 100644 --- a/.github/workflows/build_tvos.yml +++ b/.github/workflows/build_tvos.yml @@ -130,7 +130,7 @@ jobs: fi - name: Upload Build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: tvos_unity path: tvos_unity/*.zip diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 77bc8d536..c7143af7e 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -129,7 +129,7 @@ jobs: fi - name: Upload Build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: windows_unity path: windows_unity/*.zip diff --git a/.github/workflows/generate_swig.yml b/.github/workflows/generate_swig.yml index 6a63af3f2..e1e3de814 100644 --- a/.github/workflows/generate_swig.yml +++ b/.github/workflows/generate_swig.yml @@ -92,7 +92,7 @@ jobs: fi - name: Upload Documentation Sources - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: documentation_sources path: linux_unity/documentation_sources.zip diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index b3900f255..8178b664f 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -224,11 +224,11 @@ jobs: --output ~/.android/debug.keystore "scripts/gha-encrypted/debug_keystore.gpg" - name: Fetch prebuilt packaged SDK from previous run if: ${{ github.event.inputs.packaged_sdk_run_id != '' }} - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v4 with: name: 'firebase_unity_sdk.zip' - workflow: 'build_starter.yml' - run_id: ${{ github.event.inputs.packaged_sdk_run_id }} + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.packaged_sdk_run_id }} - name: Build integration tests timeout-minutes: 240 @@ -267,14 +267,14 @@ jobs: echo "__SUMMARY_MISSING__" > build-results-${{ steps.matrix_info.outputs.info }}.log.json fi - name: Upload build results artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: build_and_test_results + name: build_and_test_results-${{ matrix.platform }}-${{ matrix.ios_sdk }} path: build-results-${{ steps.matrix_info.outputs.info }}* retention-days: ${{ env.artifactRetentionDays }} - name: Upload Mobile integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ contains('Android,iOS,tvOS', matrix.platform) && !cancelled() }} with: name: testapps-${{ matrix.platform }}-${{ steps.matrix_info.outputs.artifact_suffix }} @@ -285,14 +285,14 @@ jobs: shell: bash run: rm -rf testapps-${{ steps.matrix_info.outputs.info }} || true - name: Upload Desktop build logs artifact # Mobile build logs are uploaded with integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !contains('Android,iOS,tvOS', matrix.platform) && !cancelled() }} with: name: testapps-build-logs-${{ steps.matrix_info.outputs.info }} path: testapps-${{ steps.matrix_info.outputs.info }}/build-logs retention-days: ${{ env.artifactRetentionDays }} - name: Upload Linux integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ contains(matrix.platform, 'Linux') && !cancelled() }} with: name: testapps-Linux-${{ steps.matrix_info.outputs.artifact_suffix }} @@ -303,7 +303,7 @@ jobs: shell: bash run: rm -rf testapps-${{ steps.matrix_info.outputs.info }}/Linux || true - name: Upload macOS integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ contains(matrix.platform, 'macOS') && !cancelled() }} with: name: testapps-macOS-${{ steps.matrix_info.outputs.artifact_suffix }} @@ -314,7 +314,7 @@ jobs: shell: bash run: rm -rf testapps-${{ steps.matrix_info.outputs.info }}/macOS || true - name: Upload Windows integration tests artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ contains(matrix.platform, 'Windows') && !cancelled() }} with: name: testapps-Windows-${{ steps.matrix_info.outputs.artifact_suffix }} @@ -326,10 +326,10 @@ jobs: run: rm -rf testapps-${{ steps.matrix_info.outputs.info }}/Windows || true - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: build_and_test_results + name: build_and_test_results-${{ matrix.platform }}-${{ matrix.ios_sdk }} - name: Update PR label and comment if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} shell: bash @@ -388,11 +388,11 @@ jobs: python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}" - name: Fetch prebuilt packaged SDK from previous run if: ${{ github.event.inputs.packaged_sdk_run_id != '' }} - uses: dawidd6/action-download-artifact@v2 + uses: actions/download-artifact@v4 with: name: 'firebase_unity_sdk.zip' - workflow: 'build_starter.yml' - run_id: ${{ github.event.inputs.packaged_sdk_run_id }} + github-token: ${{ github.token }} + run-id: ${{ github.event.inputs.packaged_sdk_run_id }} - name: Set up Node (18) uses: actions/setup-node@v3 with: @@ -445,10 +445,10 @@ jobs: echo "__SUMMARY_MISSING__" > test-results-${{ steps.matrix_info.outputs.info }}.log.json fi - name: Upload test results artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: build_and_test_results + name: build_and_test_results-Playmode path: test-results-${{ steps.matrix_info.outputs.info }}* retention-days: ${{ env.artifactRetentionDays }} - name: Update PR label and comment @@ -501,7 +501,7 @@ jobs: if: runner.os == 'macOS' run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer - name: Download Testapp artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: testapps name: ${{ steps.matrix_info.outputs.artifact_path }} @@ -603,17 +603,17 @@ jobs: fi - name: Upload test results artifact if: ${{ !cancelled() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: build_and_test_results + name: build_and_test_results-${{ matrix.platform }}-${{ matrix.test_device }} path: testapps/test-results-${{ steps.matrix_info.outputs.info }}* retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - path: test_results - name: build_and_test_results + path: build_and_test_results + name: build_and_test_results-${{ matrix.platform }}-${{ matrix.test_device }} - name: Update PR label and comment shell: bash if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }} @@ -649,10 +649,11 @@ jobs: - name: Install python deps run: pip install -r scripts/gha/requirements.txt - name: Download log artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: test_results - name: build_and_test_results + pattern: build_and_test_results-* + merge-multiple: true # Use a different token to remove the "in-progress" label, # to allow the removal to trigger the "Check Labels" workflow. - name: Generate token for GitHub API diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 1d8ef5f97..a6dd7b446 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -136,7 +136,7 @@ jobs: # If called by build_start.xml, ignore name search, just grab all artifact exists - name: Fetch All in build_starter - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: built_artifact @@ -224,7 +224,7 @@ jobs: echo "::warning ::$(cat firebase_unity_sdk_hash.txt)" - name: Upload Build unitypackage - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_unity_sdk.zip path: firebase_unity_sdk.zip @@ -253,13 +253,13 @@ jobs: - name: Upload Build tgz if: ${{ steps.check-input.outputs.package_for_checks }} == '1' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_unity_sdk_tgz path: output_tgz - name: upload hash - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: firebase_unity_sdk_hash.txt path: firebase_unity_sdk_hash.txt From 51fca742a96317de4abfb3bfcf6e5ba9386513f3 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Wed, 13 Nov 2024 16:42:07 -0800 Subject: [PATCH 7/9] Disable new SWIG string helper functions (#1145) --- cmake/firebase_swig.cmake | 4 ++++ docs/readme.md | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/cmake/firebase_swig.cmake b/cmake/firebase_swig.cmake index db69bc9e4..557d9a87f 100644 --- a/cmake/firebase_swig.cmake +++ b/cmake/firebase_swig.cmake @@ -154,6 +154,10 @@ macro(firebase_swig_add_library name) # https://github.com/swig/swig/issues/672#issuecomment-400577864 final= USE_EXPORT_FIX + # SWIG 4.3 added a C# class, SWIGStringWithLengthHelper, but is missing + # the corresponding C++ symbols, which can cause issues. We don't + # rely on this class anyway, so just disable it. + SWIG_CSHARP_NO_STRING_WITH_LENGTH_HELPER ) set_property(TARGET ${name} PROPERTY SWIG_GENERATED_COMPILE_DEFINITIONS diff --git a/docs/readme.md b/docs/readme.md index 49cc6898d..33da9fc34 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -71,6 +71,11 @@ Support Release Notes ------------- +### Upcoming +- Changes + - General: Remove unresolved SWIG string symbols. + ([#1139](https://github.com/firebase/firebase-unity-sdk/issues/1139)). + ### 12.4.0 - Changes - General: Update to Firebase C++ SDK version 12.4.0. From 29afaedc09fa89109d2e266d4ca7f7999afc01bf Mon Sep 17 00:00:00 2001 From: "firebase-workflow-trigger[bot]" <80733318+firebase-workflow-trigger[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:01:42 -0800 Subject: [PATCH 8/9] Update Unity SDK dependencies - Thu Nov 14 2024 (#1146) * Update Unity SDK dependencies - Thu Nov 14 2024 > Created by [Firebase Unity SDK build workflow](https://github.com/firebase/firebase-unity-sdk/actions/runs/11828479902). * Update Guids ID * Update readme.md --------- Co-authored-by: firebase-workflow-trigger-bot Co-authored-by: a-maurice --- cmake/firebase_unity_version.cmake | 2 +- docs/readme.md | 2 +- unity_packer/guids.json | 43 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/cmake/firebase_unity_version.cmake b/cmake/firebase_unity_version.cmake index 679ba53ba..6d7051c1f 100644 --- a/cmake/firebase_unity_version.cmake +++ b/cmake/firebase_unity_version.cmake @@ -14,7 +14,7 @@ # This file defines the version numbers used by the Firebase Unity SDK. -set(FIREBASE_UNITY_SDK_VERSION "12.4.0" +set(FIREBASE_UNITY_SDK_VERSION "12.4.1" CACHE STRING "The version of the Unity SDK, used in the names of files.") set(FIREBASE_IOS_POD_VERSION "11.4.2" diff --git a/docs/readme.md b/docs/readme.md index 33da9fc34..1c1262b67 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -71,7 +71,7 @@ Support Release Notes ------------- -### Upcoming +### 12.4.1 - Changes - General: Remove unresolved SWIG string symbols. ([#1139](https://github.com/firebase/firebase-unity-sdk/issues/1139)). diff --git a/unity_packer/guids.json b/unity_packer/guids.json index 4fc795373..5d784b45e 100644 --- a/unity_packer/guids.json +++ b/unity_packer/guids.json @@ -1345,6 +1345,49 @@ "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.4.0/firebase-storage-unity-12.4.0.pom": "dbac6f76b805499cbd59c362a80d1e95", "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.4.0/firebase-storage-unity-12.4.0.srcaar": "8130d10833744b70ae3063e833329111" }, + "12.4.1": { + "Firebase/Editor/FirebaseAnalytics_version-12.4.1_manifest.txt": "3f98d56fc188476aa8d825c63fecb994", + "Firebase/Editor/FirebaseAppCheck_version-12.4.1_manifest.txt": "c407cd34991e454894b3bb5070db189e", + "Firebase/Editor/FirebaseAuth_version-12.4.1_manifest.txt": "a881d9c3348049ad91e0c680487a9b8e", + "Firebase/Editor/FirebaseCrashlytics_version-12.4.1_manifest.txt": "3de58aefa5834f30bb2762a54c269e4d", + "Firebase/Editor/FirebaseDatabase_version-12.4.1_manifest.txt": "6aa98223bea24b7ea7d97d63a99cd62f", + "Firebase/Editor/FirebaseDynamicLinks_version-12.4.1_manifest.txt": "ce2825bf25f0455e9c1afb75d19c13e8", + "Firebase/Editor/FirebaseFirestore_version-12.4.1_manifest.txt": "594283f522cc463d9a8800539387efb5", + "Firebase/Editor/FirebaseFunctions_version-12.4.1_manifest.txt": "29590eafce4b46c88293af2765cc6d57", + "Firebase/Editor/FirebaseInstallations_version-12.4.1_manifest.txt": "cf09a0e5429048cf83094904f81d24ae", + "Firebase/Editor/FirebaseMessaging_version-12.4.1_manifest.txt": "88a5c4d939a04054a875594745ed9e51", + "Firebase/Editor/FirebaseRemoteConfig_version-12.4.1_manifest.txt": "34b3b376a7974f028e6a8da364013f0f", + "Firebase/Editor/FirebaseStorage_version-12.4.1_manifest.txt": "67a948a18fe74b2384c34fe8a27c2c8b", + "Firebase/Plugins/x86_64/FirebaseCppApp-12_4_1.bundle": "9ad2e16ad8f741b7bcbc23a3bf48ff2f", + "Firebase/Plugins/x86_64/FirebaseCppApp-12_4_1.dll": "27bf7cb011ac4aef972ac2d9ec4bfc5d", + "Firebase/Plugins/x86_64/FirebaseCppApp-12_4_1.so": "c812e98126fa41caa5da41b17aac51da", + "Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.4.1/firebase-analytics-unity-12.4.1.pom": "03f5ca3b66d34e01a5af9da9d597e0ba", + "Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.4.1/firebase-analytics-unity-12.4.1.srcaar": "ab8c83e718a84104b9833e838673f098", + "Firebase/m2repository/com/google/firebase/firebase-app-unity/12.4.1/firebase-app-unity-12.4.1.pom": "becdcda6b0ee4efea42495cbbf3e65b1", + "Firebase/m2repository/com/google/firebase/firebase-app-unity/12.4.1/firebase-app-unity-12.4.1.srcaar": "72be06ca0fb84653ab84997ce18d9f55", + "Firebase/m2repository/com/google/firebase/firebase-appcheck-unity/12.4.1/firebase-appcheck-unity-12.4.1.pom": "5c983bbdc6984d739091044544ba3e79", + "Firebase/m2repository/com/google/firebase/firebase-appcheck-unity/12.4.1/firebase-appcheck-unity-12.4.1.srcaar": "9235a3351e604f85b63fc31efc9583bf", + "Firebase/m2repository/com/google/firebase/firebase-auth-unity/12.4.1/firebase-auth-unity-12.4.1.pom": "f0f903f315944857b6cbfd27f2eccb55", + "Firebase/m2repository/com/google/firebase/firebase-auth-unity/12.4.1/firebase-auth-unity-12.4.1.srcaar": "8c44aec4e9624f66903e374c31f68303", + "Firebase/m2repository/com/google/firebase/firebase-config-unity/12.4.1/firebase-config-unity-12.4.1.pom": "91a0590522204fca8d1f266d278814b3", + "Firebase/m2repository/com/google/firebase/firebase-config-unity/12.4.1/firebase-config-unity-12.4.1.srcaar": "d7f9a48997f14ae9b059b764658a9ab7", + "Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.4.1/firebase-crashlytics-unity-12.4.1.pom": "7f395123d0294c6aac5917618918b542", + "Firebase/m2repository/com/google/firebase/firebase-crashlytics-unity/12.4.1/firebase-crashlytics-unity-12.4.1.srcaar": "afdc3ff2aa1b4d34a50c1335eb345cca", + "Firebase/m2repository/com/google/firebase/firebase-database-unity/12.4.1/firebase-database-unity-12.4.1.pom": "1fbd14a9ec524686b21b6e9dfb52e465", + "Firebase/m2repository/com/google/firebase/firebase-database-unity/12.4.1/firebase-database-unity-12.4.1.srcaar": "769a7f48dfbf4d80a7dcb5e98de98b12", + "Firebase/m2repository/com/google/firebase/firebase-dynamic-links-unity/12.4.1/firebase-dynamic-links-unity-12.4.1.pom": "cac40f682cc646d0bafe987132e729a7", + "Firebase/m2repository/com/google/firebase/firebase-dynamic-links-unity/12.4.1/firebase-dynamic-links-unity-12.4.1.srcaar": "18445c18aadb4a158d24034b1fc769f8", + "Firebase/m2repository/com/google/firebase/firebase-firestore-unity/12.4.1/firebase-firestore-unity-12.4.1.pom": "d4196b1c6bbd4cdc94dd221793784cd6", + "Firebase/m2repository/com/google/firebase/firebase-firestore-unity/12.4.1/firebase-firestore-unity-12.4.1.srcaar": "133f1863e54549e6928c42cf0e2be652", + "Firebase/m2repository/com/google/firebase/firebase-functions-unity/12.4.1/firebase-functions-unity-12.4.1.pom": "393abef4101d4ed3bbbd81f31b8ee2fe", + "Firebase/m2repository/com/google/firebase/firebase-functions-unity/12.4.1/firebase-functions-unity-12.4.1.srcaar": "869f4dd74c2740c09561d4a8b7dcb468", + "Firebase/m2repository/com/google/firebase/firebase-installations-unity/12.4.1/firebase-installations-unity-12.4.1.pom": "52c8f9faf73741a9a45f3868f0d2ebc4", + "Firebase/m2repository/com/google/firebase/firebase-installations-unity/12.4.1/firebase-installations-unity-12.4.1.srcaar": "aeae0390486e46e78ed220fb46a79079", + "Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.4.1/firebase-messaging-unity-12.4.1.pom": "e01f44b20a144fc2aec975e285ebf109", + "Firebase/m2repository/com/google/firebase/firebase-messaging-unity/12.4.1/firebase-messaging-unity-12.4.1.srcaar": "ba61c5e17c3f405b82895a9d98c7c55a", + "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.4.1/firebase-storage-unity-12.4.1.pom": "ce44dc94383847ffbeab725e0f85a4e2", + "Firebase/m2repository/com/google/firebase/firebase-storage-unity/12.4.1/firebase-storage-unity-12.4.1.srcaar": "385a2672c4a445e088d8d40eac29016b" + }, "3.0.0": { "Firebase/Editor/FirebaseAnalytics_v3.0.0_manifest.txt": "13c9ba8e35174de78ad7ca9a48cba9f0", "Firebase/Editor/FirebaseAuth_v3.0.0_manifest.txt": "eaa139bec35e491da653b612e67134ad", From c2860715b35b877cc9f4e03538273550564b0b7e Mon Sep 17 00:00:00 2001 From: a-maurice Date: Tue, 19 Nov 2024 13:52:08 -0800 Subject: [PATCH 9/9] Make workflow uploads more unique (#1149) * Make workflow uploads more unique * Update integration_tests.yml --- .github/workflows/integration_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 8178b664f..28feacf5c 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -270,7 +270,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: build_and_test_results-${{ matrix.platform }}-${{ matrix.ios_sdk }} + name: build_and_test_results-build-${{ steps.matrix_info.outputs.info }} path: build-results-${{ steps.matrix_info.outputs.info }}* retention-days: ${{ env.artifactRetentionDays }} - name: Upload Mobile integration tests artifact @@ -448,7 +448,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: - name: build_and_test_results-Playmode + name: build_and_test_results-${{ matrix.os }}-Playmode path: test-results-${{ steps.matrix_info.outputs.info }}* retention-days: ${{ env.artifactRetentionDays }} - name: Update PR label and comment @@ -605,7 +605,7 @@ jobs: if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: - name: build_and_test_results-${{ matrix.platform }}-${{ matrix.test_device }} + name: build_and_test_results-test-${{ steps.matrix_info.outputs.info }} path: testapps/test-results-${{ steps.matrix_info.outputs.info }}* retention-days: ${{ env.artifactRetentionDays }} - name: Download log artifacts