diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index a5165b9222..3e66502e7b 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -6931,3 +6931,10 @@ Sorry for the inconvenience."; "Channel.AdminLog.JoinedViaRequest" = "%1$@ joined via invite link %2$@, approved by %3$@"; "Appearance.NightTheme" = "Night Mode"; + +"Map.ETADays_0" = "%@ days"; +"Map.ETADays_1" = "%@ day"; +"Map.ETADays_2" = "%@ days"; +"Map.ETADays_3_10" = "%@ days"; +"Map.ETADays_many" = "%@ days"; +"Map.ETADays_any" = "%@ days"; diff --git a/submodules/InviteLinksUI/Sources/InviteRequestsController.swift b/submodules/InviteLinksUI/Sources/InviteRequestsController.swift index 5e86a712f9..e4b2bc1341 100644 --- a/submodules/InviteLinksUI/Sources/InviteRequestsController.swift +++ b/submodules/InviteLinksUI/Sources/InviteRequestsController.swift @@ -377,7 +377,7 @@ public func inviteRequestsController(context: AccountContext, updatedPresentatio } navigateToChatImpl = { [weak controller] peer in if let navigationController = controller?.navigationController as? NavigationController { - context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer.id))) + context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer.id), keepStack: .always)) } } dismissInputImpl = { [weak controller] in diff --git a/submodules/LocationUI/Sources/LocationUtils.swift b/submodules/LocationUI/Sources/LocationUtils.swift index 3b615afe37..6a03d01eee 100644 --- a/submodules/LocationUI/Sources/LocationUtils.swift +++ b/submodules/LocationUI/Sources/LocationUtils.swift @@ -75,9 +75,12 @@ func stringForEstimatedDuration(strings: PresentationStrings, time: Double, form let time = max(time, 60.0) let minutes = Int32(time / 60.0) % 60 let hours = Int32(time / 3600.0) + let days = Int32(time / (3600.0 * 24.0)) let string: String - if hours > 1 { + if hours >= 24 { + string = strings.Map_ETADays(days) + } else if hours > 1 { if hours == 1 && minutes == 0 { string = strings.Map_ETAHours(1) } else { diff --git a/submodules/SettingsUI/Sources/ThemePickerController.swift b/submodules/SettingsUI/Sources/ThemePickerController.swift index 17ec6c0794..15ad2e33ba 100644 --- a/submodules/SettingsUI/Sources/ThemePickerController.swift +++ b/submodules/SettingsUI/Sources/ThemePickerController.swift @@ -23,7 +23,7 @@ import AnimationUI private final class ThemePickerControllerArguments { let context: AccountContext let selectTheme: (TelegramBaseTheme?, PresentationThemeReference) -> Void - let previewTheme: (PresentationThemeReference) -> Void + let previewTheme: (PresentationThemeReference, Bool) -> Void let selectAccentColor: (TelegramBaseTheme?, PresentationThemeAccentColor?) -> Void let openAccentColorPicker: (PresentationThemeReference, Bool) -> Void let editTheme: (PresentationCloudTheme) -> Void @@ -32,7 +32,7 @@ private final class ThemePickerControllerArguments { let themeContextAction: (Bool, PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void let colorContextAction: (Bool, PresentationThemeReference, ThemeSettingsColorOption?, ASDisplayNode, ContextGesture?) -> Void - init(context: AccountContext, selectTheme: @escaping (TelegramBaseTheme?, PresentationThemeReference) -> Void, previewTheme: @escaping (PresentationThemeReference) -> Void, selectAccentColor: @escaping (TelegramBaseTheme?, PresentationThemeAccentColor?) -> Void, openAccentColorPicker: @escaping (PresentationThemeReference, Bool) -> Void, editTheme: @escaping (PresentationCloudTheme) -> Void, editCurrentTheme: @escaping () -> Void, createNewTheme: @escaping () -> Void, themeContextAction: @escaping (Bool, PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void, colorContextAction: @escaping (Bool, PresentationThemeReference, ThemeSettingsColorOption?, ASDisplayNode, ContextGesture?) -> Void) { + init(context: AccountContext, selectTheme: @escaping (TelegramBaseTheme?, PresentationThemeReference) -> Void, previewTheme: @escaping (PresentationThemeReference, Bool) -> Void, selectAccentColor: @escaping (TelegramBaseTheme?, PresentationThemeAccentColor?) -> Void, openAccentColorPicker: @escaping (PresentationThemeReference, Bool) -> Void, editTheme: @escaping (PresentationCloudTheme) -> Void, editCurrentTheme: @escaping () -> Void, createNewTheme: @escaping () -> Void, themeContextAction: @escaping (Bool, PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void, colorContextAction: @escaping (Bool, PresentationThemeReference, ThemeSettingsColorOption?, ASDisplayNode, ContextGesture?) -> Void) { self.context = context self.selectTheme = selectTheme self.previewTheme = previewTheme @@ -158,7 +158,7 @@ private enum ThemePickerControllerEntry: ItemListNodeEntry { return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section) case let .themes(theme, strings, themes, currentTheme, nightMode, animatedEmojiStickers): return ThemeGridThemeItem(context: arguments.context, theme: theme, strings: strings, sectionId: self.section, themes: themes, animatedEmojiStickers: animatedEmojiStickers, themeSpecificAccentColors: [:], themeSpecificChatWallpapers: [:], nightMode: nightMode, currentTheme: currentTheme, updatedTheme: { theme in - arguments.previewTheme(theme) + arguments.previewTheme(theme, nightMode) }, contextAction: { theme, node, gesture in arguments.themeContextAction(false, theme, node, gesture) }, tag: nil) @@ -395,8 +395,8 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme let arguments = ThemePickerControllerArguments(context: context, selectTheme: { baseTheme, theme in selectThemeImpl?(baseTheme, theme) - }, previewTheme: { themeReference in - if let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: themeReference) { + }, previewTheme: { themeReference, nightMode in + if let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: themeReference, baseTheme: nightMode ? .night : .classic ) { let controller = ThemePreviewController(context: context, previewTheme: theme, source: .settings(themeReference, nil, false)) pushControllerImpl?(controller) } @@ -426,15 +426,16 @@ public func themePickerController(context: AccountContext, focusOnItemTag: Theme return themeReference } |> deliverOnMainQueue).start(next: { themeReference in - guard case let .cloud(cloudTheme) = themeReference else { - return + if case let .cloud(cloudTheme) = themeReference, cloudTheme.theme.settings?.isEmpty ?? true { + let controller = editThemeController(context: context, mode: .edit(cloudTheme), navigateToChat: { peerId in + if let navigationController = getNavigationControllerImpl?() { + context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peerId))) + } + }) + pushControllerImpl?(controller) + } else { + openAccentColorPickerImpl?(themeReference, false) } - let controller = editThemeController(context: context, mode: .edit(cloudTheme), navigateToChat: { peerId in - if let navigationController = getNavigationControllerImpl?() { - context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peerId))) - } - }) - pushControllerImpl?(controller) }) }, createNewTheme: { let _ = (context.sharedContext.accountManager.transaction { transaction -> PresentationThemeReference in