├── .gitignore
├── ArkMonitor.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── ArkMonitor.xcworkspace
└── contents.xcworkspacedata
├── ArkMonitor
├── ARKPushNotificationManager.swift
├── Account Selection
│ ├── AccountTransitionDelegate.swift
│ └── AccountViewController.swift
├── AppDelegate.swift
├── ArkActivityView.swift
├── ArkBackgroundFetch.swift
├── ArkDataManager.swift
├── ArkNetworkManager.swift
├── ArkNotificationManager.swift
├── ArkPalette.swift
├── ArkTabViewController.swift
├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── appStore.png
│ │ ├── ipad@2x.png
│ │ ├── ipadNotifications@2x-1.png
│ │ ├── ipadPro@3x.png
│ │ ├── ipadSettings@2x.png
│ │ ├── ipadSpotlight@2x.png
│ │ ├── iphone@2x.png
│ │ ├── iphone@3x.png
│ │ ├── iphoneNotifications@2x.png
│ │ ├── iphoneNotifications@3x.png
│ │ ├── iphoneSettings@2x.png
│ │ ├── iphoneSettings@3x.png
│ │ ├── iphoneSpotlight@2x.png
│ │ └── iphoneSpotlight@3x.png
│ ├── ArkLogo.imageset
│ │ ├── ArkLogo@2x.png
│ │ ├── ArkLogo@3x.png
│ │ └── Contents.json
│ ├── Contents.json
│ ├── check.imageset
│ │ ├── Contents.json
│ │ ├── check@2x.png
│ │ └── check@3x.png
│ ├── chevron.imageset
│ │ ├── Contents.json
│ │ ├── chevron@2x.png
│ │ └── chevron@3x.png
│ ├── delegateList.imageset
│ │ ├── Contents.json
│ │ ├── delegateList@2x.png
│ │ └── delegateList@3x.png
│ ├── delegatesFilled.imageset
│ │ ├── Contents.json
│ │ ├── delegatesFilled@2x.png
│ │ └── delegatesFilled@3x.png
│ ├── explorerIcon.imageset
│ │ ├── Contents.json
│ │ ├── explorerIcon@2x.png
│ │ └── explorerIcon@3x.png
│ ├── homeFilled.imageset
│ │ ├── Contents.json
│ │ ├── homeFilled@3x.png
│ │ └── homeFillex@2x.png
│ ├── launchScreenBackground.imageset
│ │ ├── Contents.json
│ │ ├── launchScreen@2x.png
│ │ └── launchScreen@3x.png
│ ├── qrCode.imageset
│ │ ├── Contents.json
│ │ ├── qrCode@2x.png
│ │ └── qrCode@3x.png
│ ├── receivedCellIcon.imageset
│ │ ├── Contents.json
│ │ ├── receivedCellIcon@2x.png
│ │ └── receivedCellIcon@3x.png
│ ├── sendCellIcon.imageset
│ │ ├── Contents.json
│ │ ├── sendCellIcon@3x.png
│ │ └── sendCelllIcon@2x.png
│ ├── serverCheck.imageset
│ │ ├── Contents.json
│ │ ├── serverCheck@2x.png
│ │ └── serverCheck@3x.png
│ ├── settings.imageset
│ │ ├── Contents.json
│ │ ├── settings@2x.png
│ │ └── settings@3x.png
│ └── voteCellIcon.imageset
│ │ ├── Contents.json
│ │ ├── voteCellIcon@2x.png
│ │ └── voteCellIcon@3x.png
├── Base.lproj
│ └── LaunchScreen.storyboard
├── Delegate List
│ ├── DelegateDetailViewController.swift
│ ├── DelegateListSectionHeaderView.swift
│ ├── DelegateListViewController.swift
│ └── DelegateTableViewCell.swift
├── Explorer
│ ├── AccountDetailViewController.swift
│ ├── BlockDetailViewController.swift
│ ├── ExplorerViewController.swift
│ └── Tableview Cells
│ │ ├── ExplorerAccountTableViewCell.swift
│ │ ├── ExplorerBlockTableViewCell.swift
│ │ ├── ExplorerDelegateTableViewCell.swift
│ │ └── ExplorerTransactionTableViewCell.swift
├── Home
│ ├── HomeViewController.swift
│ ├── ReceiveTransferViewController.swift
│ ├── TransactionDetailViewController.swift
│ └── Views
│ │ ├── HomeHeaderView.swift
│ │ └── HomeTransactionsTableViewCell.swift
├── Info.plist
├── My Delegate
│ └── MyDelegateViewController.swift
├── Settings
│ ├── Currency Selection
│ │ ├── CurrenctySelectionTableViewCell.swift
│ │ └── CurrencySelectionViewController.swift
│ ├── Server Selection
│ │ ├── Custom Server Selection
│ │ │ ├── SettingsIPTableViewCell.swift
│ │ │ ├── SettingsPortTableViewCell.swift
│ │ │ ├── SettingsSSLTableViewCell.swift
│ │ │ ├── SettingsSaveTableViewCell.swift
│ │ │ └── SettingsServerNameTableViewCell.swift
│ │ ├── Server Selection Table Views
│ │ │ ├── SettingSelectionCustomTableViewCell.swift
│ │ │ ├── SettingSelectionPresetTableViewCell.swift
│ │ │ └── SettingsSelectionAddServerTableViewCell.swift
│ │ ├── Server.swift
│ │ ├── ServerSelectionViewController.swift
│ │ └── SettingsCustomServerViewController.swift
│ ├── SettingsCurrencyTableViewCell.swift
│ ├── SettingsDelegateTableViewCell.swift
│ ├── SettingsLogoutTableViewCell.swift
│ ├── SettingsServerTableViewCell.swift
│ ├── SettingsTransactionsNotificationTableViewCell.swift
│ └── SettingsViewController.swift
├── Supporting Views
│ ├── ArkCopyableLabel.swift
│ ├── ArkDetailTableViewCell.swift
│ ├── ArkGradientView.swift
│ ├── ArkNavigationViewController.swift
│ ├── ArkPalette.swift
│ ├── ArkTableView.swift
│ ├── ArkTextField.swift
│ └── ArkViewController.swift
├── SwiftyArk+Extensions.swift
├── TickerInfo.swift
└── Wordings
│ ├── en.lproj
│ └── Localizable.strings
│ └── fr.lproj
│ └── Localizable.strings
├── LICENSE
├── Podfile
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xcuserstate
23 |
24 | ## Obj-C/Swift specific
25 | *.hmap
26 | *.ipa
27 | *.dSYM.zip
28 | *.dSYM
29 |
30 | ## Playgrounds
31 | timeline.xctimeline
32 | playground.xcworkspace
33 |
34 | # Swift Package Manager
35 | #
36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
37 | # Packages/
38 | .build/
39 |
40 | # CocoaPods
41 | #
42 | # We recommend against adding the Pods directory to your .gitignore. However
43 | # you should judge for yourself, the pros and cons are mentioned at:
44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
45 | #
46 | # Pods/
47 |
48 | # Carthage
49 | #
50 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
51 | # Carthage/Checkouts
52 |
53 | Carthage/Build
54 |
55 | # fastlane
56 | #
57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
58 | # screenshots whenever they are needed.
59 | # For more information about the recommended setup visit:
60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
61 |
62 | fastlane/report.xml
63 | fastlane/Preview.html
64 | fastlane/screenshots
65 | fastlane/test_output
66 |
67 | # CocoaPods
68 | Pods/
69 | Podfile.lock
70 |
--------------------------------------------------------------------------------
/ArkMonitor.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ArkMonitor.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ArkMonitor/ARKPushNotificationManager.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import Foundation
17 | import SwiftyArk
18 | import UserNotifications
19 |
20 |
21 | struct ArkPushNotificationManager {
22 |
23 | static public func updateDelegateForgingStatus(_ delegate: Delegate) {
24 | let title = "Delegate Update"
25 | var body : String!
26 | if delegate.isForging == true {
27 | body = "Your delegate \(delegate.username) has been voted into the top 51 delegates (position \(delegate.rate))"
28 | } else {
29 | body = "Your delegate \(delegate.username) has been voted out of the top 51 delegates (position \(delegate.rate))"
30 | }
31 |
32 | postNotification(title, body: body)
33 | }
34 |
35 | static public func newTransactionNotification(_ transaction: Transaction) {
36 | let title = "Transaction"
37 | var body : String!
38 |
39 | switch transaction.status() {
40 | case .received:
41 | body = "You received a new transaction for \(transaction.amount) Ark"
42 | default:
43 | return
44 | }
45 | postNotification(title, body: body)
46 | }
47 |
48 | static private func postNotification(_ title: String, body: String) {
49 | let content = UNMutableNotificationContent()
50 | content.title = title
51 | content.body = body
52 | let request = UNNotificationRequest(identifier: "notification", content: content, trigger: nil)
53 |
54 | let center = UNUserNotificationCenter.current()
55 |
56 | center.add(request) { (error) in
57 | if let aError = error {
58 | print(aError)
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/ArkMonitor/Account Selection/AccountTransitionDelegate.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class AccountTransitionDelegate: NSObject, UIViewControllerTransitioningDelegate {
19 |
20 | var transitionContext: UIViewControllerContextTransitioning?
21 |
22 | func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
23 | return AccountTransitionAnimator()
24 | }
25 |
26 | func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
27 | return AccountDismissTransitionAnimator()
28 | }
29 |
30 | }
31 |
32 | class AccountTransitionAnimator: NSObject, UIViewControllerAnimatedTransitioning, CAAnimationDelegate {
33 |
34 | var transitionContext: UIViewControllerContextTransitioning?
35 |
36 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
37 | return 0.7
38 | }
39 |
40 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
41 | let destinationController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!
42 |
43 | let containerView = transitionContext.containerView as UIView
44 |
45 | destinationController.view.alpha = 0.0
46 | containerView.addSubview(destinationController.view)
47 |
48 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
49 | destinationController.view.alpha = 1.0
50 | }) { (finished) in
51 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
52 | }
53 | }
54 |
55 |
56 | func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
57 | if let transitionContext = self.transitionContext {
58 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
59 | }
60 | }
61 | }
62 |
63 | class AccountDismissTransitionAnimator: NSObject, UIViewControllerAnimatedTransitioning {
64 |
65 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
66 | return 0.7
67 | }
68 |
69 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
70 | let destinationController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!
71 |
72 | let containerView = transitionContext.containerView as UIView
73 |
74 | destinationController.view.alpha = 0.0
75 | containerView.addSubview(destinationController.view)
76 |
77 |
78 | UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseInOut, animations: {
79 | destinationController.view.alpha = 1.0
80 | }) { (finished) in
81 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
82 | }
83 | }
84 | }
85 |
86 |
87 |
--------------------------------------------------------------------------------
/ArkMonitor/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import UserNotifications
18 |
19 | @UIApplicationMain
20 | class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
21 |
22 | var window: UIWindow?
23 | public let center = UNUserNotificationCenter.current()
24 |
25 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
26 | UIApplication.shared.statusBarStyle = .lightContent
27 | window = UIWindow(frame: UIScreen.main.bounds)
28 | let homeVC = ArkTabViewController()
29 | window!.rootViewController = homeVC
30 | window?.makeKeyAndVisible()
31 |
32 | center.delegate = self
33 | center.requestAuthorization(options: [.alert, .sound]) {
34 | (granted, error) in
35 | if let aError = error {
36 | print(aError)
37 | }
38 | }
39 |
40 | UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
41 | return true
42 | }
43 |
44 | func applicationDidBecomeActive(_ application: UIApplication) {
45 | ArkDataManager.startupOperations()
46 | }
47 |
48 | func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
49 | ArkBackgroundDownloadManager.shared.updateNewData()
50 | completionHandler(.newData)
51 | }
52 |
53 | func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
54 | print(notification.request.content.userInfo)
55 | completionHandler(.alert)
56 | }
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/ArkMonitor/ArkActivityView.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import NotificationBannerSwift
18 | import SwiftyArk
19 |
20 | public struct ArkActivityView {
21 |
22 | static public var lastNetworkMessageDate: Date?
23 |
24 | static public func checkNetworkError(_ error: Error?) {
25 | guard let currentError = error as? ApiError else {
26 | return
27 | }
28 |
29 | if currentError == ApiError.networkError {
30 | if let last = lastNetworkMessageDate {
31 | let now = Date()
32 | if now.timeIntervalSince(last) > 10.0 {
33 | showNoNetworkMessage()
34 | lastNetworkMessageDate = now
35 | }
36 | } else {
37 | showNoNetworkMessage()
38 | lastNetworkMessageDate = Date()
39 | }
40 | }
41 | }
42 |
43 | static private func showNoNetworkMessage() {
44 | let banner = StatusBarNotificationBanner(title: "No Network Detected", style: .warning, colors: CustomBannerColors())
45 | banner.duration = 6.0
46 | banner.show()
47 | }
48 |
49 | static public func showMessage(_ text: String, style: BannerStyle) {
50 | let banner = StatusBarNotificationBanner(title: text, style: style, colors: CustomBannerColors())
51 | banner.duration = 2.0
52 | banner.show()
53 | }
54 |
55 |
56 |
57 |
58 |
59 | }
60 |
61 | fileprivate class CustomBannerColors: BannerColorsProtocol {
62 |
63 | func color(for style: BannerStyle) -> UIColor {
64 | switch style {
65 | case .danger:
66 | return ArkPalette.textColor
67 | case .info: // Your custom .info color
68 | return ArkPalette.textColor
69 | case .none: // Your custom .none color
70 | return ArkPalette.textColor
71 | case .success: // Your custom .success color
72 | return ArkPalette.accentColor
73 | case .warning: // Your custom .warning color
74 | return ArkPalette.textColor
75 | }
76 | }
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/ArkMonitor/ArkNetworkManager.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import Foundation
17 | import SwiftyArk
18 |
19 | public struct ArkNetworkManager {
20 |
21 | static var currentNetwork: NetworkPreset? {
22 | get {
23 | if let presetString = UserDefaults.standard.string(forKey: "networkPreset") {
24 | if let preset = NetworkPreset(rawValue: presetString) {
25 | return preset
26 | } else {
27 | return nil
28 | }
29 | } else {
30 | return nil
31 | }
32 | }
33 | set {
34 | if let value = newValue {
35 | UserDefaults.standard.set(value.rawValue, forKey: "networkPreset")
36 | UserDefaults.standard.synchronize()
37 | } else {
38 | UserDefaults.standard.removeObject(forKey: "networkPreset")
39 | UserDefaults.standard.synchronize()
40 | }
41 | }
42 | }
43 |
44 | static public var CurrentCustomServer: CustomServer? {
45 | get {
46 | guard let rawData = UserDefaults.standard.object(forKey: "currentCustomServer") as? [String: AnyObject] else {
47 | return nil
48 | }
49 |
50 | if let server = CustomServer(dictionary: rawData) {
51 | return server
52 | } else {
53 | return nil
54 | }
55 | }
56 | set {
57 | if let server = newValue {
58 | UserDefaults.standard.set(server.dictionary(), forKey: "currentCustomServer")
59 | } else {
60 | UserDefaults.standard.removeObject(forKey: "currentCustomServer")
61 | }
62 | UserDefaults.standard.synchronize()
63 | }
64 | }
65 |
66 | static public private(set) var CustomServers: [CustomServer] {
67 | get {
68 | guard let rawData = UserDefaults.standard.object(forKey: "customServers") as? [[String: AnyObject]] else {
69 | return []
70 | }
71 |
72 | var servers = [CustomServer]()
73 |
74 | for data in rawData {
75 | if let server = CustomServer(dictionary: data) {
76 | servers.append(server)
77 | }
78 | }
79 | return servers
80 | }
81 | set {
82 | let newServers = newValue
83 |
84 | var newDict = [[String: AnyObject]]()
85 |
86 | for server in newServers {
87 | newDict.append(server.dictionary())
88 | }
89 |
90 | UserDefaults.standard.set(newDict, forKey: "customServers")
91 | UserDefaults.standard.synchronize()
92 | }
93 | }
94 |
95 | static public func updateNetwork(_ preset: NetworkPreset) {
96 | currentNetwork = preset
97 | CurrentCustomServer = nil
98 | ArkDataManager.startupOperations()
99 | ArkActivityView.showMessage(NSLocalizedString("Message.SuccessfullyUpdatedServer", comment: ""), style: .success)
100 | }
101 |
102 | static public func updateNetwork(_ server: CustomServer) {
103 | CurrentCustomServer = server
104 | currentNetwork = nil
105 | ArkDataManager.startupOperations()
106 | ArkActivityView.showMessage(NSLocalizedString("Message.SuccessfullyUpdatedServer", comment: ""), style: .success)
107 | }
108 |
109 | static public func setNetwork(_ manager: ArkManager) {
110 | if let customServer = CurrentCustomServer {
111 | manager.updateNetwork(customServer.network())
112 | } else if let serverPreset = currentNetwork {
113 | manager.updateNetworkPreset(serverPreset)
114 | } else {
115 | manager.updateNetworkPreset(.arknode)
116 | currentNetwork = .arknode
117 | }
118 | }
119 |
120 | static public func add(_ newServer: CustomServer, success: @escaping(_ success: Bool) -> ()) {
121 | var currentServers = CustomServers
122 | for server in CustomServers {
123 | if server == newServer {
124 | success(false)
125 | return
126 | }
127 | }
128 |
129 | currentServers.append(newServer)
130 | CustomServers = currentServers
131 | success(true)
132 | }
133 |
134 | static public func remove(_ server: CustomServer) {
135 | var currentServers = CustomServers
136 |
137 | for aServer in currentServers {
138 | if server == aServer {
139 | currentServers.remove(object: aServer)
140 | }
141 | }
142 | CustomServers = currentServers
143 | }
144 | }
145 |
146 | extension Array where Element: Equatable {
147 | mutating func remove(object: Element) {
148 | if let index = index(of: object) {
149 | remove(at: index)
150 | }
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/ArkMonitor/ArkNotificationManager.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import Foundation
17 |
18 | enum ArkNotifications: String {
19 | case accountUpdated = "homeUpdated"
20 | case transactionsUpdated = "transactionsUpdated"
21 | case tickerUpdated = "tickerUpdated"
22 | case delegateListUpdated = "delegateListUpdated"
23 | case accountVoteUpdated = "accountVoteUpdated"
24 | case accountLogout = "accountLogout"
25 | }
26 |
27 | class ArkNotificationManager: NSObject {
28 | static func postNotification(_ notification: ArkNotifications) {
29 | NotificationCenter.default.post(name: Notification.Name(rawValue: notification.rawValue), object: nil, userInfo: nil)
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/ArkMonitor/ArkPalette.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | public struct ArkPalette {
19 | static public let backgroundColor = UIColor(r: 0, g: 0, b: 0)
20 | static public let secondaryBackgroundColor = UIColor(r: 19, g: 19, b: 19)
21 | static public let tertiaryBackgroundColor = UIColor(r: 42, g: 42, b: 42)
22 | static public let textColor = UIColor(r: 119, g: 119, b: 125)
23 | static public let highlightedTextColor = UIColor(r: 249, g: 247, b: 247)
24 | static public let accentColor = UIColor(r: 0, g: 191, b: 192)
25 |
26 | }
27 |
28 | extension UIColor {
29 | convenience init(r: Int, g: Int, b: Int) {
30 | self.init(red: CGFloat(r) / 255.0, green: CGFloat(g) / 255.0, blue: CGFloat(b) / 255.0, alpha: 1.0)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ArkMonitor/ArkTabViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class ArkTabViewController: UITabBarController, UITabBarControllerDelegate {
19 |
20 | let transitionDelegate = AccountTransitionDelegate()
21 |
22 | override func viewDidLoad() {
23 | super.viewDidLoad()
24 |
25 | delegate = self
26 | tabBar.tintColor = ArkPalette.accentColor
27 | if #available(iOS 10.0, *) {
28 | tabBar.unselectedItemTintColor = ArkPalette.textColor
29 | }
30 | tabBar.barTintColor = ArkPalette.backgroundColor
31 | tabBar.isTranslucent = true
32 |
33 | let homeViewController = HomeViewController()
34 | let homeNav = ArkNavigationViewController(rootViewController: homeViewController)
35 | homeNav.tabBarItem = UITabBarItem(title: NSLocalizedString("TabBar.Home", comment: ""), image: #imageLiteral(resourceName: "homeFilled"), selectedImage: nil)
36 |
37 | let myDelegateVieController = MyDelegateViewController()
38 | let myDelegateNav = ArkNavigationViewController(rootViewController: myDelegateVieController)
39 | myDelegateNav.tabBarItem = UITabBarItem(title: NSLocalizedString("TabBar.Delegate", comment: ""), image: #imageLiteral(resourceName: "delegatesFilled"), selectedImage: nil)
40 |
41 | let explorerVC = ExplorerViewController()
42 | let explorerNav = ArkNavigationViewController(rootViewController: explorerVC)
43 | explorerNav.tabBarItem = UITabBarItem(title: NSLocalizedString("TabBar.Explorer", comment: ""), image: #imageLiteral(resourceName: "explorerIcon"), selectedImage: nil)
44 |
45 |
46 | let delegatesViewController = DelegateListViewController()
47 | let delegateNav = ArkNavigationViewController(rootViewController: delegatesViewController)
48 | delegateNav.tabBarItem = UITabBarItem(title: NSLocalizedString("TabBar.Delegates", comment: ""), image: #imageLiteral(resourceName: "delegateList"), selectedImage: nil)
49 |
50 |
51 | let settingsVC = SettingsViewController()
52 | let miscNav = ArkNavigationViewController(rootViewController: settingsVC)
53 | miscNav.tabBarItem = UITabBarItem(title: NSLocalizedString("TabBar.Settings", comment: ""), image: #imageLiteral(resourceName: "settings"), selectedImage: nil)
54 |
55 | viewControllers = [homeNav, myDelegateNav, delegateNav, explorerNav, miscNav]
56 | }
57 |
58 | override func viewDidAppear(_ animated: Bool) {
59 | super.viewDidAppear(animated)
60 | if ArkDataManager.currentAddress == nil && ArkDataManager.currentPublickey == nil {
61 | let vc = AccountViewController()
62 | vc.transitioningDelegate = transitionDelegate
63 | present(vc, animated: true, completion: nil)
64 | }
65 |
66 | NotificationCenter.default.addObserver(self, selector: #selector(showLogin), name: NSNotification.Name(rawValue: ArkNotifications.accountLogout.rawValue), object: nil)
67 | }
68 |
69 | deinit {
70 | NotificationCenter.default.removeObserver(self)
71 | }
72 |
73 | @objc private func showLogin() {
74 | let vc = AccountViewController()
75 | vc.transitioningDelegate = transitionDelegate
76 | present(vc, animated: true) {
77 | self.selectedIndex = 0
78 | }
79 | }
80 |
81 | func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
82 | viewController.viewDidAppear(true)
83 | }
84 |
85 | override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
86 | //ArkHaptics.selectionChanged()
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "iphoneNotifications@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "iphoneNotifications@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "iphoneSpotlight@2x.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "iphoneSpotlight@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "iphoneSettings@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "iphoneSettings@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "iphone@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "iphone@3x.png",
49 | "scale" : "3x"
50 | },
51 | {
52 | "idiom" : "ipad",
53 | "size" : "20x20",
54 | "scale" : "1x"
55 | },
56 | {
57 | "size" : "20x20",
58 | "idiom" : "ipad",
59 | "filename" : "ipadNotifications@2x-1.png",
60 | "scale" : "2x"
61 | },
62 | {
63 | "idiom" : "ipad",
64 | "size" : "29x29",
65 | "scale" : "1x"
66 | },
67 | {
68 | "size" : "29x29",
69 | "idiom" : "ipad",
70 | "filename" : "ipadSettings@2x.png",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "40x40",
76 | "scale" : "1x"
77 | },
78 | {
79 | "size" : "40x40",
80 | "idiom" : "ipad",
81 | "filename" : "ipadSpotlight@2x.png",
82 | "scale" : "2x"
83 | },
84 | {
85 | "idiom" : "ipad",
86 | "size" : "76x76",
87 | "scale" : "1x"
88 | },
89 | {
90 | "size" : "76x76",
91 | "idiom" : "ipad",
92 | "filename" : "ipad@2x.png",
93 | "scale" : "2x"
94 | },
95 | {
96 | "size" : "83.5x83.5",
97 | "idiom" : "ipad",
98 | "filename" : "ipadPro@3x.png",
99 | "scale" : "2x"
100 | },
101 | {
102 | "size" : "1024x1024",
103 | "idiom" : "ios-marketing",
104 | "filename" : "appStore.png",
105 | "scale" : "1x"
106 | }
107 | ],
108 | "info" : {
109 | "version" : 1,
110 | "author" : "xcode"
111 | }
112 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/appStore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/appStore.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipad@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipad@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadNotifications@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadNotifications@2x-1.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadPro@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadPro@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadSettings@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadSettings@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadSpotlight@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/ipadSpotlight@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphone@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphone@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneNotifications@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneNotifications@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneNotifications@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneNotifications@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSettings@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSettings@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSettings@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSettings@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSpotlight@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSpotlight@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSpotlight@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/AppIcon.appiconset/iphoneSpotlight@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/ArkLogo.imageset/ArkLogo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/ArkLogo.imageset/ArkLogo@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/ArkLogo.imageset/ArkLogo@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/ArkLogo.imageset/ArkLogo@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/ArkLogo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "ArkLogo@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "ArkLogo@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/check.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "check@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "check@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/check.imageset/check@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/check.imageset/check@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/check.imageset/check@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/check.imageset/check@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/chevron.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "chevron@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "chevron@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/chevron.imageset/chevron@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/chevron.imageset/chevron@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/chevron.imageset/chevron@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/chevron.imageset/chevron@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/delegateList.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "delegateList@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "delegateList@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/delegateList.imageset/delegateList@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/delegateList.imageset/delegateList@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/delegateList.imageset/delegateList@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/delegateList.imageset/delegateList@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/delegatesFilled.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "delegatesFilled@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "delegatesFilled@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/delegatesFilled.imageset/delegatesFilled@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/delegatesFilled.imageset/delegatesFilled@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/delegatesFilled.imageset/delegatesFilled@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/delegatesFilled.imageset/delegatesFilled@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/explorerIcon.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "explorerIcon@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "explorerIcon@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/explorerIcon.imageset/explorerIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/explorerIcon.imageset/explorerIcon@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/explorerIcon.imageset/explorerIcon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/explorerIcon.imageset/explorerIcon@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/homeFilled.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "homeFillex@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "homeFilled@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/homeFilled.imageset/homeFilled@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/homeFilled.imageset/homeFilled@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/homeFilled.imageset/homeFillex@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/homeFilled.imageset/homeFillex@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/launchScreenBackground.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "launchScreen@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "launchScreen@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/launchScreenBackground.imageset/launchScreen@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/launchScreenBackground.imageset/launchScreen@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/launchScreenBackground.imageset/launchScreen@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/launchScreenBackground.imageset/launchScreen@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/qrCode.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "qrCode@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "qrCode@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/qrCode.imageset/qrCode@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/qrCode.imageset/qrCode@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/qrCode.imageset/qrCode@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/qrCode.imageset/qrCode@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/receivedCellIcon.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "receivedCellIcon@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "receivedCellIcon@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/receivedCellIcon.imageset/receivedCellIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/receivedCellIcon.imageset/receivedCellIcon@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/receivedCellIcon.imageset/receivedCellIcon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/receivedCellIcon.imageset/receivedCellIcon@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/sendCellIcon.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "sendCelllIcon@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "sendCellIcon@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/sendCellIcon.imageset/sendCellIcon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/sendCellIcon.imageset/sendCellIcon@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/sendCellIcon.imageset/sendCelllIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/sendCellIcon.imageset/sendCelllIcon@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/serverCheck.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "serverCheck@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "serverCheck@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/serverCheck.imageset/serverCheck@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/serverCheck.imageset/serverCheck@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/serverCheck.imageset/serverCheck@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/serverCheck.imageset/serverCheck@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/settings.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "settings@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "settings@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/settings.imageset/settings@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/settings.imageset/settings@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/settings.imageset/settings@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/settings.imageset/settings@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/voteCellIcon.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "voteCellIcon@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "voteCellIcon@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/voteCellIcon.imageset/voteCellIcon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/voteCellIcon.imageset/voteCellIcon@2x.png
--------------------------------------------------------------------------------
/ArkMonitor/Assets.xcassets/voteCellIcon.imageset/voteCellIcon@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ArkEcosystemArchive/ios-monitor/f773526970f8bf7aee27a041bdeeb4318b403d0e/ArkMonitor/Assets.xcassets/voteCellIcon.imageset/voteCellIcon@3x.png
--------------------------------------------------------------------------------
/ArkMonitor/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ArkMonitor/Delegate List/DelegateDetailViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class DelegateDetailViewController: ArkViewController {
20 |
21 | fileprivate let delegate : Delegate
22 | fileprivate var tableView : ArkTableView!
23 |
24 | init(_ delegate: Delegate) {
25 | self.delegate = delegate
26 | super.init(nibName: nil, bundle: nil)
27 |
28 | }
29 |
30 | required init?(coder aDecoder: NSCoder) {
31 | fatalError("init(coder:) has not been implemented")
32 | }
33 |
34 | override func viewDidLoad() {
35 | super.viewDidLoad()
36 |
37 | navigationItem.title = delegate.username
38 |
39 | tableView = ArkTableView(CGRect.zero)
40 | tableView.delegate = self
41 | tableView.dataSource = self
42 |
43 | view.addSubview(tableView)
44 | tableView.snp.makeConstraints { (make) in
45 | make.left.right.top.bottom.equalToSuperview()
46 | }
47 | }
48 | }
49 |
50 | // MARK: UITableViewDelegate
51 | extension DelegateDetailViewController : UITableViewDelegate {
52 |
53 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
54 | return 35.0
55 | }
56 |
57 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
58 | let headerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: _screenWidth, height: 35.0))
59 | headerView.backgroundColor = ArkPalette.secondaryBackgroundColor
60 |
61 | let headerLabel = UILabel(frame: CGRect(x: 12.5, y: 0.0, width: _screenWidth - 12.5, height: 35.0))
62 | headerLabel.textColor = ArkPalette.highlightedTextColor
63 | headerLabel.textAlignment = .center
64 | headerLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
65 |
66 | switch section {
67 | case 0:
68 | headerLabel.text = NSLocalizedString("Delegates.Address", comment: "")
69 | case 1:
70 | headerLabel.text = NSLocalizedString("Delegates.PublicKey", comment: "")
71 | case 2:
72 | headerLabel.text = NSLocalizedString("Delegates.Votes", comment: "")
73 | case 3:
74 | headerLabel.text = NSLocalizedString("Delegates.ProducedBlocks", comment: "")
75 | case 4:
76 | headerLabel.text = NSLocalizedString("Delegates.MissedBlocks", comment: "")
77 | case 5:
78 | headerLabel.text = NSLocalizedString("Delegates.Rank", comment: "")
79 | case 6:
80 | headerLabel.text = NSLocalizedString("Delegates.Productivity", comment: "")
81 | default:
82 | headerLabel.text = NSLocalizedString("Delegates.Approval", comment: "")
83 | }
84 | headerView.addSubview(headerLabel)
85 | return headerView
86 | }
87 |
88 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
89 | if indexPath.section == 1 {
90 | return 65.0
91 | }
92 | return 45.0
93 | }
94 |
95 | func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
96 | return CGFloat.leastNormalMagnitude
97 | }
98 |
99 | func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
100 | return nil
101 | }
102 |
103 | }
104 |
105 | // MARK: UITableViewDelegate
106 | extension DelegateDetailViewController : UITableViewDataSource {
107 |
108 | func numberOfSections(in tableView: UITableView) -> Int {
109 | return 8
110 | }
111 |
112 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
113 | return 1
114 | }
115 |
116 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
117 |
118 | var titleString = ""
119 | var numberOfLines = 1
120 |
121 | switch indexPath.section {
122 | case 0:
123 | titleString = delegate.address
124 | case 1:
125 | titleString = delegate.publicKey
126 | numberOfLines = 2
127 | case 2:
128 | titleString = String(delegate.votes)
129 | case 3:
130 | titleString = String(delegate.producedblocks)
131 | case 4:
132 | titleString = String(delegate.missedblocks)
133 | case 5:
134 | titleString = String(delegate.rate)
135 | case 6:
136 | titleString = String(delegate.productivity) + "%"
137 | default:
138 | titleString = String(delegate.approval) + "%"
139 | }
140 |
141 | let cell = ArkDetailTableViewCell(titleString, numberOfLines: numberOfLines)
142 | return cell
143 | }
144 | }
145 |
146 |
147 |
--------------------------------------------------------------------------------
/ArkMonitor/Delegate List/DelegateListSectionHeaderView.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class DelegateListSectionHeaderView: UIView {
19 |
20 | override init(frame: CGRect) {
21 | super.init(frame: frame)
22 |
23 | backgroundColor = ArkPalette.secondaryBackgroundColor
24 |
25 | let rankLabel = UILabel()
26 | rankLabel.textColor = ArkPalette.highlightedTextColor
27 | rankLabel.text = NSLocalizedString("Delegates.Rank", comment: "")
28 | rankLabel.textAlignment = .center
29 | rankLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
30 | addSubview(rankLabel)
31 |
32 | rankLabel.snp.makeConstraints { (make) in
33 | make.top.bottom.left.equalToSuperview()
34 | make.width.equalToSuperview().multipliedBy(0.16)
35 | }
36 |
37 | let nameLabel = UILabel()
38 | nameLabel.textColor = ArkPalette.highlightedTextColor
39 | nameLabel.text = NSLocalizedString("Delegates.Username", comment: "")
40 | nameLabel.textAlignment = .center
41 | nameLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
42 | addSubview(nameLabel)
43 |
44 | nameLabel.snp.makeConstraints { (make) in
45 | make.top.bottom.equalToSuperview()
46 | make.left.equalTo(rankLabel.snp.right)
47 | make.width.equalToSuperview().multipliedBy(0.28)
48 | }
49 |
50 | let approvalLabel = UILabel()
51 | approvalLabel.textColor = ArkPalette.highlightedTextColor
52 | approvalLabel.text = NSLocalizedString("Delegates.Approval", comment: "")
53 | approvalLabel.textAlignment = .center
54 | approvalLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
55 | addSubview(approvalLabel)
56 |
57 | approvalLabel.snp.makeConstraints { (make) in
58 | make.top.bottom.equalToSuperview()
59 | make.left.equalTo(nameLabel.snp.right)
60 | make.width.equalToSuperview().multipliedBy(0.28)
61 | }
62 |
63 | let productivityLabel = UILabel()
64 | productivityLabel.textColor = ArkPalette.highlightedTextColor
65 | productivityLabel.text = NSLocalizedString("Delegates.Productivity", comment: "")
66 | productivityLabel.textAlignment = .center
67 | productivityLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
68 | addSubview(productivityLabel)
69 |
70 | productivityLabel.snp.makeConstraints { (make) in
71 | make.top.bottom.equalToSuperview()
72 | make.left.equalTo(approvalLabel.snp.right)
73 | make.width.equalToSuperview().multipliedBy(0.28)
74 | }
75 | }
76 |
77 | required init?(coder aDecoder: NSCoder) {
78 | fatalError("init(coder:) has not been implemented")
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/ArkMonitor/Delegate List/DelegateListViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class DelegateListViewController: ArkViewController {
20 |
21 | fileprivate var tableView : ArkTableView!
22 | fileprivate var delegates = [Delegate]()
23 |
24 | override func viewDidLoad() {
25 | super.viewDidLoad()
26 |
27 | navigationItem.title = NSLocalizedString("Delegates", comment: "")
28 | tableView = ArkTableView(CGRect.zero)
29 | tableView.delegate = self
30 | tableView.dataSource = self
31 |
32 | view.addSubview(tableView)
33 | tableView.snp.makeConstraints { (make) in
34 | make.left.right.top.bottom.equalToSuperview()
35 | }
36 |
37 | NotificationCenter.default.addObserver(self, selector: #selector(updateDelegates), name: NSNotification.Name(rawValue: ArkNotifications.delegateListUpdated.rawValue), object: nil)
38 | }
39 |
40 | override func viewDidAppear(_ animated: Bool) {
41 | super.viewDidAppear(animated)
42 | setNeedsStatusBarAppearanceUpdate()
43 | updateDelegates()
44 | }
45 |
46 | @objc private func updateDelegates() {
47 | guard let currentDelegates = ArkDataManager.currentDelegates else {
48 | return
49 | }
50 | self.delegates = currentDelegates
51 | tableView.reloadData()
52 | }
53 | }
54 |
55 | // MARK: UITableViewDelegate
56 | extension DelegateListViewController : UITableViewDelegate {
57 |
58 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
59 | return 35.0
60 | }
61 |
62 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
63 | let header = DelegateListSectionHeaderView(frame: CGRect(x: 0.0, y: 0.0, width: _screenWidth, height: 35.0))
64 | return header
65 | }
66 |
67 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
68 | return 45.0
69 | }
70 |
71 | func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
72 | if let aCell = cell as? DelegateTableViewCell {
73 | aCell.update(delegates[indexPath.row])
74 | }
75 | }
76 |
77 | func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
78 | return CGFloat.leastNormalMagnitude
79 | }
80 |
81 | func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
82 | return nil
83 | }
84 |
85 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
86 | let vc = DelegateDetailViewController(delegates[indexPath.row])
87 | navigationController?.pushViewController(vc, animated: true)
88 | }
89 | }
90 |
91 | // MARK: UITableViewDatasource
92 | extension DelegateListViewController : UITableViewDataSource {
93 |
94 | func numberOfSections(in tableView: UITableView) -> Int {
95 | return 1
96 | }
97 |
98 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
99 | let count = delegates.count
100 | return count
101 | }
102 |
103 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
104 | var cell = tableView.dequeueReusableCell(withIdentifier: "delegate")
105 |
106 | if cell == nil {
107 | cell = DelegateTableViewCell(style: .default, reuseIdentifier: "delegate")
108 | }
109 | return cell!
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/ArkMonitor/Delegate List/DelegateTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class DelegateTableViewCell: UITableViewCell {
20 |
21 | var delegate : Delegate?
22 |
23 | var rankLabel : UILabel!
24 | var nameLabel : UILabel!
25 | var approvalLabel : UILabel!
26 | var productivityLabel : UILabel!
27 | var seperator : UIView!
28 |
29 | public func update(_ delegate: Delegate) {
30 | self.delegate = delegate
31 | rankLabel.text = String(delegate.rate)
32 | nameLabel.text = delegate.username
33 | approvalLabel.text = String(delegate.approval) + "%"
34 | productivityLabel.text = String(delegate.productivity) + "%"
35 |
36 | if delegate.publicKey == ArkDataManager.currentVote?.publicKey {
37 | rankLabel.textColor = ArkPalette.accentColor
38 | nameLabel.textColor = ArkPalette.accentColor
39 | approvalLabel.textColor = ArkPalette.accentColor
40 | productivityLabel.textColor = ArkPalette.accentColor
41 | } else {
42 | rankLabel.textColor = ArkPalette.highlightedTextColor
43 | nameLabel.textColor = ArkPalette.highlightedTextColor
44 | approvalLabel.textColor = ArkPalette.highlightedTextColor
45 | productivityLabel.textColor = ArkPalette.highlightedTextColor
46 | }
47 |
48 | backgroundColor = ArkPalette.backgroundColor
49 | seperator.backgroundColor = ArkPalette.tertiaryBackgroundColor
50 | }
51 |
52 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
53 | super.init(style: style, reuseIdentifier: reuseIdentifier)
54 |
55 | backgroundColor = ArkPalette.backgroundColor
56 | selectionStyle = .none
57 |
58 | rankLabel = UILabel()
59 | rankLabel.textColor = ArkPalette.accentColor
60 | rankLabel.textAlignment = .center
61 | rankLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
62 | addSubview(rankLabel)
63 |
64 | rankLabel.snp.makeConstraints { (make) in
65 | make.top.bottom.left.equalToSuperview()
66 | make.width.equalToSuperview().multipliedBy(0.16)
67 | }
68 |
69 | nameLabel = UILabel()
70 | nameLabel.textColor = ArkPalette.highlightedTextColor
71 | nameLabel.adjustsFontSizeToFitWidth = true
72 | nameLabel.textAlignment = .center
73 | nameLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
74 | addSubview(nameLabel)
75 |
76 | nameLabel.snp.makeConstraints { (make) in
77 | make.top.bottom.equalToSuperview()
78 | make.left.equalTo(rankLabel.snp.right)
79 | make.width.equalToSuperview().multipliedBy(0.28)
80 | }
81 |
82 | approvalLabel = UILabel()
83 | approvalLabel.textColor = ArkPalette.highlightedTextColor
84 | approvalLabel.textAlignment = .center
85 | approvalLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
86 | addSubview(approvalLabel)
87 |
88 | approvalLabel.snp.makeConstraints { (make) in
89 | make.top.bottom.equalToSuperview()
90 | make.left.equalTo(nameLabel.snp.right)
91 | make.width.equalToSuperview().multipliedBy(0.28)
92 | }
93 |
94 | productivityLabel = UILabel()
95 | productivityLabel.textColor = ArkPalette.highlightedTextColor
96 | productivityLabel.textAlignment = .center
97 | productivityLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
98 | addSubview(productivityLabel)
99 |
100 | productivityLabel.snp.makeConstraints { (make) in
101 | make.top.bottom.equalToSuperview()
102 | make.left.equalTo(approvalLabel.snp.right)
103 | make.width.equalToSuperview().multipliedBy(0.28)
104 | }
105 |
106 | seperator = UIView()
107 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
108 | addSubview(seperator)
109 | seperator.snp.makeConstraints { (make) in
110 | make.left.right.bottom.equalToSuperview()
111 | make.height.equalTo(0.5)
112 | }
113 | }
114 |
115 | required init?(coder aDecoder: NSCoder) {
116 | fatalError("init(coder:) has not been implemented")
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/ArkMonitor/Explorer/AccountDetailViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class AccountDetailViewController: ArkViewController {
20 |
21 | fileprivate let account : Account
22 | fileprivate var tableView : ArkTableView!
23 |
24 | init(_ account: Account) {
25 | self.account = account
26 | super.init(nibName: nil, bundle: nil)
27 |
28 | }
29 |
30 | required init?(coder aDecoder: NSCoder) {
31 | fatalError("init(coder:) has not been implemented")
32 | }
33 |
34 | override func viewDidLoad() {
35 | super.viewDidLoad()
36 |
37 | navigationItem.title = NSLocalizedString("Account.Detail", comment: "")
38 |
39 | tableView = ArkTableView(CGRect.zero)
40 | tableView.delegate = self
41 | tableView.dataSource = self
42 |
43 | view.addSubview(tableView)
44 | tableView.snp.makeConstraints { (make) in
45 | make.left.right.top.bottom.equalToSuperview()
46 | }
47 | }
48 | }
49 |
50 | // MARK: UITableViewDelegate
51 | extension AccountDetailViewController : UITableViewDelegate {
52 |
53 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
54 | return 35.0
55 | }
56 |
57 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
58 | let headerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: _screenWidth, height: 35.0))
59 | headerView.backgroundColor = ArkPalette.secondaryBackgroundColor
60 |
61 | let headerLabel = UILabel(frame: CGRect(x: 12.5, y: 0.0, width: _screenWidth - 12.5, height: 35.0))
62 | headerLabel.textColor = ArkPalette.highlightedTextColor
63 | headerLabel.textAlignment = .center
64 | headerLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
65 |
66 | switch section {
67 | case 0:
68 | headerLabel.text = NSLocalizedString("Account.Address", comment: "")
69 | case 1:
70 | headerLabel.text = NSLocalizedString("Account.PublicKey", comment: "")
71 | case 2:
72 | headerLabel.text = NSLocalizedString("Account.Balance", comment: "")
73 | case 3:
74 | headerLabel.text = NSLocalizedString("Account.UnconfirmedBalance", comment: "")
75 | default:
76 | headerLabel.text = ""
77 | }
78 | headerView.addSubview(headerLabel)
79 | return headerView
80 | }
81 |
82 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
83 | if indexPath.section == 1 {
84 | return 65.0
85 | }
86 | return 45.0
87 | }
88 |
89 | func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
90 | return CGFloat.leastNormalMagnitude
91 | }
92 |
93 | func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
94 | return nil
95 | }
96 |
97 | }
98 |
99 | // MARK: UITableViewDelegate
100 | extension AccountDetailViewController : UITableViewDataSource {
101 |
102 | func numberOfSections(in tableView: UITableView) -> Int {
103 | return 4
104 | }
105 |
106 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
107 | return 1
108 | }
109 |
110 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
111 |
112 | var titleString = ""
113 | var numberOfLines = 1
114 |
115 | switch indexPath.section {
116 | case 0:
117 | titleString = account.address
118 | case 1:
119 | titleString = account.publicKey
120 | numberOfLines = 2
121 | case 2:
122 | titleString = String(account.balance)
123 | case 3:
124 | titleString = String(account.unconfirmedBalance)
125 | default:
126 | titleString = " "
127 | }
128 |
129 | let cell = ArkDetailTableViewCell(titleString, numberOfLines: numberOfLines)
130 | return cell
131 | }
132 | }
133 |
134 |
135 |
--------------------------------------------------------------------------------
/ArkMonitor/Explorer/Tableview Cells/ExplorerAccountTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class ExplorerAccountTableViewCell: UITableViewCell {
20 |
21 | public let account: Account
22 |
23 | init(_ account: Account) {
24 | self.account = account
25 | super.init(style: .default, reuseIdentifier: "account")
26 |
27 | backgroundColor = ArkPalette.secondaryBackgroundColor
28 | selectionStyle = .none
29 |
30 | let nameLabel = UILabel()
31 | nameLabel.textColor = ArkPalette.highlightedTextColor
32 | nameLabel.text = account.address
33 |
34 | nameLabel.adjustsFontSizeToFitWidth = true
35 | nameLabel.textAlignment = .center
36 | nameLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .regular)
37 | addSubview(nameLabel)
38 |
39 | nameLabel.snp.makeConstraints { (make) in
40 | make.top.bottom.equalToSuperview()
41 | make.left.equalTo(25.0)
42 | make.right.equalToSuperview().offset(-25.0)
43 | }
44 |
45 | let seperator = UIView()
46 | seperator.backgroundColor = ArkPalette.backgroundColor
47 | addSubview(seperator)
48 | seperator.snp.makeConstraints { (make) in
49 | make.left.right.bottom.equalToSuperview()
50 | make.height.equalTo(0.5)
51 | }
52 | }
53 |
54 | required init?(coder aDecoder: NSCoder) {
55 | fatalError("init(coder:) has not been implemented")
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/ArkMonitor/Explorer/Tableview Cells/ExplorerBlockTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class ExplorerBlockTableViewCell: UITableViewCell {
20 |
21 | public let block: Block
22 |
23 | init(_ block: Block) {
24 | self.block = block
25 | super.init(style: .default, reuseIdentifier: "block")
26 |
27 | backgroundColor = ArkPalette.secondaryBackgroundColor
28 | selectionStyle = .none
29 |
30 | let nameLabel = UILabel()
31 | nameLabel.textColor = ArkPalette.highlightedTextColor
32 | nameLabel.text = block.id
33 |
34 | nameLabel.adjustsFontSizeToFitWidth = true
35 | nameLabel.textAlignment = .left
36 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
37 | addSubview(nameLabel)
38 |
39 | nameLabel.snp.makeConstraints { (make) in
40 | make.top.bottom.equalToSuperview()
41 | make.left.equalTo(25.0)
42 | make.right.equalToSuperview().offset(-25.0)
43 | }
44 |
45 | let seperator = UIView()
46 | seperator.backgroundColor = ArkPalette.backgroundColor
47 | addSubview(seperator)
48 | seperator.snp.makeConstraints { (make) in
49 | make.left.right.bottom.equalToSuperview()
50 | make.height.equalTo(0.5)
51 | }
52 | }
53 |
54 | required init?(coder aDecoder: NSCoder) {
55 | fatalError("init(coder:) has not been implemented")
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/ArkMonitor/Explorer/Tableview Cells/ExplorerDelegateTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class ExplorerDelegateTableViewCell: UITableViewCell {
20 |
21 | public let delegate: Delegate
22 |
23 | init(_ delegate: Delegate) {
24 | self.delegate = delegate
25 | super.init(style: .default, reuseIdentifier: "delegate")
26 |
27 | backgroundColor = ArkPalette.secondaryBackgroundColor
28 | selectionStyle = .none
29 |
30 | let nameLabel = UILabel()
31 | nameLabel.textColor = ArkPalette.highlightedTextColor
32 | nameLabel.text = delegate.username
33 |
34 | nameLabel.adjustsFontSizeToFitWidth = true
35 | nameLabel.textAlignment = .left
36 | nameLabel.font = UIFont.systemFont(ofSize: 18.0, weight: .semibold)
37 | addSubview(nameLabel)
38 |
39 | nameLabel.snp.makeConstraints { (make) in
40 | make.top.bottom.equalToSuperview()
41 | make.left.equalTo(25.0)
42 | make.right.equalToSuperview().offset(-25.0)
43 | }
44 |
45 | let seperator = UIView()
46 | seperator.backgroundColor = ArkPalette.backgroundColor
47 | addSubview(seperator)
48 | seperator.snp.makeConstraints { (make) in
49 | make.left.right.bottom.equalToSuperview()
50 | make.height.equalTo(0.5)
51 | }
52 | }
53 |
54 | required init?(coder aDecoder: NSCoder) {
55 | fatalError("init(coder:) has not been implemented")
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/ArkMonitor/Explorer/Tableview Cells/ExplorerTransactionTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class ExplorerTransactionTableViewCell: UITableViewCell {
20 |
21 | public let transaction: Transaction
22 |
23 | init(_ transaction: Transaction) {
24 | self.transaction = transaction
25 | super.init(style: .default, reuseIdentifier: "transaction")
26 |
27 | backgroundColor = ArkPalette.secondaryBackgroundColor
28 | selectionStyle = .none
29 |
30 | let nameLabel = UILabel()
31 | nameLabel.textColor = ArkPalette.highlightedTextColor
32 | nameLabel.text = transaction.id
33 |
34 | nameLabel.adjustsFontSizeToFitWidth = true
35 | nameLabel.textAlignment = .left
36 | nameLabel.numberOfLines = 2
37 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
38 | addSubview(nameLabel)
39 |
40 | nameLabel.snp.makeConstraints { (make) in
41 | make.top.bottom.equalToSuperview()
42 | make.left.equalTo(12.5)
43 | make.right.equalToSuperview().offset(-12.5)
44 | }
45 |
46 | let seperator = UIView()
47 | seperator.backgroundColor = ArkPalette.backgroundColor
48 | addSubview(seperator)
49 | seperator.snp.makeConstraints { (make) in
50 | make.left.right.bottom.equalToSuperview()
51 | make.height.equalTo(0.5)
52 | }
53 | }
54 |
55 | required init?(coder aDecoder: NSCoder) {
56 | fatalError("init(coder:) has not been implemented")
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/ArkMonitor/Home /ReceiveTransferViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class ReceiveTransferViewController: ArkViewController {
20 |
21 | private let account : Account
22 | private var qrCodeView : UIImageView!
23 | private var addressDescription : UILabel!
24 |
25 |
26 | init(_ account: Account) {
27 | self.account = account
28 | super.init(nibName: nil, bundle: nil)
29 | }
30 |
31 | required init?(coder aDecoder: NSCoder) {
32 | fatalError("init(coder:) has not been implemented")
33 | }
34 |
35 | override func viewDidLoad() {
36 | super.viewDidLoad()
37 | navigationItem.title = NSLocalizedString("Account", comment: "")
38 |
39 | let bottomButton = UIButton()
40 | bottomButton.backgroundColor = ArkPalette.accentColor
41 | bottomButton.setTitle(NSLocalizedString("ReceiveTransfer.CopyAddress", comment: ""), for: UIControlState())
42 | bottomButton.setTitleColor(ArkPalette.highlightedTextColor, for: UIControlState())
43 | bottomButton.titleLabel?.font = UIFont.systemFont(ofSize: 18.0, weight: .semibold)
44 | bottomButton.addTarget(self, action: #selector(copyAddressToClipboard), for: .touchUpInside)
45 | view.addSubview(bottomButton)
46 | bottomButton.snp.makeConstraints { (make) in
47 | make.left.right.equalToSuperview()
48 | make.height.equalTo(45.0)
49 | make.bottom.equalToSuperview().offset(-49.0)
50 | }
51 |
52 | let arkAddressLabel = UILabel()
53 | arkAddressLabel.text = account.address
54 | arkAddressLabel.textColor = ArkPalette.highlightedTextColor
55 | arkAddressLabel.font = UIFont.systemFont(ofSize: 16.0)
56 | arkAddressLabel.adjustsFontSizeToFitWidth = true
57 | arkAddressLabel.textAlignment = .center
58 | view.addSubview(arkAddressLabel)
59 | arkAddressLabel.snp.makeConstraints { (make) in
60 | make.left.equalTo(25.0)
61 | make.right.equalToSuperview().offset(-25.0)
62 | make.height.equalTo(25.0)
63 | make.centerY.equalTo(_screenHeight * 0.6)
64 | }
65 |
66 | addressDescription = UILabel()
67 | addressDescription.textAlignment = .center
68 | addressDescription.textColor = ArkPalette.highlightedTextColor
69 | addressDescription.font = UIFont.systemFont(ofSize: 18.0, weight: .semibold)
70 | addressDescription.text = NSLocalizedString("ArkAddress", comment: "").uppercased()
71 | view.addSubview(addressDescription)
72 | addressDescription.snp.makeConstraints { (make) in
73 | make.left.right.equalToSuperview()
74 | make.height.equalTo(25.0)
75 | make.bottom.equalTo(arkAddressLabel).offset(-25.0)
76 | }
77 |
78 | let spacer = UIView()
79 | view.addSubview(spacer)
80 | spacer.snp.makeConstraints { (make) in
81 | make.left.right.top.equalToSuperview()
82 | make.bottom.equalTo(addressDescription.snp.top)
83 | }
84 |
85 | if let qrCodeImage = account.qrCode() {
86 | qrCodeView = UIImageView(image: qrCodeImage)
87 | spacer.addSubview(qrCodeView)
88 | qrCodeView.snp.makeConstraints{ (make) in
89 | make.height.width.equalTo(_screenWidth * 0.6)
90 | make.center.equalToSuperview()
91 | }
92 | }
93 | }
94 |
95 | override func viewWillAppear(_ animated: Bool) {
96 | super.viewWillAppear(animated)
97 | navigationController?.setNavigationBarHidden(false, animated: true)
98 | }
99 |
100 | @objc private func copyAddressToClipboard() {
101 | UIPasteboard.general.string = account.address
102 | ArkActivityView.showMessage(NSLocalizedString("ReceiveTransfer.AddressSuccessfullyCopied", comment: ""), style: .success)
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/ArkMonitor/Home /TransactionDetailViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class TransactionDetailViewController: ArkViewController {
20 |
21 | fileprivate let transaction : Transaction
22 | fileprivate var tableView : ArkTableView!
23 |
24 | init(_ transaction: Transaction) {
25 | self.transaction = transaction
26 | super.init(nibName: nil, bundle: nil)
27 | }
28 |
29 | required init?(coder aDecoder: NSCoder) {
30 | fatalError("init(coder:) has not been implemented")
31 | }
32 |
33 | override func viewDidLoad() {
34 | super.viewDidLoad()
35 |
36 | navigationItem.title = NSLocalizedString("Transaction.Detail", comment: "")
37 |
38 | tableView = ArkTableView(CGRect.zero)
39 | tableView.delegate = self
40 | tableView.dataSource = self
41 |
42 | view.addSubview(tableView)
43 | tableView.snp.makeConstraints { (make) in
44 | make.left.right.top.bottom.equalToSuperview()
45 | }
46 | }
47 |
48 | override func viewWillAppear(_ animated: Bool) {
49 | super.viewWillAppear(animated)
50 | navigationController?.setNavigationBarHidden(false, animated: true)
51 | }
52 | }
53 |
54 | // MARK: UITableViewDelegate
55 | extension TransactionDetailViewController : UITableViewDelegate {
56 |
57 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
58 | return 35.0
59 | }
60 |
61 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
62 | let headerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: _screenWidth, height: 35.0))
63 | headerView.backgroundColor = ArkPalette.secondaryBackgroundColor
64 |
65 | let headerLabel = UILabel(frame: CGRect(x: 12.5, y: 0.0, width: _screenWidth - 12.5, height: 35.0))
66 | headerLabel.textColor = ArkPalette.highlightedTextColor
67 | headerLabel.textAlignment = .center
68 | headerLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
69 |
70 | switch section {
71 | case 0:
72 | headerLabel.text = NSLocalizedString("Transaction.TransactionID", comment: "")
73 | case 1:
74 | headerLabel.text = NSLocalizedString("Transaction.Time", comment: "")
75 | case 2:
76 | headerLabel.text = NSLocalizedString("Transaction.From", comment: "")
77 | case 3:
78 | headerLabel.text = NSLocalizedString("Transaction.To", comment: "")
79 | case 4:
80 | headerLabel.text = NSLocalizedString("Transaction.Amount", comment: "")
81 | case 5:
82 | headerLabel.text = NSLocalizedString("Transaction.Fee", comment: "")
83 | case 6:
84 | headerLabel.text = NSLocalizedString("Transaction.Confirmations", comment: "")
85 | default:
86 | headerLabel.text = NSLocalizedString("Transaction.VendorField", comment: "")
87 | }
88 | headerView.addSubview(headerLabel)
89 | return headerView
90 | }
91 |
92 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
93 | if indexPath.section == 0 {
94 | return 65.0
95 | }
96 | return 45.0
97 | }
98 |
99 | func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
100 | return CGFloat.leastNormalMagnitude
101 | }
102 |
103 | func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
104 | return nil
105 | }
106 | }
107 |
108 | // MARK: UITableViewDelegate
109 | extension TransactionDetailViewController : UITableViewDataSource {
110 |
111 | func numberOfSections(in tableView: UITableView) -> Int {
112 | if transaction.vendorField != nil {
113 | return 8
114 | } else {
115 | return 7
116 | }
117 | }
118 |
119 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
120 | return 1
121 | }
122 |
123 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
124 |
125 | var titleString = ""
126 | var numberOfLines = 1
127 |
128 | switch indexPath.section {
129 | case 0:
130 | titleString = transaction.id
131 | numberOfLines = 2
132 | case 1:
133 | titleString = transaction.timestamp.longStyleDateString
134 | case 2:
135 | titleString = transaction.senderId
136 | case 3:
137 | titleString = transaction.recipientId
138 | case 4:
139 | titleString = String(transaction.amount)
140 | case 5:
141 | titleString = String(transaction.fee)
142 | case 6:
143 | titleString = String(transaction.confirmations)
144 | default:
145 | titleString = transaction.vendorField ?? ""
146 | }
147 |
148 | let cell = ArkDetailTableViewCell(titleString, numberOfLines: numberOfLines)
149 | return cell
150 | }
151 | }
152 |
153 |
--------------------------------------------------------------------------------
/ArkMonitor/Home /Views/HomeTransactionsTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | extension HomeViewController {
20 | class HomeTransactionsTableViewCell: UITableViewCell {
21 |
22 | private var typeLabel : UILabel!
23 | private var dateLabel : UILabel!
24 | private var quantityLabel : UILabel!
25 | private var iconView : UIImageView!
26 |
27 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
28 | super.init(style: style, reuseIdentifier: reuseIdentifier)
29 | selectionStyle = .none
30 | setupView()
31 | }
32 |
33 | private func setupView() {
34 | backgroundColor = ArkPalette.backgroundColor
35 |
36 | iconView = UIImageView()
37 | addSubview(iconView)
38 | iconView.snp.makeConstraints { (make) in
39 | make.height.width.equalTo(25.0)
40 | make.centerY.equalToSuperview()
41 | make.left.equalTo(12.5)
42 | }
43 | typeLabel = UILabel()
44 | typeLabel.textColor = ArkPalette.highlightedTextColor
45 | typeLabel.textAlignment = .left
46 | typeLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
47 | addSubview(typeLabel)
48 | typeLabel.snp.makeConstraints { (make) in
49 | make.height.equalTo(20.0)
50 | make.width.equalTo(150.0)
51 | make.left.equalTo(50.0)
52 | make.centerY.equalTo(65.0 / 3.0)
53 | }
54 |
55 | dateLabel = UILabel()
56 | dateLabel.textColor = ArkPalette.highlightedTextColor
57 | dateLabel.textAlignment = .left
58 | dateLabel.font = UIFont.systemFont(ofSize: 14.0, weight: .regular)
59 | addSubview(dateLabel)
60 | dateLabel.snp.makeConstraints { (make) in
61 | make.height.equalTo(20.0)
62 | make.width.equalTo(150.0)
63 | make.left.equalTo(50.0)
64 | make.centerY.equalTo(65.0 * 2.0 / 3.0)
65 | }
66 |
67 | quantityLabel = UILabel()
68 | quantityLabel.textColor = ArkPalette.accentColor
69 | quantityLabel.textAlignment = .right
70 | quantityLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
71 | addSubview(quantityLabel)
72 | quantityLabel.snp.makeConstraints { (make) in
73 | make.height.equalTo(20.0)
74 | make.width.equalTo(150.0)
75 | make.right.equalToSuperview().offset(-10.0)
76 | make.centerY.equalToSuperview()
77 | }
78 |
79 | let seperator = UIView()
80 | seperator.backgroundColor = ArkPalette.tertiaryBackgroundColor
81 | addSubview(seperator)
82 | seperator.snp.makeConstraints { (make) in
83 | make.bottom.right.equalToSuperview()
84 | make.height.equalTo(1.0)
85 | make.left.equalTo(25.0)
86 | }
87 | }
88 |
89 | public func update(_ transaction: Transaction) {
90 | switch transaction.status() {
91 | case .received:
92 | typeLabel.text = NSLocalizedString("Home.Received", comment: "").uppercased()
93 | iconView.image = #imageLiteral(resourceName: "receivedCellIcon")
94 | quantityLabel.text = transaction.amount.formatString(3) + " Ark"
95 | case .sent:
96 | typeLabel.text = NSLocalizedString("Home.Sent", comment: "").uppercased()
97 | iconView.image = #imageLiteral(resourceName: "sendCellIcon")
98 | quantityLabel.text = (-transaction.amount - transaction.fee).formatString(3) + " Ark"
99 | case .vote:
100 | typeLabel.text = NSLocalizedString("Home.Vote", comment: "").uppercased()
101 | iconView.image = #imageLiteral(resourceName: "voteCellIcon")
102 | quantityLabel.text = (-transaction.amount - transaction.fee).formatString(3) + " Ark"
103 | default:
104 | typeLabel.text = ""
105 | quantityLabel.text = ""
106 | iconView.image = nil
107 | }
108 |
109 | dateLabel.text = transaction.timestamp.longStyleDateString
110 | }
111 |
112 | required init?(coder aDecoder: NSCoder) {
113 | fatalError("init(coder:) has not been implemented")
114 | }
115 |
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/ArkMonitor/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | Ark Monitor
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 2.1.0
21 | CFBundleVersion
22 | 4
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UIStatusBarStyle
32 | UIStatusBarStyleLightContent
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 |
37 | UIViewControllerBasedStatusBarAppearance
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/ArkMonitor/My Delegate/MyDelegateViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class MyDelegateViewController: ArkViewController {
20 |
21 | public var delegate : Delegate?
22 | fileprivate var tableView : ArkTableView!
23 |
24 | override func viewDidLoad() {
25 | super.viewDidLoad()
26 |
27 | if let myDelegate = ArkDataManager.currentVote {
28 | delegate = myDelegate
29 | }
30 |
31 | navigationItem.title = delegate?.username ?? "Delegate"
32 |
33 | tableView = ArkTableView(CGRect.zero)
34 | tableView.delegate = self
35 | tableView.dataSource = self
36 |
37 | view.addSubview(tableView)
38 | tableView.snp.makeConstraints { (make) in
39 | make.left.right.top.bottom.equalToSuperview()
40 | }
41 | }
42 |
43 | override func viewDidAppear(_ animated: Bool) {
44 | super.viewDidAppear(animated)
45 | if let myDelegate = ArkDataManager.currentVote {
46 | delegate = myDelegate
47 | } else {
48 | delegate = nil
49 | ArkActivityView.showMessage(NSLocalizedString("Message.NoDelegateForAccount", comment: ""), style: .warning)
50 | }
51 | tableView.reloadData()
52 | navigationItem.title = delegate?.username ?? "Delegate"
53 | }
54 | }
55 |
56 | // MARK: UITableViewDelegate
57 | extension MyDelegateViewController : UITableViewDelegate {
58 |
59 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
60 | return 35.0
61 | }
62 |
63 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
64 | let headerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: _screenWidth, height: 35.0))
65 | headerView.backgroundColor = ArkPalette.secondaryBackgroundColor
66 |
67 | let headerLabel = UILabel(frame: CGRect(x: 12.5, y: 0.0, width: _screenWidth - 12.5, height: 35.0))
68 | headerLabel.textColor = ArkPalette.highlightedTextColor
69 | headerLabel.textAlignment = .center
70 | headerLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
71 |
72 | switch section {
73 | case 0:
74 | headerLabel.text = NSLocalizedString("Delegates.Address", comment: "")
75 | case 1:
76 | headerLabel.text = NSLocalizedString("Delegates.PublicKey", comment: "")
77 | case 2:
78 | headerLabel.text = NSLocalizedString("Delegates.Votes", comment: "")
79 | case 3:
80 | headerLabel.text = NSLocalizedString("Delegates.ProducedBlocks", comment: "")
81 | case 4:
82 | headerLabel.text = NSLocalizedString("Delegates.MissedBlocks", comment: "")
83 | case 5:
84 | headerLabel.text = NSLocalizedString("Delegates.Rank", comment: "")
85 | case 6:
86 | headerLabel.text = NSLocalizedString("Delegates.Productivity", comment: "")
87 | default:
88 | headerLabel.text = NSLocalizedString("Delegates.Approval", comment: "")
89 | }
90 | headerView.addSubview(headerLabel)
91 | return headerView
92 | }
93 |
94 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
95 | if indexPath.section == 1 {
96 | return 65.0
97 | }
98 | return 45.0
99 | }
100 |
101 | func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
102 | return CGFloat.leastNormalMagnitude
103 | }
104 |
105 | func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
106 | return nil
107 | }
108 |
109 | }
110 |
111 | // MARK: UITableViewDelegate
112 | extension MyDelegateViewController : UITableViewDataSource {
113 |
114 | func numberOfSections(in tableView: UITableView) -> Int {
115 | return 8
116 | }
117 |
118 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
119 | return 1
120 | }
121 |
122 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
123 |
124 | var titleString = ""
125 | var numberOfLines = 1
126 |
127 | switch indexPath.section {
128 | case 0:
129 | titleString = delegate?.address ?? ""
130 | case 1:
131 | titleString = delegate?.publicKey ?? ""
132 | numberOfLines = 2
133 | case 2:
134 | titleString = String(delegate?.votes ?? 0.0)
135 | case 3:
136 | titleString = String(delegate?.producedblocks ?? 0)
137 | case 4:
138 | titleString = String(delegate?.missedblocks ?? 0)
139 | case 5:
140 | titleString = String(delegate?.rate ?? 0)
141 | case 6:
142 | titleString = String(delegate?.productivity ?? 0.0) + "%"
143 | default:
144 | titleString = String(delegate?.approval ?? 0.0) + "%"
145 | }
146 |
147 | let cell = ArkDetailTableViewCell(titleString, numberOfLines: numberOfLines)
148 | return cell
149 | }
150 | }
151 |
152 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Currency Selection/CurrenctySelectionTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class CurrenctySelectionTableViewCell: UITableViewCell {
20 |
21 | public var currency : Currency!
22 | public var nameLabel : UILabel!
23 | public var checkView : UIImageView!
24 |
25 | public func update(_ currency: Currency) {
26 | self.currency = currency
27 | let currencyInfo = CurrencyInfo(currency)
28 | nameLabel.text = currency.rawValue + " - " + currencyInfo.currencyName
29 | }
30 |
31 | public func currencySelected(_ selected: Bool) {
32 | if selected == true {
33 | checkView.isHidden = false
34 | } else {
35 | checkView.isHidden = true
36 | }
37 | }
38 |
39 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
40 | super.init(style: style, reuseIdentifier: "currency")
41 |
42 | backgroundColor = ArkPalette.backgroundColor
43 | selectionStyle = .none
44 |
45 | nameLabel = UILabel()
46 | nameLabel.textColor = ArkPalette.highlightedTextColor
47 | nameLabel.adjustsFontSizeToFitWidth = true
48 | nameLabel.textAlignment = .left
49 | nameLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
50 | addSubview(nameLabel)
51 |
52 | nameLabel.snp.makeConstraints { (make) in
53 | make.top.bottom.right.equalToSuperview()
54 | make.left.equalTo(15)
55 | }
56 |
57 | checkView = UIImageView(image: #imageLiteral(resourceName: "check"))
58 | checkView.isHidden = true
59 | addSubview(checkView)
60 | checkView.snp.makeConstraints { (make) in
61 | make.height.width.equalTo(30.0)
62 | make.centerY.equalToSuperview()
63 | make.right.equalToSuperview().offset(-15.0)
64 | }
65 |
66 |
67 | let seperator = UIView()
68 | seperator.backgroundColor = ArkPalette.tertiaryBackgroundColor
69 | addSubview(seperator)
70 | seperator.snp.makeConstraints { (make) in
71 | make.right.bottom.equalToSuperview()
72 | make.left.equalTo(15.0)
73 | make.height.equalTo(1.0)
74 | }
75 | }
76 |
77 | required init?(coder aDecoder: NSCoder) {
78 | fatalError("init(coder:) has not been implemented")
79 | }
80 |
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Currency Selection/CurrencySelectionViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class CurrencySelectionViewController: ArkViewController {
19 |
20 | fileprivate var tableView : ArkTableView!
21 |
22 | override func viewDidLoad() {
23 | super.viewDidLoad()
24 |
25 | navigationItem.title = NSLocalizedString("Currency", comment: "")
26 |
27 | tableView = ArkTableView(CGRect.zero)
28 | tableView.delegate = self
29 | tableView.dataSource = self
30 |
31 | view.addSubview(tableView)
32 | tableView.snp.makeConstraints { (make) in
33 | make.left.right.top.bottom.equalToSuperview()
34 | }
35 | }
36 | }
37 |
38 | // MARK: UITableViewDelegate
39 | extension CurrencySelectionViewController : UITableViewDelegate {
40 |
41 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
42 | return 44.0
43 | }
44 |
45 | func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
46 | return CGFloat.leastNormalMagnitude
47 | }
48 |
49 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
50 | return CGFloat.leastNormalMagnitude
51 | }
52 |
53 | func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
54 | return nil
55 | }
56 |
57 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
58 | return nil
59 | }
60 |
61 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
62 | guard let aCell = tableView.cellForRow(at: indexPath) as? CurrenctySelectionTableViewCell else {
63 | return
64 | }
65 |
66 | ArkDataManager.updateCurrency(aCell.currency)
67 | ArkActivityView.showMessage(NSLocalizedString("Message.CurrencySuccessfullyUpdated", comment: ""), style: .success)
68 |
69 |
70 | if let cells = tableView.visibleCells as? [CurrenctySelectionTableViewCell] {
71 | for cell in cells {
72 | if cell.currency == ArkDataManager.currentCurrency {
73 | cell.currencySelected(true)
74 | } else {
75 | cell.currencySelected(false)
76 | }
77 | }
78 | }
79 | }
80 | }
81 |
82 | // MARK: UITableViewDataSource
83 | extension CurrencySelectionViewController : UITableViewDataSource {
84 |
85 | func numberOfSections(in tableView: UITableView) -> Int {
86 | return 1
87 | }
88 |
89 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
90 | return 31
91 | }
92 |
93 | func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
94 | guard let aCell = cell as? CurrenctySelectionTableViewCell else {
95 | return
96 | }
97 | switch indexPath.row {
98 | case 0:
99 | aCell.update(.aud)
100 | case 1:
101 | aCell.update(.brl)
102 | case 2:
103 | aCell.update(.cad)
104 | case 3:
105 | aCell.update(.chf)
106 | case 4:
107 | aCell.update(.clp)
108 | case 5:
109 | aCell.update(.cny)
110 | case 6:
111 | aCell.update(.czk)
112 | case 7:
113 | aCell.update(.dkk)
114 | case 8:
115 | aCell.update(.eur)
116 | case 9:
117 | aCell.update(.gbp)
118 | case 10:
119 | aCell.update(.hkd)
120 | case 11:
121 | aCell.update(.huf)
122 | case 12:
123 | aCell.update(.idr)
124 | case 13:
125 | aCell.update(.ils)
126 | case 14:
127 | aCell.update(.inr)
128 | case 15:
129 | aCell.update(.jpy)
130 | case 16:
131 | aCell.update(.krw)
132 | case 17:
133 | aCell.update(.mxn)
134 | case 18:
135 | aCell.update(.myr)
136 | case 19:
137 | aCell.update(.nok)
138 | case 20:
139 | aCell.update(.nzd)
140 | case 21:
141 | aCell.update(.php)
142 | case 22:
143 | aCell.update(.pkr)
144 | case 23:
145 | aCell.update(.pln)
146 | case 24:
147 | aCell.update(.rub)
148 | case 25:
149 | aCell.update(.sek)
150 | case 26:
151 | aCell.update(.sgd)
152 | case 27:
153 | aCell.update(.thb)
154 | case 28:
155 | aCell.update(.twd)
156 | case 29:
157 | aCell.update(.usd)
158 | default:
159 | aCell.update(.zar)
160 | }
161 |
162 | if aCell.currency == ArkDataManager.tickerInfo?.currency {
163 | aCell.currencySelected(true)
164 | } else {
165 | aCell.currencySelected(false)
166 | }
167 | }
168 |
169 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
170 | var cell = tableView.dequeueReusableCell(withIdentifier: "currency") as? CurrenctySelectionTableViewCell
171 | if cell == nil {
172 | cell = CurrenctySelectionTableViewCell(style: .default, reuseIdentifier: "currency")
173 | }
174 | return cell!
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Custom Server Selection/SettingsIPTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | protocol SettingsIPTableViewCellDelegate: class {
19 | func ipCell(_ cell: SettingsIPTableViewCell, didChangeText text: String?)
20 | }
21 |
22 | class SettingsIPTableViewCell: UITableViewCell {
23 |
24 | public weak var delegate: SettingsIPTableViewCellDelegate?
25 |
26 | var nameLabel : UILabel!
27 | var nameTextField : ArkServerTextField!
28 |
29 | init(reuseIdentifier: String) {
30 | super.init(style: .default, reuseIdentifier: "ip")
31 |
32 | backgroundColor = ArkPalette.backgroundColor
33 | selectionStyle = .none
34 |
35 | let nameLabel = UILabel()
36 | nameLabel.text = NSLocalizedString("IPAddress", comment: "")
37 | nameLabel.textColor = ArkPalette.highlightedTextColor
38 | nameLabel.textAlignment = .left
39 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
40 | addSubview(nameLabel)
41 |
42 | nameLabel.snp.makeConstraints { (make) in
43 | make.top.bottom.equalToSuperview()
44 | make.left.equalTo(25.0)
45 | make.width.equalToSuperview().multipliedBy(0.35)
46 | }
47 |
48 | nameTextField = ArkServerTextField(settings: true, placeHolder: "169.254.51.183")
49 | nameTextField.delegate = self
50 | nameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
51 | addSubview(nameTextField)
52 | nameTextField.snp.makeConstraints { (make) in
53 | make.height.equalTo(30.0)
54 | make.centerY.equalToSuperview()
55 | make.right.equalToSuperview().offset(-25.0)
56 | make.width.equalToSuperview().multipliedBy(0.5)
57 | }
58 |
59 | let seperator = UIView()
60 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
61 | addSubview(seperator)
62 | seperator.snp.makeConstraints { (make) in
63 | make.left.right.bottom.equalToSuperview()
64 | make.height.equalTo(1.0)
65 | }
66 | }
67 |
68 | required init?(coder aDecoder: NSCoder) {
69 | fatalError("init(coder:) has not been implemented")
70 | }
71 |
72 | public func update(_ ipAddress: String?) {
73 | nameTextField.text = ipAddress
74 | }
75 | }
76 |
77 | // MARK: UITextFieldDelegate
78 | extension SettingsIPTableViewCell : UITextFieldDelegate {
79 |
80 | func textFieldShouldReturn(_ textField: UITextField) -> Bool {
81 | textField.resignFirstResponder()
82 | return true
83 | }
84 |
85 | @objc func textFieldDidChange(_ textField: UITextField) {
86 | delegate?.ipCell(self, didChangeText: textField.text)
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Custom Server Selection/SettingsPortTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | protocol SettingsPortTableViewCellDelegate: class {
19 | func portCell(_ cell: SettingsPortTableViewCell, didChangeText text: String?)
20 | }
21 |
22 | class SettingsPortTableViewCell: UITableViewCell {
23 |
24 | public weak var delegate: SettingsPortTableViewCellDelegate?
25 |
26 | var nameLabel : UILabel!
27 | var nameTextField : ArkServerTextField!
28 |
29 | init(reuseIdentifier: String) {
30 | super.init(style: .default, reuseIdentifier: "port")
31 |
32 | backgroundColor = ArkPalette.backgroundColor
33 | selectionStyle = .none
34 |
35 |
36 | let nameLabel = UILabel()
37 | nameLabel.text = NSLocalizedString("Port", comment: "")
38 | nameLabel.textColor = ArkPalette.highlightedTextColor
39 | nameLabel.textAlignment = .left
40 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
41 | addSubview(nameLabel)
42 |
43 | nameLabel.snp.makeConstraints { (make) in
44 | make.top.bottom.equalToSuperview()
45 | make.left.equalTo(25.0)
46 | make.width.equalToSuperview().multipliedBy(0.35)
47 | }
48 |
49 | nameTextField = ArkServerTextField(settings: true, placeHolder: "4001")
50 | nameTextField.keyboardType = .numberPad
51 | nameTextField.delegate = self
52 | nameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
53 | addSubview(nameTextField)
54 | nameTextField.snp.makeConstraints { (make) in
55 | make.height.equalTo(30.0)
56 | make.centerY.equalToSuperview()
57 | make.right.equalToSuperview().offset(-25.0)
58 | make.width.equalToSuperview().multipliedBy(0.5)
59 | }
60 |
61 | let seperator = UIView()
62 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
63 | addSubview(seperator)
64 | seperator.snp.makeConstraints { (make) in
65 | make.left.right.bottom.equalToSuperview()
66 | make.height.equalTo(1.0)
67 | }
68 | }
69 |
70 | required init?(coder aDecoder: NSCoder) {
71 | fatalError("init(coder:) has not been implemented")
72 | }
73 |
74 | public func update(_ port: String) {
75 | nameTextField.text = port
76 | }
77 | }
78 |
79 | // MARK: UITextFieldDelegate
80 | extension SettingsPortTableViewCell : UITextFieldDelegate {
81 |
82 | func textFieldShouldReturn(_ textField: UITextField) -> Bool {
83 | textField.resignFirstResponder()
84 | return true
85 | }
86 |
87 | @objc func textFieldDidChange(_ textField: UITextField) {
88 | delegate?.portCell(self, didChangeText: textField.text)
89 | }
90 | }
91 |
92 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Custom Server Selection/SettingsSSLTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | protocol SettingsSSLTableViewCellDelegate: class {
19 | func sslCell(_ cell: SettingsSSLTableViewCell, didChangeStatus enabled: Bool)
20 | }
21 |
22 | class SettingsSSLTableViewCell: UITableViewCell {
23 |
24 | public weak var delegate: SettingsSSLTableViewCellDelegate?
25 |
26 | var nameLabel : UILabel!
27 | var sslSwitch : UISwitch!
28 |
29 | init(reuseIdentifier: String) {
30 | super.init(style: .default, reuseIdentifier: "port")
31 |
32 | backgroundColor = ArkPalette.backgroundColor
33 | selectionStyle = .none
34 |
35 |
36 | nameLabel = UILabel()
37 | nameLabel.text = NSLocalizedString("SSLEnabled", comment: "")
38 | nameLabel.textColor = ArkPalette.highlightedTextColor
39 | nameLabel.textAlignment = .left
40 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
41 | addSubview(nameLabel)
42 |
43 | nameLabel.snp.makeConstraints { (make) in
44 | make.top.bottom.equalToSuperview()
45 | make.left.equalTo(25.0)
46 | make.width.equalToSuperview().multipliedBy(0.35)
47 | }
48 |
49 | sslSwitch = UISwitch()
50 | sslSwitch.onTintColor = ArkPalette.accentColor
51 | sslSwitch.addTarget(self, action: #selector(switchValueChanged), for: .valueChanged)
52 | addSubview(sslSwitch)
53 | sslSwitch.snp.makeConstraints { (make) in
54 | make.centerY.equalToSuperview()
55 | make.right.equalToSuperview().offset(-25.0)
56 | }
57 |
58 | let seperator = UIView()
59 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
60 | addSubview(seperator)
61 | seperator.snp.makeConstraints { (make) in
62 | make.left.right.bottom.equalToSuperview()
63 | make.height.equalTo(1.0)
64 | }
65 | }
66 |
67 | public func update(_ enabled: Bool) {
68 | sslSwitch.setOn(enabled, animated: false)
69 | }
70 |
71 | @objc private func switchValueChanged() {
72 | delegate?.sslCell(self, didChangeStatus: sslSwitch.isOn)
73 | }
74 |
75 | required init?(coder aDecoder: NSCoder) {
76 | fatalError("init(coder:) has not been implemented")
77 | }
78 | }
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Custom Server Selection/SettingsSaveTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 |
19 | protocol SettingsSaveTableViewCellDelegate: class {
20 | func saveCellButtonWasTapped(_ cell: SettingsSaveTableViewCell)
21 | }
22 |
23 | class SettingsSaveTableViewCell: UITableViewCell {
24 |
25 | var saveButton: UIButton!
26 |
27 | public weak var delegate: SettingsSaveTableViewCellDelegate?
28 |
29 | init(reuseIdentifier: String) {
30 | super.init(style: .default, reuseIdentifier: "username")
31 |
32 | backgroundColor = ArkPalette.backgroundColor
33 | selectionStyle = .none
34 |
35 | saveButton = UIButton()
36 | saveButton.title("Save", color: UIColor.white)
37 | saveButton.setBackgroundColor(ArkPalette.accentColor, forState: UIControlState())
38 | saveButton.titleLabel?.font = UIFont.systemFont(ofSize: 20.0, weight: .semibold)
39 | saveButton.addTarget(self, action: #selector(saveButtonTapped), for: .touchUpInside)
40 | saveButton.clipsToBounds = true
41 | saveButton.layer.cornerRadius = 8.0
42 | addSubview(saveButton)
43 | saveButton.snp.makeConstraints { (make) in
44 | make.width.equalTo(250.0)
45 | make.height.equalTo(45.0)
46 | make.center.equalToSuperview()
47 | }
48 | }
49 |
50 | @objc private func saveButtonTapped() {
51 | delegate?.saveCellButtonWasTapped(self)
52 | }
53 |
54 | required init?(coder aDecoder: NSCoder) {
55 | fatalError("init(coder:) has not been implemented")
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Custom Server Selection/SettingsServerNameTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | protocol SettingsServerNameTableViewCellDelegate: class {
19 | func ipCell(_ cell: SettingsServerNameTableViewCell, didChangeText text: String?)
20 | }
21 |
22 | class SettingsServerNameTableViewCell: UITableViewCell {
23 |
24 | public weak var delegate: SettingsServerNameTableViewCellDelegate?
25 |
26 | var nameLabel : UILabel!
27 | var nameTextField : ArkServerTextField!
28 |
29 | init(reuseIdentifier: String) {
30 | super.init(style: .default, reuseIdentifier: "servername")
31 |
32 | backgroundColor = ArkPalette.backgroundColor
33 | selectionStyle = .none
34 |
35 | let nameLabel = UILabel()
36 | nameLabel.text = NSLocalizedString("ServerName", comment: "")
37 | nameLabel.textColor = ArkPalette.highlightedTextColor
38 | nameLabel.textAlignment = .left
39 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
40 | addSubview(nameLabel)
41 |
42 | nameLabel.snp.makeConstraints { (make) in
43 | make.top.bottom.equalToSuperview()
44 | make.left.equalTo(25.0)
45 | make.width.equalToSuperview().multipliedBy(0.35)
46 | }
47 |
48 | nameTextField = ArkServerTextField(settings: true, placeHolder: "Custom Server")
49 | nameTextField.delegate = self
50 | nameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
51 | addSubview(nameTextField)
52 | nameTextField.snp.makeConstraints { (make) in
53 | make.height.equalTo(30.0)
54 | make.centerY.equalToSuperview()
55 | make.right.equalToSuperview().offset(-25.0)
56 | make.width.equalToSuperview().multipliedBy(0.5)
57 | }
58 |
59 | let seperator = UIView()
60 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
61 | addSubview(seperator)
62 | seperator.snp.makeConstraints { (make) in
63 | make.left.right.bottom.equalToSuperview()
64 | make.height.equalTo(1.0)
65 | }
66 | }
67 |
68 | required init?(coder aDecoder: NSCoder) {
69 | fatalError("init(coder:) has not been implemented")
70 | }
71 |
72 | public func update(_ ipAddress: String?) {
73 | nameTextField.text = ipAddress
74 | }
75 | }
76 |
77 | // MARK: UITextFieldDelegate
78 | extension SettingsServerNameTableViewCell : UITextFieldDelegate {
79 |
80 | func textFieldShouldReturn(_ textField: UITextField) -> Bool {
81 | textField.resignFirstResponder()
82 | return true
83 | }
84 |
85 | @objc func textFieldDidChange(_ textField: UITextField) {
86 | delegate?.ipCell(self, didChangeText: textField.text)
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Server Selection Table Views/SettingSelectionCustomTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class SettingSelectionCustomTableViewCell: UITableViewCell {
19 |
20 | public let server : CustomServer
21 | private var nameLabel : UILabel!
22 | private var check : UIImageView!
23 | public var isCurrentServer = false
24 |
25 | init(_ server: CustomServer) {
26 | self.server = server
27 | super.init(style: .default, reuseIdentifier: "customServer")
28 |
29 | backgroundColor = ArkPalette.backgroundColor
30 | selectionStyle = .none
31 |
32 | nameLabel = UILabel()
33 | nameLabel.textAlignment = .left
34 | nameLabel.text = server.name
35 | nameLabel.textColor = ArkPalette.highlightedTextColor
36 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
37 | addSubview(nameLabel)
38 | nameLabel.snp.makeConstraints { (make) in
39 | make.right.top.bottom.equalToSuperview()
40 | make.left.equalTo(12.5)
41 | }
42 |
43 | let checkImage = #imageLiteral(resourceName: "serverCheck")
44 | check = UIImageView()
45 | check.image = checkImage.maskWithColor(color: ArkPalette.accentColor)
46 | check.isHidden = true
47 |
48 | addSubview(check)
49 | check.snp.makeConstraints { (make) in
50 | make.height.width.equalTo(25.0)
51 | make.centerY.equalToSuperview()
52 | make.right.equalToSuperview().offset(-12.5)
53 | }
54 |
55 | let seperator = UIView()
56 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
57 | addSubview(seperator)
58 | seperator.snp.makeConstraints { (make) in
59 | make.left.right.bottom.equalToSuperview()
60 | make.height.equalTo(1.0)
61 | }
62 | }
63 |
64 | public func setServerSelction(_ isCurrentServer: Bool) {
65 | self.isCurrentServer = isCurrentServer
66 | let checkImage = #imageLiteral(resourceName: "serverCheck")
67 | check.image = checkImage.maskWithColor(color: ArkPalette.accentColor)
68 | if isCurrentServer == true {
69 | nameLabel.textColor = ArkPalette.accentColor
70 | check.isHidden = false
71 | } else {
72 | nameLabel.textColor = ArkPalette.highlightedTextColor
73 | check.isHidden = true
74 | }
75 | }
76 |
77 | required init?(coder aDecoder: NSCoder) {
78 | fatalError("init(coder:) has not been implemented")
79 | }
80 |
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Server Selection Table Views/SettingSelectionPresetTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class SettingSelectionPresetTableViewCell: UITableViewCell {
20 |
21 | public let mode : NetworkPreset
22 | private var nameLabel : UILabel!
23 | private var check : UIImageView!
24 |
25 |
26 | init(_ mode: NetworkPreset) {
27 | self.mode = mode
28 | super.init(style: .default, reuseIdentifier: "presetServer")
29 |
30 | backgroundColor = ArkPalette.backgroundColor
31 | selectionStyle = .none
32 |
33 | nameLabel = UILabel()
34 | nameLabel.textAlignment = .left
35 | nameLabel.textColor = ArkPalette.highlightedTextColor
36 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
37 | addSubview(nameLabel)
38 | nameLabel.snp.makeConstraints { (make) in
39 | make.right.top.bottom.equalToSuperview()
40 | make.left.equalTo(12.5)
41 | }
42 |
43 |
44 | switch mode {
45 | case .arknet1:
46 | nameLabel.text = "node1.arknet.cloud"
47 | case .arknet2:
48 | nameLabel.text = "node2.arknet.cloud"
49 | case .arknode:
50 | nameLabel.text = "api.arknode.net"
51 | }
52 |
53 | let checkImage = #imageLiteral(resourceName: "serverCheck")
54 | check = UIImageView()
55 | check.image = checkImage.maskWithColor(color: ArkPalette.accentColor)
56 | check.isHidden = true
57 |
58 | addSubview(check)
59 | check.snp.makeConstraints { (make) in
60 | make.height.width.equalTo(25.0)
61 | make.centerY.equalToSuperview()
62 | make.right.equalToSuperview().offset(-12.5)
63 | }
64 |
65 | let seperator = UIView()
66 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
67 | addSubview(seperator)
68 | seperator.snp.makeConstraints { (make) in
69 | make.left.right.bottom.equalToSuperview()
70 | make.height.equalTo(1.0)
71 | }
72 | }
73 |
74 | public func setServerSelction(_ isCurrentServer: Bool) {
75 | let checkImage = #imageLiteral(resourceName: "serverCheck")
76 | check.image = checkImage.maskWithColor(color: ArkPalette.accentColor)
77 | if isCurrentServer == true {
78 | nameLabel.textColor = ArkPalette.accentColor
79 | check.isHidden = false
80 | } else {
81 | nameLabel.textColor = ArkPalette.highlightedTextColor
82 | check.isHidden = true
83 | }
84 | }
85 |
86 | required init?(coder aDecoder: NSCoder) {
87 | fatalError("init(coder:) has not been implemented")
88 | }
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Server Selection Table Views/SettingsSelectionAddServerTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class SettingsSelectionAddServerTableViewCell: UITableViewCell {
19 |
20 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
21 | super.init(style: .default, reuseIdentifier: "addServer")
22 |
23 | backgroundColor = ArkPalette.backgroundColor
24 | selectionStyle = .none
25 |
26 | let nameLabel = UILabel()
27 | nameLabel.textAlignment = .left
28 | nameLabel.text = NSLocalizedString("Server.AddCustomServer", comment: "")
29 | nameLabel.textColor = ArkPalette.textColor
30 | nameLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
31 | addSubview(nameLabel)
32 | nameLabel.snp.makeConstraints { (make) in
33 | make.right.top.bottom.equalToSuperview()
34 | make.left.equalTo(12.5)
35 | }
36 |
37 |
38 | let seperator = UIView()
39 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
40 | addSubview(seperator)
41 | seperator.snp.makeConstraints { (make) in
42 | make.left.right.bottom.equalToSuperview()
43 | make.height.equalTo(1.0)
44 | }
45 | }
46 |
47 | required init?(coder aDecoder: NSCoder) {
48 | fatalError("init(coder:) has not been implemented")
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/Server Selection/Server.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | public struct CustomServer: Equatable {
20 |
21 | static public func ==(lhs: CustomServer, rhs: CustomServer) -> Bool {
22 | return lhs.name == rhs.name
23 | }
24 |
25 | let name : String
26 | let ipAddress : String
27 | let port : Int
28 | let isSSL : Bool
29 |
30 | init(_ name: String, ipAddress: String, port: Int, isSSL: Bool) {
31 | self.name = name
32 | self.ipAddress = ipAddress
33 | self.port = port
34 | self.isSSL = isSSL
35 | }
36 |
37 | init?(dictionary: [String : AnyObject]) {
38 |
39 | guard let name = dictionary["name"] as? String,
40 | let ipAddress = dictionary["ipAdress"] as? String,
41 | let port = dictionary["port"] as? Int,
42 | let isSSL = dictionary["isSSL"] as? Bool
43 | else {
44 | print("Failed to Create CustomServer")
45 | return nil
46 | }
47 | self.name = name
48 | self.ipAddress = ipAddress
49 | self.port = port
50 | self.isSSL = isSSL
51 | }
52 |
53 | public func dictionary() -> [String : AnyObject] {
54 | return ["name": name as AnyObject, "ipAdress": ipAddress as AnyObject, "port": port as AnyObject, "isSSL": isSSL as AnyObject]
55 | }
56 |
57 | public func network() -> Network {
58 | return Network(ipAddress, port: port, isSSL: isSSL)
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/SettingsCurrencyTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SwiftyArk
18 |
19 | class SettingsCurrencyTableViewCell: UITableViewCell {
20 |
21 | var titleLabel : UILabel!
22 | var currencyLabel : UILabel!
23 |
24 | init(_ currency: Currency) {
25 | super.init(style: .default, reuseIdentifier: "currency")
26 |
27 | backgroundColor = ArkPalette.backgroundColor
28 | selectionStyle = .none
29 | titleLabel = UILabel()
30 | titleLabel.text = NSLocalizedString("Settings.ReferenceCurrency", comment: "")
31 | titleLabel.textColor = ArkPalette.highlightedTextColor
32 | titleLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
33 | addSubview(titleLabel)
34 | titleLabel.snp.makeConstraints { (make) in
35 | make.top.bottom.equalToSuperview()
36 | make.left.equalTo(15.0)
37 | make.width.equalTo(250.0)
38 | }
39 |
40 | let chevron = UIImageView(image: #imageLiteral(resourceName: "chevron"))
41 | addSubview(chevron)
42 | chevron.snp.makeConstraints { (make) in
43 | make.height.width.equalTo(15.0)
44 | make.centerY.equalToSuperview()
45 | make.right.equalToSuperview().offset(-15.0)
46 | }
47 |
48 | currencyLabel = UILabel()
49 | currencyLabel.textAlignment = .right
50 | currencyLabel.text = currency.rawValue
51 | currencyLabel.textColor = ArkPalette.textColor
52 | currencyLabel.font = UIFont.systemFont(ofSize: 18.0, weight: .regular)
53 | addSubview(currencyLabel)
54 | currencyLabel.snp.makeConstraints { (make) in
55 | make.top.bottom.equalToSuperview()
56 | make.width.equalTo(100.0)
57 | make.right.equalTo(chevron.snp.left).offset(-10.0)
58 |
59 |
60 | }
61 |
62 | let seperator = UIView()
63 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
64 | addSubview(seperator)
65 | seperator.snp.makeConstraints { (make) in
66 | make.left.right.bottom.equalToSuperview()
67 | make.height.equalTo(1.0)
68 | }
69 | }
70 |
71 |
72 | required init?(coder aDecoder: NSCoder) {
73 | fatalError("init(coder:) has not been implemented")
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/SettingsDelegateTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 | import UIKit
16 |
17 | class SettingsDelegateNotifcationTableViewCell: UITableViewCell {
18 |
19 | var titleLabel : UILabel!
20 | var descriptionLabel : UILabel!
21 | var notificationSwitch : UISwitch!
22 |
23 |
24 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
25 | super.init(style: .default, reuseIdentifier: "account")
26 |
27 | backgroundColor = ArkPalette.backgroundColor
28 | selectionStyle = .none
29 | titleLabel = UILabel()
30 | titleLabel.text = NSLocalizedString("Settings.DelegateNotifications", comment: "")
31 | titleLabel.textColor = ArkPalette.highlightedTextColor
32 | titleLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
33 | addSubview(titleLabel)
34 | titleLabel.snp.makeConstraints { (make) in
35 | make.top.equalTo(10.0)
36 | make.height.equalTo(20.0)
37 | make.left.equalTo(15.0)
38 | make.width.equalTo(250.0)
39 | }
40 |
41 | notificationSwitch = UISwitch()
42 | notificationSwitch.onTintColor = ArkPalette.accentColor
43 | notificationSwitch.addTarget(self, action: #selector(switchValueChanged), for: .valueChanged)
44 | notificationSwitch.isOn = ArkDataManager.showDelegateNotifications
45 | addSubview(notificationSwitch)
46 | notificationSwitch.snp.makeConstraints { (make) in
47 | make.centerY.equalToSuperview()
48 | make.right.equalToSuperview().offset(-15.0)
49 | }
50 |
51 | descriptionLabel = UILabel()
52 | descriptionLabel.text = NSLocalizedString("Settings.DelegateNotificationsDetail", comment: "")
53 | descriptionLabel.numberOfLines = 2
54 | descriptionLabel.textColor = ArkPalette.textColor
55 | descriptionLabel.font = UIFont.systemFont(ofSize: 13.0, weight: .light)
56 | descriptionLabel.adjustsFontSizeToFitWidth = true
57 | addSubview(descriptionLabel)
58 | descriptionLabel.snp.makeConstraints { (make) in
59 | make.top.equalTo(titleLabel.snp.bottom)
60 | make.bottom.equalToSuperview().offset(-5.0)
61 | make.left.equalTo(15.0)
62 | make.right.equalTo(notificationSwitch.snp.left).offset(-25.0)
63 | }
64 |
65 |
66 |
67 | let seperator = UIView()
68 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
69 | addSubview(seperator)
70 | seperator.snp.makeConstraints { (make) in
71 | make.left.right.bottom.equalToSuperview()
72 | make.height.equalTo(1.0)
73 | }
74 | }
75 |
76 |
77 | required init?(coder aDecoder: NSCoder) {
78 | fatalError("init(coder:) has not been implemented")
79 | }
80 |
81 | @objc private func switchValueChanged() {
82 | ArkDataManager.showDelegateNotifications = !ArkDataManager.showDelegateNotifications
83 | }
84 | }
85 |
86 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/SettingsLogoutTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class SettingsLogoutTableViewCell: UITableViewCell {
19 |
20 | var titleLabel : UILabel!
21 |
22 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
23 | super.init(style: .default, reuseIdentifier: "account")
24 |
25 | backgroundColor = ArkPalette.backgroundColor
26 | selectionStyle = .none
27 | titleLabel = UILabel()
28 | titleLabel.text = NSLocalizedString("Settings.SignOut", comment: "")
29 | titleLabel.textColor = ArkPalette.highlightedTextColor
30 | titleLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
31 | addSubview(titleLabel)
32 | titleLabel.snp.makeConstraints { (make) in
33 | make.top.bottom.equalToSuperview()
34 | make.left.equalTo(15.0)
35 | make.width.equalTo(250.0)
36 | }
37 | let seperator = UIView()
38 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
39 | addSubview(seperator)
40 | seperator.snp.makeConstraints { (make) in
41 | make.left.right.bottom.equalToSuperview()
42 | make.height.equalTo(1.0)
43 | }
44 | }
45 |
46 |
47 | required init?(coder aDecoder: NSCoder) {
48 | fatalError("init(coder:) has not been implemented")
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/SettingsServerTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class SettingsServerTableViewCell: UITableViewCell {
19 |
20 | var titleLabel : UILabel!
21 | var currencyLabel : UILabel!
22 |
23 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
24 | super.init(style: style, reuseIdentifier: reuseIdentifier)
25 |
26 | backgroundColor = ArkPalette.backgroundColor
27 | selectionStyle = .none
28 | titleLabel = UILabel()
29 | titleLabel.text = NSLocalizedString("Server", comment: "")
30 | titleLabel.textColor = ArkPalette.highlightedTextColor
31 | titleLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
32 | addSubview(titleLabel)
33 | titleLabel.snp.makeConstraints { (make) in
34 | make.top.bottom.equalToSuperview()
35 | make.left.equalTo(15.0)
36 | make.width.equalTo(250.0)
37 | }
38 |
39 | let chevron = UIImageView(image: #imageLiteral(resourceName: "chevron"))
40 | addSubview(chevron)
41 | chevron.snp.makeConstraints { (make) in
42 | make.height.width.equalTo(15.0)
43 | make.centerY.equalToSuperview()
44 | make.right.equalToSuperview().offset(-15.0)
45 | }
46 |
47 | currencyLabel = UILabel()
48 | currencyLabel.textAlignment = .right
49 |
50 | if let currentPreset = ArkNetworkManager.currentNetwork {
51 | switch currentPreset {
52 | case .arknode:
53 | currencyLabel.text = "arknode"
54 | case .arknet1:
55 | currencyLabel.text = "arknet1"
56 | case .arknet2:
57 | currencyLabel.text = "arknet2"
58 | }
59 | } else if ArkNetworkManager.CurrentCustomServer != nil {
60 | currencyLabel.text = "custom"
61 | } else {
62 | currencyLabel.text = "default"
63 | }
64 | currencyLabel.textColor = ArkPalette.textColor
65 | currencyLabel.font = UIFont.systemFont(ofSize: 18.0, weight: .regular)
66 | addSubview(currencyLabel)
67 | currencyLabel.snp.makeConstraints { (make) in
68 | make.top.bottom.equalToSuperview()
69 | make.width.equalTo(100.0)
70 | make.right.equalTo(chevron.snp.left).offset(-10.0)
71 |
72 |
73 | }
74 |
75 | let seperator = UIView()
76 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
77 | addSubview(seperator)
78 | seperator.snp.makeConstraints { (make) in
79 | make.left.right.bottom.equalToSuperview()
80 | make.height.equalTo(1.0)
81 | }
82 |
83 | }
84 |
85 |
86 | required init?(coder aDecoder: NSCoder) {
87 | fatalError("init(coder:) has not been implemented")
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/SettingsTransactionsNotificationTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class SettingsTransactionsNotificationTableViewCell: UITableViewCell {
19 |
20 | var titleLabel : UILabel!
21 | var descriptionLabel : UILabel!
22 | var notificationSwitch : UISwitch!
23 |
24 |
25 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
26 | super.init(style: .default, reuseIdentifier: "account")
27 |
28 | backgroundColor = ArkPalette.backgroundColor
29 | selectionStyle = .none
30 | titleLabel = UILabel()
31 | titleLabel.text = NSLocalizedString("Settings.TransactionNotifications", comment: "")
32 | titleLabel.textColor = ArkPalette.highlightedTextColor
33 | titleLabel.font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
34 | addSubview(titleLabel)
35 | titleLabel.snp.makeConstraints { (make) in
36 | make.top.equalTo(10.0)
37 | make.height.equalTo(20.0)
38 | make.left.equalTo(15.0)
39 | make.width.equalTo(250.0)
40 | }
41 |
42 | notificationSwitch = UISwitch()
43 | notificationSwitch.onTintColor = ArkPalette.accentColor
44 | notificationSwitch.addTarget(self, action: #selector(switchValueChanged), for: .valueChanged)
45 | notificationSwitch.isOn = ArkDataManager.showTransactionNotifications
46 | addSubview(notificationSwitch)
47 | notificationSwitch.snp.makeConstraints { (make) in
48 | make.centerY.equalToSuperview()
49 | make.right.equalToSuperview().offset(-15.0)
50 | }
51 |
52 | descriptionLabel = UILabel()
53 | descriptionLabel.text = NSLocalizedString("Settings.TransactionNotificationsDetail", comment: "")
54 | descriptionLabel.numberOfLines = 2
55 | descriptionLabel.textColor = ArkPalette.textColor
56 | descriptionLabel.font = UIFont.systemFont(ofSize: 13.0, weight: .light)
57 | descriptionLabel.adjustsFontSizeToFitWidth = true
58 | addSubview(descriptionLabel)
59 | descriptionLabel.snp.makeConstraints { (make) in
60 | make.top.equalTo(titleLabel.snp.bottom)
61 | make.bottom.equalToSuperview().offset(-5.0)
62 | make.left.equalTo(15.0)
63 | make.right.equalTo(notificationSwitch.snp.left).offset(-25.0)
64 | }
65 |
66 |
67 |
68 | let seperator = UIView()
69 | seperator.backgroundColor = ArkPalette.secondaryBackgroundColor
70 | addSubview(seperator)
71 | seperator.snp.makeConstraints { (make) in
72 | make.left.right.bottom.equalToSuperview()
73 | make.height.equalTo(1.0)
74 | }
75 | }
76 |
77 |
78 | required init?(coder aDecoder: NSCoder) {
79 | fatalError("init(coder:) has not been implemented")
80 | }
81 |
82 | @objc private func switchValueChanged() {
83 | ArkDataManager.showTransactionNotifications = !ArkDataManager.showTransactionNotifications
84 | }
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/ArkMonitor/Settings/SettingsViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class SettingsViewController: ArkViewController {
19 |
20 | fileprivate var tableView : ArkTableView!
21 |
22 | override func viewDidLoad() {
23 | super.viewDidLoad()
24 |
25 | navigationItem.title = NSLocalizedString("TabBar.Settings", comment: "")
26 |
27 | tableView = ArkTableView(CGRect.zero)
28 | tableView.delegate = self
29 | tableView.dataSource = self
30 |
31 | view.addSubview(tableView)
32 | tableView.snp.makeConstraints { (make) in
33 | make.left.right.top.bottom.equalToSuperview()
34 | }
35 | }
36 |
37 | override func viewWillAppear(_ animated: Bool) {
38 | super.viewWillAppear(animated)
39 | tableView.reloadData()
40 | }
41 |
42 | override func viewDidAppear(_ animated: Bool) {
43 | super.viewDidAppear(animated)
44 | tableView.reloadData()
45 | }
46 | }
47 |
48 | // MARK: UITableViewDelegate
49 | extension SettingsViewController : UITableViewDelegate {
50 |
51 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
52 | return CGFloat.leastNormalMagnitude
53 | }
54 |
55 | func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
56 | return CGFloat.leastNormalMagnitude
57 | }
58 |
59 | func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
60 | return nil
61 | }
62 |
63 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
64 | return nil
65 | }
66 |
67 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
68 | switch indexPath.row {
69 | case 2,3:
70 | return 85.0
71 | default:
72 | return 45.0
73 | }
74 | }
75 |
76 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
77 | if let _ = tableView.cellForRow(at: indexPath) as? SettingsCurrencyTableViewCell {
78 | let vc = CurrencySelectionViewController()
79 | navigationController?.pushViewController(vc, animated: true)
80 | }
81 |
82 | if let _ = tableView.cellForRow(at: indexPath) as? SettingsServerTableViewCell {
83 | let vc = ServerSelectionViewController()
84 | navigationController?.pushViewController(vc, animated: true)
85 | }
86 |
87 | if let _ = tableView.cellForRow(at: indexPath) as? SettingsLogoutTableViewCell {
88 | ArkDataManager.logoutOperations()
89 | }
90 | }
91 | }
92 |
93 |
94 | // MARK: UITableViewDataSource
95 | extension SettingsViewController : UITableViewDataSource {
96 |
97 | func numberOfSections(in tableView: UITableView) -> Int {
98 | return 1
99 | }
100 |
101 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
102 | return 5
103 | }
104 |
105 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
106 | switch indexPath.row {
107 | case 0:
108 | let currency = ArkDataManager.currentCurrency
109 | let cell = SettingsCurrencyTableViewCell(currency)
110 | return cell
111 | case 1:
112 | let cell = SettingsServerTableViewCell()
113 | return cell
114 | case 2:
115 | let cell = SettingsTransactionsNotificationTableViewCell(style: .default, reuseIdentifier: "transactions")
116 | return cell
117 | case 3:
118 | let cell = SettingsDelegateNotifcationTableViewCell(style: .default, reuseIdentifier: "delegate")
119 | return cell
120 | default:
121 | let cell = SettingsLogoutTableViewCell(style: .default, reuseIdentifier: "logout")
122 | return cell
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkCopyableLabel.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class ArkCopyableLabel: UILabel {
19 |
20 | override public var canBecomeFirstResponder: Bool {
21 | get {
22 | return true
23 | }
24 | }
25 |
26 | override init(frame: CGRect) {
27 | super.init(frame: frame)
28 | sharedInit()
29 | }
30 |
31 | required init?(coder aDecoder: NSCoder) {
32 | super.init(coder: aDecoder)
33 | sharedInit()
34 | }
35 |
36 | func sharedInit() {
37 | isUserInteractionEnabled = true
38 | addGestureRecognizer(UILongPressGestureRecognizer(
39 | target: self,
40 | action: #selector(showMenu(sender:))
41 | ))
42 | }
43 |
44 | override func copy(_ sender: Any?) {
45 | UIPasteboard.general.string = text
46 | UIMenuController.shared.setMenuVisible(false, animated: true)
47 | }
48 |
49 | @objc func showMenu(sender: Any?) {
50 | becomeFirstResponder()
51 | let menu = UIMenuController.shared
52 | if !menu.isMenuVisible {
53 | menu.setTargetRect(bounds, in: self)
54 | menu.setMenuVisible(true, animated: true)
55 | }
56 | }
57 |
58 | override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
59 | return (action == #selector(copy(_:)))
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkDetailTableViewCell.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class ArkDetailTableViewCell: UITableViewCell {
19 |
20 | var titleLabel: ArkCopyableLabel!
21 |
22 | init(_ title: String, numberOfLines: Int) {
23 | super.init(style: .default, reuseIdentifier: "detail")
24 |
25 | backgroundColor = ArkPalette.backgroundColor
26 | selectionStyle = .none
27 |
28 | titleLabel = ArkCopyableLabel()
29 | titleLabel.text = title
30 | titleLabel.textColor = ArkPalette.accentColor
31 | titleLabel.font = UIFont.systemFont(ofSize: 15.0, weight: .semibold)
32 | titleLabel.textAlignment = .left
33 | titleLabel.numberOfLines = numberOfLines
34 | titleLabel.adjustsFontSizeToFitWidth = true
35 | addSubview(titleLabel)
36 |
37 | titleLabel.snp.makeConstraints { (make) in
38 | make.top.bottom.equalToSuperview()
39 | make.right.equalToSuperview().offset(-12.5)
40 | make.left.equalTo(12.5)
41 | }
42 | }
43 |
44 | required init?(coder aDecoder: NSCoder) {
45 | fatalError("init(coder:) has not been implemented")
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkGradientView.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | open class ArkGradientView: UIView {
19 |
20 | private struct Animation {
21 | static let keyPath = "colors"
22 | static let key = "ColorChange"
23 | }
24 |
25 | // Custom Direction
26 | open var startPoint : CGPoint = CGPoint(x: 0.0, y: 0.0)
27 | open var endPoint : CGPoint = CGPoint(x: 1.0, y: 1.0)
28 |
29 | // Custom Duration
30 | open var animationDuration: TimeInterval = 5.0
31 |
32 | fileprivate let gradient = CAGradientLayer()
33 | private var currentGradient: Int = 0
34 | private var colors: [UIColor] = [UIColor(r: 0, g: 0, b: 0),
35 | UIColor(r: 35, g: 35, b: 35),
36 | UIColor(r: 0, g: 0, b: 0),
37 | UIColor(r: 35, g: 35, b: 35)]
38 |
39 |
40 | public override init(frame: CGRect) {
41 | super.init(frame: frame)
42 | }
43 |
44 | public required init?(coder aDecoder: NSCoder) {
45 | super.init(coder: aDecoder)
46 | }
47 |
48 | open override func awakeFromNib() {
49 | super.awakeFromNib()
50 | }
51 |
52 | open override func layoutSubviews() {
53 | super.layoutSubviews()
54 | gradient.frame = bounds
55 | }
56 |
57 | public func startAnimation() {
58 | gradient.removeAllAnimations()
59 | setup()
60 | animateGradient()
61 | }
62 |
63 | fileprivate func setup() {
64 | gradient.frame = bounds
65 | gradient.colors = currentGradientSet()
66 | gradient.startPoint = startPoint
67 | gradient.endPoint = endPoint
68 | gradient.drawsAsynchronously = true
69 |
70 | layer.insertSublayer(gradient, at: 0)
71 | }
72 |
73 | fileprivate func currentGradientSet() -> [CGColor] {
74 | guard colors.count > 0 else { return [] }
75 | return [colors[currentGradient % colors.count].cgColor,
76 | colors[(currentGradient + 1) % colors.count].cgColor]
77 | }
78 |
79 | public func setColors(_ colors: [UIColor]) {
80 | guard colors.count > 0 else { return }
81 | self.colors = colors
82 | }
83 |
84 | public func addcolor(_ color: UIColor) {
85 | self.colors.append(color)
86 | }
87 |
88 | func animateGradient() {
89 | currentGradient += 1
90 | let animation = CABasicAnimation(keyPath: Animation.keyPath)
91 | animation.duration = animationDuration
92 | animation.toValue = currentGradientSet()
93 | animation.fillMode = kCAFillModeForwards
94 | animation.isRemovedOnCompletion = false
95 | animation.delegate = self
96 | gradient.add(animation, forKey: Animation.key)
97 | }
98 |
99 | open override func removeFromSuperview() {
100 | super.removeFromSuperview()
101 | gradient.removeAllAnimations()
102 | gradient.removeFromSuperlayer()
103 | }
104 | }
105 |
106 | extension ArkGradientView: CAAnimationDelegate {
107 | public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
108 | if flag {
109 | gradient.colors = currentGradientSet()
110 | animateGradient()
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkNavigationViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class ArkNavigationViewController: UINavigationController {
19 |
20 | override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {
21 | return .fade
22 | }
23 | override var prefersStatusBarHidden: Bool {
24 | return false
25 | }
26 |
27 | override var preferredStatusBarStyle: UIStatusBarStyle {
28 | return .lightContent
29 | }
30 |
31 | override func viewDidLoad() {
32 | super.viewDidLoad()
33 | view.backgroundColor = ArkPalette.backgroundColor
34 | navigationItem.backBarButtonItem = UIBarButtonItem(title: "",
35 | style: .plain,
36 | target: nil,
37 | action: nil)
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkPalette.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArkPalette.swift
3 | // Dark
4 | //
5 | // Created by Andrew on 2017-09-20.
6 | // Copyright © 2017 Walzy. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public struct ArkPalette {
12 | static public let backgroundColor = UIColor(r: 0, g: 0, b: 0)
13 | static public let secondaryBackgroundColor = UIColor(r: 19, g: 19, b: 19)
14 | static public let tertiaryBackgroundColor = UIColor(r: 42, g: 42, b: 42)
15 | static public let textColor = UIColor(r: 119, g: 119, b: 125)
16 | static public let highlightedTextColor = UIColor(r: 249, g: 247, b: 247)
17 | static public let accentColor = UIColor(r: 0, g: 191, b: 192)
18 |
19 | }
20 |
21 | extension UIColor {
22 | convenience init(r: Int, g: Int, b: Int) {
23 | self.init(red: CGFloat(r) / 255.0, green: CGFloat(g) / 255.0, blue: CGFloat(b) / 255.0, alpha: 1.0)
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkTableView.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class ArkTableView: UITableView {
19 |
20 | init(_ frame: CGRect) {
21 | super.init(frame: frame, style: .grouped)
22 | separatorStyle = .none
23 | backgroundColor = ArkPalette.backgroundColor
24 |
25 | }
26 |
27 | required init?(coder aDecoder: NSCoder) {
28 | fatalError("init(coder:) has not been implemented")
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkTextField.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 |
18 | class ArkTextField: UITextField {
19 |
20 | init(placeHolder: String) {
21 | super.init(frame: CGRect.zero)
22 | isUserInteractionEnabled = true
23 | textAlignment = .center
24 | autocapitalizationType = .none
25 | autocorrectionType = .no
26 | spellCheckingType = .no
27 | textColor = ArkPalette.accentColor
28 | tintColor = ArkPalette.accentColor
29 | adjustsFontSizeToFitWidth = true
30 | placeholder = placeHolder
31 | placeHolderTextColor = ArkPalette.textColor
32 | font = UIFont.systemFont(ofSize: 18.0, weight: .semibold)
33 |
34 | let seperator = UIView()
35 | seperator.backgroundColor = ArkPalette.accentColor
36 | addSubview(seperator)
37 | seperator.snp.makeConstraints { (make) in
38 | make.left.right.bottom.equalToSuperview()
39 | make.height.equalTo(1.0)
40 | }
41 | }
42 |
43 |
44 |
45 | required init?(coder aDecoder: NSCoder) {
46 | fatalError("init(coder:) has not been implemented")
47 | }
48 | }
49 |
50 | class ArkServerTextField: UITextField {
51 |
52 | init(settings: Bool, placeHolder: String) {
53 | super.init(frame: CGRect.zero)
54 | isUserInteractionEnabled = true
55 | textAlignment = .right
56 | autocapitalizationType = .none
57 | autocorrectionType = .no
58 | spellCheckingType = .no
59 | textColor = ArkPalette.accentColor
60 | tintColor = ArkPalette.accentColor
61 | placeholder = placeHolder
62 | placeHolderTextColor = ArkPalette.textColor
63 | font = UIFont.systemFont(ofSize: 16.0, weight: .semibold)
64 | }
65 |
66 | required init?(coder aDecoder: NSCoder) {
67 | fatalError("init(coder:) has not been implemented")
68 | }
69 | }
70 |
71 | extension UITextField {
72 | var placeHolderTextColor: UIColor? {
73 | set {
74 | let placeholderText = self.placeholder != nil ? self.placeholder! : ""
75 | attributedPlaceholder = NSAttributedString(string:placeholderText, attributes:[NSAttributedStringKey.foregroundColor: newValue!])
76 | }
77 | get{
78 | return self.placeHolderTextColor
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/ArkMonitor/Supporting Views/ArkViewController.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 | import UIKit
17 | import SnapKit
18 | import SwiftyArk
19 |
20 | class ArkViewController: UIViewController {
21 |
22 | override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {
23 | return .fade
24 | }
25 | override var prefersStatusBarHidden: Bool {
26 | return false
27 | }
28 |
29 | override var preferredStatusBarStyle: UIStatusBarStyle {
30 | return .lightContent
31 | }
32 |
33 | override func viewDidLoad() {
34 | super.viewDidLoad()
35 | view.backgroundColor = ArkPalette.backgroundColor
36 | if #available(iOS 11.0, *) {
37 | navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: ArkPalette.accentColor]
38 | navigationController?.navigationBar.prefersLargeTitles = true
39 | navigationItem.largeTitleDisplayMode = .always
40 | }
41 |
42 | navigationController?.navigationBar.barTintColor = ArkPalette.backgroundColor
43 | navigationController?.navigationBar.tintColor = ArkPalette.accentColor
44 | navigationController?.navigationBar.isTranslucent = false
45 | navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: ArkPalette.accentColor, NSAttributedStringKey.font: UIFont.systemFont(ofSize: 20.0)]
46 | navigationItem.backBarButtonItem = UIBarButtonItem(title: "",
47 | style: .plain,
48 | target: nil,
49 | action: nil)
50 | }
51 |
52 | override func viewDidAppear(_ animated: Bool) {
53 | super.viewDidAppear(animated)
54 | setNeedsStatusBarAppearanceUpdate()
55 | }
56 |
57 | deinit {
58 | NotificationCenter.default.removeObserver(self)
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/ArkMonitor/TickerInfo.swift:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Ark
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
4 | // "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
5 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
6 | // subject to the following conditions:
7 | //
8 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 | //
10 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
12 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
13 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 | import UIKit
16 | import SwiftyArk
17 |
18 |
19 | struct CurrencyInfo {
20 |
21 | public let currency : Currency
22 | public let currencyName : String
23 | public let currencyUnit : String
24 |
25 | init(_ currency: Currency) {
26 | self.currency = currency
27 | switch currency {
28 | case .aud:
29 | currencyName = "Australian Dollar"
30 | currencyUnit = "$"
31 | case .brl:
32 | currencyName = "Brazilian Real"
33 | currencyUnit = "R$"
34 | case .cad:
35 | currencyName = "Canadian Dollar"
36 | currencyUnit = "$"
37 | case .chf:
38 | currencyName = "Swiss Franc"
39 | currencyUnit = "SFr."
40 | case .clp:
41 | currencyName = "Chilean Peso"
42 | currencyUnit = "$"
43 | case .cny:
44 | currencyName = "Chinese Yuan"
45 | currencyUnit = "\u{A5}"
46 | case .czk:
47 | currencyName = "Czech Koruna"
48 | currencyUnit = "Kč"
49 | case .dkk:
50 | currencyName = "Danish Krone"
51 | currencyUnit = "kr"
52 | case .eur:
53 | currencyName = "Euro"
54 | currencyUnit = "€"
55 | case .gbp:
56 | currencyName = "British Pound"
57 | currencyUnit = "£"
58 | case .hkd:
59 | currencyName = "Hong Kong Dollar"
60 | currencyUnit = "HKD"
61 | case .huf:
62 | currencyName = "Hungarian Forint"
63 | currencyUnit = "Ft"
64 | case .idr:
65 | currencyName = "Indonesian Rupiah"
66 | currencyUnit = "Rp"
67 | case .ils:
68 | currencyName = "Israeli Shekel"
69 | currencyUnit = "₪"
70 | case .inr:
71 | currencyName = "Indian Rupee"
72 | currencyUnit = "₹"
73 | case .jpy:
74 | currencyName = "Japanese Yen"
75 | currencyUnit = "¥"
76 | case .krw:
77 | currencyName = "Korean Won"
78 | currencyUnit = "₩"
79 | case .mxn:
80 | currencyName = "Mexican Peso"
81 | currencyUnit = "$"
82 | case .myr:
83 | currencyName = "Malaysian Ringgit"
84 | currencyUnit = "RM"
85 | case .nok:
86 | currencyName = "Norwegian Krone"
87 | currencyUnit = "kr"
88 | case .nzd:
89 | currencyName = "New Zealand dollar"
90 | currencyUnit = "$"
91 | case .php:
92 | currencyName = "Philippines Peso"
93 | currencyUnit = "₱"
94 | case .pkr:
95 | currencyName = "Pakistani Rupee"
96 | currencyUnit = "₨"
97 | case .pln:
98 | currencyName = "Polish Zloty"
99 | currencyUnit = "zł"
100 | case .rub:
101 | currencyName = "Russian Ruble"
102 | currencyUnit = "₽"
103 | case .sek:
104 | currencyName = "Swedish Krona"
105 | currencyUnit = "kr"
106 | case .sgd:
107 | currencyName = "Singapore Dollar"
108 | currencyUnit = "$"
109 | case .thb:
110 | currencyName = "Thailand Baht"
111 | currencyUnit = "฿"
112 | case .twd:
113 | currencyName = "Taiwan New Dollar"
114 | currencyUnit = "NT$"
115 | case .usd:
116 | currencyName = "United States Dollar"
117 | currencyUnit = "$"
118 | case .zar:
119 | currencyName = "South Africa Rand"
120 | currencyUnit = "R"
121 | }
122 | }
123 | }
124 |
125 |
126 |
127 |
128 |
--------------------------------------------------------------------------------
/ArkMonitor/Wordings/en.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | Localizable.strings
3 | ArkMonitor
4 |
5 | Created by Sacha DSO on 11/12/2017.
6 | Copyright (c) 2016 Ark. All rights reserved.
7 | */
8 |
9 | "Account.Wording" = "To get started,\nenter an Ark Address:";
10 | "Submit" = "Submit";
11 | "ArkAddress" = "Ark Address";
12 | "Home.TransactionHistory" = "Transaction History";
13 | "Home.Vote" = "Vote";
14 | "Home.Sent" = "Sent";
15 | "Home.Received" = "Received";
16 | "Account" = "Account";
17 | "Delegate" = "Delegate";
18 | "Transaction" = "Transaction";
19 | "Block" = "Block";
20 | "ReceiveTransfer.CopyAddress" = "Copy Address";
21 | "ReceiveTransfer.AddressSuccessfullyCopied" = "Address successfully copied!";
22 | "Delegates" = "Delegates";
23 | "Delegates.Address" = "Address";
24 | "Delegates.PublicKey" = "Public Key";
25 | "Delegates.Votes" = "Votes";
26 | "Delegates.ProducedBlocks" = "Produced Blocks";
27 | "Delegates.MissedBlocks" = "Missed Blocks";
28 | "Delegates.Rank" = "Rank";
29 | "Delegates.Productivity" = "Productivity";
30 | "Delegates.Approval" = "Approval";
31 | "Delegates.Username" = "Username";
32 | "TabBar.Home" = "Home";
33 | "TabBar.Delegate" = "Delegate";
34 | "TabBar.Explorer" = "Explorer";
35 | "TabBar.Delegates" = "Delegates";
36 | "TabBar.Settings" = "Settings";
37 | "Settings.SignOut" = "Sign out";
38 | "Settings.ReferenceCurrency" = "Reference Currency";
39 | "Settings.TransactionNotifications" = "Transaction Notifications";
40 | "Settings.TransactionNotificationsDetail" = "If enabled, you will recieve push notifications for new transactions";
41 | "Settings.DelegateNotifications" = "Delegate Notifications";
42 | "Settings.DelegateNotificationsDetail" = "If enabled, you will recieve push notifications with changes to your delegate's status";
43 | "Currency" = "Currency";
44 | "Server" = "Server";
45 | "Transaction.Detail" = "Detail";
46 | "Transaction.TransactionID" = "Transaction ID";
47 | "Transaction.Time" = "Time";
48 | "Transaction.From" = "From";
49 | "Transaction.To" = "To";
50 | "Transaction.Amount" = "Amount";
51 | "Transaction.Fee" = "Fee";
52 | "Transaction.Confirmations" = "Confirmations";
53 | "Transaction.VendorField" = "Vendor Field";
54 | "Account.Detail" = "Account Detail";
55 | "Account.Address" = "Address";
56 | "Account.PublicKey" = "Public Key";
57 | "Account.Balance" = "Balance";
58 | "Account.UnconfirmedBalance" = "Unconfirmed Balance";
59 | "Message.SuccessfullyFoundAccount" = "Successfully found Account!";
60 | "Message.SuccessfullyUpdatedServer" = "Successfully updated server";
61 | "Message.UnableToFindAccount" = "Unable to find Account";
62 | "Message.NoDelegateForAccount" = "No delegate vote found for Account";
63 | "Message.CurrencySuccessfullyUpdated" = "Currency successfully updated!";
64 | "Message.SuccessfullyRemovedServer" = "Successfully removed server";
65 | "Message.ServerNameCannotBeBlank" = "Server name cannot be blank";
66 | "Message.IPAddressCannotBeBlank" = "IP Address cannot be blank";
67 | "Message.PortCannotBeBlank" = "Port cannot be blank";
68 | "Message.SuccessfullyAddedServer" = "Successfully added server";
69 | "Message.ServerAlreadyExists" = "Server already exists with that name";
70 | "Block.Detail" = "Block Detail";
71 | "Block.BlockID" = "Block ID";
72 | "Block.Height" = "Height";
73 | "Block.PreviousBlock" = "Previous Block";
74 | "Block.NumberOfTransactions" = "Number of Transactions";
75 | "Block.TotalAmount" = "Total Amount";
76 | "Block.TotalFee" = "Total Fee";
77 | "Block.RewardsFee" = "Rewards Fee";
78 | "Block.PayloadLength" = "Payload Length";
79 | "Block.GeneratorPublicKey" = "Generator Public Key";
80 | "Block.BlockSignature" = "Block Signature";
81 | "Block.Confirmations" = "Confirmations";
82 | "Server.AddCustomServer" = "Add custom server";
83 | "IPAddress" = "IP Address";
84 | "Port" = "Port";
85 | "ServerName" = "Server name";
86 | "SSLEnabled" = "SSL Enabled?";
87 | "ExplorerWording" = "Search for a block,transaction,\naddress, or delegate";
88 | "ExplorerNoResults" = "No matching records found!";
89 |
--------------------------------------------------------------------------------
/ArkMonitor/Wordings/fr.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | Localizable.strings
3 | ArkMonitor
4 |
5 | Created by Sacha DSO on 11/12/2017.
6 | Copyright (c) 2016 Ark. All rights reserved.
7 | */
8 |
9 | "Account.Wording" = "Pour démarrer,\nentrez une adresse Ark:";
10 | "Submit" = "Valider";
11 | "ArkAddress" = "Adresse Ark";
12 | "Home.TransactionHistory" = "Historique des Transactions";
13 | "Home.Vote" = "Vote";
14 | "Home.Sent" = "Envoyé";
15 | "Home.Received" = "Reçu";
16 | "Account" = "Compte";
17 | "Delegate" = "Délégué";
18 | "Transaction" = "Transaction";
19 | "Block" = "Bloc";
20 | "ReceiveTransfer.CopyAddress" = "Copier l'Adresse";
21 | "ReceiveTransfer.AddressSuccessfullyCopied" = "Adresse copiée avec succès !";
22 | "Delegates" = "Délégués";
23 | "Delegates.Address" = "Adresse";
24 | "Delegates.PublicKey" = "Clé Publique";
25 | "Delegates.Votes" = "Votes";
26 | "Delegates.ProducedBlocks" = "Blocs Produits";
27 | "Delegates.MissedBlocks" = "Blocs Manqués";
28 | "Delegates.Rank" = "Rang";
29 | "Delegates.Productivity" = "Productivité";
30 | "Delegates.Approval" = "Approbation";
31 | "Delegates.Username" = "Pseudo";
32 | "TabBar.Home" = "Accueil";
33 | "TabBar.Delegate" = "Délégué";
34 | "TabBar.Explorer" = "Explorer";
35 | "TabBar.Delegates" = "Délégués";
36 | "TabBar.Settings" = "Paramètres";
37 | "Settings.SignOut" = "Déconnexion";
38 | "Settings.ReferenceCurrency" = "Monnaie de Référence";
39 | "Settings.TransactionNotifications" = "Notifications de Transaction";
40 | "Settings.TransactionNotificationsDetail" = "Si activé, vous recevrez des notifications push pour les nouvelles transactions";
41 | "Settings.DelegateNotifications" = "Notifications de délégué";
42 | "Settings.DelegateNotificationsDetail" = "Si activé, vous recevrez des notifications push pour les changements de statut de votre délegué";
43 | "Currency" = "Monnaie";
44 | "Server" = "Serveur";
45 | "Transaction.Detail" = "Détail";
46 | "Transaction.TransactionID" = "ID de transaction";
47 | "Transaction.Time" = "Date";
48 | "Transaction.From" = "De";
49 | "Transaction.To" = "À";
50 | "Transaction.Amount" = "Montant";
51 | "Transaction.Fee" = "Frais";
52 | "Transaction.Confirmations" = "Confirmations";
53 | "Transaction.VendorField" = "Champs Vendor";
54 | "Account.Detail" = "Détails du Compte";
55 | "Account.Address" = "Adresse";
56 | "Account.PublicKey" = "Clé Publique";
57 | "Account.Balance" = "Solde";
58 | "Account.UnconfirmedBalance" = "Solde non confirmé";
59 | "Message.SuccessfullyFoundAccount" = "Compte trouvé avec succès !";
60 | "Message.SuccessfullyUpdatedServer" = "Serveur mis à jour avec succès";
61 | "Message.UnableToFindAccount" = "Impossible de trouver le compte";
62 | "Message.NoDelegateForAccount" = "Aucun délégué trouvé pour le compte";
63 | "Message.CurrencySuccessfullyUpdated" = "Monnais mise à jour avec succès";
64 | "Message.SuccessfullyRemovedServer" = "Serveur supprimé avec succès";
65 | "Message.ServerNameCannotBeBlank" = "Le nom du serveur ne peut être vide";
66 | "Message.IPAddressCannotBeBlank" = "L'adresse IP ne peut être vide";
67 | "Message.PortCannotBeBlank" = "Le port ne peut être vide";
68 | "Message.SuccessfullyAddedServer" = "Serveur ajouté avec succès";
69 | "Message.ServerAlreadyExists" = "Un serveur du même nom existe déja";
70 | "Block.Detail" = "Détail du Bloc";
71 | "Block.BlockID" = "ID du Bloc";
72 | "Block.Height" = "Hauteur";
73 | "Block.PreviousBlock" = "Bloc Précédent";
74 | "Block.NumberOfTransactions" = "Nombre de Transactions";
75 | "Block.TotalAmount" = "Montant Amount";
76 | "Block.TotalFee" = "Total des Frais";
77 | "Block.RewardsFee" = "Frai de Récompense";
78 | "Block.PayloadLength" = "Longueur de la Payload";
79 | "Block.GeneratorPublicKey" = "Clé publique du Générateur";
80 | "Block.BlockSignature" = "Signature du Bloc";
81 | "Block.Confirmations" = "Confirmations";
82 | "Server.AddCustomServer" = "Ajouter un serveur custom";
83 | "IPAddress" = "Addresse IP";
84 | "Port" = "Port";
85 | "ServerName" = "Nom du Serveur";
86 | "SSLEnabled" = "SSL Activé ?";
87 | "ExplorerWording" = "Rechercher un bloc, une transaction, une adresse ou un délégué";
88 | "ExplorerNoResults" = "Aucun résultat trouvé !";
89 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Ark Ecosystem
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | target 'ArkMonitor' do
5 | use_frameworks!
6 | pod "SwiftyArk"
7 | pod "SnapKit"
8 | pod 'Disk'
9 | pod 'NotificationBannerSwift'
10 | end
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ark Monitor
2 |
3 | [](https://developer.apple.com/swift)
4 | 
5 | [](https://github.com/ArkEcosystem/ark-ios-monitor/blob/master/LICENSE)
6 |
7 |
8 |
9 |
10 | ## Authors
11 | - Andrew Walz andrewjwalz@gmail.com
12 | - Victor Lins victor@ark.io
13 |
14 | ## License
15 |
16 | MIT License
17 |
18 | Copyright (c) 2016 Ark
19 |
20 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
21 |
22 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
23 |
24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 |
--------------------------------------------------------------------------------