Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions library/Source/Views/VKShareDialogController.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import "VKObject.h"
#import "VKUploadImage.h"

Expand Down Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions library/Source/Views/VKShareDialogController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down