Skip to content

Commit 18b17c0

Browse files
jonsimantova-maurice
authored andcommitted
Update Firebase C++/Unity iOS dependencies.
Breaking changes in Firebase iOS 6.0.0 have necessitated the following: Removal of Invites C++/Unity from iOS library - Removed Invites iOS dependencies (Android remains until we refactor App's usage of Invites to call Dynamic Links instead, or just remove it from App entirely). - Move proguard file containing Invites dependencies from App into Dynamic Links. Other SDK breaking changes: - Changed Auth completion block signatures (including fakes) for a few objc methods. - Replaced Dynamic Links componentsWithLink:domain: with componentsWithLink:domainURIPrefix: which requires an "https://" at the start of the domain. - Removed FIRAnalyticsConfiguration from FIRAnalytics (everything was moved into FIRAnalytics except setMinimumSessionInternal which has been removed), which includes changes to fakes and tests. - Removed iid* from App, no longer used. PiperOrigin-RevId: 246046631
1 parent dd070dc commit 18b17c0

File tree

11 files changed

+39
-265
lines changed

11 files changed

+39
-265
lines changed

analytics/src/analytics_android.cc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
#include <cstdint>
2121
#include <cstring>
2222

23-
#include "analytics/src/include/firebase/analytics.h"
24-
2523
#include "analytics/src/analytics_common.h"
24+
#include "analytics/src/include/firebase/analytics.h"
2625
#include "app/src/assert.h"
2726
#include "app/src/include/firebase/app.h"
2827
#include "app/src/include/firebase/version.h"
@@ -54,7 +53,6 @@ static const ::firebase::App* g_app = nullptr;
5453
X(SetCurrentScreen, "setCurrentScreen", \
5554
"(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;)V"), \
5655
X(SetUserId, "setUserId", "(Ljava/lang/String;)V"), \
57-
X(SetMinimumSessionDuration, "setMinimumSessionDuration", "(J)V"), \
5856
X(SetSessionTimeoutDuration, "setSessionTimeoutDuration", "(J)V"), \
5957
X(ResetAnalyticsData, "resetAnalyticsData", "()V"), \
6058
X(GetAppInstanceId, "getAppInstanceId", \
@@ -302,13 +300,8 @@ void SetUserId(const char* user_id) {
302300

303301
// Sets the minimum engagement time required before starting a session.
304302
void SetMinimumSessionDuration(int64_t milliseconds) {
305-
FIREBASE_ASSERT_RETURN_VOID(internal::IsInitialized());
306-
JNIEnv* env = g_app->GetJNIEnv();
307-
env->CallVoidMethod(
308-
g_analytics_class_instance,
309-
analytics::GetMethodId(analytics::kSetMinimumSessionDuration),
310-
milliseconds);
311-
util::CheckAndClearJniExceptions(env);
303+
LogWarning(
304+
"SetMinimumSessionDuration is deprecated and no longer functional.");
312305
}
313306

314307
// Sets the duration of inactivity that terminates the current session.

analytics/src/analytics_ios.mm

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#import <Foundation/Foundation.h>
1818

1919
#import "FIRAnalytics.h"
20-
#import "FIRAnalyticsConfiguration.h"
2120

2221
#include "analytics/src/include/firebase/analytics.h"
2322

@@ -59,7 +58,7 @@ void Terminate() {
5958
// Enable / disable measurement and reporting.
6059
void SetAnalyticsCollectionEnabled(bool enabled) {
6160
FIREBASE_ASSERT_RETURN_VOID(internal::IsInitialized());
62-
[FIRAnalyticsConfiguration.sharedInstance setAnalyticsCollectionEnabled:enabled];
61+
[FIRAnalytics setAnalyticsCollectionEnabled:enabled];
6362
}
6463

6564
// Due to overloads of LogEvent(), it's possible for users to call variants that require a
@@ -151,16 +150,15 @@ void SetUserId(const char* user_id) {
151150
}
152151

153152
// Sets the minimum engagement time required before starting a session.
153+
// (No longer functional.)
154154
void SetMinimumSessionDuration(int64_t milliseconds) {
155-
FIREBASE_ASSERT_RETURN_VOID(internal::IsInitialized());
156-
[FIRAnalyticsConfiguration.sharedInstance
157-
setMinimumSessionInterval:static_cast<NSTimeInterval>(milliseconds) / kMillisecondsPerSecond];
155+
LogWarning("SetMinimumSessionDuration is deprecated and no longer functional.");
158156
}
159157

160158
// Sets the duration of inactivity that terminates the current session.
161159
void SetSessionTimeoutDuration(int64_t milliseconds) {
162160
FIREBASE_ASSERT_RETURN_VOID(internal::IsInitialized());
163-
[FIRAnalyticsConfiguration.sharedInstance
161+
[FIRAnalytics
164162
setSessionTimeoutInterval:static_cast<NSTimeInterval>(milliseconds) / kMillisecondsPerSecond];
165163
}
166164

analytics/src/include/firebase/analytics.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,10 @@ void SetUserId(const char* user_id);
495495
///
496496
/// @param milliseconds The minimum engagement time required to start a new
497497
/// session.
498-
void SetMinimumSessionDuration(int64_t milliseconds);
498+
///
499+
/// @deprecated SetMinimumSessionDuration is deprecated and no longer
500+
/// functional.
501+
FIREBASE_DEPRECATED void SetMinimumSessionDuration(int64_t milliseconds);
499502

500503
/// @brief Sets the duration of inactivity that terminates the current session.
501504
///

app/src/iid.h

Lines changed: 0 additions & 61 deletions
This file was deleted.

app/src/iid_android.cc

Lines changed: 0 additions & 97 deletions
This file was deleted.

app/src/iid_ios.mm

Lines changed: 0 additions & 40 deletions
This file was deleted.

app/src/iid_stub.cc

Lines changed: 0 additions & 34 deletions
This file was deleted.

auth/src/ios/auth_ios.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,11 @@ void SignInResultCallback(FIRAuthDataResult *_Nullable auth_result, NSError *_Nu
296296
ReferenceCountedFutureImpl &futures = auth_data_->future_impl;
297297
const auto handle = futures.SafeAlloc<User *>(kAuthFn_SignInWithCredential, nullptr);
298298

299-
[AuthImpl(auth_data_) signInWithCredential:CredentialFromImpl(credential.impl_)
300-
completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
301-
SignInCallback(user, error, handle, auth_data_);
302-
}];
299+
[AuthImpl(auth_data_)
300+
signInWithCredential:CredentialFromImpl(credential.impl_)
301+
completion:^(FIRAuthDataResult *_Nullable auth_result, NSError *_Nullable error) {
302+
SignInCallback(auth_result.user, error, handle, auth_data_);
303+
}];
303304

304305
return MakeFuture(&futures, handle);
305306
}

auth/src/ios/user_ios.mm

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
182182
const auto handle = futures.SafeAlloc<User*>(kUserFn_LinkWithCredential);
183183
[UserImpl(auth_data_)
184184
linkWithCredential:CredentialFromImpl(credential.impl_)
185-
completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
186-
SignInCallback(user, error, handle, auth_data_);
187-
}];
185+
completion:^(FIRAuthDataResult *_Nullable auth_result, NSError *_Nullable error) {
186+
SignInCallback(auth_result.user, error, handle, auth_data_);
187+
}];
188188
return MakeFuture(&futures, handle);
189189
}
190190

@@ -259,11 +259,13 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
259259
ReferenceCountedFutureImpl& futures = auth_data_->future_impl;
260260
const auto handle = futures.SafeAlloc<void>(kUserFn_Reauthenticate);
261261

262-
[UserImpl(auth_data_) reauthenticateWithCredential:CredentialFromImpl(credential.impl_)
263-
completion:^(NSError *_Nullable error) {
264-
futures.Complete(handle, AuthErrorFromNSError(error),
265-
[error.localizedDescription UTF8String]);
266-
}];
262+
[UserImpl(auth_data_)
263+
reauthenticateWithCredential:CredentialFromImpl(credential.impl_)
264+
completion:^(FIRAuthDataResult *_Nullable auth_result,
265+
NSError *_Nullable error) {
266+
futures.Complete(handle, AuthErrorFromNSError(error),
267+
[error.localizedDescription UTF8String]);
268+
}];
267269
return MakeFuture(&futures, handle);
268270
}
269271

