Skip to content

Commit

Permalink
OMG It's done (#89)
Browse files Browse the repository at this point in the history
* Drag to dismiss background animation no longer delays

* Optimize ipad bill detail display

* Fix settle bill navbar button animation

* Improve entry item view UI

* Add entry row view

* Good version before add entry

* Still good version

* Add entry done

* Fix settlement problem

* Fix bugs

* Add deletion animation for entry rows
  • Loading branch information
JackZhao98 authored Feb 22, 2021
1 parent f794ea7 commit 8d051a2
Show file tree
Hide file tree
Showing 16 changed files with 883 additions and 341 deletions.
22 changes: 15 additions & 7 deletions Dots/Dots.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@
EB8ED8F225BD7BB10003AC5F /* HomeBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB8ED8F125BD7BB10003AC5F /* HomeBottomView.swift */; };
EB8ED8F525BD7F850003AC5F /* CustomShape.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB8ED8F425BD7F850003AC5F /* CustomShape.swift */; };
EBA1437025C1030F006A4C93 /* KeyboardDismiss.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA1436F25C1030F006A4C93 /* KeyboardDismiss.swift */; };
EBA1437525C128E6006A4C93 /* EntryDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA1437425C128E6006A4C93 /* EntryDetailView.swift */; };
EBA1437525C128E6006A4C93 /* DeprecatedEntryDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA1437425C128E6006A4C93 /* DeprecatedEntryDetailView.swift */; };
EBA1438925C13E7F006A4C93 /* CardItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBB253A625BF9D35005E4938 /* CardItem.swift */; };
EBA1438D25C13F57006A4C93 /* EntryListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBA1438C25C13F57006A4C93 /* EntryListView.swift */; };
EBB433F625A9691E0047C940 /* DotsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBB433F525A9691E0047C940 /* DotsApp.swift */; };
EBB433FD25A969200047C940 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EBB433FC25A969200047C940 /* Preview Assets.xcassets */; };
EBB92E7E25E3521D0077997E /* EntryRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBB92E7D25E3521D0077997E /* EntryRowView.swift */; };
EBB92E8025E36EBC0077997E /* EntryDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBB92E7F25E36EBC0077997E /* EntryDetailView.swift */; };
EBBC703D25C9288F00127D7B /* CustomEntryRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBBC703C25C9288F00127D7B /* CustomEntryRowView.swift */; };
EBBCAE3F25E1DCA7003703ED /* SettleCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBBCAE3E25E1DCA7003703ED /* SettleCardView.swift */; };
EBBCAE4225E2577E003703ED /* CircleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBD6AA6625AD105B006C3AA6 /* CircleView.swift */; };
Expand Down Expand Up @@ -85,14 +87,16 @@
EB8ED8F125BD7BB10003AC5F /* HomeBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeBottomView.swift; sourceTree = "<group>"; };
EB8ED8F425BD7F850003AC5F /* CustomShape.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomShape.swift; sourceTree = "<group>"; };
EBA1436F25C1030F006A4C93 /* KeyboardDismiss.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardDismiss.swift; sourceTree = "<group>"; };
EBA1437425C128E6006A4C93 /* EntryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryDetailView.swift; sourceTree = "<group>"; };
EBA1437425C128E6006A4C93 /* DeprecatedEntryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeprecatedEntryDetailView.swift; sourceTree = "<group>"; };
EBA1438C25C13F57006A4C93 /* EntryListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntryListView.swift; sourceTree = "<group>"; };
EBB253A625BF9D35005E4938 /* CardItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardItem.swift; sourceTree = "<group>"; };
EBB433F225A9691E0047C940 /* Dots.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Dots.app; sourceTree = BUILT_PRODUCTS_DIR; };
EBB433F525A9691E0047C940 /* DotsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DotsApp.swift; sourceTree = "<group>"; };
EBB433F725A9691E0047C940 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
EBB433FC25A969200047C940 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
EBB433FE25A969200047C940 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
EBB92E7D25E3521D0077997E /* EntryRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryRowView.swift; sourceTree = "<group>"; };
EBB92E7F25E36EBC0077997E /* EntryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryDetailView.swift; sourceTree = "<group>"; };
EBBC703C25C9288F00127D7B /* CustomEntryRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomEntryRowView.swift; sourceTree = "<group>"; };
EBBCAE3E25E1DCA7003703ED /* SettleCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettleCardView.swift; sourceTree = "<group>"; };
EBC187F525C0E328000A4B32 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -130,10 +134,11 @@
children = (
EBA1438C25C13F57006A4C93 /* EntryListView.swift */,
EB162C2C25BE3C5A007F1F4F /* BillDetailView.swift */,
EBA1437425C128E6006A4C93 /* EntryDetailView.swift */,
EBBC703C25C9288F00127D7B /* CustomEntryRowView.swift */,
EB36705E25CFAE8E003EA555 /* AddBillView.swift */,
EB09532325DEF5A800057469 /* CardRowView.swift */,
EBB92E7D25E3521D0077997E /* EntryRowView.swift */,
EBB92E7F25E36EBC0077997E /* EntryDetailView.swift */,
);
path = SubViews;
sourceTree = "<group>";
Expand Down Expand Up @@ -189,7 +194,6 @@
EB554BC925B8F837001EE4E7 /* LinearDotSelectView.swift */,
EB162C2925BE2CDB007F1F4F /* EntryItemView.swift */,
EBB253A625BF9D35005E4938 /* CardItem.swift */,
EB36705725CF7CCD003EA555 /* BillMemberSelection.swift */,
EB09533825DF385400057469 /* NotificationBubble.swift */,
);
path = Components;
Expand Down Expand Up @@ -282,6 +286,8 @@
EBEB182725CB6A9200CEA356 /* ArchivedViews */ = {
isa = PBXGroup;
children = (
EBA1437425C128E6006A4C93 /* DeprecatedEntryDetailView.swift */,
EB36705725CF7CCD003EA555 /* BillMemberSelection.swift */,
EBD6AA6025AD05DF006C3AA6 /* HomeView.swift */,
87C8434B25BE46E100BDFAFB /* AddEntry.swift */,
EB6D988A25AFBBBD000C1D65 /* DotSelectView.swift */,
Expand Down Expand Up @@ -421,14 +427,15 @@
EB3DC2D925AAB0E700F2CF77 /* MainData.swift in Sources */,
EB3DC2D525AAA67800F2CF77 /* EntryObject.swift in Sources */,
EBA1438D25C13F57006A4C93 /* EntryListView.swift in Sources */,
EBA1437525C128E6006A4C93 /* EntryDetailView.swift in Sources */,
EBA1437525C128E6006A4C93 /* DeprecatedEntryDetailView.swift in Sources */,
EB8ED8F525BD7F850003AC5F /* CustomShape.swift in Sources */,
EBBC703D25C9288F00127D7B /* CustomEntryRowView.swift in Sources */,
EB09533325DEF64200057469 /* HomeView.swift in Sources */,
EBC1E28E25E0764F008A8DC5 /* NavigationBarModifier.swift in Sources */,
EB162C2D25BE3C5A007F1F4F /* BillDetailView.swift in Sources */,
EB8ED8F225BD7BB10003AC5F /* HomeBottomView.swift in Sources */,
EB36705F25CFAE8E003EA555 /* AddBillView.swift in Sources */,
EBB92E8025E36EBC0077997E /* EntryDetailView.swift in Sources */,
EBA1437025C1030F006A4C93 /* KeyboardDismiss.swift in Sources */,
EB3DC2CF25AA9AE000F2CF77 /* DotsData.swift in Sources */,
EB554BCA25B8F837001EE4E7 /* LinearDotSelectView.swift in Sources */,
Expand All @@ -439,6 +446,7 @@
EBEB182425CB6A8500CEA356 /* MenuView.swift in Sources */,
EBB433F625A9691E0047C940 /* DotsApp.swift in Sources */,
EBBCAE3F25E1DCA7003703ED /* SettleCardView.swift in Sources */,
EBB92E7E25E3521D0077997E /* EntryRowView.swift in Sources */,
EB3DC2D225AA9F6D00F2CF77 /* BillObject.swift in Sources */,
EB6D988B25AFBBBD000C1D65 /* DotSelectView.swift in Sources */,
EB3DC2E025AAB56800F2CF77 /* Helper.swift in Sources */,
Expand Down Expand Up @@ -600,7 +608,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.6.6;
MARKETING_VERSION = 0.8.1;
PRODUCT_BUNDLE_IDENTIFIER = com.zijianzhao.dots;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = NO;
Expand All @@ -626,7 +634,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.6.6;
MARKETING_VERSION = 0.8.1;
PRODUCT_BUNDLE_IDENTIFIER = com.zijianzhao.dots;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = NO;
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Dots/Dots/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Dots</string>
<string>Dots-beta</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
16 changes: 8 additions & 8 deletions Dots/Dots/Models/DotsData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,24 @@ struct DotsData: Identifiable, Codable {
while cci < creditors.count {
var temp: [(Int, Double)] = []
while creditors[cci].1 > 0 {
print("cdi: \(cdi) - debtors[cdi]: \(debtors[cdi])")
if creditors[cci].1 < (-1 * debtors[cdi].1) {

if abs(creditors[cci].1 + debtors[cdi].1) < 0.01 {
temp += [(debtors[cdi].0, creditors[cci].1)]
creditors[cci].1 = 0
cdi += 1
}
else if creditors[cci].1 < (-1 * debtors[cdi].1) {
temp += [(debtors[cdi].0, creditors[cci].1)]
debtors[cdi].1 += creditors[cci].1
creditors[cci].1 = 0
print("first")
}
else if creditors[cci].1 > (-1 * debtors[cdi].1) {
temp += [(debtors[cdi].0, (-1 * debtors[cdi].1))]
creditors[cci].1 -= (-1 * debtors[cdi].1)
print("else if")
cdi += 1
}
else {
temp += [(debtors[cdi].0, creditors[cci].1)]
creditors[cci].1 = 0
print("else")
cdi += 1
// fatalError("Should not be here")
}
settlementDict[creditors[cci].0] = temp
}
Expand Down
100 changes: 100 additions & 0 deletions Dots/Dots/Views/ArchivedViews/BillMemberSelection.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
////
//// BillMemberSelection.swift
//// Dots
////
//// Created by Jack Zhao on 2/6/21.
////
//
//import SwiftUI
//
///// Displays responsibility for members in a group in current bill.
//struct BillMemberSelection: View {
// /// members selected
// @Binding var selectedGroup: [Int]
// /// members not selected
// @State var unselectedGroup: [Int]
// /// initiator of current bill
// @Binding var initiator: Int
// @State var showMiddlePrompt: Bool = false
// /// default radius of a selected icon
// let selectedDotsRadius: CGFloat = 80
//
// @Namespace var namespace
// let rotationOffset: Int = 1
// /// default radius of an icon
// let circleRadius: Double = 35
//
//
// var body: some View {
// ZStack {
// ForEachWithIndex(self.unselectedGroup, id: \.self) { i, attendee in
// CircleView(index: attendee, diameter: circleRadius)
// .scaleEffect(self.selectedGroup.contains(attendee) ? 0.6 : 1)
// .offset(y: -selectedDotsRadius)
// .rotationEffect(Angle(degrees: Double(i) * 360.0/Double(self.unselectedGroup.count)))
// .matchedGeometryEffect(id: attendee, in: namespace)
// .onTapGesture {
// withAnimation {
// if self.selectedGroup.contains(attendee) {
// self.selectedGroup.remove(at: self.selectedGroup.firstIndex(of: attendee)!)
// } else {
// self.selectedGroup.append(attendee)
// self.selectedGroup.sort()
// }
// haptic_one_click()
// }
// }
// .onLongPressGesture() {
// self.initiator = attendee
// if !self.selectedGroup.contains(attendee) {
// self.selectedGroup.append(attendee)
// self.selectedGroup.sort()
// }
// }
// }
//
// if (showMiddlePrompt) {
// if self.initiator != -1 {
// CircleView(index: self.initiator, diameter: Double(selectedDotsRadius))
//// .stroke(style: StrokeStyle(lineWidth: 4, lineCap: .round, dash: [15], dashPhase: 1))
//// .frame(width: selectedDotsRadius, height: selectedDotsRadius)
//
// } else {
// Circle()
// .stroke(style: StrokeStyle(lineWidth: 4, lineCap: .round, dash: [15], dashPhase: 1))
// .foregroundColor(Color(UIColor.systemGray))
// .frame(width: selectedDotsRadius, height: selectedDotsRadius)
// .overlay(
// Text("Drag initiator here")
// .font(.subheadline)
// .fontWeight(.regular)
// .multilineTextAlignment(.center)
// .foregroundColor(Color(UIColor.systemGray))
// )
// }
// }
// }
// .frame(width: 2 * selectedDotsRadius + selectedDotsRadius, height: 2 * selectedDotsRadius + selectedDotsRadius)
//
// }
//
// private func xOffset(_ index: Int, show: Bool, amount: Int) -> CGFloat {
// let slice = CGFloat(2 * Double.pi / Double(amount))
// let r = show ? circleRadius : 0.3 * circleRadius
// let i = index
// return CGFloat(r) * cos(slice * CGFloat(i))
// }
//
// private func yOffset(_ index: Int, show: Bool, amount: Int) -> CGFloat {
// let slice = CGFloat(2 * Double.pi / Double(amount))
// let r = circleRadius
// let i = index
// return CGFloat(r) * sin(slice * CGFloat(i))
// }
//}
//
//struct BillMemberSelection_Previews: PreviewProvider {
// static var previews: some View {
// BillMemberSelection(selectedGroup: .constant([3]), unselectedGroup: [1, 2, 3, 4], initiator: .constant(0))
// }
//}
Loading

0 comments on commit 8d051a2

Please sign in to comment.