Skip to content

Commit

Permalink
Deploy, Adsense, Analytics e Esteiras - CI/CD Pipelines e esteiras
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurrios committed Feb 4, 2025
1 parent d47ef98 commit 37f9137
Show file tree
Hide file tree
Showing 29 changed files with 401 additions and 356 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Swiftlint Pipeline

on:
pull_request:
branches:
- main
- develop
push:
branches:
- main

jobs:
lint:
runs-on: macos-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Swiftlint
run: brew install swiftlint

- name: Run Swiftlint and Save Report
run:
swiftlint > swiftlint-report.txt || true
continue-on-error: true

- name: Upload Swiftlint Report
uses: actions/upload-artifact@v4
with:
name: swiftlint-report
path: swiftlint-report.txt

9 changes: 9 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
disabled_rules:
- line_length
included:
- Reminder
excluded:
- Pods
- Carthage
- fastlane
- Tests
19 changes: 19 additions & 0 deletions Reminder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@
buildPhases = (
80E498AEC4A419C481F795A1 /* [CP] Check Pods Manifest.lock */,
C62ACC812CB17D9B00E2B32F /* Sources */,
C65048BF2D5283C7007BC587 /* Swiftlint */,
C62ACC822CB17D9B00E2B32F /* Frameworks */,
C62ACC832CB17D9B00E2B32F /* Resources */,
40BDFF692C4C6CD35D0B5C02 /* [CP] Embed Pods Frameworks */,
Expand Down Expand Up @@ -760,6 +761,24 @@
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;
};
C65048BF2D5283C7007BC587 /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = Swiftlint;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi \n\nif which swiftlint > /dev/null; then\n swiftlint --fix && swiftlint\nelse\n echo \"warning: Swiftlint não está instalado. Execute 'brew install swiftlint' para instalar.\"\nfi\n \n";
};
F239F9355462D78CAD941ADE /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
1 change: 0 additions & 1 deletion Reminder/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
}
}

31 changes: 15 additions & 16 deletions Reminder/ReminderFlowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import Foundation
import UIKit

class ReminderFlowController {
//MARK: - Properties
// MARK: - Properties
private var navigationController: UINavigationController?
private let viewControllerFactory: ViewControllersFactoryProtocol
//MARK: - init
// MARK: - init
public init() {
self.viewControllerFactory = ViewControllersFactory()
}
//MARK: - startFlow

// MARK: - startFlow
func start() -> UINavigationController? {
let startViewController = viewControllerFactory.makeSplashViewController(flowDelegate: self)
let startViewController = viewControllerFactory.makeSplashViewController(flowDelegate: self)
self.navigationController = UINavigationController(rootViewController: startViewController)
return navigationController
}
}

