Skip to content

Commit afeca36

Browse files
committed
Cleaned up code. Added download svg.
1 parent cc6ea00 commit afeca36

23 files changed

+69
-80
lines changed

Turbah.xcodeproj/project.pbxproj

+28-14
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
FA7BA4F42594082F00E5C856 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7BA4F32594082F00E5C856 /* String+Extension.swift */; };
2121
FA7BA4F82594085500E5C856 /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7BA4F72594085500E5C856 /* UIImage+Extension.swift */; };
2222
FA7BA4FB259408A400E5C856 /* CALayer+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7BA4FA259408A400E5C856 /* CALayer+Extension.swift */; };
23+
FA7BA5042594118500E5C856 /* Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7BA5032594118500E5C856 /* Coordinates.swift */; };
2324
FA8EC36124BFD452004FF5E2 /* VisualEffectButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EC36024BFD452004FF5E2 /* VisualEffectButton.swift */; };
2425
FA8EC36324BFD48D004FF5E2 /* Super.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EC36224BFD48D004FF5E2 /* Super.swift */; };
2526
FA8EC36524C01C3B004FF5E2 /* SettingsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EC36424C01C3B004FF5E2 /* SettingsVC.swift */; };
2627
FA8EC36A24C031C7004FF5E2 /* VisualEffectText.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EC36924C031C7004FF5E2 /* VisualEffectText.swift */; };
27-
FAA121EE24C50C4A009F12C2 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA121ED24C50C4A009F12C2 /* UserDefaults.swift */; };
28+
FAA121EE24C50C4A009F12C2 /* UserDefaults+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA121ED24C50C4A009F12C2 /* UserDefaults+Extension.swift */; };
2829
FAA121F124C50CAC009F12C2 /* SegmentedCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA121F024C50CAC009F12C2 /* SegmentedCell.swift */; };
2930
FAA121F324C52F2F009F12C2 /* ContactCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA121F224C52F2F009F12C2 /* ContactCell.swift */; };
3031
FAA121FC24C6A935009F12C2 /* DistanceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA121FB24C6A935009F12C2 /* DistanceCell.swift */; };
@@ -55,11 +56,12 @@
5556
FA7BA4F32594082F00E5C856 /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
5657
FA7BA4F72594085500E5C856 /* UIImage+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Extension.swift"; sourceTree = "<group>"; };
5758
FA7BA4FA259408A400E5C856 /* CALayer+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CALayer+Extension.swift"; sourceTree = "<group>"; };
59+
FA7BA5032594118500E5C856 /* Coordinates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coordinates.swift; sourceTree = "<group>"; };
5860
FA8EC36024BFD452004FF5E2 /* VisualEffectButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VisualEffectButton.swift; sourceTree = "<group>"; };
5961
FA8EC36224BFD48D004FF5E2 /* Super.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Super.swift; sourceTree = "<group>"; };
6062
FA8EC36424C01C3B004FF5E2 /* SettingsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsVC.swift; sourceTree = "<group>"; };
6163
FA8EC36924C031C7004FF5E2 /* VisualEffectText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VisualEffectText.swift; sourceTree = "<group>"; };
62-
FAA121ED24C50C4A009F12C2 /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = "<group>"; };
64+
FAA121ED24C50C4A009F12C2 /* UserDefaults+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefaults+Extension.swift"; sourceTree = "<group>"; };
6365
FAA121F024C50CAC009F12C2 /* SegmentedCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentedCell.swift; sourceTree = "<group>"; };
6466
FAA121F224C52F2F009F12C2 /* ContactCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactCell.swift; sourceTree = "<group>"; };
6567
FAA121FB24C6A935009F12C2 /* DistanceCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DistanceCell.swift; sourceTree = "<group>"; };
@@ -113,7 +115,8 @@
113115
FA8EC36224BFD48D004FF5E2 /* Super.swift */,
114116
FABD9FB624D3B1FD00CC6EDA /* Localizable.strings */,
115117
FA8EC36724C01C7F004FF5E2 /* Controllers */,
116-
FA8EC36824C01C87004FF5E2 /* Classes */,
118+
FA7BA5002594114100E5C856 /* Views */,
119+
FA8EC36824C01C87004FF5E2 /* Models */,
117120
FA7BA4E52594075C00E5C856 /* Extensions */,
118121
FA57BA6B24BFB314009FC13E /* Turbah.rcproject */,
119122
FABD9FBA24D3B29F00CC6EDA /* Info.plist */,
@@ -126,6 +129,8 @@
126129
FA7BA4E52594075C00E5C856 /* Extensions */ = {
127130
isa = PBXGroup;
128131
children = (
132+
FAA121ED24C50C4A009F12C2 /* UserDefaults+Extension.swift */,
133+
FAA1220624CCDD90009F12C2 /* Conversions.swift */,
129134
FA7BA4F32594082F00E5C856 /* String+Extension.swift */,
130135
FA7BA4F0259407F600E5C856 /* UIColor+Extension.swift */,
131136
FA7BA4E62594077500E5C856 /* UIView+Extension.swift */,
@@ -137,6 +142,15 @@
137142
path = Extensions;
138143
sourceTree = "<group>";
139144
};
145+
FA7BA5002594114100E5C856 /* Views */ = {
146+
isa = PBXGroup;
147+
children = (
148+
FAA1220124C7DFEB009F12C2 /* View Controller */,
149+
FAA121EF24C50C8E009F12C2 /* Settings */,
150+
);
151+
path = Views;
152+
sourceTree = "<group>";
153+
};
140154
FA8EC36724C01C7F004FF5E2 /* Controllers */ = {
141155
isa = PBXGroup;
142156
children = (
@@ -146,16 +160,13 @@
146160
path = Controllers;
147161
sourceTree = "<group>";
148162
};
149-
FA8EC36824C01C87004FF5E2 /* Classes */ = {
163+
FA8EC36824C01C87004FF5E2 /* Models */ = {
150164
isa = PBXGroup;
151165
children = (
166+
FA7BA5032594118500E5C856 /* Coordinates.swift */,
152167
FACE7EB824C176EB002FE5FC /* Location.swift */,
153-
FAA1220624CCDD90009F12C2 /* Conversions.swift */,
154-
FAA121ED24C50C4A009F12C2 /* UserDefaults.swift */,
155-
FAA121EF24C50C8E009F12C2 /* Settings */,
156-
FAA1220124C7DFEB009F12C2 /* Views */,
157168
);
158-
path = Classes;
169+
path = Models;
159170
sourceTree = "<group>";
160171
};
161172
FAA121EF24C50C8E009F12C2 /* Settings */ = {
@@ -170,7 +181,7 @@
170181
path = Settings;
171182
sourceTree = "<group>";
172183
};
173-
FAA1220124C7DFEB009F12C2 /* Views */ = {
184+
FAA1220124C7DFEB009F12C2 /* View Controller */ = {
174185
isa = PBXGroup;
175186
children = (
176187
FACE7EC024C4006D002FE5FC /* CompassView.swift */,
@@ -181,7 +192,7 @@
181192
FACE7EC224C411FF002FE5FC /* LocationListCell.swift */,
182193
FAA1220424CCD508009F12C2 /* CalibrateView.swift */,
183194
);
184-
path = Views;
195+
path = "View Controller";
185196
sourceTree = "<group>";
186197
};
187198
/* End PBXGroup section */
@@ -274,7 +285,7 @@
274285
FACE7EB924C176EB002FE5FC /* Location.swift in Sources */,
275286
FACE7EB724C173FE002FE5FC /* LocationsListMenu.swift in Sources */,
276287
FAA1220524CCD508009F12C2 /* CalibrateView.swift in Sources */,
277-
FAA121EE24C50C4A009F12C2 /* UserDefaults.swift in Sources */,
288+
FAA121EE24C50C4A009F12C2 /* UserDefaults+Extension.swift in Sources */,
278289
FA7BA4F82594085500E5C856 /* UIImage+Extension.swift in Sources */,
279290
FA57BA6C24BFB314009FC13E /* Turbah.rcproject in Sources */,
280291
FAA121F124C50CAC009F12C2 /* SegmentedCell.swift in Sources */,
@@ -284,6 +295,7 @@
284295
FACE7EC124C4006D002FE5FC /* CompassView.swift in Sources */,
285296
FA7BA4E72594077500E5C856 /* UIView+Extension.swift in Sources */,
286297
FA7A250A24BFA497003D8825 /* ViewController.swift in Sources */,
298+
FA7BA5042594118500E5C856 /* Coordinates.swift in Sources */,
287299
FA7A250824BFA497003D8825 /* AppDelegate.swift in Sources */,
288300
FA8EC36A24C031C7004FF5E2 /* VisualEffectText.swift in Sources */,
289301
FA51865524C133AD009064F6 /* SettingsFooterView.swift in Sources */,
@@ -444,14 +456,15 @@
444456
buildSettings = {
445457
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
446458
CODE_SIGN_STYLE = Automatic;
447-
CURRENT_PROJECT_VERSION = 2;
459+
CURRENT_PROJECT_VERSION = 3;
448460
DEVELOPMENT_TEAM = SDG37YDN8V;
449461
INFOPLIST_FILE = Turbah/Info.plist;
450462
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
451463
LD_RUNPATH_SEARCH_PATHS = (
452464
"$(inherited)",
453465
"@executable_path/Frameworks",
454466
);
467+
MARKETING_VERSION = 1.1;
455468
PRODUCT_BUNDLE_IDENTIFIER = com.MMQ.Turbah;
456469
PRODUCT_NAME = "$(TARGET_NAME)";
457470
SWIFT_VERSION = 5.0;
@@ -464,14 +477,15 @@
464477
buildSettings = {
465478
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
466479
CODE_SIGN_STYLE = Automatic;
467-
CURRENT_PROJECT_VERSION = 2;
480+
CURRENT_PROJECT_VERSION = 3;
468481
DEVELOPMENT_TEAM = SDG37YDN8V;
469482
INFOPLIST_FILE = Turbah/Info.plist;
470483
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
471484
LD_RUNPATH_SEARCH_PATHS = (
472485
"$(inherited)",
473486
"@executable_path/Frameworks",
474487
);
488+
MARKETING_VERSION = 1.1;
475489
PRODUCT_BUNDLE_IDENTIFIER = com.MMQ.Turbah;
476490
PRODUCT_NAME = "$(TARGET_NAME)";
477491
SWIFT_VERSION = 5.0;

Turbah/AppDelegate.swift

-18
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1414
var window: UIWindow?
1515

1616
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17-
// Override point for customization after application launch.
1817
setupScreen()
1918
setupDefaults()
2019
return true
2120
}
22-
23-
func applicationWillResignActive(_ application: UIApplication) {
24-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
25-
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
26-
}
27-
28-
func applicationDidEnterBackground(_ application: UIApplication) {
29-
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
30-
}
31-
32-
func applicationWillEnterForeground(_ application: UIApplication) {
33-
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34-
}
35-
36-
func applicationDidBecomeActive(_ application: UIApplication) {
37-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38-
}
3921

4022

4123
// MARK: - Custom Funcs

Turbah/Assets.xcassets/App Icons/Contents.json

-6
This file was deleted.

Turbah/Controllers/SettingsVC.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,13 @@ class SettingsVC: UITableViewController, MFMailComposeViewControllerDelegate {
125125

126126
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
127127
switch sectionArray[section].name {
128-
case .general, .bottom: return nil
129128
case .contact: return "Contact".localized
129+
default: return nil
130130
}
131131
}
132132

133133
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
134-
if section == tableView.numberOfSections - 1 {
134+
if section == (tableView.numberOfSections - 1) {
135135
return SettingsFooterView()
136136
}
137137
return nil

Turbah/Controllers/ViewController.swift

+6-14
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ import RealityKit
1111
import ARKit
1212
import CoreLocation
1313

14-
typealias MotherFuckingArray = Array
15-
1614
class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOverlayViewDelegate {
1715

1816
var arView = ARView()
19-
2017
var compassView = CompassView()
21-
2218
var locationButton = VisualEffectButton()
2319
var settingsButton = VisualEffectButton()
24-
var buttonMargins: CGSize { return UIDevice.current.hasNotch ? CGSize(width: 14, height: 0) : CGSize(width: 5, height: 5) }
20+
lazy var buttonMargins: CGSize = UIDevice.current.hasNotch ? CGSize(width: 14, height: 0) : CGSize(width: 5, height: 5)
2521

2622
var locationsView: LocationsListMenu?
2723
var transparentView: UIView?
@@ -75,8 +71,9 @@ class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOve
7571
settingsButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: buttonMargins.height).isActive = true
7672
settingsButton.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -buttonMargins.width).isActive = true
7773

78-
rightImage.image = UIImage(systemName: "chevron.compact.right", withConfiguration: UIImage.SymbolConfiguration(pointSize: 50, weight: .medium))
79-
leftImage.image = UIImage(systemName: "chevron.compact.left", withConfiguration: UIImage.SymbolConfiguration(pointSize: 50, weight: .medium))
74+
let config = UIImage.SymbolConfiguration(pointSize: 50, weight: .medium)
75+
rightImage.image = UIImage(systemName: "chevron.compact.right", withConfiguration: config)
76+
leftImage.image = UIImage(systemName: "chevron.compact.left", withConfiguration: config)
8077
[rightImage, leftImage].forEach {
8178
$0.tintColor = .white
8279
$0.alpha = 0
@@ -102,7 +99,6 @@ class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOve
10299
anchor.position.z = -1 * cos(Float(bearingOfKabah)) / decreaseValue
103100
anchor.position.x = sin(Float(bearingOfKabah)) / decreaseValue
104101
anchor.position.y = 0
105-
print("after", anchor.position)
106102

107103
print("angle", atan(anchor.position.x/anchor.position.z) * 180 / .pi)
108104

@@ -163,7 +159,6 @@ class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOve
163159

164160
return
165161
}
166-
if !didRun { arView.run() }
167162
arView.run()
168163
}
169164

@@ -174,7 +169,7 @@ class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOve
174169
arView.gestureRecognizers?.forEach { $0.cancelsTouchesInView = false }
175170

176171
transparentView = UIView()
177-
transparentView!.backgroundColor = nil
172+
transparentView!.backgroundColor = .clear
178173
let gesture = UITapGestureRecognizer(target: self, action: #selector(transparentViewClicked))
179174
gesture.cancelsTouchesInView = false
180175
transparentView!.addGestureRecognizer(gesture)
@@ -219,8 +214,6 @@ class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOve
219214
}) { _ in
220215
self.locationsView?.removeFromSuperview()
221216
self.transparentView?.removeFromSuperview()
222-
self.locationsView = nil
223-
self.transparentView = nil
224217

225218
// FIXME: Remove this but make sure nothing is ruined
226219
//self.arView.gestureRecognizers?.forEach { $0.cancelsTouchesInView = true }
@@ -258,7 +251,6 @@ class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOve
258251
self.calibrateView?.alpha = 0
259252
}) { _ in
260253
self.calibrateView?.removeFromSuperview()
261-
self.calibrateView = nil
262254
}
263255
}
264256

@@ -272,7 +264,7 @@ class ViewController: UIViewController, CLLocationManagerDelegate, ARCoachingOve
272264

273265
func initManager() {
274266
locationManager.delegate = self
275-
locationManager.desiredAccuracy = kCLLocationAccuracyBest//NearestTenMeters
267+
locationManager.desiredAccuracy = kCLLocationAccuracyBest //NearestTenMeters
276268
locationManager.startUpdatingLocation()
277269
locationManager.startUpdatingHeading()
278270
}
File renamed without changes.

Turbah/Classes/UserDefaults.swift Turbah/Extensions/UserDefaults+Extension.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// UserDefaults.swift
2+
// UserDefaults+Extension.swift
33
// Turbah
44
//
55
// Created by MMQ on 7/19/20.

Turbah/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
18+
<string>$(MARKETING_VERSION)</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>LSApplicationQueriesSchemes</key>

Turbah/Models/Coordinates.swift

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// Coordinates.swift
3+
// Turbah
4+
//
5+
// Created by MMQ on 12/23/20.
6+
// Copyright © 2020 MMQ. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
struct Coordinates {
12+
let lat: Double
13+
let lon: Double
14+
}

Turbah/Classes/Location.swift Turbah/Models/Location.swift

+16-23
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88

99
import Foundation
1010

11-
struct Coordinates {
12-
let lat: Double
13-
let lon: Double
14-
}
15-
16-
enum Locations {
11+
enum Locations: CaseIterable {
1712
case kabah
1813
case prophet
1914
case aqsa
@@ -25,8 +20,6 @@ enum Locations {
2520
case masuma
2621
case zainab
2722

28-
static let allLocations: [Locations] = [.kabah, .prophet, .aqsa, .baqi, .ali, .hussain, .reza, .askariain, .masuma, .zainab]
29-
3023
var coordinates: Coordinates {
3124
switch self {
3225
//Adhan's coordinates for Kabah: Coordinates(lat: 21.4225241, lon: 39.8261818)
@@ -58,23 +51,23 @@ enum Locations {
5851
}
5952
}
6053

61-
var imageString: String {
62-
switch self {
63-
case .kabah: return "Launch"
64-
case .prophet: return "Launch"
65-
case .aqsa: return "Launch"
66-
case .baqi: return "Launch"
67-
case .ali: return "Launch"
68-
case .hussain: return "Launch"
69-
case .reza: return "Launch"
70-
case .askariain: return "Launch"
71-
case .masuma: return "Launch"
72-
case .zainab: return "Launch"
73-
}
74-
}
75-
7654
var compassIconString: String {
7755
return self == .kabah ? "kaba" : "shrine"
7856
}
7957

58+
// var imageString: String {
59+
// switch self {
60+
// case .kabah: return ""
61+
// case .prophet: return ""
62+
// case .aqsa: return ""
63+
// case .baqi: return ""
64+
// case .ali: return ""
65+
// case .hussain: return ""
66+
// case .reza: return ""
67+
// case .askariain: return ""
68+
// case .masuma: return ""
69+
// case .zainab: return ""
70+
// }
71+
// }
72+
8073
}

Turbah/Classes/Views/LocationsListMenu.swift Turbah/Views/View Controller/LocationsListMenu.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class LocationsListMenu: UITableView, UITableViewDelegate, UITableViewDataSource
1212

1313
var didSelectNewLocation: ((Locations) -> Void)?
1414

15-
let locations = Locations.allLocations
15+
let locations = Locations.allCases
1616
let cellHeight: CGFloat = 47
1717

1818
var height: CGFloat { return cellHeight * CGFloat(min(locations.count, 10)) }

0 commit comments

Comments
 (0)