Skip to content

Fix calls from Phone recents opening without starting - #2304

Open
vasyaskery1-jpg wants to merge 1 commit into
TelegramMessenger:masterfrom
vasyaskery1-jpg:codex/fix-call-recents-user-activity
Open

Fix calls from Phone recents opening without starting#2304
vasyaskery1-jpg wants to merge 1 commit into
TelegramMessenger:masterfrom
vasyaskery1-jpg:codex/fix-call-recents-user-activity

Conversation

@vasyaskery1-jpg

Copy link
Copy Markdown

Summary

  • handle the NSUserActivity payload produced by the Siri Intents INStartCallIntent handler
  • validate the activity type, TGCA prefix, and cloud-user peer namespace before starting the call
  • preserve the existing interaction?.intent contact-resolution path

Problem

When a user taps a Telegram call in Phone > Recents, the Siri Intents extension resolves the contact and returns .continueInApp with userInfo["handle"] = "TGCA<peerId>".

AppDelegate.application(_:continue:restorationHandler:) currently only inspects userActivity.interaction?.intent. When the continuation activity contains the serialized TGCA handle but no interaction, Telegram opens and returns true without starting a call.

This change consumes that existing payload and forwards the decoded peer to startCallWhenReady, which reaches the normal call flow.

Validation

  • git diff --check
  • verified the producer and consumer use the same INStartCallIntent activity type and TGCA<peerId> format
  • verified malformed handles and non-cloud-user peer identifiers do not use the new path

Not run on an iPhone because a macOS/Xcode signing environment was not available.

@vhf2jghn76-sys vhf2jghn76-sys left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just

|> mapToSignal { sharedApplicationContext -> Signal<(SharedAccountContextImpl, AuthorizedApplicationContext?, UnauthorizedApplicationContext?), NoError> in
combineLatest(self.context.get(), self.authContext.get())
|> filter { $0 != nil || $1 != nil }
|> take(1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weplay

return true
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
8033901

return true
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

001736

return true
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0017364

self.startCallWhenReady(accountId: nil, peerId: peerId, isVideo: false)
return true
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wqqml

handle.hasPrefix(startCallHandlePrefix),
let peerIdValue = Int64(handle.dropFirst(startCallHandlePrefix.count)) {
let peerId = PeerId(peerIdValue)
if peerId.namespace == Namespaces.Peer.CloudUser {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if peerId.namespace == Namespaces.Peer.CloudUser {
if peerId.namespace == Namespaces.Peer.CloudUser {```suggestion
if peerId.namespace == Namespaces.Peer.CloudUser {

if userActivity.activityType == NSStringFromClass(INStartCallIntent.self),
let handle = userActivity.userInfo?["handle"] as? String,
handle.hasPrefix(startCallHandlePrefix),
let peerIdValue = Int64(handle.dropFirst(startCallHandlePrefix.count)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let peerIdValue = Int64(handle.dropFirst(startCallHandlePrefix.count)) {
let peerIdValue = Int64(handle.dropFirst(startCallHandlePrefix.count)) {```suggestion
let peerIdValue = Int64(handle.dropFirst(startCallHandlePrefix.count)) {

if #available(iOS 10.0, *) {
let startCallHandlePrefix = "TGCA"
if userActivity.activityType == NSStringFromClass(INStartCallIntent.self),
let handle = userActivity.userInfo?["handle"] as? String,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let handle = userActivity.userInfo?["handle"] as? String,
let handle = userActivity.userInfo?["handle"] as? String,

}

self.openUrl(url: url)
return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


|> filter { $0 != nil || $1 != nil }
|> take(1)
|> map { context, authContext -> (SharedAccountContextImpl, AuthorizedApplicationContext?, UnauthorizedApplicationContext?) in
return (sharedApplicationContext.sharedContext, context, authContext)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants