Refactoring/ios (#300)

iOS app refactoring (native part):
- connection bugs fixed
- improved stability 
- logs from network extension
This commit is contained in:
pokamest 2023-08-27 10:46:41 -07:00 committed by GitHub
parent 3ce1e40b43
commit ece15c7394
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 935 additions and 3191 deletions

View file

@ -17,7 +17,12 @@ public class Logger {
deinit {}
func log(message: String) {
write_msg_to_log(tag, message.trimmingCharacters(in: .newlines))
let suiteName = [NSString stringWithUTF8String:GROUP_ID]
let logKey = "logMessages"
let sharedDefaults = UserDefaults(suiteName: suiteName)
var logs = sharedDefaults?.array(forKey: logKey) as? [String] ?? []
logs.append(message)
sharedDefaults?.set(logs, forKey: logKey)
}
func writeLog(to targetFile: String) -> Bool {
@ -37,8 +42,7 @@ public class Logger {
appVersion += " (\(appBuild))"
}
let goBackendVersion = "1"
Logger.global?.log(message: "App version: \(appVersion); Go backend version: \(goBackendVersion)")
Logger.global?.log(message: "App version: \(appVersion)")
}
}
@ -50,5 +54,4 @@ func wg_log(_ type: OSLogType, staticMessage msg: StaticString) {
func wg_log(_ type: OSLogType, message msg: String) {
os_log("%{AMNEZIA}s", log: OSLog.default, type: type, msg)
Logger.global?.log(message: msg)
NSLog("AMNEZIA: \(msg)")
}