aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2017-12-07 14:14:03 -0800
committerGravatar GitHub <noreply@github.com>2017-12-07 14:14:03 -0800
commitc7bade7aba047d52201d650894fd91b198bce3ab (patch)
treefc04239348ec8920d1e609a78de55be234a7641c /Firestore
parent5da88e4b9b5ce9d1aee8611d03946e19bdfa5b65 (diff)
parent293c6e252eda4c1dbc3f7fbbc3956079ad979132 (diff)
Merge pull request #542 from firebase/master
sync firestore-api-changes with master
Diffstat (limited to 'Firestore')
-rw-r--r--Firestore/CMakeLists.txt20
-rw-r--r--Firestore/Source/Public/FirebaseFirestore.h33
-rw-r--r--Firestore/Source/Remote/FSTRemoteStore.m9
-rw-r--r--Firestore/core/CMakeLists.txt16
4 files changed, 75 insertions, 3 deletions
diff --git a/Firestore/CMakeLists.txt b/Firestore/CMakeLists.txt
index 82e1903..6c2a32e 100644
--- a/Firestore/CMakeLists.txt
+++ b/Firestore/CMakeLists.txt
@@ -12,7 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-include(${PROJECT_SOURCE_DIR}/cmake/external/googletest.cmake)
+cmake_minimum_required(VERSION 2.8.11)
+project(firestore)
-add_subdirectory(core/src/firebase/firestore/util)
-add_subdirectory(core/test/firebase/firestore/util)
+set(FIREBASE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
+include("${FIREBASE_SOURCE_DIR}/cmake/utils.cmake")
+
+find_package(GTest REQUIRED)
+
+# We use C++11
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+# Fully qualified imports, project wide
+include_directories("${FIREBASE_SOURCE_DIR}")
+
+enable_testing()
+add_subdirectory(core)
diff --git a/Firestore/Source/Public/FirebaseFirestore.h b/Firestore/Source/Public/FirebaseFirestore.h
new file mode 100644
index 0000000..ff110fd
--- /dev/null
+++ b/Firestore/Source/Public/FirebaseFirestore.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "FIRCollectionReference.h"
+#import "FIRDocumentChange.h"
+#import "FIRDocumentReference.h"
+#import "FIRDocumentSnapshot.h"
+#import "FIRFieldPath.h"
+#import "FIRFieldValue.h"
+#import "FIRFirestore.h"
+#import "FIRFirestoreErrors.h"
+#import "FIRFirestoreSettings.h"
+#import "FIRGeoPoint.h"
+#import "FIRListenerRegistration.h"
+#import "FIRQuery.h"
+#import "FIRQuerySnapshot.h"
+#import "FIRSetOptions.h"
+#import "FIRSnapshotMetadata.h"
+#import "FIRTransaction.h"
+#import "FIRWriteBatch.h"
diff --git a/Firestore/Source/Remote/FSTRemoteStore.m b/Firestore/Source/Remote/FSTRemoteStore.m
index f7c3e57..063e487 100644
--- a/Firestore/Source/Remote/FSTRemoteStore.m
+++ b/Firestore/Source/Remote/FSTRemoteStore.m
@@ -110,6 +110,9 @@ static const int kOnlineAttemptsBeforeFailure = 2;
/** A count of consecutive failures to open the stream. */
@property(nonatomic, assign) int watchStreamFailures;
+/** Whether the client should fire offline warning. */
+@property(nonatomic, assign) BOOL shouldWarnOffline;
+
#pragma mark Write Stream
// The writeStream is null when the network is disabled. The non-null check is performed by
// isNetworkEnabled.
@@ -146,6 +149,7 @@ static const int kOnlineAttemptsBeforeFailure = 2;
_lastBatchSeen = kFSTBatchIDUnknown;
_watchStreamOnlineState = FSTOnlineStateUnknown;
+ _shouldWarnOffline = YES;
_pendingWrites = [NSMutableArray array];
}
return self;
@@ -157,6 +161,7 @@ static const int kOnlineAttemptsBeforeFailure = 2;
}
- (void)setOnlineStateToHealthy {
+ self.shouldWarnOffline = NO;
[self updateAndNotifyAboutOnlineState:FSTOnlineStateHealthy];
}
@@ -179,6 +184,10 @@ static const int kOnlineAttemptsBeforeFailure = 2;
} else {
self.watchStreamFailures++;
if (self.watchStreamFailures >= kOnlineAttemptsBeforeFailure) {
+ if (self.shouldWarnOffline) {
+ FSTWarn(@"Could not reach Firestore backend.");
+ self.shouldWarnOffline = NO;
+ }
[self updateAndNotifyAboutOnlineState:FSTOnlineStateFailed];
}
}
diff --git a/Firestore/core/CMakeLists.txt b/Firestore/core/CMakeLists.txt
new file mode 100644
index 0000000..c49b6db
--- /dev/null
+++ b/Firestore/core/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright 2017 Google
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+add_subdirectory(src/firebase/firestore/util)
+add_subdirectory(test/firebase/firestore/util)