[ios] Add social media contacts to placepage

Signed-off-by: David Martinez <47610359+dvdmrtnz@users.noreply.github.com>
This commit is contained in:
David Martinez 2022-07-23 15:17:41 +02:00 committed by Viktor Govako
parent bec4e9d56b
commit 7966137271
23 changed files with 208 additions and 0 deletions

View file

@ -11,6 +11,10 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly, nullable) NSString *phone;
@property(nonatomic, readonly, nullable) NSURL *phoneUrl;
@property(nonatomic, readonly, nullable) NSString *website;
@property(nonatomic, readonly, nullable) NSString *facebook;
@property(nonatomic, readonly, nullable) NSString *instagram;
@property(nonatomic, readonly, nullable) NSString *twitter;
@property(nonatomic, readonly, nullable) NSString *vk;
@property(nonatomic, readonly, nullable) NSString *email;
@property(nonatomic, readonly, nullable) NSString *cuisine;
@property(nonatomic, readonly, nullable) NSString *ppOperator;

View file

@ -41,6 +41,18 @@ using namespace osm;
case Props::Email:
_email = ToNSString(rawData.GetEmail());
break;
case Props::ContactFacebook:
_facebook = ToNSString(rawData.GetFacebookPage());
break;
case Props::ContactInstagram:
_instagram = ToNSString(rawData.GetInstagramPage());
break;
case Props::ContactTwitter:
_twitter = ToNSString(rawData.GetTwitterPage());
break;
case Props::ContactVk:
_vk = ToNSString(rawData.GetVkPage());
break;
case Props::Cuisine:
_cuisine = @(strings::JoinStrings(rawData.GetLocalizedCuisines(), Info::kSubtitleSeparator).c_str());
break;

View file

