Skip to content
Merged
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
6 changes: 5 additions & 1 deletion EmpowerPlant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
674899180B469D888700A555 /* Pods_EmpowerPlant.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74014747DE857D26E9BD7B24 /* Pods_EmpowerPlant.framework */; };
843BD60F2AD08CE900B0098F /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 843BD60E2AD08CE900B0098F /* Utils.swift */; };
8B21663C29D3F8C80009C890 /* RandomErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B21663B29D3F8C80009C890 /* RandomErrors.swift */; };
8BA3AB382A20212C00BE1EA8 /* CartViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BA3AB372A20212C00BE1EA8 /* CartViewControllerTests.swift */; };
D15EDF12282BF7FB00FC13D6 /* Product+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = D15EDF11282BF7FB00FC13D6 /* Product+CoreDataProperties.swift */; };
Expand Down Expand Up @@ -37,6 +38,7 @@
/* Begin PBXFileReference section */
57BE79023D12DCDCB69BA73D /* Pods-EmpowerPlant.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EmpowerPlant.release.xcconfig"; path = "Target Support Files/Pods-EmpowerPlant/Pods-EmpowerPlant.release.xcconfig"; sourceTree = "<group>"; };
74014747DE857D26E9BD7B24 /* Pods_EmpowerPlant.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EmpowerPlant.framework; sourceTree = BUILT_PRODUCTS_DIR; };
843BD60E2AD08CE900B0098F /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
846BEA1A2ABE46880032F77F /* upload-symbols.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "upload-symbols.sh"; sourceTree = "<group>"; };
8474F0482ACCE2D800F21E06 /* deploy_project.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = deploy_project.sh; sourceTree = "<group>"; };
8474F04D2ACE54F300F21E06 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
Expand Down Expand Up @@ -130,6 +132,7 @@
D15EDF13282BF80400FC13D6 /* Product+CoreDataClass.swift */,
D15EDF11282BF7FB00FC13D6 /* Product+CoreDataProperties.swift */,
D17C73D127D83321006650AF /* ListAppViewController.swift */,
843BD60E2AD08CE900B0098F /* Utils.swift */,
D15FCDA727E00F0D00258BF3 /* Model.xcdatamodeld */,
D17C73CB27D82EB8006650AF /* EmpowerPlantViewController.swift */,
D19EBE6E2805ED52007022DC /* ShoppingCart.swift */,
Expand Down Expand Up @@ -330,6 +333,7 @@
D17C73CF27D82ED1006650AF /* CartViewController.swift in Sources */,
8B21663C29D3F8C80009C890 /* RandomErrors.swift in Sources */,
D19EBE6F2805ED52007022DC /* ShoppingCart.swift in Sources */,
843BD60F2AD08CE900B0098F /* Utils.swift in Sources */,
D17C73B327D8291D006650AF /* AppDelegate.swift in Sources */,
D17C73B527D8291D006650AF /* SceneDelegate.swift in Sources */,
D15EDF12282BF7FB00FC13D6 /* Product+CoreDataProperties.swift in Sources */,
Expand Down Expand Up @@ -461,8 +465,8 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D DEBUG";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
ReferencedContainer = "container:EmpowerPlant.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "--wipe-db"
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "USER"
Expand Down
39 changes: 22 additions & 17 deletions EmpowerPlant/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,32 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
SentrySDK.start { options in
options.dsn = "https://c88045e430864a8e864af6233e7c18ea@o87286.ingest.sentry.io/6249899"
// options.debug = true // Enabled debug when first installing is always helpful
options.dsn = "https://c88045e430864a8e864af6233e7c18ea@o87286.ingest.sentry.io/6249899"
#if DEBUG
options.debug = true
#endif

// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
options.profilesSampleRate = 1.0
options.enableCoreDataTracing = true
options.enableFileIOTracing = true
options.attachScreenshot = true
options.attachViewHierarchy = true
options.enableTimeToFullDisplayTracing = true
options.enableUserInteractionTracing = false
}
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0
options.profilesSampleRate = 1.0
options.enableCoreDataTracing = true
options.enableFileIOTracing = true
options.attachScreenshot = true
options.attachViewHierarchy = true
options.enableTimeToFullDisplayTracing = true
options.enableAutoPerformanceTracing = true
options.enableUserInteractionTracing = false
}
SentrySDK.configureScope{ scope in
scope.setTag(value: ["corporate", "enterprise", "self-serve"].randomElement() ?? "unknown", key: "customer.type")
scope.setTag(value: ProcessInfo.processInfo.environment["USER"] ?? "tda", key: "se")
}

