• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    Swift
  • License
    Mozilla Public Li...
  • Created over 3 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mozilla's Pocket iOS App, Rebuilt in Swift

Pocket iOS

Welcome to the Next iteration of the Pocket iOS client, currently in development.

Getting Started

Setup Pocket Secrets File

pocket-ios requires a secrets.xcconfig file to run and secrets_test.xcconfig file to test, we have included some mock secrets in the repo but if you are a Mozillan or Pocketeer you can obtain the actual secret keys from the Pocket Team.

External contributors may generate their own Pocket API keys at https://getpocket.com/developer/ though some features (payments, for example) will still not work.

Once obtained you can run the following command from the root directory:

cp Config/secrets.xcconfig.example Config/secrets.xcconfig

Then replace values in Config/secrets.xcconfig with the values you have received.

After you will need to run the API Generation steps below.

Install Docker (Mozillans/Pocketeers Only)

To run our UITests locally, you will need an instance of Snowplow Micro running on your system on port 9090. We use Docker for this purpose. You can install Docker using Homebrew: brew install docker Or you may download it from the Docker website

Once installed you need to provide your Docker username to the iOS lead so they can add you to the Pocket docker Organisation. Once done you can simply run docker compose up in Terminal from the root Pocket directory to run an instance of Snowplow Micro.

###Snowplow Micro Snowplow micro has 4 endpoints of note:

  1. http://localhost:9090/micro/all - Lists the total number of events received and whether they are bad or good.
  2. http://localhost:9090/micro/good - Returns all the good (passed validation) events snowplow received and the data within.
  3. http://localhost:9090/micro/bad - Returns all the bad (failed validation) events snowplow received and the reason why.
  4. http://localhost:9090/micro/reset - Resets snowplow to 0 events received. Should be ran at the start of each test.

[SnowplowMicro](./Tests iOS/Support/SnowplowMicro) class is used to interact with Snowplow and provide helper assertions to make testing events easier.

Pocket Graph (API) Schema

Pocket for iOS uses Apollo client to autogenerate its API schema code. You will need to run the following commands every time the APIs you use change or if you change your API queries.

To Start run the following command:

cd PocketKit/
swift package --allow-writing-to-package-directory apollo-cli-install

Downloading Graph Schema

To download a new version of PocketKit/Sources/Sync/schema.graphqls you can run the following commands:

cd PocketKit/
./apollo-ios-cli fetch-schema

Generating API.swift

To download a new version of PocketKit/Sources/Sync/API.swift you can run the following commands:

cd PocketKit/
./apollo-ios-cli generate

Modifiying GraphQL query/mutation in code

To modify/create a request look into PocketKit/Sources/PocketGraph/user-defined-operations

Any modifications done here and after you generate above will be auto-generated in our codebase for usage.

Previously we used a singleton PocketSource, but we are moving away from that model and instead encourage the adoption of a protocol Service. As an example, you can look at SlateService.

Future

We plan on implementing the following changes in the future:

Setup Fonts

Pocket uses custom fonts: Graphik & Blanco. In order for the styles to present as expected in your local build you need to obtain the font files. Mozillians and Pocketeers can request them from the iOS manager and install them in PocketKit/Sources/Textile/Style/Typography/Fonts

Build Targets

Pocket Kit

PocketKit 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.

Sync

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.

Textile

Textile provides the standard views and styles that can be re-used across all of the Pocket targets we create in the Apple Ecosystem.

Analytics

Analytics provides Pocket's implementation of Snowplow which we use to provide a feedback loop to the Pocket product team into how our features are used.

SaveToPocketKit

SaveToPocketKit 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.

SharedPocketKit

SharedPocketKit is for code that is shared between PocketKit and SaveToPocketKit. It contains code for session management and keychain storage that is used across all apps in the Pocket App Group.

Developing in Pocket

See our Contribution Guide for day-to-day Pocket development guides.

License Acknowledgements

When you add a dependncy we need to ensure that our OpenSource Licenses are up to date with all licenses we are using.

