From 9cf07bb5db0957199b198dcced63b450e497843f Mon Sep 17 00:00:00 2001 From: jguz-pubnub <102806147+jguz-pubnub@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:38:50 +0200 Subject: [PATCH] Using InputStream instead of URL in StreamUploadContent (#259) --- .../kotlin/com/pubnub/api/endpoints/files/SendFile.ios.kt | 2 +- .../src/iosMain/kotlin/com/pubnub/kmp/abstractions.ios.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/endpoints/files/SendFile.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/endpoints/files/SendFile.ios.kt index 5c33f33a4..47ec51ace 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/endpoints/files/SendFile.ios.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/endpoints/files/SendFile.ios.kt @@ -73,7 +73,7 @@ class SendFileImpl( fileURL = content.url ) is StreamUploadContent -> PubNubInputStreamContentObjC( - stream = NSInputStream(content.url), + stream = content.stream, contentType = content.contentType, contentLength = content.contentLength.toLong() ) diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/kmp/abstractions.ios.kt b/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/kmp/abstractions.ios.kt index f740adc90..e13937fd7 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/kmp/abstractions.ios.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/kmp/abstractions.ios.kt @@ -1,6 +1,7 @@ package com.pubnub.kmp import platform.Foundation.NSData +import platform.Foundation.NSInputStream import platform.Foundation.NSURL actual class CustomObject(val value: Any) @@ -17,7 +18,7 @@ data class FileUploadContent( ) : Uploadable() data class StreamUploadContent( - val url: NSURL, + val stream: NSInputStream, val contentType: String?, val contentLength: Int ) : Uploadable()