|
@@ -146,83 +146,81 @@ public class Nexilis: NSObject {
|
|
|
Nexilis.dispatch = nil
|
|
|
|
|
|
// Nexilis.initiateAudio()
|
|
|
- DispatchQueue.main.async {
|
|
|
- if(!id.isEmpty && (UserDefaults.standard.string(forKey: "me") == nil)){
|
|
|
- if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getSignUpApi(api: apiKey, p_pin: id), timeout: 30 * 1000){
|
|
|
- id = response.getBody(key: CoreMessage_TMessageKey.F_PIN, default_value: "")
|
|
|
- let enable_signup = (response.getBody(key: CoreMessage_TMessageKey.IS_ENABLED_ANONYMOUS, default_value: "0")) == "1"
|
|
|
- Utils.setForceAnonymous(value: enable_signup)
|
|
|
- if(!id.isEmpty) {
|
|
|
- Nexilis.changeUser(f_pin: id)
|
|
|
- UserDefaults.standard.setValue(id, forKey: "me")
|
|
|
- }
|
|
|
+ if(!id.isEmpty && (UserDefaults.standard.string(forKey: "me") == nil)){
|
|
|
+ if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getSignUpApi(api: apiKey, p_pin: id), timeout: 30 * 1000){
|
|
|
+ id = response.getBody(key: CoreMessage_TMessageKey.F_PIN, default_value: "")
|
|
|
+ let enable_signup = (response.getBody(key: CoreMessage_TMessageKey.IS_ENABLED_ANONYMOUS, default_value: "0")) == "1"
|
|
|
+ Utils.setForceAnonymous(value: enable_signup)
|
|
|
+ if(!id.isEmpty) {
|
|
|
+ Nexilis.changeUser(f_pin: id)
|
|
|
+ UserDefaults.standard.setValue(id, forKey: "me")
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if UserDefaults.standard.string(forKey: "apiKey") == nil {
|
|
|
- UserDefaults.standard.setValue(apiKey, forKey: "apiKey")
|
|
|
- }
|
|
|
-
|
|
|
- if let me = UserDefaults.standard.string(forKey: "me") {
|
|
|
- if Utils.getForceAnonymous() || (!Utils.getForceAnonymous() && Utils.getSetProfile()) {
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
- if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT * FROM BUDDY where f_pin = '\(me)' ") {
|
|
|
- if !cursorData.next() {
|
|
|
- _ = Nexilis.write(message: CoreMessage_TMessageBank.getPostRegistration(p_pin: me))
|
|
|
- }
|
|
|
- cursorData.close()
|
|
|
- }
|
|
|
- })
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
- if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT image_id FROM GROUPZ where group_type = 1 AND official = 1"), cursorData.next() {
|
|
|
- do {
|
|
|
- let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
- let file = documentDir.appendingPathComponent(cursorData.string(forColumnIndex: 0)!)
|
|
|
- if !FileManager().fileExists(atPath: file.path) {
|
|
|
- Download().startHTTP(forKey: cursorData.string(forColumnIndex: 0)!) { (name, progress) in}
|
|
|
- }
|
|
|
- } catch {}
|
|
|
- cursorData.close()
|
|
|
+ if UserDefaults.standard.string(forKey: "apiKey") == nil {
|
|
|
+ UserDefaults.standard.setValue(apiKey, forKey: "apiKey")
|
|
|
+ }
|
|
|
+
|
|
|
+ if let me = UserDefaults.standard.string(forKey: "me") {
|
|
|
+ if Utils.getForceAnonymous() || (!Utils.getForceAnonymous() && Utils.getSetProfile()) {
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
+ if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT * FROM BUDDY where f_pin = '\(me)' ") {
|
|
|
+ if !cursorData.next() {
|
|
|
+ _ = Nexilis.write(message: CoreMessage_TMessageBank.getPostRegistration(p_pin: me))
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- getServiceBank()
|
|
|
- getPullWorkingArea()
|
|
|
- getPullGroupNoMember()
|
|
|
- delegate.onSuccess(userId: me)
|
|
|
- getPullDefaultCC()
|
|
|
- if showButton {
|
|
|
- DispatchQueue.main.async {
|
|
|
- var viewController = UIApplication.shared.windows.first?.rootViewController
|
|
|
- var notNull = false
|
|
|
- while !notNull {
|
|
|
- viewController = UIApplication.shared.windows.first?.rootViewController
|
|
|
- if viewController != nil {
|
|
|
- notNull = true
|
|
|
+ cursorData.close()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
+ if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT image_id FROM GROUPZ where group_type = 1 AND official = 1"), cursorData.next() {
|
|
|
+ do {
|
|
|
+ let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
+ let file = documentDir.appendingPathComponent(cursorData.string(forColumnIndex: 0)!)
|
|
|
+ if !FileManager().fileExists(atPath: file.path) {
|
|
|
+ Download().startHTTP(forKey: cursorData.string(forColumnIndex: 0)!) { (name, progress) in}
|
|
|
}
|
|
|
+ } catch {}
|
|
|
+ cursorData.close()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ getServiceBank()
|
|
|
+ getPullWorkingArea()
|
|
|
+ getPullGroupNoMember()
|
|
|
+ delegate.onSuccess(userId: me)
|
|
|
+ getPullDefaultCC()
|
|
|
+ if showButton {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ var viewController = UIApplication.shared.windows.first?.rootViewController
|
|
|
+ var notNull = false
|
|
|
+ while !notNull {
|
|
|
+ viewController = UIApplication.shared.windows.first?.rootViewController
|
|
|
+ if viewController != nil {
|
|
|
+ notNull = true
|
|
|
}
|
|
|
- let fb = FloatingButton()
|
|
|
- if fromMAB {
|
|
|
- var vc = viewController
|
|
|
- if viewController is UINavigationController {
|
|
|
- vc = (viewController as! UINavigationController).rootViewController
|
|
|
- }
|
|
|
- vc?.view.addSubview(fb)
|
|
|
- fb.mySettingDelegate = vc as? any SettingMABDelegate
|
|
|
- } else {
|
|
|
- viewController?.view.addSubview(fb)
|
|
|
+ }
|
|
|
+ let fb = FloatingButton()
|
|
|
+ if fromMAB {
|
|
|
+ var vc = viewController
|
|
|
+ if viewController is UINavigationController {
|
|
|
+ vc = (viewController as! UINavigationController).rootViewController
|
|
|
}
|
|
|
+ vc?.view.addSubview(fb)
|
|
|
+ fb.mySettingDelegate = vc as? any SettingMABDelegate
|
|
|
+ } else {
|
|
|
+ viewController?.view.addSubview(fb)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- Nexilis.destroyAll()
|
|
|
- OutgoingThread.default.run()
|
|
|
-
|
|
|
- InquiryThread.default.run()
|
|
|
-
|
|
|
- if UIFont.systemFont(ofSize: 12).familyName == ".AppleSystemUIFont" {
|
|
|
- UIFont.libOverrideInitialize()
|
|
|
- }
|
|
|
+ }
|
|
|
+ Nexilis.destroyAll()
|
|
|
+ OutgoingThread.default.run()
|
|
|
+
|
|
|
+ InquiryThread.default.run()
|
|
|
+
|
|
|
+ if UIFont.systemFont(ofSize: 12).familyName == ".AppleSystemUIFont" {
|
|
|
+ UIFont.libOverrideInitialize()
|
|
|
}
|
|
|
//print("MANIA \(UIFont.systemFont(ofSize: 12)) <> \(UIFont.italicSystemFont(ofSize: 12)) <> \(UIFont.boldSystemFont(ofSize: 12))")
|
|
|
}
|