Brave iOS Browser
C Swift C++ Objective-C HTML JavaScript Other
Latest commit d24396d Jan 16, 2017 @garvankeeley garvankeeley committed on GitHub Add files via upload
Permalink
Failed to load latest commit information.
.github Bug template: add stesp for Web Compat bugs Aug 12, 2016
BraveShareTo Using new conversion script, import a bunch of languages Oct 5, 2016
Client.xcodeproj ad-block lib version: use 2.0.0 Jan 3, 2017
Client Fix #634: stats counter not saving on double tap Dec 29, 2016
ClientTests Merge from firefox master Feb 18, 2016
Crashlytics.framework Crashlytics update to 3.8.1 Sep 20, 2016
Fabric.framework upgrade crashlytics version Aug 26, 2016
L10nSnapshotTests Bug 1245219 - (2/2) L10N Intro Screen Snapshot - Snapshot generation Feb 2, 2016
MarketingUITests Merge from fx master Jan 25, 2016
NativeRefTests Bug 1248990 - Re-record LoginTableViewCell snapshots to reflect new c… Feb 17, 2016
Providers Fix #585: DB Clearing. Apply patches from fx master that ensure safer… Nov 18, 2016
ReadingList Using new conversion script, import a bunch of languages Oct 5, 2016
ReadingListTests Merge from fx master Jan 25, 2016
Shared removed unused l10n files Oct 13, 2016
SharedTests Bug 1223400 - Amend project to use carthage built dynamic frameworks Feb 12, 2016
Storage Fix #642. Pass along folder information (GUID, title) when saving boo… Jan 6, 2017
StorageTests No Bug - Resolved import errors when running tests Feb 16, 2016
ThirdParty remove sqlite test projects Oct 11, 2016
UITests Enable Private Browsing and hookup some test cases Mar 8, 2016
Utils Global Shield Stats on Top Sites Dec 15, 2016
brave Add files via upload Jan 16, 2017
fastlane Bug 1228290 - add ability to take automated snapshots with Fastlane Dec 1, 2015
.gitignore Fix #521, Opt-In Screen layout fixes, including fixes on device rotation Oct 25, 2016
.travis.yml Update .travis.yml Jun 3, 2015
AUTHORS Update AUTHORS Jan 29, 2015
Cartfile Add basic fingerprint shield test using panopticlick Dec 7, 2016
Cartfile.resolved Add basic fingerprint shield test using panopticlick Dec 7, 2016
Client-Bridging-Header.h Update URIFixup and NSURL utilities from fx master Oct 17, 2016
Info.plist Bug 1247624 - Reset snapshot test schemes so that they run properly u… Feb 16, 2016
L10nSnapshotTests-Info.plist Bug 1247624 - Reset snapshot test schemes so that they run properly u… Feb 16, 2016
LICENSE Initial import Nov 4, 2014
README.md update carthage info Oct 20, 2016
carthage.sh Add mixpanel back in Oct 20, 2016
checkout.sh Carthage 0.18 or higher is needed for Xcode8 Sep 30, 2016

README.md

Brave iOS Browser

Download in the App Store

Brave is based on Firefox iOS, most of the Brave-specific code is in the brave dir

These steps should be sufficient to build, but if you need more info, refer to the the Firefox iOS readme

Adding Brave to your app to open links

Either ensure your app supports opening urls in a share menu or use this project https://github.com/brave/ios-open-thirdparty-browser to open links directly.

Setup

The master branch (i.e. the mainline) is Xcode8 + Swift2.3

Install Node.js v5.0.0

Install Carthage: brew install carthage

Do the following commands:

./checkout.sh # builds carthage dependencies
(cd brave && ./setup.sh your.fake.appid) # put in a fake unique app id if you want to build to device
open Client.xcodeproj

build Brave scheme

Note: building your own ad-hoc builds is supported see user device build

Crash reporting using Fabric

To enable, add ~/.brave-fabric-keys with 2 lines, the API key and build secret. Re-run setup.sh and the project will be generated to use Fabric and Crashlytics frameworks.

Tests

Run Product>Test in Xcode to do so. Not all Firefox tests are passing yet.

Contribution Notes

Most of the code is in the brave/ directory. The primary design goal has been to preserve easy merging from Firefox iOS upstream, so hopefully code changes outside of that dir are minimal.

To find changes outside of brave/, look for #if BRAVE / #if !BRAVE (#if/#else/#endif is supported by Swift).

Adding Carthage modules

  1. Add line into Cartfile, run carthage bootstrap to update Cartfile.resolved
  2. Verify that your new module has been added to Cartfile.resolved
  3. Run checkout.sh
  4. In the Xcode Project, go to Client target settings, open the Build Phases tab and add a line such as
$(SRCROOT)/Carthage/Build/iOS/FRAMEWORKNAME.framework

Provisioning Profiles using a Team account

(This section doesn't apply to individual developer accounts, Xcode managed profiles seem to work fine in that case.)

Do not use 'Xcode managed profiles', there is no advantage to this, and debugging problems with that system is a dead end due to lack of transparency in that system.

brave/build-system/profiles has some handy scripts to download the adhoc or developer profiles and install them.

JS Tips

For anyone working with JS in iOS native, I recommend running and debugging your JS in an attached JS console. (Not using an edit/compile/debug cycle in Xcode). When you run from Xcode any iOS web view in the simulator (or attached device), you can then attach from Safari desktop (the Develop menu), and you get a JS console to work in.

We have various JS interpreters available: UIWebView, JavaScriptCore, and WKWebView.

The first is required if we are running JS on the web page, since we are using UIWebView. JavaScriptCore is a stand-alone JS engine that I believe is more up-to-date than UIWebView's. WKWebView will have the most modern JS engine, but requires instantiating a WKWebView for this purpose, which we would prefer to avoid as that is a heavy approach. UIWebView's JS engine is a few years old, and is quite primitive.

None of these are comparable to Safari iOS's JS engine, which is highly up-to-date in its capabilities but is not available to us.

Release Builds

brave/build-system/build-archive.sh does everything. When that completes, the Fabric app detects a new archive and asks to distribute to testers.

Misc Tips

If you get the dreaded "Launch Services Error 0": open ~/Library/Logs/CoreSimulator/CoreSimulator.log for info

Go to the Brave app folder for the most recently run simulator:

cd ~/Library/Developer/CoreSimulator/Devices && cd `ls -t | head -1` && cd data/Containers/Data/Application && cd `find . -iname "*brave*" | head -1 | xargs -I{} dirname {}`