├── .gitignore ├── Frameworks └── ParsecSDK.framework ├── LICENSE ├── OpenParsec.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── OpenParsec ├── ActivityIndicator.swift ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon-1024.png │ │ ├── icon-20.png │ │ ├── icon-20@2x.png │ │ ├── icon-20@3x.png │ │ ├── icon-29.png │ │ ├── icon-29@2x.png │ │ ├── icon-29@3x.png │ │ ├── icon-40.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-76.png │ │ ├── icon-76@2x.png │ │ └── icon-83.5@2x.png │ ├── BackgroundButton.colorset │ │ └── Contents.json │ ├── BackgroundCard.colorset │ │ └── Contents.json │ ├── BackgroundField.colorset │ │ └── Contents.json │ ├── BackgroundGray.colorset │ │ └── Contents.json │ ├── BackgroundPrompt.colorset │ │ └── Contents.json │ ├── Contents.json │ ├── Foreground.colorset │ │ └── Contents.json │ ├── IconTransparent.imageset │ │ ├── Contents.json │ │ └── icon_transparent.png │ ├── LogoShadow.imageset │ │ ├── Contents.json │ │ └── logo_shadow.png │ └── Shading.colorset │ │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── CParsec.swift ├── ContentView.swift ├── Info.plist ├── LoginView.swift ├── MainView.swift ├── NetworkHandler.swift ├── OpenParsec-Bridging-Header.h ├── ParsecGLKRenderer.swift ├── ParsecGLKViewController.swift ├── ParsecView.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── SceneDelegate.swift ├── audio.c └── audio.h └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | .DS_Store 3 | .AppleDouble 4 | .LSOverride 5 | 6 | # Icon must end with two \r 7 | Icon 8 | 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear in the root of a volume 14 | .DocumentRevisions-V100 15 | .fseventsd 16 | .Spotlight-V100 17 | .TemporaryItems 18 | .Trashes 19 | .VolumeIcon.icns 20 | .com.apple.timemachine.donotpresent 21 | 22 | # Directories potentially created on remote AFP share 23 | .AppleDB 24 | .AppleDesktop 25 | Network Trash Folder 26 | Temporary Items 27 | .apdisk 28 | 29 | ## User settings 30 | xcuserdata/ 31 | -------------------------------------------------------------------------------- /Frameworks/ParsecSDK.framework: -------------------------------------------------------------------------------- 1 | /Users/mike/Documents/Repositories/parsec-sdk/sdk/ios/ParsecSDK.framework -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /OpenParsec.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 271D14F9292E90EB00D7F1D6 /* ParsecView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271D14F8292E90EB00D7F1D6 /* ParsecView.swift */; }; 11 | 271D14FC292EAA3600D7F1D6 /* ParsecGLKRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271D14FA292EAA3600D7F1D6 /* ParsecGLKRenderer.swift */; }; 12 | 271D14FD292EAA3600D7F1D6 /* ParsecGLKViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271D14FB292EAA3600D7F1D6 /* ParsecGLKViewController.swift */; }; 13 | 27899AC7292FE2A9001ACA33 /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 27899AC5292FE2A9001ACA33 /* audio.c */; }; 14 | 27B8D564292DC7A000A324AD /* CParsec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B8D563292DC7A000A324AD /* CParsec.swift */; }; 15 | 27B8D571292DCA5B00A324AD /* ParsecSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27B8D56F292DCA5800A324AD /* ParsecSDK.framework */; }; 16 | 27B8D572292DCA5B00A324AD /* ParsecSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 27B8D56F292DCA5800A324AD /* ParsecSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 27E61A92292965FC00FF6563 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E61A91292965FC00FF6563 /* AppDelegate.swift */; }; 18 | 27E61A94292965FC00FF6563 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E61A93292965FC00FF6563 /* SceneDelegate.swift */; }; 19 | 27E61A96292965FC00FF6563 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E61A95292965FC00FF6563 /* ContentView.swift */; }; 20 | 27E61A98292965FD00FF6563 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 27E61A97292965FD00FF6563 /* Assets.xcassets */; }; 21 | 27E61A9B292965FD00FF6563 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 27E61A9A292965FD00FF6563 /* Preview Assets.xcassets */; }; 22 | 27E61A9E292965FD00FF6563 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 27E61A9C292965FD00FF6563 /* LaunchScreen.storyboard */; }; 23 | 27E61AA62929817700FF6563 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E61AA52929817700FF6563 /* LoginView.swift */; }; 24 | 27E61AA8292994B500FF6563 /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E61AA7292994B500FF6563 /* ActivityIndicator.swift */; }; 25 | 27E61AAA2929B92200FF6563 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E61AA92929B92200FF6563 /* MainView.swift */; }; 26 | 27ED36FF292D4F9800B1BE3D /* NetworkHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27ED36FE292D4F9800B1BE3D /* NetworkHandler.swift */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXCopyFilesBuildPhase section */ 30 | 27B8D569292DC81500A324AD /* Embed Frameworks */ = { 31 | isa = PBXCopyFilesBuildPhase; 32 | buildActionMask = 2147483647; 33 | dstPath = ""; 34 | dstSubfolderSpec = 10; 35 | files = ( 36 | 27B8D572292DCA5B00A324AD /* ParsecSDK.framework in Embed Frameworks */, 37 | ); 38 | name = "Embed Frameworks"; 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXCopyFilesBuildPhase section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 271D14F8292E90EB00D7F1D6 /* ParsecView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParsecView.swift; sourceTree = ""; }; 45 | 271D14FA292EAA3600D7F1D6 /* ParsecGLKRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParsecGLKRenderer.swift; sourceTree = ""; }; 46 | 271D14FB292EAA3600D7F1D6 /* ParsecGLKViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParsecGLKViewController.swift; sourceTree = ""; }; 47 | 27899AC4292FE2A8001ACA33 /* OpenParsec-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OpenParsec-Bridging-Header.h"; sourceTree = ""; }; 48 | 27899AC5292FE2A9001ACA33 /* audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audio.c; sourceTree = ""; }; 49 | 27899AC6292FE2A9001ACA33 /* audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio.h; sourceTree = ""; }; 50 | 27B8D563292DC7A000A324AD /* CParsec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CParsec.swift; sourceTree = ""; }; 51 | 27B8D56F292DCA5800A324AD /* ParsecSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ParsecSDK.framework; path = "../../../../../Users/mike/Documents/Repositories/parsec-sdk/sdk/ios/ParsecSDK.framework"; sourceTree = ""; }; 52 | 27E61A8E292965FC00FF6563 /* OpenParsec.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenParsec.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 27E61A91292965FC00FF6563 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 54 | 27E61A93292965FC00FF6563 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 55 | 27E61A95292965FC00FF6563 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 56 | 27E61A97292965FD00FF6563 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 57 | 27E61A9A292965FD00FF6563 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 58 | 27E61A9D292965FD00FF6563 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 27E61A9F292965FD00FF6563 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 27E61AA52929817700FF6563 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; 61 | 27E61AA7292994B500FF6563 /* ActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = ""; }; 62 | 27E61AA92929B92200FF6563 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; }; 63 | 27ED36FE292D4F9800B1BE3D /* NetworkHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkHandler.swift; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 27E61A8B292965FC00FF6563 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 27B8D571292DCA5B00A324AD /* ParsecSDK.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXFrameworksBuildPhase section */ 76 | 77 | /* Begin PBXGroup section */ 78 | 27B8D56A292DC98B00A324AD /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 27B8D56F292DCA5800A324AD /* ParsecSDK.framework */, 82 | ); 83 | path = Frameworks; 84 | sourceTree = ""; 85 | }; 86 | 27E61A85292965FC00FF6563 = { 87 | isa = PBXGroup; 88 | children = ( 89 | 27B8D56A292DC98B00A324AD /* Frameworks */, 90 | 27E61A90292965FC00FF6563 /* OpenParsec */, 91 | 27E61A8F292965FC00FF6563 /* Products */, 92 | ); 93 | sourceTree = ""; 94 | }; 95 | 27E61A8F292965FC00FF6563 /* Products */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 27E61A8E292965FC00FF6563 /* OpenParsec.app */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 27E61A90292965FC00FF6563 /* OpenParsec */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 27899AC5292FE2A9001ACA33 /* audio.c */, 107 | 27899AC6292FE2A9001ACA33 /* audio.h */, 108 | 271D14FA292EAA3600D7F1D6 /* ParsecGLKRenderer.swift */, 109 | 271D14FB292EAA3600D7F1D6 /* ParsecGLKViewController.swift */, 110 | 27E61A91292965FC00FF6563 /* AppDelegate.swift */, 111 | 27E61A93292965FC00FF6563 /* SceneDelegate.swift */, 112 | 27E61A95292965FC00FF6563 /* ContentView.swift */, 113 | 27E61A97292965FD00FF6563 /* Assets.xcassets */, 114 | 27E61A9C292965FD00FF6563 /* LaunchScreen.storyboard */, 115 | 27E61A9F292965FD00FF6563 /* Info.plist */, 116 | 27E61A99292965FD00FF6563 /* Preview Content */, 117 | 27E61AA52929817700FF6563 /* LoginView.swift */, 118 | 27E61AA7292994B500FF6563 /* ActivityIndicator.swift */, 119 | 27E61AA92929B92200FF6563 /* MainView.swift */, 120 | 27ED36FE292D4F9800B1BE3D /* NetworkHandler.swift */, 121 | 27B8D563292DC7A000A324AD /* CParsec.swift */, 122 | 271D14F8292E90EB00D7F1D6 /* ParsecView.swift */, 123 | 27899AC4292FE2A8001ACA33 /* OpenParsec-Bridging-Header.h */, 124 | ); 125 | path = OpenParsec; 126 | sourceTree = ""; 127 | }; 128 | 27E61A99292965FD00FF6563 /* Preview Content */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 27E61A9A292965FD00FF6563 /* Preview Assets.xcassets */, 132 | ); 133 | path = "Preview Content"; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | 27E61A8D292965FC00FF6563 /* OpenParsec */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = 27E61AA2292965FD00FF6563 /* Build configuration list for PBXNativeTarget "OpenParsec" */; 142 | buildPhases = ( 143 | 27E61A8A292965FC00FF6563 /* Sources */, 144 | 27E61A8B292965FC00FF6563 /* Frameworks */, 145 | 27E61A8C292965FC00FF6563 /* Resources */, 146 | 27B8D569292DC81500A324AD /* Embed Frameworks */, 147 | ); 148 | buildRules = ( 149 | ); 150 | dependencies = ( 151 | ); 152 | name = OpenParsec; 153 | productName = OpenParsec; 154 | productReference = 27E61A8E292965FC00FF6563 /* OpenParsec.app */; 155 | productType = "com.apple.product-type.application"; 156 | }; 157 | /* End PBXNativeTarget section */ 158 | 159 | /* Begin PBXProject section */ 160 | 27E61A86292965FC00FF6563 /* Project object */ = { 161 | isa = PBXProject; 162 | attributes = { 163 | LastSwiftUpdateCheck = 1250; 164 | LastUpgradeCheck = 1250; 165 | TargetAttributes = { 166 | 27E61A8D292965FC00FF6563 = { 167 | CreatedOnToolsVersion = 12.5; 168 | LastSwiftMigration = 1250; 169 | }; 170 | }; 171 | }; 172 | buildConfigurationList = 27E61A89292965FC00FF6563 /* Build configuration list for PBXProject "OpenParsec" */; 173 | compatibilityVersion = "Xcode 9.3"; 174 | developmentRegion = en; 175 | hasScannedForEncodings = 0; 176 | knownRegions = ( 177 | en, 178 | Base, 179 | ); 180 | mainGroup = 27E61A85292965FC00FF6563; 181 | productRefGroup = 27E61A8F292965FC00FF6563 /* Products */; 182 | projectDirPath = ""; 183 | projectRoot = ""; 184 | targets = ( 185 | 27E61A8D292965FC00FF6563 /* OpenParsec */, 186 | ); 187 | }; 188 | /* End PBXProject section */ 189 | 190 | /* Begin PBXResourcesBuildPhase section */ 191 | 27E61A8C292965FC00FF6563 /* Resources */ = { 192 | isa = PBXResourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | 27E61A9E292965FD00FF6563 /* LaunchScreen.storyboard in Resources */, 196 | 27E61A9B292965FD00FF6563 /* Preview Assets.xcassets in Resources */, 197 | 27E61A98292965FD00FF6563 /* Assets.xcassets in Resources */, 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXResourcesBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | 27E61A8A292965FC00FF6563 /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 27E61A92292965FC00FF6563 /* AppDelegate.swift in Sources */, 209 | 27E61AAA2929B92200FF6563 /* MainView.swift in Sources */, 210 | 271D14FD292EAA3600D7F1D6 /* ParsecGLKViewController.swift in Sources */, 211 | 27E61AA8292994B500FF6563 /* ActivityIndicator.swift in Sources */, 212 | 271D14FC292EAA3600D7F1D6 /* ParsecGLKRenderer.swift in Sources */, 213 | 27E61A94292965FC00FF6563 /* SceneDelegate.swift in Sources */, 214 | 27899AC7292FE2A9001ACA33 /* audio.c in Sources */, 215 | 27E61AA62929817700FF6563 /* LoginView.swift in Sources */, 216 | 27B8D564292DC7A000A324AD /* CParsec.swift in Sources */, 217 | 27E61A96292965FC00FF6563 /* ContentView.swift in Sources */, 218 | 27ED36FF292D4F9800B1BE3D /* NetworkHandler.swift in Sources */, 219 | 271D14F9292E90EB00D7F1D6 /* ParsecView.swift in Sources */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | /* End PBXSourcesBuildPhase section */ 224 | 225 | /* Begin PBXVariantGroup section */ 226 | 27E61A9C292965FD00FF6563 /* LaunchScreen.storyboard */ = { 227 | isa = PBXVariantGroup; 228 | children = ( 229 | 27E61A9D292965FD00FF6563 /* Base */, 230 | ); 231 | name = LaunchScreen.storyboard; 232 | sourceTree = ""; 233 | }; 234 | /* End PBXVariantGroup section */ 235 | 236 | /* Begin XCBuildConfiguration section */ 237 | 27E61AA0292965FD00FF6563 /* Debug */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ALWAYS_SEARCH_USER_PATHS = NO; 241 | CLANG_ANALYZER_NONNULL = YES; 242 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_ENABLE_OBJC_WEAK = YES; 248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 249 | CLANG_WARN_BOOL_CONVERSION = YES; 250 | CLANG_WARN_COMMA = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INFINITE_RECURSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 265 | CLANG_WARN_STRICT_PROTOTYPES = YES; 266 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | COPY_PHASE_STRIP = NO; 271 | DEBUG_INFORMATION_FORMAT = dwarf; 272 | ENABLE_STRICT_OBJC_MSGSEND = YES; 273 | ENABLE_TESTABILITY = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu11; 275 | GCC_DYNAMIC_NO_PIC = NO; 276 | GCC_NO_COMMON_BLOCKS = YES; 277 | GCC_OPTIMIZATION_LEVEL = 0; 278 | GCC_PREPROCESSOR_DEFINITIONS = ( 279 | "DEBUG=1", 280 | "$(inherited)", 281 | ); 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 289 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 290 | MTL_FAST_MATH = YES; 291 | ONLY_ACTIVE_ARCH = YES; 292 | SDKROOT = iphoneos; 293 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 294 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 295 | }; 296 | name = Debug; 297 | }; 298 | 27E61AA1292965FD00FF6563 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_ANALYZER_NONNULL = YES; 303 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_ENABLE_OBJC_WEAK = YES; 309 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 310 | CLANG_WARN_BOOL_CONVERSION = YES; 311 | CLANG_WARN_COMMA = YES; 312 | CLANG_WARN_CONSTANT_CONVERSION = YES; 313 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INFINITE_RECURSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 322 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 333 | ENABLE_NS_ASSERTIONS = NO; 334 | ENABLE_STRICT_OBJC_MSGSEND = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu11; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 339 | GCC_WARN_UNDECLARED_SELECTOR = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 341 | GCC_WARN_UNUSED_FUNCTION = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 344 | MTL_ENABLE_DEBUG_INFO = NO; 345 | MTL_FAST_MATH = YES; 346 | SDKROOT = iphoneos; 347 | SWIFT_COMPILATION_MODE = wholemodule; 348 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 349 | VALIDATE_PRODUCT = YES; 350 | }; 351 | name = Release; 352 | }; 353 | 27E61AA3292965FD00FF6563 /* Debug */ = { 354 | isa = XCBuildConfiguration; 355 | buildSettings = { 356 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 357 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 358 | CLANG_ENABLE_MODULES = YES; 359 | CODE_SIGN_STYLE = Automatic; 360 | DEVELOPMENT_ASSET_PATHS = "\"OpenParsec/Preview Content\""; 361 | DEVELOPMENT_TEAM = NMU32WR5KZ; 362 | ENABLE_PREVIEWS = YES; 363 | INFOPLIST_FILE = OpenParsec/Info.plist; 364 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 365 | LD_RUNPATH_SEARCH_PATHS = ( 366 | "$(inherited)", 367 | "@executable_path/Frameworks", 368 | ); 369 | PRODUCT_BUNDLE_IDENTIFIER = io.github.AngelDTF.OpenParsec; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | SWIFT_OBJC_BRIDGING_HEADER = "OpenParsec/OpenParsec-Bridging-Header.h"; 372 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 373 | SWIFT_VERSION = 5.0; 374 | SYSTEM_FRAMEWORK_SEARCH_PATHS = $PROJECT_DIR/Frameworks; 375 | TARGETED_DEVICE_FAMILY = "1,2"; 376 | VALIDATE_WORKSPACE = YES; 377 | }; 378 | name = Debug; 379 | }; 380 | 27E61AA4292965FD00FF6563 /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 384 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 385 | CLANG_ENABLE_MODULES = YES; 386 | CODE_SIGN_STYLE = Automatic; 387 | DEVELOPMENT_ASSET_PATHS = "\"OpenParsec/Preview Content\""; 388 | DEVELOPMENT_TEAM = NMU32WR5KZ; 389 | ENABLE_PREVIEWS = YES; 390 | INFOPLIST_FILE = OpenParsec/Info.plist; 391 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 392 | LD_RUNPATH_SEARCH_PATHS = ( 393 | "$(inherited)", 394 | "@executable_path/Frameworks", 395 | ); 396 | PRODUCT_BUNDLE_IDENTIFIER = io.github.AngelDTF.OpenParsec; 397 | PRODUCT_NAME = "$(TARGET_NAME)"; 398 | SWIFT_OBJC_BRIDGING_HEADER = "OpenParsec/OpenParsec-Bridging-Header.h"; 399 | SWIFT_VERSION = 5.0; 400 | SYSTEM_FRAMEWORK_SEARCH_PATHS = $PROJECT_DIR/Frameworks; 401 | TARGETED_DEVICE_FAMILY = "1,2"; 402 | VALIDATE_WORKSPACE = YES; 403 | }; 404 | name = Release; 405 | }; 406 | /* End XCBuildConfiguration section */ 407 | 408 | /* Begin XCConfigurationList section */ 409 | 27E61A89292965FC00FF6563 /* Build configuration list for PBXProject "OpenParsec" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | 27E61AA0292965FD00FF6563 /* Debug */, 413 | 27E61AA1292965FD00FF6563 /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | 27E61AA2292965FD00FF6563 /* Build configuration list for PBXNativeTarget "OpenParsec" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | 27E61AA3292965FD00FF6563 /* Debug */, 422 | 27E61AA4292965FD00FF6563 /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | /* End XCConfigurationList section */ 428 | }; 429 | rootObject = 27E61A86292965FC00FF6563 /* Project object */; 430 | } 431 | -------------------------------------------------------------------------------- /OpenParsec.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OpenParsec.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /OpenParsec/ActivityIndicator.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SwiftUI 3 | 4 | struct ActivityIndicator: UIViewRepresentable 5 | { 6 | @Binding var isAnimating:Bool 7 | let style:UIActivityIndicatorView.Style 8 | var tint:UIColor 9 | 10 | func makeUIView(context:UIViewRepresentableContext) -> UIActivityIndicatorView 11 | { 12 | let uiView:UIActivityIndicatorView = UIActivityIndicatorView(style:style) 13 | uiView.color = tint; 14 | return uiView 15 | } 16 | 17 | func updateUIView(_ uiView:UIActivityIndicatorView, context:UIViewRepresentableContext) 18 | { 19 | isAnimating ? uiView.startAnimating() : uiView.stopAnimating() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /OpenParsec/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | @main 4 | class AppDelegate:UIResponder, UIApplicationDelegate 5 | { 6 | func application(_ application:UIApplication, didFinishLaunchingWithOptions launchOptions:[UIApplication.LaunchOptionsKey: Any]?) -> Bool 7 | { 8 | // Override point for customization after application launch. 9 | return true 10 | } 11 | 12 | func application(_ application:UIApplication, configurationForConnecting connectingSceneSession:UISceneSession, options:UIScene.ConnectionOptions) -> UISceneConfiguration 13 | { 14 | // Called when a new scene session is being created. 15 | // Use this method to select a configuration to create the new scene with. 16 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 17 | } 18 | 19 | func application(_ application:UIApplication, didDiscardSceneSessions sceneSessions:Set) 20 | { 21 | // Called when the user discards a scene session. 22 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 23 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 24 | } 25 | 26 | func applicationWillTerminate(_ application: UIApplication) 27 | { 28 | CParsec.destroy() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "1.000", 9 | "green" : "0.250", 10 | "red" : "0.625" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "icon-20@2x.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "icon-20@3x.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "icon-29@2x.png", 17 | "idiom" : "iphone", 18 | "scale" : "2x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "icon-29@3x.png", 23 | "idiom" : "iphone", 24 | "scale" : "3x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "icon-40@2x.png", 29 | "idiom" : "iphone", 30 | "scale" : "2x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "filename" : "icon-40@3x.png", 35 | "idiom" : "iphone", 36 | "scale" : "3x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "icon-60@2x.png", 41 | "idiom" : "iphone", 42 | "scale" : "2x", 43 | "size" : "60x60" 44 | }, 45 | { 46 | "filename" : "icon-60@3x.png", 47 | "idiom" : "iphone", 48 | "scale" : "3x", 49 | "size" : "60x60" 50 | }, 51 | { 52 | "filename" : "icon-20.png", 53 | "idiom" : "ipad", 54 | "scale" : "1x", 55 | "size" : "20x20" 56 | }, 57 | { 58 | "filename" : "icon-20@2x.png", 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "20x20" 62 | }, 63 | { 64 | "filename" : "icon-29.png", 65 | "idiom" : "ipad", 66 | "scale" : "1x", 67 | "size" : "29x29" 68 | }, 69 | { 70 | "filename" : "icon-29@2x.png", 71 | "idiom" : "ipad", 72 | "scale" : "2x", 73 | "size" : "29x29" 74 | }, 75 | { 76 | "filename" : "icon-40.png", 77 | "idiom" : "ipad", 78 | "scale" : "1x", 79 | "size" : "40x40" 80 | }, 81 | { 82 | "filename" : "icon-40@2x.png", 83 | "idiom" : "ipad", 84 | "scale" : "2x", 85 | "size" : "40x40" 86 | }, 87 | { 88 | "filename" : "icon-76.png", 89 | "idiom" : "ipad", 90 | "scale" : "1x", 91 | "size" : "76x76" 92 | }, 93 | { 94 | "filename" : "icon-76@2x.png", 95 | "idiom" : "ipad", 96 | "scale" : "2x", 97 | "size" : "76x76" 98 | }, 99 | { 100 | "filename" : "icon-83.5@2x.png", 101 | "idiom" : "ipad", 102 | "scale" : "2x", 103 | "size" : "83.5x83.5" 104 | }, 105 | { 106 | "filename" : "icon-1024.png", 107 | "idiom" : "ios-marketing", 108 | "scale" : "1x", 109 | "size" : "1024x1024" 110 | } 111 | ], 112 | "info" : { 113 | "author" : "xcode", 114 | "version" : 1 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-20.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/BackgroundButton.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "0.300", 8 | "blue" : "0.525", 9 | "green" : "0.500", 10 | "red" : "0.500" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/BackgroundCard.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.205", 9 | "green" : "0.200", 10 | "red" : "0.200" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/BackgroundField.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "0.500", 8 | "blue" : "0.215", 9 | "green" : "0.200", 10 | "red" : "0.200" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/BackgroundGray.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.110", 9 | "green" : "0.100", 10 | "red" : "0.100" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/BackgroundPrompt.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "0.255", 9 | "green" : "0.250", 10 | "red" : "0.250" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/Foreground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "1.000", 9 | "green" : "1.000", 10 | "red" : "1.000" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/IconTransparent.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "icon_transparent.png", 5 | "idiom" : "universal" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/IconTransparent.imageset/icon_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/IconTransparent.imageset/icon_transparent.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/LogoShadow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "logo_shadow.png", 5 | "idiom" : "universal" 6 | } 7 | ], 8 | "info" : { 9 | "author" : "xcode", 10 | "version" : 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/LogoShadow.imageset/logo_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaxjiang96/OpenParsec/8253a632dbc9b1f5c09323ca2402f95d2634c18d/OpenParsec/Assets.xcassets/LogoShadow.imageset/logo_shadow.png -------------------------------------------------------------------------------- /OpenParsec/Assets.xcassets/Shading.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "0.500", 8 | "blue" : "0.000", 9 | "green" : "0.000", 10 | "red" : "0.000" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | } 15 | ], 16 | "info" : { 17 | "author" : "xcode", 18 | "version" : 1 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenParsec/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /OpenParsec/CParsec.swift: -------------------------------------------------------------------------------- 1 | import ParsecSDK 2 | import UIKit 3 | 4 | enum RendererType 5 | { 6 | case opengl 7 | } 8 | 9 | class CParsec 10 | { 11 | private static var _initted:Bool = false 12 | 13 | private static var _parsec:OpaquePointer! 14 | private static var _audio:OpaquePointer! 15 | private static let _audioPtr:UnsafeRawPointer = UnsafeRawPointer(_audio) 16 | 17 | static let PARSEC_VER:UInt32 = UInt32((PARSEC_VER_MAJOR << 16) | PARSEC_VER_MINOR) 18 | 19 | static func initialize() 20 | { 21 | if _initted { return } 22 | 23 | print("Parsec SDK Version: " + String(CParsec.PARSEC_VER)) 24 | 25 | ParsecSetLogCallback( 26 | { (level, msg, opaque) in 27 | print("[\(level == LOG_DEBUG ? "D" : "I")] \(String(cString:msg!))") 28 | }, nil) 29 | 30 | audio_init(&_audio) 31 | 32 | ParsecInit(PARSEC_VER, nil, nil, &_parsec) 33 | 34 | _initted = true 35 | } 36 | 37 | static func destroy() 38 | { 39 | if !_initted { return } 40 | 41 | ParsecDestroy(_parsec) 42 | audio_destroy(&_audio) 43 | } 44 | 45 | static func connect(_ peerID:String) -> ParsecStatus 46 | { 47 | return ParsecClientConnect(_parsec, nil, NetworkHandler.clinfo?.session_id, peerID) 48 | } 49 | 50 | static func disconnect() 51 | { 52 | ParsecClientDisconnect(_parsec) 53 | } 54 | 55 | static func getStatus() -> ParsecStatus 56 | { 57 | return ParsecClientGetStatus(_parsec, nil) 58 | } 59 | 60 | static func setFrame(_ width:CGFloat, _ height:CGFloat, _ scale:CGFloat) 61 | { 62 | ParsecClientSetDimensions(_parsec, UInt8(DEFAULT_STREAM), UInt32(width), UInt32(height), Float(scale)) 63 | } 64 | 65 | static func renderFrame(_ type:RendererType, timeout:UInt32 = 16) // timeout in ms, 16 == 60 FPS, 8 == 120 FPS 66 | { 67 | switch type 68 | { 69 | case .opengl: 70 | ParsecClientGLRenderFrame(_parsec, UInt8(DEFAULT_STREAM), nil, nil, timeout) 71 | } 72 | } 73 | 74 | static func pollAudio(timeout:UInt32 = 16) // timeout in ms, 16 == 60 FPS, 8 == 120 FPS 75 | { 76 | ParsecClientPollAudio(_parsec, audio_cb, timeout, _audioPtr) 77 | } 78 | 79 | static func setMuted(_ muted:Bool) 80 | { 81 | audio_mute(muted) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /OpenParsec/ContentView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | enum ViewType 4 | { 5 | case login 6 | case main 7 | case parsec 8 | } 9 | 10 | struct ContentView:View 11 | { 12 | @State var curView:ViewType = .login 13 | 14 | let defaultTransition = AnyTransition.move(edge:.trailing) 15 | 16 | var body:some View 17 | { 18 | ZStack() 19 | { 20 | switch curView 21 | { 22 | case .login: 23 | LoginView(self) 24 | case .main: 25 | MainView(self) 26 | .transition(defaultTransition) 27 | case .parsec: 28 | ParsecView(self) 29 | } 30 | } 31 | .background(Rectangle().fill(Color.black).edgesIgnoringSafeArea(.all)) 32 | .onAppear { CParsec.initialize() } 33 | } 34 | 35 | public func setView(_ t:ViewType) 36 | { 37 | withAnimation(.easeInOut) { curView = t } 38 | } 39 | } 40 | 41 | struct ContentView_Previews:PreviewProvider 42 | { 43 | static var previews:some View 44 | { 45 | ContentView() 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /OpenParsec/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UIApplicationSupportsIndirectInputEvents 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UIRequiresFullScreen 49 | 50 | UIStatusBarStyle 51 | UIStatusBarStyleLightContent 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UISupportedInterfaceOrientations~ipad 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | UIViewControllerBasedStatusBarAppearance 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /OpenParsec/LoginView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | struct LoginView:View 4 | { 5 | var controller:ContentView? 6 | 7 | @State var inputEmail:String = "" 8 | @State var inputPassword:String = "" 9 | @State var isLoading:Bool = false 10 | @State var showAlert:Bool = false 11 | @State var alertText:String = "" 12 | 13 | init(_ controller:ContentView?) 14 | { 15 | self.controller = controller 16 | } 17 | 18 | var body:some View 19 | { 20 | ZStack() 21 | { 22 | // Background 23 | Rectangle() 24 | .fill(Color("BackgroundGray")) 25 | .edgesIgnoringSafeArea(/*@START_MENU_TOKEN@*/.all/*@END_MENU_TOKEN@*/) 26 | 27 | // Login controls 28 | VStack(spacing:8) 29 | { 30 | HStack(spacing:2) 31 | { 32 | Image("IconTransparent") 33 | .resizable() 34 | .aspectRatio(contentMode: .fit) 35 | Image("LogoShadow") 36 | .resizable() 37 | .aspectRatio(contentMode: .fit) 38 | .padding([.top, .bottom, .trailing]) 39 | } 40 | .frame(height:80) 41 | TextField("Email", text: $inputEmail) 42 | .padding() 43 | .background(Rectangle().fill(Color("BackgroundField"))) 44 | .cornerRadius(8) 45 | .disableAutocorrection(true) 46 | .autocapitalization(/*@START_MENU_TOKEN@*/.none/*@END_MENU_TOKEN@*/) 47 | .keyboardType(.emailAddress) 48 | .textContentType(.emailAddress) 49 | SecureField("Password", text: $inputPassword) 50 | .padding() 51 | .background(Rectangle().fill(Color("BackgroundField"))) 52 | .cornerRadius(8) 53 | .disableAutocorrection(true) 54 | .autocapitalization(/*@START_MENU_TOKEN@*/.none/*@END_MENU_TOKEN@*/) 55 | .textContentType(.password) 56 | Button(action:authenticate) 57 | { 58 | ZStack() 59 | { 60 | Rectangle() 61 | .fill(Color("AccentColor")) 62 | .cornerRadius(8) 63 | Text("Login") 64 | .foregroundColor(.white) 65 | } 66 | .frame(height:54) 67 | } 68 | } 69 | .padding() 70 | .frame(maxWidth:400) 71 | .disabled(isLoading) // Disable when loading 72 | 73 | // Loading elements 74 | if isLoading 75 | { 76 | ZStack() 77 | { 78 | Rectangle() // Darken background 79 | .fill(Color.black) 80 | .opacity(0.5) 81 | .edgesIgnoringSafeArea(.all) 82 | VStack() 83 | { 84 | ActivityIndicator(isAnimating:$isLoading, style:.large, tint:.white) 85 | .padding() 86 | Text("Loading...") 87 | .multilineTextAlignment(.center) 88 | } 89 | .padding() 90 | .background(Rectangle().fill(Color("BackgroundPrompt"))) 91 | .cornerRadius(8) 92 | .padding() 93 | } 94 | } 95 | } 96 | .foregroundColor(Color("Foreground")) 97 | .alert(isPresented:$showAlert) 98 | { 99 | Alert(title:Text(alertText)) 100 | } 101 | } 102 | 103 | func authenticate() 104 | { 105 | #if DEBUG 106 | if inputEmail == "test@example.com" // skip authentication (DEBUG ONLY) 107 | { 108 | if let c = controller 109 | { 110 | c.setView(.main) 111 | } 112 | return 113 | } 114 | #endif 115 | 116 | withAnimation { isLoading = true } 117 | 118 | let apiURL = URL(string:"https://kessel-api.parsecgaming.com/v1/auth")! 119 | 120 | var request = URLRequest(url:apiURL) 121 | request.httpMethod = "POST"; 122 | request.setValue("application/json", forHTTPHeaderField:"Content-Type") 123 | request.httpBody = try? JSONSerialization.data(withJSONObject: 124 | [ 125 | "email":inputEmail, 126 | "password":inputPassword 127 | ], options:[]) 128 | 129 | let task = URLSession.shared.dataTask(with:request) 130 | { (data, response, error) in 131 | isLoading = false 132 | if let data = data 133 | { 134 | let statusCode:Int = (response as! HTTPURLResponse).statusCode 135 | let decoder = JSONDecoder() 136 | 137 | print(statusCode) 138 | print(String(data:data, encoding:.utf8)!) 139 | 140 | if statusCode == 201 // 201 Created 141 | { 142 | NetworkHandler.clinfo = try? decoder.decode(ClientInfo.self, from:data) 143 | 144 | if let c = controller 145 | { 146 | c.setView(.main) 147 | } 148 | } 149 | else if statusCode >= 400 // 4XX client errors 150 | { 151 | let info:ErrorInfo = try! decoder.decode(ErrorInfo.self, from:data) 152 | 153 | alertText = "Error: \(info.error)" 154 | showAlert = true 155 | } 156 | } 157 | } 158 | task.resume() 159 | } 160 | } 161 | 162 | struct LoginView_Previews:PreviewProvider 163 | { 164 | static var previews:some View 165 | { 166 | LoginView(nil) 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /OpenParsec/MainView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import ParsecSDK 3 | 4 | struct MainView:View 5 | { 6 | var controller:ContentView? 7 | 8 | @State var refreshTime:String = "Last refreshed at 1/1/1970 12:00 AM" 9 | @State var hosts:Array = [] 10 | 11 | @State var showBaseAlert:Bool = false 12 | @State var baseAlertText:String = "" 13 | 14 | @State var showLogoutAlert:Bool = false 15 | 16 | @State var isConnecting:Bool = false 17 | @State var connectingToName:String = "" 18 | @State var pollTimer:Timer? 19 | 20 | @State var isRefreshing:Bool = false 21 | 22 | @State var inSettings:Bool = false 23 | 24 | var busy:Bool 25 | { 26 | isConnecting || isRefreshing || inSettings 27 | } 28 | 29 | init(_ controller:ContentView?) 30 | { 31 | self.controller = controller 32 | } 33 | 34 | var body:some View 35 | { 36 | ZStack() 37 | { 38 | // Background 39 | Rectangle() 40 | .fill(Color("BackgroundGray")) 41 | .edgesIgnoringSafeArea(.all) 42 | 43 | // Main controls 44 | VStack() 45 | { 46 | // Navigation controls 47 | ZStack() 48 | { 49 | Rectangle() 50 | .fill(Color("BackgroundGray")) 51 | .frame(height:52) 52 | .shadow(color:Color("Shading"), radius:4, y:6) 53 | HStack() 54 | { 55 | Button(action:{ showLogoutAlert = true }, label:{ Image(systemName:"chevron.left") }) 56 | .padding() 57 | .alert(isPresented:$showLogoutAlert) 58 | { 59 | Alert(title:Text("Are you sure you want to logout?"), primaryButton:.destructive(Text("Logout"), action:logout), secondaryButton:.cancel(Text("Cancel"))) 60 | } 61 | Spacer() 62 | Button(action:refreshList, label:{ Image(systemName:"arrow.clockwise") }) 63 | .padding() 64 | // Button(action:{ withAnimation { inSettings = true } }, label:{ Image(systemName:"gear") }) 65 | // .padding() 66 | } 67 | .foregroundColor(Color("AccentColor")) 68 | } 69 | .zIndex(1) 70 | 71 | ScrollView(.vertical) 72 | { 73 | VStack() 74 | { 75 | Text(refreshTime) 76 | .multilineTextAlignment(.center) 77 | .opacity(0.5) 78 | ForEach(hosts) 79 | { i in 80 | VStack() 81 | { 82 | Image("IconTransparent") 83 | .resizable() 84 | .aspectRatio(contentMode: .fit) 85 | .frame(width:64, height:64) 86 | .background(Rectangle().fill(Color("BackgroundPrompt"))) 87 | .cornerRadius(8) 88 | Text(i.hostname) 89 | .font(.system(size:20, weight:.medium)) 90 | .multilineTextAlignment(.center) 91 | Text("\(i.user.name)#\(String(i.user.id))") 92 | .font(.system(size:16, weight:.medium)) 93 | .multilineTextAlignment(.center) 94 | .opacity(0.5) 95 | Button(action:{ connectTo(i) }) 96 | { 97 | ZStack() 98 | { 99 | Rectangle() 100 | .fill(Color("AccentColor")) 101 | .cornerRadius(8) 102 | Text("Connect") 103 | .foregroundColor(.white) 104 | .padding(8) 105 | } 106 | .frame(maxWidth:100) 107 | } 108 | } 109 | .padding() 110 | .frame(maxWidth:400) 111 | .background(Rectangle().fill(Color("BackgroundCard"))) 112 | .cornerRadius(8) 113 | } 114 | } 115 | .padding() 116 | } 117 | .padding(.top, -8) 118 | .frame(maxWidth:.infinity) 119 | .alert(isPresented:$showBaseAlert) 120 | { 121 | Alert(title:Text(baseAlertText)) 122 | } 123 | } 124 | .onAppear(perform:refreshList) 125 | .disabled(busy) // disable view if busy 126 | 127 | // Loading elements 128 | if isConnecting 129 | { 130 | ZStack() 131 | { 132 | Rectangle() // Darken background 133 | .fill(Color.black) 134 | .opacity(0.5) 135 | .edgesIgnoringSafeArea(.all) 136 | VStack() 137 | { 138 | ActivityIndicator(isAnimating:$isConnecting, style:.large, tint:.white) 139 | .padding() 140 | Text("Requesting connection to \(connectingToName)...") 141 | .multilineTextAlignment(.center) 142 | Button(action:cancelConnection) 143 | { 144 | ZStack() 145 | { 146 | Rectangle() 147 | .fill(Color("BackgroundButton")) 148 | .cornerRadius(8) 149 | Text("Cancel") 150 | .foregroundColor(.red) 151 | } 152 | } 153 | .frame(maxWidth:100, maxHeight:48) 154 | } 155 | .padding() 156 | .background(Rectangle().fill(Color("BackgroundPrompt"))) 157 | .cornerRadius(8) 158 | .padding() 159 | } 160 | } 161 | if isRefreshing 162 | { 163 | ZStack() 164 | { 165 | Rectangle() // Darken background 166 | .fill(Color.black) 167 | .opacity(0.5) 168 | .edgesIgnoringSafeArea(.all) 169 | VStack() 170 | { 171 | ActivityIndicator(isAnimating:$isRefreshing, style:.large, tint:.white) 172 | .padding() 173 | Text("Refreshing hosts...") 174 | .multilineTextAlignment(.center) 175 | } 176 | .padding() 177 | .background(Rectangle().fill(Color("BackgroundPrompt"))) 178 | .cornerRadius(8) 179 | .padding() 180 | } 181 | } 182 | 183 | // Settings screen 184 | if inSettings 185 | { 186 | ZStack() 187 | { 188 | Rectangle() // Darken background 189 | .fill(Color.black) 190 | .opacity(0.5) 191 | .edgesIgnoringSafeArea(.all) 192 | VStack() 193 | { 194 | HStack() 195 | { 196 | Button(action:{ withAnimation { inSettings = false } }, label:{ Image(systemName:"xmark") }) 197 | Spacer() 198 | } 199 | .foregroundColor(Color("AccentColor")) 200 | ScrollView(.vertical) 201 | { 202 | 203 | } 204 | } 205 | .padding() 206 | .background(Rectangle().fill(Color("BackgroundGray"))) 207 | .cornerRadius(8) 208 | .padding() 209 | } 210 | } 211 | } 212 | .foregroundColor(Color("Foreground")) 213 | } 214 | 215 | func refreshList() 216 | { 217 | withAnimation 218 | { 219 | isRefreshing = true 220 | 221 | let clinfo = NetworkHandler.clinfo 222 | if clinfo == nil 223 | { 224 | isRefreshing = false; 225 | baseAlertText = "Error gathering hosts: Invalid session" 226 | showBaseAlert = true 227 | return 228 | } 229 | 230 | let apiURL = URL(string:"https://kessel-api.parsecgaming.com/v2/hosts?mode=desktop&public=false")! 231 | 232 | var request = URLRequest(url:apiURL) 233 | request.httpMethod = "GET"; 234 | request.setValue("application/json", forHTTPHeaderField:"Content-Type") 235 | request.setValue("Bearer \(clinfo!.session_id)", forHTTPHeaderField:"Authorization") 236 | 237 | let task = URLSession.shared.dataTask(with:request) 238 | { (data, response, error) in 239 | if let data = data 240 | { 241 | let statusCode:Int = (response as! HTTPURLResponse).statusCode 242 | let decoder = JSONDecoder() 243 | 244 | print(statusCode) 245 | print(String(data:data, encoding:.utf8)!) 246 | 247 | if statusCode == 200 // 200 OK 248 | { 249 | let info:HostInfoList = try! decoder.decode(HostInfoList.self, from:data) 250 | hosts.removeAll() 251 | info.data.forEach 252 | { h in 253 | hosts.append(IdentifiableHostInfo(id:h.peer_id, hostname:h.name, user:h.user)) 254 | } 255 | 256 | let formatter = DateFormatter() 257 | formatter.dateFormat = "M/d/yyyy h:mm a" 258 | refreshTime = "Last refreshed at \(formatter.string(from:Date()))" 259 | } 260 | else if statusCode == 403 // 403 Forbidden 261 | { 262 | let info:ErrorInfo = try! decoder.decode(ErrorInfo.self, from:data) 263 | 264 | baseAlertText = "Error gathering hosts: \(info.error)" 265 | showBaseAlert = true 266 | } 267 | } 268 | 269 | isRefreshing = false 270 | } 271 | task.resume() 272 | } 273 | } 274 | 275 | func connectTo(_ who:IdentifiableHostInfo) 276 | { 277 | connectingToName = who.hostname 278 | withAnimation { isConnecting = true } 279 | 280 | var status = CParsec.connect(who.id) 281 | 282 | // Polling status 283 | pollTimer = Timer.scheduledTimer(withTimeInterval:1, repeats:true) 284 | { timer in 285 | status = CParsec.getStatus() 286 | 287 | if status == PARSEC_CONNECTING { return } // wait 288 | 289 | withAnimation { isConnecting = false } 290 | 291 | if status == PARSEC_OK 292 | { 293 | if let c = controller 294 | { 295 | c.setView(.parsec) 296 | } 297 | } 298 | else 299 | { 300 | baseAlertText = "Error connecting to host (code \(status.rawValue))" 301 | showBaseAlert = true 302 | } 303 | 304 | timer.invalidate() 305 | } 306 | } 307 | 308 | func cancelConnection() 309 | { 310 | withAnimation { isConnecting = false } 311 | 312 | CParsec.disconnect() 313 | 314 | pollTimer!.invalidate() 315 | } 316 | 317 | func logout() 318 | { 319 | NetworkHandler.clinfo = nil 320 | if let c = controller 321 | { 322 | c.setView(.login) 323 | } 324 | } 325 | } 326 | 327 | struct MainView_Previews:PreviewProvider 328 | { 329 | static var previews:some View 330 | { 331 | MainView(nil) 332 | } 333 | } 334 | 335 | struct IdentifiableHostInfo:Identifiable 336 | { 337 | var id:String // Peer ID 338 | var hostname:String 339 | var user:UserInfo 340 | } 341 | -------------------------------------------------------------------------------- /OpenParsec/NetworkHandler.swift: -------------------------------------------------------------------------------- 1 | class NetworkHandler 2 | { 3 | public static var clinfo:ClientInfo? = nil 4 | } 5 | 6 | struct ErrorInfo:Decodable 7 | { 8 | var error:String 9 | // var codes:Array 10 | } 11 | 12 | struct ClientInfo:Decodable 13 | { 14 | var instance_id:String 15 | var user_id:Int 16 | var session_id:String 17 | var host_peer_id:String 18 | } 19 | 20 | struct UserInfo:Decodable 21 | { 22 | var id:Int 23 | var name:String 24 | var warp:Bool 25 | var external_id:String 26 | var external_provider:String 27 | var team_id:String 28 | } 29 | 30 | struct HostInfo:Decodable 31 | { 32 | var user:UserInfo 33 | var peer_id:String 34 | var game_id:String 35 | var description:String 36 | var max_players:Int 37 | var mode:String 38 | var name:String 39 | var event_name:String 40 | var players:Int 41 | // var public:Bool 42 | var guest_access:Bool 43 | var online:Bool 44 | // var self:Bool 45 | var build:String 46 | } 47 | 48 | struct HostInfoList:Decodable 49 | { 50 | var data:Array 51 | var has_more:Bool 52 | } 53 | -------------------------------------------------------------------------------- /OpenParsec/OpenParsec-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "audio.h" 6 | -------------------------------------------------------------------------------- /OpenParsec/ParsecGLKRenderer.swift: -------------------------------------------------------------------------------- 1 | import GLKit 2 | import ParsecSDK 3 | 4 | class ParsecGLKRenderer:NSObject, GLKViewDelegate, GLKViewControllerDelegate 5 | { 6 | var glkView:GLKView 7 | var glkViewController:GLKViewController 8 | 9 | init(_ view:GLKView, _ viewController:GLKViewController) 10 | { 11 | glkView = view 12 | glkViewController = viewController 13 | 14 | super.init() 15 | 16 | glkView.delegate = self 17 | glkViewController.delegate = self 18 | } 19 | 20 | deinit 21 | { 22 | glkView.delegate = nil 23 | glkViewController.delegate = nil 24 | } 25 | 26 | func glkView(_ view:GLKView, drawIn rect:CGRect) 27 | { 28 | CParsec.pollAudio() 29 | CParsec.setFrame(view.frame.size.width, view.frame.size.height, view.contentScaleFactor) 30 | CParsec.renderFrame(.opengl) 31 | glFinish() 32 | } 33 | 34 | func glkViewControllerUpdate(_ controller:GLKViewController) { } 35 | } 36 | -------------------------------------------------------------------------------- /OpenParsec/ParsecGLKViewController.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import GLKit 3 | 4 | struct ParsecGLKViewController:UIViewControllerRepresentable 5 | { 6 | let glkView = GLKView() 7 | let glkViewController = GLKViewController() 8 | 9 | func makeCoordinator() -> ParsecGLKRenderer 10 | { 11 | ParsecGLKRenderer(glkView, glkViewController) 12 | } 13 | 14 | func makeUIViewController(context:UIViewControllerRepresentableContext) -> GLKViewController 15 | { 16 | glkView.context = EAGLContext(api:.openGLES3)! 17 | glkViewController.view = glkView 18 | glkViewController.preferredFramesPerSecond = 60 19 | return glkViewController 20 | } 21 | 22 | func updateUIViewController(_ uiViewController:GLKViewController, context:UIViewControllerRepresentableContext) { } 23 | } 24 | -------------------------------------------------------------------------------- /OpenParsec/ParsecView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | import ParsecSDK 3 | 4 | struct ParsecView:View 5 | { 6 | var controller:ContentView? 7 | 8 | @State var pollTimer:Timer? 9 | 10 | @State var showDCAlert:Bool = false 11 | @State var DCAlertText:String = "Disconnected (reason unknown)" 12 | 13 | @State var hideOverlay:Bool = false 14 | @State var showMenu:Bool = false 15 | 16 | @State var muted:Bool = false 17 | 18 | init(_ controller:ContentView?) 19 | { 20 | self.controller = controller 21 | } 22 | 23 | var body:some View 24 | { 25 | ZStack() 26 | { 27 | // Stream view controller 28 | ParsecGLKViewController() 29 | .zIndex(0) 30 | 31 | // Overlay elements 32 | VStack() 33 | { 34 | if !hideOverlay 35 | { 36 | HStack() 37 | { 38 | Button(action:{ showMenu.toggle() }) 39 | { 40 | Image("IconTransparent") 41 | .resizable() 42 | .aspectRatio(contentMode: .fit) 43 | .frame(width:48, height:48) 44 | .background(Rectangle().fill(Color("BackgroundPrompt").opacity(showMenu ? 0.75 : 1))) 45 | .cornerRadius(8) 46 | .opacity(showMenu ? 1 : 0.25) 47 | } 48 | .padding() 49 | Spacer() 50 | } 51 | } 52 | if showMenu 53 | { 54 | HStack() 55 | { 56 | VStack(spacing:3) 57 | { 58 | Button(action:disableOverlay) 59 | { 60 | Text("Hide Overlay") 61 | .padding(12) 62 | .frame(maxWidth:.infinity) 63 | .multilineTextAlignment(.center) 64 | } 65 | Button(action:toggleMute) 66 | { 67 | Text("Sound \(muted ? "OFF" : "ON")") 68 | .padding(12) 69 | .frame(maxWidth:.infinity) 70 | .multilineTextAlignment(.center) 71 | } 72 | Rectangle() 73 | .fill(Color("Foreground")) 74 | .opacity(0.25) 75 | .frame(height:1) 76 | Button(action:disconnect) 77 | { 78 | Text("Disconnect") 79 | .foregroundColor(.red) 80 | .padding(12) 81 | .frame(maxWidth:.infinity) 82 | .multilineTextAlignment(.center) 83 | } 84 | } 85 | .background(Rectangle().fill(Color("BackgroundPrompt").opacity(0.75))) 86 | .foregroundColor(Color("Foreground")) 87 | .frame(maxWidth:175) 88 | .cornerRadius(8) 89 | .padding(.horizontal) 90 | Spacer() 91 | } 92 | } 93 | Spacer() 94 | } 95 | .zIndex(1) 96 | } 97 | .statusBar(hidden:true) 98 | .alert(isPresented:$showDCAlert) 99 | { 100 | Alert(title:Text(DCAlertText), dismissButton:.default(Text("Close"), action:disconnect)) 101 | } 102 | .onAppear(perform:startPollTimer) 103 | .onDisappear(perform:stopPollTimer) 104 | } 105 | 106 | func startPollTimer() 107 | { 108 | if pollTimer != nil { return } 109 | pollTimer = Timer.scheduledTimer(withTimeInterval:1, repeats:true) 110 | { timer in 111 | let status = CParsec.getStatus() 112 | if status != PARSEC_OK 113 | { 114 | DCAlertText = "Disconnected (code \(status.rawValue))" 115 | showDCAlert = true 116 | timer.invalidate() 117 | } 118 | } 119 | CParsec.setMuted(muted) 120 | } 121 | 122 | func stopPollTimer() 123 | { 124 | pollTimer!.invalidate() 125 | } 126 | 127 | func disableOverlay() 128 | { 129 | hideOverlay = true 130 | showMenu = false 131 | } 132 | 133 | func toggleMute() 134 | { 135 | muted.toggle() 136 | CParsec.setMuted(muted) 137 | } 138 | 139 | func disconnect() 140 | { 141 | CParsec.disconnect() 142 | 143 | if let c = controller 144 | { 145 | c.setView(.main) 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /OpenParsec/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /OpenParsec/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SwiftUI 3 | 4 | class SceneDelegate:UIResponder, UIWindowSceneDelegate 5 | { 6 | var window:UIWindow? 7 | 8 | func scene(_ scene:UIScene, willConnectTo session:UISceneSession, options connectionOptions:UIScene.ConnectionOptions) 9 | { 10 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 11 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 12 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 13 | 14 | // Create the SwiftUI view that provides the window contents. 15 | let contentView = ContentView() 16 | 17 | // Use a UIHostingController as window root view controller. 18 | if let windowScene = scene as? UIWindowScene 19 | { 20 | let window = UIWindow(windowScene: windowScene) 21 | window.rootViewController = UIHostingController(rootView: contentView) 22 | self.window = window 23 | window.makeKeyAndVisible() 24 | } 25 | } 26 | 27 | func sceneDidDisconnect(_ scene:UIScene) 28 | { 29 | // Called as the scene is being released by the system. 30 | // This occurs shortly after the scene enters the background, or when its session is discarded. 31 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 32 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 33 | } 34 | 35 | func sceneDidBecomeActive(_ scene:UIScene) 36 | { 37 | // Called when the scene has moved from an inactive state to an active state. 38 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 39 | } 40 | 41 | func sceneWillResignActive(_ scene:UIScene) 42 | { 43 | // Called when the scene will move from an active state to an inactive state. 44 | // This may occur due to temporary interruptions (ex. an incoming phone call). 45 | } 46 | 47 | func sceneWillEnterForeground(_ scene:UIScene) 48 | { 49 | // Called as the scene transitions from the background to the foreground. 50 | // Use this method to undo the changes made on entering the background. 51 | } 52 | 53 | func sceneDidEnterBackground(_ scene:UIScene) 54 | { 55 | // Called as the scene transitions from the foreground to the background. 56 | // Use this method to save data, release shared resources, and store enough scene-specific state information 57 | // to restore the scene back to its current state. 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /OpenParsec/audio.c: -------------------------------------------------------------------------------- 1 | #include "audio.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | #define NUM_AUDIO_BUF 16 8 | #define BUFFER_SIZE 4096 9 | 10 | bool isMuted = false; 11 | 12 | struct audio { 13 | AudioQueueRef q; 14 | AudioQueueBufferRef audio_buf[NUM_AUDIO_BUF]; 15 | int32_t buf_index; 16 | int32_t in_use; 17 | }; 18 | 19 | static void audio_queue_callback(void *opaque, AudioQueueRef queue, AudioQueueBufferRef buffer) 20 | { 21 | struct audio *ctx = (struct audio *) opaque; 22 | 23 | if (ctx == NULL) 24 | return; 25 | 26 | buffer->mAudioDataByteSize = 0; 27 | if (ctx->in_use > 0) 28 | ctx->in_use--; 29 | 30 | if (ctx->in_use == 0) 31 | AudioQueueStop(ctx->q, true); 32 | } 33 | 34 | void audio_init(struct audio **ctx_out) 35 | { 36 | struct audio *ctx = *ctx_out = calloc(1, sizeof(struct audio)); 37 | 38 | AudioStreamBasicDescription format; 39 | format.mSampleRate = 48000; 40 | format.mFormatID = kAudioFormatLinearPCM; 41 | format.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; 42 | format.mFramesPerPacket = 1; 43 | format.mChannelsPerFrame = 2; 44 | format.mBitsPerChannel = 16; 45 | format.mBytesPerPacket = 4; 46 | format.mBytesPerFrame = 4; 47 | 48 | // Create and audio playback queue 49 | AudioQueueNewOutput(&format, audio_queue_callback, (void *) ctx, nil, nil, 0, &ctx->q); 50 | 51 | // Create buffers for the queue 52 | for (int32_t x = 0; x < NUM_AUDIO_BUF; x++) { 53 | AudioQueueAllocateBuffer(ctx->q, BUFFER_SIZE, &ctx->audio_buf[x]); 54 | ctx->audio_buf[x]->mAudioDataByteSize = BUFFER_SIZE; 55 | } 56 | } 57 | 58 | void audio_destroy(struct audio **ctx_out) 59 | { 60 | if (!ctx_out || !*ctx_out) 61 | return; 62 | 63 | struct audio *ctx = *ctx_out; 64 | 65 | for (int32_t x = 0; x < NUM_AUDIO_BUF; x++) { 66 | if (ctx->audio_buf[x]) 67 | AudioQueueFreeBuffer(ctx->q, ctx->audio_buf[x]); 68 | } 69 | 70 | if (ctx->q) 71 | AudioQueueDispose(ctx->q, true); 72 | 73 | free(ctx); 74 | *ctx_out = NULL; 75 | } 76 | 77 | void audio_cb(const int16_t *pcm, uint32_t frames, void *opaque) 78 | { 79 | struct audio *ctx = (struct audio *) opaque; 80 | 81 | if (ctx == NULL || isMuted) 82 | return; 83 | 84 | // Use the first available buffer is one is free 85 | int32_t found = -1; 86 | for (int32_t x = 0; x < NUM_AUDIO_BUF; x++) { 87 | if (ctx->audio_buf[x]->mAudioDataByteSize == 0 || ctx->audio_buf[x]->mAudioDataByteSize == BUFFER_SIZE) { 88 | found = x; 89 | break; 90 | } 91 | } 92 | 93 | if (found < 0) 94 | return; 95 | 96 | // Enqueue the sample for playback 97 | memcpy(ctx->audio_buf[found]->mAudioData, pcm, frames * 4); 98 | ctx->audio_buf[found]->mAudioDataByteSize = frames * 4; 99 | 100 | AudioQueueEnqueueBuffer(ctx->q, ctx->audio_buf[found], 0, NULL); 101 | 102 | ctx->in_use++; 103 | 104 | if (ctx->in_use > 10) 105 | AudioQueueStart(ctx->q, NULL); 106 | } 107 | 108 | void audio_mute(bool muted) 109 | { 110 | isMuted = muted; 111 | } 112 | -------------------------------------------------------------------------------- /OpenParsec/audio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | struct audio; 7 | 8 | void audio_init(struct audio **ctx_out); 9 | void audio_destroy(struct audio **ctx_out); 10 | 11 | void audio_cb(const int16_t *pcm, uint32_t frames, void *opaque); 12 | 13 | void audio_mute(bool muted); 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #

![icon_transparent.png](OpenParsec/Assets.xcassets/IconTransparent.imageset/icon_transparent.png) ![OpenParsec](OpenParsec/Assets.xcassets/LogoShadow.imageset/logo_shadow.png)

2 | 3 | OpenParsec is a simple, open-source Parsec client for iOS/iPadOS written in Swift using the SwiftUI framework and the Parsec SDK. 4 | 5 | This project is still a major WIP, so apologies for the currently lackluster documentation. I'm also very new to both Swift and SwiftUI so I'm sure there are many places for improvement. 6 | 7 | Before building, make sure you have the Parsec SDK framework symlinked or copied to the `Frameworks` folder. Builds were tested on Xcode Version 12.5. 8 | --------------------------------------------------------------------------------