another.im-ios/ConversationsClassic/Helpers/Const.swift

52 lines
1.7 KiB
Swift
Raw Normal View History

2024-06-19 15:15:27 +00:00
import Foundation
2024-07-10 17:49:36 +00:00
import UIKit
2024-06-19 15:15:27 +00:00
enum Const {
// App
static var appVersion: String {
let info = Bundle.main.infoDictionary
let appVersion = info?["CFBundleShortVersionString"] as? String ?? "Unknown"
let appBuild = info?[kCFBundleVersionKey as String] as? String ?? "Unknown"
return "v \(appVersion)(\(appBuild))"
}
static var appName: String {
Bundle.main.bundleIdentifier ?? "Conversations Classic iOS"
}
// Trusted servers
enum TrustedServers: String {
case narayana = "narayana.im"
case conversations = "conversations.im"
}
2024-07-09 12:37:51 +00:00
2024-07-10 17:49:36 +00:00
// Limit for video for sharing
static let videoDurationLimit = 60.0
// Grid size for gallery preview (3 in a row)
static let galleryGridSize = UIScreen.main.bounds.width / 3
2024-07-11 13:59:24 +00:00
// Size for map preview for location messages
2024-07-11 15:46:57 +00:00
static let mapPreviewSize = UIScreen.main.bounds.width * 0.5
// Size for attachment preview
static let attachmentPreviewSize = UIScreen.main.bounds.width * 0.5
2024-07-23 14:55:38 +00:00
2024-08-19 01:25:27 +00:00
// MAM request page size
2024-08-19 05:56:04 +00:00
static let mamRequestPageSize = 50
2024-06-19 15:15:27 +00:00
}
2024-08-19 07:34:46 +00:00
final class FolderWrapper {
static let shared = FolderWrapper()
let fileFolder: URL
private init() {
// swiftlint:disable:next force_unwrapping
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let subdirectoryURL = documentsURL.appendingPathComponent("Downloads")
if !FileManager.default.fileExists(atPath: subdirectoryURL.path) {
try? FileManager.default.createDirectory(at: subdirectoryURL, withIntermediateDirectories: true, attributes: nil)
}
fileFolder = subdirectoryURL
}
}