diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5f5a128 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +language: objective-c +osx_image: xcode10.1 +env: + global: + secure: oX8UxAhaWXqhlywMKAw9yYYQppRJCfrzpQeEIHdGCHC873rA4Jwnf6reFFs6bFCoGczxrFdDYKOgDjbPL7cot3LtVKBF0f+YHK4NSG993XAwml2a22prIplJGxi/u0JZ5dbjupSdIx7bpUx2s9g+Y5wX9fARoWZShcXJP2P+wx9ss0RJiRyfz8ufFoHOzi11h4kRlPizPyqfWGl4L8DwTFLpmpT1IW1/R1TIK4vue9A0RHeV7YpIXJiwC5dXFxJoJXLmFxi44ilhYGCZVklgLCO9acHrL/suW9j201xerrKXlC7M3+sTMuPiadWOCPrZug5SaNMIRyJXutptscJt7cx0l1Tc3Aae/MXyrapvKVxFw8hhNMhGU1iQWGdIAHJApdIuJNUq37TecA12ZreqZ692zad16wLLjjmOPLHKr8KAHu33WhGUfWCTrrAwI7dTXnHaaAEBTHxu7Ne9pWRqhHyknofcQU6VdsPZuRu5h8dOa9ZoJBPmJkmpcc9Q2Z3pEeCQyIL0/i1mpdAwZNmZlMqlvF9on5xraxc3cEDBo9bXZ3ztk+fUEdzaX3drDPCftVmGT1f54Yh6VQBgUER8LzlFtUPcpvtMU4kDA7qeJhm7+FmvYEtO/ldT7I5QfVbP/3MOucZQSCKh8sHwPgyVwLtI+jVDuh36h47h6+g8bk4= + +cache: + - cocoapods + +before_install: + - brew update + - brew install jq + - gem install cocoapods + - pod install --repo-update + +script: + - set -o pipefail + - xcodebuild -workspace MyEtherWallet-iOS.xcworkspace -scheme MyEtherWallet-iOS -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone SE" | xcpretty + +deploy: + provider: script + script: bash ./Scripts/release.sh $TRAVIS_TAG $GITHUB_TOKEN "MyEtherWallet/MEWconnect-iOS" + skip_cleanup: true + on: + tags: true + branch: master diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d85fc8e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,43 @@ +### Release 1.0.5 + +- Improved connection for some mobile operators. +- Improved Ether purchase history. +- Improved UI for token transactions. + +### Release 1.0.4 + +- Minor improvements to 'restore account' scenario. + +### Release 1.0.3 + +##### Update highlights: + +- New 'Share' screen with address QR code, and ability to easily share or copy your address. (Tap on QR code icon on the main screen to see it.) +- Fixed issues related to token transfer approvals, where token amounts and ‘Send to’ address was displaying incorrectly +- Sensitive data is now not visible in the Task Switcher anymore, the app immediately hides its content when switching apps +- Implemented password protection after the app goes on the background + +##### Other improvements: + +- ‘Buy Ether’ history section improvements +- Buy Ether amount input UI improvements +- Fixed an issue of re-setting wallet from 'Forgot password' screen +- Fixed an edge case when ‘Balance refresh’ button stops working +- Tokens list UI fixes and balance update fixes. +- Added passphrase validator on Restore Wallet screen +- Removed comma from placeholder text (Restore screens) +- Updated "share" icon on the main screen +- Account address on the main screen is now also clickable +- Added sounds to QR code scanner +- Improved connection to desktop flow for some browsers +- UI fixes related to new iPhone models +- Various UI and bugfixes + +### Release 1.0.2 + +- Fixed the issue that caused the app to not connect to browser in some cases. +- Thanks to everyone who reported it! Let us know if you still experiencing problems: support@myetherwallet.com + +### Release 1.0.1 + +- Performance improvements diff --git a/Configurations/application.xcconfig b/Configurations/application.xcconfig index fc54cb6..fd2fff6 100644 --- a/Configurations/application.xcconfig +++ b/Configurations/application.xcconfig @@ -1,2 +1,2 @@ -APPLICATION_VERSION=1.0.4 -APPLICATION_BUILD=18121701 +APPLICATION_VERSION=1.0.5 +APPLICATION_BUILD=19011002 diff --git a/MyEtherWallet-iOS.xcodeproj/project.pbxproj b/MyEtherWallet-iOS.xcodeproj/project.pbxproj index 6f6db96..c9ca24e 100644 --- a/MyEtherWallet-iOS.xcodeproj/project.pbxproj +++ b/MyEtherWallet-iOS.xcodeproj/project.pbxproj @@ -1307,6 +1307,10 @@ 560D773520B58C93009A3D6D /* BackupConfirmationSegmentedControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BackupConfirmationSegmentedControl.m; sourceTree = ""; }; 560D773820B5A258009A3D6D /* BackupConfirmationQuiz.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BackupConfirmationQuiz.h; sourceTree = ""; }; 560D773920B5A258009A3D6D /* BackupConfirmationQuiz.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BackupConfirmationQuiz.m; sourceTree = ""; }; + 5610EB9E21DD5F0700F925C3 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; + 5610EBA321DD97F400F925C3 /* release.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = release.sh; path = Scripts/release.sh; sourceTree = SOURCE_ROOT; }; + 5610EBA421DD97FB00F925C3 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = SOURCE_ROOT; }; + 5610EBA521DD980F00F925C3 /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .travis.yml; sourceTree = SOURCE_ROOT; }; 56115D332103706000C176F4 /* ConfirmationStoryModuleOutput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConfirmationStoryModuleOutput.h; sourceTree = ""; }; 561840B720CC8CE1004BEB7E /* MEWcryptoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MEWcryptoTests.m; path = MEWcrypto/MEWcryptoTests.m; sourceTree = ""; }; 561840BE20CCA0BA004BEB7E /* RamblerTyphoonUtils.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RamblerTyphoonUtils.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -3840,6 +3844,16 @@ path = Models; sourceTree = ""; }; + 5610EBA221DD97BB00F925C3 /* Release */ = { + isa = PBXGroup; + children = ( + 5610EBA521DD980F00F925C3 /* .travis.yml */, + 5610EBA421DD97FB00F925C3 /* CHANGELOG.md */, + 5610EBA321DD97F400F925C3 /* release.sh */, + ); + name = Release; + sourceTree = ""; + }; 56115D3121036FDD00C176F4 /* Common */ = { isa = PBXGroup; children = ( @@ -7037,6 +7051,8 @@ 56FE2B7E20817F1100DB39D5 /* Info.plist */, 56E3E66A210178740014152D /* Info-Beta.plist */, 569E51CB20D9484C00883583 /* prefix.pch */, + 5610EB9E21DD5F0700F925C3 /* README.md */, + 5610EBA221DD97BB00F925C3 /* Release */, ); path = "Supporting Files"; sourceTree = ""; diff --git a/MyEtherWallet-iOS.xcodeproj/xcshareddata/xcschemes/MyEtherWallet-iOS.xcscheme b/MyEtherWallet-iOS.xcodeproj/xcshareddata/xcschemes/MyEtherWallet-iOS.xcscheme new file mode 100644 index 0000000..07cd911 --- /dev/null +++ b/MyEtherWallet-iOS.xcodeproj/xcshareddata/xcschemes/MyEtherWallet-iOS.xcscheme @@ -0,0 +1,558 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWConnectService/MEWConnectServiceImplementation.m b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWConnectService/MEWConnectServiceImplementation.m index 2efddce..5ac87bf 100644 --- a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWConnectService/MEWConnectServiceImplementation.m +++ b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWConnectService/MEWConnectServiceImplementation.m @@ -79,6 +79,7 @@ - (BOOL) connectWithData:(NSString *)data { [self _disconnect]; } [self.stateMachine reset]; + [self.rtcService updateIceServers:nil]; NSArray *params = [data componentsSeparatedByString:@"_"]; if ([params count] < 3) { return NO; @@ -193,6 +194,11 @@ - (void) _defineSignalsWithSocketClient:(SocketIOClient *)client { [self _signalConfirmationError:data]; }]; + [client on:kMEWConnectSignalTurnToken callback:^(NSArray * data, __unused SocketAckEmitter * emit) { + @strongify(self); + [self _signalTurnToken:data]; + }]; + /* Any signal */ #if DEBUG_ANYSIGNAL [client onAny:^(SocketAnyEvent * _Nonnull event) { @@ -336,6 +342,10 @@ - (void) _signalConfirmationError:(NSArray *)data { DDLogVerbose(@"MEWConnect: confirmation failed (%@)", data); } +- (void) _signalTurnToken:(NSArray *> *)data { + [self.rtcService updateIceServers:[data firstObject][kMEWConnectSocketData]]; +} + #if DEBUG_ANYSIGNAL - (void) _signalAny:(SocketAnyEvent *)event { DDLogVerbose(@"MEWConnect: any (%@)", event); diff --git a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCService.h b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCService.h index 0ceefec..4ba4010 100644 --- a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCService.h +++ b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCService.h @@ -19,4 +19,5 @@ - (void) openDataChannel; - (void) disconnect; - (BOOL) sendMessage:(id)message; +- (void) updateIceServers:(NSArray *)servers; @end diff --git a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCServiceImplementation.m b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCServiceImplementation.m index 82a2bbf..961b979 100644 --- a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCServiceImplementation.m +++ b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/MEW/MEWRTCService/MEWRTCServiceImplementation.m @@ -19,6 +19,7 @@ @interface MEWRTCServiceImplementation () *turnServers; @end @implementation MEWRTCServiceImplementation { @@ -32,7 +33,7 @@ - (void) connectWithType:(NSString *)type andSdp:(NSString *)sdp { RTCSdpType sdpType = [RTCSessionDescription typeForString:type]; RTCSessionDescription *description = [[RTCSessionDescription alloc] initWithType:sdpType sdp:sdp]; - self.peerConnection = [self.peerConnectionFactory peerConnectionWithConfiguration:[self _RTCConfigurationWithIceServers:nil] + self.peerConnection = [self.peerConnectionFactory peerConnectionWithConfiguration:[self _RTCConfigurationWithIceServers:self.turnServers] constraints:[self _RTCMediaConstraints] delegate:self]; @weakify(self); @@ -69,6 +70,16 @@ - (void) prepareAnswer { }]; } +- (void) updateIceServers:(NSArray *)servers { + NSMutableArray *iceServers = [[NSMutableArray alloc] initWithCapacity:[servers count]]; + for (NSDictionary *server in servers) { + [iceServers addObject:[[RTCIceServer alloc] initWithURLStrings:@[server[NSStringFromSelector(@selector(url))]] + username:server[NSStringFromSelector(@selector(username))] + credential:server[NSStringFromSelector(@selector(credential))]]]; + } + self.turnServers = [iceServers copy]; +} + - (void) updateLocalDescriptionWithAnswer:(RTCSessionDescription *)answer { @weakify(self); [self.peerConnection setLocalDescription:answer diff --git a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/SimplexService/SimplexServiceStatusTypes.h b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/SimplexService/SimplexServiceStatusTypes.h index df17c4b..f9b4167 100644 --- a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/SimplexService/SimplexServiceStatusTypes.h +++ b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/SimplexService/SimplexServiceStatusTypes.h @@ -17,6 +17,7 @@ static NSString *const kSimplexServicePaymentDeclined = @"payment_simple static NSString *const kSimplexServicePaymentDeclined2 = @"simplexcc_declined"; static NSString *const kSimplexServicePaymentPending = @"pending_simplexcc_approval"; static NSString *const kSimplexServicePaymentCancelled = @"cancelled"; +static NSString *const kSimplexServicePaymentToPartner = @"pending_simplexcc_payment_to_partner"; typedef NS_ENUM(short, SimplexServicePaymentStatusType) { SimplexServicePaymentStatusTypeUnknown = 0, @@ -30,7 +31,8 @@ NS_INLINE SimplexServicePaymentStatusType SimplexServicePaymentStatusTypeFromStr if ([string isEqualToString:kSimplexServicePaymentRequestSubmitted] || [string isEqualToString:kSimplexServicePaymentPending]) { return SimplexServicePaymentStatusTypeInProgress; - } else if ([string isEqualToString:kSimplexServicePaymentApproved]) { + } else if ([string isEqualToString:kSimplexServicePaymentApproved] || + [string isEqualToString:kSimplexServicePaymentToPartner]) { return SimplexServicePaymentStatusTypeApproved; } else if ([string isEqualToString:kSimplexServicePaymentDeclined] || [string isEqualToString:kSimplexServicePaymentDeclined2]) { diff --git a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/TokensService/TokensServiceImplementation.m b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/TokensService/TokensServiceImplementation.m index 8f2c570..42632f2 100644 --- a/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/TokensService/TokensServiceImplementation.m +++ b/MyEtherWallet-iOS/Classes/BusinessLogicLayer/Services/ConcreteServices/TokensService/TokensServiceImplementation.m @@ -188,6 +188,9 @@ - (MasterTokenModelObject *) obtainActiveMasterToken { } - (TokenModelObject *) obtainTokenWithAddress:(NSString *)address ofMasterToken:(MasterTokenPlainObject *)masterToken { + if (!address) { + return nil; + } NSManagedObjectContext *context = [NSManagedObjectContext MR_defaultContext]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF.address ==[c] %@ && SELF.fromNetwork.master.address ==[c] %@", address, masterToken.address]; TokenModelObject *tokenModelObject = [TokenModelObject MR_findFirstWithPredicate:predicate inContext:context]; diff --git a/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.h b/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.h index c8e3e78..22810d0 100644 --- a/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.h +++ b/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.h @@ -33,6 +33,7 @@ FOUNDATION_EXPORT NSString *const kMEWConnectSignalAnswer; FOUNDATION_EXPORT NSString *const kMEWConnectSignalError; FOUNDATION_EXPORT NSString *const kMEWConnectSignalInvalidConnection; FOUNDATION_EXPORT NSString *const kMEWConnectSignalConfirmationFailed; +FOUNDATION_EXPORT NSString *const kMEWConnectSignalTurnToken; /* MEWConnect data keys */ diff --git a/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.m b/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.m index 623d573..1108260 100644 --- a/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.m +++ b/MyEtherWallet-iOS/Classes/Constants/MEWConnectConstants/MEWConnectConstants.m @@ -33,6 +33,7 @@ NSString *const kMEWConnectSignalError = @"error"; NSString *const kMEWConnectSignalInvalidConnection = @"InvalidConnection"; NSString *const kMEWConnectSignalConfirmationFailed = @"confirmationFailed"; +NSString *const kMEWConnectSignalTurnToken = @"turnToken"; /* MEWConnect data keys */ diff --git a/MyEtherWallet-iOS/Classes/Models/ConcreteClasses/MEWConnect/MEWConnectTransaction/MEWConnectTransaction.m b/MyEtherWallet-iOS/Classes/Models/ConcreteClasses/MEWConnect/MEWConnectTransaction/MEWConnectTransaction.m index be63946..8aa50e6 100644 --- a/MyEtherWallet-iOS/Classes/Models/ConcreteClasses/MEWConnect/MEWConnectTransaction/MEWConnectTransaction.m +++ b/MyEtherWallet-iOS/Classes/Models/ConcreteClasses/MEWConnect/MEWConnectTransaction/MEWConnectTransaction.m @@ -13,8 +13,6 @@ #import "TokenPlainObject.h" -static NSString *const kMEWconnectTransactionTransferPrefix = @"0xa9059cbb"; - static NSString *const kMEWconnectTransactionChainId = @"chainId"; static NSString *const kMEWconnectTransactionData = @"data"; static NSString *const kMEWconnectTransactionGas = @"gas"; @@ -22,6 +20,7 @@ static NSString *const kMEWconnectTransactionNonce = @"nonce"; static NSString *const kMEWconnectTransactionTo = @"to"; static NSString *const kMEWconnectTransactionValue = @"value"; +static NSString *const kMEWconnectTransactionCurrency = @"currency"; @interface MEWConnectTransaction () @property (nonatomic, strong) MEWconnectTokenTransfer *tokenTransferInformation; @@ -41,6 +40,8 @@ + (instancetype)transactionWithJSONString:(NSString *)string { transaction->_to = info[kMEWconnectTransactionTo]; transaction->_value = info[kMEWconnectTransactionValue]; + transaction->_token = [TokenPlainObject transactionTokenWithDescription:info[kMEWconnectTransactionCurrency]]; + transaction.tokenTransferInformation = [MEWconnectTokenTransfer tokenTransferWithData:transaction->_data]; return transaction; diff --git a/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.h b/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.h index 120a312..aed7b1a 100644 --- a/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.h +++ b/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.h @@ -8,5 +8,6 @@ @interface TokenPlainObject : _TokenPlainObject @property (nonatomic, strong, readonly) NSString *amountString; @property (nonatomic, strong, readonly) NSDecimalNumber *amount; ++ (instancetype) transactionTokenWithDescription:(NSDictionary *)description; - (BOOL) isEqualToToken:(TokenPlainObject *)token; @end diff --git a/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.m b/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.m index 73dbf97..72dd279 100644 --- a/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.m +++ b/MyEtherWallet-iOS/Classes/Models/PlainObjects/TokenPlainObject.m @@ -6,10 +6,25 @@ #import "TokenPlainObject.h" #import "NSNumberFormatter+Ethereum.h" +static NSString *const kTransactionTokenAddress = @"address"; +static NSString *const kTransactionTokenDecimals = @"decimals"; +static NSString *const kTransactionTokenSymbol = @"symbol"; + @implementation TokenPlainObject @synthesize amount = _amount; @synthesize amountString = _amountString; ++ (instancetype) transactionTokenWithDescription:(NSDictionary *)description { + if (!description) { + return nil; + } + TokenPlainObject *token = [[[self class] alloc] init]; + token.address = description[kTransactionTokenAddress]; + token.decimals = @([description[kTransactionTokenDecimals] shortValue]); + token.symbol = description[kTransactionTokenSymbol]; + return token; +} + #pragma mark - Getter - (NSDecimalNumber *)amount { diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CardView/CardView.m b/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CardView/CardView.m index 1583564..e3a02e5 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CardView/CardView.m +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CardView/CardView.m @@ -141,6 +141,7 @@ - (void) updateWithSeed:(NSString *)seed { - (void) updateBalance:(NSDecimalNumber *)balance network:(BlockchainNetworkType)network { _ethBalance = balance; _network = network; + [self _updateAddressDescription]; if (!balance) { balance = [NSDecimalNumber zero]; } @@ -327,23 +328,15 @@ - (void) _commonInit { toItem:self.balanceLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:kCardViewDefaultOffset]]; CGFloat offset = kCardViewEthereumTitleTopOffset; - UIFont *font = nil; if ([UIScreen mainScreen].screenSizeType == ScreenSizeTypeInches40) { offset = 62.0; - font = [UIFont systemFontOfSize:10.0 weight:UIFontWeightRegular]; - } else { - font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular]; } [self addConstraint:[NSLayoutConstraint constraintWithItem:ethereumTitleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:offset]]; - NSDictionary *attributes = @{NSForegroundColorAttributeName: [UIColor whiteColor], - NSFontAttributeName: font, - NSKernAttributeName: @0.0}; - NSString *title = NSLocalizedString(@"Your public Ethereum address", @"Card view"); - ethereumTitleLabel.attributedText = [[NSAttributedString alloc] initWithString:title attributes:attributes]; self.ethereumTitleLabel = ethereumTitleLabel; + [self _updateAddressDescription]; } { //Seed label + Share UIButton *seedLabelButton = [CardViewSeedButton seedButton]; @@ -393,15 +386,41 @@ - (void) _commonInit { self.layer.rasterizationScale = [UIScreen mainScreen].scale; } +- (void) _updateAddressDescription { + UIFont *font = nil; + if ([UIScreen mainScreen].screenSizeType == ScreenSizeTypeInches40) { + font = [UIFont systemFontOfSize:10.0 weight:UIFontWeightRegular]; + } else { + font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular]; + } + NSDictionary *attributes = @{NSForegroundColorAttributeName: [UIColor whiteColor], + NSFontAttributeName: font, + NSKernAttributeName: @0.0}; + NSString *title = nil; + if (_network == BlockchainNetworkTypeMainnet) { + title = NSLocalizedString(@"Your public Ethereum address", @"Card view"); + } else { + title = NSLocalizedString(@"Your public Ropsten testnet address", @"Card view"); + } + self.ethereumTitleLabel.attributedText = [[NSAttributedString alloc] initWithString:title attributes:attributes]; +} + /* $423.65 USD @ $746/ETH */ - (void) _updateUsdBalance { - if (_ethBalance && _ethToUsdPrice) { - NSDecimalNumber *usd = [_ethBalance decimalNumberByMultiplyingBy:_ethToUsdPrice]; - NSNumberFormatter *usdFormatter = [NSNumberFormatter usdFormatter]; - NSNumberFormatter *ethFormatter = [NSNumberFormatter ethereumFormatterWithNetwork:_network]; - NSString *usdBalance = [usdFormatter stringFromNumber:usd]; - NSString *ethUsdPrice = [usdFormatter stringFromNumber:_ethToUsdPrice]; - NSString *finalString = [NSString stringWithFormat:@"%@ USD @ %@/%@", usdBalance, ethUsdPrice, ethFormatter.currencySymbol]; + if ((_ethBalance && _ethToUsdPrice) || _network == BlockchainNetworkTypeRopsten) { + NSString *finalString = nil; + NSString *usdBalance = nil; + + if (_network == BlockchainNetworkTypeMainnet) { + NSDecimalNumber *usd = [_ethBalance decimalNumberByMultiplyingBy:_ethToUsdPrice]; + NSNumberFormatter *usdFormatter = [NSNumberFormatter usdFormatter]; + NSNumberFormatter *ethFormatter = [NSNumberFormatter ethereumFormatterWithNetwork:_network]; + usdBalance = [usdFormatter stringFromNumber:usd]; + NSString *ethUsdPrice = [usdFormatter stringFromNumber:_ethToUsdPrice]; + finalString = [NSString stringWithFormat:@"%@ USD @ %@/%@", usdBalance, ethUsdPrice, ethFormatter.currencySymbol]; + } else { + finalString = NSLocalizedString(@"Test network", nil); + } UIFont *balanceFont = nil; UIFont *infoFont = nil; @@ -418,9 +437,12 @@ - (void) _updateUsdBalance { NSKernAttributeName: @0.15}; NSDictionary *infoAttributes = @{NSFontAttributeName: infoFont}; NSMutableAttributedString *finalAttributedText = [[NSMutableAttributedString alloc] initWithString:finalString attributes:balanceAttributes]; - NSRange usdBalanceRange = [finalString rangeOfString:usdBalance]; - NSRange infoRange = NSMakeRange(NSMaxRange(usdBalanceRange), [finalString length] - NSMaxRange(usdBalanceRange)); - [finalAttributedText addAttributes:infoAttributes range:infoRange]; + if (usdBalance) { + NSRange usdBalanceRange = [finalString rangeOfString:usdBalance]; + NSRange infoRange = NSMakeRange(NSMaxRange(usdBalanceRange), [finalString length] - NSMaxRange(usdBalanceRange)); + [finalAttributedText addAttributes:infoAttributes range:infoRange]; + } + self.usdBalanceLabel.attributedText = finalAttributedText; if (self.usdBalanceLabel.hidden) { self.usdBalanceLabel.hidden = NO; diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CheckboxButton/CheckboxButton.swift b/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CheckboxButton/CheckboxButton.swift index 16a34db..cf2c7da 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CheckboxButton/CheckboxButton.swift +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/Common/ConcreteClasses/CheckboxButton/CheckboxButton.swift @@ -26,20 +26,6 @@ private struct CheckboxButtonConstants { } } -private struct SignedMessageConstants { - struct Fields { - static let Address = "address" - static let Msg = "msg" - static let Sig = "sig" - static let Version = "version" - static let Signer = "signer" - } - struct Values { - static let Version = "3" - static let Signer = "MEW" - } -} - @objc class CheckboxButton: UIButton { private let checkboxView = M13Checkbox(frame: .zero) diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/ConfirmationUserStory/Modules/Transaction/Interactor/TransactionInteractor.m b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/ConfirmationUserStory/Modules/Transaction/Interactor/TransactionInteractor.m index ab1db0f..ceddf6d 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/ConfirmationUserStory/Modules/Transaction/Interactor/TransactionInteractor.m +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/ConfirmationUserStory/Modules/Transaction/Interactor/TransactionInteractor.m @@ -39,11 +39,14 @@ - (void) configurateWithMessage:(MEWConnectCommand *)message masterToken:(Master self.message = message; self.transaction = [message transaction]; if ([self.transaction isTransfer]) { - TokenModelObject *tokenModelObject = [self.tokensService obtainTokenWithAddress:self.transaction.to + NSString *tokenAddress = self.transaction.token.address ?: self.transaction.to; + TokenModelObject *tokenModelObject = [self.tokensService obtainTokenWithAddress:tokenAddress ofMasterToken:masterToken]; - NSArray *ignoringProperties = @[NSStringFromSelector(@selector(fromNetwork)), - NSStringFromSelector(@selector(purchaseHistory))]; - self.transaction.token = [self.ponsomizer convertObject:tokenModelObject ignoringProperties:ignoringProperties]; + if (tokenModelObject) { + NSArray *ignoringProperties = @[NSStringFromSelector(@selector(fromNetwork)), + NSStringFromSelector(@selector(purchaseHistory))]; + self.transaction.token = [self.ponsomizer convertObject:tokenModelObject ignoringProperties:ignoringProperties]; + } } else { self.transaction.token = self.masterToken; } diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeStretchyHeader/HomeStretchyHeader.m b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeStretchyHeader/HomeStretchyHeader.m index 0c191ab..70bdafc 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeStretchyHeader/HomeStretchyHeader.m +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeStretchyHeader/HomeStretchyHeader.m @@ -240,7 +240,7 @@ - (void) _commonInit { { titleBalanceLabel.alpha = 0.0; titleBalanceLabel.translatesAutoresizingMaskIntoConstraints = NO; - titleBalanceLabel.textColor = [UIColor colorWithRGB:0xCCCCCC]; + titleBalanceLabel.textColor = [UIColor colorWithWhite:1.0 alpha:0.7]; titleBalanceLabel.font = [UIFont systemFontOfSize:13.0 weight:UIFontWeightSemibold]; titleBalanceLabel.text = @"0.00 ETH"; [self.contentView addSubview:titleBalanceLabel]; @@ -416,6 +416,13 @@ - (void) _updateContentStyleWithScrollFactor:(CGFloat)scrollFactor { self.buyEtherButton.tintColor = [UIColor whiteColor]; [self.buyEtherButton setAttributedTitle:buyEtherAttributedString forState:UIControlStateNormal]; } completion:nil]; + [UIView transitionWithView:self.networkButton.titleLabel + duration:kHomeStretchyHeaderFadeDuration + options:UIViewAnimationOptionTransitionCrossDissolve|UIViewAnimationOptionBeginFromCurrentState + animations:^{ + self.networkButton.tintColor = [UIColor colorWithWhite:1.0 alpha:0.7]; + [self.networkButton setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.7] forState:UIControlStateNormal]; + } completion:nil]; #if BETA [UIView transitionWithView:self.betaIconImageView duration:kHomeStretchyHeaderFadeDuration @@ -439,6 +446,13 @@ - (void) _updateContentStyleWithScrollFactor:(CGFloat)scrollFactor { self.buyEtherButton.tintColor = [[UIColor mainApplicationColor] colorWithAlphaComponent:0.1]; [self.buyEtherButton setAttributedTitle:buyEtherAttributedString forState:UIControlStateNormal]; } completion:nil]; + [UIView transitionWithView:self.networkButton.titleLabel + duration:kHomeStretchyHeaderFadeDuration + options:UIViewAnimationOptionTransitionCrossDissolve|UIViewAnimationOptionBeginFromCurrentState + animations:^{ + self.networkButton.tintColor = [UIColor lightGreyTextColor]; + [self.networkButton setTitleColor:[UIColor lightGreyTextColor] forState:UIControlStateNormal]; + } completion:nil]; #if BETA [UIView transitionWithView:self.betaIconImageView duration:kHomeStretchyHeaderFadeDuration diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeViewController.m b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeViewController.m index 9e7d44f..bd14e64 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeViewController.m +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Home/View/HomeViewController.m @@ -193,7 +193,9 @@ - (void) updateWithMasterToken:(MasterTokenPlainObject *)masterToken { - (void) updateBalanceWithMasterToken:(MasterTokenPlainObject *)masterToken { NetworkPlainObject *network = masterToken.fromNetworkMaster; - [self.headerView.cardView updateEthPrice:masterToken.price.usdPrice]; + if (network.network == BlockchainNetworkTypeMainnet) { + [self.headerView.cardView updateEthPrice:masterToken.price.usdPrice]; + } NSNumberFormatter *ethereumFormatter = [NSNumberFormatter ethereumFormatterWithNetwork:[network network]]; switch ([UIScreen mainScreen].screenSizeType) { diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractor.m b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractor.m index 1d73125..e3d65ac 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractor.m +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractor.m @@ -11,6 +11,7 @@ #import "ShareInteractorOutput.h" #import "MasterTokenPlainObject.h" +#import "NetworkPlainObject.h" static CGFloat const kShareInteractorQRCodeSize = 155.0; @@ -50,6 +51,10 @@ - (UIImage *)obtainQRCode { return self.qrCode; } +- (BlockchainNetworkType) obtainNetworkType { + return [self.masterToken.fromNetworkMaster network]; +} + - (void) copyAddress { [UIPasteboard generalPasteboard].string = self.masterToken.address; } diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractorInput.h b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractorInput.h index a78e875..8b567f5 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractorInput.h +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Interactor/ShareInteractorInput.h @@ -8,12 +8,15 @@ @import Foundation; +#import "BlockchainNetworkTypes.h" + @class MasterTokenPlainObject; @protocol ShareInteractorInput - (void) configureWithMasterToken:(MasterTokenPlainObject *)masterToken; - (NSString *) obtainPublicAddress; - (UIImage *) obtainQRCode; +- (BlockchainNetworkType) obtainNetworkType; - (void) copyAddress; - (NSArray *) shareActivityItems; @end diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Presenter/SharePresenter.m b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Presenter/SharePresenter.m index ccdd95a..c9ee33b 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Presenter/SharePresenter.m +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/Presenter/SharePresenter.m @@ -47,7 +47,8 @@ - (void)didTriggerViewWillDisappearEvent { - (void) didTriggerViewReadyEvent { NSString *address = [self.interactor obtainPublicAddress]; UIImage *qrCode = [self.interactor obtainQRCode]; - [self.view setupInitialStateWithAddress:address qrCode:qrCode]; + BlockchainNetworkType network = [self.interactor obtainNetworkType]; + [self.view setupInitialStateWithAddress:address qrCode:qrCode network:network]; } - (void) closeAction { diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/View/ShareViewController.m b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/View/ShareViewController.m index 72e282d..103790c 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/View/ShareViewController.m +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Modules/Share/View/ShareViewController.m @@ -67,7 +67,7 @@ - (void)setCustomTransitioningDelegate:(id -- (void) setupInitialStateWithAddress:(NSString *)address qrCode:(UIImage *)qrCode; +- (void) setupInitialStateWithAddress:(NSString *)address qrCode:(UIImage *)qrCode network:(BlockchainNetworkType)network; - (void) presentShareWithItems:(NSArray *)items; @end diff --git a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Storyboard/Wallet.storyboard b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Storyboard/Wallet.storyboard index 95f2eac..e9f2e85 100644 --- a/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Storyboard/Wallet.storyboard +++ b/MyEtherWallet-iOS/Classes/PresentationLayer/UserStories/WalletUserStory/Storyboard/Wallet.storyboard @@ -1,11 +1,11 @@ - + - + @@ -563,7 +563,7 @@ with MyEtherWallet -