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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions Steps4Impact.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
3AAA329F23655CB5002B7479 /* LoginButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginButton.swift; sourceTree = "<group>"; };
644A965BB27AB6174A19603E /* Pods_Steps4ImpactTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Steps4ImpactTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7D885FB78222CE09537F0C6A /* Pods-steps4impact.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-steps4impact.debug.xcconfig"; path = "Target Support Files/Pods-steps4impact/Pods-steps4impact.debug.xcconfig"; sourceTree = "<group>"; };
A51064892895F99C001467A2 /* Steps4ImpactDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Steps4ImpactDebug.entitlements; sourceTree = "<group>"; };
A5123F1E2381B51E00C3E9DE /* JourneyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JourneyViewController.swift; sourceTree = "<group>"; };
A5123F212381B60B00C3E9DE /* MilestoneCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MilestoneCell.swift; sourceTree = "<group>"; };
A5123F232381B63300C3E9DE /* JourneyDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JourneyDataSource.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -702,6 +703,7 @@
269E34C81E765828000726C2 /* Steps4Impact */ = {
isa = PBXGroup;
children = (
A51064892895F99C001467A2 /* Steps4ImpactDebug.entitlements */,
A52E332B246768DA008FAF71 /* PushNotifications */,
A5123F1D2381B4F700C3E9DE /* Journey */,
A57A29FA236E404C002AA380 /* BadgesV2 */,
Expand Down Expand Up @@ -791,13 +793,13 @@
sourceTree = "<group>";
};
A52E332B246768DA008FAF71 /* PushNotifications */ = {
isa = PBXGroup;
children = (
A52E332C24676929008FAF71 /* PushNotificationManager.swift */,
);
path = PushNotifications;
sourceTree = "<group>";
};
isa = PBXGroup;
children = (
A52E332C24676929008FAF71 /* PushNotificationManager.swift */,
);
path = PushNotifications;
sourceTree = "<group>";
};
A550395E23823FE500788157 /* Cells */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1009,7 +1011,7 @@
};
269E34C51E765828000726C2 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 6SQ8F32998;
DevelopmentTeam = 77MLE67A45;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
SystemCapabilities = {
Expand Down Expand Up @@ -1609,15 +1611,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Steps4Impact/Supporting Files/Steps4Impact.entitlements";
CODE_SIGN_ENTITLEMENTS = Steps4Impact/Steps4ImpactDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 278;
DEVELOPMENT_TEAM = 6SQ8F32998;
CURRENT_PROJECT_VERSION = 280;
DEVELOPMENT_TEAM = 77MLE67A45;
INFOPLIST_FILE = "Steps4Impact/Supporting Files/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0.5;
PRODUCT_BUNDLE_IDENTIFIER = com.akf.WalkingChallenge;
PRODUCT_BUNDLE_IDENTIFIER = com.akf.WalkingChallenge.aalim;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -1636,7 +1638,7 @@
CODE_SIGN_ENTITLEMENTS = "Steps4Impact/Supporting Files/Steps4Impact.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 278;
CURRENT_PROJECT_VERSION = 280;
DEVELOPMENT_TEAM = 6SQ8F32998;
INFOPLIST_FILE = "Steps4Impact/Supporting Files/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
38 changes: 20 additions & 18 deletions Steps4Impact/App/AppConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,29 @@ import Foundation

struct AppConfig {
static var server: URLComponents {
if UserInfo.isStaging {
return URLComponents(string: "https://staging.step4change.org")! // swiftlint:disable:this force_unwrapping
} else {
#if DEBUG
return URLComponents(string: "https://dev.step4change.org")! // swiftlint:disable:this force_unwrapping
#else
return URLComponents(string: "http://step4change.org")! // swiftlint:disable:this force_unwrapping
#endif
}
// if UserInfo.isStaging {
// return URLComponents(string: "https://staging.steps4impact.org")! // swiftlint:disable:this force_unwrapping
// } else {
// #if DEBUG
// return URLComponents(string: "https://steps4impact-dev.azurewebsites.net")! // swiftlint:disable:this force_unwrapping
// #else
// return URLComponents(string: "https://production.steps4impact.org")! // swiftlint:disable:this force_unwrapping
// #endif
// }
return URLComponents(string: "https://steps4impact-test.theismailiusa.org")!
}

static var serverPassword: String {
if UserInfo.isStaging {
return AppSecrets.stagingPassword
} else {
#if DEBUG
return AppSecrets.devPassword
#else
return AppSecrets.prodPassword
#endif
}
// if UserInfo.isStaging {
// return AppSecrets.stagingPassword
// } else {
// #if DEBUG
// return AppSecrets.devPassword
// #else
// return AppSecrets.prodPassword
// #endif
// }
return "dGVzdDp0ZXN0"
}

static let appCenterSecret = "9ca54e4e-20df-425a-bfe6-b72d0daad2da" // TODO: Move this to CI env
Expand Down
12 changes: 12 additions & 0 deletions Steps4Impact/App/Cache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ class Cache {
}
}

func fetchParticipant(fbid: FirebaseID) {
AKFCausesService.getParticipant(fbid: fbid) { [weak self] (result) in
guard result.isSuccess, let participant = Participant(json: result.response) else {
return
}
self?.update(participant: participant)
}
}

let socialDisplayNamesRelay = BehaviorRelay<[FirebaseID: SocialDisplayName]>(value: [:])
private var socialDisplayNames = [FirebaseID: SocialDisplayName]()
func update(fbid: FirebaseID, name: SocialDisplayName) {
Expand Down Expand Up @@ -84,5 +93,8 @@ class Cache {
}

let participantRelay = BehaviorRelay<Participant?>(value: nil)
func update(participant: Participant) {
participantRelay.accept(participant)
}
let currentEventRelay = BehaviorRelay<Event?>(value: nil)
}
2 changes: 1 addition & 1 deletion Steps4Impact/BadgesV2/Cells/BadgeCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Badge: CellContext {
var badgeType: BadgeType = .unknown
}

protocol BadgeCellDelegate: class {
protocol BadgeCellDelegate: AnyObject {
func badgeCellTapped()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import UIKit
import SnapKit

protocol ChallengeTeamProgressCellDelegate: class {
protocol ChallengeTeamProgressCellDelegate: AnyObject {
func challengeTeamProgressDisclosureTapped()
func challengeTeamProgressEditTapped()
}
Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/Challenge/Cells/TeamNeededCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import UIKit
import SnapKit

protocol TeamNeededCellDelegate: class {
protocol TeamNeededCellDelegate: AnyObject {
func teamNeededCellPrimaryTapped()
func teamNeededCellSecondaryTapped()
}
Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/CommonUI/Cells/DisclosureCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import UIKit
import SnapKit

protocol DisclosureCellDelegate: class {
protocol DisclosureCellDelegate: AnyObject {
func disclosureCellTapped(context: Context?)
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/CommonUI/Cells/ImageButtonCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import UIKit
import SnapKit

protocol ImageButtonCellDelegate: class {
protocol ImageButtonCellDelegate: AnyObject {
func imageButtonCellTapped(context: Context?)
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/CommonUI/Views/CellDisclosureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import UIKit

protocol CellDisclosureViewDelegate: class {
protocol CellDisclosureViewDelegate: AnyObject {
func cellDisclosureTapped()
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/CommonUI/Views/CellImageButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import UIKit

protocol CellImageButtonViewDelegate: class {
protocol CellImageButtonViewDelegate: AnyObject {
func cellImageButtonViewTapped()
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/CommonUI/Views/RadioButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import UIKit

protocol RadioButtonDelegate: class {
protocol RadioButtonDelegate: AnyObject {
func radioButtonTapped(radioButton: RadioButton)
}

Expand Down
4 changes: 2 additions & 2 deletions Steps4Impact/CommonUI/Views/SelectionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import UIKit
import SnapKit

protocol SelectionButtonDataSource: class {
protocol SelectionButtonDataSource: AnyObject {
var items: [String] { get }
var selection: Int? { get set }
}
Expand Down Expand Up @@ -102,7 +102,7 @@ extension SelectionButtonPopoverViewController: UIPopoverPresentationControllerD
}
}

protocol SelectionButtonDelegate: class {
protocol SelectionButtonDelegate: AnyObject {
func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool, completion: (() -> Swift.Void)?)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import UIKit
import SnapKit

protocol ConnectedActivityCellDelegate: class {
protocol ConnectedActivityCellDelegate: AnyObject {
}

struct ConnectedActivityCellContext: CellContext {
Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/DashboardV2/Cells/EmptyActivityCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import UIKit
import SnapKit

protocol EmptyActivityCellDelegate: class {
protocol EmptyActivityCellDelegate: AnyObject {
func emptyActivityCellConnectTapped()
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/DashboardV2/Cells/ProfileCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import UIKit
import SnapKit
import SDWebImage

protocol ProfileCardCellDelegate: class {
protocol ProfileCardCellDelegate: AnyObject {
func profileDisclosureTapped()
}

Expand Down
10 changes: 5 additions & 5 deletions Steps4Impact/DashboardV2/DashboardDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ class DashboardDataSource: TableViewDataSource {
cache.participantRelay)

update.subscribeOnNext { [weak self] (names, imageURLs, participant) in
guard let `self` = self else { return }
self.name = names["me"] ?? " "
self.imageURL = imageURLs["me"]
self.teamName = participant?.team?.name ?? " "
if let event = participant?.currentEvent {
guard let `self` = self, let participant = participant else { return }
self.name = names[participant.fbid] ?? " "
self.imageURL = imageURLs[participant.fbid]
self.teamName = participant.team?.name ?? " "
if let event = participant.currentEvent {
self.eventName = event.name
self.eventTimeline = DateInterval(start: event.teamFormationPhase.start, end: event.challengePhase.end)
self.eventTimelineString = DataFormatters
Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/DashboardV2/Views/ActivityDateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import UIKit

protocol ActivityDateViewDelegate: class {
protocol ActivityDateViewDelegate: AnyObject {
func activityDateViewLeftTapped()
func activityDateViewRightTapped()
}
Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/DashboardV2/Views/ActivityTimeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import UIKit

protocol ActivityTimeViewDelegate: class {
protocol ActivityTimeViewDelegate: AnyObject {
func activityTimeViewTapped(time: ActivityTime)
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/DashboardV2/Views/ActivityUnitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import UIKit

protocol ActivityUnitViewDelegate: class {
protocol ActivityUnitViewDelegate: AnyObject {
func activityUnitViewTapped(unit: ActivityUnit)
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/Journey/Cells/JourneyDetailCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import UIKit

protocol JourneyDetailDelegate: class {
protocol JourneyDetailDelegate: AnyObject {
func didGetShareText(_ shareText: String)
}

Expand Down
2 changes: 1 addition & 1 deletion Steps4Impact/Journey/Cells/MilestoneCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

protocol MilestoneNameButtonDelegate: class {
protocol MilestoneNameButtonDelegate: AnyObject {
func milestoneNameButtonTapped(sequence: Int)
}

Expand Down
17 changes: 16 additions & 1 deletion Steps4Impact/LoginV2/LoginV2ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,27 @@ class LoginV2ViewController: ViewController {
// AKF-WCBackend
extension LoginV2ViewController {
private func linkAKFBackend(fbid: String) {
AKFCausesService.createParticipant(fbid: fbid) { [weak self] (_) in

let handler = { [weak self] in
onMain {
AppController.shared.login()
}
self?.addParticipantToDefaultEventIfNeeded(fbid: fbid)
}

AKFCausesService.getParticipant(fbid: fbid) { (result) in
if !result.isSuccess {
AKFCausesService.createParticipant(fbid: fbid) { [weak self] (result) in
guard result.isSuccess else {
self?.alert(message: "Sign In failed. Please try again")
return
}
handler()
}
} else {
handler()
}
}
}

private func addParticipantToDefaultEventIfNeeded(fbid: String) {
Expand Down
28 changes: 16 additions & 12 deletions Steps4Impact/Networking/AZSClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@ import AZSClient

class AZSClient {

static let accKey = String(AppSecrets.azureAccKey.reversed())
static let serverURL = "https://teamimages.blob.core.windows.net/"
static let containerName = "teamimages-dev"
static let accountName = "teamimages"
// static let accKey = String(AppSecrets.azureAccKey.reversed())
static let accKey = "qoLL+0O+vKrleXiGMrT6JPHsQI9f0juFYJ+aRJ8KnUkCwGbbYhaLpPMFOhIyuVXBMaibBcd5O9C6+AStLRpkVA=="
// static let serverURL = "https://teamimages.blob.core.windows.net/"
static let serverURL = "https://steps4impact.blob.core.windows.net/"
// static let containerName = "teamimages-dev"
static let containerName = "teamimages"
// static let accountName = "teamimages"
static let accountName = "steps4impact"
static let folderName: String = {
if UserInfo.isStaging {
return "staging/"
} else {
#if DEBUG
return "dev/"
#else
// if UserInfo.isStaging {
// return "staging/"
// } else {
// #if DEBUG
// return "dev/"
// #else
return ""
#endif
}
// #endif
// }
}()
static let connectionString = "DefaultEndpointsProtocol=https;AccountName=\(AZSClient.accountName);AccountKey=\(AZSClient.accKey)"
static func uploadImage(data imageData: Data, teamName: String, completion: @escaping (Error?, Bool) -> (Void)) {
Expand Down
Loading