├── LICENSE ├── OpenInFirefoxClient-Bridging-Header.h ├── OpenInFirefoxClient.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── bmunar.xcuserdatad │ └── xcschemes │ ├── OpenInFirefoxClient.xcscheme │ └── xcschememanagement.plist ├── OpenInFirefoxClient ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-76.png │ │ └── Icon-76@2x.png ├── Info.plist ├── OpenInFirefoxControllerObjC.h ├── OpenInFirefoxControllerObjC.m ├── OpenInFirefoxControllerSwift.swift └── ViewController.swift └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License, version 2.0 2 | 3 | 1. Definitions 4 | 5 | 1.1. "Contributor" 6 | 7 | means each individual or legal entity that creates, contributes to the 8 | creation of, or owns Covered Software. 9 | 10 | 1.2. "Contributor Version" 11 | 12 | means the combination of the Contributions of others (if any) used by a 13 | Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | 17 | means Covered Software of a particular Contributor. 18 | 19 | 1.4. "Covered Software" 20 | 21 | means Source Code Form to which the initial Contributor has attached the 22 | notice in Exhibit A, the Executable Form of such Source Code Form, and 23 | Modifications of such Source Code Form, in each case including portions 24 | thereof. 25 | 26 | 1.5. "Incompatible With Secondary Licenses" 27 | means 28 | 29 | a. that the initial Contributor has attached the notice described in 30 | Exhibit B to the Covered Software; or 31 | 32 | b. that the Covered Software was made available under the terms of 33 | version 1.1 or earlier of the License, but not also under the terms of 34 | a Secondary License. 35 | 36 | 1.6. "Executable Form" 37 | 38 | means any form of the work other than Source Code Form. 39 | 40 | 1.7. "Larger Work" 41 | 42 | means a work that combines Covered Software with other material, in a 43 | separate file or files, that is not Covered Software. 44 | 45 | 1.8. "License" 46 | 47 | means this document. 48 | 49 | 1.9. "Licensable" 50 | 51 | means having the right to grant, to the maximum extent possible, whether 52 | at the time of the initial grant or subsequently, any and all of the 53 | rights conveyed by this License. 54 | 55 | 1.10. "Modifications" 56 | 57 | means any of the following: 58 | 59 | a. any file in Source Code Form that results from an addition to, 60 | deletion from, or modification of the contents of Covered Software; or 61 | 62 | b. any new file in Source Code Form that contains any Covered Software. 63 | 64 | 1.11. "Patent Claims" of a Contributor 65 | 66 | means any patent claim(s), including without limitation, method, 67 | process, and apparatus claims, in any patent Licensable by such 68 | Contributor that would be infringed, but for the grant of the License, 69 | by the making, using, selling, offering for sale, having made, import, 70 | or transfer of either its Contributions or its Contributor Version. 71 | 72 | 1.12. "Secondary License" 73 | 74 | means either the GNU General Public License, Version 2.0, the GNU Lesser 75 | General Public License, Version 2.1, the GNU Affero General Public 76 | License, Version 3.0, or any later versions of those licenses. 77 | 78 | 1.13. "Source Code Form" 79 | 80 | means the form of the work preferred for making modifications. 81 | 82 | 1.14. "You" (or "Your") 83 | 84 | means an individual or a legal entity exercising rights under this 85 | License. For legal entities, "You" includes any entity that controls, is 86 | controlled by, or is under common control with You. For purposes of this 87 | definition, "control" means (a) the power, direct or indirect, to cause 88 | the direction or management of such entity, whether by contract or 89 | otherwise, or (b) ownership of more than fifty percent (50%) of the 90 | outstanding shares or beneficial ownership of such entity. 91 | 92 | 93 | 2. License Grants and Conditions 94 | 95 | 2.1. Grants 96 | 97 | Each Contributor hereby grants You a world-wide, royalty-free, 98 | non-exclusive license: 99 | 100 | a. under intellectual property rights (other than patent or trademark) 101 | Licensable by such Contributor to use, reproduce, make available, 102 | modify, display, perform, distribute, and otherwise exploit its 103 | Contributions, either on an unmodified basis, with Modifications, or 104 | as part of a Larger Work; and 105 | 106 | b. under Patent Claims of such Contributor to make, use, sell, offer for 107 | sale, have made, import, and otherwise transfer either its 108 | Contributions or its Contributor Version. 109 | 110 | 2.2. Effective Date 111 | 112 | The licenses granted in Section 2.1 with respect to any Contribution 113 | become effective for each Contribution on the date the Contributor first 114 | distributes such Contribution. 115 | 116 | 2.3. Limitations on Grant Scope 117 | 118 | The licenses granted in this Section 2 are the only rights granted under 119 | this License. No additional rights or licenses will be implied from the 120 | distribution or licensing of Covered Software under this License. 121 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 122 | Contributor: 123 | 124 | a. for any code that a Contributor has removed from Covered Software; or 125 | 126 | b. for infringements caused by: (i) Your and any other third party's 127 | modifications of Covered Software, or (ii) the combination of its 128 | Contributions with other software (except as part of its Contributor 129 | Version); or 130 | 131 | c. under Patent Claims infringed by Covered Software in the absence of 132 | its Contributions. 133 | 134 | This License does not grant any rights in the trademarks, service marks, 135 | or logos of any Contributor (except as may be necessary to comply with 136 | the notice requirements in Section 3.4). 137 | 138 | 2.4. Subsequent Licenses 139 | 140 | No Contributor makes additional grants as a result of Your choice to 141 | distribute the Covered Software under a subsequent version of this 142 | License (see Section 10.2) or under the terms of a Secondary License (if 143 | permitted under the terms of Section 3.3). 144 | 145 | 2.5. Representation 146 | 147 | Each Contributor represents that the Contributor believes its 148 | Contributions are its original creation(s) or it has sufficient rights to 149 | grant the rights to its Contributions conveyed by this License. 150 | 151 | 2.6. Fair Use 152 | 153 | This License is not intended to limit any rights You have under 154 | applicable copyright doctrines of fair use, fair dealing, or other 155 | equivalents. 156 | 157 | 2.7. Conditions 158 | 159 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in 160 | Section 2.1. 161 | 162 | 163 | 3. Responsibilities 164 | 165 | 3.1. Distribution of Source Form 166 | 167 | All distribution of Covered Software in Source Code Form, including any 168 | Modifications that You create or to which You contribute, must be under 169 | the terms of this License. You must inform recipients that the Source 170 | Code Form of the Covered Software is governed by the terms of this 171 | License, and how they can obtain a copy of this License. You may not 172 | attempt to alter or restrict the recipients' rights in the Source Code 173 | Form. 174 | 175 | 3.2. Distribution of Executable Form 176 | 177 | If You distribute Covered Software in Executable Form then: 178 | 179 | a. such Covered Software must also be made available in Source Code Form, 180 | as described in Section 3.1, and You must inform recipients of the 181 | Executable Form how they can obtain a copy of such Source Code Form by 182 | reasonable means in a timely manner, at a charge no more than the cost 183 | of distribution to the recipient; and 184 | 185 | b. You may distribute such Executable Form under the terms of this 186 | License, or sublicense it under different terms, provided that the 187 | license for the Executable Form does not attempt to limit or alter the 188 | recipients' rights in the Source Code Form under this License. 189 | 190 | 3.3. Distribution of a Larger Work 191 | 192 | You may create and distribute a Larger Work under terms of Your choice, 193 | provided that You also comply with the requirements of this License for 194 | the Covered Software. If the Larger Work is a combination of Covered 195 | Software with a work governed by one or more Secondary Licenses, and the 196 | Covered Software is not Incompatible With Secondary Licenses, this 197 | License permits You to additionally distribute such Covered Software 198 | under the terms of such Secondary License(s), so that the recipient of 199 | the Larger Work may, at their option, further distribute the Covered 200 | Software under the terms of either this License or such Secondary 201 | License(s). 202 | 203 | 3.4. Notices 204 | 205 | You may not remove or alter the substance of any license notices 206 | (including copyright notices, patent notices, disclaimers of warranty, or 207 | limitations of liability) contained within the Source Code Form of the 208 | Covered Software, except that You may alter any license notices to the 209 | extent required to remedy known factual inaccuracies. 210 | 211 | 3.5. Application of Additional Terms 212 | 213 | You may choose to offer, and to charge a fee for, warranty, support, 214 | indemnity or liability obligations to one or more recipients of Covered 215 | Software. However, You may do so only on Your own behalf, and not on 216 | behalf of any Contributor. You must make it absolutely clear that any 217 | such warranty, support, indemnity, or liability obligation is offered by 218 | You alone, and You hereby agree to indemnify every Contributor for any 219 | liability incurred by such Contributor as a result of warranty, support, 220 | indemnity or liability terms You offer. You may include additional 221 | disclaimers of warranty and limitations of liability specific to any 222 | jurisdiction. 223 | 224 | 4. Inability to Comply Due to Statute or Regulation 225 | 226 | If it is impossible for You to comply with any of the terms of this License 227 | with respect to some or all of the Covered Software due to statute, 228 | judicial order, or regulation then You must: (a) comply with the terms of 229 | this License to the maximum extent possible; and (b) describe the 230 | limitations and the code they affect. Such description must be placed in a 231 | text file included with all distributions of the Covered Software under 232 | this License. Except to the extent prohibited by statute or regulation, 233 | such description must be sufficiently detailed for a recipient of ordinary 234 | skill to be able to understand it. 235 | 236 | 5. Termination 237 | 238 | 5.1. The rights granted under this License will terminate automatically if You 239 | fail to comply with any of its terms. However, if You become compliant, 240 | then the rights granted under this License from a particular Contributor 241 | are reinstated (a) provisionally, unless and until such Contributor 242 | explicitly and finally terminates Your grants, and (b) on an ongoing 243 | basis, if such Contributor fails to notify You of the non-compliance by 244 | some reasonable means prior to 60 days after You have come back into 245 | compliance. Moreover, Your grants from a particular Contributor are 246 | reinstated on an ongoing basis if such Contributor notifies You of the 247 | non-compliance by some reasonable means, this is the first time You have 248 | received notice of non-compliance with this License from such 249 | Contributor, and You become compliant prior to 30 days after Your receipt 250 | of the notice. 251 | 252 | 5.2. If You initiate litigation against any entity by asserting a patent 253 | infringement claim (excluding declaratory judgment actions, 254 | counter-claims, and cross-claims) alleging that a Contributor Version 255 | directly or indirectly infringes any patent, then the rights granted to 256 | You by any and all Contributors for the Covered Software under Section 257 | 2.1 of this License shall terminate. 258 | 259 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user 260 | license agreements (excluding distributors and resellers) which have been 261 | validly granted by You or Your distributors under this License prior to 262 | termination shall survive termination. 263 | 264 | 6. Disclaimer of Warranty 265 | 266 | Covered Software is provided under this License on an "as is" basis, 267 | without warranty of any kind, either expressed, implied, or statutory, 268 | including, without limitation, warranties that the Covered Software is free 269 | of defects, merchantable, fit for a particular purpose or non-infringing. 270 | The entire risk as to the quality and performance of the Covered Software 271 | is with You. Should any Covered Software prove defective in any respect, 272 | You (not any Contributor) assume the cost of any necessary servicing, 273 | repair, or correction. This disclaimer of warranty constitutes an essential 274 | part of this License. No use of any Covered Software is authorized under 275 | this License except under this disclaimer. 276 | 277 | 7. Limitation of Liability 278 | 279 | Under no circumstances and under no legal theory, whether tort (including 280 | negligence), contract, or otherwise, shall any Contributor, or anyone who 281 | distributes Covered Software as permitted above, be liable to You for any 282 | direct, indirect, special, incidental, or consequential damages of any 283 | character including, without limitation, damages for lost profits, loss of 284 | goodwill, work stoppage, computer failure or malfunction, or any and all 285 | other commercial damages or losses, even if such party shall have been 286 | informed of the possibility of such damages. This limitation of liability 287 | shall not apply to liability for death or personal injury resulting from 288 | such party's negligence to the extent applicable law prohibits such 289 | limitation. Some jurisdictions do not allow the exclusion or limitation of 290 | incidental or consequential damages, so this exclusion and limitation may 291 | not apply to You. 292 | 293 | 8. Litigation 294 | 295 | Any litigation relating to this License may be brought only in the courts 296 | of a jurisdiction where the defendant maintains its principal place of 297 | business and such litigation shall be governed by laws of that 298 | jurisdiction, without reference to its conflict-of-law provisions. Nothing 299 | in this Section shall prevent a party's ability to bring cross-claims or 300 | counter-claims. 301 | 302 | 9. Miscellaneous 303 | 304 | This License represents the complete agreement concerning the subject 305 | matter hereof. If any provision of this License is held to be 306 | unenforceable, such provision shall be reformed only to the extent 307 | necessary to make it enforceable. Any law or regulation which provides that 308 | the language of a contract shall be construed against the drafter shall not 309 | be used to construe this License against a Contributor. 310 | 311 | 312 | 10. Versions of the License 313 | 314 | 10.1. New Versions 315 | 316 | Mozilla Foundation is the license steward. Except as provided in Section 317 | 10.3, no one other than the license steward has the right to modify or 318 | publish new versions of this License. Each version will be given a 319 | distinguishing version number. 320 | 321 | 10.2. Effect of New Versions 322 | 323 | You may distribute the Covered Software under the terms of the version 324 | of the License under which You originally received the Covered Software, 325 | or under the terms of any subsequent version published by the license 326 | steward. 327 | 328 | 10.3. Modified Versions 329 | 330 | If you create software not governed by this License, and you want to 331 | create a new license for such software, you may create and use a 332 | modified version of this License if you rename the license and remove 333 | any references to the name of the license steward (except to note that 334 | such modified license differs from this License). 335 | 336 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 337 | Licenses If You choose to distribute Source Code Form that is 338 | Incompatible With Secondary Licenses under the terms of this version of 339 | the License, the notice described in Exhibit B of this License must be 340 | attached. 341 | 342 | Exhibit A - Source Code Form License Notice 343 | 344 | This Source Code Form is subject to the 345 | terms of the Mozilla Public License, v. 346 | 2.0. If a copy of the MPL was not 347 | distributed with this file, You can 348 | obtain one at 349 | http://mozilla.org/MPL/2.0/. 350 | 351 | If it is not possible or desirable to put the notice in a particular file, 352 | then You may include the notice in a location (such as a LICENSE file in a 353 | relevant directory) where a recipient would be likely to look for such a 354 | notice. 355 | 356 | You may add additional accurate notices of copyright ownership. 357 | 358 | Exhibit B - "Incompatible With Secondary Licenses" Notice 359 | 360 | This Source Code Form is "Incompatible 361 | With Secondary Licenses", as defined by 362 | the Mozilla Public License, v. 2.0. 363 | 364 | -------------------------------------------------------------------------------- /OpenInFirefoxClient-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | #import "OpenInFirefoxControllerObjC.h" -------------------------------------------------------------------------------- /OpenInFirefoxClient.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7459FBED1B323CFE002DCC8A /* OpenInFirefoxControllerObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = 7459FBEC1B323CFE002DCC8A /* OpenInFirefoxControllerObjC.m */; }; 11 | 74D20F841B2B789500A41894 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74D20F831B2B789500A41894 /* AppDelegate.swift */; }; 12 | 74D20F861B2B789500A41894 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74D20F851B2B789500A41894 /* ViewController.swift */; }; 13 | 74D20F891B2B789500A41894 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74D20F871B2B789500A41894 /* Main.storyboard */; }; 14 | 74D20F8B1B2B789500A41894 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 74D20F8A1B2B789500A41894 /* Images.xcassets */; }; 15 | 74D20F8E1B2B789500A41894 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 74D20F8C1B2B789500A41894 /* LaunchScreen.xib */; }; 16 | 74D20FC81B2B926500A41894 /* OpenInFirefoxControllerSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74D20FC71B2B926500A41894 /* OpenInFirefoxControllerSwift.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 7459FBEB1B323CFE002DCC8A /* OpenInFirefoxControllerObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenInFirefoxControllerObjC.h; sourceTree = ""; }; 21 | 7459FBEC1B323CFE002DCC8A /* OpenInFirefoxControllerObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenInFirefoxControllerObjC.m; sourceTree = ""; }; 22 | 746140F21B2F43F30011A8A6 /* OpenInFirefoxClient-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "OpenInFirefoxClient-Bridging-Header.h"; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 23 | 74D20F7E1B2B789500A41894 /* OpenInFirefoxClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenInFirefoxClient.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 74D20F821B2B789500A41894 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | 74D20F831B2B789500A41894 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 74D20F851B2B789500A41894 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; 27 | 74D20F881B2B789500A41894 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 74D20F8A1B2B789500A41894 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 29 | 74D20F8D1B2B789500A41894 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 30 | 74D20FC71B2B926500A41894 /* OpenInFirefoxControllerSwift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenInFirefoxControllerSwift.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 74D20F7B1B2B789500A41894 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 28D3923A1B5DC56D0016F0E5 /* Example App */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | 74D20F831B2B789500A41894 /* AppDelegate.swift */, 48 | 74D20F851B2B789500A41894 /* ViewController.swift */, 49 | 74D20F871B2B789500A41894 /* Main.storyboard */, 50 | 74D20F8A1B2B789500A41894 /* Images.xcassets */, 51 | 74D20F8C1B2B789500A41894 /* LaunchScreen.xib */, 52 | ); 53 | name = "Example App"; 54 | sourceTree = ""; 55 | }; 56 | 74D20F751B2B789500A41894 = { 57 | isa = PBXGroup; 58 | children = ( 59 | 74D20F801B2B789500A41894 /* OpenInFirefoxClient */, 60 | 74D20F7F1B2B789500A41894 /* Products */, 61 | ); 62 | sourceTree = ""; 63 | }; 64 | 74D20F7F1B2B789500A41894 /* Products */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 74D20F7E1B2B789500A41894 /* OpenInFirefoxClient.app */, 68 | ); 69 | name = Products; 70 | sourceTree = ""; 71 | }; 72 | 74D20F801B2B789500A41894 /* OpenInFirefoxClient */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 28D3923A1B5DC56D0016F0E5 /* Example App */, 76 | 74D20FC71B2B926500A41894 /* OpenInFirefoxControllerSwift.swift */, 77 | 7459FBEB1B323CFE002DCC8A /* OpenInFirefoxControllerObjC.h */, 78 | 7459FBEC1B323CFE002DCC8A /* OpenInFirefoxControllerObjC.m */, 79 | 746140F21B2F43F30011A8A6 /* OpenInFirefoxClient-Bridging-Header.h */, 80 | 74D20F811B2B789500A41894 /* Supporting Files */, 81 | ); 82 | path = OpenInFirefoxClient; 83 | sourceTree = ""; 84 | }; 85 | 74D20F811B2B789500A41894 /* Supporting Files */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 74D20F821B2B789500A41894 /* Info.plist */, 89 | ); 90 | name = "Supporting Files"; 91 | sourceTree = ""; 92 | }; 93 | /* End PBXGroup section */ 94 | 95 | /* Begin PBXNativeTarget section */ 96 | 74D20F7D1B2B789500A41894 /* OpenInFirefoxClient */ = { 97 | isa = PBXNativeTarget; 98 | buildConfigurationList = 74D20F9D1B2B789500A41894 /* Build configuration list for PBXNativeTarget "OpenInFirefoxClient" */; 99 | buildPhases = ( 100 | 74D20F7A1B2B789500A41894 /* Sources */, 101 | 74D20F7B1B2B789500A41894 /* Frameworks */, 102 | 74D20F7C1B2B789500A41894 /* Resources */, 103 | ); 104 | buildRules = ( 105 | ); 106 | dependencies = ( 107 | ); 108 | name = OpenInFirefoxClient; 109 | productName = OpenInFirefoxClient; 110 | productReference = 74D20F7E1B2B789500A41894 /* OpenInFirefoxClient.app */; 111 | productType = "com.apple.product-type.application"; 112 | }; 113 | /* End PBXNativeTarget section */ 114 | 115 | /* Begin PBXProject section */ 116 | 74D20F761B2B789500A41894 /* Project object */ = { 117 | isa = PBXProject; 118 | attributes = { 119 | LastSwiftUpdateCheck = 0720; 120 | LastUpgradeCheck = 0630; 121 | ORGANIZATIONNAME = "Bryan Munar"; 122 | TargetAttributes = { 123 | 74D20F7D1B2B789500A41894 = { 124 | CreatedOnToolsVersion = 6.3.2; 125 | LastSwiftMigration = 0800; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = 74D20F791B2B789500A41894 /* Build configuration list for PBXProject "OpenInFirefoxClient" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = 74D20F751B2B789500A41894; 138 | productRefGroup = 74D20F7F1B2B789500A41894 /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | 74D20F7D1B2B789500A41894 /* OpenInFirefoxClient */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | 74D20F7C1B2B789500A41894 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 74D20F891B2B789500A41894 /* Main.storyboard in Resources */, 153 | 74D20F8E1B2B789500A41894 /* LaunchScreen.xib in Resources */, 154 | 74D20F8B1B2B789500A41894 /* Images.xcassets in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXSourcesBuildPhase section */ 161 | 74D20F7A1B2B789500A41894 /* Sources */ = { 162 | isa = PBXSourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | 74D20F861B2B789500A41894 /* ViewController.swift in Sources */, 166 | 74D20FC81B2B926500A41894 /* OpenInFirefoxControllerSwift.swift in Sources */, 167 | 7459FBED1B323CFE002DCC8A /* OpenInFirefoxControllerObjC.m in Sources */, 168 | 74D20F841B2B789500A41894 /* AppDelegate.swift in Sources */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXSourcesBuildPhase section */ 173 | 174 | /* Begin PBXVariantGroup section */ 175 | 74D20F871B2B789500A41894 /* Main.storyboard */ = { 176 | isa = PBXVariantGroup; 177 | children = ( 178 | 74D20F881B2B789500A41894 /* Base */, 179 | ); 180 | name = Main.storyboard; 181 | sourceTree = ""; 182 | }; 183 | 74D20F8C1B2B789500A41894 /* LaunchScreen.xib */ = { 184 | isa = PBXVariantGroup; 185 | children = ( 186 | 74D20F8D1B2B789500A41894 /* Base */, 187 | ); 188 | name = LaunchScreen.xib; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXVariantGroup section */ 192 | 193 | /* Begin XCBuildConfiguration section */ 194 | 74D20F9B1B2B789500A41894 /* Debug */ = { 195 | isa = XCBuildConfiguration; 196 | buildSettings = { 197 | ALWAYS_SEARCH_USER_PATHS = NO; 198 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 199 | CLANG_CXX_LIBRARY = "libc++"; 200 | CLANG_ENABLE_MODULES = YES; 201 | CLANG_ENABLE_OBJC_ARC = YES; 202 | CLANG_WARN_BOOL_CONVERSION = YES; 203 | CLANG_WARN_CONSTANT_CONVERSION = YES; 204 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 205 | CLANG_WARN_EMPTY_BODY = YES; 206 | CLANG_WARN_ENUM_CONVERSION = YES; 207 | CLANG_WARN_INT_CONVERSION = YES; 208 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 209 | CLANG_WARN_UNREACHABLE_CODE = YES; 210 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 211 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 212 | COPY_PHASE_STRIP = NO; 213 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 214 | ENABLE_STRICT_OBJC_MSGSEND = YES; 215 | GCC_C_LANGUAGE_STANDARD = gnu99; 216 | GCC_DYNAMIC_NO_PIC = NO; 217 | GCC_NO_COMMON_BLOCKS = YES; 218 | GCC_OPTIMIZATION_LEVEL = 0; 219 | GCC_PREPROCESSOR_DEFINITIONS = ( 220 | "DEBUG=1", 221 | "$(inherited)", 222 | ); 223 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 224 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 225 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 226 | GCC_WARN_UNDECLARED_SELECTOR = YES; 227 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 228 | GCC_WARN_UNUSED_FUNCTION = YES; 229 | GCC_WARN_UNUSED_VARIABLE = YES; 230 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 231 | MTL_ENABLE_DEBUG_INFO = YES; 232 | ONLY_ACTIVE_ARCH = YES; 233 | SDKROOT = iphoneos; 234 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 235 | TARGETED_DEVICE_FAMILY = "1,2"; 236 | }; 237 | name = Debug; 238 | }; 239 | 74D20F9C1B2B789500A41894 /* Release */ = { 240 | isa = XCBuildConfiguration; 241 | buildSettings = { 242 | ALWAYS_SEARCH_USER_PATHS = NO; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_WARN_BOOL_CONVERSION = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_EMPTY_BODY = YES; 251 | CLANG_WARN_ENUM_CONVERSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 254 | CLANG_WARN_UNREACHABLE_CODE = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 257 | COPY_PHASE_STRIP = NO; 258 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 259 | ENABLE_NS_ASSERTIONS = NO; 260 | ENABLE_STRICT_OBJC_MSGSEND = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu99; 262 | GCC_NO_COMMON_BLOCKS = YES; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 270 | MTL_ENABLE_DEBUG_INFO = NO; 271 | SDKROOT = iphoneos; 272 | TARGETED_DEVICE_FAMILY = "1,2"; 273 | VALIDATE_PRODUCT = YES; 274 | }; 275 | name = Release; 276 | }; 277 | 74D20F9E1B2B789500A41894 /* Debug */ = { 278 | isa = XCBuildConfiguration; 279 | buildSettings = { 280 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 281 | CLANG_ENABLE_MODULES = YES; 282 | INFOPLIST_FILE = OpenInFirefoxClient/Info.plist; 283 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 284 | PRODUCT_NAME = "$(TARGET_NAME)"; 285 | SWIFT_OBJC_BRIDGING_HEADER = "OpenInFirefoxClient-Bridging-Header.h"; 286 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 287 | SWIFT_VERSION = 3.0; 288 | }; 289 | name = Debug; 290 | }; 291 | 74D20F9F1B2B789500A41894 /* Release */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 295 | CLANG_ENABLE_MODULES = YES; 296 | INFOPLIST_FILE = OpenInFirefoxClient/Info.plist; 297 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | SWIFT_OBJC_BRIDGING_HEADER = "OpenInFirefoxClient-Bridging-Header.h"; 300 | SWIFT_VERSION = 3.0; 301 | }; 302 | name = Release; 303 | }; 304 | /* End XCBuildConfiguration section */ 305 | 306 | /* Begin XCConfigurationList section */ 307 | 74D20F791B2B789500A41894 /* Build configuration list for PBXProject "OpenInFirefoxClient" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 74D20F9B1B2B789500A41894 /* Debug */, 311 | 74D20F9C1B2B789500A41894 /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | 74D20F9D1B2B789500A41894 /* Build configuration list for PBXNativeTarget "OpenInFirefoxClient" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 74D20F9E1B2B789500A41894 /* Debug */, 320 | 74D20F9F1B2B789500A41894 /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | /* End XCConfigurationList section */ 326 | }; 327 | rootObject = 74D20F761B2B789500A41894 /* Project object */; 328 | } 329 | -------------------------------------------------------------------------------- /OpenInFirefoxClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OpenInFirefoxClient.xcodeproj/xcuserdata/bmunar.xcuserdatad/xcschemes/OpenInFirefoxClient.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /OpenInFirefoxClient.xcodeproj/xcuserdata/bmunar.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenInFirefoxClient.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 74D20F7D1B2B789500A41894 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | import UIKit 6 | 7 | @UIApplicationMain 8 | class AppDelegate: UIResponder, UIApplicationDelegate { 9 | var window: UIWindow? 10 | } 11 | 12 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "size" : "60x60", 25 | "idiom" : "iphone", 26 | "filename" : "Icon-60@2x.png", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "size" : "60x60", 31 | "idiom" : "iphone", 32 | "filename" : "Icon-60@3x.png", 33 | "scale" : "3x" 34 | }, 35 | { 36 | "idiom" : "ipad", 37 | "size" : "29x29", 38 | "scale" : "1x" 39 | }, 40 | { 41 | "idiom" : "ipad", 42 | "size" : "29x29", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "idiom" : "ipad", 47 | "size" : "40x40", 48 | "scale" : "1x" 49 | }, 50 | { 51 | "idiom" : "ipad", 52 | "size" : "40x40", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "size" : "76x76", 57 | "idiom" : "ipad", 58 | "filename" : "Icon-76.png", 59 | "scale" : "1x" 60 | }, 61 | { 62 | "size" : "76x76", 63 | "idiom" : "ipad", 64 | "filename" : "Icon-76@2x.png", 65 | "scale" : "2x" 66 | }, 67 | { 68 | "idiom" : "ipad", 69 | "size" : "83.5x83.5", 70 | "scale" : "2x" 71 | } 72 | ], 73 | "info" : { 74 | "version" : 1, 75 | "author" : "xcode" 76 | } 77 | } -------------------------------------------------------------------------------- /OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla-mobile/firefox-ios-open-in-client/cb9602a7075c5ec1fe3d4d8ff1d614b186d1392a/OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla-mobile/firefox-ios-open-in-client/cb9602a7075c5ec1fe3d4d8ff1d614b186d1392a/OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla-mobile/firefox-ios-open-in-client/cb9602a7075c5ec1fe3d4d8ff1d614b186d1392a/OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla-mobile/firefox-ios-open-in-client/cb9602a7075c5ec1fe3d4d8ff1d614b186d1392a/OpenInFirefoxClient/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /OpenInFirefoxClient/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSApplicationQueriesSchemes 6 | 7 | firefox 8 | 9 | CFBundleDevelopmentRegion 10 | en 11 | CFBundleDisplayName 12 | $(PRODUCT_NAME) 13 | CFBundleExecutable 14 | $(EXECUTABLE_NAME) 15 | CFBundleIdentifier 16 | org.mozilla.$(PRODUCT_NAME:rfc1034identifier) 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | $(PRODUCT_NAME) 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | 1.0 25 | CFBundleSignature 26 | ???? 27 | CFBundleURLTypes 28 | 29 | 30 | CFBundleURLName 31 | org.mozilla.openinfirefoxclient 32 | CFBundleURLSchemes 33 | 34 | firefoxopeninfirefoxclient 35 | 36 | 37 | 38 | CFBundleVersion 39 | 1 40 | LSRequiresIPhoneOS 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/OpenInFirefoxControllerObjC.h: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | #import 6 | 7 | // This class is used to check if Firefox is installed in the system and 8 | // to open a URL in Firefox either with or without a callback URL. 9 | @interface OpenInFirefoxControllerObjC : NSObject 10 | 11 | // Returns a shared instance of the OpenInFirefoxControllerObjC. 12 | + (OpenInFirefoxControllerObjC *)sharedInstance; 13 | 14 | // Returns YES if Firefox is installed in the user's system. 15 | - (BOOL)isFirefoxInstalled; 16 | 17 | // Opens a URL in Firefox. 18 | - (BOOL)openInFirefox:(NSURL *)url; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/OpenInFirefoxControllerObjC.m: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | #import 6 | #import "OpenInFirefoxControllerObjC.h" 7 | 8 | static NSString *const firefoxScheme = @"firefox:"; 9 | 10 | @implementation OpenInFirefoxControllerObjC 11 | 12 | // Creates a shared instance of the controller. 13 | + (OpenInFirefoxControllerObjC *)sharedInstance { 14 | static OpenInFirefoxControllerObjC *sharedInstance; 15 | static dispatch_once_t onceToken; 16 | dispatch_once(&onceToken, ^{ 17 | sharedInstance = [[self alloc] init]; 18 | }); 19 | return sharedInstance; 20 | } 21 | 22 | // Custom function that does complete percent escape for constructing the URL. 23 | static NSString *encodeByAddingPercentEscapes(NSString *string) { 24 | NSString *encodedString = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes( 25 | kCFAllocatorDefault, 26 | (CFStringRef)string, 27 | NULL, 28 | (CFStringRef)@"!*'();:@&=+$,/?%#[]", 29 | kCFStringEncodingUTF8)); 30 | return encodedString; 31 | } 32 | 33 | // Checks if Firefox is installed. 34 | - (BOOL)isFirefoxInstalled { 35 | NSURL *url = [NSURL URLWithString:firefoxScheme]; 36 | return [[UIApplication sharedApplication] canOpenURL:url]; 37 | } 38 | 39 | // Opens the URL in Firefox. 40 | - (BOOL)openInFirefox:(NSURL *)url { 41 | if (![self isFirefoxInstalled]) { 42 | return NO; 43 | } 44 | 45 | NSString *scheme = [url.scheme lowercaseString]; 46 | if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"]) { 47 | return NO; 48 | } 49 | 50 | NSString *urlString = [url absoluteString]; 51 | NSMutableString *firefoxURLString = [NSMutableString string]; 52 | [firefoxURLString appendFormat:@"%@//open-url?url=%@", firefoxScheme, encodeByAddingPercentEscapes(urlString)]; 53 | NSURL *firefoxURL = [NSURL URLWithString: firefoxURLString]; 54 | 55 | // Open the URL with Firefox. 56 | return [[UIApplication sharedApplication] openURL:firefoxURL]; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/OpenInFirefoxControllerSwift.swift: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | import Foundation 6 | import UIKit 7 | 8 | open class OpenInFirefoxControllerSwift { 9 | let firefoxScheme = "firefox:" 10 | let basicURL = URL(string: "firefox://")! 11 | 12 | // This would need to be changed if used from an extension… but you 13 | // can't open arbitrary URLs from an extension anyway. 14 | let app = UIApplication.shared 15 | 16 | fileprivate func encodeByAddingPercentEscapes(_ input: String) -> String { 17 | return NSString(string: input).addingPercentEncoding(withAllowedCharacters: CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[]"))! 18 | } 19 | 20 | open func isFirefoxInstalled() -> Bool { 21 | return app.canOpenURL(basicURL) 22 | } 23 | 24 | open func openInFirefox(_ url: URL) -> Bool { 25 | if !isFirefoxInstalled() { 26 | return false 27 | } 28 | 29 | let scheme = url.scheme 30 | if scheme == "http" || scheme == "https" { 31 | let escaped = encodeByAddingPercentEscapes(url.absoluteString) 32 | if let firefoxURL = URL(string: "firefox://open-url?url=\(escaped)") { 33 | return app.openURL(firefoxURL) 34 | } 35 | } 36 | return false 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /OpenInFirefoxClient/ViewController.swift: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | import Foundation 6 | import UIKit 7 | import WebKit 8 | 9 | class ViewController: UIViewController { 10 | let url = URL(string: "https://www.mozilla.org/en-US/firefox/ios/")! 11 | 12 | override func viewDidLoad() { 13 | super.viewDidLoad() 14 | let myWebView = UIWebView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)) 15 | 16 | let swiftButton = UIButton(type: UIButtonType.system) 17 | swiftButton.frame = CGRect(x: 100, y: 100, width: 200, height: 50) 18 | swiftButton.center = CGPoint(x: self.view.center.x, y: self.view.center.y - 150) 19 | swiftButton.backgroundColor = UIColor.orange 20 | swiftButton.setTitle("OpenInFirefox with Swift", for: UIControlState()) 21 | swiftButton.tintColor = UIColor.white 22 | swiftButton.addTarget(self, action: #selector(ViewController.buttonActionSwift(_:)), for: UIControlEvents.touchUpInside) 23 | 24 | let objCButton = UIButton(type: UIButtonType.system) 25 | objCButton.frame = CGRect(x: 100, y: 300, width: 200, height: 50) 26 | objCButton.center = CGPoint(x: self.view.center.x, y: self.view.center.y) 27 | objCButton.backgroundColor = UIColor.blue 28 | objCButton.setTitle("OpenInFirefox with Obj-C", for: UIControlState()) 29 | objCButton.tintColor = UIColor.white 30 | objCButton.addTarget(self, action: #selector(ViewController.buttonActionObjC(_:)), for: UIControlEvents.touchUpInside) 31 | 32 | self.view.addSubview(myWebView) 33 | self.view.addSubview(swiftButton) 34 | self.view.addSubview(objCButton) 35 | } 36 | 37 | func buttonActionSwift(_ sender: UIButton!) { 38 | let controller = OpenInFirefoxControllerSwift() 39 | if controller.isFirefoxInstalled() { 40 | controller.openInFirefox(url) 41 | } 42 | } 43 | 44 | func buttonActionObjC(_ sender: UIButton!) { 45 | let controller = OpenInFirefoxControllerObjC() 46 | if controller.isFirefoxInstalled() { 47 | controller.open(inFirefox: url) 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Opening links in Firefox for iOS # 2 | This open-source project provides support for opening links in Firefox for iOS. There are classes (for Objective-C and Swift), along with a sample project that uses them, available for reference and use. 3 | 4 | ### Using OpenInFirefoxControllerSwift or OpenInFirefoxControllerObjC to open links ### 5 | The `OpenInFirefoxControllerSwift` and `OpenInFirefoxControllerObjC` classes provide methods that handle the making of custom URI schemes, checking if Firefox is installed on the device and opening the URL in Firefox. We have provided Swift and Objective-C implementations of these classes to accommodate your language of choice. 6 | 7 | ### Methods ### 8 | * `isFirefoxInstalled`: returns true if Firefox is installed 9 | * `openInFirefox`: opens the specified URL in Firefox; used with or without the following: 10 | 11 | ### The Custom Firefox URL ### 12 | Firefox uses a single URI scheme, `firefox://`. This scheme can accepts the following query parameter: 13 | * `url`: (required) the URL to open in Firefox. 14 | 15 | For Example: 16 | ``` 17 | firefox://open-url?url=https://www.google.com/search%3Fq%3Dfirefox%2520for%2520ios 18 | ``` 19 | ### Walkthrough ### 20 | 1. Download the class file in the language of your choice: 21 | * Swift: [OpenInFirefoxControllerSwift.swift](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/OpenInFirefoxControllerSwift.swift) 22 | * Objective-C: [OpenInFirefoxControllerObjC.m](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/OpenInFirefoxControllerObjC.m), [OpenInFirefoxControllerObjC.h](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/OpenInFirefoxControllerObjC.h) 23 | 2. Whitelist the Firefox URL scheme in Info.plist, under the LSApplicationQueriesSchemes key: 24 | * In depth example on how to do that [here](http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html) 25 | * If LSApplicationQueriesSchemes isn't already in your app's Info.plist, you can just manually add it 26 | * Add `firefox` to LSApplicationQueriesSchemes 27 | 3. Call methods to open links in Firefox: 28 | * [Example in Swift](https://github.com/mozilla/firefox-ios-open-in-client/blob/master/OpenInFirefoxClient/ViewController.swift#L38-41) 29 | 30 | ### Contribute to Firefox for iOS ### 31 | Learn more about how to contribute to this project: [Firefox for iOS official repo](https://github.com/mozilla/firefox-ios) 32 | --------------------------------------------------------------------------------