|
1 |
| -# Pocket iOS |
| 1 | +# Pocket iOS |
| 2 | + |
| 3 | +Welcome to the Next iteration of the Pocket iOS client, currently in development. |
| 4 | + |
| 5 | +# Getting Started |
| 6 | + |
| 7 | +## Setup Pocket Secrets File |
| 8 | + |
| 9 | +To develop Pocket for iOS, you need to first obtain a 1st party Pocket consumer key, which is available to internal Pocket & Mozilla Employees. |
| 10 | + |
| 11 | +Once obtained you can run the following command from the root directory: |
| 12 | + |
| 13 | +``` |
| 14 | +cp Config/secrets.xcconfig.example Config/secrets.xcconfig |
| 15 | +``` |
| 16 | + |
| 17 | +Then replace values in `Config/secrets.xcconfig` with the values you have received. |
| 18 | + |
| 19 | +## Pocket Graph (API) Schema |
| 20 | + |
| 21 | +Pocket for iOS uses an autogenerated API.swift file that is created by the Apollo CodeGen target. |
| 22 | + |
| 23 | +### Downloading Graph Schema |
| 24 | + |
| 25 | +To download a new version of [`PocketKit/Sources/Sync/schema.graphqls`](./PocketKit/Sources/Sync/schema.graphqls) you can run the following commands: |
| 26 | + |
| 27 | +```bash |
| 28 | +cd PocketKit/Sources/ApolloCodegen/ |
| 29 | +swift run ApolloCodegen download-schema |
| 30 | +``` |
| 31 | + |
| 32 | +### Generating API.swift |
| 33 | + |
| 34 | +To download a new version of [`PocketKit/Sources/Sync/API.swift`](./PocketKit/Sources/Sync/API.swift) you can run the following commands: |
| 35 | + |
| 36 | +```bash |
| 37 | +cd PocketKit/Sources/ApolloCodegen/ |
| 38 | +swift run ApolloCodegen generate |
| 39 | +``` |
| 40 | + |
| 41 | +### Future |
| 42 | + |
| 43 | +We plan on implementing the following changes in the future: |
| 44 | + |
| 45 | +- Ensure that the [`PocketKit/Sources/Sync/schema.graphqls`](./PocketKit/Sources/Sync/schema.graphqls) and [`PocketKit/Sources/Sync/API.swift`](./PocketKit/Sources/Sync/API.swift) are generated on demand at build time. |
| 46 | + - Blocked by needing [Swift Build Tool support in Apollo](https://github.com/apollographql/apollo-ios/pull/2464) |
| 47 | + |
| 48 | +## Build Targets |
| 49 | + |
| 50 | +### Apollo CodeGen |
| 51 | + |
| 52 | +Apollo CodeGen is a build target setup to download and generate the GraphQL schemas provided by the [Pocket Graph](https://github.com/Pocket/client-api). |
| 53 | + |
| 54 | +How to use it can be seen in [Generating API Schema](#Generating API Schema) above. |
| 55 | + |
| 56 | +### Pocket Kit |
| 57 | + |
| 58 | +Pocket Kit is the foundation of all of Pocket. Pocket is purposefully abstracted into a Kit so that we can define multiple targets in the Apple Ecosystem and still use the same code base. Here you can find the view controllers, app delegates and most entrypoints into the Pocket application. |
| 59 | + |
| 60 | +### Sync |
| 61 | + |
| 62 | +Sync is the main API & Core Data layer that Pocket is built on. This library provides the work needed to communicate with the Pocket API and our Offline storage layer, backed by CoreData. |
| 63 | + |
| 64 | +### Textile |
| 65 | + |
| 66 | +Textile provides the standard views and styles that can be re-used across all of the Pocket targets we create in the Apple Ecosystem. |
| 67 | + |
| 68 | +### Analytics |
| 69 | + |
| 70 | +Analytics provides Pocket's implementation of [Snowplow](https://github.com/snowplow/) which we use to provide a feedback loop to the Pocket product team into how our features are used. |
| 71 | + |
| 72 | +### Save To Pocket Kit |
| 73 | + |
| 74 | +Save to Pocket Kit is the code base needed to make the Pocket Share Extension function and is embeded in the SaveToPocket Extension that enables you to Save to Pocket from other applications. |
| 75 | + |
| 76 | +### Shared Pocket Kit |
| 77 | + |
| 78 | +Shared Pocket Kit contains the main bits for session management and keychain storage that is used across all apps in the Pocket App Group. |
| 79 | + |
| 80 | +## Developing in Pocket |
| 81 | + |
| 82 | +### Commit strategy |
| 83 | + |
| 84 | +We prefer to keep out commit history linear (meaning avoiding noisy merge |
| 85 | +commits). To keep your branch up to date, follow these steps: |
| 86 | + |
| 87 | +```bash |
| 88 | +# while on your PR branch |
| 89 | +git checkout develop |
| 90 | +git pull --rebase |
| 91 | +git checkout my-pr-branch |
| 92 | +git rebase develop |
| 93 | +git push origin my-pr-branch --force[-with-lease] |
| 94 | +``` |
0 commit comments