[iOS] Drop products features on the place page

Signed-off-by: Jean-Baptiste Charron <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
Jean-Baptiste
2025-07-06 13:15:14 +02:00
committed by Yannik Bloscheck
parent 9a759229f9
commit 3abf354099
61 changed files with 1 additions and 682 deletions

View File

@@ -9,13 +9,6 @@
typedef NS_ENUM(NSUInteger, MWMZoomMode) { MWMZoomModeIn = 0, MWMZoomModeOut };
typedef NS_ENUM(NSInteger, ProductsPopupCloseReason) {
ProductsPopupCloseReasonClose,
ProductsPopupCloseReasonSelectProduct,
ProductsPopupCloseReasonAlreadyDonated,
ProductsPopupCloseReasonRemindLater
};
NS_ASSUME_NONNULL_BEGIN
typedef void (^SearchInDownloaderCompletions)(NSArray<MWMMapSearchResult *> *results, BOOL finished);
@@ -35,19 +28,8 @@ typedef void (^TrackRecordingUpdatedHandler)(TrackInfo * _Nonnull trackInfo);
@end
@class ProductsConfiguration;
@class Product;
@protocol ProductsManager <NSObject>
+ (nullable ProductsConfiguration *)getProductsConfiguration;
+ (void)didCloseProductsPopupWithReason:(ProductsPopupCloseReason)reason;
+ (void)didSelectProduct:(Product *)product;
@end
NS_SWIFT_NAME(FrameworkHelper)
@interface MWMFrameworkHelper : NSObject<TrackRecorder, ProductsManager>
@interface MWMFrameworkHelper : NSObject<TrackRecorder>
+ (void)processFirstLaunch:(BOOL)hasLocation;
+ (void)setVisibleViewport:(CGRect)rect scaleFactor:(CGFloat)scale;

View File

@@ -1,7 +1,5 @@
#import "MWMFrameworkHelper.h"
#import "MWMMapSearchResult+Core.h"
#import "ProductsConfiguration+Core.h"
#import "Product+Core.h"
#import "TrackInfo+Core.h"
#import "ElevationProfileData+Core.h"
@@ -12,19 +10,6 @@
#include "platform/local_country_file_utils.hpp"
#include "platform/network_policy_ios.h"
static Framework::ProductsPopupCloseReason ConvertProductPopupCloseReasonToCore(ProductsPopupCloseReason reason) {
switch (reason) {
case ProductsPopupCloseReasonClose:
return Framework::ProductsPopupCloseReason::Close;
case ProductsPopupCloseReasonSelectProduct:
return Framework::ProductsPopupCloseReason::SelectProduct;
case ProductsPopupCloseReasonAlreadyDonated:
return Framework::ProductsPopupCloseReason::AlreadyDonated;
case ProductsPopupCloseReasonRemindLater:
return Framework::ProductsPopupCloseReason::RemindLater;
}
}
@implementation MWMFrameworkHelper
+ (void)processFirstLaunch:(BOOL)hasLocation {
@@ -255,19 +240,4 @@ static Framework::ProductsPopupCloseReason ConvertProductPopupCloseReasonToCore(
return [[ElevationProfileData alloc] initWithElevationInfo:GetFramework().GetTrackRecordingElevationInfo()];
}
// MARK: - ProductsManager
+ (nullable ProductsConfiguration *)getProductsConfiguration {
auto const & config = GetFramework().GetProductsConfiguration();
return config.has_value() ? [[ProductsConfiguration alloc] init:config.value()] : nil;
}
+ (void)didCloseProductsPopupWithReason:(ProductsPopupCloseReason)reason {
GetFramework().DidCloseProductsPopup(ConvertProductPopupCloseReasonToCore(reason));
}
+ (void)didSelectProduct:(Product *)product {
GetFramework().DidSelectProduct({product.title.UTF8String, product.link.UTF8String});
}
@end

View File

@@ -1,10 +0,0 @@
#include <CoreApi/CoreApi-Swift.h>
#include <CoreApi/Framework.h>
#include "platform/products.hpp"
@interface Product (Core)
- (nonnull instancetype)init:(products::ProductsConfig::Product const &)product;
@end

View File

@@ -1,11 +0,0 @@
#import "Product+Core.h"
@implementation Product (Core)
- (nonnull instancetype)init:(products::ProductsConfig::Product const &)product {
self = [self initWithTitle:[NSString stringWithCString:product.GetTitle().c_str() encoding:NSUTF8StringEncoding]
link:[NSString stringWithCString:product.GetLink().c_str() encoding:NSUTF8StringEncoding]];
return self;
}
@end

View File

@@ -1,14 +0,0 @@
#include <CoreApi/CoreApi-Swift.h>
#include <CoreApi/Framework.h>
#include "platform/products.hpp"
NS_ASSUME_NONNULL_BEGIN
@interface ProductsConfiguration (Core)
- (nonnull instancetype)init:(products::ProductsConfig const &)config;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,15 +0,0 @@
#import "ProductsConfiguration+Core.h"
#import "Product+Core.h"
@implementation ProductsConfiguration (Core)
- (nonnull instancetype)init:(products::ProductsConfig const &)config {
auto const & coreProducts = config.GetProducts();
NSMutableArray<Product *> * products = [[NSMutableArray<Product *> alloc] initWithCapacity:coreProducts.size()];
for (auto const & product : coreProducts)
[products addObject:[[Product alloc] init:product]];
self = [self initWithPlacePagePrompt:[NSString stringWithCString:config.GetPlacePagePrompt().c_str() encoding:NSUTF8StringEncoding] products:products];
return self;
}
@end

View File

@@ -1,23 +0,0 @@
import Foundation
@objcMembers
public final class Product: NSObject {
public let title: String
public let link: String
public init(title: String, link: String) {
self.title = title
self.link = link
}
}
@objcMembers
public final class ProductsConfiguration: NSObject {
public let placePagePrompt: String
public let products: [Product]
public init(placePagePrompt: String, products: [Product]) {
self.placePagePrompt = placePagePrompt
self.products = products
}
}