Skip to content

Commit

Permalink
Merge pull request #72 from nimblehq/release/0.4.0
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
Thieurom authored Dec 26, 2022
2 parents 85a36df + 9532a02 commit e0279da
Show file tree
Hide file tree
Showing 64 changed files with 1,271 additions and 298 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/automatic_pull_request_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,28 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/cache@v3
- name: Cache Ruby gems
uses: actions/cache@v3
id: bunlderCache
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Cache Swift packages
uses: actions/cache@v3
with:
path: SourcePackages
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Setup
run: make setup

Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/deploy_Firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -28,7 +29,15 @@ jobs:
run: |
yarn add firebase-tools
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Cache Swift packages
uses: actions/cache@v3
with:
path: SourcePackages
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Setup
run: make setup

Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/deploy_Release_Firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install SSH key
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}


- name: Cache Swift packages
uses: actions/cache@v3
with:
path: SourcePackages
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Setup
run: make setup

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ fastlane/FastlaneRunner
# Bundler
.bundle
vendor/bundle

# SourcePackages folder
SourcePackages
136 changes: 115 additions & 21 deletions CryptoPrices.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,52 +1,77 @@
{
"object": {
"pins": [
{
"package": "CwlCatchException",
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git",
"state": {
"branch": null,
"revision": "35f9e770f54ce62dd8526470f14c6e137cef3eea",
"version": "2.1.1"
}
},
{
"package": "CwlPreconditionTesting",
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state": {
"branch": null,
"revision": "c21f7bab5ca8eee0a9998bbd17ca1d0eb45d4688",
"version": "2.1.0"
}
},
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble",
"state": {
"branch": null,
"revision": "b7f6c49acdb247e3158198c5448b38c3cc595533",
"version": "11.2.1"
}
},
{
"package": "Pilot",
"repositoryURL": "https://github.com/Thieurom/Pilot",
"state": {
"branch": null,
"revision": "d0c990223f3447fd912ae716d03676fd1db714af",
"version": "0.5.1"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick",
"state": {
"branch": null,
"revision": "16910e406be96e08923918315388c3e989deac9e",
"version": "6.1.0"
}
}
]
},
"version": 1
"pins" : [
{
"identity" : "cwlcatchexception",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattgallagher/CwlCatchException.git",
"state" : {
"revision" : "35f9e770f54ce62dd8526470f14c6e137cef3eea",
"version" : "2.1.1"
}
},
{
"identity" : "cwlpreconditiontesting",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state" : {
"revision" : "c21f7bab5ca8eee0a9998bbd17ca1d0eb45d4688",
"version" : "2.1.0"
}
},
{
"identity" : "factory",
"kind" : "remoteSourceControl",
"location" : "https://github.com/hmlongco/Factory",
"state" : {
"revision" : "ca5788b8621b185a0fbe6ef05bb9a73b3ef2833f",
"version" : "1.2.9"
}
},
{
"identity" : "nimble",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Nimble",
"state" : {
"revision" : "b7f6c49acdb247e3158198c5448b38c3cc595533",
"version" : "11.2.1"
}
},
{
"identity" : "pilot",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Thieurom/Pilot",
"state" : {
"revision" : "d0c990223f3447fd912ae716d03676fd1db714af",
"version" : "0.5.1"
}
},
{
"identity" : "quick",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Quick",
"state" : {
"revision" : "16910e406be96e08923918315388c3e989deac9e",
"version" : "6.1.0"
}
},
{
"identity" : "showtime",
"kind" : "remoteSourceControl",
"location" : "https://github.com/KaneCheshire/ShowTime",
"state" : {
"revision" : "f4e976931fc5f9b7a7d011f40c62a250c4ff53ab",
"version" : "2.5.3"
}
},
{
"identity" : "wormholy",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ipavlidakis/Wormholy",
"state" : {
"branch" : "master",
"revision" : "fa6cba3377498701c67720d4911d33b36a5d0bab"
}
}
],
"version" : 2
}
52 changes: 40 additions & 12 deletions CryptoPrices/Sources/App/CryptoPricesApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,62 @@
// Created by Doan Thieu on 28/11/2022.
//