@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "ic_placepage_facebook.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_placepage_facebook@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_placepage_facebook@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "ic_placepage_instagram.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_placepage_instagram@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_placepage_instagram@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "ic_placepage_twitter.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_placepage_twitter@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_placepage_twitter@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "ic_placepage_vk.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_placepage_vk@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_placepage_vk@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -52,6 +52,10 @@ class InfoItemViewController: UIViewController {
protocol PlacePageInfoViewControllerDelegate: AnyObject {
func didPressCall()
func didPressWebsite()
func didPressFacebook()
func didPressInstagram()
func didPressTwitter()
func didPressVk()
func didPressEmail()
}
@ -72,6 +76,10 @@ class PlacePageInfoViewController: UIViewController {
private var phoneView: InfoItemViewController?
private var websiteView: InfoItemViewController?
private var emailView: InfoItemViewController?
private var facebookView: InfoItemViewController?
private var instagramView: InfoItemViewController?
private var twitterView: InfoItemViewController?
private var vkView: InfoItemViewController?
private var cuisineView: InfoItemViewController?
private var operatorView: InfoItemViewController?
private var wifiView: InfoItemViewController?
@ -122,6 +130,30 @@ class PlacePageInfoViewController: UIViewController {
self?.delegate?.didPressEmail()
}
}
if let facebook = placePageInfoData.facebook {
facebookView = createInfoItem(facebook, icon: UIImage(named: "ic_placepage_facebook"), style: .link) { [weak self] in
self?.delegate?.didPressFacebook()
}
}
if let instagram = placePageInfoData.instagram {
instagramView = createInfoItem(instagram, icon: UIImage(named: "ic_placepage_instagram"), style: .link) { [weak self] in
self?.delegate?.didPressInstagram()
}
}
if let twitter = placePageInfoData.twitter {
twitterView = createInfoItem(twitter, icon: UIImage(named: "ic_placepage_twitter"), style: .link) { [weak self] in
self?.delegate?.didPressTwitter()
}
}
if let vk = placePageInfoData.vk {
vkView = createInfoItem(vk, icon: UIImage(named: "ic_placepage_vk"), style: .link) { [weak self] in
self?.delegate?.didPressVk()
}
}
if let cuisine = placePageInfoData.cuisine {
cuisineView = createInfoItem(cuisine, icon: UIImage(named: "ic_placepage_cuisine"))

View file

@ -32,7 +32,23 @@ extension PlacePageInteractor: PlacePageInfoViewControllerDelegate {
func didPressWebsite() {
MWMPlacePageManagerHelper.openWebsite(placePageData)
}
func didPressFacebook() {
MWMPlacePageManagerHelper.openFacebook(placePageData)
}
func didPressInstagram() {
MWMPlacePageManagerHelper.openInstagram(placePageData)
}
func didPressTwitter() {
MWMPlacePageManagerHelper.openTwitter(placePageData)
}
func didPressVk() {
MWMPlacePageManagerHelper.openVk(placePageData)
}
func didPressEmail() {
}

View file

@ -229,6 +229,22 @@ using namespace storage;
[self.ownerViewController openUrl:data.infoData.website];
}
- (void)openFacebook:(PlacePageData *)data {
[self.ownerViewController openUrl:[NSString stringWithFormat:@"https://m.facebook.com/%@", data.infoData.facebook]];
}
- (void)openInstagram:(PlacePageData *)data {
[self.ownerViewController openUrl:[NSString stringWithFormat:@"https://instagram.com/%@", data.infoData.instagram]];
}
- (void)openTwitter:(PlacePageData *)data {
[self.ownerViewController openUrl:[NSString stringWithFormat:@"https://mobile.twitter.com/%@", data.infoData.twitter]];
}
- (void)openVk:(PlacePageData *)data {
[self.ownerViewController openUrl:[NSString stringWithFormat:@"https://vk.com/%@", data.infoData.vk]];
}
- (void)openElevationDifficultPopup:(PlacePageData *)data {
auto difficultyPopup = [ElevationDetailsBuilder buildWithData:data];
[[MapViewController sharedController] presentViewController:difficultyPopup animated:YES completion:nil];

View file

@ -8,6 +8,10 @@
+ (void)addBusiness;
+ (void)addPlace:(CLLocationCoordinate2D)coordinate;
+ (void)openWebsite:(PlacePageData *)data;
+ (void)openFacebook:(PlacePageData *)data;
+ (void)openInstagram:(PlacePageData *)data;
+ (void)openTwitter:(PlacePageData *)data;
+ (void)openVk:(PlacePageData *)data;
+ (void)call:(PlacePageData *)data;
+ (void)showAllFacilities:(PlacePageData *)data;
+ (void)showPlaceDescription:(NSString *)htmlString;

View file

@ -15,6 +15,10 @@
- (void)addBusiness;
- (void)addPlace:(CLLocationCoordinate2D)coordinate;
- (void)openWebsite:(PlacePageData *)data;
- (void)openFacebook:(PlacePageData *)data;
- (void)openInstagram:(PlacePageData *)data;
- (void)openTwitter:(PlacePageData *)data;
- (void)openVk:(PlacePageData *)data;
- (void)call:(PlacePageData *)data;
- (void)showAllFacilities:(PlacePageData *)data;
- (void)showPlaceDescription:(NSString *)htmlString;
@ -63,6 +67,22 @@
[[MWMMapViewControlsManager manager].placePageManager openWebsite:data];
}
+ (void)openFacebook:(PlacePageData *)data {
[[MWMMapViewControlsManager manager].placePageManager openFacebook:data];
}
+ (void)openInstagram:(PlacePageData *)data {
[[MWMMapViewControlsManager manager].placePageManager openInstagram:data];
}
+ (void)openTwitter:(PlacePageData *)data {
[[MWMMapViewControlsManager manager].placePageManager openTwitter:data];
}
+ (void)openVk:(PlacePageData *)data {
[[MWMMapViewControlsManager manager].placePageManager openVk:data];
}
+ (void)call:(PlacePageData *)data {
[[MWMMapViewControlsManager manager].placePageManager call:data];
}