Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dashpay): restoring Contacts flow #584

Merged
Merged
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
1 change: 0 additions & 1 deletion DashPay/Presentation/Home/DWDashPayReadyProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ extern NSNotificationName const DWDashPayAvailabilityStatusUpdatedNotification;
@protocol DWDashPayReadyProtocol <NSObject>

@property (readonly, nonatomic, assign) BOOL isDashPayReady;
@property (readonly, nonatomic, assign) BOOL isDashPayReadyMainSuggestion;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed atm. Removed to keep the DWDashPayReadyProtocol footprint low.


@end

Expand Down
6 changes: 6 additions & 0 deletions DashWallet/Resources/AppAssets.xcassets/TabBar/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "tabbar_pay_button.png",
"filename" : "contacts.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tabbar_pay_button@2x.png",
"filename" : "contacts@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tabbar_pay_button@3x.png",
"filename" : "contacts@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "tabbar_discover_icon.png",
"filename" : "contacts_selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "tabbar_discover_icon@2x.png",
"filename" : "contacts_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "tabbar_discover_icon@3x.png",
"filename" : "contacts_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"images" : [
{
"filename" : "explore.png",
"idiom" : "universal",
"filename" : "tabbar_contacts_icon.png",
"scale" : "1x"
},
{
"filename" : "explore@2x.png",
"idiom" : "universal",
"filename" : "tabbar_contacts_icon@2x.png",
"scale" : "2x"
},
{
"filename" : "explore@3x.png",
"idiom" : "universal",
"filename" : "tabbar_contacts_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "explore_selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "explore_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "explore_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"images" : [
{
"filename" : "home.png",
"idiom" : "universal",
"filename" : "tabbar_home_icon.png",
"scale" : "1x"
},
{
"filename" : "home@2x.png",
"idiom" : "universal",
"filename" : "tabbar_home_icon@2x.png",
"scale" : "2x"
},
{
"filename" : "home@3x.png",
"idiom" : "universal",
"filename" : "tabbar_home_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "home_selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"images" : [
{
"filename" : "more.png",
"idiom" : "universal",
"filename" : "tabbar_other_icon.png",
"scale" : "1x"
},
{
"filename" : "more@2x.png",
"idiom" : "universal",
"filename" : "tabbar_other_icon@2x.png",
"scale" : "2x"
},
{
"filename" : "more@3x.png",
"idiom" : "universal",
"filename" : "tabbar_other_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "more_selected.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "more_selected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "more_selected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "receive.sent.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "receive.sent@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "receive.sent@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

@import UIKit;

#import "dashwallet-Swift.h"

NS_ASSUME_NONNULL_BEGIN

@protocol DWNavigationFullscreenable;

@interface DWSearchViewController : UIViewController <DWNavigationFullscreenable, UISearchBarDelegate>

@property (readonly, nonatomic, strong) UISearchBar *searchBar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ - (void)viewDidLoad {

switch (self.intent) {
case DWContactsControllerIntent_Default:
self.title = NSLocalizedString(@"Contacts", nil);
self.navigationItem.title = NSLocalizedString(@"Contacts", nil);
break;

case DWContactsControllerIntent_PayToSelector:
self.title = NSLocalizedString(@"Send to a Contact", nil);
self.navigationItem.title = NSLocalizedString(@"Send to a Contact", nil);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (instancetype)initWithPayModel:(id<DWPayModelProtocol>)payModel
- (void)viewDidLoad {
[super viewDidLoad];

self.title = NSLocalizedString(@"Contacts", nil);
self.navigationItem.title = NSLocalizedString(@"Contacts", nil);

self.view.backgroundColor = [UIColor dw_secondaryBackgroundColor];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ - (void)willDisplayItemAtIndex:(NSInteger)index {
}

- (BOOL)canOpenBlockchainIdentity:(DSBlockchainIdentity *)blockchainIdentity {
if (MOCK_DASHPAY) {
return YES;
}

DSWallet *wallet = [DWEnvironment sharedInstance].currentWallet;
DSBlockchainIdentity *myBlockchainIdentity = wallet.defaultBlockchainIdentity;
return !uint256_eq(myBlockchainIdentity.uniqueID, blockchainIdentity.uniqueID);
Expand Down Expand Up @@ -164,6 +168,23 @@ - (void)performSearchAndNotify:(BOOL)notify {
}

- (void)performSearchWithQuery:(NSString *)query offset:(uint32_t)offset {
if (MOCK_DASHPAY) {
NSMutableArray<id<DWDPBasicUserItem, DWDPBlockchainIdentityBackedItem>> *items = [NSMutableArray array];

for (int i = 0; i < 3; i++) {
DSWallet *wallet = [DWEnvironment sharedInstance].currentWallet;
NSString *username = [NSString stringWithFormat:@"%@%d", query, i];
DSBlockchainIdentity *identity = [wallet createBlockchainIdentityForUsername:username];
id<DWDPBasicUserItem, DWDPBlockchainIdentityBackedItem> item = [self.itemsFactory itemForBlockchainIdentity:identity];
[items addObject:item];
}

self.searchRequest.hasNextPage = NO;
self.searchRequest.items = items;

[self.delegate userSearchModel:self completedWithItems:items];
}

self.searchRequest.requestInProgress = YES;

DSIdentitiesManager *manager = [DWEnvironment sharedInstance].currentChainManager.identitiesManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#import "DWDashPayContactsActions.h"
#import "DWDashPayContactsUpdater.h"
#import "DWEnvironment.h"
#import "DWDashPayConstants.h"

@implementation DWBaseContactsModel

Expand All @@ -42,6 +43,10 @@ - (instancetype)init {
}

- (BOOL)hasBlockchainIdentity {
if (MOCK_DASHPAY) {
return YES;
}

DSWallet *wallet = [DWEnvironment sharedInstance].currentWallet;
DSBlockchainIdentity *myBlockchainIdentity = wallet.defaultBlockchainIdentity;
return myBlockchainIdentity != nil;
Expand Down
1 change: 1 addition & 0 deletions DashWallet/Sources/UI/DashPay/DWDashPayConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern uint64_t DWDP_MIN_BALANCE_TO_CREATE_USERNAME;
extern uint64_t DWDP_MIN_BALANCE_TO_CREATE_INVITE;
extern NSInteger DW_MIN_USERNAME_LENGTH;
extern NSInteger DW_MAX_USERNAME_LENGTH;
extern BOOL MOCK_DASHPAY;

extern NSString *const DWDP_THUMBNAIL_SERVER;
NS_ASSUME_NONNULL_END
1 change: 1 addition & 0 deletions DashWallet/Sources/UI/DashPay/DWDashPayConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@

NSInteger DW_MIN_USERNAME_LENGTH = 3;
NSInteger DW_MAX_USERNAME_LENGTH = 24;
BOOL MOCK_DASHPAY = YES; // TODO: remove once Platform is available
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figure it's better to reference a single flag for any mocking code. Will be easier to turn off and remove once the platform is available.


NSString *const DWDP_THUMBNAIL_SERVER = @"http://54.74.4.114";
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#import "DWGlobalOptions.h"
#import "DWProfileTxsFetchedDataSource.h"
#import "DWUserProfileDataSourceObject.h"
#import "DWDashPayConstants.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -155,6 +156,11 @@ - (BOOL)shouldShowAcceptDeclineRequestAction {
}

- (void)sendContactRequest:(void (^)(BOOL success))completion {
if (MOCK_DASHPAY) {
completion(YES);
return;
}

self.sendRequestState = DWUserProfileModelState_Loading;

DSWallet *wallet = [DWEnvironment sharedInstance].currentWallet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
// limitations under the License.
//

#import "dashwallet-Swift.h"
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class DWExploreTestnetViewController;
@protocol DWNavigationFullscreenable;

@protocol DWExploreTestnetViewControllerDelegate <NSObject>

Expand Down
Loading