This commit is contained in:
Woit 2024-11-25 12:49:47 +01:00
parent 477e58f35c
commit a59d3bbeb7
3 changed files with 23 additions and 6 deletions

View file

@ -3736,6 +3736,7 @@
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios; PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -3826,6 +3827,7 @@
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios; PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -3918,6 +3920,7 @@
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios; PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -4010,6 +4013,7 @@
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios; PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -4102,6 +4106,7 @@
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios; PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -4194,6 +4199,7 @@
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios; PRODUCT_BUNDLE_IDENTIFIER = im.narayana.anotherim.ios;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View file

@ -1,3 +1,4 @@
import monalxmpp
import SwiftUI import SwiftUI
@main @main
@ -5,6 +6,10 @@ struct AnotherIMApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@StateObject var wrapper = MonalXmppWrapper() @StateObject var wrapper = MonalXmppWrapper()
init() {
DDLog.add(DDOSLogger.sharedInstance, with: .all)
}
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {
RootView() RootView()
@ -13,4 +18,9 @@ struct AnotherIMApp: App {
} }
} }
class AppDelegate: NSObject, UIApplicationDelegate {} class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationWillEnterForeground(_: UIApplication) {
// let manager = MLXMPPManager.sharedInstance()
// manager.nowForegrounded()
}
}

View file

@ -25,7 +25,8 @@ final class MonalXmppWrapper: ObservableObject {
NotificationCenter.default.post(name: Notification.Name(kMonalRefresh), object: nil) NotificationCenter.default.post(name: Notification.Name(kMonalRefresh), object: nil)
// reconnect // reconnect
xmpp.connectIfNecessary() // xmpp.nowForegrounded()
// xmpp.connectIfNecessary()
} }
deinit { deinit {
@ -85,12 +86,10 @@ private final class LoginTry {
// Обработать кейс когда бесячий monalxmpp возвращает nil при попытке добавить тот же JID // Обработать кейс когда бесячий monalxmpp возвращает nil при попытке добавить тот же JID
func tryLogin(_ login: String, _ password: String) async -> Bool { func tryLogin(_ login: String, _ password: String) async -> Bool {
async let notify = await withCheckedContinuation { [weak self] continuation in async let notify = await withCheckedContinuation { [weak self] continuation in
self?.successObserver = NotificationCenter.default.addObserver(forName: Notification.Name("kMLResourceBoundNotice"), object: nil, queue: .main) { notification in self?.successObserver = NotificationCenter.default.addObserver(forName: Notification.Name("kMLResourceBoundNotice"), object: nil, queue: .main) { _ in
print(notification.debugDescription)
continuation.resume(returning: true) continuation.resume(returning: true)
} }
self?.failureObserver = NotificationCenter.default.addObserver(forName: Notification.Name("kXMPPError"), object: nil, queue: .main) { notification in self?.failureObserver = NotificationCenter.default.addObserver(forName: Notification.Name("kXMPPError"), object: nil, queue: .main) { _ in
print(notification.debugDescription)
continuation.resume(returning: false) continuation.resume(returning: false)
} }
} }
@ -188,6 +187,8 @@ final class MonalChatWrapper: ObservableObject {
self.contact = contact self.contact = contact
self.db = db self.db = db
self.xmpp = xmpp self.xmpp = xmpp
subscribe()
} }
deinit { deinit {