Skip to content

Commit

Permalink
Remove awful cache
Browse files Browse the repository at this point in the history
  • Loading branch information
f0go committed Apr 19, 2022
1 parent 6e9b5f9 commit 6b4b0b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 56 deletions.
4 changes: 2 additions & 2 deletions Terra Planet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 15;
CURRENT_PROJECT_VERSION = 17;
DEVELOPMENT_TEAM = 8P26MFFBDF;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -980,7 +980,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 15;
CURRENT_PROJECT_VERSION = 17;
DEVELOPMENT_TEAM = 8P26MFFBDF;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
7 changes: 0 additions & 7 deletions Terra Planet/API/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,8 @@ final class API {
}

func loadCoins(callback: @escaping (_ status: Bool) -> Void) {
callback(false)
if let wallet = wallet {

self.wallet?.coins = [:]
StoreManager.shared.deleteBalance()

func loadCoins() {
var terra = false
var anchor = false
Expand All @@ -100,7 +96,6 @@ final class API {
if self.supportedCoins.contains(coin["denom"].stringValue) {
let amount = (coin["amount"].doubleValue / 1000000)
let balance = Balance(coin: coin["denom"].stringValue, amount: amount)
StoreManager.shared.setBalance(coin: balance)
self.wallet?.coins[coin["denom"].stringValue] = balance
}
}
Expand All @@ -115,7 +110,6 @@ final class API {
Network.shared.post("\(local)anchor/balance", data: ["mnemonic":wallet.mnemonic,"network":net]) { response in
if response.status == 200 {
let balance = Balance(coin: "anchor", amount: response.data["total_deposit_balance_in_ust"].doubleValue)
StoreManager.shared.setBalance(coin: balance)
self.wallet?.coins["anchor"] = balance
anchor = true
if terra {
Expand Down Expand Up @@ -357,7 +351,6 @@ final class API {
Network.shared.get("\(local)market/rate/uluna/uusd") { response in
if response.status == 200 {
self.lunaPrice = response.data["amount"].doubleValue
StoreManager.shared.setLastLunaPrice(value: self.lunaPrice)
callback(true)
}
else {
Expand Down
35 changes: 0 additions & 35 deletions Terra Planet/StoreManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,7 @@ final class StoreManager {
return .ust
}

func setLastLunaPrice(value: Double) {
UserDefaults.standard.setValue(value, forKey: "lunaPrice")
}

private func getLunaPrice() -> Double {
if let value = UserDefaults.standard.value(forKey: "lunaPrice") as? Double {
return value
}
else {
return 0
}
}

func setBalance(coin: Balance) {
UserDefaults.standard.setValue(coin.amount, forKey: "balance_\(coin.coin)")
}

func deleteBalance() {
for coin in availableCoins {
UserDefaults.standard.setValue(nil, forKey: "balance_\(coin)")
}
}

private func getBalance() {
if var _ = API.shared.wallet {
API.shared.lunaPrice = getLunaPrice()
for coin in availableCoins {
if let stored = UserDefaults.standard.value(forKey: "balance_\(coin)") as? Double {
API.shared.wallet?.coins[coin] = Balance(coin: coin, amount: stored)
}
}
}
}

func loadUserData(callback: @escaping (_ preferredGasFeeCoin: FeeCoin) -> Void) {
getBalance()
callback(getPreferredGasFeeCoin())
}

Expand Down
24 changes: 12 additions & 12 deletions Terra Planet/Views/Home/Home.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3ZH-uc-Ie3">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3ZH-uc-Ie3">
<rect key="frame" x="20" y="55" width="374" height="41"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="34"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -78,14 +78,14 @@
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FBJ-fS-UPH">
<rect key="frame" x="342" y="0.0" width="22" height="50"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FBJ-fS-UPH">
<rect key="frame" x="345.5" y="0.0" width="18.5" height="50"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gnH-gD-wh3">
<rect key="frame" x="102" y="0.0" width="10.5" height="50"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gnH-gD-wh3">
<rect key="frame" x="102" y="0.0" width="8" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -127,14 +127,14 @@
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Aa3-VD-h29">
<rect key="frame" x="342" y="0.0" width="22" height="50"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Aa3-VD-h29">
<rect key="frame" x="345.5" y="0.0" width="18.5" height="50"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9qS-VW-2OH">
<rect key="frame" x="102" y="0.0" width="10.5" height="50"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9qS-VW-2OH">
<rect key="frame" x="102" y="0.0" width="8" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -272,7 +272,7 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Earn (0% APY)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cg5-KV-m7c">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Earn (-% APY)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cg5-KV-m7c">
<rect key="frame" x="20" y="429" width="374" height="21"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -303,8 +303,8 @@
<action selector="anchorDeposit:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="xjO-WU-uCU"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="61j-wx-6pl">
<rect key="frame" x="20" y="20" width="31" height="29"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="61j-wx-6pl">
<rect key="frame" x="20" y="20" width="26.5" height="29"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="24"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand Down

0 comments on commit 6b4b0b1

Please sign in to comment.