forked from organicmaps/organicmaps-tmp
[ios] Fixed bug with bookmark/poi/my position sharing
This commit is contained in:
parent
ecedd34e27
commit
4940b5ad90
6 changed files with 16 additions and 18 deletions
|
@ -100,9 +100,7 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
return;
|
||||
}
|
||||
CLLocationCoordinate2D const coord = location.coordinate;
|
||||
double const gX = MercatorBounds::LonToX(coord.longitude);
|
||||
double const gY = MercatorBounds::LatToY(coord.latitude);
|
||||
ShareInfo * const info = [[ShareInfo alloc] initWithText:nil gX:gX gY:gY myPosition:YES];
|
||||
ShareInfo * const info = [[ShareInfo alloc] initWithText:nil lat:coord.latitude lon:coord.longitude myPosition:YES];
|
||||
self.controller.shareActionSheet = [[ShareActionSheet alloc] initWithInfo:info viewController:self.controller];
|
||||
UIView const * const parentView = self.controller.view;
|
||||
[self.controller.shareActionSheet showFromRect:CGRectMake(parentView.midX, parentView.height - 40.0, 0.0, 0.0)];
|
||||
|
|
|
@ -178,7 +178,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
- (void)share
|
||||
{
|
||||
MWMPlacePageEntity * entity = self.entity;
|
||||
ShareInfo * info = [[ShareInfo alloc] initWithText:entity.title gX:entity.point.x gY:entity.point.y myPosition:NO];
|
||||
ShareInfo * info = [[ShareInfo alloc] initWithText:entity.title lat:entity.point.x lon:entity.point.y myPosition:NO];
|
||||
|
||||
self.actionSheet = [[ShareActionSheet alloc] initWithInfo:info viewController:self.ownerViewController];
|
||||
UIView * parentView = self.ownerViewController.view;
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
@interface ShareInfo : NSObject
|
||||
|
||||
- (instancetype)initWithText:(NSString *)text gX:(double)gX gY:(double)gY myPosition:(BOOL)myPosition;
|
||||
- (instancetype)initWithText:(NSString *)text lat:(double)lat lon:(double)lon myPosition:(BOOL)myPosition;
|
||||
|
||||
@property (nonatomic) NSString * text;
|
||||
@property (nonatomic) double gX;
|
||||
@property (nonatomic) double gY;
|
||||
@property (nonatomic) double lat;
|
||||
@property (nonatomic) double lon;
|
||||
@property (nonatomic) BOOL myPosition;
|
||||
|
||||
@end
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
@implementation ShareInfo
|
||||
|
||||
- (instancetype)initWithText:(NSString *)text gX:(double)gX gY:(double)gY myPosition:(BOOL)myPosition
|
||||
- (instancetype)initWithText:(NSString *)text lat:(double)lat lon:(double)lon myPosition:(BOOL)myPosition
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
self.text = text ? text : @"";
|
||||
self.gX = gX;
|
||||
self.gY = gY;
|
||||
self.lat = lat;
|
||||
self.lon = lon;
|
||||
self.myPosition = myPosition;
|
||||
|
||||
return self;
|
||||
|
@ -62,7 +62,7 @@
|
|||
- (void)actionSheet:(UIActionSheet *)as willDismissWithButtonIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
Framework & f = GetFramework();
|
||||
string const s = f.CodeGe0url(MercatorBounds::YToLat(self.info.gY), MercatorBounds::XToLon(self.info.gX), f.GetDrawScale(), [self.info.text UTF8String]);
|
||||
string const s = f.CodeGe0url(self.info.lat, self.info.lon, f.GetDrawScale(), [self.info.text UTF8String]);
|
||||
NSString * shortUrl = [NSString stringWithUTF8String:s.c_str()];
|
||||
|
||||
if ([[as buttonTitleAtIndex:buttonIndex] isEqualToString:L(@"email")])
|
||||
|
@ -87,7 +87,7 @@
|
|||
if (self.info.myPosition)
|
||||
{
|
||||
search::AddressInfo info;
|
||||
GetFramework().GetAddressInfoForGlobalPoint(m2::PointD(self.info.gX, self.info.gY), info);
|
||||
GetFramework().GetAddressInfoForGlobalPoint(m2::PointD(MercatorBounds::LonToX(self.info.lon), MercatorBounds::LatToY(self.info.lat)), info);
|
||||
NSString * nameAndAddress = [NSString stringWithUTF8String:info.FormatNameAndAddress().c_str()];
|
||||
body = [NSString stringWithFormat:L(@"my_position_share_email"), nameAndAddress, shortUrl, httpGe0Url];
|
||||
subject = L(@"my_position_share_email_subject");
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "ic_email.png"
|
||||
"filename" : "ic_Email.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "ic_email@2x.png"
|
||||
"filename" : "ic_Email@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "ic_email@3x.png"
|
||||
"filename" : "ic_Email@3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "ic_wifi.png"
|
||||
"filename" : "ic_WiFi.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "ic_wifi@2x.png"
|
||||
"filename" : "ic_WiFi@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "ic_wifi@3x.png"
|
||||
"filename" : "ic_WiFi@3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
|
Loading…
Add table
Reference in a new issue