diff --git a/Monal/Classes/AddContactMenu.swift b/Monal/Classes/AddContactMenu.swift index bb5399b..b4e30e3 100644 --- a/Monal/Classes/AddContactMenu.swift +++ b/Monal/Classes/AddContactMenu.swift @@ -168,7 +168,7 @@ struct AddContactMenu: View { Text("Please make sure at least one account has connected before trying to add a contact or channel.") .foregroundColor(.secondary) } else { - if !DataLayer.sharedInstance().allContactRequests().isEmpty { + if DataLayer.sharedInstance().allContactRequests().count > 0 { ContactRequestsMenu() } @@ -235,7 +235,7 @@ struct AddContactMenu: View { } } - if DataLayer.sharedInstance().allContactRequests().isEmpty { + if DataLayer.sharedInstance().allContactRequests().count == 0 { Section { ContactRequestsMenu() } diff --git a/Monal/Classes/HelperTools.m b/Monal/Classes/HelperTools.m index cb60da9..f552159 100644 --- a/Monal/Classes/HelperTools.m +++ b/Monal/Classes/HelperTools.m @@ -2582,7 +2582,9 @@ static void notification_center_logging(CFNotificationCenterRef center, void* ob #if IS_QUICKSY NSString* resource = [NSString stringWithFormat:@"Quicksy-iOS.%@", [self hexadecimalString:[NSData dataWithBytes: &i length: sizeof(i)]]]; #else - NSString* resource = [NSString stringWithFormat:@"Monal-iOS.%@", [self hexadecimalString:[NSData dataWithBytes: &i length: sizeof(i)]]]; + // fmodf: changed due aim + NSString* resource = [NSString stringWithFormat:@"another-im-iOS.%@", [self hexadecimalString:[NSData dataWithBytes: &i length: sizeof(i)]]]; + // NSString* resource = [NSString stringWithFormat:@"Monal-iOS.%@", [self hexadecimalString:[NSData dataWithBytes: &i length: sizeof(i)]]]; #endif #endif return resource; diff --git a/Monal/Classes/MLConstants.h b/Monal/Classes/MLConstants.h index 3277c0a..cf34565 100644 --- a/Monal/Classes/MLConstants.h +++ b/Monal/Classes/MLConstants.h @@ -40,8 +40,10 @@ static const DDLogLevel ddLogLevel = LOG_LEVEL_STDOUT; #define kBackgroundRefreshingTask @"im.monal.refresh" #else // fmodf: 19.11.24 - changed to actual another.im group - // #define kAppGroup @"group.monal" #define kAppGroup @"group.im.narayana.anotherim" + // #define kAppGroup @"group.monal" + + #define kMonalOpenURL [NSURL URLWithString:@"monalOpen://"] #define kBackgroundProcessingTask @"im.monal.process" #define kBackgroundRefreshingTask @"im.monal.refresh" diff --git a/Monal/Monal.xcodeproj/project.pbxproj b/Monal/Monal.xcodeproj/project.pbxproj index 764fdf7..518815a 100644 --- a/Monal/Monal.xcodeproj/project.pbxproj +++ b/Monal/Monal.xcodeproj/project.pbxproj @@ -683,6 +683,7 @@ 7E8442AC2CF297E5001CEBD2 /* ConversationScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationScreen.swift; sourceTree = ""; }; 7E8442AD2CF297E5001CEBD2 /* ConversationSettingsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationSettingsScreen.swift; sourceTree = ""; }; 7E8442AE2CF297E5001CEBD2 /* ConversationTextInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationTextInput.swift; sourceTree = ""; }; + 7E84BA842CFA7459009F262B /* another-im-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "another-im-Info.plist"; sourceTree = SOURCE_ROOT; }; 7E8D7AEE2CECEB30009AD3DF /* Colors+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Colors+Generated.swift"; sourceTree = ""; }; 7E8D7AEF2CECEB30009AD3DF /* Images+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Images+Generated.swift"; sourceTree = ""; }; 7E8D7AF02CECEB30009AD3DF /* Strings+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Strings+Generated.swift"; sourceTree = ""; }; @@ -1451,7 +1452,7 @@ name = tools; sourceTree = ""; }; - 29B97314FDCFA39411CA2CEA = { + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( 8414ADF92A7ABAC900EFFCCC /* Packages */, @@ -1627,6 +1628,7 @@ 7E995F232CEAC5D2005B30EE /* another.im */ = { isa = PBXGroup; children = ( + 7E84BA842CFA7459009F262B /* another-im-Info.plist */, 7E995F202CEAC5D2005B30EE /* AnotherIMApp.swift */, EA534340732BF66B533E4C0B /* Generated */, 7E8D7B152CECEE79009AD3DF /* Helpers */, @@ -1782,7 +1784,6 @@ 2C9B95CF9DA11FCEE44990A0 /* Chat.swift */, 405F76B4AD0B916C50352D23 /* Message.swift */, ); - name = Models; path = Models; sourceTree = ""; }; @@ -1857,7 +1858,6 @@ children = ( C02B964344F7E01D60E660D7 /* ScenarioLogIn.swift */, ); - name = Scenaries; path = Scenaries; sourceTree = ""; }; @@ -2174,7 +2174,7 @@ eu, "es-AR", ); - mainGroup = 29B97314FDCFA39411CA2CEA; + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; packageReferences = ( C1F5C7AD2777638B0001F295 /* XCRemoteSwiftPackageReference "swift-collections" */, 841898A82957712000FEC77D /* XCRemoteSwiftPackageReference "ViewExtractor" */, @@ -3750,12 +3750,14 @@ "$(inherited)", ); GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "another-im-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = another.im; INFOPLIST_KEY_NSCameraUsageDescription = "Allow app to take picture from camera and send it in atachments"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Allow app to take your geo to send it in attachment"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UILaunchStoryboardName = launchscreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 16.6; @@ -3843,12 +3845,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "another-im-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = another.im; INFOPLIST_KEY_NSCameraUsageDescription = "Allow app to take picture from camera and send it in atachments"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Allow app to take your geo to send it in attachment"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UILaunchStoryboardName = launchscreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 16.6; @@ -3938,12 +3942,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "another-im-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = another.im; INFOPLIST_KEY_NSCameraUsageDescription = "Allow app to take picture from camera and send it in atachments"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Allow app to take your geo to send it in attachment"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UILaunchStoryboardName = launchscreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 16.6; @@ -4033,12 +4039,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "another-im-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = another.im; INFOPLIST_KEY_NSCameraUsageDescription = "Allow app to take picture from camera and send it in atachments"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Allow app to take your geo to send it in attachment"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UILaunchStoryboardName = launchscreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 16.6; @@ -4128,12 +4136,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "another-im-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = another.im; INFOPLIST_KEY_NSCameraUsageDescription = "Allow app to take picture from camera and send it in atachments"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Allow app to take your geo to send it in attachment"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UILaunchStoryboardName = launchscreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 16.6; @@ -4223,12 +4233,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "another-im-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = another.im; INFOPLIST_KEY_NSCameraUsageDescription = "Allow app to take picture from camera and send it in atachments"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Allow app to take your geo to send it in attachment"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UILaunchStoryboardName = launchscreen; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 16.6; diff --git a/Monal/another-im-Info.plist b/Monal/another-im-Info.plist new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/Monal/another-im-Info.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/Monal/another.im/Resources/Assets/Images.xcassets/aim_logo.imageset/Contents.json b/Monal/another.im/Resources/Assets/Images.xcassets/aimlogo.imageset/Contents.json similarity index 100% rename from Monal/another.im/Resources/Assets/Images.xcassets/aim_logo.imageset/Contents.json rename to Monal/another.im/Resources/Assets/Images.xcassets/aimlogo.imageset/Contents.json diff --git a/Monal/another.im/Resources/Assets/Images.xcassets/aim_logo.imageset/aim_logo_2_1.png b/Monal/another.im/Resources/Assets/Images.xcassets/aimlogo.imageset/aim_logo_2_1.png similarity index 100% rename from Monal/another.im/Resources/Assets/Images.xcassets/aim_logo.imageset/aim_logo_2_1.png rename to Monal/another.im/Resources/Assets/Images.xcassets/aimlogo.imageset/aim_logo_2_1.png diff --git a/Monal/another.im/Resources/launchscreen.storyboard b/Monal/another.im/Resources/launchscreen.storyboard index f8e472c..dfd3be6 100644 --- a/Monal/another.im/Resources/launchscreen.storyboard +++ b/Monal/another.im/Resources/launchscreen.storyboard @@ -20,7 +20,7 @@ - + @@ -41,7 +41,7 @@ - + diff --git a/Monal/another.im/Views/Conversation/ConversationScreen.swift b/Monal/another.im/Views/Conversation/ConversationScreen.swift index 8c247a5..3487ee2 100644 --- a/Monal/another.im/Views/Conversation/ConversationScreen.swift +++ b/Monal/another.im/Views/Conversation/ConversationScreen.swift @@ -38,6 +38,13 @@ struct ConversationScreen: View { ) ) + if chatWrapper.mamRequestInProgress { + ProgressView() + .progressViewStyle(.circular) + .tint(.Material.Shape.separator) + .padding(.top, 8) + } + // Msg list if !chatWrapper.messages.isEmpty { ScrollViewReader { proxy in diff --git a/Monal/another.im/Views/Enter/LoginScreen.swift b/Monal/another.im/Views/Enter/LoginScreen.swift index e055f70..33980c8 100644 --- a/Monal/another.im/Views/Enter/LoginScreen.swift +++ b/Monal/another.im/Views/Enter/LoginScreen.swift @@ -24,7 +24,7 @@ struct LoginScreen: View { // content VStack(spacing: 32) { // icon - Image(.aimLogo) + Image(.aimlogo) .resizable() .aspectRatio(contentMode: .fit) .frame(width: 120, height: 120) diff --git a/Monal/another.im/Views/Enter/WelcomeScreen.swift b/Monal/another.im/Views/Enter/WelcomeScreen.swift index bc6201d..d12d6a6 100644 --- a/Monal/another.im/Views/Enter/WelcomeScreen.swift +++ b/Monal/another.im/Views/Enter/WelcomeScreen.swift @@ -33,7 +33,7 @@ struct WelcomeScreen: View { // content VStack(spacing: 32) { // icon - Image.aimLogo + Image.aimlogo .resizable() .aspectRatio(contentMode: .fit) .frame(width: 120, height: 120) diff --git a/Monal/another.im/XMPP/MonalXmppWrapper.swift b/Monal/another.im/XMPP/MonalXmppWrapper.swift index ae3dd1f..b897459 100644 --- a/Monal/another.im/XMPP/MonalXmppWrapper.swift +++ b/Monal/another.im/XMPP/MonalXmppWrapper.swift @@ -155,6 +155,7 @@ private extension MonalXmppWrapper { final class MonalChatWrapper: ObservableObject { @Published private(set) var messages: [Message] = [] @Published var replyText: String = "" + @Published private(set) var mamRequestInProgress = false @Published var isOmemoEnabled: Bool { didSet { toggleOmemo(isOmemoEnabled) @@ -168,7 +169,6 @@ final class MonalChatWrapper: ObservableObject { private let xmpp: MLXMPPManager private let db: DataLayer private var notificationObservers: [AnyObject] = [] - private var mamRequestInProgress = false init(account: Account, contact: Contact, db: DataLayer, xmpp: MLXMPPManager) { self.contact = contact @@ -221,10 +221,13 @@ final class MonalChatWrapper: ObservableObject { ?? db.lastStanzaId(forAccount: NSNumber(value: account.id)) acc.setMAMQueryMostRecentFor(monalContact, before: lastStanzaId) { [weak self] msgs, _ in - self?.mamRequestInProgress = false - if !(msgs ?? []).isEmpty { - DispatchQueue.main.async { [weak self] in + DispatchQueue.main.async { [weak self] in + self?.mamRequestInProgress = false + if !(msgs ?? []).isEmpty { self?.refreshMessages() + } else { + let test = 4 + print(test) } } } diff --git a/Monal/another.im/XMPP/Scenaries/ScenarioLogIn.swift b/Monal/another.im/XMPP/Scenaries/ScenarioLogIn.swift index 616cb21..238e5b0 100644 --- a/Monal/another.im/XMPP/Scenaries/ScenarioLogIn.swift +++ b/Monal/another.im/XMPP/Scenaries/ScenarioLogIn.swift @@ -10,11 +10,25 @@ final class ScenarioLogIn { // TODO: Добавить автовключение отключенных аккаунтов при попытке ввести тот же JID // Обработать кейс когда бесячий monalxmpp возвращает nil при попытке добавить тот же JID func tryLogin(_ login: String, _ password: String) async -> Bool { + NotificationCenter.default.addObserver(forName: Notification.Name("kMonalUpdateBundleFetchStatus"), object: nil, queue: .main) { _ in + print("--- DEBUG: kMonalUpdateBundleFetchStatus") + } + + NotificationCenter.default.addObserver(forName: Notification.Name("kMonalFinishedOmemoBundleFetch"), object: nil, queue: .main) { _ in + print("--- DEBUG: kMonalFinishedOmemoBundleFetch") + } + + NotificationCenter.default.addObserver(forName: Notification.Name("kMonalFinishedCatchup"), object: nil, queue: .main) { _ in + print("--- DEBUG: kMonalFinishedCatchup") + } + async let notify = await withCheckedContinuation { [weak self] continuation in self?.successObserver = NotificationCenter.default.addObserver(forName: Notification.Name("kMLResourceBoundNotice"), object: nil, queue: .main) { _ in + print("--- DEBUG: kMLResourceBoundNotice") continuation.resume(returning: true) } self?.failureObserver = NotificationCenter.default.addObserver(forName: Notification.Name("kXMPPError"), object: nil, queue: .main) { _ in + print("--- DEBUG: kXMPPError") continuation.resume(returning: false) } }