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 {
|
2024-07-09 12:37:51 +00:00
|
|
|
// // Network
|
|
|
|
// #if DEBUG
|
|
|
|
// static let baseUrl = "staging.some.com/api"
|
|
|
|
// #else
|
|
|
|
// static let baseUrl = "prod.some.com/api"
|
|
|
|
// #endif
|
|
|
|
// static let requestTimeout = 15.0
|
|
|
|
// static let networkLogging = true
|
2024-06-19 15:15:27 +00:00
|
|
|
|
|
|
|
// 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"
|
|
|
|
}
|
|
|
|
|
2024-08-17 22:05:18 +00:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2024-06-19 15:15:27 +00:00
|
|
|
// 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
|
|
|
|
|
|
|
// Lenght in days for MAM request
|
2024-08-09 14:33:22 +00:00
|
|
|
static let mamRequestDaysLength = 30
|
|
|
|
|
|
|
|
// Limits for messages pagination
|
2024-08-14 13:48:30 +00:00
|
|
|
static let messagesPageSize = 20 // size for block requesting
|
|
|
|
static let messagesMaxSize = 100 // total messages in memory
|
2024-06-19 15:15:27 +00:00
|
|
|
}
|