Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Pod::Spec.new do |s|
s.license = { :file => '../LICENSE' }
s.authors = 'The Chromium Authors'
s.source = { :path => '.' }
s.source_files = 'cloud_firestore/Sources/cloud_firestore/**/*.{h,m,mm}'
s.public_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Public/**/*.h'
s.private_header_files = 'cloud_firestore/Sources/cloud_firestore/include/Private/**/*.h'
s.source_files = 'cloud_firestore/Sources/**/*.{swift,h,m,mm}'
s.public_header_files = 'cloud_firestore/Sources/cloud_firestore_objc/include/*.h'

s.swift_version = '5.0'
s.ios.deployment_target = '15.0'
s.dependency 'Flutter'

Expand All @@ -36,7 +36,6 @@ Pod::Spec.new do |s|

s.static_framework = true
s.pod_target_xcconfig = {
'GCC_PREPROCESSOR_DEFINITIONS' => "LIBRARY_VERSION=\\\"#{library_version}\\\" LIBRARY_NAME=\\\"flutter-fire-fst\\\"",
'DEFINES_MODULE' => 'YES'
}
end
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,30 @@ let package = Package(
.package(name: "FlutterFramework", path: "../FlutterFramework"),
],
targets: [
// SPM does not allow mixing Swift and ObjC in a single target.
.target(
name: "cloud_firestore_objc",
dependencies: [
.product(name: "FirebaseFirestore", package: "firebase-ios-sdk")
],
path: "Sources/cloud_firestore_objc",
publicHeadersPath: "include",
cSettings: [
.headerSearchPath("include")
]
),
.target(
name: "cloud_firestore",
dependencies: [
"cloud_firestore_objc",
.product(name: "FirebaseFirestore", package: "firebase-ios-sdk"),
.product(name: "firebase-core", package: "firebase_core"),
.product(name: "FlutterFramework", package: "FlutterFramework"),
],
path: "Sources/cloud_firestore",
resources: [
.process("Resources")
],
cSettings: [
.headerSearchPath("include/cloud_firestore/Private"),
.headerSearchPath("include/cloud_firestore/Public"),
.define("LIBRARY_VERSION", to: "\"\(libraryVersion)\""),
.define("LIBRARY_NAME", to: "\"flutter-fire-fst\""),
]
)
),
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Auto-generated file. Do not edit.
public let versionNumber = "6.8.0"

let kFLTFirebaseFirestoreChannelName = "plugins.flutter.io/firebase_firestore"
let kFLTFirebaseFirestoreQuerySnapshotEventChannelName =
"plugins.flutter.io/firebase_firestore/query"
let kFLTFirebaseFirestoreDocumentSnapshotEventChannelName =
"plugins.flutter.io/firebase_firestore/document"
let kFLTFirebaseFirestoreSnapshotsInSyncEventChannelName =
"plugins.flutter.io/firebase_firestore/snapshotsInSync"
let kFLTFirebaseFirestoreTransactionChannelName =
"plugins.flutter.io/firebase_firestore/transaction"
let kFLTFirebaseFirestoreLoadBundleChannelName =
"plugins.flutter.io/firebase_firestore/loadBundle"
let kFirebaseFirestoreLibraryName = "flutter-fire-fst"
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import FirebaseFirestore
import Foundation

#if canImport(firebase_core)
import firebase_core
#else
import firebase_core_shared
#endif

#if os(iOS)
import Flutter
#elseif os(macOS)
import FlutterMacOS
#endif

final class DocumentSnapshotStreamHandler: NSObject, FlutterStreamHandler {
private let firestore: Firestore
private let reference: DocumentReference
private let includeMetadataChanges: Bool
private let serverTimestampBehavior: FirebaseFirestore.ServerTimestampBehavior
private let source: FirebaseFirestore.ListenSource
private var listenerRegistration: ListenerRegistration?

init(
firestore: Firestore,
reference: DocumentReference,
includeMetadataChanges: Bool,
serverTimestampBehavior: FirebaseFirestore.ServerTimestampBehavior,
source: FirebaseFirestore.ListenSource
) {
self.firestore = firestore
self.reference = reference
self.includeMetadataChanges = includeMetadataChanges
self.serverTimestampBehavior = serverTimestampBehavior
self.source = source
}

func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink)
-> FlutterError?
{
let options = SnapshotListenOptions()
.withIncludeMetadataChanges(includeMetadataChanges)
.withSource(source)

listenerRegistration = reference.addSnapshotListener(options: options) {
[serverTimestampBehavior] snapshot, error in
if let error {
let (code, message) = FirebaseFirestoreUtils.errorCodeAndMessage(from: error)
DispatchQueue.main.async {
events(
FLTFirebasePlugin.createFlutterError(
fromCode: code,
message: message,
optionalDetails: ["code": code, "message": message],
andOptionalNSError: error as NSError
)
)
}
} else if let snapshot {
DispatchQueue.main.async {
events(
PigeonParser.toPigeonDocumentSnapshot(
snapshot, serverTimestampBehavior: serverTimestampBehavior
)
)
}
}
}
return nil
}

func onCancel(withArguments arguments: Any?) -> FlutterError? {
listenerRegistration?.remove()
listenerRegistration = nil
return nil
}
}

This file was deleted.

This file was deleted.

Loading
Loading