This commit is contained in:
Woit 2024-11-29 23:18:54 +01:00
parent eb037c452a
commit 6934b0fa97
13 changed files with 61 additions and 16 deletions

View file

@ -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()
}

View file

@ -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;

View file

@ -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"

View file

@ -683,6 +683,7 @@
7E8442AC2CF297E5001CEBD2 /* ConversationScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationScreen.swift; sourceTree = "<group>"; };
7E8442AD2CF297E5001CEBD2 /* ConversationSettingsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationSettingsScreen.swift; sourceTree = "<group>"; };
7E8442AE2CF297E5001CEBD2 /* ConversationTextInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationTextInput.swift; sourceTree = "<group>"; };
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 = "<group>"; };
7E8D7AEF2CECEB30009AD3DF /* Images+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Images+Generated.swift"; sourceTree = "<group>"; };
7E8D7AF02CECEB30009AD3DF /* Strings+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Strings+Generated.swift"; sourceTree = "<group>"; };
@ -1451,7 +1452,7 @@
name = tools;
sourceTree = "<group>";
};
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 = "<group>";
};
@ -1857,7 +1858,6 @@
children = (
C02B964344F7E01D60E660D7 /* ScenarioLogIn.swift */,
);
name = Scenaries;
path = Scenaries;
sourceTree = "<group>";
};
@ -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;

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>

View file

@ -20,7 +20,7 @@
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="aim_logo" translatesAutoresizingMaskIntoConstraints="NO" id="Uob-GB-ruJ">
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="aimlogo" translatesAutoresizingMaskIntoConstraints="NO" id="Uob-GB-ruJ">
<rect key="frame" x="96.666666666666686" y="326" width="200" height="200"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="Y9d-CF-hg4" userLabel="width = 200"/>
@ -41,7 +41,7 @@
</scene>
</scenes>
<resources>
<image name="aim_logo" width="1000" height="1000"/>
<image name="aimlogo" width="1000" height="1000"/>
<namedColor name="material/background/light">
<color red="0.92156862745098034" green="0.92156862745098034" blue="0.92156862745098034" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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
DispatchQueue.main.async { [weak self] in
self?.mamRequestInProgress = false
if !(msgs ?? []).isEmpty {
DispatchQueue.main.async { [weak self] in
self?.refreshMessages()
} else {
let test = 4
print(test)
}
}
}

View file

@ -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)
}
}