mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-14 23:25:33 +00:00
3d85480944
* ui: onboarding assets * android: fix gradle version check, pass assets dir to builds * desktop: pass assets dir to gradle builds * ui: new onboarding (#6872) * ios: improve onboarding * ios version condition * android strings * merge keys * refactor network conditions to old location * ios scroll headline * remove nav view * kotlin: refactor network commitments page to use existing view * remove unused keys * update why page * configure -> setup * padding for app bar in why page * fix why page * padding * copy translations from the website * export localizations * export again * kotlin: fix why page * fix * import localizations * custom layout * padding for system bars * paddings * more paddings * more padding 2 * update fonts * fonts * line height, padding * paddings * refactor notifications * refactor ios * notification icons in cards * restore profile field * padding * desktop layout create profile * fix * more layout * create profile layout * mobile padding * split mobile and desktop * layout * layout * background * refactor onboarding images * use DARK theme by default * page 3 and 4 layouts * restructure desktop onboarding to two panes * improve layout * improve * fonts, padding * link mobile on full page * fix, reduce noise * change to animation * fix animation * refactor * colors, animation * import * details * fix padding * fix icon * fix * button paddings * accept button on terms page * fix conditions button * close modal --------- Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Co-authored-by: shum <github.shum@liber.li> Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
149 lines
5.2 KiB
Swift
149 lines
5.2 KiB
Swift
//
|
|
// SimpleXInfo.swift
|
|
// SimpleX (iOS)
|
|
//
|
|
// Created by Evgeny on 07/05/2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
// Spec: spec/client/navigation.md
|
|
|
|
import SwiftUI
|
|
import SimpleXChat
|
|
|
|
struct SimpleXInfo: View {
|
|
@EnvironmentObject var m: ChatModel
|
|
@EnvironmentObject var theme: AppTheme
|
|
@Environment(\.colorScheme) var colorScheme: ColorScheme
|
|
@State private var showWhyBuilt = false
|
|
@State private var createProfileNavLinkActive = false
|
|
var onboarding: Bool
|
|
|
|
var body: some View {
|
|
GeometryReader { g in
|
|
VStack(alignment: .center, spacing: 10) {
|
|
Image(colorScheme == .light ? "logo" : "logo-light")
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(width: (g.size.width - 50) * 0.55)
|
|
.padding(.leading, 4)
|
|
.frame(maxWidth: .infinity, minHeight: 48, alignment: .top)
|
|
|
|
#if SIMPLEX_ASSETS
|
|
Image(colorScheme == .light ? "intro" : "intro-light")
|
|
.resizable()
|
|
.scaledToFit()
|
|
.frame(maxWidth: .infinity)
|
|
#else
|
|
ZStack {
|
|
let gp = OnboardingCardView.gradientPoints(aspectRatio: 1.0, scale: colorScheme == .light ? 1.2 : 1.5)
|
|
LinearGradient(
|
|
stops: colorScheme == .light ? OnboardingCardView.lightStops : OnboardingCardView.darkStops,
|
|
startPoint: gp.start,
|
|
endPoint: gp.end
|
|
)
|
|
Image(systemName: "bubble.left.and.bubble.right")
|
|
.font(.system(size: 72))
|
|
.foregroundColor(theme.colors.primary)
|
|
}
|
|
.aspectRatio(1.0, contentMode: .fit)
|
|
.clipShape(RoundedRectangle(cornerRadius: 24))
|
|
.padding(.horizontal, 25)
|
|
.frame(maxWidth: .infinity)
|
|
#endif
|
|
|
|
Text("Be free\nin your network")
|
|
.font(.largeTitle)
|
|
.bold()
|
|
.multilineTextAlignment(.center)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
Text("Private and secure messaging.")
|
|
.font(.title3)
|
|
.fontWeight(.medium)
|
|
.foregroundColor(theme.colors.secondary)
|
|
.multilineTextAlignment(.center)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
Text("The first network where you own\nyour contacts and groups.")
|
|
.font(.footnote)
|
|
.foregroundColor(theme.colors.secondary)
|
|
.multilineTextAlignment(.center)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
if onboarding {
|
|
Spacer(minLength: 0)
|
|
|
|
createFirstProfileButton()
|
|
.padding(.vertical, 10)
|
|
|
|
Button {
|
|
showWhyBuilt = true
|
|
} label: {
|
|
Label("Why SimpleX is built.", systemImage: "info.circle")
|
|
.font(.headline)
|
|
}
|
|
}
|
|
}
|
|
.padding(.horizontal, 25)
|
|
.padding(.top, 28)
|
|
.padding(.bottom, 20)
|
|
.frame(minHeight: g.size.height)
|
|
.sheet(isPresented: Binding(
|
|
get: { m.migrationState != nil && !createProfileNavLinkActive },
|
|
set: { _ in
|
|
m.migrationState = nil
|
|
MigrationToDeviceState.save(nil) }
|
|
)) {
|
|
NavigationView {
|
|
VStack(alignment: .leading) {
|
|
MigrateToDevice(migrationState: $m.migrationState)
|
|
}
|
|
.navigationTitle("Migrate here")
|
|
.modifier(ThemedBackground(grouped: true))
|
|
}
|
|
}
|
|
.sheet(isPresented: $showWhyBuilt) {
|
|
WhySimpleX(
|
|
onboarding: onboarding,
|
|
createProfileNavLinkActive: $createProfileNavLinkActive
|
|
)
|
|
}
|
|
}
|
|
.onAppear() {
|
|
setLastVersionDefault()
|
|
}
|
|
.frame(maxHeight: .infinity)
|
|
.navigationBarHidden(true) // necessary on iOS 15
|
|
}
|
|
|
|
private func createFirstProfileButton() -> some View {
|
|
ZStack {
|
|
Button {
|
|
createProfileNavLinkActive = true
|
|
} label: {
|
|
Text("Get started")
|
|
}
|
|
.buttonStyle(OnboardingButtonStyle(isDisabled: false))
|
|
|
|
NavigationLink(isActive: $createProfileNavLinkActive) {
|
|
CreateFirstProfile()
|
|
.modifier(ThemedBackground())
|
|
} label: {
|
|
EmptyView()
|
|
}
|
|
.frame(width: 1, height: 1)
|
|
.hidden()
|
|
}
|
|
}
|
|
}
|
|
|
|
let textSpace = Text(verbatim: " ")
|
|
|
|
let textNewLine = Text(verbatim: "\n")
|
|
|
|
struct SimpleXInfo_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
SimpleXInfo(onboarding: true)
|
|
}
|
|
}
|