49 lines
1.6 KiB
Swift
49 lines
1.6 KiB
Swift
import Foundation
|
|
import UIKit
|
|
|
|
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"
|
|
}
|
|
|
|
// Folder for storing files
|
|
static var fileFolder: URL {
|
|
// 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)
|
|
}
|
|
return subdirectoryURL
|
|
}
|
|
|
|
// Trusted servers
|
|
enum TrustedServers: String {
|
|
case narayana = "narayana.im"
|
|
case conversations = "conversations.im"
|
|
}
|
|
|
|
// 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
|
|
|
|
// Size for map preview for location messages
|
|
static let mapPreviewSize = UIScreen.main.bounds.width * 0.5
|
|
|
|
// Size for attachment preview
|
|
static let attachmentPreviewSize = UIScreen.main.bounds.width * 0.5
|
|
|
|
// Lenght in days for MAM request
|
|
static let mamRequestDaysLength = 30
|
|
}
|