Skip to content

Commit ce04423

Browse files
committed
Merge remote-tracking branch 'origin/master' into LevelDbDocumentOverlayCache
2 parents cd87b8d + 355e1d1 commit ce04423

File tree

5 files changed

+67
-5
lines changed

5 files changed

+67
-5
lines changed

.github/workflows/zip.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,11 @@ jobs:
199199
mkdir -p "${HOME}"/ios_frameworks/
200200
find "${GITHUB_WORKSPACE}/${FRAMEWORK_DIR}" -name "Firebase*latest.zip" -exec unzip -d "${HOME}"/ios_frameworks/ {} +
201201
- name: Setup Swift Quickstart
202-
run: SAMPLE="$SDK" TARGET="${SDK}Example" scripts/setup_quickstart_framework.sh \
202+
203+
run: SAMPLE="$SDK" TARGET="${SDK}Example" NON_FIREBASE_SDKS="FirebaseRemoteConfigSwift FirebaseSharedSwift" scripts/setup_quickstart_framework.sh \
203204
"${HOME}"/ios_frameworks/Firebase/FirebaseRemoteConfig/* \
204-
"${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/*
205+
"${HOME}"/ios_frameworks/Firebase/FirebaseAnalytics/* \
206+
"${HOME}"/ios_frameworks/Firebase/NonFirebaseSDKs/*
205207
- name: Install Secret GoogleService-Info.plist
206208
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-config.plist.gpg \
207209
quickstart-ios/config/GoogleService-Info.plist "$plist_secret"

FirebaseMessaging/Tests/UnitTestsSwift/FIRMessagingAPITest.swift

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,69 @@ import UserNotifications
2222
// exercised in the integration tests.
2323
func apis() {
2424
let messaging = Messaging.messaging()
25+
let delegate = CustomDelegate()
26+
messaging.delegate = delegate
27+
messaging.isAutoInitEnabled = false
28+
messaging.token(completion: { _, _ in
29+
})
30+
messaging.deleteToken { _ in
31+
}
32+
messaging.retrieveFCMToken(forSenderID: "fakeSenderID") { _, _ in
33+
}
34+
messaging.deleteData { _ in
35+
}
36+
messaging.deleteFCMToken(forSenderID: "fakeSenderID") { _ in
37+
}
2538

2639
if let _ = messaging.apnsToken {}
2740

2841
let apnsToken = Data()
2942
messaging.setAPNSToken(apnsToken, type: .prod)
3043

44+
// Use random to eliminate the warning that we're evaluating to a constant.
45+
let type: MessagingAPNSTokenType = Bool.random() ? .prod : .sandbox
46+
switch type {
47+
case .prod: ()
48+
case .sandbox: ()
49+
case .unknown: ()
50+
// Intentionally leave the warning for not handling unknown values as that's the only way this
51+
// will fail to compile if we add a case.
52+
}
53+
54+
// Use random to eliminate the warning that we're evaluating to a constant.
55+
let messagingError: MessagingError = Bool.random() ? .unknown : .authentication
56+
switch messagingError {
57+
case .unknown: ()
58+
case .authentication: ()
59+
case .noAccess: ()
60+
case .timeout: ()
61+
case .network: ()
62+
case .operationInProgress: ()
63+
case .invalidRequest: ()
64+
case .invalidTopicName: ()
65+
// Intentionally leave the warning for not handling unknown values as that's the only way this
66+
// will fail to compile if we add a case.
67+
}
68+
69+
// Use random to eliminate the warning that we're evaluating to a constant.
70+
let status: MessagingMessageStatus = Bool.random() ? .unknown : .new
71+
switch status {
72+
case .new: ()
73+
case .unknown: ()
74+
// Intentionally leave the warning for not handling unknown values as that's the only way this
75+
// will fail to compile if we add a case.
76+
}
77+
78+
// TODO: Mark the initializer as unavialable, as devs shouldn't be able to instantiate this.
79+
_ = MessagingMessageInfo().status
80+
81+
NotificationCenter.default.post(name: .MessagingRegistrationTokenRefreshed, object: nil)
82+
3183
let topic = "cat_video"
3284
messaging.subscribe(toTopic: topic)
3385
messaging.unsubscribe(fromTopic: topic)
86+
messaging.unsubscribe(fromTopic: topic) { _ in
87+
}
3488

3589
messaging.appDidReceiveMessage([:])
3690

@@ -43,6 +97,10 @@ func apis() {
4397
}
4498
}
4599

100+
class CustomDelegate: NSObject, MessagingDelegate {
101+
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {}
102+
}
103+
46104
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
47105
func apiAsync() async throws {
48106
let messaging = Messaging.messaging()

SwiftDashboard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tasks for additional Swift improvements.
1010
| | AB | An | ApC | ApD | Aut | Cor | Crs | DB | Fst | Fn | IAM | Ins | Msg | MLM | Prf | RC | Str |
1111
| :--- | :--- | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: |
1212
| **Swift Library** |||||||||| 1 ||||||||
13-
| **API Tests** |||||||| 3 | 2 || 2 || 2 | 2 ||||
13+
| **API Tests** |||||||| 3 | 2 || 2 || | 2 ||||
1414
| **async/await** || n/a |||||| 3 ||||||||||
1515
| **Swift Errors** ||||| 4 |||||||||||| 5 |
1616
| **Codable** | n/a | n/a | n/a |n/a | n/a | n/a |n/a ||| 1 | n/a | n/a || n/a | n/a ||n/a |

scripts/build_non_firebase_sdks.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ do
3030
if [ ${sdk} == "FirebaseFirestoreSwift" ]; then
3131
echo "{\"name\":\"FirebaseFirestoreSwift\", \"version\" : \"> 8.2-beta\"}" >> "${ZIP_POD_JSON}"
3232
elif [ ${sdk} == "FirebaseStorageSwift" ]; then
33-
echo "{\"name\":\"FirebaseStorageSwift\", \"version\" : \"> 8.2-beta\"}" >> "${ZIP_POD_JSON}"
33+
echo "{\"name\":\"FirebaseStorageSwift\", \"version\" : \"> 8.12-beta\"}" >> "${ZIP_POD_JSON}"
34+
elif [ ${sdk} == "FirebaseRemoteConfigSwift" ]; then
35+
echo "{\"name\":\"FirebaseRemoteConfigSwift\", \"version\" : \"> 8.12-beta\"}" >> "${ZIP_POD_JSON}"
3436
else
3537
echo "{\"name\":\"${sdk}\"}" >> "${ZIP_POD_JSON}"
3638
fi

scripts/health_metrics/get_updated_files.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ cd scripts/health_metrics/generate_code_coverage_report
3737
# merge commit to the head commit from the target branch.
3838
git diff --name-only remotes/origin/${GITHUB_BASE_REF} ${GITHUB_SHA} > updated_files.txt
3939

40-
if [ -z $spec_output_file] ; then
40+
if [ -z $spec_output_file ] ; then
4141
swift run UpdatedFilesCollector --changed-file-paths updated_files.txt --code-coverage-file-patterns ../file_patterns.json
4242
else
4343
swift run UpdatedFilesCollector --changed-file-paths updated_files.txt --code-coverage-file-patterns ../file_patterns.json --output-sdk-file-url "${spec_output_file}" --exclude-podspecs ${exclude_specs}

0 commit comments

Comments
 (0)