/browser-ios

Primary LanguageSwiftMozilla Public License 2.0MPL-2.0

DEPRECATED - Cliqz for iOS version 1.x

Current release version is built from https://github.com/cliqz/user-agent-ios

Cliqz for iOS

Download on the App Store.

This branch

This branch is for mainline development.

Building the code

  1. Install the latest Xcode developer tools from Apple.
  2. Install Carthage
brew update
brew install carthage
  1. Clone the repository:
git clone https://github.com/mozilla/firefox-ios
  1. Pull in the project dependencies:
cd browser-ios
sh ./bootstrap.sh
  1. Get dependencies for react-native:
npm install
pod install
  1. Build react-native bundle
npm run dev-bundle
  1. Open Client.xcodeproj in Xcode.
  2. Build the Fennec scheme in Xcode.

It is possible to use App Code instead of Xcode, but you will still require the Xcode developer tools.

React Native

This branch uses react-native for background javascript. The bootstrap setup will automatically setup the react-native environment, and create a XCode workspace which you should use to open the project.

React debug tools

You can enable extra debug tools for React by passing a DEBUG flag to the react module:

  1. In the Pods.xcodeproj go to build settings
  2. Under Preprocessor Macros add a DEBUG=1 option for the Fennec build.
  3. Now React debug options will be available after a 'shake' gesture in the app.

Developing JS code

By default React uses the jsengine.bundle.js code bundle to run. In order to develop you can use the react-native command line tools to auto re-generate this bundle when you change the code.

  1. Start react-native dev server
npm run dev-server
  1. Configure react to use the debug server: in Client.xcodeproj under build settings, go to 'Other Swift Flags' and add -DReact_Debug to the Fennec flags.

  2. Now the app will load code provided by the bundler when starting.

  3. Checkout a copy of browser-core (Cliqzers, use navigation-extension for non-release versions).

  4. Get browser-core dependencies::

cd /path/to/browser-core
./fern.js install
  1. Build browser-core with the react-native.json config, and output to node_modules for browser-ios:
CLIQZ_OUTPUT_PATH=/path/to/browser-ios/node_modules/browser-core/build/ ./fern.js serve configs/react-native.json

With this workflow, any code changes will be automatically rebuild, then you can reload the js bundle in the app (running in the emulator) to see the changes.

Debugging JS code

The Cliqz extension modules are exposed to debuggers via the app global variable. You can use this as an entry point to inspect the state of the app.

Creating a new bundle

You can create a new js bundle using the react-native cli:

npm run dev-bundle

Contributor guidelines

Swift style

Whitespace

  • New code should not contain any trailing whitespace.
  • We recommend enabling both the "Automatically trim trailing whitespace" and "Including whitespace-only lines" preferences in Xcode (under Text Editing).
  • git rebase --whitespace=fix can also be used to remove whitespace from your commits before issuing a pull request.

Commits

  • Each commit should have a single clear purpose. If a commit contains multiple unrelated changes, those changes should be split into separate commits.
  • If a commit requires another commit to build properly, those commits should be squashed.
  • Follow-up commits for any review comments should be squashed. Do not include "Fixed PR comments", merge commits, or other "temporary" commits in pull requests.