-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(firestore): serverTimestampBehaviour (#9590)
* feat(firestore): add serverTimestampBehaviour to get and snapshot * feat: add iOS support * feat: add web support * feat: add tests * feat: add licence header * feat: add tests * feat: support for namedquery * feat: support for namedquery
- Loading branch information
Showing
26 changed files
with
298 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...in/java/io/flutter/plugins/firebase/firestore/utils/ServerTimestampBehaviorConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2022, the Chromium project authors. Please see the AUTHORS file | ||
* for details. All rights reserved. Use of this source code is governed by a | ||
* BSD-style license that can be found in the LICENSE file. | ||
*/ | ||
|
||
package io.flutter.plugins.firebase.firestore.utils; | ||
|
||
import androidx.annotation.Nullable; | ||
import com.google.firebase.firestore.DocumentSnapshot; | ||
|
||
public class ServerTimestampBehaviorConverter { | ||
public static DocumentSnapshot.ServerTimestampBehavior toServerTimestampBehavior( | ||
@Nullable String serverTimestampBehavior) { | ||
if (serverTimestampBehavior == null) { | ||
return DocumentSnapshot.ServerTimestampBehavior.NONE; | ||
} | ||
switch (serverTimestampBehavior) { | ||
case "estimate": | ||
return DocumentSnapshot.ServerTimestampBehavior.ESTIMATE; | ||
case "previous": | ||
return DocumentSnapshot.ServerTimestampBehavior.PREVIOUS; | ||
case "none": | ||
default: | ||
return DocumentSnapshot.ServerTimestampBehavior.NONE; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.