[ios] search category banner review fixes.

This commit is contained in:
Arsentiy Milchakov 2020-11-03 21:12:34 +03:00 committed by Alexander Boriskov
parent 611ad89881
commit 82308265bc
6 changed files with 18 additions and 14 deletions

View file

@ -1,6 +1,6 @@
protocol TaxiViewControllerDelegate: AnyObject {
func didPressOrder()
func didTaxiShown()
func didShowTaxi()
}
class TaxiViewController: UIViewController {
@ -41,7 +41,7 @@ class TaxiViewController: UIViewController {
fatalError()
}
delegate?.didTaxiShown()
delegate?.didShowTaxi()
}
@IBAction func onOrder(_ sender: UIButton) {

View file

@ -73,7 +73,7 @@ extension PlacePageInteractor: TaxiViewControllerDelegate {
MWMPlacePageManagerHelper.orderTaxi(placePageData)
}
func didTaxiShown() {
func didShowTaxi() {
MWMPlacePageManagerHelper.taxiShown(placePageData)
}
}

View file

@ -153,7 +153,7 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type)
[self closePlacePage];
}
- (void)taxiShown:(PlacePageData *)data
- (void)logTaxiShown:(PlacePageData *)data
{
NSString * providerString = [MWMPlacePageManager taxiProviderStatisticsString:data.taxiProvider];
[Statistics logEvent:kStatPlacepageTaxiShow withParameters:@{kStatProvider : providerString}];

View file

@ -17,7 +17,7 @@
- (void)addBusiness;
- (void)addPlace:(CLLocationCoordinate2D)coordinate;
- (void)orderTaxi:(PlacePageData *)data;
- (void)taxiShown:(PlacePageData *)data;
- (void)logTaxiShown:(PlacePageData *)data;
- (void)openLocalAdsURL:(PlacePageData *)data;
- (void)openWebsite:(PlacePageData *)data;
- (void)call:(PlacePageData *)data;
@ -80,7 +80,7 @@
}
+ (void)taxiShown:(PlacePageData *)data {
[[MWMMapViewControlsManager manager].placePageManager taxiShown:data];
[[MWMMapViewControlsManager manager].placePageManager logTaxiShown:data];
}
+ (void)openLocalAdsURL:(PlacePageData *)data {

View file

@ -5,8 +5,8 @@ protocol SearchBannerCellDelegate: AnyObject {
class SearchBannerCell: MWMTableViewCell {
@IBOutlet var iconView: UIImageView!
@IBOutlet weak var labelView: UILabel!
@IBOutlet weak var buttonView: UIButton!
@IBOutlet var labelView: UILabel!
@IBOutlet var buttonView: UIButton!
private weak var delegate: SearchBannerCellDelegate?

View file

@ -65,16 +65,17 @@ final class SearchCategoriesViewController: MWMTableViewController {
}
}
private func bannerStatProvider() -> String {
switch banner!.mwmType {
private func bannerStatProvider(_ bannerType: MWMBannerType) -> String {
switch bannerType {
case .citymobil: return kStatCitymobil
default: return ""
}
}
private func createBanner(_ indexPath: IndexPath) -> UITableViewCell {
guard let banner = banner else { fatalError("Banner must exist") }
let cell = tableView.dequeueReusableCell(cell: SearchBannerCell.self, indexPath: indexPath)
switch self.banner!.mwmType {
switch banner.mwmType {
case .citymobil:
cell.configure(icon: "ic_taxi_logo_citymobil",
label: L("taxi"),
@ -84,17 +85,20 @@ final class SearchCategoriesViewController: MWMTableViewController {
}
if (!bannerShown) {
bannerShown = true;
Statistics.logEvent(kStatSearchSponsoredShow, withParameters: [kStatProvider: bannerStatProvider()]);
let provider = bannerStatProvider(banner.mwmType)
Statistics.logEvent(kStatSearchSponsoredShow, withParameters: [kStatProvider: provider]);
}
return cell
}
private func openBanner() {
if let url = URL(string: banner!.bannerID) {
guard let banner = banner else { fatalError("Banner must exist") }
if let url = URL(string: banner.bannerID) {
UIApplication.shared.open(url)
}
Statistics.logEvent(kStatSearchSponsoredSelect, withParameters: [kStatProvider: bannerStatProvider()]);
let provider = bannerStatProvider(banner.mwmType)
Statistics.logEvent(kStatSearchSponsoredSelect, withParameters: [kStatProvider: provider]);
}
}