diff --git a/Gigs/Gigs.xcodeproj/project.pbxproj b/Gigs/Gigs.xcodeproj/project.pbxproj new file mode 100644 index 00000000..214bd92e --- /dev/null +++ b/Gigs/Gigs.xcodeproj/project.pbxproj @@ -0,0 +1,375 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 51F16E13246641F7004FA084 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F16E12246641F7004FA084 /* AppDelegate.swift */; }; + 51F16E15246641F7004FA084 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F16E14246641F7004FA084 /* SceneDelegate.swift */; }; + 51F16E1A246641F7004FA084 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51F16E18246641F7004FA084 /* Main.storyboard */; }; + 51F16E1C246641F9004FA084 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 51F16E1B246641F9004FA084 /* Assets.xcassets */; }; + 51F16E1F246641F9004FA084 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 51F16E1D246641F9004FA084 /* LaunchScreen.storyboard */; }; + 51F16E2724664460004FA084 /* GigsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F16E2624664460004FA084 /* GigsTableViewController.swift */; }; + 51F16E2924664556004FA084 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F16E2824664556004FA084 /* LoginViewController.swift */; }; + 51F16E2C246647E8004FA084 /* Bearer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F16E2B246647E8004FA084 /* Bearer.swift */; }; + 51F16E2E2466482F004FA084 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F16E2D2466482F004FA084 /* User.swift */; }; + 51F16E312466487D004FA084 /* GigController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F16E302466487D004FA084 /* GigController.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 51F16E0F246641F7004FA084 /* Gigs.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Gigs.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 51F16E12246641F7004FA084 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 51F16E14246641F7004FA084 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 51F16E19246641F7004FA084 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 51F16E1B246641F9004FA084 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 51F16E1E246641F9004FA084 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 51F16E20246641F9004FA084 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 51F16E2624664460004FA084 /* GigsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigsTableViewController.swift; sourceTree = ""; }; + 51F16E2824664556004FA084 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; + 51F16E2B246647E8004FA084 /* Bearer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bearer.swift; sourceTree = ""; }; + 51F16E2D2466482F004FA084 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + 51F16E302466487D004FA084 /* GigController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GigController.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 51F16E0C246641F7004FA084 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 51F16E06246641F7004FA084 = { + isa = PBXGroup; + children = ( + 51F16E11246641F7004FA084 /* Gigs */, + 51F16E2A246647BF004FA084 /* Model */, + 51F16E2F24664868004FA084 /* Model Controller */, + 51F16E10246641F7004FA084 /* Products */, + ); + sourceTree = ""; + }; + 51F16E10246641F7004FA084 /* Products */ = { + isa = PBXGroup; + children = ( + 51F16E0F246641F7004FA084 /* Gigs.app */, + ); + name = Products; + sourceTree = ""; + }; + 51F16E11246641F7004FA084 /* Gigs */ = { + isa = PBXGroup; + children = ( + 51F16E12246641F7004FA084 /* AppDelegate.swift */, + 51F16E14246641F7004FA084 /* SceneDelegate.swift */, + 51F16E2624664460004FA084 /* GigsTableViewController.swift */, + 51F16E2824664556004FA084 /* LoginViewController.swift */, + 51F16E18246641F7004FA084 /* Main.storyboard */, + 51F16E1B246641F9004FA084 /* Assets.xcassets */, + 51F16E1D246641F9004FA084 /* LaunchScreen.storyboard */, + 51F16E20246641F9004FA084 /* Info.plist */, + ); + path = Gigs; + sourceTree = ""; + }; + 51F16E2A246647BF004FA084 /* Model */ = { + isa = PBXGroup; + children = ( + 51F16E2B246647E8004FA084 /* Bearer.swift */, + 51F16E2D2466482F004FA084 /* User.swift */, + ); + path = Model; + sourceTree = ""; + }; + 51F16E2F24664868004FA084 /* Model Controller */ = { + isa = PBXGroup; + children = ( + 51F16E302466487D004FA084 /* GigController.swift */, + ); + path = "Model Controller"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 51F16E0E246641F7004FA084 /* Gigs */ = { + isa = PBXNativeTarget; + buildConfigurationList = 51F16E23246641F9004FA084 /* Build configuration list for PBXNativeTarget "Gigs" */; + buildPhases = ( + 51F16E0B246641F7004FA084 /* Sources */, + 51F16E0C246641F7004FA084 /* Frameworks */, + 51F16E0D246641F7004FA084 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Gigs; + productName = Gigs; + productReference = 51F16E0F246641F7004FA084 /* Gigs.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 51F16E07246641F7004FA084 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1140; + LastUpgradeCheck = 1140; + ORGANIZATIONNAME = "Lambda, Inc"; + TargetAttributes = { + 51F16E0E246641F7004FA084 = { + CreatedOnToolsVersion = 11.4.1; + }; + }; + }; + buildConfigurationList = 51F16E0A246641F7004FA084 /* Build configuration list for PBXProject "Gigs" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 51F16E06246641F7004FA084; + productRefGroup = 51F16E10246641F7004FA084 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 51F16E0E246641F7004FA084 /* Gigs */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 51F16E0D246641F7004FA084 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 51F16E1F246641F9004FA084 /* LaunchScreen.storyboard in Resources */, + 51F16E1C246641F9004FA084 /* Assets.xcassets in Resources */, + 51F16E1A246641F7004FA084 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 51F16E0B246641F7004FA084 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 51F16E2C246647E8004FA084 /* Bearer.swift in Sources */, + 51F16E312466487D004FA084 /* GigController.swift in Sources */, + 51F16E2924664556004FA084 /* LoginViewController.swift in Sources */, + 51F16E2E2466482F004FA084 /* User.swift in Sources */, + 51F16E13246641F7004FA084 /* AppDelegate.swift in Sources */, + 51F16E15246641F7004FA084 /* SceneDelegate.swift in Sources */, + 51F16E2724664460004FA084 /* GigsTableViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 51F16E18246641F7004FA084 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 51F16E19246641F7004FA084 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 51F16E1D246641F9004FA084 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 51F16E1E246641F9004FA084 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 51F16E21246641F9004FA084 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 51F16E22246641F9004FA084 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 51F16E24246641F9004FA084 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = HMX25T49H2; + INFOPLIST_FILE = Gigs/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = jkGames.Gigs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 51F16E25246641F9004FA084 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = HMX25T49H2; + INFOPLIST_FILE = Gigs/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = jkGames.Gigs; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 51F16E0A246641F7004FA084 /* Build configuration list for PBXProject "Gigs" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 51F16E21246641F9004FA084 /* Debug */, + 51F16E22246641F9004FA084 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 51F16E23246641F9004FA084 /* Build configuration list for PBXNativeTarget "Gigs" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 51F16E24246641F9004FA084 /* Debug */, + 51F16E25246641F9004FA084 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 51F16E07246641F7004FA084 /* Project object */; +} diff --git a/Gigs/Gigs.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Gigs/Gigs.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..d19207e8 --- /dev/null +++ b/Gigs/Gigs.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Gigs/Gigs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Gigs/Gigs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Gigs/Gigs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Gigs/Gigs/AppDelegate.swift b/Gigs/Gigs/AppDelegate.swift new file mode 100644 index 00000000..19a112f5 --- /dev/null +++ b/Gigs/Gigs/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// Gigs +// +// Created by Josh Kocsis on 5/8/20. +// Copyright © 2020 Lambda, Inc. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/Gigs/Gigs/Assets.xcassets/AppIcon.appiconset/Contents.json b/Gigs/Gigs/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..9221b9bb --- /dev/null +++ b/Gigs/Gigs/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Gigs/Gigs/Assets.xcassets/Contents.json b/Gigs/Gigs/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Gigs/Gigs/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Gigs/Gigs/Base.lproj/LaunchScreen.storyboard b/Gigs/Gigs/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/Gigs/Gigs/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gigs/Gigs/Base.lproj/Main.storyboard b/Gigs/Gigs/Base.lproj/Main.storyboard new file mode 100644 index 00000000..c0737949 --- /dev/null +++ b/Gigs/Gigs/Base.lproj/Main.storyboard @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gigs/Gigs/GigsTableViewController.swift b/Gigs/Gigs/GigsTableViewController.swift new file mode 100644 index 00000000..c369a5e8 --- /dev/null +++ b/Gigs/Gigs/GigsTableViewController.swift @@ -0,0 +1,41 @@ +// +// GigsTableViewController.swift +// Gigs +// +// Created by Josh Kocsis on 5/8/20. +// Copyright © 2020 Lambda, Inc. All rights reserved. +// + +import UIKit + +class GigsTableViewController: UITableViewController { + + let reuseIdentifier = "GigsCell" + let gigController: GigController = GigController() + + override func viewDidLoad() { + super.viewDidLoad() + + if gigController.bearer == nil { + performSegue(withIdentifier: "LoggingSegue", sender: self) + } + } + + override func numberOfSections(in tableView: UITableView) -> Int { + // #warning Incomplete implementation, return the number of sections + return 1 + } + + 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) + + + + return cell + } +} diff --git a/Gigs/Gigs/Info.plist b/Gigs/Gigs/Info.plist new file mode 100644 index 00000000..2a3483c0 --- /dev/null +++ b/Gigs/Gigs/Info.plist @@ -0,0 +1,64 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Gigs/Gigs/LoginViewController.swift b/Gigs/Gigs/LoginViewController.swift new file mode 100644 index 00000000..6318f66b --- /dev/null +++ b/Gigs/Gigs/LoginViewController.swift @@ -0,0 +1,96 @@ +// +// LoginViewController.swift +// Gigs +// +// Created by Josh Kocsis on 5/8/20. +// Copyright © 2020 Lambda, Inc. All rights reserved. +// + +import UIKit + +enum LoginType { + case signUp + case signIn +} + +class LoginViewController: UIViewController, UITextFieldDelegate { + @IBOutlet weak var sUAndLiSegmentedControl: UISegmentedControl! + @IBOutlet weak var usernameTextField: UITextField! + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var sUAndLiButton: UIButton! + + var gigController: GigController? + var loginType = LoginType.signUp + + override func viewDidLoad() { + super.viewDidLoad() + + sUAndLiButton.backgroundColor = UIColor(hue: 190/360, saturation: 70/100, brightness: 80/100, alpha: 1.0) + sUAndLiButton.tintColor = .white + sUAndLiButton.layer.cornerRadius = 8.0 + } + + @IBAction func suAndLIButtonTapped(_ sender: Any) { + if let username = usernameTextField.text, + !username.isEmpty, + let password = passwordTextField.text, + !password.isEmpty { + let user = User(username: username, password: password) + if loginType == .signUp { + gigController?.signUp(with: user, completion: { (result) in + do { + let success = try result.get() + if success { + DispatchQueue.main.async { + let alerController = UIAlertController(title: "Sign Up Successful!", message: "Now please log in.", preferredStyle: .alert) + let alertAction = UIAlertAction(title: "Ok", style: .default, handler: nil) + alerController.addAction(alertAction) + self.present(alerController, animated: true) { + self.loginType = .signIn + self.sUAndLiSegmentedControl.selectedSegmentIndex = 1 + self.sUAndLiButton.setTitle("Sign In", for: .normal) + } + } + } + } catch { + print("Error signing up: \(error)") + } + }) + } else { + // TODO: Call sign in method on api controller + gigController?.signIn(with: user, completion: { (result) in + do { + let success = try result.get() + if success { + DispatchQueue.main.async { + self.dismiss(animated: true, completion: nil) + } + } + } catch { + if let error = error as? GigController.NetworkError { + switch error { + case .failedSignIn: + print("Sign in failed") + case .noToken, .noData: + print("No data received") + default: + print("Other error occurred") + } + } + } + }) + + } + } + } + + @IBAction func segmentedTypeChange(_ sender: UISegmentedControl) { + if sender.selectedSegmentIndex == 0 { + loginType = .signUp + sUAndLiButton.setTitle("Sign Up", for: .normal) + } else { + loginType = .signIn + sUAndLiButton.setTitle("Sign In", for: .normal) + } + } +} diff --git a/Gigs/Gigs/SceneDelegate.swift b/Gigs/Gigs/SceneDelegate.swift new file mode 100644 index 00000000..df7e4dcd --- /dev/null +++ b/Gigs/Gigs/SceneDelegate.swift @@ -0,0 +1,53 @@ +// +// SceneDelegate.swift +// Gigs +// +// Created by Josh Kocsis on 5/8/20. +// Copyright © 2020 Lambda, Inc. All rights reserved. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/Gigs/Model Controller/GigController.swift b/Gigs/Model Controller/GigController.swift new file mode 100644 index 00000000..89fb870e --- /dev/null +++ b/Gigs/Model Controller/GigController.swift @@ -0,0 +1,118 @@ +// +// GigController.swift +// Gigs +// +// Created by Josh Kocsis on 5/8/20. +// Copyright © 2020 Lambda, Inc. All rights reserved. +// + +import Foundation +import UIKit + +class GigController { + + var bearer: Bearer? + let baseURL = URL(string: "https://lambdagigapi.herokuapp.com/api")! + lazy var signUpURL = baseURL.appendingPathComponent("/users/signup") + lazy var signInURL = baseURL.appendingPathComponent("/users/login") + + enum HTTPMethod: String { + case get = "GET" + case post = "POST" + } + + enum NetworkError: Error { + case noData, failedSignUp, failedSignIn, noToken + } + + private func postRequest(for url: URL) -> URLRequest { + var request = URLRequest(url: url) + request.httpMethod = HTTPMethod.post.rawValue + request.setValue("application/json", forHTTPHeaderField: "Content-Type") + return request + } + + func signUp(with user: User, completion: @escaping(Result) -> Void) { + print("signUpURL = \(signUpURL.absoluteString)") + + var request = postRequest(for: signUpURL) + + do { + let encoder = JSONEncoder() + encoder.outputFormatting = .prettyPrinted + let jsonData = try encoder.encode(user) + print(String(data: jsonData, encoding: .utf8)!) + request.httpBody = jsonData + + let task = URLSession.shared.dataTask(with: request) { (_, response, error) in + // Check for error first + if let error = error { + print("Sign up failed with error: \(error)") + completion(.failure(.failedSignUp)) + return + } + + // Check for response and make sure it is a 200 + guard let response = response as? HTTPURLResponse, + response.statusCode == 200 else { + print("Sign up was unsuccessful") + completion(.failure(.failedSignUp)) + return + } + completion(.success(true)) + } + task.resume() + + } catch { + print("Error encoding user: \(error)") + completion(.failure(.failedSignUp)) + } + } + + func signIn(with user: User, completion: @escaping (Result) -> Void) { + + var request = postRequest(for: signInURL) + + do { + let encoder = JSONEncoder() + let jsonData = try encoder.encode(user) + request.httpBody = jsonData + + let task = URLSession.shared.dataTask(with: request) { (data, response, error) in + if let error = error { + print("Sign in failed with error: \(error)") + completion(.failure(.failedSignIn)) + return + } + + guard let response = response as? HTTPURLResponse, + response.statusCode == 200 else { + print("Sign in was Unsuccessful.") + completion(.failure(.failedSignIn)) + return + } + + guard let data = data else { + print("Data was not recieved.") + completion(.failure(.noData)) + return + } + + do { + let decoder = JSONDecoder() + self.bearer = try decoder.decode(Bearer.self, from: data) + completion(.success(true)) + } catch { + print("Error decoding Bearer: \(error)") + completion(.failure(.noToken)) + return + } + } + task.resume() + } catch { + print("Error encoding user: \(error)") + completion(.failure(.failedSignIn)) + } + } + +} diff --git a/Gigs/Model/Bearer.swift b/Gigs/Model/Bearer.swift new file mode 100644 index 00000000..b723ea54 --- /dev/null +++ b/Gigs/Model/Bearer.swift @@ -0,0 +1,13 @@ +// +// Bearer.swift +// Gigs +// +// Created by Josh Kocsis on 5/8/20. +// Copyright © 2020 Lambda, Inc. All rights reserved. +// + +import Foundation + +struct Bearer: Codable { + let token: String +} diff --git a/Gigs/Model/User.swift b/Gigs/Model/User.swift new file mode 100644 index 00000000..51a1bd8b --- /dev/null +++ b/Gigs/Model/User.swift @@ -0,0 +1,14 @@ +// +// User.swift +// Gigs +// +// Created by Josh Kocsis on 5/8/20. +// Copyright © 2020 Lambda, Inc. All rights reserved. +// + +import Foundation + +struct User: Codable { + let username: String + let password: String +}