Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
523 changes: 523 additions & 0 deletions MyExperiences copy/MyExperiences.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1160"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5020E59224B2F63900E70522"
BuildableName = "MyExperiences.app"
BlueprintName = "MyExperiences"
ReferencedContainer = "container:MyExperiences.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5020E59224B2F63900E70522"
BuildableName = "MyExperiences.app"
BlueprintName = "MyExperiences"
ReferencedContainer = "container:MyExperiences.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<LocationScenarioReference
identifier = "Rio de Janeiro, Brazil"
referenceType = "1">
</LocationScenarioReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5020E59224B2F63900E70522"
BuildableName = "MyExperiences.app"
BlueprintName = "MyExperiences"
ReferencedContainer = "container:MyExperiences.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
13 changes: 13 additions & 0 deletions MyExperiences copy/MyExperiences/FirebaseConvertible.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// FirebaseConvertible.swift
// MyExperiences
//
// Created by Kelson Hartle on 7/10/20.
// Copyright © 2020 Kelson Hartle. All rights reserved.
//

import Foundation

protocol FirebaseConvertible {
var dictionaryRepresentation: [String: Any] { get }
}
36 changes: 36 additions & 0 deletions MyExperiences copy/MyExperiences/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>148592290546-9n183to7ns2k73hb6pm403364enie3el.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.148592290546-9n183to7ns2k73hb6pm403364enie3el</string>
<key>API_KEY</key>
<string>AIzaSyAggmXqJCYTeVRwpnDZR13AVzxgDdnOc1s</string>
<key>GCM_SENDER_ID</key>
<string>148592290546</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.KelsonHartle.MyExperiences</string>
<key>PROJECT_ID</key>
<string>myexperiences-3d6b3</string>
<key>STORAGE_BUCKET</key>
<string>myexperiences-3d6b3.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:148592290546:ios:3c782c7e0d88c6d5387e6b</string>
<key>DATABASE_URL</key>
<string>https://myexperiences-3d6b3.firebaseio.com</string>
</dict>
</plist>
39 changes: 39 additions & 0 deletions MyExperiences copy/MyExperiences/Helpers/UIImage+Scaling.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// UIImage+Scaling.swift
// MyExperiences
//
// Created by Kelson Hartle on 7/6/20.
// Copyright © 2020 Kelson Hartle. All rights reserved.
//

import Foundation
import UIKit

extension UIImage {

/// Resize the image to a max dimension from size parameter
func imageByScaling(toSize size: CGSize) -> UIImage? {
guard size.width > 0 && size.height > 0 else { return nil }

let originalAspectRatio = self.size.width/self.size.height
var correctedSize = size

if correctedSize.width > correctedSize.width*originalAspectRatio {
correctedSize.width = correctedSize.width*originalAspectRatio
} else {
correctedSize.height = correctedSize.height/originalAspectRatio
}

return UIGraphicsImageRenderer(size: correctedSize, format: imageRendererFormat).image { context in
draw(in: CGRect(origin: .zero, size: correctedSize))
}
}

/// Renders the image if the pixel data was rotated due to orientation of camera
var flattened: UIImage {
if imageOrientation == .up { return self }
return UIGraphicsImageRenderer(size: size, format: imageRendererFormat).image { context in
draw(at: .zero)
}
}
}
81 changes: 81 additions & 0 deletions MyExperiences copy/MyExperiences/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.148592290546-9n183to7ns2k73hb6pm403364enie3el</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) We need to access your location in order to add geotags.</string>
<key>NSMicrophoneUsageDescription</key>
<string>ok?</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) We need acess to photos in order for you to post photos.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
66 changes: 66 additions & 0 deletions MyExperiences copy/MyExperiences/LocationHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// LocationHelper.swift
// MyExperiences
//
// Created by Kelson Hartle on 7/10/20.
// Copyright © 2020 Kelson Hartle. All rights reserved.
//

import UIKit
import MapKit
import CoreLocation

class LocationHelper: NSObject, CLLocationManagerDelegate {


static let shared = LocationHelper()

private let locationManager = CLLocationManager()
var group: DispatchGroup?

override init() {
super.init()
locationManager.delegate = self

requestLocationAuthorization()
}

func requestLocationAuthorization() {

switch CLLocationManager.authorizationStatus() {
case .authorizedWhenInUse:
return
case .notDetermined:
locationManager.requestWhenInUseAuthorization()
default:
break
}
}

func getCurrentLocation(completion: @escaping (CLLocationCoordinate2D?) -> Void) {
requestLocationAuthorization()

group = DispatchGroup()

group?.enter()

locationManager.requestLocation()

group?.notify(queue: .main) {
let coordinate = self.locationManager.location?.coordinate

self.group = nil
completion(coordinate)
}
}


func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
group?.leave()
}

func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print("Failed getting location \(error)")
}

}
38 changes: 38 additions & 0 deletions MyExperiences copy/MyExperiences/Models/Author.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Author.swift
// MyExperiences
//
// Created by Kelson Hartle on 7/10/20.
// Copyright © 2020 Kelson Hartle. All rights reserved.
//

import Foundation
import FirebaseAuth

struct Author: FirebaseConvertible, Equatable {

init?(user: User) {
self.init(dictionary: user.dictionaryRepresentation)
}

init?(dictionary: [String: Any]) {
guard let uid = dictionary[Author.uidKey] as? String,
let displayName = dictionary[Author.displayNameKey] as? String else { return nil }

self.uid = uid
self.displayName = displayName
}


// MARK: - Properties
let uid: String
let displayName: String?

private static let uidKey = "uid"
private static let displayNameKey = "displayName"

var dictionaryRepresentation: [String: Any] {
return [Author.uidKey: uid,
Author.displayNameKey: displayName ?? "No display name"]
}
}
Loading