mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-15 18:59:54 +00:00
[ASEnvironmentTraitCollection] default user interface idiom to UIUserInterfaceIdiomUnspecified (#1998)
* [ASEnvironmentTraitCollection] default user interface idiom to ASEnvironmentTraitCollection UIUserInterfaceIdiomUnspecified is -1 so we were actually defaulting our trait collection to UIUserInterfaceIdiomPhone (which is 0). * Fix a few places where we weren’t using the default method to create the base traits
This commit is contained in:
parent
95bf8bbe1f
commit
f0b1f12160
@ -1848,7 +1848,9 @@ static NSInteger incrementIfFound(NSInteger i) {
|
||||
}
|
||||
|
||||
// now that we have a supernode, propagate its traits to self.
|
||||
ASEnvironmentStatePropagateDown(self, [newSupernode environmentTraitCollection]);
|
||||
if (newSupernode != nil) {
|
||||
ASEnvironmentStatePropagateDown(self, [newSupernode environmentTraitCollection]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ typedef struct ASEnvironmentLayoutOptionsState {
|
||||
|
||||
struct ASEnvironmentStateExtensions _extensions;
|
||||
} ASEnvironmentLayoutOptionsState;
|
||||
extern ASEnvironmentLayoutOptionsState ASEnvironmentLayoutOptionsStateMakeDefault();
|
||||
|
||||
|
||||
#pragma mark - ASEnvironmentHierarchyState
|
||||
@ -60,6 +61,7 @@ typedef struct ASEnvironmentHierarchyState {
|
||||
unsigned transitioningSupernodes:1; // = NO
|
||||
unsigned layoutPending:1; // = NO
|
||||
} ASEnvironmentHierarchyState;
|
||||
extern ASEnvironmentHierarchyState ASEnvironmentHierarchyStateMakeDefault();
|
||||
|
||||
#pragma mark - ASEnvironmentDisplayTraits
|
||||
|
||||
@ -72,6 +74,7 @@ typedef struct ASEnvironmentTraitCollection {
|
||||
|
||||
CGSize containerSize;
|
||||
} ASEnvironmentTraitCollection;
|
||||
extern ASEnvironmentTraitCollection ASEnvironmentTraitCollectionMakeDefault();
|
||||
|
||||
extern ASEnvironmentTraitCollection ASEnvironmentTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection);
|
||||
extern BOOL ASEnvironmentTraitCollectionIsEqualToASEnvironmentTraitCollection(ASEnvironmentTraitCollection lhs, ASEnvironmentTraitCollection rhs);
|
||||
|
||||
@ -11,24 +11,25 @@
|
||||
#import "ASEnvironmentInternal.h"
|
||||
#import "ASAvailability.h"
|
||||
|
||||
ASEnvironmentLayoutOptionsState _ASEnvironmentLayoutOptionsStateMakeDefault()
|
||||
ASEnvironmentLayoutOptionsState ASEnvironmentLayoutOptionsStateMakeDefault()
|
||||
{
|
||||
return (ASEnvironmentLayoutOptionsState) {
|
||||
// Default values can be defined in here
|
||||
};
|
||||
}
|
||||
|
||||
ASEnvironmentHierarchyState _ASEnvironmentHierarchyStateMakeDefault()
|
||||
ASEnvironmentHierarchyState ASEnvironmentHierarchyStateMakeDefault()
|
||||
{
|
||||
return (ASEnvironmentHierarchyState) {
|
||||
// Default values can be defined in here
|
||||
};
|
||||
}
|
||||
|
||||
ASEnvironmentTraitCollection _ASEnvironmentTraitCollectionMakeDefault()
|
||||
ASEnvironmentTraitCollection ASEnvironmentTraitCollectionMakeDefault()
|
||||
{
|
||||
return (ASEnvironmentTraitCollection) {
|
||||
// Default values can be defined in here
|
||||
.userInterfaceIdiom = UIUserInterfaceIdiomUnspecified,
|
||||
.containerSize = CGSizeZero,
|
||||
};
|
||||
}
|
||||
@ -62,9 +63,9 @@ BOOL ASEnvironmentTraitCollectionIsEqualToASEnvironmentTraitCollection(ASEnviron
|
||||
ASEnvironmentState ASEnvironmentStateMakeDefault()
|
||||
{
|
||||
return (ASEnvironmentState) {
|
||||
.layoutOptionsState = _ASEnvironmentLayoutOptionsStateMakeDefault(),
|
||||
.hierarchyState = _ASEnvironmentHierarchyStateMakeDefault(),
|
||||
.environmentTraitCollection = _ASEnvironmentTraitCollectionMakeDefault()
|
||||
.layoutOptionsState = ASEnvironmentLayoutOptionsStateMakeDefault(),
|
||||
.hierarchyState = ASEnvironmentHierarchyStateMakeDefault(),
|
||||
.environmentTraitCollection = ASEnvironmentTraitCollectionMakeDefault()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -43,13 +43,13 @@ enum class ASEnvironmentStatePropagation { DOWN, UP };
|
||||
|
||||
static const struct ASEnvironmentStateExtensions ASEnvironmentDefaultStateExtensions = {};
|
||||
|
||||
static const struct ASEnvironmentLayoutOptionsState ASEnvironmentDefaultLayoutOptionsState = {};
|
||||
static const struct ASEnvironmentLayoutOptionsState ASEnvironmentDefaultLayoutOptionsState = ASEnvironmentLayoutOptionsStateMakeDefault();
|
||||
ASEnvironmentState ASEnvironmentMergeObjectAndState(ASEnvironmentState environmentState, ASEnvironmentLayoutOptionsState state, ASEnvironmentStatePropagation propagation);
|
||||
|
||||
static const struct ASEnvironmentHierarchyState ASEnvironmentDefaultHierarchyState = {};
|
||||
static const struct ASEnvironmentHierarchyState ASEnvironmentDefaultHierarchyState = ASEnvironmentHierarchyStateMakeDefault();
|
||||
ASEnvironmentState ASEnvironmentMergeObjectAndState(ASEnvironmentState environmentState, ASEnvironmentHierarchyState state, ASEnvironmentStatePropagation propagation);
|
||||
|
||||
static const struct ASEnvironmentTraitCollection ASEnvironmentDefaultTraitCollection = {};
|
||||
static const struct ASEnvironmentTraitCollection ASEnvironmentDefaultTraitCollection = ASEnvironmentTraitCollectionMakeDefault();
|
||||
ASEnvironmentState ASEnvironmentMergeObjectAndState(ASEnvironmentState environmentState, ASEnvironmentTraitCollection state, ASEnvironmentStatePropagation propagation);
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user