Skip to content

Commit d585fca

Browse files
committed
misc database
1 parent e27af73 commit d585fca

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

android/src/main/java/io/fullstack/firestack/database/FirestackDatabase.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.google.firebase.database.DatabaseError;
2121
import com.google.firebase.database.DatabaseReference;
2222
import com.google.firebase.database.FirebaseDatabase;
23+
import com.google.firebase.database.ServerValue;
2324

2425

2526
import io.fullstack.firestack.Utils;
@@ -333,4 +334,11 @@ private FirestackDatabaseReference getDBHandle(final String path,
333334
private String getDBListenerKey(String path, String modifiersString) {
334335
return path + " | " + modifiersString;
335336
}
337+
338+
@Override
339+
public Map<String, Object> getConstants() {
340+
final Map<String, Object> constants = new HashMap<>();
341+
constants.put("serverValueTimestamp", ServerValue.TIMESTAMP);
342+
return constants;
343+
}
336344
}

lib/modules/database/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Snapshot from './snapshot.js';
99
import Reference from './reference.js';
1010
import { promisify } from './../../utils';
1111

12-
const FirestackModule = NativeModules.Firestack;
1312
const FirestackDatabase = NativeModules.FirestackDatabase;
1413
const FirestackDatabaseEvt = new NativeEventEmitter(FirestackDatabase);
1514

@@ -43,9 +42,14 @@ export default class Database extends Base {
4342
this.log.debug('Created new Database instance', this.options);
4443
}
4544

45+
/**
46+
* https://firebase.google.com/docs/reference/js/firebase.database.ServerValue
47+
* @returns {{TIMESTAMP: (*|{[.sv]: string})}}
48+
* @constructor
49+
*/
4650
get ServerValue(): Object {
4751
return {
48-
TIMESTAMP: FirestackModule.serverValueTimestamp || { '.sv': 'timestamp' },
52+
TIMESTAMP: FirestackDatabase.serverValueTimestamp || { '.sv': 'timestamp' },
4953
};
5054
}
5155

0 commit comments

Comments
 (0)