Skip to content

Commit 6bac579

Browse files
fabriziocuccifacebook-github-bot
authored andcommitted
Back out "Kotlinify OkHttpCallUtil" (#43857)
Summary: Pull Request resolved: #43857 Changelog: [Internal] There seems to be a weird problem with OkHttpCallUtil: * D55707704 works in fbsource but breaks the CircleCI build with > using 'dispatcher(): Dispatcher' is an error. moved to val * D55744165 fixes the CircleCI build but breaks in fbsource with > cannot access 'dispatcher': it is package-private in 'OkHttpClient' Not sure what's the real fix to migrate `OkHttpCallUtil` to Koltin but at this point is probably safer to backout the original migration! 😥 Reviewed By: cortinico Differential Revision: D55745345 fbshipit-source-id: 3ec6e4d99c950098fae974aa5f0e5be0b6663249
1 parent 0b6b8e2 commit 6bac579

File tree

3 files changed

+38
-35
lines changed

3 files changed

+38
-35
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,9 +1936,8 @@ public final class com/facebook/react/common/mapbuffer/WritableMapBuffer : com/f
19361936
public final fun put (IZ)Lcom/facebook/react/common/mapbuffer/WritableMapBuffer;
19371937
}
19381938

1939-
public final class com/facebook/react/common/network/OkHttpCallUtil {
1940-
public static final field INSTANCE Lcom/facebook/react/common/network/OkHttpCallUtil;
1941-
public static final fun cancelTag (Lokhttp3/OkHttpClient;Ljava/lang/Object;)V
1939+
public class com/facebook/react/common/network/OkHttpCallUtil {
1940+
public static fun cancelTag (Lokhttp3/OkHttpClient;Ljava/lang/Object;)V
19421941
}
19431942

19441943
public class com/facebook/react/config/ReactFeatureFlags {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.react.common.network;
9+
10+
import com.facebook.infer.annotation.Nullsafe;
11+
import okhttp3.Call;
12+
import okhttp3.OkHttpClient;
13+
14+
/**
15+
* Helper class that provides the necessary methods for canceling queued and running OkHttp calls
16+
*/
17+
@Nullsafe(Nullsafe.Mode.LOCAL)
18+
public class OkHttpCallUtil {
19+
20+
private OkHttpCallUtil() {}
21+
22+
public static void cancelTag(OkHttpClient client, Object tag) {
23+
for (Call call : client.dispatcher().queuedCalls()) {
24+
if (tag.equals(call.request().tag())) {
25+
call.cancel();
26+
return;
27+
}
28+
}
29+
for (Call call : client.dispatcher().runningCalls()) {
30+
if (tag.equals(call.request().tag())) {
31+
call.cancel();
32+
return;
33+
}
34+
}
35+
}
36+
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.kt

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)