mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-26 21:45:52 +00:00
26558dfaca
* core: configurable smp servers (#366) * core: update simplexmq hash * core: update simplexmq hash (fix SMPServer json encoding) * core: fix crashing on supplying duplicate SMP servers * core: update simplexmq hash (remove SMPServer FromJSON) * core: update simplexmq hash (merged master) * core: profile images (#384) * adding initial RFC * adding migration SQL * update RFC * linting * Apply suggestions from code review Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> * refine RFC * add avatars db migration to Store.hs * initial chages to have images in users/groups * fix protocol tests * update SQL & MobileTests * minor bug fixes * add missing comma * fix query error * refactor and update functions * bug fixes + testing * update to parse base64 web format images * fix parsing and use valid padded base64 encoded image * fix typos * respose to and suggestions from review * fix: typo * refactor: avatars -> profile_images * fix: typo * swap updateProfile parameters * remove TODO Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> * initial changes to show profile images * simple set up complete * add initial shape of image getting (needs work) * redesign * ios, android: configurable smp servers (only model and api for android) (#392) * example image picker placed in edit profile screen * tidy up and allow encoding * more tidying * update bottom modal bar * v0.1 UI for upload ready * add api calls * refactor edit profile screen * complete the refactor with connection back to api * linting * update encoding for hs compat * no line wrapping and resize image * refactor and tidy up for cleanest compatability with haskell * ios: UI for editing images * crop image to square * update profile edit layout * fixing image preview orientation etc * allow expandable image in profile view * handle case where user exits camera rather than take image * housekeeping on when to call apiUpdateProfileImage * improve scaling of large image * linting * spacing * fix padding * revert whitespace change * tidy up, one remaining issue * refactor to get parsing working * add missed change * use custom modal in user profile * fix image size after scaling * scale image iteratively * add filter * update profile editing view * ios: edit profile image (TODO aspect ratio) * ios: UI to manage profile images * ios: use new profile api * android: use new api to update profile * android: scroll profile view up when editing * revert change * reduce profile image resolution to 104px to fit in 12.5kb Co-authored-by: IanRDavies <ian_davies_@hotmail.co.uk> Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
149 lines
5.7 KiB
Swift
149 lines
5.7 KiB
Swift
//
|
|
// SettingsView.swift
|
|
// SimpleX
|
|
//
|
|
// Created by Evgeny Poberezkin on 31/01/2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
let simplexTeamURL = URL(string: "simplex:/contact#/?v=1&smp=smp%3A%2F%2FPQUV2eL0t7OStZOoAsPEV2QYWt4-xilbakvGUGOItUo%3D%40smp6.simplex.im%2FK1rslx-m5bpXVIdMZg9NLUZ_8JBm8xTt%23MCowBQYDK2VuAyEALDeVe-sG8mRY22LsXlPgiwTNs9dbiLrNuA7f3ZMAJ2w%3D")!
|
|
|
|
let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
|
|
|
|
let appBuild = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String
|
|
|
|
struct SettingsView: View {
|
|
@Environment(\.colorScheme) var colorScheme
|
|
@EnvironmentObject var chatModel: ChatModel
|
|
@Binding var showSettings: Bool
|
|
|
|
var body: some View {
|
|
let user: User = chatModel.currentUser!
|
|
|
|
return NavigationView {
|
|
List {
|
|
Section("You") {
|
|
NavigationLink {
|
|
UserProfile()
|
|
.navigationTitle("Your chat profile")
|
|
} label: {
|
|
HStack {
|
|
ProfileImage(imageStr: user.image)
|
|
.frame(width: 44, height: 44)
|
|
.padding(.trailing, 6)
|
|
.padding(.vertical, 6)
|
|
VStack(alignment: .leading) {
|
|
Text(user.displayName)
|
|
.fontWeight(.bold)
|
|
.font(.title2)
|
|
Text(user.fullName)
|
|
}
|
|
}
|
|
.padding(.leading, -8)
|
|
}
|
|
NavigationLink {
|
|
UserAddress()
|
|
.navigationTitle("Your chat address")
|
|
} label: {
|
|
HStack {
|
|
Image(systemName: "qrcode")
|
|
.padding(.trailing, 8)
|
|
Text("Your SimpleX contact address")
|
|
}
|
|
}
|
|
}
|
|
|
|
Section("Settings") {
|
|
NavigationLink {
|
|
SMPServers()
|
|
.navigationTitle("Your SMP servers")
|
|
} label: {
|
|
HStack {
|
|
Image(systemName: "server.rack")
|
|
.padding(.trailing, 4)
|
|
Text("SMP servers")
|
|
}
|
|
}
|
|
}
|
|
|
|
Section("Help") {
|
|
NavigationLink {
|
|
ChatHelp(showSettings: $showSettings)
|
|
.navigationTitle("Welcome \(user.displayName)!")
|
|
.frame(maxHeight: .infinity, alignment: .top)
|
|
} label: {
|
|
HStack {
|
|
Image(systemName: "questionmark.circle")
|
|
.padding(.trailing, 8)
|
|
Text("How to use SimpleX Chat")
|
|
}
|
|
}
|
|
NavigationLink {
|
|
MarkdownHelp()
|
|
.navigationTitle("How to use markdown")
|
|
.frame(maxHeight: .infinity, alignment: .top)
|
|
} label: {
|
|
HStack {
|
|
Image(systemName: "textformat")
|
|
.padding(.trailing, 4)
|
|
Text("Markdown in messages")
|
|
}
|
|
}
|
|
HStack {
|
|
Image(systemName: "number")
|
|
.padding(.trailing, 8)
|
|
Button {
|
|
showSettings = false
|
|
DispatchQueue.main.async {
|
|
UIApplication.shared.open(simplexTeamURL)
|
|
}
|
|
} label: {
|
|
Text("Chat with the founder")
|
|
}
|
|
}
|
|
HStack {
|
|
Image(systemName: "envelope")
|
|
.padding(.trailing, 4)
|
|
Text("[Send us email](mailto:chat@simplex.chat)")
|
|
}
|
|
}
|
|
|
|
Section("Develop") {
|
|
NavigationLink {
|
|
TerminalView()
|
|
} label: {
|
|
HStack {
|
|
Image(systemName: "terminal")
|
|
.frame(maxWidth: 24)
|
|
.padding(.trailing, 8)
|
|
Text("Chat console")
|
|
}
|
|
}
|
|
HStack {
|
|
Image(colorScheme == .dark ? "github_light" : "github")
|
|
.resizable()
|
|
.frame(width: 24, height: 24)
|
|
.padding(.trailing, 8)
|
|
Text("Install [SimpleX Chat for terminal](https://github.com/simplex-chat/simplex-chat)")
|
|
}
|
|
Text("v\(appVersion ?? "?") (\(appBuild ?? "?"))")
|
|
}
|
|
}
|
|
.navigationTitle("Your settings")
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SettingsView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
let chatModel = ChatModel()
|
|
chatModel.currentUser = User.sampleData
|
|
@State var showSettings = false
|
|
|
|
return SettingsView(showSettings: $showSettings)
|
|
.environmentObject(chatModel)
|
|
}
|
|
}
|