Skip to content

Commit

Permalink
Merge pull request #333 from EhPanda-Team/develop
Browse files Browse the repository at this point in the history
Bugfixes & Refactoring
  • Loading branch information
chihchy authored May 27, 2023
2 parents 0bc63c4 + 0a4a294 commit 75ff164
Show file tree
Hide file tree
Showing 161 changed files with 7,753 additions and 8,721 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Xcode Dependencies
on:
schedule:
- cron: '0 0 * * 1'
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
dependencies:
runs-on: macos-13
if: ${{ contains(github.event.head_commit.message, '[update dependencies]') || github.event_name == 'schedule' }}
steps:
- uses: actions/checkout@v2
- name: Resolve Dependencies
id: resolution
uses: GetSidetrack/action-xcodeproj-spm-update@main
with:
forceResolution: true
failWhenOutdated: false
- name: Create Pull Request
if: steps.resolution.outputs.dependenciesChanged == 'true'
uses: peter-evans/create-pull-request@v3
with:
branch: 'update-dependencies'
delete-branch: true
commit-message: 'Update dependencies [skip test]'
title: 'Updated Dependencies'
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
- main
types: [closed]
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app
APP_VERSION: '2.6.1'
DEVELOPER_DIR: /Applications/Xcode_14.3.app
APP_VERSION: '2.7.0'
SCHEME_NAME: 'EhPanda'
ALTSTORE_JSON_PATH: './AltStore.json'
BUILDS_PATH: '/tmp/action-builds'
Expand All @@ -19,7 +19,7 @@ env:

