Merge commit '62b259b4d30e7726b11f107ff5570b58c95773a0'

This commit is contained in:
Ali 2021-11-05 14:05:59 +04:00
commit 3989b4887d
6 changed files with 28 additions and 5 deletions

View File

@ -13,7 +13,7 @@
@property (nonatomic, readonly) bool isAnimation;
@property (nonatomic, readonly) TGMediaAsset *originalAsset;
@property (nonatomic, readonly) CGSize dimensions;
@property (nonatomic, readonly) NSString *uniformTypeIdentifier;
- (instancetype)initWithURL:(NSURL *)url;
- (instancetype)initWithAsset:(TGMediaAsset *)asset livePhoto:(bool)livePhoto;

View File

@ -88,6 +88,11 @@
return _cachedAVAsset;
}
- (NSString *)uniformTypeIdentifier
{
return nil;
}
- (SSignal *)avAsset {
if (_originalAsset != nil) {
if (_cachedAVAsset != nil) {

View File

@ -1107,7 +1107,11 @@
}
else if (self.item.avAsset != nil) {
itemSignal = [self.item.avAsset mapToSignal:^SSignal *(AVAsset *avAsset) {
return [SSignal single:[AVPlayerItem playerItemWithAsset:avAsset]];
if ([avAsset isKindOfClass:[AVAsset class]]) {
return [SSignal single:[AVPlayerItem playerItemWithAsset:avAsset]];
} else {
return [SSignal never];
}
}];
}

View File

@ -108,6 +108,9 @@
+ (SSignal *)convertAVAsset:(AVAsset *)avAsset adjustments:(TGMediaVideoEditAdjustments *)adjustments watcher:(TGMediaVideoFileWatcher *)watcher inhibitAudio:(bool)inhibitAudio entityRenderer:(id<TGPhotoPaintEntityRenderer>)entityRenderer
{
if ([avAsset isKindOfClass:[NSURL class]]) {
avAsset = [[AVURLAsset alloc] initWithURL:(NSURL *)avAsset options:nil];
}
SQueue *queue = [[SQueue alloc] init];
return [[SSignal alloc] initWithGenerator:^id<SDisposable>(SSubscriber *subscriber)

View File

@ -74,10 +74,10 @@ public struct Namespaces {
public static let cachedPollResults: Int8 = 9
public static let cachedContextResults: Int8 = 10
public static let proximityNotificationStoredState: Int8 = 11
public static let cachedPeerInvitationImporters: Int8 = 12
public static let cachedPeerExportedInvitations: Int8 = 13
public static let cachedGroupCallDisplayAsPeers: Int8 = 14
public static let cachedAdMessageStates: Int8 = 15
public static let cachedPeerInvitationImporters: Int8 = 16
public static let cachedPeerExportedInvitations: Int8 = 17
}
public struct UnorderedItemList {

View File

@ -285,18 +285,29 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager<Te
let contactSettings: ContactSynchronizationSettings = transaction.getSharedData(ApplicationSpecificSharedDataKeys.contactSynchronizationSettings)?.get(ContactSynchronizationSettings.self) ?? ContactSynchronizationSettings.defaultSettings
let effectiveTheme: PresentationThemeReference
var preferredBaseTheme: TelegramBaseTheme?
let parameters = AutomaticThemeSwitchParameters(settings: themeSettings.automaticThemeSwitchSetting)
let autoNightModeTriggered: Bool
if automaticThemeShouldSwitchNow(parameters, systemUserInterfaceStyle: systemUserInterfaceStyle) {
effectiveTheme = themeSettings.automaticThemeSwitchSetting.theme
autoNightModeTriggered = true
if let baseTheme = themeSettings.themePreferredBaseTheme[effectiveTheme.index], [.night, .tinted].contains(baseTheme) {
preferredBaseTheme = baseTheme
} else {
preferredBaseTheme = .night
}
} else {
effectiveTheme = themeSettings.theme
autoNightModeTriggered = false
if let baseTheme = themeSettings.themePreferredBaseTheme[effectiveTheme.index], [.classic, .day].contains(baseTheme) {
preferredBaseTheme = baseTheme
}
}
let effectiveColors = themeSettings.themeSpecificAccentColors[effectiveTheme.index]
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: effectiveTheme, accentColor: effectiveColors?.color, bubbleColors: effectiveColors?.customBubbleColors ?? [], baseColor: effectiveColors?.baseColor) ?? defaultPresentationTheme
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: effectiveTheme, baseTheme: preferredBaseTheme, accentColor: effectiveColors?.color, bubbleColors: effectiveColors?.customBubbleColors ?? [], baseColor: effectiveColors?.baseColor) ?? defaultPresentationTheme
let effectiveChatWallpaper: TelegramWallpaper = (themeSettings.themeSpecificChatWallpapers[coloredThemeIndex(reference: effectiveTheme, accentColor: effectiveColors)] ?? themeSettings.themeSpecificChatWallpapers[effectiveTheme.index]) ?? theme.chat.defaultWallpaper