Skip to content

Commit

Permalink
use incubating network transport
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Mar 11, 2024
1 parent 095c5ce commit bd3379c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false
id("com.apollographql.apollo3").version("3.8.2").apply(false)
id("com.apollographql.apollo3").version("4.0.0-beta.5-SNAPSHOT").apply(false)
id("co.touchlab.skie").version("0.6.1").apply(false)
}
16 changes: 12 additions & 4 deletions ios-app/SubscriptionTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -416,7 +417,8 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -443,8 +445,10 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SubscriptionTest/Preview Content\"";
DEVELOPMENT_TEAM = F9RAPYL9T3;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "../shared/build/xcode-frameworks/Debug/iphonesimulator17.2/";
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand Down Expand Up @@ -472,8 +476,10 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SubscriptionTest/Preview Content\"";
DEVELOPMENT_TEAM = F9RAPYL9T3;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "../shared/build/xcode-frameworks/Debug/iphonesimulator17.2/";
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand Down Expand Up @@ -537,6 +543,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = net.mbonnin.subscriptiontest.SubscriptionTestUITests;
Expand All @@ -554,6 +561,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = net.mbonnin.subscriptiontest.SubscriptionTestUITests;
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pluginManagement {
}
mavenCentral()
gradlePluginPortal()
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
dependencyResolutionManagement {
Expand All @@ -17,6 +18,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}

Expand Down
1 change: 1 addition & 0 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ kotlin {

sourceSets.getByName("commonMain").dependencies {
api("com.apollographql.apollo3:apollo-runtime")
api("com.apollographql.apollo3:apollo-websocket-network-transport-incubating")
}
}
14 changes: 8 additions & 6 deletions shared/src/commonMain/kotlin/subscriptiontest/Apollo.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
package subscriptiontest

import com.apollographql.apollo3.ApolloClient
import com.apollographql.apollo3.annotations.ApolloExperimental
import com.apollographql.apollo3.api.ApolloResponse
import com.apollographql.apollo3.network.ws.WebSocketNetworkTransport
import com.apollographql.apollo3.api.Subscription
import com.apollographql.apollo3.network.ws.incubating.SubscriptionWsProtocol
import com.apollographql.apollo3.network.ws.incubating.WebSocketNetworkTransport
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onEach
import subscription.test.GetTimeSubscription

@OptIn(ApolloExperimental::class)
fun currentTime(): Flow<ApolloResponse<GetTimeSubscription.Data>> {
return ApolloClient.Builder()
.serverUrl("https://leonidas-naiwjdzjsq-od.a.run.app/graphql")
.retryOnError { it.operation is Subscription<*> }
.subscriptionNetworkTransport(
WebSocketNetworkTransport.Builder()
.wsProtocol(SubscriptionWsProtocol { null })
.serverUrl("https://leonidas-naiwjdzjsq-od.a.run.app/subscription")
.reopenWhen { throwable, attempt ->
println("Reopening...")
delay(2000)
true
}
.build()
)
.build()
Expand Down

0 comments on commit bd3379c

Please sign in to comment.