Skip to content

Commit

Permalink
xplat/js/react-native-github/packages/react-native/ReactAndroid/src/m…
Browse files Browse the repository at this point in the history
…ain/java/com/facebook/react/common/network/OkHttpCallUtil.java

Summary: Changelog: [Internal]

Differential Revision: D60233395
  • Loading branch information
andrewdacenko authored and facebook-github-bot committed Jul 25, 2024
1 parent eae2240 commit 5f1306e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 38 deletions.
5 changes: 3 additions & 2 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -1957,8 +1957,9 @@ public final class com/facebook/react/common/mapbuffer/WritableMapBuffer : com/f
public final fun put (IZ)Lcom/facebook/react/common/mapbuffer/WritableMapBuffer;
}

public class com/facebook/react/common/network/OkHttpCallUtil {
public static fun cancelTag (Lokhttp3/OkHttpClient;Ljava/lang/Object;)V
public final class com/facebook/react/common/network/OkHttpCallUtil {
public static final field INSTANCE Lcom/facebook/react/common/network/OkHttpCallUtil;
public static final fun cancelTag (Lokhttp3/OkHttpClient;Ljava/lang/Object;)V
}

public class com/facebook/react/config/ReactFeatureFlags {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.common.network

import okhttp3.OkHttpClient

/**
* Helper class that provides the necessary methods for canceling queued and running OkHttp calls
*/
public object OkHttpCallUtil {
@JvmStatic
public fun cancelTag(client: OkHttpClient, tag: Any) {
for (call in client.dispatcher().queuedCalls()) {
if (tag == call.request().tag()) {
call.cancel()
return
}
}
for (call in client.dispatcher().runningCalls()) {
if (tag == call.request().tag()) {
call.cancel()
return
}
}
}
}

0 comments on commit 5f1306e

Please sign in to comment.