Skip to content

Commit

Permalink
v1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
ronan18 committed Feb 14, 2020
1 parent d9ec8e9 commit 08c8104
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 104 deletions.
49 changes: 10 additions & 39 deletions Arrival-iOS2.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
C568C40023D8B99400AB9E67 /* Station.swift in Sources */ = {isa = PBXBuildFile; fileRef = C568C3FF23D8B99400AB9E67 /* Station.swift */; };
C568C40423D95FA000AB9E67 /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C568C40323D95FA000AB9E67 /* LoadingView.swift */; };
C568C40623D95FA800AB9E67 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C568C40523D95FA800AB9E67 /* LoginView.swift */; };
C5751DA923F7055E0071F224 /* SignInWithAppleDelegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5751DA823F7055E0071F224 /* SignInWithAppleDelegates.swift */; };
C58F248223CC1438003882F3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C58F248123CC1438003882F3 /* AppDelegate.swift */; };
C58F248423CC1438003882F3 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C58F248323CC1438003882F3 /* SceneDelegate.swift */; };
C58F248723CC1438003882F3 /* Arrival_iOS2.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = C58F248523CC1438003882F3 /* Arrival_iOS2.xcdatamodeld */; };
Expand Down Expand Up @@ -67,6 +68,8 @@
C568C40323D95FA000AB9E67 /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = "<group>"; };
C568C40523D95FA800AB9E67 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
C56D06D647AB3355D1B3247D /* Pods-Arrival-iOS2Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Arrival-iOS2Tests.debug.xcconfig"; path = "Target Support Files/Pods-Arrival-iOS2Tests/Pods-Arrival-iOS2Tests.debug.xcconfig"; sourceTree = "<group>"; };
C5751DA523F702F70071F224 /* Arrival.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Arrival.entitlements; sourceTree = "<group>"; };
C5751DA823F7055E0071F224 /* SignInWithAppleDelegates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInWithAppleDelegates.swift; sourceTree = "<group>"; };
C58F247E23CC1438003882F3 /* Arrival.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Arrival.app; sourceTree = BUILT_PRODUCTS_DIR; };
C58F248123CC1438003882F3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C58F248323CC1438003882F3 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -167,6 +170,7 @@
C58F248023CC1438003882F3 /* Arrival-iOS2 */ = {
isa = PBXGroup;
children = (
C5751DA523F702F70071F224 /* Arrival.entitlements */,
C512BCC423E4FBA80079F49C /* TimePlayground.playground */,
C568C3FE23D8B98400AB9E67 /* Models */,
C58F248123CC1438003882F3 /* AppDelegate.swift */,
Expand All @@ -191,6 +195,7 @@
C5166C3823F610AB001F0254 /* TermsOfSeriviceView.swift */,
C512BCC723E751650079F49C /* toStations.js */,
C592370823E151AD00AFCD6C /* HostingController.swift */,
C5751DA823F7055E0071F224 /* SignInWithAppleDelegates.swift */,
);
path = "Arrival-iOS2";
sourceTree = "<group>";
Expand Down Expand Up @@ -224,8 +229,6 @@
C58F247B23CC1438003882F3 /* Frameworks */,
C58F247C23CC1438003882F3 /* Resources */,
E17C82A52DBE2323B5D7E277 /* [CP] Embed Pods Frameworks */,
C51B3EE523EE254A0021EBE0 /* Run Script */,
C5E5768F23EFEB7500A3A7BD /* ShellScript */,
C538A11423F661BD00DDF811 /* ShellScript */,
);
buildRules = (
Expand Down Expand Up @@ -362,24 +365,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
C51B3EE523EE254A0021EBE0 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n#\"${PODS_ROOT}/Fabric/run\"\n";
};
C538A11423F661BD00DDF811 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -399,23 +384,6 @@
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${PODS_ROOT}/FirebaseCrashlytics/run\"\n";
};
C5E5768F23EFEB7500A3A7BD /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n#\"${PODS_ROOT}/Fabric/upload-symbols\" -gsp \"${PROJECT_DIR}/GoogleService-Info.plist\" -p ios \"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}\"\n";
};
E17C82A52DBE2323B5D7E277 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -454,6 +422,7 @@
C58F248923CC1438003882F3 /* ContentView.swift in Sources */,
C5E5768E23EFBB0A00A3A7BD /* Leg.swift in Sources */,
C5E46EC623F3C53E00979DBB /* Route.swift in Sources */,
C5751DA923F7055E0071F224 /* SignInWithAppleDelegates.swift in Sources */,
C5E5768C23EFB9E300A3A7BD /* Trip.swift in Sources */,
C568C40023D8B99400AB9E67 /* Station.swift in Sources */,
C568C40623D95FA800AB9E67 /* LoginView.swift in Sources */,
Expand Down Expand Up @@ -613,6 +582,7 @@
baseConfigurationReference = F0A9A7194655A9A4C5A07CDE /* Pods-Arrival-iOS2.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Arrival-iOS2/Arrival.entitlements";
CODE_SIGN_STYLE = Automatic;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"Arrival-iOS2/Preview Content\"";
Expand All @@ -623,7 +593,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.17;
MARKETING_VERSION = 1.20;
PRODUCT_BUNDLE_IDENTIFIER = com.ronanfuruta.arrival;
PRODUCT_NAME = Arrival;
SWIFT_VERSION = 5.0;
Expand All @@ -636,6 +606,7 @@
baseConfigurationReference = C82760030A0921AD836D9E8B /* Pods-Arrival-iOS2.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Arrival-iOS2/Arrival.entitlements";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"Arrival-iOS2/Preview Content\"";
DEVELOPMENT_TEAM = 7M5JDZSYX7;
Expand All @@ -645,7 +616,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.17;
MARKETING_VERSION = 1.20;
PRODUCT_BUNDLE_IDENTIFIER = com.ronanfuruta.arrival;
PRODUCT_NAME = Arrival;
SWIFT_VERSION = 5.0;
Expand Down
106 changes: 45 additions & 61 deletions Arrival-iOS2/AppData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import FirebasePerformance
import FirebaseAnalytics
import FirebaseRemoteConfig
import FirebaseCrashlytics

let appDelegate = UIApplication.shared.delegate as! AppDelegate
let context = appDelegate.persistentContainer.viewContext
let baseURL = "https://api.arrival.city"
Expand Down Expand Up @@ -71,7 +70,7 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {
private var initialTrainsTraceDone: Bool = false
private var remoteConfig = RemoteConfig.remoteConfig()
private let settings = RemoteConfigSettings()
private var apiUrl = ""
private var apiUrl = "https://api.arrival.city"

override init() {
super.init()
Expand All @@ -82,62 +81,17 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {
remoteConfig.setDefaults(fromPlist: "RemoteConfigDefaults")
self.apiUrl = self.remoteConfig["apiurl"].stringValue!
self.cycleTimer = Double(self.remoteConfig["cycleTimer"].stringValue!)!
/* remoteConfig.fetch() { (status, error) -> Void in
if status == .success {
print("Config fetched!")
self.remoteConfig.activate(completionHandler: { (error) in
// ...
print("remote config activated", error, self.remoteConfig.configValue(forKey: "onboarding1Tagline").stringValue)
DispatchQueue.main.async {
print("This is run on the main queue, after the previous code in outer block")
self.onboardingMessages["onboarding1Heading"] = JSON(self.remoteConfig.configValue(forKey: "onboarding1Heading").stringValue!)
self.onboardingMessages["onboarding1Tagline"] = JSON(self.remoteConfig.configValue(forKey: "onboarding1Tagline").stringValue!)
self.onboardingMessages["onboarding2Heading"] = JSON(self.remoteConfig.configValue(forKey: "onboarding2Heading").stringValue!)
self.onboardingMessages["onboarding3Tagline"] = JSON(self.remoteConfig.configValue(forKey: "onboarding3Tagline").stringValue!)
self.onboardingMessages["onboarding3Heading"] = JSON(self.remoteConfig.configValue(forKey: "onboarding3Heading").stringValue!)
self.onboardingMessages["onboarding2Tagline"] = JSON(self.remoteConfig.configValue(forKey: "onboarding2Tagline").stringValue!)
print("got onboarding config activated", self.onboardingMessages.dictionaryObject, self.remoteConfig.configValue(forKey: "onboarding1Tagline").stringValue!, "1 tagline")
}
})
} else {
print("Config not fetched")
print("Error: \(error?.localizedDescription ?? "No error available.")")
}
}
*/
let preferencesEntity = NSEntityDescription.entity(forEntityName: "Preferences", in: context)!
let newTestPref = NSManagedObject(entity: preferencesEntity, insertInto: context)
newTestPref.setValue(false, forKey: "prioritizeTrain")
newTestPref.setValue(true, forKey: "sortTrainsByTime")
do {
try context.save()
} catch {
print("failed so save testing pref")
}
let expirationDuration: TimeInterval = 43200
/*
remoteConfig.fetchAndActivate { (status, error) in

if (status == .successUsingPreFetchedData) {
print("remote config activated from pre fetch")
} else if (status == .successFetchedFromRemote) {
print("remote config activated from remote fetch")

}
print(self.remoteConfig["apiurl"].stringValue, "remote config api value")
print(self.remoteConfig["onboarding1Heading"].stringValue, "remote config onboarding1Heading value")
self.apiUrl = self.remoteConfig["apiurl"].stringValue!
self.onboardingMessages["onboarding1Heading"] = JSON(self.remoteConfig["onboarding1Heading"].stringValue!)
self.onboardingMessages["onboarding2Heading"] = JSON(self.remoteConfig["onboarding2Heading"].stringValue!)
self.onboardingMessages["onboarding3Heading"] = JSON(self.remoteConfig["onboarding3Heading"].stringValue!)
self.onboardingMessages["onboarding1Tagline"] = JSON(self.remoteConfig["onboarding1Tagline"].stringValue!)
self.onboardingMessages["onboarding2Tagline"] = JSON(self.remoteConfig["onboarding2Tagline"].stringValue!)
self.onboardingMessages["onboarding3Tagline"] = JSON(self.remoteConfig["onboarding3Tagline"].stringValue!)
/*

self.apiUrl = self.remoteConfig.value(forKey: "apiurl") as! String
self.onboardingMessages["onboarding1Heading"] = JSON(self.remoteConfig.value(forKey: "onboarding1Heading") as! String)
self.onboardingMessages["onboarding1Tagline"] = JSON(self.remoteConfig.value(forKey: "onboarding1Tagline") as! String)
self.onboardingMessages["onboarding2Heading"] = JSON(self.remoteConfig.value(forKey: "onboarding2Heading") as! String)
self.onboardingMessages["onboarding3Tagline"] = JSON(self.remoteConfig.value(forKey: "onboarding3Tagline") as! String)
self.onboardingMessages["onboarding3Heading"] = JSON(self.remoteConfig.value(forKey: "onboarding3Heading") as! String)
self.onboardingMessages["onboarding2Tagline"] = JSON(self.remoteConfig.value(forKey: "onboarding2Tagline") as! String)
*/
print(self.onboardingMessages.dictionaryObject, "config onboarding messages")
self.onboardingLoaded = true
}
*/

