diff --git a/LegacyComponents.xcodeproj/xcuserdata/ilya.xcuserdatad/xcschemes/xcschememanagement.plist b/LegacyComponents.xcodeproj/xcuserdata/ilya.xcuserdatad/xcschemes/xcschememanagement.plist index a7666f2142..670370130b 100644 --- a/LegacyComponents.xcodeproj/xcuserdata/ilya.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/LegacyComponents.xcodeproj/xcuserdata/ilya.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ LegacyComponents.xcscheme orderHint - 12 + 0 SuppressBuildableAutocreation diff --git a/LegacyComponents/TGCameraController.m b/LegacyComponents/TGCameraController.m index 5bd3734239..a87c888b5d 100644 --- a/LegacyComponents/TGCameraController.m +++ b/LegacyComponents/TGCameraController.m @@ -2165,7 +2165,9 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus { 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); else return CGRectMake(0, 0, screenSize.width, screenSize.height); @@ -2187,9 +2189,11 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus 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); - if (widescreenWidth >= 736.0f - FLT_EPSILON) + else if (widescreenWidth >= 736.0f - FLT_EPSILON) return CGRectMake(0, 44, screenSize.width, screenSize.height - 50 - 136); else if (widescreenWidth >= 667.0f - FLT_EPSILON) return CGRectMake(0, 44, screenSize.width, screenSize.height - 44 - 123); diff --git a/LegacyComponents/TGCameraMainPhoneView.m b/LegacyComponents/TGCameraMainPhoneView.m index 1aa521df3a..8530d6870d 100644 --- a/LegacyComponents/TGCameraMainPhoneView.m +++ b/LegacyComponents/TGCameraMainPhoneView.m @@ -110,7 +110,18 @@ CGFloat shutterButtonWidth = 66.0f; CGSize screenSize = TGScreenSize(); 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; _topPanelHeight = 44.0f; diff --git a/LegacyComponents/TGLocationReverseGeocodeResult.h b/LegacyComponents/TGLocationReverseGeocodeResult.h index bc1b730f6f..b3aba81dbc 100644 --- a/LegacyComponents/TGLocationReverseGeocodeResult.h +++ b/LegacyComponents/TGLocationReverseGeocodeResult.h @@ -16,5 +16,6 @@ @property (nonatomic, readonly) NSString *street; + (TGLocationReverseGeocodeResult *)reverseGeocodeResultWithDictionary:(NSDictionary *)dictionary; ++ (TGLocationReverseGeocodeResult *)reverseGeocodeResultWithPlacemark:(CLPlacemark *)placemark; @end diff --git a/LegacyComponents/TGLocationReverseGeocodeResult.m b/LegacyComponents/TGLocationReverseGeocodeResult.m index a528f0d826..bcb0edce7e 100644 --- a/LegacyComponents/TGLocationReverseGeocodeResult.m +++ b/LegacyComponents/TGLocationReverseGeocodeResult.m @@ -44,6 +44,20 @@ 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 { if (self.street.length > 0) @@ -56,4 +70,4 @@ return nil; } -@end \ No newline at end of file +@end diff --git a/LegacyComponents/TGLocationSignals.m b/LegacyComponents/TGLocationSignals.m index 9956546138..46b631dba4 100644 --- a/LegacyComponents/TGLocationSignals.m +++ b/LegacyComponents/TGLocationSignals.m @@ -132,21 +132,27 @@ NSString *const TGLocationGoogleGeocodeLocale = @"en"; + (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 [[[LegacyComponentsGlobals provider] jsonForHttpLocation:url.absoluteString] map:^id(id json) + return [[SSignal alloc] initWithGenerator:^id(SSubscriber *subscriber) { - if (![json respondsToSelector:@selector(objectForKey:)]) - return nil; + CLGeocoder *geocoder = [[CLGeocoder alloc] init]; + [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"]; - if (![results respondsToSelector:@selector(objectAtIndex:)]) - return nil; - - if (![results.firstObject isKindOfClass:[NSDictionary class]]) - return nil; - - return [TGLocationReverseGeocodeResult reverseGeocodeResultWithDictionary:results.firstObject]; + return [[SBlockDisposable alloc] initWithBlock:^ + { + [geocoder cancelGeocode]; + }]; }]; } diff --git a/LegacyComponents/TGNavigationController.m b/LegacyComponents/TGNavigationController.m index fbe49578f6..481769c272 100644 --- a/LegacyComponents/TGNavigationController.m +++ b/LegacyComponents/TGNavigationController.m @@ -359,8 +359,8 @@ _showCallStatusBar = showCallStatusBar; - - CGFloat statusBarHeight = (int)TGScreenSize().height == 812 ? 0.0f : 20.0f; + int screenHeight = (int)TGScreenSize().height; + CGFloat statusBarHeight = (screenHeight == 812 || screenHeight == 896) ? 0.0f : 20.0f; _currentAdditionalStatusBarHeight = _showCallStatusBar ? statusBarHeight : 0.0f; [(TGNavigationBar *)self.navigationBar setVerticalOffset:_currentAdditionalStatusBarHeight]; diff --git a/LegacyComponents/TGPassportMRZ.m b/LegacyComponents/TGPassportMRZ.m index 5bbf87d812..1e21717c5e 100644 --- a/LegacyComponents/TGPassportMRZ.m +++ b/LegacyComponents/TGPassportMRZ.m @@ -268,6 +268,7 @@ NSString *const TGPassportEmptyCharacter = @"<"; dispatch_once(&onceToken, ^ { dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; dateFormatter.dateFormat = @"YYMMdd"; dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; }); diff --git a/LegacyComponents/TGPasswordEntryView.m b/LegacyComponents/TGPasswordEntryView.m index dea7d231a4..881a48a002 100644 --- a/LegacyComponents/TGPasswordEntryView.m +++ b/LegacyComponents/TGPasswordEntryView.m @@ -149,6 +149,11 @@ simpleButtonInsetHorizontal = 26.0f; simpleButtonInsetVertical = 21.0f; } + else if ((int)screenSize.height == 896) + { + simpleButtonInsetHorizontal = 54.0f; + simpleButtonInsetVertical = 67.0f; + } else if ((int)screenSize.height == 812) { simpleButtonInsetHorizontal = 54.0f; @@ -528,12 +533,21 @@ pinOffset = 89.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) { keyboardOffset = 300.0f; titleOffset = 116.0f; - pinOffset = 79.0f + TGRetinaPixel; - infoOffset = 6.0f - TGRetinaPixel; + pinOffset = 79.0f + TGScreenPixel; + infoOffset = 6.0f - TGScreenPixel; topOffset = 44.0f; bottomOffset = 34.0f; } @@ -541,20 +555,20 @@ { keyboardOffset = 246.0f; titleOffset = 112.0f; - pinOffset = 79.0f + TGRetinaPixel; - infoOffset = 6.0f - TGRetinaPixel; + pinOffset = 79.0f + TGScreenPixel; + infoOffset = 6.0f - TGScreenPixel; } else if ((int)screenSize.height == 667) { keyboardOffset = 206.0f; titleOffset = 112.0f; - pinOffset = 79.0f + TGRetinaPixel; - infoOffset = 6.0f - TGRetinaPixel; + pinOffset = 79.0f + TGScreenPixel; + infoOffset = 6.0f - TGScreenPixel; } else if ((int)screenSize.height == 568) { keyboardOffset = 163.0f; - titleOffset = 98.0f - TGRetinaPixel; + titleOffset = 98.0f - TGScreenPixel; pinOffset = 72.0f; infoOffset = 0.0f; }