Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions GoMoney.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -967,8 +967,8 @@
08C8729B28F655CD00DC859D /* Sources */,
08C8729C28F655CD00DC859D /* Frameworks */,
08C8729D28F655CD00DC859D /* Resources */,
8291F096518328B4CB2334CA /* [CP] Embed Pods Frameworks */,
08EEA005291CC29F003B35B8 /* Embed Foundation Extensions */,
C7F73096535B070AD90AE7EF /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -1085,7 +1085,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
8291F096518328B4CB2334CA /* [CP] Embed Pods Frameworks */ = {
C7F73096535B070AD90AE7EF /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down
20 changes: 6 additions & 14 deletions GoMoney/AppDelegate/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
//
// AppDelegate.swift
// GoMoney
//
// Created by Golden Owl on 12/10/2022.
//

import FirebaseCore
import GoogleSignIn
import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
func application(_: UIApplication, open url: URL, options _: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
return GIDSignIn.sharedInstance.handle(url)
}

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

FirebaseApp.configure()

return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
func application(_: UIApplication, didDiscardSceneSessions _: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

19 changes: 6 additions & 13 deletions GoMoney/AppDelegate/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
//
// SceneDelegate.swift
// GoMoney
//
// Created by Golden Owl on 12/10/2022.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?

let settingManager = SettingsManager.shared

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
func scene(_ scene: UIScene, willConnectTo _: UISceneSession, options _: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
Expand Down Expand Up @@ -44,29 +37,29 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
window?.makeKeyAndVisible()
}

func sceneDidDisconnect(_ scene: UIScene) {
func sceneDidDisconnect(_: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}

func sceneDidBecomeActive(_ scene: UIScene) {
func sceneDidBecomeActive(_: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}

func sceneWillResignActive(_ scene: UIScene) {
func sceneWillResignActive(_: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}

func sceneWillEnterForeground(_ scene: UIScene) {
func sceneWillEnterForeground(_: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}

func sceneDidEnterBackground(_ scene: UIScene) {
func sceneDidEnterBackground(_: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
Expand Down
25 changes: 12 additions & 13 deletions GoMoney/Base/GMMainViewController.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// GMViewController.swift
// GoMoney
//
// Created by Golden Owl on 12/10/2022.
//

import Reachability
import UIKit

Expand Down Expand Up @@ -55,17 +48,20 @@ class GMMainViewController: GMViewController {
image: leftBarImage,
style: .done,
target: self,
action: nil)
action: nil
)

let leftBarTitle = UIBarButtonItem(
title: leftTitle,
style: .plain,
target: self,
action: nil)
action: nil
)

leftBarTitle.setTitleTextAttributes(
[.foregroundColor: UIColor.white, .font: K.Theme.titleFont],
for: .disabled)
for: .disabled
)

leftBarIcon.isEnabled = false
leftBarTitle.isEnabled = false
Expand All @@ -77,7 +73,8 @@ class GMMainViewController: GMViewController {
image: rightBarImage,
style: .done,
target: self,
action: nil)
action: nil
)
navigationItem.rightBarButtonItem = rightBarIcon
}

Expand Down Expand Up @@ -106,7 +103,8 @@ class GMMainViewController: GMViewController {
if self?.networkAvailable == false {
self?.snackBar(
message: "Connection restored",
actionIcon: UIImage(named: "ic_wifi")?.color(.green))
actionIcon: UIImage(named: "ic_wifi")?.color(.green)
)
self?.networkAvailable = true
}
}
Expand All @@ -119,7 +117,8 @@ class GMMainViewController: GMViewController {

self?.snackBar(
message: "Connection lost",
actionIcon: UIImage(named: "ic_wifi_off")?.color(.red))
actionIcon: UIImage(named: "ic_wifi_off")?.color(.red)
)
}
}

Expand Down
17 changes: 6 additions & 11 deletions GoMoney/Base/GMViewController.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// GMViewController.swift
// GoMoney
//
// Created by Golden Owl on 12/10/2022.
//

import UIKit

