From fac890e8334ab9b40b23fdcc2c8d5fd9360e798c Mon Sep 17 00:00:00 2001 From: Mick MacCallum Date: Mon, 7 Oct 2024 09:30:05 -0400 Subject: [PATCH] test --- Package.swift | 8 +- .../ParraStorefrontWidget.swift | 85 ++++++++++--------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/Package.swift b/Package.swift index 903e4833..08aaef71 100644 --- a/Package.swift +++ b/Package.swift @@ -27,8 +27,8 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/Shopify/mobile-buy-sdk-ios", from: "13.0.0"), - .package(url: "https://github.com/Shopify/checkout-sheet-kit-swift", from: "3.0.4") +// .package(url: "https://github.com/Shopify/mobile-buy-sdk-ios", from: "13.0.0"), +// .package(url: "https://github.com/Shopify/checkout-sheet-kit-swift", from: "3.0.4") ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. @@ -46,8 +46,8 @@ let package = Package( name: "ParraStorefront", dependencies: [ .target(name: "Parra"), - .product(name: "Buy", package: "mobile-buy-sdk-ios"), - .product(name: "ShopifyCheckoutSheetKit", package: "checkout-sheet-kit-swift") +// .product(name: "Buy", package: "mobile-buy-sdk-ios"), +// .product(name: "ShopifyCheckoutSheetKit", package: "checkout-sheet-kit-swift") ], path: "\(iosSdkDir)/Sources/ParraStorefront", resources: [ diff --git a/ios/Sources/ParraStorefront/ParraStorefrontWidget.swift b/ios/Sources/ParraStorefront/ParraStorefrontWidget.swift index 60e40927..d8287268 100644 --- a/ios/Sources/ParraStorefront/ParraStorefrontWidget.swift +++ b/ios/Sources/ParraStorefront/ParraStorefrontWidget.swift @@ -5,22 +5,23 @@ // Created by Mick MacCallum on 10/6/24. // -import Buy import Parra -import ShopifyCheckoutSheetKit import SwiftUI +// import Buy +// import ShopifyCheckoutSheetKit + public struct ParraStorefrontWidget: View { // MARK: - Lifecycle public init() { - let client = Graph.Client( - shopDomain: "", - apiKey: "" - ) - - client.cachePolicy = .cacheFirst(expireIn: 3_600) - self.client = client +// let client = Graph.Client( +// shopDomain: "", +// apiKey: "" +// ) +// +// client.cachePolicy = .cacheFirst(expireIn: 3_600) +// self.client = client } // MARK: - Public @@ -29,47 +30,47 @@ public struct ParraStorefrontWidget: View { Text("Hello, World!") Text(parraAuthState.user?.info.displayName ?? "idk") - Button("Store stuff") { - _Concurrency.Task { - do { - let q = Storefront.buildQuery { $0 - .product { $0 - } - } - try await performQuery(q) - } catch {} - } - } +// Button("Store stuff") { +// _Concurrency.Task { +// do { +// let q = Storefront.buildQuery { $0 +// .product { $0 +// } +// } +// try await performQuery(q) +// } catch {} +// } +// } } // MARK: - Internal - let client: Graph.Client +// let client: Graph.Client @Environment(\.parra) var parra @Environment(\.parraAuthState) var parraAuthState - func performQuery( - _ query: Storefront.QueryRootQuery - ) async throws -> Storefront.QueryRoot { - return try await withCheckedThrowingContinuation { continuation in - let task = client.queryGraphWith(query) { response, error in - if let error { - continuation.resume( - throwing: error - ) - } else if let response { - continuation.resume( - returning: response - ) - } else { +// func performQuery( +// _ query: Storefront.QueryRootQuery +// ) async throws -> Storefront.QueryRoot { +// return try await withCheckedThrowingContinuation { continuation in +// let task = client.queryGraphWith(query) { response, error in +// if let error { // continuation.resume( -// throwing: +// throwing: error // ) - } - } - - task.resume() - } - } +// } else if let response { +// continuation.resume( +// returning: response +// ) +// } else { + //// continuation.resume( + //// throwing: + //// ) +// } +// } +// +// task.resume() +// } +// } }