Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WCM] Implement missing ui + fix ui glitches #943

Merged
merged 3 commits into from
Jul 12, 2023
Merged

Conversation

radeknovis
Copy link
Contributor

No description provided.

@radeknovis radeknovis temporarily deployed to internal July 5, 2023 09:58 — with GitHub Actions Inactive
@radeknovis radeknovis changed the title [WCM] Fix some buttons + ui glitches [WCM] Implement missing ui + fix ui glitches Jul 5, 2023
@radeknovis radeknovis temporarily deployed to internal July 5, 2023 12:29 — with GitHub Actions Inactive
@radeknovis radeknovis temporarily deployed to internal July 6, 2023 08:41 — with GitHub Actions Inactive
@@ -31,3 +31,5 @@ DerivedDataCache
*.ipa
*.zip
test_results/

Sources/WalletConnectModal/Secrets/secrets.json
Copy link
Contributor

@flypaper0 flypaper0 Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where it used? Other team also need to have this file locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only needed if you want to run WalletConnectModal previews. If you don't have it, you will get a somewhat explanatory error to create it.

dependencies: ["QRCode", "WalletConnectSign"]),
dependencies: ["QRCode", "WalletConnectSign"],
exclude: ["Secrets/secrets.json.sample"],
resources: [.copy("Secrets/secrets.json")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange. You're ignoring this file by git, but it's required for WalletConnectModal SDK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ignored, so we don't commit actual secrets. This will pass if the file is not present, but to access the JSON with actual secrets, you need to bundle it with the target.

@@ -34,7 +33,7 @@ struct ModalContainerView_Previews: PreviewProvider {

init() {

let projectId = "9bfe94c9cbf74aaa0597094ef561f703"
let projectId = Secrets.load().projectID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we're taking Project ID from configuration. Why json file is better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configuration.xcconfig is not available from package, only for stuff in the ExampleApp project, or at least I haven't figured out how to read from it.

I'm not too keen on having two approaches how to share secrets/vars either. So any suggestions on how to do this better are more than welcome :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can pass projectID to w3m in a config method like in Relay

    static public func configure(
        relayHost: String = "relay.walletconnect.com",
        projectId: String,
        socketFactory: WebSocketFactory,
        socketConnectionType: SocketConnectionType = .automatic
    )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't believe we missed comiting proj id xd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is how it will be done when actually integrating the modal SDK https://github.com/WalletConnect/WalletConnectSwiftV2/blob/9cead7d4443815687e02cd87ba888130225283fc/Sources/WalletConnectModal/WalletConnectModal.swift#L51-L57C8

but this is in the context of previews within SDK itself so I don't have any projectID injected from elsewhere.

@@ -34,3 +34,15 @@ struct Listing: Codable, Hashable, Identifiable {
let universal: String?
}
}

#if DEBUG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move all stubs in separate folder "Stubs". To not pollute SDK code

@@ -12,7 +12,7 @@ struct AsyncImage<Content>: View where Content: View {

var request = URLRequest(url: url)
request.setValue(ExplorerAPI.userAgent, forHTTPHeaderField: "User-Agent")
request.setValue(WalletConnectModal.config.metadata.name, forHTTPHeaderField: "Referer")
request.setValue(WalletConnectModal.config?.metadata.name, forHTTPHeaderField: "Referer")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you double check that it sets normal string instead of Optional("...")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a unit test for this, verifying that both User-Agent and Referer headers are correctly populated.

@radeknovis radeknovis temporarily deployed to internal July 7, 2023 09:52 — with GitHub Actions Inactive
@radeknovis
Copy link
Contributor Author

@flypaper0 I've tried to address all your comments. Can you have a look again, please?

@radeknovis radeknovis temporarily deployed to internal July 7, 2023 12:33 — with GitHub Actions Inactive
@radeknovis radeknovis merged commit f025099 into develop Jul 12, 2023
8 checks passed
@radeknovis radeknovis deleted the feature/wcm-cleanup branch July 12, 2023 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants