-
Notifications
You must be signed in to change notification settings - Fork 2
feat(mobile-ios): GraphQL client and codegen #116
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
04c186b
chore(ios): add Apollo iOS dependency and codegen config
Ur-imazing 1d7d4c5
feat(ios): add GetWatchExperience query and generated types
Ur-imazing 5e5f4a7
feat(ios): add GraphQLContentClient adapter for ContentClient
Ur-imazing eeedf0c
docs(ios): add GraphQL and codegen section to readme, ignore Apollo C…
Ur-imazing 0cf6024
fix(ci): pass STRAPI_API_TOKEN and NEXT_PUBLIC_GRAPHQL_URL to web bui…
Ur-imazing 2a3b753
chore(mobile-ios): codegen cwd requirement in readme, iOS-only package
Ur-imazing e95cc9b
fix(mobile-ios): document stubbed body/state, only use non-empty Prom…
Ur-imazing da2260a
fix(mobile-ios): derive state from publishedAt, document stubbed body
Ur-imazing 87878bc
revert(ci): remove .env.local workaround from build step
Ur-imazing 20ac8a9
feat(mobile-ios): add init(apollo:) for DI and fix SwiftLint in Graph…
Ur-imazing 369ae3f
feat(mobile-ios): test call, Strapi token from .env at build, GraphQL…
Ur-imazing 42aa770
chore(mobile-ios): debug vs release info plists for ATS and app store
Ur-imazing ce8837e
chore(mobile-ios): exclude generated code from swiftlint
Ur-imazing cae66e8
fix(mobile-ios): address CodeRabbit review
Ur-imazing 383815e
fix(mobile-ios): address CodeRabbit — no token in binary, GraphQL URL…
Ur-imazing 06aa284
fix(mobile-ios): restore Debug-only token from apps/cms/.env for Curs…
Ur-imazing d814e2d
refactor(mobile-ios): move content wiring out of ForgeApp into factory
Ur-imazing f66c004
feat(mobile-ios): enforce MVVM with WatchHomeViewModel and Data/ViewM…
Ur-imazing 5b809aa
docs(mobile-ios): document MVVM and ForgeMobile layout in README
Ur-imazing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Apollo iOS CLI symlink (created by apollo-cli-install) | ||
| apollo-ios-cli |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| excluded: | ||
| - .build | ||
| # Apollo codegen output; do not edit | ||
| - Sources/ForgeMobile/Generated | ||
| # Build-generated token from apps/cms/.env | ||
| - App/ForgeApp/Generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import Foundation | ||
| import ForgeMobile | ||
|
|
||
| /// Builds the app's `ContentRepository` using GraphQL endpoint from Info.plist and optional bearer token. | ||
| enum AppContentRepositoryFactory { | ||
| /// GraphQL endpoint from Info.plist (GraphQLEndpoint). Debug falls back to localhost; Release requires a valid value. | ||
| private static var graphQLURL: URL { | ||
| let key = "GraphQLEndpoint" | ||
| let raw = Bundle.main.object(forInfoDictionaryKey: key) as? String | ||
| let trimmed = raw?.trimmingCharacters(in: .whitespacesAndNewlines) | ||
| if let endpointString = trimmed, !endpointString.isEmpty, let url = URL(string: endpointString) { | ||
| return url | ||
| } | ||
| #if DEBUG | ||
| return URL(string: "http://localhost:1337/graphql")! | ||
| #else | ||
| fatalError("\(key) must be set in Info-Release.plist for production builds.") | ||
| #endif | ||
| } | ||
|
|
||
| static func makeContentRepository() -> ContentRepository { | ||
| let token = ProcessInfo.processInfo.environment["STRAPI_FULL_ACCESS_TOKEN"] | ||
| .flatMap { $0.isEmpty ? nil : $0 } | ||
| ?? kStrapiFullAccessToken | ||
| let client = GraphQLContentClient(endpoint: graphQLURL, bearerToken: token) | ||
| return ContentRepository(client: client) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>GraphQLEndpoint</key> | ||
| <string>http://localhost:1337/graphql</string> | ||
| <key>NSAppTransportSecurity</key> | ||
| <dict> | ||
| <key>NSExceptionDomains</key> | ||
| <dict> | ||
| <key>localhost</key> | ||
| <dict> | ||
| <key>NSExceptionAllowsInsecureHTTPLoads</key> | ||
| <true/> | ||
| </dict> | ||
| </dict> | ||
| </dict> | ||
| </dict> | ||
| </plist> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>GraphQLEndpoint</key> | ||
| <string></string> | ||
| </dict> | ||
| </plist> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| query GetWatchExperience( | ||
| $locale: I18NLocaleCode! | ||
| $filters: ExperienceFiltersInput! | ||
| ) { | ||
| experiences(filters: $filters, locale: $locale) { | ||
| documentId | ||
| slug | ||
| publishedAt | ||
| sections { | ||
| ... on ComponentSectionsMediaCollection { | ||
| id | ||
| title | ||
| subtitle | ||
| mediaCollectionDescription: description | ||
| categoryLabel | ||
| mediaCollectionCtaLink: ctaLink | ||
| showItemNumbers | ||
| variant | ||
| } | ||
| ... on ComponentSectionsPromoBanner { | ||
| id | ||
| promoBannerHeading: heading | ||
| promoBannerDescription: description | ||
| intro | ||
| promoBannerCtaLink: ctaLink | ||
| } | ||
| ... on ComponentSectionsInfoBlocks { | ||
| id | ||
| infoBlocksHeading: heading | ||
| intro | ||
| infoBlocksDescription: description | ||
| blocks { | ||
| id | ||
| title | ||
| description | ||
| icon | ||
| } | ||
| } | ||
| ... on ComponentSectionsCta { | ||
| id | ||
| ctaHeading: heading | ||
| body | ||
| buttonLabel | ||
| buttonLink | ||
| } | ||
| } | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.