fix CallKit crash

pull/1053/head
Ryan ZHAO 10 months ago
parent 5fb9a6621d
commit 780e262e52

@ -7778,7 +7778,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 498; CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_TEAM = SUQ8J2PCT7; DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -7849,7 +7849,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 498; CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_TEAM = SUQ8J2PCT7; DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",

@ -354,6 +354,7 @@ final class HomeVC: BaseVC, LibSessionRespondingViewController, UITableViewDataS
// Start polling if needed (i.e. if the user just created or restored their Session ID) // Start polling if needed (i.e. if the user just created or restored their Session ID)
if Identity.userExists(), let appDelegate: AppDelegate = UIApplication.shared.delegate as? AppDelegate { if Identity.userExists(), let appDelegate: AppDelegate = UIApplication.shared.delegate as? AppDelegate {
SNLog("[HomeVC]: Starting pollers...")
appDelegate.startPollersIfNeeded() appDelegate.startPollersIfNeeded()
} }

@ -300,39 +300,27 @@ public enum PushRegistrationError: Error {
var call: SessionCall? = nil var call: SessionCall? = nil
do { do {
let messageInfo: CallMessage.MessageInfo = CallMessage.MessageInfo(state: .incoming) call = SessionCall(
SNLog("[Calls] messageInfo done") db,
for: caller,
let messageInfoString: String? = { uuid: uuid,
if let messageInfoData: Data = try? JSONEncoder().encode(messageInfo) { mode: .answer
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) let thread: SessionThread = try SessionThread
SNLog("[Calls] call instance done") .fetchOrCreate(
let thread: SessionThread = try SessionThread.fetchOrCreate(db, id: caller, variant: .contact, shouldBeVisible: nil) db,
SNLog("[Calls] thread got") id: caller,
variant: .contact,
shouldBeVisible: nil
)
let interaction: Interaction = try Interaction( let interaction: Interaction? = try Interaction
messageUuid: uuid, .filter(Interaction.Columns.threadId == thread.id)
threadId: thread.id, .filter(Interaction.Columns.messageUuid == uuid)
threadVariant: thread.variant, .fetchOne(db)
authorId: caller,
variant: .infoCall,
body: messageInfoString,
timestampMs: timestampMs
)
.withDisappearingMessagesConfiguration(db, threadVariant: thread.variant)
.inserted(db)
SNLog("[Calls] control message inserted")
call?.callInteractionId = interaction.id call?.callInteractionId = interaction?.id
} catch { } catch {
SNLog("[Calls] Failed to creat call due to error: \(error)") SNLog("[Calls] Failed to creat call due to error: \(error)")
} }

Loading…
Cancel
Save