Skip to content

Commit

Permalink
fix: don't show close button for Screen presentation mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Syn-McJ committed Sep 16, 2023
1 parent 9291f74 commit 89babdb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ - (void)buySellDashActionAuthenticated {
- (void)showLocalCurrencyAction {
DWLocalCurrencyViewController *controller =
[[DWLocalCurrencyViewController alloc] initWithNavigationAppearance:DWNavigationAppearance_White
presentationMode:DWCurrencyPickerPresentationMode_Dialog
currencyCode:nil];
controller.delegate = self;
[self presentControllerModallyInNavigationController:controller];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ - (void)rescanBlockchainActionFromSourceView:(UIView *)sourceView sourceRect:(CG
- (void)showCurrencySelector {
DWLocalCurrencyViewController *controller =
[[DWLocalCurrencyViewController alloc] initWithNavigationAppearance:DWNavigationAppearance_Default
presentationMode:DWCurrencyPickerPresentationMode_Screen
currencyCode:nil];
controller.delegate = self;
[self.navigationController pushViewController:controller animated:YES];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, DWCurrencyPickerPresentationMode) {
DWCurrencyPickerPresentationMode_Dialog,
DWCurrencyPickerPresentationMode_Screen,
};

@class DWLocalCurrencyViewController;

@protocol DWLocalCurrencyViewControllerDelegate <NSObject>
Expand All @@ -37,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL isGlobal;

- (instancetype)initWithNavigationAppearance:(DWNavigationAppearance)navigationAppearance
presentationMode:(DWCurrencyPickerPresentationMode)mode
currencyCode:(nullable NSString *)currencyCode;

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@interface DWLocalCurrencyViewController () <UISearchBarDelegate, UISearchResultsUpdating>

@property (nonatomic, assign) DWNavigationAppearance navigationAppearance;
@property (nonatomic, assign) DWCurrencyPickerPresentationMode presentationMode;
@property (nonatomic, strong) DWLocalCurrencyModel *model;
@property (nonatomic, strong) UILabel *priceSourceLabel;

Expand All @@ -41,10 +42,12 @@ @interface DWLocalCurrencyViewController () <UISearchBarDelegate, UISearchResult
@implementation DWLocalCurrencyViewController

- (instancetype)initWithNavigationAppearance:(DWNavigationAppearance)navigationAppearance
presentationMode:(DWCurrencyPickerPresentationMode)mode
currencyCode:(nullable NSString *)currencyCode {
self = [super initWithStyle:UITableViewStylePlain];
if (self) {
self.navigationAppearance = navigationAppearance;
self.presentationMode = mode;
if (navigationAppearance == DWNavigationAppearance_Default) {
self.title = NSLocalizedString(@"Local Currency", nil);
}
Expand All @@ -59,8 +62,10 @@ - (instancetype)initWithNavigationAppearance:(DWNavigationAppearance)navigationA
- (void)viewDidLoad {
[super viewDidLoad];

UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemClose target:self action:@selector(closeButtonAction)];
self.navigationItem.rightBarButtonItem = barButton;
if (self.presentationMode == DWCurrencyPickerPresentationMode_Dialog) {
UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemClose target:self action:@selector(closeButtonAction)];
self.navigationItem.rightBarButtonItem = barButton;
}

self.title = NSLocalizedString(@"Local Currency", nil);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class BaseAmountViewController: ActionButtonViewController, AmountProviding {

internal func showCurrencyList() {
let currencyController = DWLocalCurrencyViewController(navigationAppearance: .white,
presentationMode: .dialog,
currencyCode: model.localCurrencyCode)
currencyController.isGlobal = false
currencyController.delegate = self
Expand Down

0 comments on commit 89babdb

Please sign in to comment.