Skip to content

Commit 839cc6b

Browse files
authored
Cherry picks and versions for Firestore 8.9.1 (#8905)
1 parent 0fa1b8e commit 839cc6b

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

Firebase.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Simplify your app development, grow your user base, and monetize more effectivel
141141

142142
s.subspec 'Firestore' do |ss|
143143
ss.dependency 'Firebase/CoreOnly'
144-
ss.dependency 'FirebaseFirestore', '~> 8.9.0'
144+
ss.dependency 'FirebaseFirestore', '~> 8.9.1'
145145
end
146146

147147
s.subspec 'Functions' do |ss|

FirebaseFirestore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'FirebaseFirestore'
3-
s.version = '8.9.0'
3+
s.version = '8.9.1'
44
s.summary = 'Google Cloud Firestore'
55

66
s.description = <<-DESC

Firestore/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v8.9.1
2+
- [fixed] Fixed a bug in the AppCheck integration that caused the SDK to respond
3+
to unrelated notifications (#8895).
4+
15
# v8.9.0
26
- [added] Added support for Firebase AppCheck.
37
- [fixed] Fix a crash if `[FIRTransaction getDocument]` was called after

Firestore/core/src/credentials/firebase_app_check_credentials_provider_apple.mm

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131
FirebaseAppCheckCredentialsProvider::FirebaseAppCheckCredentialsProvider(
3232
FIRApp* app, id<FIRAppCheckInterop> app_check) {
3333
contents_ = std::make_shared<Contents>(app, app_check);
34-
std::weak_ptr<Contents> weak_contents = contents_;
3534

35+
if (app_check == nil) {
36+
return;
37+
}
38+
39+
std::weak_ptr<Contents> weak_contents = contents_;
3640
app_check_listener_handle_ = [[NSNotificationCenter defaultCenter]
3741
addObserverForName:[app_check tokenDidChangeNotificationName]
3842
object:nil
@@ -73,20 +77,17 @@
7377

7478
void FirebaseAppCheckCredentialsProvider::GetToken(
7579
TokenListener<std::string> completion) {
76-
HARD_ASSERT(app_check_listener_handle_,
77-
"GetToken cannot be called after listener removed.");
78-
79-
void (^get_token_callback)(id<FIRAppCheckTokenResultInterop>) =
80-
^(id<FIRAppCheckTokenResultInterop> result) {
81-
if (result.error != nil) {
82-
LOG_WARN("AppCheck failed: '%s'",
83-
util::MakeString(result.error.localizedDescription));
84-
}
85-
completion(util::MakeString(result.token)); // Always return token
86-
};
87-
8880
std::weak_ptr<Contents> weak_contents = contents_;
8981
if (contents_->app_check) {
82+
void (^get_token_callback)(id<FIRAppCheckTokenResultInterop>) =
83+
^(id<FIRAppCheckTokenResultInterop> result) {
84+
if (result.error != nil) {
85+
LOG_WARN("AppCheck failed: '%s'",
86+
util::MakeString(result.error.localizedDescription));
87+
}
88+
completion(util::MakeString(result.token)); // Always return token
89+
};
90+
9091
// Retrieve a cached or generate a new FAC Token. If forcingRefresh == YES
9192
// always generates a new token and updates the cache.
9293
[contents_->app_check getTokenForcingRefresh:force_refresh_
@@ -106,11 +107,12 @@
106107
// Fire initial event.
107108
change_listener(contents_->current_token);
108109
} else {
109-
HARD_ASSERT(app_check_listener_handle_, "removed change_listener twice!");
110110
HARD_ASSERT(change_listener_, "change_listener removed without being set!");
111-
[[NSNotificationCenter defaultCenter]
112-
removeObserver:app_check_listener_handle_];
113-
app_check_listener_handle_ = nil;
111+
if (app_check_listener_handle_) {
112+
[[NSNotificationCenter defaultCenter]
113+
removeObserver:app_check_listener_handle_];
114+
app_check_listener_handle_ = nil;
115+
}
114116
}
115117

116118
change_listener_ = change_listener;

0 commit comments

Comments
 (0)