import Factory
import Home
import NetworkExtension
import Pilot
import Repositories
import MyCoin
import ShowTime
import Styleguide
import SwiftUI
import UseCases
import WormholySwift

@main
struct CryptoPricesApp: App {

// TODO: Apply DI instead of manually initializing
private let network = Pilot<CoinRoute>()
@StateObject var appCoordinator = AppCoordinator()

@Injected(Container.homeViewModel) private var homeViewModel

var body: some Scene {
// TODO: Apply DI instead of manually initializing
WindowGroup {
HomeView(
viewModel: HomeViewModel(
myCoinsUseCase: MyCoinsUseCase(
repository: CoinRepository(coinAPI: network)
switch appCoordinator.state {
case let .home(homeState):
HomeView(viewModel: homeViewModel)
.environmentObject(homeState)
case let .myCoin(myCoinState):
MyCoinView()
.environmentObject(myCoinState)
.transition(
.move(edge: .trailing)
.animation(.linear(duration: 1.0))
)
)
)
}
}
}

init() {
Fonts.registerAllCustomFonts()
enableVisualTouchesOnDebug()
configureWormhly()
}
}

extension CryptoPricesApp {

// Config showing taps and gestures on screen on DEBUG
private func enableVisualTouchesOnDebug() {
#if DEBUG
ShowTime.enabled = .debugOnly
ShowTime.fillColor = .lightGray.withAlphaComponent(0.7)
ShowTime.strokeColor = .lightGray
ShowTime.strokeWidth = 1
ShowTime.disappearDelay = 0.1
#endif
}

private func configureWormhly() {
#if !DEBUG
Wormholy.shakeEnabled = false
#endif
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// Container+Injection.swift
// CryptoPrices
//
// Created by Minh Pham on 21/12/2022.
//

import Factory
import Home
import MyCoin
import NetworkExtension
import UseCaseProtocol
import NetworkCore
import Pilot
import Repositories
import RepositoryProtocol
import UseCases

@MainActor
extension Container {

// Network
static let coinAPI = Factory<CoinAPIProtocol> { Pilot<CoinRoute>() }

// ViewModels
static let homeViewModel = Factory {
HomeViewModel(myCoinsUseCase: myCoinsUseCase.callAsFunction())
}

// Repositories
static let coinRepository = Factory<CoinRepositoryProtocol> {
CoinRepository(coinAPI: coinAPI.callAsFunction())
}

// UseCases
static let myCoinsUseCase = Factory<MyCoinsUseCaseProtocol> {
MyCoinsUseCase(repository: coinRepository.callAsFunction())

}
}
48 changes: 48 additions & 0 deletions CryptoPrices/Sources/App/Navigation/AppCoordinator.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// AppCoordinator.swift
// CryptoPrices
//
// Created by Khanh on 19/12/2022.
//

import Combine
import Home
import MyCoin
import SwiftUI

final class AppCoordinator: ObservableObject {

@Published var state: AppState = .home(HomeState())

private var cancellables = Set<AnyCancellable>()

init() {
$state
.compactMap { currentState -> HomeState? in
if case let .home(homeState) = currentState {
return homeState
}
return nil
}
.flatMap(\.$didSelectCoin)
.filter { $0 }
.sink(receiveValue: { [weak self] _ in
self?.state = .myCoin(MyCoinState())
})
.store(in: &cancellables)

$state
.compactMap { currentState -> MyCoinState? in
if case let .myCoin(myCoinState) = currentState {
return myCoinState
}
return nil
}
.flatMap(\.$didSelectBack)
.filter { $0 }
.sink(receiveValue: { [weak self] _ in
self?.state = .home(HomeState())
})
.store(in: &cancellables)
}
}
Loading

0 comments on commit e0279da

Please sign in to comment.