//MARK: - Login
// MARK: - Login
extension ReminderFlowController: LoginBottomSheetFlowDelegate {
func navigateToHome() {
self.navigationController?.dismiss(animated: false)
Expand All @@ -34,7 +34,7 @@ extension ReminderFlowController: LoginBottomSheetFlowDelegate {
}
}

//MARK: - Splash
// MARK: - Splash
extension ReminderFlowController: SplashFlowDelegate {
func openLoginBottomSheet() {
let loginBottomSheet = viewControllerFactory.makeLoginBottomSheetController(flowDelegate: self)
Expand All @@ -43,7 +43,7 @@ extension ReminderFlowController: SplashFlowDelegate {
navigationController?.present(loginBottomSheet, animated: false) {
loginBottomSheet.animateShow()
}

func navigateToHome() {
self.navigationController?.dismiss(animated: false)
let viewController = viewControllerFactory.makeHomeViewController(flowDelegate: self)
Expand All @@ -52,34 +52,33 @@ extension ReminderFlowController: SplashFlowDelegate {
}
}

//MARK: - Home
// MARK: - Home
extension ReminderFlowController: HomeFlowDelegate {
func navigateToMyRecipes() {
let myRecipesViewController = viewControllerFactory.makeMyReceiptsViewController(flowDelegate: self)
self.navigationController?.pushViewController(myRecipesViewController, animated: true)
}

func navigateToRecipes() {
let recipesViewController = viewControllerFactory.makeRecipesViewController()
self.navigationController?.pushViewController(recipesViewController, animated: true)
}

func logout() {
self.navigationController?.popViewController(animated: true)
self.openLoginBottomSheet()
}



}

//MARK: - MyReceipts
// MARK: - MyReceipts
extension ReminderFlowController: MyReceiptsFlowDelegate {
func popScreen() {
self.navigationController?.popViewController(animated: true)
}

func goToNewRecipes() {
self.navigateToRecipes()
}

}
6 changes: 2 additions & 4 deletions Reminder/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }

let window = UIWindow(windowScene: windowScene)
flowController = ReminderFlowController()
let rootViewController = flowController?.start()

window.rootViewController = rootViewController
self.window = window
window.makeKeyAndVisible()
Expand Down Expand Up @@ -52,6 +52,4 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// to restore the scene back to its current state.
}


}

Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import UIKit

class ButtonHomeView: UIView {
var tapAction: (() -> Void)?

private let iconView: UIView = {
let view = UIView()
view.backgroundColor = Colors.gray600
view.layer.cornerRadius = 10
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()

private let iconImageView: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
}()

private let titleLabel: UILabel = {
let label = UILabel()
label.font = Typography.subHeading
Expand All @@ -34,7 +34,7 @@ class ButtonHomeView: UIView {
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

private let descriptionLabel: UILabel = {
let label = UILabel()
label.font = Typography.body
Expand All @@ -43,15 +43,15 @@ class ButtonHomeView: UIView {
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

private let arrowImageView: UIImageView = {
let imageView = UIImageView(image: UIImage(systemName: "chevron.right"))
imageView.tintColor = Colors.gray400
imageView.contentMode = .scaleAspectFit
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
}()

init(icon: UIImage?, title: String, description: String) {
super.init(frame: .zero)
backgroundColor = Colors.gray700
Expand All @@ -62,56 +62,55 @@ class ButtonHomeView: UIView {
iconImageView.image = icon
titleLabel.text = title
descriptionLabel.text = description

setupGesture()
setupUI()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setupUI() {
addSubview(iconView)
iconView.addSubview(iconImageView)
addSubview(titleLabel)
addSubview(descriptionLabel)
addSubview(arrowImageView)

NSLayoutConstraint.activate([
iconView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: Metrics.medium),
iconView.centerYAnchor.constraint(equalTo: centerYAnchor),
iconView.widthAnchor.constraint(equalToConstant: 80),
iconView.heightAnchor.constraint(equalToConstant: 80),

iconImageView.centerXAnchor.constraint(equalTo: iconView.centerXAnchor),
iconImageView.centerYAnchor.constraint(equalTo: iconView.centerYAnchor),
iconImageView.widthAnchor.constraint(equalToConstant: 48),
iconImageView.heightAnchor.constraint(equalToConstant: 48),

titleLabel.topAnchor.constraint(equalTo: topAnchor, constant: Metrics.medium),
titleLabel.leadingAnchor.constraint(equalTo: iconView.trailingAnchor, constant: Metrics.medier),
titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -Metrics.medier),

descriptionLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: Metrics.medier),
descriptionLabel.leadingAnchor.constraint(equalTo: titleLabel.leadingAnchor),
descriptionLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -Metrics.medier),
descriptionLabel.bottomAnchor.constraint(lessThanOrEqualTo: bottomAnchor, constant: -Metrics.tiny),



arrowImageView.bottomAnchor.constraint(equalTo: titleLabel.centerYAnchor),
arrowImageView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -Metrics.medier),
arrowImageView.widthAnchor.constraint(equalToConstant: 16),
arrowImageView.heightAnchor.constraint(equalToConstant: 16),
arrowImageView.heightAnchor.constraint(equalToConstant: 16)
])
}

private func setupGesture() {
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap))
self.addGestureRecognizer(tapGesture)
self.isUserInteractionEnabled = true
}

@objc private func handleTap() {
tapAction?()
}
Expand Down
18 changes: 9 additions & 9 deletions Reminder/Sources/Features/Components/Checkbox/Checkbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,42 @@ class Checkbox: UIView {
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

private let checkbox: UIButton = {
let button = UIButton()
button.setImage(UIImage(systemName: "square"), for: .normal)
button.tintColor = Colors.gray400
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()

init(title: String) {
super.init(frame: .zero)

translatesAutoresizingMaskIntoConstraints = false

titleLabel.text = title
setupView()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setupView() {
addSubview(checkbox)
addSubview(titleLabel)

setupConstraints()
}

private func setupConstraints() {
NSLayoutConstraint.activate([
checkbox.leadingAnchor.constraint(equalTo: leadingAnchor),
checkbox.centerYAnchor.constraint(equalTo: centerYAnchor),
checkbox.widthAnchor.constraint(equalToConstant: 24),
checkbox.heightAnchor.constraint(equalToConstant: 24),

titleLabel.leadingAnchor.constraint(equalTo: checkbox.trailingAnchor, constant: Metrics.small),
titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor),
titleLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
Expand Down
Loading

0 comments on commit 37f9137

Please sign in to comment.