if ProcessInfo.processInfo.arguments.contains("--wipe-db") {
wipeDB()
}

return true
}

Expand Down Expand Up @@ -87,10 +95,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
// TODO: error
}
}
}
Expand Down
11 changes: 2 additions & 9 deletions EmpowerPlant/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,8 @@
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="sK4-fV-ief">
<rect key="frame" x="20" y="140" width="374" height="653"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</tableView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemGreenColor"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" title="Empower Plants" id="Zxx-KE-qjy">
<barButtonItem key="backBarButtonItem" title="Empower Plants" id="53r-4t-Q7n">
Expand All @@ -49,7 +42,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="M2P-we-1IG"/>
<color key="backgroundColor" systemColor="systemYellowColor"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" title="My Cart" id="HBc-3M-t3f">
<barButtonItem key="backBarButtonItem" title="Empower Plants" id="SPv-hU-fem">
Expand Down
21 changes: 13 additions & 8 deletions EmpowerPlant/CartViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CartViewController: UIViewController, UITableViewDelegate, UITableViewData
let tableView: UITableView = {
let table = UITableView()
table.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
table.translatesAutoresizingMaskIntoConstraints = false
return table
}()

Expand All @@ -44,13 +45,17 @@ class CartViewController: UIViewController, UITableViewDelegate, UITableViewData
self.view.addSubview(tableView)
tableView.delegate = self
tableView.dataSource = self

// Comment this out and to see the green background and no data in the rows
tableView.frame = view.bounds

NSLayoutConstraint.activate([
tableView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
tableView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
])

configureNavigationItems()

// TODO make this 'total' appear in a UI element
// TODO: make this 'total' appear in a UI element
print("CartViewController | TOTAL", ShoppingCart.instance.total)
SentrySDK.reportFullyDisplayed()
}
Expand All @@ -77,7 +82,7 @@ class CartViewController: UIViewController, UITableViewDelegate, UITableViewData
request.httpMethod = "POST"

let json: [String: Any] = [
"form": ["email":"will@chat.io"], // TODO email update + check if all tx's+errors have email
"form": ["email":"will@chat.io"], // TODO: email update + check if all tx's+errors have email
"cart": [
"total": 100,
"quantities": ["4": 3],
Expand Down Expand Up @@ -128,10 +133,10 @@ class CartViewController: UIViewController, UITableViewDelegate, UITableViewData

// total DONE
// quantities DONE below
// items TODO
// TODO: items

let json: [String: Any] = [
"form": ["email":"will@chat.io"], // TODO email update + check if all tx's+errors have email
"form": ["email":"will@chat.io"], // TODO: email update + check if all tx's+errors have email
"cart": [
"total": ShoppingCart.instance.total,
"quantities": [
Expand All @@ -151,7 +156,7 @@ class CartViewController: UIViewController, UITableViewDelegate, UITableViewData
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// TODO could compute the length based on length of quantities.botanaVoice, plantStroller, nodeVoices, etc.
// TODO: could compute the length based on length of quantities.botanaVoice, plantStroller, nodeVoices, etc.
// or continue showing all products, even if quantity is 0. the screen looks more full this way
return 4 // products.count
}
Expand Down
Loading