jobs:
Deploy:
runs-on: macos-12
runs-on: macos-13
if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'chihchy'
steps:
- name: Checkout
Expand All @@ -34,7 +34,7 @@ jobs:
run: xcodebuild -version
- name: Run tests
run: xcodebuild clean test -scheme ${{ env.SCHEME_NAME }} -sdk iphonesimulator
-destination 'platform=iOS Simulator,name=iPhone 14'
-destination 'platform=iOS Simulator,name=iPhone 14 Pro'
- name: Bump version
id: bump-version
uses: yanamura/ios-bump-version@v1
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name: Test
on: [push]
env:
SCHEME_NAME: 'EhPanda'
DEVELOPER_DIR: /Applications/Xcode_14.1.app
DEVELOPER_DIR: /Applications/Xcode_14.3.app
jobs:
Test:
runs-on: macos-12
runs-on: macos-13
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -16,4 +17,4 @@ jobs:
- name: Run tests
run: xcodebuild clean test
-scheme ${{ env.SCHEME_NAME }} -sdk iphonesimulator
-destination 'platform=iOS Simulator,name=iPhone 14'
-destination 'platform=iOS Simulator,name=iPhone 14 Pro'
590 changes: 329 additions & 261 deletions EhPanda.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "4cf088c29a20f52be0f2ca54992b492c54e0076b",
"version" : "0.5.3"
"revision" : "0625932976b3ae23949f6b816d13bd97f3b40b7c",
"version" : "0.10.0"
}
},
{
Expand Down Expand Up @@ -59,71 +59,80 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher.git",
"state" : {
"revision" : "32e4acdf6971f58f5ad552389cf2d7d016334eaf",
"version" : "7.2.0"
"revision" : "e8625b80c413457b13ea9be75d07f6e9f5830c19",
"version" : "7.7.0"
}
},
{
"identity" : "r.swift.library",
"identity" : "sfsafesymbols",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mac-cain13/R.swift.Library.git",
"location" : "https://github.com/SFSafeSymbols/SFSafeSymbols.git",
"state" : {
"revision" : "8998cfe77f4fce79ee6dfab0c88a7d551659d8fb",
"version" : "5.4.0"
"revision" : "7cca2d60925876b5953a2cf7341cd80fbeac983c",
"version" : "4.1.1"
}
},
{
"identity" : "sfsafesymbols",
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SFSafeSymbols/SFSafeSymbols.git",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"branch" : "stable",
"revision" : "de65e5545623c32c86da259cb0987c381bc6a9e2"
"revision" : "fc45e7b2cfece9dd80b5a45e6469ffe67fe67984",
"version" : "0.14.1"
}
},
{
"identity" : "swift-case-paths",
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "241301b67d8551c26d8f09bd2c0e52cc49f18007",
"version" : "0.8.0"
"revision" : "f9acfa1a45f4483fe0f2c434a74e6f68f865d12d",
"version" : "0.3.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "48254824bb4248676bf7ce56014ff57b142b77eb",
"version" : "1.0.2"
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
}
},
{
"identity" : "swift-composable-architecture",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-composable-architecture.git",
"state" : {
"revision" : "2828dc44f6e3f81d84bcaba72c1ab1c0121d66f6",
"version" : "0.34.0"
"revision" : "b6559103c7867821b3848afe29afc1a386ae83f1",
"version" : "0.53.2"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "51698ece74ecf31959d3fa81733f0a5363ef1b4e",
"version" : "0.3.0"
"revision" : "505aa98716275fbd045d8f934fee3337c82ffbd3",
"version" : "0.10.3"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "25c9b6789b4b7ada649a3808e6d8de1489082a33",
"version" : "0.5.0"
}
},
{
"identity" : "swift-identified-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-identified-collections",
"state" : {
"revision" : "680bf440178a78a627b1c2c64c0855f6523ad5b9",
"version" : "0.3.2"
"revision" : "f52eee28bdc6065aa2f8424067e6f04c74bda6e6",
"version" : "0.7.1"
}
},
{
Expand All @@ -140,26 +149,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation.git",
"state" : {
"revision" : "2694c03284a368168b3e0b8d7ab52626802d2246",
"version" : "0.1.0"
"revision" : "47dd574b900ba5ba679f56ea00d4d282fc7305a6",
"version" : "0.7.1"
}
},
{
"identity" : "swiftuipager",
"kind" : "remoteSourceControl",
"location" : "https://github.com/fermoya/SwiftUIPager.git",
"state" : {
"revision" : "6e4170ef7cafd04b3d8ab8dc5b0469036b2bcd6a",
"version" : "2.4.0"
"revision" : "4ddc04c801aac143090bb14cf26603a3bf9c74cb",
"version" : "2.5.0"
}
},
{
"identity" : "swiftybeaver",
"kind" : "remoteSourceControl",
"location" : "https://github.com/EhPanda-Team/SwiftyBeaver.git",
"location" : "https://github.com/SwiftyBeaver/SwiftyBeaver.git",
"state" : {
"branch" : "custom",
"revision" : "2e8a65567ca877a7fdf6a63ab53b2c49a927af87"
"revision" : "1080914828ef1c9ca9cd2bad50667b3d847dabff",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -203,8 +212,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "50a70a9d3583fe228ce672e8923010c8df2deddd",
"version" : "0.2.1"
"revision" : "4af50b38daf0037cfbab15514a241224c3f62f98",
"version" : "0.8.5"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion EhPanda.xcodeproj/xcshareddata/xcschemes/EhPanda.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions EhPanda/App/EhPandaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ComposableArchitecture
var body: some Scene {
WindowGroup {
WithViewStore(
appDelegate.store.scope(state: \.appDelegateState.migrationState.databaseState)
appDelegate.store, observe: \.appDelegateState.migrationState.databaseState
) { viewStore in
ZStack {
if viewStore.state == .idle {
Expand All @@ -23,7 +23,7 @@ import ComposableArchitecture
MigrationView(
store: appDelegate.store.scope(
state: \.appDelegateState.migrationState,
action: { AppAction.appDelegate(.migration($0)) }
action: { AppReducer.Action.appDelegate(.migration($0)) }
)
)
.opacity(viewStore.state != .idle ? 1 : 0)
Expand Down
41 changes: 34 additions & 7 deletions EhPanda/App/Tools/Clients/AppDelegateClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import SwiftUI
import ComposableArchitecture

struct AppDelegateClient {
let setOrientation: (UIInterfaceOrientation) -> Effect<Never, Never>
let setOrientationMask: (UIInterfaceOrientationMask) -> Effect<Never, Never>
let setOrientation: (UIInterfaceOrientationMask) -> EffectTask<Never>
let setOrientationMask: (UIInterfaceOrientationMask) -> EffectTask<Never>
}

extension AppDelegateClient {
static let live: Self = .init(
setOrientation: { orientation in
setOrientation: { mask in
.fireAndForget {
UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
DeviceUtil.keyWindow?.windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: mask))
}
},
setOrientationMask: { mask in
Expand All @@ -27,13 +27,40 @@ extension AppDelegateClient {
}
)

func setPortraitOrientation() -> Effect<Never, Never> {
func setPortraitOrientation() -> EffectTask<Never> {
setOrientation(.portrait)
}
func setAllOrientationMask() -> Effect<Never, Never> {
func setAllOrientationMask() -> EffectTask<Never> {
setOrientationMask([.all])
}
func setPortraitOrientationMask() -> Effect<Never, Never> {
func setPortraitOrientationMask() -> EffectTask<Never> {
setOrientationMask([.portrait, .portraitUpsideDown])
}
}

// MARK: API
enum AppDelegateClientKey: DependencyKey {
static let liveValue = AppDelegateClient.live
static let previewValue = AppDelegateClient.noop
static let testValue = AppDelegateClient.unimplemented
}

extension DependencyValues {
var appDelegateClient: AppDelegateClient {
get { self[AppDelegateClientKey.self] }
set { self[AppDelegateClientKey.self] = newValue }
}
}

// MARK: Test
extension AppDelegateClient {
static let noop: Self = .init(
setOrientation: { _ in .none },
setOrientationMask: { _ in .none }
)

static let unimplemented: Self = .init(
setOrientation: XCTestDynamicOverlay.unimplemented("\(Self.self).setOrientation"),
setOrientationMask: XCTestDynamicOverlay.unimplemented("\(Self.self).setOrientationMask")
)
}
32 changes: 19 additions & 13 deletions EhPanda/App/Tools/Clients/AuthorizationClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ComposableArchitecture

struct AuthorizationClient {
let passcodeNotSet: () -> Bool
let localAuthroize: (String) -> Effect<Bool, Never>
let localAuthroize: (String) -> EffectTask<Bool>
}

extension AuthorizationClient {
Expand Down Expand Up @@ -40,23 +40,29 @@ extension AuthorizationClient {
)
}

// MARK: Test
#if DEBUG
import XCTestDynamicOverlay
// MARK: API
enum AuthorizationClientKey: DependencyKey {
static let liveValue = AuthorizationClient.live
static let previewValue = AuthorizationClient.noop
static let testValue = AuthorizationClient.unimplemented
}

extension AuthorizationClient {
static let failing: Self = .init(
passcodeNotSet: {
XCTFail("\(Self.self).passcodeNotSet is unimplemented")
return false
},
localAuthroize: { .failing("\(Self.self).localAuthroize(\($0)) is unimplemented")}
)
extension DependencyValues {
var authorizationClient: AuthorizationClient {
get { self[AuthorizationClientKey.self] }
set { self[AuthorizationClientKey.self] = newValue }
}
}
#endif

// MARK: Test
extension AuthorizationClient {
static let noop: Self = .init(
passcodeNotSet: { false },
localAuthroize: { _ in .none }
)

static let unimplemented: Self = .init(
passcodeNotSet: XCTestDynamicOverlay.unimplemented("\(Self.self).passcodeNotSet"),
localAuthroize: XCTestDynamicOverlay.unimplemented("\(Self.self).localAuthroize")
)
}
Loading

0 comments on commit 75ff164

Please sign in to comment.