From 8ac0d8ac20c0b763b0076c46da666e3bb292044c Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 16 Aug 2018 07:46:19 -0400 Subject: [PATCH] Initial commit --- .gitignore | 77 ++++++++++++++++ Tusker.xcodeproj/project.pbxproj | 60 ++++++++++++- .../xcschemes/xcschememanagement.plist | 20 ++++- Tusker.xcworkspace/contents.xcworkspacedata | 10 +++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ Tusker/Base.lproj/Main.storyboard | 24 ----- Tusker/Controllers/MastodonController.swift | 37 ++++++++ Tusker/Info.plist | 2 - Tusker/Storyboards/Base.lproj/Main.storyboard | 28 ++++++ Tusker/Storyboards/Statuses.storyboard | 40 +++++++++ .../StatusesTableViewController.swift | 90 +++++++++++++++++++ .../ViewController.swift | 0 12 files changed, 367 insertions(+), 29 deletions(-) create mode 100644 .gitignore create mode 100644 Tusker.xcworkspace/contents.xcworkspacedata create mode 100644 Tusker.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 Tusker/Base.lproj/Main.storyboard create mode 100644 Tusker/Controllers/MastodonController.swift create mode 100644 Tusker/Storyboards/Base.lproj/Main.storyboard create mode 100644 Tusker/Storyboards/Statuses.storyboard create mode 100644 Tusker/View Controllers/StatusesTableViewController.swift rename Tusker/{ => View Controllers}/ViewController.swift (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..71c83743 --- /dev/null +++ b/.gitignore @@ -0,0 +1,77 @@ +.DS_Store + +### Swift ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +.build/ + +# CocoaPods - Refactored to standalone file + +# Carthage - Refactored to standalone file + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output + +### Xcode ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated + +## Various settings + +## Other + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index 127b9254..62ded57c 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -14,6 +14,11 @@ D6D4DDDA212518A200E1C4BB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6D4DDD8212518A200E1C4BB /* LaunchScreen.storyboard */; }; D6D4DDE5212518A200E1C4BB /* TuskerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDE4212518A200E1C4BB /* TuskerTests.swift */; }; D6D4DDF0212518A200E1C4BB /* TuskerUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D4DDEF212518A200E1C4BB /* TuskerUITests.swift */; }; + D6F953E7212519A400CF0F2B /* MastodonKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6F953E6212519A400CF0F2B /* MastodonKit.framework */; }; + D6F953E8212519A400CF0F2B /* MastodonKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D6F953E6212519A400CF0F2B /* MastodonKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + D6F953EC212519E700CF0F2B /* StatusesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F953EB212519E700CF0F2B /* StatusesTableViewController.swift */; }; + D6F953EE21251A0700CF0F2B /* Statuses.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6F953ED21251A0700CF0F2B /* Statuses.storyboard */; }; + D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F953EF21251A2900CF0F2B /* MastodonController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -33,6 +38,20 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + D6F953E52125197500CF0F2B /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + D6F953E8212519A400CF0F2B /* MastodonKit.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ D6D4DDCC212518A000E1C4BB /* Tusker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tusker.app; sourceTree = BUILT_PRODUCTS_DIR; }; D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -47,6 +66,10 @@ D6D4DDEB212518A200E1C4BB /* TuskerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TuskerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; D6D4DDEF212518A200E1C4BB /* TuskerUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TuskerUITests.swift; sourceTree = ""; }; D6D4DDF1212518A200E1C4BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D6F953E6212519A400CF0F2B /* MastodonKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MastodonKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D6F953EB212519E700CF0F2B /* StatusesTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusesTableViewController.swift; sourceTree = ""; }; + D6F953ED21251A0700CF0F2B /* Statuses.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Statuses.storyboard; sourceTree = ""; }; + D6F953EF21251A2900CF0F2B /* MastodonController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,6 +77,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D6F953E7212519A400CF0F2B /* MastodonKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -77,6 +101,7 @@ D6D4DDC3212518A000E1C4BB = { isa = PBXGroup; children = ( + D6F953E6212519A400CF0F2B /* MastodonKit.framework */, D6D4DDCE212518A000E1C4BB /* Tusker */, D6D4DDE3212518A200E1C4BB /* TuskerTests */, D6D4DDEE212518A200E1C4BB /* TuskerUITests */, @@ -98,8 +123,9 @@ isa = PBXGroup; children = ( D6D4DDCF212518A000E1C4BB /* AppDelegate.swift */, - D6D4DDD1212518A000E1C4BB /* ViewController.swift */, - D6D4DDD3212518A000E1C4BB /* Main.storyboard */, + D6F953F121251A2F00CF0F2B /* Controllers */, + D6F953E9212519B800CF0F2B /* View Controllers */, + D6F953EA212519BE00CF0F2B /* Storyboards */, D6D4DDD6212518A200E1C4BB /* Assets.xcassets */, D6D4DDD8212518A200E1C4BB /* LaunchScreen.storyboard */, D6D4DDDB212518A200E1C4BB /* Info.plist */, @@ -125,6 +151,32 @@ path = TuskerUITests; sourceTree = ""; }; + D6F953E9212519B800CF0F2B /* View Controllers */ = { + isa = PBXGroup; + children = ( + D6D4DDD1212518A000E1C4BB /* ViewController.swift */, + D6F953EB212519E700CF0F2B /* StatusesTableViewController.swift */, + ); + path = "View Controllers"; + sourceTree = ""; + }; + D6F953EA212519BE00CF0F2B /* Storyboards */ = { + isa = PBXGroup; + children = ( + D6D4DDD3212518A000E1C4BB /* Main.storyboard */, + D6F953ED21251A0700CF0F2B /* Statuses.storyboard */, + ); + path = Storyboards; + sourceTree = ""; + }; + D6F953F121251A2F00CF0F2B /* Controllers */ = { + isa = PBXGroup; + children = ( + D6F953EF21251A2900CF0F2B /* MastodonController.swift */, + ); + path = Controllers; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -135,6 +187,7 @@ D6D4DDC8212518A000E1C4BB /* Sources */, D6D4DDC9212518A000E1C4BB /* Frameworks */, D6D4DDCA212518A000E1C4BB /* Resources */, + D6F953E52125197500CF0F2B /* Embed Frameworks */, ); buildRules = ( ); @@ -231,6 +284,7 @@ files = ( D6D4DDDA212518A200E1C4BB /* LaunchScreen.storyboard in Resources */, D6D4DDD7212518A200E1C4BB /* Assets.xcassets in Resources */, + D6F953EE21251A0700CF0F2B /* Statuses.storyboard in Resources */, D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -256,7 +310,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */, D6D4DDD2212518A000E1C4BB /* ViewController.swift in Sources */, + D6F953EC212519E700CF0F2B /* StatusesTableViewController.swift in Sources */, D6D4DDD0212518A000E1C4BB /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Tusker.xcodeproj/xcuserdata/shadowfacts.xcuserdatad/xcschemes/xcschememanagement.plist b/Tusker.xcodeproj/xcuserdata/shadowfacts.xcuserdatad/xcschemes/xcschememanagement.plist index bb0319ac..ad87b120 100644 --- a/Tusker.xcodeproj/xcuserdata/shadowfacts.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Tusker.xcodeproj/xcuserdata/shadowfacts.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,25 @@ Tusker.xcscheme orderHint - 0 + 3 + + + SuppressBuildableAutocreation + + D6D4DDCB212518A000E1C4BB + + primary + + + D6D4DDDF212518A200E1C4BB + + primary + + + D6D4DDEA212518A200E1C4BB + + primary + diff --git a/Tusker.xcworkspace/contents.xcworkspacedata b/Tusker.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..5bf14a84 --- /dev/null +++ b/Tusker.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Tusker.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Tusker.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Tusker.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Tusker/Base.lproj/Main.storyboard b/Tusker/Base.lproj/Main.storyboard deleted file mode 100644 index f1bcf384..00000000 --- a/Tusker/Base.lproj/Main.storyboard +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tusker/Controllers/MastodonController.swift b/Tusker/Controllers/MastodonController.swift new file mode 100644 index 00000000..71cba902 --- /dev/null +++ b/Tusker/Controllers/MastodonController.swift @@ -0,0 +1,37 @@ +// +// MastodonController.swift +// Tusker +// +// Created by Shadowfacts on 8/15/18. +// Copyright © 2018 Shadowfacts. All rights reserved. +// + +import Foundation +import MastodonKit + +struct MastodonController { + + static private(set) var shared = MastodonController() + + var client: Client! + + private init() { + } + + mutating func connect() { + // TODO: OAuth + let url = ProcessInfo.processInfo.environment["mastodon_url"]! + let username = ProcessInfo.processInfo.environment["mastodon_username"]! + let password = ProcessInfo.processInfo.environment["mastodon_password"]! + + client = Client(baseURL: url) + + let loginReq = Login.silent(clientID: "net.shadowfacts.Tusker", clientSecret: "some super secret thing", scopes: [.read, .write, .follow], username: username, password: password) + + client.run(loginReq) { result in + guard case let .success(loginSettings, _) = result else { fatalError() } + print("access token: \(loginSettings.accessToken)") + } + } + +} diff --git a/Tusker/Info.plist b/Tusker/Info.plist index 16be3b68..89d7858b 100644 --- a/Tusker/Info.plist +++ b/Tusker/Info.plist @@ -31,8 +31,6 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad diff --git a/Tusker/Storyboards/Base.lproj/Main.storyboard b/Tusker/Storyboards/Base.lproj/Main.storyboard new file mode 100644 index 00000000..0101e92c --- /dev/null +++ b/Tusker/Storyboards/Base.lproj/Main.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tusker/Storyboards/Statuses.storyboard b/Tusker/Storyboards/Statuses.storyboard new file mode 100644 index 00000000..14a9b969 --- /dev/null +++ b/Tusker/Storyboards/Statuses.storyboard @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tusker/View Controllers/StatusesTableViewController.swift b/Tusker/View Controllers/StatusesTableViewController.swift new file mode 100644 index 00000000..f1727671 --- /dev/null +++ b/Tusker/View Controllers/StatusesTableViewController.swift @@ -0,0 +1,90 @@ +// +// StatusesTableViewController.swift +// Tusker +// +// Created by Shadowfacts on 8/15/18. +// Copyright © 2018 Shadowfacts. All rights reserved. +// + +import UIKit + +class StatusesTableViewController: UITableViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem + } + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + // #warning Incomplete implementation, return the number of sections + return 0 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return 0 + } + + /* + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath) + + // Configure the cell... + + return cell + } + */ + + /* + // Override to support conditional editing of the table view. + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + /* + // Override to support editing the table view. + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + // Delete the row from the data source + tableView.deleteRows(at: [indexPath], with: .fade) + } else if editingStyle == .insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/Tusker/ViewController.swift b/Tusker/View Controllers/ViewController.swift similarity index 100% rename from Tusker/ViewController.swift rename to Tusker/View Controllers/ViewController.swift