The following are the high level steps to update the notices page:

  1. Install LicensePlist brew install licenseplist
  2. Run license-plist --markdown-path Acknowledgements.markdown
  3. Open an issue on Bedrock with a description and the requested page to update with a link to a document of the generated Acknowledgements.markdown

More Repositories

1

extension-save-to-pocket

Save to Pocket is a browser extension that is used to save pages to a connected Pocket account
JavaScript
270
star
2

Pocket-ObjC-SDK

Headless iOS/Mac SDK for saving stuff to Pocket.
Objective-C
230
star
3

data-flows

Pocket data flows orchestrated using Prefect
Python
42
star
4

terraform-modules

Terraform CDK Modules
TypeScript
41
star
5

pocket-monorepo

Monorepo of all Pocket App Typescript Backend Sevices
TypeScript
38
star
6

extension-pocket-new-tab

Pocket New Tab is a browser extension that serves as a replacement to the default new tab.
JavaScript
32
star
7

recommendation-api

Rank and serve recommendations
Python
25
star
8

proxy-server

Service to deliver sponsored content while preserving privacy
Python
20
star
9

front-end-build-tools

Modified Create React App for use with Pocket extensions
JavaScript
19
star
10

curation-tools-frontend

DEPRECATED
TypeScript
10
star
11

hashicorp-pocket-cdktf

TypeScript
10
star
12

collection-api

The API that manages Pocket's curated collections.
TypeScript
7
star
13

Firefox-Integration-Add-On-Prototype

JavaScript
6
star
14

backend-typescript-template

Template to spin up a new service in Typescript and Pocket's terraform-modules package.
TypeScript
5
star
15

firefox-android-home-recommendations

REST API endpoint for Firefox Android home recommendations
TypeScript
5
star
16

Pocket-iOS-Extension-Tweet-Attribution-Helper

Tweet Attribution is a feature inside of Pocket that enables attaching the original tweet to a saved link from Twitter.
Objective-C
5
star
17

docker-kinesis-agent

Docker container for running AWS Kinesis Agent
Dockerfile
4
star
18

pocket-ff-addon

JavaScript
4
star
19

eslint-config

ESLint Config used across Pocket
JavaScript
2
star
20

annotations-api

Annotations API Subgraph
TypeScript
2
star
21

tsconfig

JavaScript
2
star
22

shared-snowplow-consumer

This is SharedSnowplowConsumer
TypeScript
2
star
23

apollo-utils

Utilities for Apollo gateway and implementing services
TypeScript
2
star
24

curation-admin-tools

a suite of admin tools for the editorial team to curate stories
TypeScript
2
star
25

list-api

TypeScript
2
star
26

curated-corpus-api

TypeScript
2
star
27

cloudwatch-metrics-aggregator

nodejs lib to easily aggregate and process cloudwatch metrics in the background
TypeScript
2
star
28

dynamore

A better query language for DynamoDB
TypeScript
2
star
29

admin-api

TypeScript
2
star
30

fxa-webhook-proxy

Receives FxA events as webhook requests and proxies the requests to the User Service through the Client API.
TypeScript
1
star
31

pocket-event-bridge

This is PocketEventBridge
TypeScript
1
star
32

moz-social-analytics-demo

1
star
33

curation-tools-data-sync

This is CurationToolsDataSync
TypeScript
1
star
34

canary-tests

Contains infrastructure related to AWS Canaries and their test modules. Can be used for health checks and e2e testing.
TypeScript
1
star
35

terraform-pocket-emergency-response

Terraform module for PagerDuty + SNS
HCL
1
star
36

data-product-admin

TypeScript
1
star
37

terraform-modules-site

Documentation for pocket/terraform-modules
1
star
38

backend-benchmarking

Stores utility methods for benchmarking performance of APIs
TypeScript
1
star
39

renovate-config

Renovate config for Pocket
1
star
40

terraform-pocket-metrics-alerting

HCL
1
star
41

terraform-pocket-ecs-autoscale

HCL
1
star
42

data-product-docs

Data product documentation
TypeScript
1
star
43

related-content-api

An API that suggests further content given a specific piece
Python
1
star
44

pocket-android

Pocket Android app
Java
1
star
45

braze-content-proxy

TypeScript
1
star