mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-05 04:10:16 +00:00
Merge commit '2ace780b67a5909063c47a8519b67054ae8f1988'
This commit is contained in:
commit
1ba4a0e596
@ -7,7 +7,7 @@
|
|||||||
<key>LegacyComponents.xcscheme</key>
|
<key>LegacyComponents.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>12</integer>
|
<integer>0</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SuppressBuildableAutocreation</key>
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
@ -2165,7 +2165,9 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
|||||||
{
|
{
|
||||||
case PGCameraModeVideo:
|
case PGCameraModeVideo:
|
||||||
{
|
{
|
||||||
if (widescreenWidth == 812.0f)
|
if (widescreenWidth == 896.0f)
|
||||||
|
return CGRectMake(0, 77, screenSize.width, screenSize.height - 77 - 83);
|
||||||
|
else if (widescreenWidth == 812.0f)
|
||||||
return CGRectMake(0, 77, screenSize.width, screenSize.height - 77 - 68);
|
return CGRectMake(0, 77, screenSize.width, screenSize.height - 77 - 68);
|
||||||
else
|
else
|
||||||
return CGRectMake(0, 0, screenSize.width, screenSize.height);
|
return CGRectMake(0, 0, screenSize.width, screenSize.height);
|
||||||
@ -2187,9 +2189,11 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (widescreenWidth == 812.0f)
|
if (widescreenWidth == 896.0f)
|
||||||
|
return CGRectMake(0, 121, screenSize.width, screenSize.height - 121 - 223);
|
||||||
|
else if (widescreenWidth == 812.0f)
|
||||||
return CGRectMake(0, 121, screenSize.width, screenSize.height - 121 - 191);
|
return CGRectMake(0, 121, screenSize.width, screenSize.height - 121 - 191);
|
||||||
if (widescreenWidth >= 736.0f - FLT_EPSILON)
|
else if (widescreenWidth >= 736.0f - FLT_EPSILON)
|
||||||
return CGRectMake(0, 44, screenSize.width, screenSize.height - 50 - 136);
|
return CGRectMake(0, 44, screenSize.width, screenSize.height - 50 - 136);
|
||||||
else if (widescreenWidth >= 667.0f - FLT_EPSILON)
|
else if (widescreenWidth >= 667.0f - FLT_EPSILON)
|
||||||
return CGRectMake(0, 44, screenSize.width, screenSize.height - 44 - 123);
|
return CGRectMake(0, 44, screenSize.width, screenSize.height - 44 - 123);
|
||||||
|
@ -110,7 +110,18 @@
|
|||||||
CGFloat shutterButtonWidth = 66.0f;
|
CGFloat shutterButtonWidth = 66.0f;
|
||||||
CGSize screenSize = TGScreenSize();
|
CGSize screenSize = TGScreenSize();
|
||||||
CGFloat widescreenWidth = MAX(screenSize.width, screenSize.height);
|
CGFloat widescreenWidth = MAX(screenSize.width, screenSize.height);
|
||||||
if (widescreenWidth == 812.0f)
|
if (widescreenWidth == 896.0f)
|
||||||
|
{
|
||||||
|
_topPanelOffset = 33.0f;
|
||||||
|
_topPanelHeight = 44.0f;
|
||||||
|
_bottomPanelOffset = 94.0f;
|
||||||
|
_bottomPanelHeight = 123.0f;
|
||||||
|
_modeControlOffset = 0.0f;
|
||||||
|
_modeControlHeight = 52.0f;
|
||||||
|
_counterOffset = 7.0f;
|
||||||
|
shutterButtonWidth = 72.0f;
|
||||||
|
}
|
||||||
|
else if (widescreenWidth == 812.0f)
|
||||||
{
|
{
|
||||||
_topPanelOffset = 33.0f;
|
_topPanelOffset = 33.0f;
|
||||||
_topPanelHeight = 44.0f;
|
_topPanelHeight = 44.0f;
|
||||||
|
@ -16,5 +16,6 @@
|
|||||||
@property (nonatomic, readonly) NSString *street;
|
@property (nonatomic, readonly) NSString *street;
|
||||||
|
|
||||||
+ (TGLocationReverseGeocodeResult *)reverseGeocodeResultWithDictionary:(NSDictionary *)dictionary;
|
+ (TGLocationReverseGeocodeResult *)reverseGeocodeResultWithDictionary:(NSDictionary *)dictionary;
|
||||||
|
+ (TGLocationReverseGeocodeResult *)reverseGeocodeResultWithPlacemark:(CLPlacemark *)placemark;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -44,6 +44,20 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (TGLocationReverseGeocodeResult *)reverseGeocodeResultWithPlacemark:(CLPlacemark *)placemark
|
||||||
|
{
|
||||||
|
TGLocationReverseGeocodeResult *result = [[TGLocationReverseGeocodeResult alloc] init];
|
||||||
|
result->_country = placemark.country;
|
||||||
|
result->_countryAbbr = placemark.ISOcountryCode;
|
||||||
|
result->_city = placemark.locality;
|
||||||
|
result->_district = placemark.subLocality;
|
||||||
|
result->_street = placemark.thoroughfare;
|
||||||
|
if (placemark.name.length > 0 && result->_street.length == 0) {
|
||||||
|
result->_street = placemark.name;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)displayAddress
|
- (NSString *)displayAddress
|
||||||
{
|
{
|
||||||
if (self.street.length > 0)
|
if (self.street.length > 0)
|
||||||
|
@ -132,21 +132,27 @@ NSString *const TGLocationGoogleGeocodeLocale = @"en";
|
|||||||
|
|
||||||
+ (SSignal *)reverseGeocodeCoordinate:(CLLocationCoordinate2D)coordinate
|
+ (SSignal *)reverseGeocodeCoordinate:(CLLocationCoordinate2D)coordinate
|
||||||
{
|
{
|
||||||
NSURL *url = [NSURL URLWithString:[[NSString alloc] initWithFormat:@"https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&sensor=true&language=%@", coordinate.latitude, coordinate.longitude, TGLocationGoogleGeocodeLocale]];
|
return [[SSignal alloc] initWithGenerator:^id<SDisposable>(SSubscriber *subscriber)
|
||||||
|
|
||||||
return [[[LegacyComponentsGlobals provider] jsonForHttpLocation:url.absoluteString] map:^id(id json)
|
|
||||||
{
|
{
|
||||||
if (![json respondsToSelector:@selector(objectForKey:)])
|
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
|
||||||
return nil;
|
[geocoder reverseGeocodeLocation:[[CLLocation alloc] initWithLatitude:coordinate.latitude longitude:coordinate.longitude] completionHandler:^(NSArray *placemarks, NSError *error)
|
||||||
|
{
|
||||||
|
if (error != nil)
|
||||||
|
{
|
||||||
|
[subscriber putError:error];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[subscriber putNext:[TGLocationReverseGeocodeResult reverseGeocodeResultWithPlacemark:placemarks.firstObject]];
|
||||||
|
[subscriber putCompletion];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
NSArray *results = json[@"results"];
|
return [[SBlockDisposable alloc] initWithBlock:^
|
||||||
if (![results respondsToSelector:@selector(objectAtIndex:)])
|
{
|
||||||
return nil;
|
[geocoder cancelGeocode];
|
||||||
|
}];
|
||||||
if (![results.firstObject isKindOfClass:[NSDictionary class]])
|
|
||||||
return nil;
|
|
||||||
|
|
||||||
return [TGLocationReverseGeocodeResult reverseGeocodeResultWithDictionary:results.firstObject];
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,8 +359,8 @@
|
|||||||
|
|
||||||
_showCallStatusBar = showCallStatusBar;
|
_showCallStatusBar = showCallStatusBar;
|
||||||
|
|
||||||
|
int screenHeight = (int)TGScreenSize().height;
|
||||||
CGFloat statusBarHeight = (int)TGScreenSize().height == 812 ? 0.0f : 20.0f;
|
CGFloat statusBarHeight = (screenHeight == 812 || screenHeight == 896) ? 0.0f : 20.0f;
|
||||||
|
|
||||||
_currentAdditionalStatusBarHeight = _showCallStatusBar ? statusBarHeight : 0.0f;
|
_currentAdditionalStatusBarHeight = _showCallStatusBar ? statusBarHeight : 0.0f;
|
||||||
[(TGNavigationBar *)self.navigationBar setVerticalOffset:_currentAdditionalStatusBarHeight];
|
[(TGNavigationBar *)self.navigationBar setVerticalOffset:_currentAdditionalStatusBarHeight];
|
||||||
|
@ -268,6 +268,7 @@ NSString *const TGPassportEmptyCharacter = @"<";
|
|||||||
dispatch_once(&onceToken, ^
|
dispatch_once(&onceToken, ^
|
||||||
{
|
{
|
||||||
dateFormatter = [[NSDateFormatter alloc] init];
|
dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
|
dateFormatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
|
||||||
dateFormatter.dateFormat = @"YYMMdd";
|
dateFormatter.dateFormat = @"YYMMdd";
|
||||||
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
|
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
|
||||||
});
|
});
|
||||||
|
@ -149,6 +149,11 @@
|
|||||||
simpleButtonInsetHorizontal = 26.0f;
|
simpleButtonInsetHorizontal = 26.0f;
|
||||||
simpleButtonInsetVertical = 21.0f;
|
simpleButtonInsetVertical = 21.0f;
|
||||||
}
|
}
|
||||||
|
else if ((int)screenSize.height == 896)
|
||||||
|
{
|
||||||
|
simpleButtonInsetHorizontal = 54.0f;
|
||||||
|
simpleButtonInsetVertical = 67.0f;
|
||||||
|
}
|
||||||
else if ((int)screenSize.height == 812)
|
else if ((int)screenSize.height == 812)
|
||||||
{
|
{
|
||||||
simpleButtonInsetHorizontal = 54.0f;
|
simpleButtonInsetHorizontal = 54.0f;
|
||||||
@ -528,12 +533,21 @@
|
|||||||
pinOffset = 89.0f;
|
pinOffset = 89.0f;
|
||||||
infoOffset = 7.0f;
|
infoOffset = 7.0f;
|
||||||
}
|
}
|
||||||
|
else if ((int)screenSize.height == 896)
|
||||||
|
{
|
||||||
|
keyboardOffset = 330.0f;
|
||||||
|
titleOffset = 116.0f;
|
||||||
|
pinOffset = 79.0f + TGScreenPixel;
|
||||||
|
infoOffset = 6.0f - TGScreenPixel;
|
||||||
|
topOffset = 44.0f;
|
||||||
|
bottomOffset = 34.0f;
|
||||||
|
}
|
||||||
else if ((int)screenSize.height == 812)
|
else if ((int)screenSize.height == 812)
|
||||||
{
|
{
|
||||||
keyboardOffset = 300.0f;
|
keyboardOffset = 300.0f;
|
||||||
titleOffset = 116.0f;
|
titleOffset = 116.0f;
|
||||||
pinOffset = 79.0f + TGRetinaPixel;
|
pinOffset = 79.0f + TGScreenPixel;
|
||||||
infoOffset = 6.0f - TGRetinaPixel;
|
infoOffset = 6.0f - TGScreenPixel;
|
||||||
topOffset = 44.0f;
|
topOffset = 44.0f;
|
||||||
bottomOffset = 34.0f;
|
bottomOffset = 34.0f;
|
||||||
}
|
}
|
||||||
@ -541,20 +555,20 @@
|
|||||||
{
|
{
|
||||||
keyboardOffset = 246.0f;
|
keyboardOffset = 246.0f;
|
||||||
titleOffset = 112.0f;
|
titleOffset = 112.0f;
|
||||||
pinOffset = 79.0f + TGRetinaPixel;
|
pinOffset = 79.0f + TGScreenPixel;
|
||||||
infoOffset = 6.0f - TGRetinaPixel;
|
infoOffset = 6.0f - TGScreenPixel;
|
||||||
}
|
}
|
||||||
else if ((int)screenSize.height == 667)
|
else if ((int)screenSize.height == 667)
|
||||||
{
|
{
|
||||||
keyboardOffset = 206.0f;
|
keyboardOffset = 206.0f;
|
||||||
titleOffset = 112.0f;
|
titleOffset = 112.0f;
|
||||||
pinOffset = 79.0f + TGRetinaPixel;
|
pinOffset = 79.0f + TGScreenPixel;
|
||||||
infoOffset = 6.0f - TGRetinaPixel;
|
infoOffset = 6.0f - TGScreenPixel;
|
||||||
}
|
}
|
||||||
else if ((int)screenSize.height == 568)
|
else if ((int)screenSize.height == 568)
|
||||||
{
|
{
|
||||||
keyboardOffset = 163.0f;
|
keyboardOffset = 163.0f;
|
||||||
titleOffset = 98.0f - TGRetinaPixel;
|
titleOffset = 98.0f - TGScreenPixel;
|
||||||
pinOffset = 72.0f;
|
pinOffset = 72.0f;
|
||||||
infoOffset = 0.0f;
|
infoOffset = 0.0f;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user