Skip to content

Commit 33f8849

Browse files
author
Cynthia Jiang
committed
Merge remote-tracking branch 'origin/master' into ghm
2 parents 71a22e6 + 4d6a0d7 commit 33f8849

27 files changed

+264
-594
lines changed

CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ option(FIREBASE_INCLUDE_DYNAMIC_LINKS
4242
"Include the Firebase Dynamic Links library." ON)
4343
option(FIREBASE_INCLUDE_FUNCTIONS
4444
"Include the Cloud Functions for Firebase library." ON)
45-
option(FIREBASE_INCLUDE_INSTANCE_ID
46-
"Include the Firebase Instance ID library." ON)
4745
option(FIREBASE_INCLUDE_MESSAGING
4846
"Include the Firebase Cloud Messaging library." ON)
4947
option(FIREBASE_INCLUDE_REMOTE_CONFIG
@@ -244,11 +242,6 @@ if (FIREBASE_INCLUDE_FUNCTIONS)
244242
list(APPEND TARGET_LINK_LIB_NAMES "firebase_functions" "firebase_functions_swig")
245243
list(APPEND PROJECT_LIST_HEADER " X(Functions)")
246244
endif()
247-
if (FIREBASE_INCLUDE_INSTANCE_ID)
248-
add_subdirectory(instance_id)
249-
list(APPEND TARGET_LINK_LIB_NAMES "firebase_instance_id" "firebase_instance_id_swig")
250-
list(APPEND PROJECT_LIST_HEADER " X(InstanceId)")
251-
endif()
252245
if (FIREBASE_INCLUDE_MESSAGING)
253246
add_subdirectory(messaging)
254247
list(APPEND TARGET_LINK_LIB_NAMES "firebase_messaging" "firebase_messaging_swig")

app/src/swig/app.i

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,6 @@ static firebase::AppOptions* AppOptionsLoadFromJsonConfig(const char* config) {
651651
"Firebase.Installations.FirebaseInstallations, Firebase.Installations",
652652
"installations"
653653
),
654-
new EnableModuleParams(
655-
"Firebase.InstanceId.FirebaseInstanceId, Firebase.InstanceId",
656-
"instance_id"
657-
),
658654
new EnableModuleParams(
659655
"Firebase.Invites.FirebaseInvites, Firebase.Invites",
660656
"invites"

app/src/swig/future.i

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@ namespace firebase {
181181
System.Threading.Tasks.TaskCompletionSource<CSTYPE> tcs =
182182
new System.Threading.Tasks.TaskCompletionSource<CSTYPE>();
183183
#endif // TYPE_## %mangle(CTYPE)
184+
185+
// Check if an exception has occurred previously and propagate it if it has.
186+
// This has to be done before accessing the future because the future object
187+
// might be invalid.
188+
if ($imclassname.SWIGPendingException.Pending) {
189+
tcs.SetException($imclassname.SWIGPendingException.Retrieve());
190+
return tcs.Task;
191+
}
192+
184193
if (fu.status() == FutureStatus.Invalid) {
185194
tcs.SetException(
186195
new FirebaseException(0, "Asynchronous operation was not started."));

app/src/unity_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// the C++ module.
2121

2222
#include <jni.h>
23+
2324
#include "app/src/util.h"
2425
#include "app/src/util_android.h"
2526

@@ -110,7 +111,6 @@ jint JNI_OnLoad(JavaVM *jvm, void *reserved) {
110111
{"com/google/firebase/dynamiclinks/FirebaseDynamicLinks",
111112
"dynamic_links"},
112113
{"com/google/firebase/functions/FirebaseFunctions", "functions"},
113-
{"com/google/firebase/iid/FirebaseInstanceId", "instance_id"},
114114
{"com/google/firebase/installations/FirebaseInstallations",
115115
"installations"},
116116
{"com/google/android/gms/appinvite/AppInvite", "invites"},

auth/src/swig/auth.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ static CppInstanceManager<Auth> g_auth_instances;
956956
%typemap(csclassmodifiers) firebase::auth::FederatedOAuthProvider
957957
"public sealed class";
958958

959-
// Provider classes declared in auth/client/cpp/src/included/credential.h
959+
// Provider classes declared in third_party/firebase/cpp/auth/src/included/credential.h
960960
// Rename the kProviderId string constant for all of our AuthProviders.
961961
%rename(ProviderId) firebase::auth::EmailAuthProvider::kProviderId;
962962
%rename(ProviderId) firebase::auth::FacebookAuthProvider::kProviderId;

cmake/android_dependencies.cmake

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,49 @@
1616

1717
set(FIREBASE_APP_ANDROID_DEPS
1818
"com.google.firebase:firebase-common:19.5.0"
19-
"com.google.firebase:firebase-analytics:18.0.2"
19+
"com.google.firebase:firebase-analytics:18.0.3"
2020
)
2121

2222
set(FIREBASE_ANALYTICS_ANDROID_DEPS
23-
"com.google.firebase:firebase-analytics:18.0.2"
23+
"com.google.firebase:firebase-analytics:18.0.3"
2424
)
2525

2626
set(FIREBASE_AUTH_ANDROID_DEPS
27-
"com.google.firebase:firebase-auth:20.0.2"
28-
"com.google.firebase:firebase-analytics:18.0.2"
27+
"com.google.firebase:firebase-auth:20.0.4"
28+
"com.google.firebase:firebase-analytics:18.0.3"
2929
)
3030

3131
set(FIREBASE_DATABASE_ANDROID_DEPS
32-
"com.google.firebase:firebase-database:19.6.0"
33-
"com.google.firebase:firebase-analytics:18.0.2"
32+
"com.google.firebase:firebase-database:19.7.0"
33+
"com.google.firebase:firebase-analytics:18.0.3"
3434
)
3535

3636
set(FIREBASE_DYNAMIC_LINKS_ANDROID_DEPS
3737
"com.google.android.gms:play-services-appinvite:18.0.0"
38-
"com.google.firebase:firebase-analytics:18.0.2"
38+
"com.google.firebase:firebase-analytics:18.0.3"
3939
)
4040

4141
set(FIREBASE_FUNCTIONS_ANDROID_DEPS
4242
"com.google.firebase:firebase-functions:19.2.0"
43-
"com.google.firebase:firebase-analytics:18.0.2"
43+
"com.google.firebase:firebase-analytics:18.0.3"
4444
)
4545

4646
set(FIREBASE_INSTANCE_ID_ANDROID_DEPS
47-
"com.google.firebase:firebase-iid:21.0.1"
48-
"com.google.firebase:firebase-analytics:18.0.2"
47+
"com.google.firebase:firebase-iid:21.1.0"
48+
"com.google.firebase:firebase-analytics:18.0.3"
4949
)
5050

5151
set(FIREBASE_MESSAGING_ANDROID_DEPS
52-
"com.google.firebase:firebase-messaging:21.0.1"
53-
"com.google.firebase:firebase-analytics:18.0.2"
52+
"com.google.firebase:firebase-messaging:21.1.0"
53+
"com.google.firebase:firebase-analytics:18.0.3"
5454
)
5555

5656
set(FIREBASE_REMOTE_CONFIG_ANDROID_DEPS
57-
"com.google.firebase:firebase-config:20.0.3"
58-
"com.google.firebase:firebase-analytics:18.0.2"
57+
"com.google.firebase:firebase-config:20.0.4"
58+
"com.google.firebase:firebase-analytics:18.0.3"
5959
)
6060

6161
set(FIREBASE_STORAGE_ANDROID_DEPS
62-
"com.google.firebase:firebase-storage:19.2.1"
63-
"com.google.firebase:firebase-analytics:18.0.2"
62+
"com.google.firebase:firebase-storage:19.2.2"
63+
"com.google.firebase:firebase-analytics:18.0.3"
6464
)

cmake/swig_fix.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ def get_transformations(namespace):
139139
'csharp': [
140140
swig_post_process.SWIGEnumPostProcessing(),
141141
NamespaceCMethodsCMake(namespace),
142-
swig_post_process.ReplaceExceptionChecks('AppUtil'),
142+
swig_post_process.ReplaceExceptionChecks(
143+
'AppUtil', ['firebase/firestore/client/unity']),
143144
swig_post_process.FixSealedClasses(),
144145
swig_post_process.InternalMethodsToInternalVisibility(),
145146
swig_post_process.RenameAsyncMethods(),

crashlytics/src/AndroidImpl.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ internal AndroidImpl() {
5555
"Unable to create FirebaseCrashlytics instance.");
5656
return;
5757
}
58+
59+
SetCustomKey(MetadataBuilder.METADATA_KEY, MetadataBuilder.GenerateMetadataJSON());
5860
}
5961

6062
~AndroidImpl() {

crashlytics/src/IOSImpl.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ internal class IOSImpl : Impl
4949
[DllImport("__Internal")]
5050
private static extern void CLUSetKeyValue(string key, string value);
5151

52+
[DllImport("__Internal")]
53+
private static extern void CLUSetInternalKeyValue(string key, string value);
54+
5255
[DllImport("__Internal")]
5356
private static extern void CLUSetUserIdentifier(string identifier);
5457

@@ -68,6 +71,7 @@ private static extern void CLURecordCustomException(string name, string reason,
6871

6972
public IOSImpl() {
7073
CLUSetDevelopmentPlatform("Unity", Application.unityVersion);
74+
CLUSetInternalKeyValue(MetadataBuilder.METADATA_KEY, MetadataBuilder.GenerateMetadataJSON());
7175
}
7276

7377
public override bool IsSDKInitialized() {

crashlytics/src/Metadata.cs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
namespace Firebase.Crashlytics {
18+
using System;
19+
using System;
20+
using UnityEngine;
21+
22+
/// <summary>
23+
/// Represents the Unity-specific metadata object that is transformed into JSON.
24+
///
25+
/// Metadata keys are acronyms to save space as there are limits to the maximum size of Keys in
26+
/// the Android and iOS SDK.
27+
/// </summary>
28+
internal class Metadata {
29+
// unityVersion: Version of Unity Engine
30+
public string uv;
31+
// isDebugBuild: Whether "Development Build" is checked
32+
public bool idb;
33+
34+
// processorType
35+
public string pt;
36+
// processorCount: Number of cores
37+
public int pc;
38+
// processorFrequency
39+
public int pf;
40+
41+
// systemMemorySize: RAM size
42+
public int sms;
43+
44+
// graphicsMemorySize
45+
public int gms;
46+
// graphicsDeviceID
47+
public int gdid;
48+
// graphicsDeviceVendorID
49+
public int gdvid;
50+
// graphicsDeviceName
51+
public string gdn;
52+
// graphicsDeviceVendor
53+
public string gdv;
54+
// graphicsDeviceVersion
55+
public string gdver;
56+
// graphicsDeviceType
57+
public UnityEngine.Rendering.GraphicsDeviceType gdt;
58+
59+
// graphicsShaderLevel
60+
// https://docs.unity3d.com/540/Documentation/ScriptReference/SystemInfo-graphicsShaderLevel.html
61+
public int gsl;
62+
// graphicsRenderTargetCount
63+
public int grtc;
64+
// graphicsCopyTextureSupport
65+
public UnityEngine.Rendering.CopyTextureSupport gcts;
66+
// graphicsMaxTextureSize
67+
public int gmts;
68+
69+
// screenSize
70+
public string ss;
71+
// screenDPI
72+
public float sdpi;
73+
// screenRefreshRate
74+
public int srr;
75+
76+
public Metadata() {
77+
uv = Application.unityVersion;
78+
idb = Debug.isDebugBuild;
79+
80+
pt = SystemInfo.processorType;
81+
pc = SystemInfo.processorCount;
82+
pf = SystemInfo.processorFrequency;
83+
84+
sms = SystemInfo.systemMemorySize;
85+
86+
gms = SystemInfo.graphicsMemorySize;
87+
gdid = SystemInfo.graphicsDeviceID;
88+
gdvid = SystemInfo.graphicsDeviceVendorID;
89+
gdn = SystemInfo.graphicsDeviceName;
90+
gdv = SystemInfo.graphicsDeviceVendor;
91+
gdver = SystemInfo.graphicsDeviceVersion;
92+
gdt = SystemInfo.graphicsDeviceType;
93+
94+
gsl = SystemInfo.graphicsShaderLevel;
95+
grtc = SystemInfo.supportedRenderTargetCount;
96+
gcts = SystemInfo.copyTextureSupport;
97+
gmts = SystemInfo.maxTextureSize;
98+
99+
ss = String.Format("{0}x{1}", Screen.width, Screen.height);
100+
sdpi = Screen.dpi;
101+
srr = Screen.currentResolution.refreshRate;
102+
}
103+
}
104+
}

crashlytics/src/MetadataBuilder.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
namespace Firebase.Crashlytics {
18+
using System;
19+
using UnityEngine;
20+
21+
/// <summary>
22+
/// Automatically collects metadata and serializes to JSON in a space-efficient way.
23+
/// </summary>
24+
internal class MetadataBuilder {
25+
public static string METADATA_KEY = "com.crashlytics.metadata.unity";
26+
27+
public static string GenerateMetadataJSON() {
28+
try {
29+
Metadata metadata = new Metadata();
30+
return JsonUtility.ToJson(metadata);
31+
} catch (Exception e) {
32+
UnityEngine.Debug.LogError(
33+
"Failed to generate Unity-specific metadata for Crashlytics due to: " + e.ToString());
34+
return "";
35+
}
36+
}
37+
}
38+
}

crashlytics/src/cpp/android/crashlytics_android.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
#define FIREBASE_CRASHLYTICS_CLIENT_CPP_SRC_ANDROID_CRASHLYTICS_ANDROID_H_
1717

1818
#include <jni.h>
19+
1920
#include <map>
2021
#include <set>
22+
23+
#include "crashlytics/src/cpp/include/firebase/crashlytics.h"
2124
#include "app/src/future_manager.h"
2225
#include "app/src/include/firebase/app.h"
2326
#include "app/src/include/firebase/internal/common.h"
2427
#include "app/src/mutex.h"
2528
#include "app/src/util_android.h"
26-
#include "crashlytics/src/cpp/include/firebase/crashlytics.h"
2729

2830
namespace firebase {
2931
namespace crashlytics {

crashlytics/src/cpp/common/crashlytics.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
#include "app/src/cleanup_notifier.h"
2323
#include "app/src/include/firebase/app.h"
2424
#include "app/src/include/firebase/version.h"
25-
#include "app/src/mutex.h"
2625
#include "app/src/log.h"
26+
#include "app/src/mutex.h"
2727
#include "app/src/util.h"
2828

2929
#if defined(__ANDROID__)
30-
#include "app/src/util_android.h"
3130
#include "crashlytics/src/cpp/android/crashlytics_android.h"
31+
#include "app/src/util_android.h"
3232
#else
3333
#include "crashlytics/src/cpp/stub/crashlytics_stub.h"
3434
#endif // defined(__ANDROID__)

crashlytics/src/cpp/ios/Crashlytics_PrivateHeaders/Crashlytics_Platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@
2626
@property(nonatomic, strong, nullable) NSString* developmentPlatformVersion;
2727

2828
@end
29+
30+
void FIRCLSUserLoggingRecordInternalKeyValue(NSString* key, id value);

crashlytics/src/cpp/ios/CrashlyticsiOSWrapper.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ void CLUSetKeyValue(const char *key, const char *value) {
6969
forKey:safeCharToNSString(key)];
7070
}
7171

72+
void CLUSetInternalKeyValue(const char *key, const char *value) {
73+
FIRCLSUserLoggingRecordInternalKeyValue(safeCharToNSString(key), safeCharToNSString(value));
74+
}
75+
7276
void CLULog(const char *msg) { [[FIRCrashlytics crashlytics] log:safeCharToNSString(msg)]; }
7377

7478
void CLUSetUserIdentifier(const char *identifier) {

crashlytics/src/cpp/stub/crashlytics_stub.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717

1818
#include <map>
1919
#include <set>
20+
21+
#include "crashlytics/src/cpp/include/firebase/crashlytics.h"
2022
#include "app/src/cleanup_notifier.h"
2123
#include "app/src/future_manager.h"
2224
#include "app/src/include/firebase/app.h"
2325
#include "app/src/include/firebase/internal/common.h"
2426
#include "app/src/mutex.h"
25-
#include "crashlytics/src/cpp/include/firebase/crashlytics.h"
2627

2728
namespace firebase {
2829
namespace crashlytics {
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)