try to fix a callkit issue

pull/1055/head
Ryan ZHAO 4 months ago
parent 907abf1d24
commit 53fdbbb00d

@ -7819,6 +7819,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 = 508;
DEVELOPMENT_TEAM = SUQ8J2PCT7; DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -7856,6 +7857,7 @@
"$(SRCROOT)", "$(SRCROOT)",
); );
LLVM_LTO = NO; LLVM_LTO = NO;
MARKETING_VERSION = 2.8.4;
OTHER_LDFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
@ -7888,6 +7890,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 = 508;
DEVELOPMENT_TEAM = SUQ8J2PCT7; DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -7925,6 +7928,7 @@
"$(SRCROOT)", "$(SRCROOT)",
); );
LLVM_LTO = NO; LLVM_LTO = NO;
MARKETING_VERSION = 2.8.4;
OTHER_LDFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
PRODUCT_NAME = Session; PRODUCT_NAME = Session;

@ -289,13 +289,10 @@ public class PushRegistrationManager: NSObject, PKPushRegistryDelegate, PushRegi
return return
} }
// FIXME: Initialise the `PushRegistrationManager` with a dependencies instance
let dependencies: Dependencies = Dependencies()
dependencies.storage.resumeDatabaseAccess() dependencies.storage.resumeDatabaseAccess()
LibSession.resumeNetworkAccess() LibSession.resumeNetworkAccess()
let maybeCall: SessionCall? = Storage.shared.write { db in let maybeCall: SessionCall? = Storage.shared.read { [dependencies = self.dependencies] db in
var call: SessionCall? = nil var call: SessionCall? = nil
do { do {
@ -307,17 +304,8 @@ public class PushRegistrationManager: NSObject, PKPushRegistryDelegate, PushRegi
using: dependencies using: dependencies
) )
let thread: SessionThread = try SessionThread.upsert(
db,
id: caller,
variant: .contact,
values: .existingOrDefault,
calledFromConfig: nil,
using: dependencies
)
let interaction: Interaction? = try Interaction let interaction: Interaction? = try Interaction
.filter(Interaction.Columns.threadId == thread.id) .filter(Interaction.Columns.threadId == caller)
.filter(Interaction.Columns.messageUuid == uuid) .filter(Interaction.Columns.messageUuid == uuid)
.fetchOne(db) .fetchOne(db)

@ -95,8 +95,10 @@ public final class NotificationServiceExtension: UNNotificationServiceExtension
} }
} }
let isCallOngoing: Bool = (UserDefaults.sharedLokiProject?[.isCallOngoing]) let isCallOngoing: Bool = (
.defaulting(to: false) (UserDefaults.sharedLokiProject?[.isCallOngoing]).defaulting(to: false) &&
(UserDefaults.sharedLokiProject?[.lastCallPreOffer]) != nil
)
// HACK: It is important to use write synchronously here to avoid a race condition // HACK: It is important to use write synchronously here to avoid a race condition
// where the completeSilenty() is called before the local notification request // where the completeSilenty() is called before the local notification request

Loading…
Cancel
Save