From 5fb9a6621db5bea4b64696a4a57fbe1e5450a4c7 Mon Sep 17 00:00:00 2001
From: Ryan ZHAO <>
Date: Fri, 29 Nov 2024 17:21:35 +1100
Subject: [PATCH] add more logs
---
Session.xcodeproj/project.pbxproj | 4 +-
.../Settings.bundle/ThirdPartyLicenses.plist | 82 +++++++++++++++++++
.../PushRegistrationManager.swift | 71 ++++++++--------
3 files changed, 122 insertions(+), 35 deletions(-)
diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj
index ea30ead1a..6fafaac47 100644
--- a/Session.xcodeproj/project.pbxproj
+++ b/Session.xcodeproj/project.pbxproj
@@ -7778,7 +7778,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 496;
+ CURRENT_PROJECT_VERSION = 498;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -7849,7 +7849,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 496;
+ CURRENT_PROJECT_VERSION = 498;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
diff --git a/Session/Meta/Settings.bundle/ThirdPartyLicenses.plist b/Session/Meta/Settings.bundle/ThirdPartyLicenses.plist
index 1e94962d9..6ca29b954 100644
--- a/Session/Meta/Settings.bundle/ThirdPartyLicenses.plist
+++ b/Session/Meta/Settings.bundle/ThirdPartyLicenses.plist
@@ -985,6 +985,88 @@ SOFTWARE.
License
The MIT License (MIT)
+Copyright (c) 2016 swiftlyfalling (https://github.com/swiftlyfalling)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+ Title
+ session-grdb-swift
+
+
+ License
+ The author disclaims copyright to this source code. In place of
+a legal notice, here is a blessing:
+
+ * May you do good and not evil.
+ * May you find forgiveness for yourself and forgive others.
+ * May you share freely, never taking more than you give.
+
+ Title
+ session-grdb-swift
+
+
+ License
+ /*
+** LICENSE for the sqlite3 WebAssembly/JavaScript APIs.
+**
+** This bundle (typically released as sqlite3.js or sqlite3.mjs)
+** is an amalgamation of JavaScript source code from two projects:
+**
+** 1) https://emscripten.org: the Emscripten "glue code" is covered by
+** the terms of the MIT license and University of Illinois/NCSA
+** Open Source License, as described at:
+**
+** https://emscripten.org/docs/introducing_emscripten/emscripten_license.html
+**
+** 2) https://sqlite.org: all code and documentation labeled as being
+** from this source are released under the same terms as the sqlite3
+** C library:
+**
+** 2022-10-16
+**
+** The author disclaims copyright to this source code. In place of a
+** legal notice, here is a blessing:
+**
+** * May you do good and not evil.
+** * May you find forgiveness for yourself and forgive others.
+** * May you share freely, never taking more than you give.
+*/
+
+ Title
+ session-grdb-swift
+
+
+ License
+ The author disclaims copyright to this source code. In place of
+a legal notice, here is a blessing:
+
+ May you do good and not evil.
+ May you find forgiveness for yourself and forgive others.
+ May you share freely, never taking more than you give.
+
+ Title
+ session-grdb-swift
+
+
+ License
+ The MIT License (MIT)
+
Copyright (c) 2015 ibireme <ibireme@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/Session/Notifications/PushRegistrationManager.swift b/Session/Notifications/PushRegistrationManager.swift
index 7f3b98ef7..9b292d5f7 100644
--- a/Session/Notifications/PushRegistrationManager.swift
+++ b/Session/Notifications/PushRegistrationManager.swift
@@ -297,40 +297,45 @@ public enum PushRegistrationError: Error {
LibSession.resumeNetworkAccess()
let maybeCall: SessionCall? = Storage.shared.write { db in
- let messageInfo: CallMessage.MessageInfo = CallMessage.MessageInfo(
- state: (caller == getUserHexEncodedPublicKey(db) ?
- .outgoing :
- .incoming
- )
- )
-
- let messageInfoString: String? = {
- if let messageInfoData: Data = try? JSONEncoder().encode(messageInfo) {
- return String(data: messageInfoData, encoding: .utf8)
- } else {
- return "callsIncoming"
- .put(key: "name", value: caller)
- .localized()
- }
- }()
-
- let call: SessionCall = SessionCall(db, for: caller, uuid: uuid, mode: .answer)
- let thread: SessionThread = try SessionThread
- .fetchOrCreate(db, id: caller, variant: .contact, shouldBeVisible: nil)
-
- let interaction: Interaction = try Interaction(
- messageUuid: uuid,
- threadId: thread.id,
- threadVariant: thread.variant,
- authorId: caller,
- variant: .infoCall,
- body: messageInfoString,
- timestampMs: timestampMs
- )
- .withDisappearingMessagesConfiguration(db, threadVariant: thread.variant)
- .inserted(db)
+ var call: SessionCall? = nil
- call.callInteractionId = interaction.id
+ do {
+ let messageInfo: CallMessage.MessageInfo = CallMessage.MessageInfo(state: .incoming)
+ SNLog("[Calls] messageInfo done")
+
+ let messageInfoString: String? = {
+ if let messageInfoData: Data = try? JSONEncoder().encode(messageInfo) {
+ return String(data: messageInfoData, encoding: .utf8)
+ } else {
+ return "callsIncoming"
+ .put(key: "name", value: caller)
+ .localized()
+ }
+ }()
+ SNLog("[Calls] messageInfoString done: \(messageInfoString ?? "nil")")
+
+ call = SessionCall(db, for: caller, uuid: uuid, mode: .answer)
+ SNLog("[Calls] call instance done")
+ let thread: SessionThread = try SessionThread.fetchOrCreate(db, id: caller, variant: .contact, shouldBeVisible: nil)
+ SNLog("[Calls] thread got")
+
+ let interaction: Interaction = try Interaction(
+ messageUuid: uuid,
+ threadId: thread.id,
+ threadVariant: thread.variant,
+ authorId: caller,
+ variant: .infoCall,
+ body: messageInfoString,
+ timestampMs: timestampMs
+ )
+ .withDisappearingMessagesConfiguration(db, threadVariant: thread.variant)
+ .inserted(db)
+ SNLog("[Calls] control message inserted")
+
+ call?.callInteractionId = interaction.id
+ } catch {
+ SNLog("[Calls] Failed to creat call due to error: \(error)")
+ }
return call
}