diff --git a/Travel-IT.xcodeproj/project.pbxproj b/Travel-IT.xcodeproj/project.pbxproj index b366d76..cd82bc2 100644 --- a/Travel-IT.xcodeproj/project.pbxproj +++ b/Travel-IT.xcodeproj/project.pbxproj @@ -20,6 +20,7 @@ 14A724D12063D7BA00A9BE47 /* CustomNavigationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14A724D02063D7BA00A9BE47 /* CustomNavigationVC.swift */; }; 14A724D32063DCD100A9BE47 /* CustomTabbarVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14A724D22063DCD100A9BE47 /* CustomTabbarVC.swift */; }; 14A724D52063DD0400A9BE47 /* BaseColours.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14A724D42063DD0400A9BE47 /* BaseColours.swift */; }; + 14B0B8C8207F8202007CD973 /* VotingPowerRechargeTimeCalculatorVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14B0B8C7207F8202007CD973 /* VotingPowerRechargeTimeCalculatorVC.swift */; }; 14E6026B20652233006BAFCF /* Tools.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14E6026A20652233006BAFCF /* Tools.storyboard */; }; 14E6026D20652242006BAFCF /* UserProfile.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14E6026C20652242006BAFCF /* UserProfile.storyboard */; }; 14E6026F206522C3006BAFCF /* UsefulSteemitToolsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E6026E206522C3006BAFCF /* UsefulSteemitToolsVC.swift */; }; @@ -71,6 +72,7 @@ 14A724D02063D7BA00A9BE47 /* CustomNavigationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomNavigationVC.swift; sourceTree = ""; }; 14A724D22063DCD100A9BE47 /* CustomTabbarVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTabbarVC.swift; sourceTree = ""; }; 14A724D42063DD0400A9BE47 /* BaseColours.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseColours.swift; sourceTree = ""; }; + 14B0B8C7207F8202007CD973 /* VotingPowerRechargeTimeCalculatorVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VotingPowerRechargeTimeCalculatorVC.swift; sourceTree = ""; }; 14E6026A20652233006BAFCF /* Tools.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Tools.storyboard; sourceTree = ""; }; 14E6026C20652242006BAFCF /* UserProfile.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = UserProfile.storyboard; sourceTree = ""; }; 14E6026E206522C3006BAFCF /* UsefulSteemitToolsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UsefulSteemitToolsVC.swift; sourceTree = ""; }; @@ -211,6 +213,7 @@ children = ( 14E6026A20652233006BAFCF /* Tools.storyboard */, 14E6026E206522C3006BAFCF /* UsefulSteemitToolsVC.swift */, + 14B0B8C7207F8202007CD973 /* VotingPowerRechargeTimeCalculatorVC.swift */, ); path = Tools; sourceTree = ""; @@ -552,6 +555,7 @@ 14E6027320652A5D006BAFCF /* HotPostsListVC.swift in Sources */, 14E6027F2067B6A5006BAFCF /* UIView+Properties.swift in Sources */, 147B50D7205CEA44001424D2 /* AppDelegate.swift in Sources */, + 14B0B8C8207F8202007CD973 /* VotingPowerRechargeTimeCalculatorVC.swift in Sources */, 147B5105205CFD1A001424D2 /* PostsTableCell.swift in Sources */, 147B5107205D6106001424D2 /* PostShowVC.swift in Sources */, 14E60271206524A3006BAFCF /* UserProfileVC.swift in Sources */, diff --git a/Travel-IT/Assets.xcassets/Voting_power_tool_logo.imageset/Contents.json b/Travel-IT/Assets.xcassets/Voting_power_tool_logo.imageset/Contents.json new file mode 100644 index 0000000..2163199 --- /dev/null +++ b/Travel-IT/Assets.xcassets/Voting_power_tool_logo.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "battery-156718_1280 copy.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Travel-IT/Assets.xcassets/Voting_power_tool_logo.imageset/battery-156718_1280 copy.png b/Travel-IT/Assets.xcassets/Voting_power_tool_logo.imageset/battery-156718_1280 copy.png new file mode 100644 index 0000000..5a0d5dc Binary files /dev/null and b/Travel-IT/Assets.xcassets/Voting_power_tool_logo.imageset/battery-156718_1280 copy.png differ diff --git a/Travel-IT/Tools/Tools.storyboard b/Travel-IT/Tools/Tools.storyboard index d7404cf..3a2cbc7 100644 --- a/Travel-IT/Tools/Tools.storyboard +++ b/Travel-IT/Tools/Tools.storyboard @@ -1,10 +1,10 @@ - + - + @@ -25,9 +25,9 @@ - + - + @@ -35,39 +35,256 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + - + - + - + diff --git a/Travel-IT/Tools/UsefulSteemitToolsVC.swift b/Travel-IT/Tools/UsefulSteemitToolsVC.swift index 33f13bc..cd5f121 100644 --- a/Travel-IT/Tools/UsefulSteemitToolsVC.swift +++ b/Travel-IT/Tools/UsefulSteemitToolsVC.swift @@ -12,7 +12,7 @@ class UsefulSteemitToolsVC: UIViewController { override func viewDidLoad() { super.viewDidLoad() - + self.title = "Useful Steem Tools" // Do any additional setup after loading the view. } diff --git a/Travel-IT/Tools/VotingPowerRechargeTimeCalculatorVC.swift b/Travel-IT/Tools/VotingPowerRechargeTimeCalculatorVC.swift new file mode 100644 index 0000000..e2e3287 --- /dev/null +++ b/Travel-IT/Tools/VotingPowerRechargeTimeCalculatorVC.swift @@ -0,0 +1,44 @@ +// +// VotingPowerRechargeTimeCalculatorVC.swift +// Travel-IT +// +// Created by Ankit Singh on 12/04/18. +// Copyright © 2018 Ankit Singh. All rights reserved. +// + +import UIKit + +class VotingPowerRechargeTimeCalculatorVC: UIViewController { + + @IBOutlet var targetedVotingPowerTextFieldValue: UITextField! + @IBOutlet var currentVotingPowerTextFieldValue: UITextField! + @IBOutlet var secondsLabel: UILabel! + @IBOutlet var minutesLabel: UILabel! + @IBOutlet var hoursLabel: UILabel! + @IBOutlet var daysLabel: UILabel! + override func viewDidLoad() { + super.viewDidLoad() + self.targetedVotingPowerTextFieldValue.keyboardType = .numberPad + self.currentVotingPowerTextFieldValue.keyboardType = .numberPad + } + + @IBAction func calculateButtonClick(_ sender: Any) { + let targetedValue = Int(self.targetedVotingPowerTextFieldValue.text!) + let currentValue = Int(self.currentVotingPowerTextFieldValue.text!) + let difference = (targetedValue! - currentValue!) + var timeInSecond = Double(difference) * 43.2 / 0.01 + self.view.endEditing(true) + self.updateLabels(time: Int(timeInSecond), targetedValue: targetedValue!) + } + + func updateLabels(time: Int, targetedValue: Int) { + let minutes = time / 60 + let hours = minutes / 60 + let days = hours / 24 + self.secondsLabel.text = "In order to reach the percentage of " + "\(targetedValue)%" + " you have to wait " + "\(time) seconds" + self.minutesLabel.text = "In order to reach the percentage of " + "\(targetedValue)%" + " you have to wait " + "\(minutes) minutes" + self.hoursLabel.text = "In order to reach the percentage of " + "\(targetedValue)%" + " you have to wait " + "\(hours) hours" + self.daysLabel.text = "In order to reach the percentage of " + "\(targetedValue)%" + " you have to wait " + "\(days) days" + } + +}