remoteConfig.fetch(withExpirationDuration: TimeInterval(expirationDuration)) { (status, error) -> Void in
if status == .success {
print("Config fetched!")
Expand Down Expand Up @@ -194,6 +148,7 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {


}

func convertColor(color: String) -> Color {

switch (color.lowercased()) {
Expand Down Expand Up @@ -654,13 +609,23 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {
var sortTrainsByTimeSetting: Bool
let user: String
do {
user = try data.value(forKey: "user") as! String
let testUser = try data.value(forKey: "user")
if testUser == nil {
user = ""
} else {
user = testUser as! String
}
} catch {
user = ""
}
do {

try sortTrainsByTimeSetting = data.value(forKey: "sortTrainsByTime") as! Bool
let tempSetting = try data.value(forKey: "sortTrainsByTime")
if (tempSetting == nil) {
sortTrainsByTimeSetting = false
} else {
sortTrainsByTimeSetting = tempSetting as! Bool
}
} catch {
sortTrainsByTimeSetting = false

Expand Down Expand Up @@ -707,8 +672,27 @@ class AppData: NSObject, ObservableObject,CLLocationManagerDelegate {
if (!result.isEmpty) {
print("fetching old settings")
for data in result as! [NSManagedObject] {
let user = data.value(forKey: "user") as! String
let sortTrainsByTimeSetting = data.value(forKey: "sortTrainsByTime") as! Bool
var user = ""
do {
var temp = try data.value(forKey: "user")
if (temp != nil) {
user = temp as! String
}
} catch {
user = ""
}


var sortTrainsByTimeSetting = false
do {
var temp = try data.value(forKey: "sortTrainsByTime")
if (temp != nil) {
sortTrainsByTimeSetting = temp as! Bool
}

} catch {
sortTrainsByTimeSetting = false
}
print(user, "user setting")
print(sortTrainsByTimeSetting, "sort t b t setting")
if (user == self.passphrase) {
Expand Down
1 change: 1 addition & 0 deletions Arrival-iOS2/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit
import CoreData
import Firebase
import FirebaseCrashlytics
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

Expand Down
5 changes: 5 additions & 0 deletions Arrival-iOS2/Arrival.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?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/>
</plist>
1 change: 1 addition & 0 deletions Arrival-iOS2/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation
import UIKit
import SwiftUI

extension Color {
//static let oldPrimaryColor = Color(UIColor.systemIndigo)
static let blackBG: Color = Color("blackBG")
Expand Down
1 change: 1 addition & 0 deletions Arrival-iOS2/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import SwiftUI
import Combine
import FirebaseCrashlytics

struct ContentView: View {
@EnvironmentObject private var appData: AppData
Expand Down
2 changes: 2 additions & 0 deletions Arrival-iOS2/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import SwiftUI
import UIKit
import Firebase
import FirebaseAnalytics
import FirebaseCrashlytics

struct HomeView: View {
@State var fromModalDisplayed = false
@State var toModalDisplayed = false
Expand Down
3 changes: 3 additions & 0 deletions Arrival-iOS2/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@

import SwiftUI
import FirebaseAnalytics
import FirebaseCrashlytics
struct LoginView: View {
@State var onboard = 0
@State var passphrase = ""
@State var newPass = ""
@EnvironmentObject private var appData: AppData

var body: some View {
GeometryReader { geometry in
VStack(alignment: .center) {
Expand Down Expand Up @@ -122,6 +124,7 @@ struct LoginView: View {
.font(.subheadline)
.multilineTextAlignment(.center)
Spacer()

Button(action: {
self.onboard = 3
}) {
Expand Down
1 change: 1 addition & 0 deletions Arrival-iOS2/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import UIKit
import SwiftUI
import Foundation
import Combine
import FirebaseCrashlytics

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand Down
4 changes: 3 additions & 1 deletion Arrival-iOS2/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import SwiftUI
import FirebaseAnalytics
import FirebaseCrashlytics
struct SettingsView: View {
@EnvironmentObject private var appData: AppData
init() {
Expand All @@ -26,10 +27,11 @@ struct SettingsView: View {
}) {
HStack {
Image(systemName: "chevron.left").foregroundColor(.white).padding(5)
Text("Settings").font(.largeTitle).foregroundColor(Color.white).fontWeight(.bold)

}
}
Text("Settings").font(.largeTitle).foregroundColor(Color.white).fontWeight(.bold)

Spacer()


Expand Down
9 changes: 9 additions & 0 deletions Arrival-iOS2/SignInWithAppleDelegates.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// SignInWithAppleDelegates.swift
// Arrival-iOS2
//
// Created by Ronan Furuta on 2/14/20.
// Copyright © 2020 Stomp Rocket. All rights reserved.
//

import Foundation
2 changes: 2 additions & 0 deletions Arrival-iOS2/TrainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import SwiftUI
import SwiftyJSON
import FirebaseCrashlytics

let sampleData = [1,2,3,4,5]
struct TrainView: View {
@EnvironmentObject private var appData: AppData
Expand Down
Loading

0 comments on commit 08c8104

Please sign in to comment.