class GMViewController: UIViewController {
Expand Down Expand Up @@ -70,22 +63,24 @@ class GMViewController: UIViewController {
func setupKeyboard(
onKeyboardWillShow: ((CGFloat, Double) -> Void)?,
onKeyboardWillHide: ((CGFloat, Double) -> Void)?,
hideKeyboarOnTap: Bool = true)
{
hideKeyboarOnTap: Bool = true
) {
self.onKeyboardWillShow = onKeyboardWillShow
self.onKeyboardWillHide = onKeyboardWillHide

NotificationCenter.default.addObserver(
self,
selector: #selector(handleKeyboardWillShow(notification:)),
name: UIResponder.keyboardWillShowNotification,
object: nil)
object: nil
)

NotificationCenter.default.addObserver(
self,
selector: #selector(handleKeyboardWillHide(notification:)),
name: UIResponder.keyboardWillHideNotification,
object: nil)
object: nil
)

if hideKeyboarOnTap {
hideKeyboardOnTap()
Expand Down
14 changes: 7 additions & 7 deletions GoMoney/Common/AsyncImage/AsyncImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class AsyncImageView: UIView {
imageView.trailingAnchor.constraint(equalTo: trailingAnchor),

activityIndicator.centerXAnchor.constraint(equalTo: centerXAnchor),
activityIndicator.centerYAnchor.constraint(equalTo: centerYAnchor)
activityIndicator.centerYAnchor.constraint(equalTo: centerYAnchor),
])
}

Expand All @@ -53,13 +53,13 @@ public class AsyncImageView: UIView {
loader.loadImage(imageURL) { [weak self] result in
DispatchQueue.main.async {
switch result {
case .success(let image):
self?.activityIndicator.stopAnimating()
self?.imageView.image = image
case let .success(image):
self?.activityIndicator.stopAnimating()
self?.imageView.image = image

case .failure:
self?.activityIndicator.stopAnimating()
self?.imageView.image = defaultImage
case .failure:
self?.activityIndicator.stopAnimating()
self?.imageView.image = defaultImage
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion GoMoney/Common/Chart/Formatter/DayAxisValueFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class BarChartXAxisFormatter: IndexAxisValueFormatter {
self.tagExpenses = tagExpenses
}

override func stringForValue(_ value: Double, axis: AxisBase?) -> String {
override func stringForValue(_ value: Double, axis _: AxisBase?) -> String {
guard let
tagExpenses = tagExpenses,
tagExpenses.count > 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LineChartXAxisFormatter: IndexAxisValueFormatter {
self.dateType = dateType
}

override func stringForValue(_ value: Double, axis: AxisBase?) -> String {
override func stringForValue(_ value: Double, axis _: AxisBase?) -> String {
guard
let dateAmount = dateAmount,
let dateType = dateType,
Expand Down
2 changes: 1 addition & 1 deletion GoMoney/Common/Currency/MoneyFormatter.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class MoneyFormatter {
enum MoneyFormatter {
static func formatShorter(amount: Double, currency: CurrencyUnit) -> String {
switch currency {
case .dong:
Expand Down
2 changes: 1 addition & 1 deletion GoMoney/Common/InputView/AccessoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class AccessoryView: UIView {
}

@available(*, unavailable)
required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
8 changes: 4 additions & 4 deletions GoMoney/Common/InputView/CategoryPickerInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class CategoryPickerInputView: UIView {
}

@available(*, unavailable)
required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand All @@ -69,7 +69,7 @@ public class CategoryPickerInputView: UIView {
}

extension CategoryPickerInputView: UICollectionViewDelegate, UICollectionViewDataSource {
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
public func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int {
return type == .expense ? expenseTags.count : incomeTags.count
}

Expand All @@ -82,7 +82,7 @@ extension CategoryPickerInputView: UICollectionViewDelegate, UICollectionViewDat
return UICollectionViewCell()
}

public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
public func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let tag = type == .expense ? expenseTags[indexPath.row] : incomeTags[indexPath.row]
didSelect?(tag)
}
Expand Down Expand Up @@ -110,7 +110,7 @@ class CategoryPickerCell: UICollectionViewCell {
}

@available(*, unavailable)
required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
4 changes: 2 additions & 2 deletions GoMoney/Common/InputView/DatePickerInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public class DatePickerInputView: UIView {
) {
super.init(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 200))
self.didSelect = didSelect
self.pickerMode = mode
pickerMode = mode
setupView()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Expand Down
Loading