Skip to content

Commit

Permalink
Integrates AppDevAnnouncements pod (#264)
Browse files Browse the repository at this point in the history
* Integrates appdev-announcements pod

* Fixes naming in Secrets.swift

* Adds firebase logging for presenting announcement
  • Loading branch information
kevinchan159 authored Feb 23, 2020
1 parent e261c3c commit 43952cb
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Secrets/
Eatery/schema.json
Eatery/API.swift
Eatery/GoogleService-Info.plist
Eatery/Supporting/Secrets.plist
build/
*.pbxuser
!default.pbxuser
Expand Down
18 changes: 18 additions & 0 deletions Eatery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
C0497B161B64AA1800AC1C6C /* TimeFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0497AF51B64AA1800AC1C6C /* TimeFactory.swift */; };
C0497BAF1B64AA3800AC1C6C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C0497B581B64AA3800AC1C6C /* Images.xcassets */; };
C0F182FA1B674B1300063D77 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0F182F81B674B1300063D77 /* AppDelegate.swift */; };
C21D107D2400F535000A488B /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21D107C2400F535000A488B /* Secrets.swift */; };
C21D107F2400FC53000A488B /* Secrets.plist in Resources */ = {isa = PBXBuildFile; fileRef = C21D107E2400FC53000A488B /* Secrets.plist */; };
C26C57A0219642BC000E7FC9 /* EateryTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26C579F219642BC000E7FC9 /* EateryTabBarController.swift */; };
C82C9B83238D75C200DC18CF /* OnboardingPrivacyStatementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82C9B82238D75C200DC18CF /* OnboardingPrivacyStatementViewController.swift */; };
C82E5F032388E96400C881B2 /* OnboardingPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C82E5EFF2388E96400C881B2 /* OnboardingPageViewController.swift */; };
Expand Down Expand Up @@ -306,6 +308,8 @@
C0497AF51B64AA1800AC1C6C /* TimeFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimeFactory.swift; sourceTree = "<group>"; };
C0497B581B64AA3800AC1C6C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
C0F182F81B674B1300063D77 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C21D107C2400F535000A488B /* Secrets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Secrets.swift; sourceTree = "<group>"; };
C21D107E2400FC53000A488B /* Secrets.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Secrets.plist; sourceTree = "<group>"; };
C26C579F219642BC000E7FC9 /* EateryTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EateryTabBarController.swift; sourceTree = "<group>"; };
C82C9B82238D75C200DC18CF /* OnboardingPrivacyStatementViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingPrivacyStatementViewController.swift; sourceTree = "<group>"; };
C82E5EFF2388E96400C881B2 /* OnboardingPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPageViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -712,6 +716,7 @@
C0497ACA1B64AA1800AC1C6C /* Eatery */ = {
isa = PBXGroup;
children = (
C21D10792400F48B000A488B /* Supporting */,
8724A0772349637E00D92EE3 /* GoogleService-Info.plist */,
D97142E6219A6B6F00E2EE05 /* API.swift */,
C0F182F81B674B1300063D77 /* AppDelegate.swift */,
Expand Down Expand Up @@ -781,6 +786,15 @@
path = Resources;
sourceTree = "<group>";
};
C21D10792400F48B000A488B /* Supporting */ = {
isa = PBXGroup;
children = (
C21D107E2400FC53000A488B /* Secrets.plist */,
C21D107C2400F535000A488B /* Secrets.swift */,
);
path = Supporting;
sourceTree = "<group>";
};
C83AEAAF237A476B00663C8D /* Onboarding */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1002,6 +1016,7 @@
D956DCB12187B2BF001BB9B0 /* campusEateries.graphql in Resources */,
C0497BAF1B64AA3800AC1C6C /* Images.xcassets in Resources */,
8724A0782349637E00D92EE3 /* GoogleService-Info.plist in Resources */,
C21D107F2400FC53000A488B /* Secrets.plist in Resources */,
E9CFC0AA1C0E4A3000ED884A /* appendix.json in Resources */,
95F661FA1E2E9F3D00591A54 /* LaunchScreen.storyboard in Resources */,
5DC2D01922349CE800D2B0F5 /* collegetownEateries.graphql in Resources */,
Expand Down Expand Up @@ -1046,6 +1061,7 @@
"${PODS_ROOT}/Target Support Files/Pods-Eatery/Pods-Eatery-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/ARCL/ARCL.framework",
"${BUILT_PRODUCTS_DIR}/Apollo-iOS/Apollo.framework",
"${BUILT_PRODUCTS_DIR}/AppDevAnnouncements/AppDevAnnouncements.framework",
"${BUILT_PRODUCTS_DIR}/BulletinBoard/BLTNBoard.framework",
"${BUILT_PRODUCTS_DIR}/CHIPageControl/CHIPageControl.framework",
"${BUILT_PRODUCTS_DIR}/FLEX/FLEX.framework",
Expand All @@ -1063,6 +1079,7 @@
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ARCL.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Apollo.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppDevAnnouncements.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BLTNBoard.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CHIPageControl.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLEX.framework",
Expand Down Expand Up @@ -1263,6 +1280,7 @@
87E712EE23416C3300085DB5 /* GivingDayViewController.swift in Sources */,
C89E17FB236E3FB300E89014 /* BRBAccountManager.swift in Sources */,
5D218C4021FBE39700327516 /* EateryCollectionViewCell.swift in Sources */,
C21D107D2400F535000A488B /* Secrets.swift in Sources */,
D956DCB92187B885001BB9B0 /* CampusEatery.swift in Sources */,
5DE1D42C225E95EB008054F4 /* RatingView.swift in Sources */,
5D218C3F21FBE39700327516 /* FilterEateriesView.swift in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions Eatery/Analytics/Analytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,8 @@ struct CampusCafeCellPressPayload: Payload {
struct CollegetownCellPressPayload: Payload {
let eventName = "collegetown_eatery_press"
}

/// Log whenever an announcement is presented to the user
struct AnnouncementPresentedPayload: Payload {
let eventName = "announcement_presented"
}
8 changes: 8 additions & 0 deletions Eatery/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AppDevAnnouncements
import Fabric
import Firebase
import Hero
Expand All @@ -19,6 +20,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let URLCache = Foundation.URLCache(memoryCapacity: 4 * 1024 * 1024, diskCapacity: 20 * 1024 * 1024, diskPath: nil)
Foundation.URLCache.shared = URLCache

AnnouncementNetworking.setupConfig(
scheme: Secrets.announcementsScheme,
host: Secrets.announcementsHost,
commonPath: Secrets.announcementsCommonPath,
announcementPath: Secrets.announcementsPath
)

window = UIWindow()
window?.backgroundColor = .white

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2019 CUAppDev. All rights reserved.
//

import AppDevAnnouncements
import CoreLocation
import UIKit

Expand Down Expand Up @@ -50,6 +51,13 @@ class EateriesSharedViewController: UIViewController {
setUpNavigationBar()
setUpChildViewControllers()
setUpPillView()

// Present announcement if there are any new ones to present
presentAnnouncement { presented in
if presented {
AppDevAnalytics.shared.logFirebase(AnnouncementPresentedPayload())
}
}
}

override func viewDidAppear(_ animated: Bool) {
Expand Down
25 changes: 25 additions & 0 deletions Eatery/Supporting/Secrets.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Keys.swift
// Eatery
//
// Created by Kevin Chan on 2/22/20.
// Copyright © 2020 CUAppDev. All rights reserved.
//

import Foundation

struct Secrets {

static let announcementsCommonPath = Secrets.secretDict["announcements-common-path"] as! String
static let announcementsHost = Secrets.secretDict["announcements-host"] as! String
static let announcementsPath = Secrets.secretDict["announcements-path"] as! String
static let announcementsScheme = Secrets.secretDict["announcements-scheme"] as! String

private static let secretDict: NSDictionary = {
guard let path = Bundle.main.path(forResource: "Secrets", ofType: "plist"),
let dict = NSDictionary(contentsOfFile: path) else { return [:] }
return dict
}()

}

3 changes: 2 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ target 'Eatery' do
platform :ios, '11.0'
shared_pods

pod 'AppDevAnnouncements', :git => 'https://github.com/cuappdev/appdev-announcements.git'
pod 'ARCL'
pod 'BulletinBoard'
pod 'CHIPageControl/Jaloro'
pod 'FLEX', '~> 2.0', :configurations => ['Debug']
pod 'Fabric'
pod 'Firebase/Analytics'
pod 'Hero'
pod 'Kingfisher'
pod 'NVActivityIndicatorView'
pod 'SnapKit'
pod 'CHIPageControl/Jaloro'
pod 'lottie-ios'
end

Expand Down
10 changes: 9 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PODS:
- Apollo (0.9.5):
- Apollo/Core (= 0.9.5)
- Apollo/Core (0.9.5)
- AppDevAnnouncements (0.0.1)
- ARCL (1.0.4)
- BulletinBoard (4.1.0)
- CHIPageControl/Jaloro (0.2)
Expand Down Expand Up @@ -73,6 +74,7 @@ PODS:

DEPENDENCIES:
- Apollo (from `https://github.com/apollographql/apollo-ios.git`)
- AppDevAnnouncements (from `https://github.com/cuappdev/appdev-announcements.git`)
- ARCL
- BulletinBoard
- CHIPageControl/Jaloro
Expand Down Expand Up @@ -113,14 +115,20 @@ SPEC REPOS:
EXTERNAL SOURCES:
Apollo:
:git: https://github.com/apollographql/apollo-ios.git
AppDevAnnouncements:
:git: https://github.com/cuappdev/appdev-announcements.git

CHECKOUT OPTIONS:
Apollo:
:commit: 43dd373b9a64cd877f6331be6c56b24c125ca778
:git: https://github.com/apollographql/apollo-ios.git
AppDevAnnouncements:
:commit: 31c4502ac6e9e77e3c478bc46b4e4960cfc90fe9
:git: https://github.com/cuappdev/appdev-announcements.git

SPEC CHECKSUMS:
Apollo: 09002d68c46e4098766fe376151d9ff8bd6aad36
AppDevAnnouncements: da6074ec0011c8964caa11cabc959ca007cb958f
ARCL: 5fd2b0d7aabf91f15dbc0e8c510b25516b8a755a
BulletinBoard: c774340545b5cfd05a96a89f63b105ecc95c86f9
CHIPageControl: a787bf7205c9b7e7fbfc412be36c5e8636b68f86
Expand All @@ -141,6 +149,6 @@ SPEC CHECKSUMS:
SwiftyJSON: c29297daf073d2aa016295d5809cdd68045c39b3
SwiftyUserDefaults: 33fcb42bd1feb53a37d873feb62c82967db5f7f6

PODFILE CHECKSUM: 1c5d8dde84bdc9fd451aeff03150714afe7dc373
PODFILE CHECKSUM: 001412e9dcee71b81e01610fd92688768c99c741

COCOAPODS: 1.8.4
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,31 @@ We use [CocoaPods](http://cocoapods.org) for our dependency manager. This should
To access the project, clone the project, and run `pod install` in the project directory.

### 2. Configuration
We use [Firebase](https://firebase.google.com) for our user analytics. You will have to retrieve a `GoogleService-Info.plist` from Firebase and then place it inside the `Eatery/` directory.
1. We use [Firebase](https://firebase.google.com) for our user analytics. You will have to retrieve a `GoogleService-Info.plist` from Firebase and then place it inside the `Eatery/` directory.

We also use `GraphQL` to retrieve data from our backend server and use `Apollo` on the client side in order to help us do so.
2. We also use `GraphQL` to retrieve data from our backend server and use `Apollo` on the client side in order to help us do so.

To setup `Apollo`, you will have to first install it by running `npm install -g [email protected]` in the project directory (make sure you specify version 1.9).

You will also have to retrieve a `schema.json` file by running: `apollo schema:download --endpoint={Backend_URL} schema.json` in the <strong>project directory</strong>.

3. Lastly, you will need a `Secrets.plist` file that you will want to place inside the `Eatery/Supporting/` directory. The following is a template for the `Secrets.plist` file:

```
<?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>announcements-scheme</key>
<string>insert-value-here</string>
<key>announcements-host</key>
<string>insert-value-here</string>
<key>announcements-common-path</key>
<string>insert-value-here</string>
<key>announcements-path</key>
<string>insert-value-here</string>
</dict>
</plist>
```

Finally, open `Eatery.xcworkspace` and enjoy Eatery!

0 comments on commit 43952cb

Please sign in to comment.