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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@
C796F29C26CCE3DA0076C5F5 /* ScreenDimensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C796F29B26CCE3DA0076C5F5 /* ScreenDimensions.swift */; };
C796F29D26CCE3DA0076C5F5 /* ScreenDimensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C796F29B26CCE3DA0076C5F5 /* ScreenDimensions.swift */; };
C796F29E26CCE9DE0076C5F5 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B9029EF026A10B1500C92F12 /* GoogleService-Info.plist */; };
C796F2AD26D2281A0076C5F5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C796F2AC26D2281A0076C5F5 /* Preview Assets.xcassets */; };
C796F2B226D228380076C5F5 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B9029EF026A10B1500C92F12 /* GoogleService-Info.plist */; };
C796F2B326D2283B0076C5F5 /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7C6B5B2268DAC1800546A57 /* Comment.swift */; };
C796F2B426D2283E0076C5F5 /* UserViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F60CF5268EBEDE002F68AB /* UserViewModel.swift */; };
C796F2B526D228410076C5F5 /* PostViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C79D1AC226A4114600B6A169 /* PostViewModel.swift */; };
C796F2B626D228490076C5F5 /* PostsType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C730A31E26B0998A00A29E81 /* PostsType.swift */; };
C796F2B726D228490076C5F5 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F60CFB268EE316002F68AB /* ContentView.swift */; };
C796F2B826D228490076C5F5 /* PostDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C799B60D269E1CEF00A43C40 /* PostDetailView.swift */; };
C796F2B926D228490076C5F5 /* NewPostsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70B63FE2696B29400851A91 /* NewPostsView.swift */; };
C796F2BA26D228490076C5F5 /* PostCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C799B610269E1E3B00A43C40 /* PostCell.swift */; };
C796F2BB26D228490076C5F5 /* SignUpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F60CF1268E352F002F68AB /* SignUpView.swift */; };
C796F2BC26D228490076C5F5 /* PostListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C77ABFAA26B8992600BDE919 /* PostListViewModel.swift */; };
C796F2BD26D228490076C5F5 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7C6B575268C8C9A00546A57 /* LoginView.swift */; };
C796F2BE26D228490076C5F5 /* PostsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C79D1AEC26A8D9A300B6A169 /* PostsView.swift */; };
C796F2BF26D228490076C5F5 /* Database+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C77ABFAD26B8A7FF00BDE919 /* Database+Extensions.swift */; };
C796F2C026D228490076C5F5 /* DatabaseExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7C6B574268C8C9A00546A57 /* DatabaseExampleApp.swift */; };
C796F2C126D228490076C5F5 /* ScreenDimensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C796F29B26CCE3DA0076C5F5 /* ScreenDimensions.swift */; };
C796F2C326D228F30076C5F5 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = C796F2C226D228F30076C5F5 /* FirebaseAuth */; };
C796F2C526D228F30076C5F5 /* FirebaseDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = C796F2C426D228F30076C5F5 /* FirebaseDatabase */; };
C796F2C626D390010076C5F5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7C6B576268C8C9C00546A57 /* Assets.xcassets */; };
C799B60E269E1CEF00A43C40 /* PostDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C799B60D269E1CEF00A43C40 /* PostDetailView.swift */; };
C799B60F269E1CEF00A43C40 /* PostDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C799B60D269E1CEF00A43C40 /* PostDetailView.swift */; };
C799B611269E1E3B00A43C40 /* PostCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C799B610269E1E3B00A43C40 /* PostCell.swift */; };
Expand Down Expand Up @@ -55,6 +75,9 @@
C77ABFAA26B8992600BDE919 /* PostListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostListViewModel.swift; sourceTree = "<group>"; };
C77ABFAD26B8A7FF00BDE919 /* Database+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Database+Extensions.swift"; sourceTree = "<group>"; };
C796F29B26CCE3DA0076C5F5 /* ScreenDimensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenDimensions.swift; sourceTree = "<group>"; };
C796F2A326D228180076C5F5 /* DatabaseExample (tvOS).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DatabaseExample (tvOS).app"; sourceTree = BUILT_PRODUCTS_DIR; };
C796F2AC26D2281A0076C5F5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
C796F2AE26D2281A0076C5F5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C799B60D269E1CEF00A43C40 /* PostDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostDetailView.swift; sourceTree = "<group>"; };
C799B610269E1E3B00A43C40 /* PostCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostCell.swift; sourceTree = "<group>"; };
C79D1AC226A4114600B6A169 /* PostViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostViewModel.swift; sourceTree = "<group>"; };
Expand All @@ -74,6 +97,15 @@
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
C796F2A026D228180076C5F5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C796F2C526D228F30076C5F5 /* FirebaseDatabase in Frameworks */,
C796F2C326D228F30076C5F5 /* FirebaseAuth in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C7C6B578268C8C9C00546A57 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -103,13 +135,31 @@
name = Frameworks;
sourceTree = "<group>";
};
C796F2A426D228180076C5F5 /* tvOS */ = {
isa = PBXGroup;
children = (
C796F2AE26D2281A0076C5F5 /* Info.plist */,
C796F2AB26D2281A0076C5F5 /* Preview Content */,
);
path = tvOS;
sourceTree = "<group>";
};
C796F2AB26D2281A0076C5F5 /* Preview Content */ = {
isa = PBXGroup;
children = (
C796F2AC26D2281A0076C5F5 /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
C7C6B56E268C8C9A00546A57 = {
isa = PBXGroup;
children = (
B9029EF026A10B1500C92F12 /* GoogleService-Info.plist */,
C7C6B573268C8C9A00546A57 /* Shared */,
C7C6B57D268C8C9C00546A57 /* iOS */,
C7C6B584268C8C9C00546A57 /* macOS */,
C796F2A426D228180076C5F5 /* tvOS */,
C7C6B57C268C8C9C00546A57 /* Products */,
C796F29626CCDCEF0076C5F5 /* Frameworks */,
);
Expand All @@ -131,6 +181,7 @@
children = (
C7C6B57B268C8C9C00546A57 /* DatabaseExample.app */,
C7C6B583268C8C9C00546A57 /* DatabaseExample.app */,
C796F2A326D228180076C5F5 /* DatabaseExample (tvOS).app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -183,6 +234,27 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
C796F2A226D228180076C5F5 /* DatabaseExample (tvOS) */ = {
isa = PBXNativeTarget;
buildConfigurationList = C796F2B126D2281A0076C5F5 /* Build configuration list for PBXNativeTarget "DatabaseExample (tvOS)" */;
buildPhases = (
C796F29F26D228180076C5F5 /* Sources */,
C796F2A026D228180076C5F5 /* Frameworks */,
C796F2A126D228180076C5F5 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "DatabaseExample (tvOS)";
packageProductDependencies = (
C796F2C226D228F30076C5F5 /* FirebaseAuth */,
C796F2C426D228F30076C5F5 /* FirebaseDatabase */,
);
productName = tvOSDatabaseExample;
productReference = C796F2A326D228180076C5F5 /* DatabaseExample (tvOS).app */;
productType = "com.apple.product-type.application";
};
C7C6B57A268C8C9C00546A57 /* DatabaseExample (iOS) */ = {
isa = PBXNativeTarget;
buildConfigurationList = C7C6B58F268C8C9C00546A57 /* Build configuration list for PBXNativeTarget "DatabaseExample (iOS)" */;
Expand Down Expand Up @@ -235,6 +307,9 @@
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1250;
TargetAttributes = {
C796F2A226D228180076C5F5 = {
CreatedOnToolsVersion = 12.5;
};
C7C6B57A268C8C9C00546A57 = {
CreatedOnToolsVersion = 12.5;
};
Expand All @@ -261,11 +336,22 @@
targets = (
C7C6B57A268C8C9C00546A57 /* DatabaseExample (iOS) */,
C7C6B582268C8C9C00546A57 /* DatabaseExample (macOS) */,
C796F2A226D228180076C5F5 /* DatabaseExample (tvOS) */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
C796F2A126D228180076C5F5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C796F2AD26D2281A0076C5F5 /* Preview Assets.xcassets in Resources */,
C796F2C626D390010076C5F5 /* Assets.xcassets in Resources */,
C796F2B226D228380076C5F5 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C7C6B579268C8C9C00546A57 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -287,6 +373,28 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
C796F29F26D228180076C5F5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C796F2B526D228410076C5F5 /* PostViewModel.swift in Sources */,
C796F2B726D228490076C5F5 /* ContentView.swift in Sources */,
C796F2BE26D228490076C5F5 /* PostsView.swift in Sources */,
C796F2BC26D228490076C5F5 /* PostListViewModel.swift in Sources */,
C796F2B626D228490076C5F5 /* PostsType.swift in Sources */,
C796F2C126D228490076C5F5 /* ScreenDimensions.swift in Sources */,
C796F2B826D228490076C5F5 /* PostDetailView.swift in Sources */,
C796F2B926D228490076C5F5 /* NewPostsView.swift in Sources */,
C796F2BF26D228490076C5F5 /* Database+Extensions.swift in Sources */,
C796F2B326D2283B0076C5F5 /* Comment.swift in Sources */,
C796F2C026D228490076C5F5 /* DatabaseExampleApp.swift in Sources */,
C796F2B426D2283E0076C5F5 /* UserViewModel.swift in Sources */,
C796F2BD26D228490076C5F5 /* LoginView.swift in Sources */,
C796F2BB26D228490076C5F5 /* SignUpView.swift in Sources */,
C796F2BA26D228490076C5F5 /* PostCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C7C6B577268C8C9C00546A57 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -334,6 +442,51 @@
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
C796F2AF26D2281A0076C5F5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"tvOS/Preview Content\"";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = tvOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.quickstart.DatabaseExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 14.5;
};
name = Debug;
};
C796F2B026D2281A0076C5F5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"tvOS/Preview Content\"";
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = tvOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.quickstart.DatabaseExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 14.5;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
C7C6B58D268C8C9C00546A57 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -535,6 +688,15 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
C796F2B126D2281A0076C5F5 /* Build configuration list for PBXNativeTarget "DatabaseExample (tvOS)" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C796F2AF26D2281A0076C5F5 /* Debug */,
C796F2B026D2281A0076C5F5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C7C6B572268C8C9A00546A57 /* Build configuration list for PBXProject "DatabaseExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down Expand Up @@ -586,6 +748,16 @@
package = C7C6B595268C8D7800546A57 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseDatabase;
};
C796F2C226D228F30076C5F5 /* FirebaseAuth */ = {
isa = XCSwiftPackageProductDependency;
package = C7C6B595268C8D7800546A57 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseAuth;
};
C796F2C426D228F30076C5F5 /* FirebaseDatabase */ = {
isa = XCSwiftPackageProductDependency;
package = C7C6B595268C8D7800546A57 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseDatabase;
};
C7C6B596268C8D7800546A57 /* FirebaseDatabaseSwift-Beta */ = {
isa = XCSwiftPackageProductDependency;
package = C7C6B595268C8D7800546A57 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import SwiftUI

class ScreenDimensions {
#if os(iOS)
#if os(iOS) || os(tvOS)
static var width: CGFloat = UIScreen.main.bounds.size.width
static var height: CGFloat = UIScreen.main.bounds.size.height
#elseif os(macOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct ContentView: View {
@AppStorage("isSignedIn") var isSignedIn = true

// define variables for creating a new post for macOS
#if os(macOS)
#if os(macOS) || os(tvOS)
@StateObject var postList = PostListViewModel()
@State private var newPostsViewPresented = false
#endif
Expand All @@ -43,7 +43,8 @@ struct ContentView: View {
}
}
.accentColor(Color(.systemTeal))
#if os(iOS)

#if os(iOS) || os(tvOS)
tabView
#elseif os(macOS)
tabView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct LoginView: View {
emailTextField
.keyboardType(.emailAddress)
.autocapitalization(UITextAutocapitalizationType.none)
#elseif os(macOS)
#elseif os(macOS) || os(tvOS)
emailTextField
#endif
}
Expand All @@ -53,7 +53,7 @@ struct LoginView: View {
emailInputField
.background(RoundedRectangle(cornerRadius: 10).fill(Color(.systemGray5)))
.frame(width: ScreenDimensions.width * 0.8)
#elseif os(macOS)
#elseif os(macOS) || os(tvOS)
emailInputField
#endif

Expand All @@ -72,7 +72,7 @@ struct LoginView: View {
passwordInputField
.background(RoundedRectangle(cornerRadius: 10).fill(Color(.systemGray5)))
.frame(width: ScreenDimensions.width * 0.8)
#elseif os(macOS)
#elseif os(macOS) || os(tvOS)
passwordInputField
#endif

Expand All @@ -81,33 +81,44 @@ struct LoginView: View {
.fixedSize()

// Login button
Button(action: user.login) {
let loginButton = Button(action: user.login) {
Text("Login".uppercased())
.foregroundColor(.white)
.font(.title2)
.bold()
}
.buttonStyle(BorderlessButtonStyle())
.padding(0.025 * ScreenDimensions.height)
.background(Capsule().fill(Color(.systemTeal)))

#if os(iOS) || os(macOS)
loginButton
.buttonStyle(BorderlessButtonStyle())
#elseif os(tvOS)
loginButton
#endif

Spacer()
.frame(idealHeight: 0.05 * ScreenDimensions.height)
.fixedSize()

// Navigation text
HStack {
Text("Don't have an account?")
Button(action: {
let signUpButton = Button(action: {
signUpViewPresented = true
}) {
Text("Sign up".uppercased())
.bold()
}
.buttonStyle(BorderlessButtonStyle())
.sheet(isPresented: $signUpViewPresented) {
SignUpView(user: user, isPresented: $signUpViewPresented)
}
#if os(iOS) || os(macOS)
signUpButton
.buttonStyle(BorderlessButtonStyle())
#elseif os(tvOS)
signUpButton
#endif
}
}
.alert(isPresented: $user.alert, content: {
Expand Down
Loading