Skip to content

Commit 1562bb7

Browse files
Remove Platform.useProto3Json flag (#2866)
1 parent b107e04 commit 1562bb7

File tree

6 files changed

+5
-18
lines changed

6 files changed

+5
-18
lines changed

packages/firestore/src/api/database.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import { Document, MaybeDocument, NoDocument } from '../model/document';
4444
import { DocumentKey } from '../model/document_key';
4545
import { DeleteMutation, Mutation, Precondition } from '../model/mutation';
4646
import { FieldPath, ResourcePath } from '../model/path';
47-
import { JsonProtoSerializer } from '../remote/serializer';
4847
import { isServerTimestamp } from '../model/server_timestamps';
4948
import { refValue } from '../model/values';
5049
import { PlatformSupport } from '../platform/platform';
@@ -518,9 +517,7 @@ export class Firestore implements firestore.FirebaseFirestore, FirebaseService {
518517
return value;
519518
}
520519
};
521-
const serializer = new JsonProtoSerializer(databaseId, {
522-
useProto3Json: PlatformSupport.getPlatform().useProto3Json
523-
});
520+
const serializer = PlatformSupport.getPlatform().newSerializer(databaseId);
524521
return new UserDataReader(serializer, preConverter);
525522
}
526523

packages/firestore/src/platform/platform.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ export interface Platform {
5151

5252
/** True if and only if the Base64 conversion functions are available. */
5353
readonly base64Available: boolean;
54-
55-
/**
56-
* True if timestamps, bytes and numbers are represented in Proto3 JSON
57-
* format (in-memory and on the wire)
58-
*/
59-
readonly useProto3Json: boolean;
6054
}
6155

6256
/**

packages/firestore/src/platform_browser/browser_platform.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { WebChannelConnection } from './webchannel_connection';
2727
// Implements the Platform API for browsers and some browser-like environments
2828
// (including ReactNative).
2929
export class BrowserPlatform implements Platform {
30-
readonly useProto3Json = true;
3130
readonly base64Available: boolean;
3231

3332
constructor() {

packages/firestore/src/platform_node/node_platform.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { GrpcConnection } from './grpc_connection';
2929
import { loadProtos } from './load_protos';
3030

3131
export class NodePlatform implements Platform {
32-
readonly useProto3Json = false;
3332
readonly base64Available = true;
3433

3534
readonly document = null;

packages/firestore/test/util/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ export function testUserDataWriter(): UserDataWriter {
121121
}
122122

123123
export function testUserDataReader(useProto3Json?: boolean): UserDataReader {
124-
useProto3Json = useProto3Json ?? PlatformSupport.getPlatform().useProto3Json;
124+
const databaseId = new DatabaseId('test-project');
125125
return new UserDataReader(
126-
new JsonProtoSerializer(new DatabaseId('test-project'), { useProto3Json }),
126+
useProto3Json !== undefined
127+
? new JsonProtoSerializer(databaseId, { useProto3Json })
128+
: PlatformSupport.getPlatform().newSerializer(databaseId),
127129
preConverter
128130
);
129131
}

packages/firestore/test/util/test_platform.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,6 @@ export class TestPlatform implements Platform {
223223
this.mockWindow = new FakeWindow(this.mockStorage);
224224
}
225225

226-
get useProto3Json(): boolean {
227-
return this.basePlatform.useProto3Json;
228-
}
229-
230226
get document(): Document | null {
231227
// FakeWindow doesn't support full Document interface.
232228
return this.mockDocument as any; // eslint-disable-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)