I'm using the below code to open an URL. Downloading a PDF from React native webview after opening on Android gives:

> 
> "invaild pdf format or corrupted"
> 
> 
> 

but it works fine on iOS.

```
<WebView
        renderToHardwareTextureAndroid={true}
        startInLoadingState={isLoading}
        renderLoading={() => {
          return <BarIndicator color="blue" />;
        }}
        mediaPlaybackRequiresUserAction={false}
        javaScriptEnabled={true}
        source={{
          uri: webviewUrl,
          headers: webviewHeaders,
        }}
        style={drawerWebviewStyles.container}
      />

```
['https://Stackoverflow.com/questions/69084365', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16477546/']
If you want full control over subscriptions, you can create a custom `Publisher` and `Subscription`.

`Publisher`'s `func receive<S: Subscriber>(subscriber: S)` method is the one that gets called when the publisher receives a new subscriber.

If you simply want to make a network request when this happens, you just need to create a custom `Publisher` and return a `Future` that wraps the network request from this method.

In general, you should use `Future` for one-off async events, `PassthroughSubject` is not the ideal `Publisher` to use for network requests.
I finally solved my problem using `Future` instead of `PassthroughtSubject` as Dávid Pásztor suggested. Using `Future` I don't have to worried about `LoginService.login()` logic finish before I create `loginSubscriber`.

`LoginSevice.login()` method:

```
static func login(_ email: String,_ password: String) -> Future<Client, NetworkError>{        
    return Future<Client, NetworkError>{ completion in
        let url = NetworkBuilder.getApiUrlWith(extraPath: "login")

        print(url)

        let parameters: [String: String] = [
            "password": password,
            "login": email
        ]

        print(parameters)

        let request = AF.request(
            url, method: .post,
            parameters: parameters,
            encoder: JSONParameterEncoder.default
        )

        request.validate(statusCode: 200...299)
        request.responseDecodable(of: Client.self) { response in
            if let loginResponse = response.value{//Success
                completion(.success(loginResponse))
            }
            else{//Failure
                completion(.failure(NetworkError.thingsJustHappen))
            }
        }
    }
}

```

Implementation:

```
        loginSubscriber = LoginService.login(email, password)
        .sink { error in
            print("Something bad happened")
            self.isLoading = false
        } receiveValue: { value in
            self.saveClient(value)
            self.client = (value)
            self.isLoading = false
        }

```