From 341d22ae1ad7a47f1b7960129f7b9a016061ebc3 Mon Sep 17 00:00:00 2001
From: Kylmakalle <iceman9831@gmail.com>
Date: Fri, 2 May 2025 01:06:13 +0300
Subject: [PATCH] merge fixes

---
 .../Sources/NotificationService.swift          |  6 +++---
 .../PremiumUI/Sources/PremiumIntroScreen.swift |  6 ++++--
 .../Sources/CallListSettings.swift             | 18 ++++++++++++------
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/Telegram/NotificationService/Sources/NotificationService.swift b/Telegram/NotificationService/Sources/NotificationService.swift
index c0613280d2..6bf0101ff2 100644
--- a/Telegram/NotificationService/Sources/NotificationService.swift
+++ b/Telegram/NotificationService/Sources/NotificationService.swift
@@ -1340,7 +1340,7 @@ private final class NotificationServiceHandler {
                             }
                         case let .groupCall(groupCallData):
                             if let stateManager = strongSelf.stateManager {
-                                let content = NotificationContent(isLockedMessage: nil)
+                                let content = NotificationContent(sgStatus: sgStatus, isLockedMessage: nil)
                                 updateCurrentContent(content)
                                 
                                 let _ = (stateManager.postbox.transaction { transaction -> TelegramUser? in
@@ -1361,7 +1361,7 @@ private final class NotificationServiceHandler {
 
                                     if #available(iOS 14.5, *), voiceCallSettings.enableSystemIntegration {
                                         Logger.shared.log("NotificationService \(episode)", "Will report voip notification")
-                                        let content = NotificationContent(isLockedMessage: nil)
+                                        let content = NotificationContent(sgStatus: sgStatus, isLockedMessage: nil)
                                         updateCurrentContent(content)
                                         
                                         CXProvider.reportNewIncomingVoIPPushPayload(voipPayload, completion: { error in
@@ -1370,7 +1370,7 @@ private final class NotificationServiceHandler {
                                             completed()
                                         })
                                     } else {
-                                        var content = NotificationContent(isLockedMessage: nil)
+                                        var content = NotificationContent(sgStatus: sgStatus, isLockedMessage: nil)
                                         if let peer = fromPeer {
                                             content.title = peer.debugDisplayTitle
                                             content.body = incomingCallMessage
diff --git a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift
index 3b2b234ac0..249be9029a 100644
--- a/submodules/PremiumUI/Sources/PremiumIntroScreen.swift
+++ b/submodules/PremiumUI/Sources/PremiumIntroScreen.swift
@@ -3099,8 +3099,10 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
             let presentationData = self.screenContext.presentationData
 
             // MARK: Swiftgram
-            let alertController = textAlertController(context: self.context, title: i18n("Common.OpenTelegram", presentationData.strings.baseLanguageCode), text: i18n("Common.UseTelegramForPremium", presentationData.strings.baseLanguageCode), actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
-            self.present(alertController)
+            if let context = self.screenContext.context {
+                let alertController = textAlertController(context: context, title: i18n("Common.OpenTelegram", presentationData.strings.baseLanguageCode), text: i18n("Common.UseTelegramForPremium", presentationData.strings.baseLanguageCode), actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
+                self.present(alertController)
+            }
             
             /*
             if case let .gift(_, _, _, giftCode) = self.source, let giftCode, giftCode.usedDate == nil {
diff --git a/submodules/TelegramUIPreferences/Sources/CallListSettings.swift b/submodules/TelegramUIPreferences/Sources/CallListSettings.swift
index 850f6c622f..510c58813a 100644
--- a/submodules/TelegramUIPreferences/Sources/CallListSettings.swift
+++ b/submodules/TelegramUIPreferences/Sources/CallListSettings.swift
@@ -3,10 +3,11 @@ import TelegramCore
 import SwiftSignalKit
 
 public struct CallListSettings: Codable, Equatable {
+    public var showContactsTab: Bool
     public var _showTab: Bool?
     
     public static var defaultSettings: CallListSettings {
-        return CallListSettings(showTab: nil)
+        return CallListSettings(showContactsTab: true, showTab: nil)
     }
     
     public var showTab: Bool {
@@ -21,13 +22,14 @@ public struct CallListSettings: Codable, Equatable {
         }
     }
     
-    public init(showTab: Bool?) {
+    public init(showContactsTab: Bool, showTab: Bool?) {
+        self.showContactsTab = showContactsTab
         self._showTab = showTab
     }
     
     public init(from decoder: Decoder) throws {
         let container = try decoder.container(keyedBy: StringCodingKey.self)
-
+        self.showContactsTab = (try container.decode(Int32.self, forKey: "showContactsTab")) != 0
         if let value = try container.decodeIfPresent(Int32.self, forKey: "showTab") {
             self._showTab = value != 0
         }
@@ -35,7 +37,7 @@ public struct CallListSettings: Codable, Equatable {
     
     public func encode(to encoder: Encoder) throws {
         var container = encoder.container(keyedBy: StringCodingKey.self)
-
+        try container.encode((self.showContactsTab ? 1 : 0) as Int32, forKey: "showContactsTab")
         if let showTab = self._showTab {
             try container.encode((showTab ? 1 : 0) as Int32, forKey: "showTab")
         } else {
@@ -44,11 +46,15 @@ public struct CallListSettings: Codable, Equatable {
     }
     
     public static func ==(lhs: CallListSettings, rhs: CallListSettings) -> Bool {
-        return lhs._showTab == rhs._showTab
+        return lhs.showContactsTab == rhs.showContactsTab && lhs._showTab == rhs._showTab
     }
     
     public func withUpdatedShowTab(_ showTab: Bool) -> CallListSettings {
-        return CallListSettings(showTab: showTab)
+        return CallListSettings(showContactsTab: self.showContactsTab, showTab: showTab)
+    }
+    
+    public func withUpdatedShowContactsTab(_ showContactsTab: Bool) -> CallListSettings {
+        return CallListSettings(showContactsTab: showContactsTab, showTab: self.showTab)
     }
 }