fix some issues on database preparation and potential

pull/1061/head
Ryan ZHAO 2 months ago
parent 7af5b53433
commit 1e89f6c4fd

@ -40,7 +40,8 @@ extension ProjectState {
"cameraGrantAccessDescription",
"permissionsAppleMusic",
"permissionsStorageSave",
"permissionsMicrophoneAccessRequiredIos"
"permissionsMicrophoneAccessRequiredIos",
"permissionsLocalNetworkAccessRequiredIos"
]
static let permissionStringsMap: [String: String] = [
"permissionsStorageSend": "NSPhotoLibraryUsageDescription",
@ -48,7 +49,8 @@ extension ProjectState {
"cameraGrantAccessDescription": "NSCameraUsageDescription",
"permissionsAppleMusic": "NSAppleMusicUsageDescription",
"permissionsStorageSave": "NSPhotoLibraryAddUsageDescription",
"permissionsMicrophoneAccessRequiredIos": "NSMicrophoneUsageDescription"
"permissionsMicrophoneAccessRequiredIos": "NSMicrophoneUsageDescription",
"permissionsLocalNetworkAccessRequiredIos": "NSLocalNetworkUsageDescription"
]
static let validSourceSuffixes: Set<String> = [".swift", ".m"]
static let excludedPaths: Set<String> = [
@ -318,7 +320,8 @@ enum ScriptAction: String {
ProjectState.permissionStrings.forEach { key in
guard let nsKey: String = ProjectState.permissionStringsMap[key] else { return }
if
let stringsData: Data = try? JSONSerialization.data(withJSONObject: (projectState.localizationFile.strings[key] as! JSON), options: [ .fragmentsAllowed ]),
let json = projectState.localizationFile.strings[key] as? JSON,
let stringsData: Data = try? JSONSerialization.data(withJSONObject: json, options: [ .fragmentsAllowed ]),
let stringsJSONString: String = String(data: stringsData, encoding: .utf8)
{
let updatedStringsJSONString = stringsJSONString.replacingOccurrences(of: "{app_name}", with: "Session")

@ -23,7 +23,13 @@ public final class SessionCall: CurrentCallProtocol, WebRTCSessionDelegate {
var audioMode: AudioMode
public let webRTCSession: WebRTCSession
let isOutgoing: Bool
var remoteSDP: RTCSessionDescription? = nil
var remoteSDP: RTCSessionDescription? = nil {
didSet {
if hasStartedConnecting, let sdp = remoteSDP {
webRTCSession.handleRemoteSDP(sdp, from: sessionId) // This sends an answer message internally
}
}
}
var callInteractionId: Int64?
var answerCallAction: CXAnswerCallAction? = nil
@ -214,9 +220,6 @@ public final class SessionCall: CurrentCallProtocol, WebRTCSessionDelegate {
Log.info(.calls, "Did receive remote sdp.")
remoteSDP = sdp
if hasStartedConnecting {
webRTCSession.handleRemoteSDP(sdp, from: sessionId) // This sends an answer message internally
}
if mode == .answer {
self.updateCurrentConnectionStepIfPossible(AnswerStep.receivedOffer)
}
@ -296,10 +299,10 @@ public final class SessionCall: CurrentCallProtocol, WebRTCSessionDelegate {
guard case .answer = mode else { return }
hasStartedConnecting = true
self.updateCurrentConnectionStepIfPossible(AnswerStep.sendingAnswer)
if let sdp = remoteSDP {
SNLog("[Calls] Got remote sdp already")
self.updateCurrentConnectionStepIfPossible(AnswerStep.sendingAnswer)
webRTCSession.handleRemoteSDP(sdp, from: sessionId) // This sends an answer message internally
}
}
@ -615,9 +618,14 @@ extension SessionCall {
connectionStepsRecord[step.index] = true
while let nextStep = currentConnectionStep.nextStep, connectionStepsRecord[nextStep.index] {
currentConnectionStep = nextStep
updateCallDetailedStatus?(
mode == .offer ? Constants.call_connection_steps_sender[currentConnectionStep.index] : Constants.call_connection_steps_receiver[currentConnectionStep.index]
)
DispatchQueue.main.async {
self.updateCallDetailedStatus?(
self.mode == .offer ?
Constants.call_connection_steps_sender[self.currentConnectionStep.index] :
Constants.call_connection_steps_receiver[self.currentConnectionStep.index]
)
}
}
}
}

@ -24,9 +24,11 @@ extension WebRTCSession {
else {
guard sdp.type == .offer else { return }
self?.sendAnswer(to: sessionId)
.retry(5)
.sinkUntilComplete()
DispatchQueue.global(qos: .userInitiated).async {
self?.sendAnswer(to: sessionId)
.retry(5)
.sinkUntilComplete()
}
}
})
}

@ -314,8 +314,10 @@ public class PushRegistrationManager: NSObject, PKPushRegistryDelegate {
dependencies[singleton: .jobRunner].appDidBecomeActive()
// NOTE: Just start 1-1 poller so that it won't wait for polling group messages
(UIApplication.shared.delegate as? AppDelegate)?.startPollersIfNeeded(shouldStartGroupPollers: false)
dependencies[singleton: .appReadiness].runNowOrWhenAppDidBecomeReady {
// NOTE: Just start 1-1 poller so that it won't wait for polling group messages
(UIApplication.shared.delegate as? AppDelegate)?.startPollersIfNeeded(shouldStartGroupPollers: false)
}
call.reportIncomingCallIfNeeded { error in
if let error = error {

@ -485,7 +485,7 @@ public final class NotificationServiceExtension: UNNotificationServiceExtension
for callMessage: CallMessage,
runId: String
) {
if #available(iOSApplicationExtension 14.5, *), Preferences.isCallKitSupported {
if Preferences.isCallKitSupported {
guard let caller: String = callMessage.sender, let timestamp = callMessage.sentTimestampMs else { return }
let reportCall: () -> () = { [weak self, dependencies] in

Loading…
Cancel
Save