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

[BP-128] Token was made visible in all networks #170

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion BankexWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@
9296A28A21B7F4E500BB3E27 /* BackButtonView.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = BackButtonView.xcassets; sourceTree = "<group>"; };
92A9FCFC21AECA6C00F8BB33 /* AssetManagementEthViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetManagementEthViewController.swift; sourceTree = "<group>"; };
92A9FCFE21AECAAD00F8BB33 /* AssetManagementEth.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = AssetManagementEth.storyboard; sourceTree = "<group>"; };
92AA46C121D6766E00572208 /* BankexWallet 3.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "BankexWallet 3.xcdatamodel"; sourceTree = "<group>"; };
92BCEDE921D0D805002264FE /* TransactionDetailsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionDetailsService.swift; sourceTree = "<group>"; };
92BCEDEB21D0E23D002264FE /* TransactionDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionDetails.swift; sourceTree = "<group>"; };
92DF231421D3D65C00AF00A0 /* SFSafariViewController+AssetManagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SFSafariViewController+AssetManagement.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2506,10 +2507,11 @@
81942F0D201B36A300F0AE29 /* BankexWallet.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
92AA46C121D6766E00572208 /* BankexWallet 3.xcdatamodel */,
86F4CEC6216F6CD300B946FF /* BankexWallet 2.xcdatamodel */,
81942F0E201B36A300F0AE29 /* BankexWallet.xcdatamodel */,
);
currentVersion = 86F4CEC6216F6CD300B946FF /* BankexWallet 2.xcdatamodel */;
currentVersion = 92AA46C121D6766E00572208 /* BankexWallet 3.xcdatamodel */;
path = BankexWallet.xcdatamodeld;
sourceTree = "<group>";
usesTabs = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>BankexWallet 2.xcdatamodel</string>
<string>BankexWallet 3.xcdatamodel</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14460.32" systemVersion="18A391" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="ERC20Token" representedClassName="ERC20Token" syncable="YES" codeGenerationType="class">
<attribute name="address" attributeType="String" syncable="YES"/>
<attribute name="decimals" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="isAdded" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
<attribute name="isSecurity" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
<attribute name="isSelected" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="symbol" attributeType="String" syncable="YES"/>
<relationship name="balances" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="TokenBalance" inverseName="token" inverseEntity="TokenBalance" syncable="YES"/>
<relationship name="transactions" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="SendEthTransaction" inverseName="token" inverseEntity="SendEthTransaction" syncable="YES"/>
</entity>
<entity name="FavoritesAddress" representedClassName="FavoritesAddress" syncable="YES" codeGenerationType="class">
<attribute name="address" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<entity name="KeyWallet" representedClassName="KeyWallet" syncable="YES" codeGenerationType="class">
<attribute name="address" attributeType="String" syncable="YES"/>
<attribute name="data" attributeType="Binary" syncable="YES"/>
<attribute name="isHD" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
<attribute name="isSelected" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="balances" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="TokenBalance" inverseName="wallet" inverseEntity="TokenBalance" syncable="YES"/>
<relationship name="childKeys" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="KeyWallet" inverseName="parentKey" inverseEntity="KeyWallet" syncable="YES"/>
<relationship name="parentKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="KeyWallet" inverseName="childKeys" inverseEntity="KeyWallet" syncable="YES"/>
<relationship name="transactions" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="SendEthTransaction" inverseName="keywallet" inverseEntity="SendEthTransaction" syncable="YES"/>
</entity>
<entity name="SendEthTransaction" representedClassName="SendEthTransaction" syncable="YES" codeGenerationType="class">
<attribute name="amount" attributeType="String" syncable="YES"/>
<attribute name="data" optional="YES" attributeType="Binary" syncable="YES"/>
<attribute name="date" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
<attribute name="from" attributeType="String" syncable="YES"/>
<attribute name="isPending" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
<attribute name="networkId" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="to" attributeType="String" syncable="YES"/>
<attribute name="trHash" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="keywallet" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="KeyWallet" inverseName="transactions" inverseEntity="KeyWallet" syncable="YES"/>
<relationship name="token" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="ERC20Token" inverseName="transactions" inverseEntity="ERC20Token" syncable="YES"/>
</entity>
<entity name="TokenBalance" representedClassName="TokenBalance" syncable="YES" codeGenerationType="class">
<attribute name="balance" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="networkUrl" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="token" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="ERC20Token" inverseName="balances" inverseEntity="ERC20Token" syncable="YES"/>
<relationship name="wallet" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="KeyWallet" inverseName="balances" inverseEntity="KeyWallet" syncable="YES"/>
</entity>
<elements>
<element name="ERC20Token" positionX="-63" positionY="9" width="128" height="180"/>
<element name="FavoritesAddress" positionX="-18" positionY="135" width="128" height="75"/>
<element name="KeyWallet" positionX="-54" positionY="54" width="128" height="180"/>
<element name="SendEthTransaction" positionX="-63" positionY="-18" width="128" height="195"/>
<element name="TokenBalance" positionX="-54" positionY="90" width="128" height="105"/>
</elements>
</model>
4 changes: 1 addition & 3 deletions BankexWallet/Service/CustomERC20TokensService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class CustomERC20TokensServiceImplementation: CustomERC20TokensService {
newToken.decimals = decimals.description
newToken.isAdded = true
newToken.isSelected = true
newToken.networkURL = self.networksService.preferredNetwork().fullNetworkUrl.absoluteString
try context.insert(newToken)
save()
}
Expand Down Expand Up @@ -383,8 +382,7 @@ class CustomERC20TokensServiceImplementation: CustomERC20TokensService {

let networksService = NetworksServiceImplementation()
func availableTokensList() -> [ERC20TokenModel]? {
let selectedNetworkURL = networksService.preferredNetwork().fullNetworkUrl.absoluteString
let networks = try! db.fetch(FetchRequest<ERC20Token>().filtered(with: NSPredicate(format:"networkURL == %@ && isAdded == %@", selectedNetworkURL, NSNumber(value: true))))
let networks = try! db.fetch(FetchRequest<ERC20Token>().filtered(with: NSPredicate(format:"isAdded == %@", NSNumber(value: true))))

let listOfNetworks = [etherModel()] + networks.map { (token) -> ERC20TokenModel in
return ERC20TokenModel(name: token.name ?? "",
Expand Down
1 change: 0 additions & 1 deletion BankexWallet/Service/DefaultTokensService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class DefaultTokensServiceImplementation: DefaultTokensService {
newToken.symbol = dict["symbol"] as? String
newToken.name = newToken.symbol
newToken.decimals = String((dict["decimal"] as? Int) ?? 0)
newToken.networkURL = self.networksService.preferredNetwork().fullNetworkUrl.absoluteString
newToken.isSecurity = dict["isSecurity"] as? Bool ?? false
try context.insert(newToken)
save()
Expand Down