Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #398

Merged
merged 21 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ target 'TCAT' do
# Analytics
pod 'Firebase'
pod 'FirebaseCrashlytics'
pod 'Firebase/Messaging'

# File Management
pod 'Zip', '~> 1.1'
Expand Down
17 changes: 16 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ PODS:
- FirebaseAnalytics (~> 10.24.0)
- Firebase/CoreOnly (10.24.0):
- FirebaseCore (= 10.24.0)
- Firebase/Messaging (10.24.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 10.24.0)
- FirebaseAnalytics (10.24.0):
- FirebaseAnalytics/AdIdSupport (= 10.24.0)
- FirebaseCore (~> 10.0)
Expand Down Expand Up @@ -50,6 +53,15 @@ PODS:
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseMessaging (10.24.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.3)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Reachability (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseRemoteConfigInterop (10.24.0)
- FirebaseSessions (10.24.0):
- FirebaseCore (~> 10.5)
Expand Down Expand Up @@ -142,6 +154,7 @@ DEPENDENCIES:
- Apollo (~> 1.9.3)
- DZNEmptyDataSet (from `https://github.com/cuappdev/DZNEmptyDataSet.git`)
- Firebase
- Firebase/Messaging
- FirebaseCrashlytics
- FutureNova (from `https://github.com/cuappdev/ios-networking.git`)
- GoogleMaps
Expand All @@ -165,6 +178,7 @@ SPEC REPOS:
- FirebaseCoreInternal
- FirebaseCrashlytics
- FirebaseInstallations
- FirebaseMessaging
- FirebaseRemoteConfigInterop
- FirebaseSessions
- GoogleAppMeasurement
Expand Down Expand Up @@ -213,6 +227,7 @@ SPEC CHECKSUMS:
FirebaseCoreInternal: bcb5acffd4ea05e12a783ecf835f2210ce3dc6af
FirebaseCrashlytics: af38ea4adfa606f6e63fcc22091b61e7938fcf66
FirebaseInstallations: 8f581fca6478a50705d2bd2abd66d306e0f5736e
FirebaseMessaging: 4d52717dd820707cc4eadec5eb981b4832ec8d5d
FirebaseRemoteConfigInterop: 6c349a466490aeace3ce9c091c86be1730711634
FirebaseSessions: 2651b464e241c93fd44112f995d5ab663c970487
FutureNova: 95f9aa352b2c250253b96fdf380754afcc87c7f3
Expand All @@ -234,6 +249,6 @@ SPEC CHECKSUMS:
Wormholy: ab1c8c2f02f58587a0941deb0088555ffbf039a1
Zip: 8877eede3dda76bcac281225c20e71c25270774c

PODFILE CHECKSUM: a3b80dd04ea30998a17c032f2730e21ee8517238
PODFILE CHECKSUM: 03571a87e3df2cb79c3c62b5bd19cd6713131c52

COCOAPODS: 1.15.2
24 changes: 5 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,17 @@ fi

```

- There should also be another run script labeled **UpliftAPI** If not, create a **New Run Script Phase** with the following script:

```bash
CLI_PATH="./Pods/Apollo/apollo-ios-cli"
SECRETS_PATH="${SRCROOT}/TransitSecrets"

if [ "${CONFIGURATION}" != "Release" ]; then
CONFIG_PATH="${SECRETS_PATH}/uplift-codegen-config-dev.json"
fi

if [ "${CONFIGURATION}" = "Release" ]; then
CONFIG_PATH="${SECRETS_PATH}/uplift-codegen-config-prod.json"
fi
5. Select the `TCAT Debug` schema to use our development server and `TCAT Release` to use our production server.
6. Generate the Uplift API:

"${CLI_PATH}" generate -p "${CONFIG_PATH}" -f
- Dev: `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-dev.json" -f`
- Prod: `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-prod.json" -f`

```

5. Select the `TCAT Debug` schema to use our development server and `TCAT Release` to use our production server.
6. Generate the Uplift API with the following command: `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-dev.json" -f`
7. Build the project and you should be good to go.

## Common Issues

- If the build script for generating the API folder doesn't work, you can manually generate the API via `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-dev.json" -f`
- If the API is not working properly, try manually generating the API with the CLI.

- If UpliftAPI is not detected or if your new written queries/mutations are not generated by Apollo, make sure that the generated UpliftAPI folder is linked to the TCAT target. You can do this by simply deleting the UpliftAPI group via the project navigator on Xcode and dragging the generated UpliftAPI folder from Finder to Xcode.

Expand Down
38 changes: 13 additions & 25 deletions TCAT.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
BF74AC1E1F945D8E00AFD4E4 /* GoogleMaps.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF74AC1C1F945D8E00AFD4E4 /* GoogleMaps.framework */; };
D4756EA223986CB500FE7F0D /* ReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4756EA123986CB500FE7F0D /* ReachabilityManager.swift */; };
DD3D9C211F94297100B164D4 /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3D9C201F94297100B164D4 /* Reachability.swift */; };
EEB26AE22C9F9B9A002E863F /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEB26AE12C9F9B9A002E863F /* UserNotifications.framework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -271,6 +272,9 @@
BF74AC1C1F945D8E00AFD4E4 /* GoogleMaps.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleMaps.framework; path = Pods/GoogleMaps/Maps/Frameworks/GoogleMaps.framework; sourceTree = "<group>"; };
D4756EA123986CB500FE7F0D /* ReachabilityManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityManager.swift; sourceTree = "<group>"; };
DD3D9C201F94297100B164D4 /* Reachability.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reachability.swift; sourceTree = "<group>"; };
EEB26AE02C9F998C002E863F /* TCATLocal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = TCATLocal.entitlements; sourceTree = "<group>"; };
EEB26AE12C9F9B9A002E863F /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
EEB26AE32C9FA60E002E863F /* TCATDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = TCATDebug.entitlements; sourceTree = "<group>"; };
FD69AF2A2B89212F00970C7E /* ci_post_clone.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = ci_post_clone.sh; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -279,6 +283,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
EEB26AE22C9F9B9A002E863F /* UserNotifications.framework in Frameworks */,
BF74AC1D1F945D8E00AFD4E4 /* GoogleMapsCore.framework in Frameworks */,
BF74AC1E1F945D8E00AFD4E4 /* GoogleMaps.framework in Frameworks */,
BF74AC1A1F945D7D00AFD4E4 /* GoogleMapsBase.framework in Frameworks */,
Expand All @@ -292,6 +297,7 @@
12F774CEB5023E6938BDCF3A /* Frameworks */ = {
isa = PBXGroup;
children = (
EEB26AE12C9F9B9A002E863F /* UserNotifications.framework */,
BF74AC1C1F945D8E00AFD4E4 /* GoogleMaps.framework */,
BF74AC1B1F945D8E00AFD4E4 /* GoogleMapsCore.framework */,
BF74AC191F945D7D00AFD4E4 /* GoogleMapsBase.framework */,
Expand Down Expand Up @@ -575,6 +581,8 @@
449A7C771D80D0E80019300C /* TCAT */ = {
isa = PBXGroup;
children = (
EEB26AE32C9FA60E002E863F /* TCATDebug.entitlements */,
EEB26AE02C9F998C002E863F /* TCATLocal.entitlements */,
449A7C7F1D80D0E80019300C /* Assets.xcassets */,
2E70434D2BB75E10003AC1D6 /* PrivacyInfo.xcprivacy */,
2E9416662BC615B0003DEB44 /* Base */,
Expand Down Expand Up @@ -622,7 +630,6 @@
2292F9DB215722ED00C8C931 /* SwiftLint */,
7E14AED52177E846006A344D /* Embed Foundation Extensions */,
CE26CBF62B879837005D099A /* Crashlytics */,
2E9416612BC60AE7003DEB44 /* UpliftAPI */,
882B9E91268F347446806E32 /* [CP] Embed Pods Frameworks */,
0B4CA64206AF6DA1763F9ACB /* [CP] Copy Pods Resources */,
);
Expand Down Expand Up @@ -743,25 +750,6 @@
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n\nif which swiftlint >/dev/null; then\n swiftlint --fix && swiftlint\nelse\n echo \"WARNING: SwiftLint not installed\"\nfi\n";
};
2E9416612BC60AE7003DEB44 /* UpliftAPI */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = UpliftAPI;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "CLI_PATH=\"./Pods/Apollo/apollo-ios-cli\"\nSECRETS_PATH=\"${SRCROOT}/TransitSecrets\"\n\nif [ \"${CONFIGURATION}\" != \"Release\" ]; then\n CONFIG_PATH=\"${SECRETS_PATH}/uplift-codegen-config-dev.json\"\nfi\n\nif [ \"${CONFIGURATION}\" = \"Release\" ]; then\n CONFIG_PATH=\"${SECRETS_PATH}/uplift-codegen-config-prod.json\"\nfi\n\n\"${CLI_PATH}\" generate -p \"${CONFIG_PATH}\" -f\n";
};
882B9E91268F347446806E32 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -1021,7 +1009,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
PRODUCT_BUNDLE_IDENTIFIER = com.cornellappdev.tcat;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1097,7 +1085,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
BUNDLE_APP_DISPLAY_NAME = "Ithaca Transit Beta";
CODE_SIGN_ENTITLEMENTS = TCAT/Supporting/TCAT.entitlements;
CODE_SIGN_ENTITLEMENTS = TCAT/TCATDebug.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
Expand All @@ -1118,7 +1106,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DDEBUG";
"OTHER_SWIFT_FLAGS[arch=*]" = "$(inherited) \"-D\" \"COCOAPODS\"";
PRODUCT_BUNDLE_IDENTIFIER = com.cornellappdev.tcat.debug;
Expand Down Expand Up @@ -1196,7 +1184,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
BUNDLE_APP_DISPLAY_NAME = "Ithaca Transit Local";
CODE_SIGN_ENTITLEMENTS = TCAT/Supporting/TCAT.entitlements;
CODE_SIGN_ENTITLEMENTS = TCAT/TCATLocal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
Expand All @@ -1217,7 +1205,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DLOCAL";
"OTHER_SWIFT_FLAGS[arch=*]" = "$(inherited) \"-D\" \"COCOAPODS\"";
PRODUCT_BUNDLE_IDENTIFIER = com.cornellappdev.tcat.debug;
Expand Down
6 changes: 3 additions & 3 deletions TCAT/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
21 changes: 21 additions & 0 deletions TCAT/Assets.xcassets/locationMarker.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "locationMarker.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 53 additions & 3 deletions TCAT/Base/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import Intents
import SafariServices
import SwiftyJSON
import UIKit
import FirebaseMessaging

/// This is used for app-specific preferences
let userDefaults = UserDefaults.standard

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate, UNUserNotificationCenterDelegate {

var window: UIWindow?
private let encoder = JSONEncoder()
Expand All @@ -36,7 +37,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// Set Up Google Services
FirebaseApp.configure()

GMSServices.provideAPIKey(TransitEnvironment.googleMaps)

// Update shortcut items
Expand Down Expand Up @@ -90,13 +91,40 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()


//Set up notifications
UNUserNotificationCenter.current().delegate = self

let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: { _, _ in }
)
application.registerForRemoteNotifications()
Messaging.messaging().delegate = self

return true
}

func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
handleShortcut(item: shortcutItem)
}

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
Messaging.messaging().token { token, error in
if let error = error {
print("Error fetching FCM registration token: \(error)")
} else if let token = token {
print("FCM registration token: \(token)")

}
}

}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("application didFailToRegisterForRemoteNotificationsWithError")
}

// MARK: - Helper Functions

Expand Down Expand Up @@ -206,3 +234,25 @@ extension UIWindow {
}

}

extension AppDelegate {

func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
print("Firebase registration token: \(String(describing: fcmToken))")

let dataDict: [String: String] = ["token": fcmToken ?? ""]
NotificationCenter.default.post(
name: Notification.Name("FCMToken"),
object: nil,
userInfo: dataDict
)
// TODO: If necessary send token to application server.
// Note: This callback is fired at each app startup and whenever a new token is generated.
}

//UNUserNotificationCenterDelegate
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print("APNs received with: \(userInfo)")
}

}
2 changes: 1 addition & 1 deletion TCAT/Controllers/HomeOptionsCardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class HomeOptionsCardViewController: UIViewController {
}

// MARK: - Get Search Results

/// Get Search Results
@objc func getPlaces(timer: Timer) {
if let userInfo = timer.userInfo as? [String: String],
Expand Down
Loading