Skip to content

Commit

Permalink
Merge pull request #452 from PermanentOrg/feature/VSP-1442-iOS-Login-…
Browse files Browse the repository at this point in the history
…Screen

VSP-1442 [IOS][Mobile]Login Screen
  • Loading branch information
luciancerbu-vsp authored Sep 16, 2024
2 parents 80f7b8a + c9cd534 commit ef54165
Show file tree
Hide file tree
Showing 36 changed files with 973 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deployStaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy Firebase Beta
on:
workflow_dispatch:
push:
branches: [ "main", "feature/Onboarding-Redesign" ]
branches: [ "main", "feature/Onboarding-Redesign", "feature/Authentication-Redesign" ]

jobs:
build:
Expand Down
164 changes: 132 additions & 32 deletions Permanent.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions Permanent/App/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>3B52.1</string>
<string>DDA9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
<string>AC6B.1</string>
</array>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AuthViewModel: ViewModelInterface {

AuthenticationManager.shared.login(withUsername: email, password: password) { status in
switch status {
case .success, .mfaToken:
case .success, .mfaToken, .unknown:
handler(status)

case .error(message: _):
Expand Down Expand Up @@ -190,6 +190,7 @@ class AuthViewModel: ViewModelInterface {
enum LoginStatus: Equatable {
case success
case mfaToken
case unknown
case error(message: String?)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ struct RoundButtonRightImageView: View {
let text: String
var rightImage: Image = Image(.rightArrowShort)
let action: () -> Void
var ignoreDeviceType: Bool = false
var isPhone: Bool = true

var body: some View {
Button(action: action, label: {
Expand All @@ -26,7 +28,7 @@ struct RoundButtonRightImageView: View {
Color(.white)
HStack(spacing: 16) {
Spacer()
if Constants.Design.isPhone {
if Constants.Design.isPhone || (ignoreDeviceType && isPhone){
Text(text)
.textStyle(UsualSmallXMediumTextStyle())
.foregroundColor(.blue700)
Expand Down Expand Up @@ -58,7 +60,7 @@ struct RoundButtonRightImageView: View {
case .noColor:
ZStack {
HStack() {
if Constants.Design.isPhone {
if Constants.Design.isPhone || (ignoreDeviceType && isPhone){
Text(text)
.textStyle(UsualSmallXMediumTextStyle())
.foregroundColor(.white)
Expand Down Expand Up @@ -96,7 +98,7 @@ struct RoundButtonRightImageView: View {
ZStack {
HStack() {
Spacer()
if Constants.Design.isPhone {
if Constants.Design.isPhone || (ignoreDeviceType && isPhone){
Text(text)
.textStyle(UsualSmallXMediumTextStyle())
.foregroundColor(.white)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ struct SmallRoundButtonImageView: View {
var image: Image = Image(.rightArrowShort)
var hasSpacer: Bool = false
let action: () -> Void
var ignoreDeviceType: Bool = false
var isPhone: Bool = true

var body: some View {
Button(action: action, label: {
Expand All @@ -36,7 +38,7 @@ struct SmallRoundButtonImageView: View {
.frame(width: 24, height: 24, alignment: .center)
.accentColor(.blue700)
}
if Constants.Design.isPhone {
if Constants.Design.isPhone || (ignoreDeviceType && isPhone){
Text(text)
.textStyle(UsualSmallXMediumTextStyle())
.foregroundColor(.blue700)
Expand Down Expand Up @@ -77,7 +79,7 @@ struct SmallRoundButtonImageView: View {
Spacer()
}
}
if Constants.Design.isPhone {
if Constants.Design.isPhone || (ignoreDeviceType && isPhone){
Text(text)
.textStyle(UsualSmallXMediumTextStyle())
.foregroundColor(.white)
Expand Down
9 changes: 6 additions & 3 deletions Permanent/Common/Base/SwiftUIViews/SectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct SectionView: View {
var rightButtonView: RightButtonView?
var haveRightSection: Bool = true
var divider: Divider? = nil
var isLoading: Bool = false

var body: some View {
VStack {
Expand All @@ -21,14 +22,16 @@ struct SectionView: View {
Text(title)
.textStyle(SmallRegularTextStyle())
Spacer()
if haveRightSection {
if isLoading {
ProgressView()
} else if haveRightSection {
rightButtonView
}
}
divider
.padding(.top, 24)
.padding(.top, 20)
}
.padding(.top, 24)
.padding(.top, 20)
}
}

Expand Down
43 changes: 43 additions & 0 deletions Permanent/Common/Base/SwiftUIViews/SnackBarView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// SnackBarView.swift
// Permanent
//
// Created by Flaviu Silaghi on 15.04.2024.

import SwiftUI

struct SnackBarView: View {
@Binding var show: Bool
private var messsage: String

init(message: String, show: Binding<Bool>) {
self.messsage = message
_show = show
}

var body: some View {
VStack {
Spacer()
if show {
Text(messsage)
.textStyle(SmallRegularTextStyle())
.foregroundColor(Color.middleGray)
.frame(minWidth: 240, minHeight: 64)
.padding(.horizontal, 12)
.padding(.vertical, 4)
.background(Color.white)
.cornerRadius(32)
.shadow(color: .black.opacity(0.08), radius: 8, x: 0, y: 16)
.padding(.bottom, 32)

// Optionally add a button to dismiss
}
}
.animation(.spring(), value: show) // Animation for showing/hiding
.edgesIgnoringSafeArea(.bottom) // Overlay the whole window
}
}

#Preview {
SnackBarView(message: "Hello", show: .constant(true))
}
4 changes: 3 additions & 1 deletion Permanent/Common/Base/TextFields/CustomBorderTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ struct CustomBorderTextField: View {
var placeholder: String = "Enter your text here"
var preText: String = "The"
var afterText: String = "Archive"
var ignoreDeviceType: Bool = false
var isPhone: Bool = true

var body: some View {
if Constants.Design.isPhone {
if Constants.Design.isPhone || (ignoreDeviceType && isPhone) {
HStack(alignment: .center, spacing: 8) {
Text("\(preText)")
.textStyle(UsualRegularTextStyle())
Expand Down
2 changes: 2 additions & 0 deletions Permanent/Common/Managers/AuthenticationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class AuthenticationManager {
if loginError == .mfaToken {
mfaSession = MFASession(email: username, methodType: CodeVerificationType.mfa)
handler(.mfaToken)
} else if loginError == .unknown {
handler(.unknown)
} else {
handler(.error(message: loginError.description))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ class ArchivesViewController: BaseViewController<ArchivesViewModel> {

// MARK: - Actions
@IBAction func createNewArchiveAction(_ sender: Any) {
let archiveTypes = ArchiveType.allCases.map { $0.archiveName }
var archiveTypes = ArchiveType.allCases.map{$0.archiveName}

if let removeItemIdx = archiveTypes.firstIndex(of: ArchiveType.nonProfit.archiveName) {
archiveTypes.remove(at: removeItemIdx)
}

self.showActionDialog(
styled: .inputWithDropdown,
Expand Down
24 changes: 24 additions & 0 deletions Permanent/Modules/Authentication/Screens/AuthLeftSideView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// AuthLeftSideView.swift
// Permanent
//
// Created by Lucian Cerbu on 09.09.2024.

import SwiftUI

struct AuthLeftSideView: View {
var body: some View {
VStack {
HStack {
Text("Show image")
.foregroundStyle(.white)

}
}

}
}

#Preview {
AuthLeftSideView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// AuthenticatorContainerView.swift
// Permanent
//
// Created by Lucian Cerbu on 03.09.2024.

import SwiftUI

struct AuthenticatorContainerView: View {
@ObservedObject var viewModel: AuthenticatorContainerViewModel

@State private var isBack = false
@Environment(\.presentationMode) var presentationMode

var body: some View {
GeometryReader { geometry in
ZStack {
Gradient.darkLightBlueGradient
HStack(spacing: 0) {
if !Constants.Design.isPhone {
AuthLeftSideView()
.frame(width: geometry.size.width * 0.61)
}
LoginView(viewModel: LoginViewModel(containerViewModel: viewModel), loginSuccess: {
dismissView()
})
.frame(maxWidth: .infinity)
}
LoadingOverlay()
.opacity(viewModel.isLoading ? 1 : 0)
.animation(.easeInOut(duration: 0.5), value: viewModel.isLoading)
.allowsHitTesting(viewModel.isLoading)
}
}
.ignoresSafeArea(.all)
}

func dismissView() {
presentationMode.wrappedValue.dismiss()
}
}

#Preview {
AuthenticatorContainerView(viewModel: AuthenticatorContainerViewModel())
}
Loading

0 comments on commit ef54165

Please sign in to comment.