Skip to content

Commit

Permalink
Add iOS implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
phjardas committed Aug 30, 2024
1 parent 1e48621 commit 84be8d3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/firestore/ios/Plugin/FirebaseFirestore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ import FirebaseFirestore

@objc public func addDocumentSnapshotListener(_ options: AddDocumentSnapshotListenerOptions, completion: @escaping (Result?, Error?) -> Void) {
let reference = options.getReference()
let includeMetadataChanges = options.getIncludeMetadataChanges()
let callbackId = options.getCallbackId()

let listenerRegistration = Firestore.firestore().document(reference).addSnapshotListener { documentSnapshot, error in
let listenerRegistration = Firestore.firestore().document(reference).addSnapshotListener(includeMetadataChanges: includeMetadataChanges) { documentSnapshot, error in
if let error = error {
completion(nil, error)
} else {
Expand All @@ -214,6 +215,7 @@ import FirebaseFirestore
let reference = options.getReference()
let compositeFilter = options.getCompositeFilter()
let queryConstraints = options.getQueryConstraints()
let includeMetadataChanges = options.getIncludeMetadataChanges()
let callbackId = options.getCallbackId()

Task {
Expand All @@ -231,7 +233,7 @@ import FirebaseFirestore
}
}

let listenerRegistration = query.addSnapshotListener { querySnapshot, error in
let listenerRegistration = query.addSnapshotListener(includeMetadataChanges: includeMetadataChanges) { querySnapshot, error in
if let error = error {
completion(nil, error)
} else {
Expand All @@ -250,6 +252,7 @@ import FirebaseFirestore
let reference = options.getReference()
let compositeFilter = options.getCompositeFilter()
let queryConstraints = options.getQueryConstraints()
let includeMetadataChanges = options.getIncludeMetadataChanges()
let callbackId = options.getCallbackId()

Task {
Expand All @@ -267,7 +270,7 @@ import FirebaseFirestore
}
}

let listenerRegistration = query.addSnapshotListener { querySnapshot, error in
let listenerRegistration = query.addSnapshotListener(includeMetadataChanges: includeMetadataChanges) { querySnapshot, error in
if let error = error {
completion(nil, error)
} else {
Expand Down

0 comments on commit 84be8d3

Please sign in to comment.