dynamic_links/src/dynamic_links_ios.mm

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include <cstring>
16+
1517
#include "dynamic_links/src/include/firebase/dynamic_links.h"
1618
#include "dynamic_links/src/include/firebase/dynamic_links/components.h"
1719

@@ -119,9 +121,16 @@ static void AddUrlEncodingWarning(
119121
generated_link->error = kUrlEncodingError;
120122
return nil;
121123
}
124+
// If components.dynamic_link_domain doesn't start with "https://", add it.
125+
static const char kHttpsPrefix[] = "https://";
126+
static const size_t kHttpsPrefixLength = sizeof(kHttpsPrefix) - 1;
127+
std::string dynamic_link_domain =
128+
strncmp(components.dynamic_link_domain, kHttpsPrefix, kHttpsPrefixLength) == 0
129+
? components.dynamic_link_domain
130+
: std::string(kHttpsPrefix) + components.dynamic_link_domain;
122131
FIRDynamicLinkComponents* fir_components =
123132
[FIRDynamicLinkComponents componentsWithLink:link_url
124-
domain:@(components.dynamic_link_domain)];
133+
domainURIPrefix:@(dynamic_link_domain.c_str())];
125134
{
126135
auto* cpp_params = components.google_analytics_parameters;
127136
if (cpp_params) {

0 commit comments

Comments
 (0)