Revert "Improve protobuf support (#2513)" (#2665)

Summary:
This reverts commit efd75ea435.

Sorry hbmartin! We're running into Kotlin compatibility problems. Your latest library release isn't compatible with Kotlin 1.3 and we can't upgrade just yet because Litho hasn't been able to release in a while. :(

Pull Request resolved: https://github.com/facebook/flipper/pull/2665

Test Plan: _eyes

Differential Revision: D30189360

Pulled By: passy

fbshipit-source-id: c1edbbc496742938579f4e2032a78debe08fcc26
This commit is contained in:
Pascal Hartig
2021-08-09 04:14:50 -07:00
committed by Facebook GitHub Bot
parent 9e0a5484e7
commit fc73e0d4ec
3 changed files with 5 additions and 21 deletions

View File

@@ -25,7 +25,7 @@ android {
implementation project(':network-plugin') implementation project(':network-plugin')
implementation deps.protobuf implementation deps.protobuf
implementation "com.squareup.retrofit2:retrofit:2.9.0" implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.github.hbmartin:protobuf_java_to_protobufjs:0.2.0" implementation "com.github.hbmartin:protobuf_java_to_protobufjs:0.1.0"
compileOnly deps.jsr305 compileOnly deps.jsr305
} }
} }

View File

@@ -63,10 +63,6 @@ export class ProtobufDefinitionsRepository {
} }
} }
public hasDefinition(method: string, path: string): boolean {
return this.rawDefinitions.hasOwnProperty(this.key(method, path));
}
private generateRoots(key: string) { private generateRoots(key: string) {
if (key in this.cachedDecodedDefinitions) { if (key in this.cachedDecodedDefinitions) {
return; return;

View File

@@ -670,11 +670,7 @@ class ProtobufFormatter {
formatRequest(request: Request) { formatRequest(request: Request) {
if ( if (
getHeaderValue(request.requestHeaders, 'content-type') === getHeaderValue(request.requestHeaders, 'content-type') ===
'application/x-protobuf' || 'application/x-protobuf'
this.protobufDefinitionRepository.hasDefinition(
request.method,
request.url,
)
) { ) {
const protobufDefinition = const protobufDefinition =
this.protobufDefinitionRepository.getRequestType( this.protobufDefinitionRepository.getRequestType(
@@ -685,9 +681,7 @@ class ProtobufFormatter {
return ( return (
<Text> <Text>
Could not locate protobuf definition for request body of{' '} Could not locate protobuf definition for request body of{' '}
{request.url} <br /> {request.url}
Please send ProtobufJS definitions with the plugin's
addProtobufDefinitions method.
</Text> </Text>
); );
} }
@@ -710,11 +704,7 @@ class ProtobufFormatter {
if ( if (
getHeaderValue(request.responseHeaders, 'content-type') === getHeaderValue(request.responseHeaders, 'content-type') ===
'application/x-protobuf' || 'application/x-protobuf' ||
request.url.endsWith('.proto') || request.url.endsWith('.proto')
this.protobufDefinitionRepository.hasDefinition(
request.method,
request.url,
)
) { ) {
const protobufDefinition = const protobufDefinition =
this.protobufDefinitionRepository.getResponseType( this.protobufDefinitionRepository.getResponseType(
@@ -725,9 +715,7 @@ class ProtobufFormatter {
return ( return (
<Text> <Text>
Could not locate protobuf definition for response body of{' '} Could not locate protobuf definition for response body of{' '}
{request.url} <br /> {request.url}
Please send ProtobufJS definitions with the plugin's
addProtobufDefinitions method.
</Text> </Text>
); );
} }