diff --git a/library/Source/Views/VKShareDialogController.h b/library/Source/Views/VKShareDialogController.h index 7d2b3553..c7db42dc 100644 --- a/library/Source/Views/VKShareDialogController.h +++ b/library/Source/Views/VKShareDialogController.h @@ -21,6 +21,7 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import +#import #import "VKObject.h" #import "VKUploadImage.h" @@ -59,6 +60,9 @@ typedef NS_ENUM(NSInteger, VKShareDialogControllerResult) { /// Text to share. User can change it @property(nonatomic, copy) NSString *text; +/// Location attachment for new post +@property(nonatomic) CLLocationCoordinate2D *location; + /// Put only needed scopes into that array. By default equals @[VK_PER_WALL,VK_PER_PHOTOS] @property(nonatomic, strong) NSArray *requestedScope; diff --git a/library/Source/Views/VKShareDialogController.m b/library/Source/Views/VKShareDialogController.m index 88562ed6..cc870bdd 100644 --- a/library/Source/Views/VKShareDialogController.m +++ b/library/Source/Views/VKShareDialogController.m @@ -978,6 +978,12 @@ - (void)sendMessage:(id)sender { VKRequest *post = [[VKApi wall] post:@{VK_API_MESSAGE : textView.text ?: @"", VK_API_ATTACHMENTS : [attachStrings componentsJoinedByString:@","]}]; NSMutableArray *exports = [NSMutableArray new]; + if (self.parent.location) { + CLLocationCoordinate2D location = *(self.parent.location); + NSString *latitude = [NSString stringWithFormat:@"%f", location.latitude]; + NSString *longitude = [NSString stringWithFormat:@"%f", location.longitude]; + [post addExtraParameters:@{VK_API_LAT: latitude, VK_API_LONG: longitude}]; + } if (self.postSettings.friendsOnly.boolValue) [post addExtraParameters:@{VK_API_FRIENDS_ONLY : @1}]; if (self.postSettings.exportTwitter.boolValue) [exports addObject:@"twitter"]; if (self.postSettings.exportFacebook.boolValue) [exports addObject:@"facebook"];