Skip to content

Commit

Permalink
Publishing the app first version
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-chuang committed Dec 2, 2023
1 parent 3d441f7 commit 53bd8c2
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 27 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 4 additions & 4 deletions truscoop-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
Expand Down Expand Up @@ -696,8 +696,8 @@
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions truscoop/API/NetworkWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class NetworkWrapper: ObservableObject {
APIFetchHandler.sharedInstance.getAllArticles(
completion: { [weak self] scoops in
guard let self = self else { return }
self.scoops = scoops
self.filtered = scoops.reversed()
self.scoops = scoops.reversed()
self.filtered = self.scoops
// Perform UI update on main queue
DispatchQueue.main.async {
self.loading = false
Expand Down
Binary file added truscoop/Assets.xcassets/.DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions truscoop/Assets.xcassets/info.circle.symbolset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"symbols" : [
{
"filename" : "info.circle.svg",
"idiom" : "universal"
}
]
}
107 changes: 107 additions & 0 deletions truscoop/Assets.xcassets/info.circle.symbolset/info.circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 107 additions & 20 deletions truscoop/Views/AddScoopView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ struct AddScoopView: View {

@State var url: String = ""

@State private var failedToAddScoop: Bool = false
@State private var errorMsg: String = ""

@State var showAlreadyThereModal: Bool = false

@State var alreadyThereScoop: Scoop = articles[0]


@EnvironmentObject var network: NetworkWrapper

var body: some View {
Expand All @@ -36,6 +44,60 @@ struct AddScoopView: View {
EmptyView()
)
)

(showAlreadyThereModal ?
AnyView(
GeometryReader {geometry in
ZStack {
Rectangle()
.opacity(0.6)
.ignoresSafeArea()
ZStack(alignment: Alignment(horizontal: .center, vertical: .top)) {
Rectangle()
.fill(Color(hex: "F3F3F3")!)
.cornerRadius(15)
.frame(width: geometry.size.width * 0.8, height: geometry.size.height * 0.3, alignment: .center)
VStack(alignment: .center, spacing: 20) {
Text("Article already found")
.font(.system(size: 24, weight: .bold))
Text("This article already exists in our database. Would you like to open it now?")
.font(.system(size: 14))
VStack(spacing: 15) {
NavigationLink {
ScoopView(scoop: alreadyThereScoop)
} label: {
ZStack {
Rectangle()
.fill(Color.init(hex: "CFCFCF")!)
.cornerRadius(20)
.frame(height: 44)
.shadow(color: .black.opacity(0.25), radius: 2, x: 0, y: 2)
Text("Open Now")
.font(.system(size: 18, weight: .bold))
.foregroundColor(.black)
}
}

Button {
showAlreadyThereModal = false
} label: {
Text("No thanks")
.font(.system(size: 12))
.foregroundColor(.red)
}
}
}.padding(20)
.frame(width: geometry.size.width * 0.8, height: geometry.size.height * 0.3, alignment: .center)
}

}
}
)
:
AnyView(
EmptyView()
)
)
}
}

Expand Down Expand Up @@ -108,38 +170,63 @@ struct AddScoopView: View {
.cornerRadius(30)
.frame(width: geometry.size.width, height: geometry.size.height * 0.67, alignment: .center)
VStack(spacing: 30) {

TextField("paste url here", text: $url)
.font(
Font.custom("Inter", size: 16)
.weight(.medium)
)
.padding(11)
.kerning(0.24)
.background(
Rectangle()
.foregroundColor(.clear)
.background(Color(red: 0.99, green: 0.99, blue: 0.99))

.cornerRadius(2)
.overlay(
RoundedRectangle(cornerRadius: 2)
.stroke(Color(red: 0.7, green: 0.7, blue: 0.7).opacity(0.8), lineWidth: 1.5)
VStack {
TextField("paste url here", text: $url)
.font(
Font.custom("Inter", size: 16)
.weight(.medium)
)
.padding(11)
.kerning(0.24)
.background(
Rectangle()
.foregroundColor(.clear)
.background(Color(red: 0.99, green: 0.99, blue: 0.99))

.cornerRadius(2)
.overlay(
RoundedRectangle(cornerRadius: 2)
.stroke(Color(red: 0.7, green: 0.7, blue: 0.7).opacity(0.8), lineWidth: 1.5)
)
)

(
failedToAddScoop ?
AnyView(
Text(errorMsg)
.font(.system(size: 16))
.foregroundColor(.red)
)
:
AnyView(EmptyView())
)
}

Button {
network.addArticle(url: url, completion: { updated in
DispatchQueue.main.async {
guard let newScoop = updated else {
print("POOPY BALLS")
failedToAddScoop = true
network.loading = false

// check and see if it already exists
network.scoops.forEach { val in
if url == val.url {
alreadyThereScoop = val
showAlreadyThereModal = true
errorMsg = "Please enter a url that is not in our database"
return
}
}
if !showAlreadyThereModal {
errorMsg = "Please enter a valid url"
}
return
}
network.scoops.insert(newScoop, at: 0)
network.filtered.insert(newScoop, at: 0)
network.loading = false
print("LOADING NEW ONE")
failedToAddScoop = false
}

})
Expand All @@ -166,7 +253,7 @@ struct AddScoopView: View {
RoundedRectangle(cornerRadius: 8)
.stroke(Color(red: 0.76, green: 0.76, blue: 0.76), style: StrokeStyle(lineWidth: 1, dash: [2, 2]))
)
VStack(alignment: .leading){
VStack(alignment: .leading) {
Text("Recently Added Scoops")
.font(.system(size: 18, weight: .bold))
.foregroundColor(.black)
Expand Down
10 changes: 10 additions & 0 deletions truscoop/Views/ScoopView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ struct ScoopView: View {
}
})
})
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
ShareLink(item: scoop.url) {
Image(systemName: "square.and.arrow.up.circle.fill")
.resizable()
.scaledToFit()
.foregroundColor(.blue)
}
}
}
}

private func findSimilarScoops(rating: Float) -> ArraySlice<Scoop> {
Expand Down
1 change: 0 additions & 1 deletion truscoop/todo.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# <#Title#>
- Animated filtering
- Display the number of votes
- Modify the SPEC
- Table tracking which articles posted by which user
- Submit! (leave like a half an hour for this)
- Share article

0 comments on commit 53bd8c2

Please sign in to comment.