Minimal Settings screen UI (#85)

* #37 Remove sign out button from home screen

* #37 Move crash button visibility flag to BuildSettings, import BuildSettings from test targets

* #37 Add log out button into the settings screen

* #37 Add version into the settings screen

* #37 enhance bug report parameters

* #37 Remove sign out button from home screen

* #37 Move crash button visibility flag to BuildSettings, import BuildSettings from test targets

* #37 Add log out button into the settings screen

* #37 Add version into the settings screen

* #37 enhance bug report parameters

* #37 Add changelog

* #37 Fix code smells and PR remarks
This commit is contained in:
ismailgulek
2022-06-20 15:27:02 +03:00
committed by GitHub
parent 40e51fb157
commit 591f835811
17 changed files with 104 additions and 64 deletions
@@ -141,23 +141,34 @@ class BugReportService: BugReportServiceProtocol {
// MARK: - Private
private var defaultParams: [MultipartFormData] {
[
let (localTime, utcTime) = localAndUTCTime(for: Date())
return [
MultipartFormData(key: "user_agent", type: .text(value: "iOS")),
MultipartFormData(key: "app", type: .text(value: applicationId)),
MultipartFormData(key: "version", type: .text(value: version)),
MultipartFormData(key: "version", type: .text(value: ElementInfoPlist.cfBundleShortVersionString)),
MultipartFormData(key: "build", type: .text(value: ElementInfoPlist.cfBundleVersion)),
MultipartFormData(key: "os", type: .text(value: os)),
MultipartFormData(key: "client", type: .text(value: "Element-X"))
MultipartFormData(key: "resolved_language", type: .text(value: Bundle.preferredLanguages[0])),
MultipartFormData(key: "user_language", type: .text(value: Bundle.elementLanguage ?? "null")),
MultipartFormData(key: "fallback_language", type: .text(value: Bundle.elementFallbackLanguage ?? "null")),
MultipartFormData(key: "local_time", type: .text(value: localTime)),
MultipartFormData(key: "utc_time", type: .text(value: utcTime))
]
}
private func localAndUTCTime(for date: Date) -> (String, String) {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let localTime = dateFormatter.string(from: date)
dateFormatter.timeZone = TimeZone(identifier: "UTC")
let utcTime = dateFormatter.string(from: date)
return (localTime, utcTime)
}
private var os: String {
"\(UIDevice.current.systemName) \(UIDevice.current.systemVersion)"
}
private var version: String {
ElementInfoPlist.cfBundleShortVersionString
}
private func zipFiles(includeLogs: Bool,
includeCrashLog: Bool) async throws -> [URL] {
MXLog.debug("[BugReportService] zipFiles: includeLogs: \(includeLogs), includeCrashLog: \(includeCrashLog)")