Skip to content

Commit

Permalink
Merge branch 'asiliuk:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Archichil authored Jan 10, 2025
2 parents 3cc69c5 + 0ef2b52 commit b4f4687
Show file tree
Hide file tree
Showing 52 changed files with 681 additions and 674 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb",
"version" : "1.0.0"
"revision" : "9fa31f4403da54855f1e2aeaeff478f4f0e40b13",
"version" : "1.0.2"
}
},
{
Expand Down Expand Up @@ -68,17 +68,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "b871e5ed11a23e52c2896a92ce2c829982ff8619",
"version" : "1.4.2"
"revision" : "642e6aab8e03e5f992d9c83e38c5be98cfad5078",
"version" : "1.5.5"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "a8421d68068d8f45fbceb418fbf22c5dad4afd33",
"version" : "1.0.2"
"revision" : "b9b24b69e2adda099a1fa381cda1eeec272d5b53",
"version" : "1.0.5"
}
},
{
Expand All @@ -95,8 +95,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-composable-architecture.git",
"state" : {
"revision" : "1f952d8c69ace5e53bb69a218e6ed00e03a4695c",
"version" : "1.11.2"
"revision" : "8013f1a72af8ccb2b1735d7aed831a8dc07c6fd0",
"version" : "1.15.0"
}
},
{
Expand All @@ -113,17 +113,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "f01efb26f3a192a0e88dcdb7c3c391ec2fc25d9c",
"version" : "1.3.0"
"revision" : "82645ec760917961cfa08c9c0c7104a57a0fa4b1",
"version" : "1.3.3"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies.git",
"state" : {
"revision" : "00bc30ca03f98881329fab7f1bebef8eba472596",
"version" : "1.3.1"
"revision" : "0fc0255e780bf742abeef29dec80924f5f0ae7b9",
"version" : "1.4.1"
}
},
{
Expand All @@ -135,6 +135,15 @@
"version" : "1.1.0"
}
},
{
"identity" : "swift-navigation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-navigation",
"state" : {
"revision" : "d1bdbd8a5d1d1dfd2e4bb1f5e2f6facb631404d4",
"version" : "2.2.1"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
Expand All @@ -158,14 +167,14 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-perception",
"state" : {
"revision" : "d3ab98dc2887d1cc3bed676f6fa354da4cb22b3c",
"version" : "1.2.4"
"revision" : "bc67aa8e461351c97282c2419153757a446ae1c9",
"version" : "1.3.5"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
"version" : "510.0.2"
Expand All @@ -189,15 +198,6 @@
"version" : "0.12.0"
}
},
{
"identity" : "swiftui-navigation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"state" : {
"revision" : "b7c9a79f6f6b1fefb87d3e5a83a9c2fe7cdc9720",
"version" : "1.5.0"
}
},
{
"identity" : "whatsnewkit",
"kind" : "remoteSourceControl",
Expand All @@ -212,8 +212,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "6f30bdba373bbd7fbfe241dddd732651f2fbd1e2",
"version" : "1.1.2"
"revision" : "27d767d643fa2cf083d0a73d74fa84cacb53e85c",
"version" : "1.4.1"
}
}
],
Expand Down
29 changes: 18 additions & 11 deletions BsuirScheduleApp/Application/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ struct App: SwiftUI.App {
final class AppDelegate: NSObject, UIApplicationDelegate {
private(set) lazy var store = Store(initialState: .init()) {
AppFeature()
.dependency(\.imageCache, .default)
.dependency(\.defaultAppStorage, .asiliukShared)
#if DEBUG
.transformDependency(\.date.now) { [isTestingEnabled] now in
if isTestingEnabled { now = Date(timeIntervalSince1970: 1699830000) }
}
#endif
} withDependencies: { [isTestingEnabled] in
$0.imageCache = .default
$0.defaultAppStorage = .asiliukShared
#if DEBUG
if isTestingEnabled {
$0.date.now = Date(timeIntervalSince1970: 1699830000)
}
#endif
}

override init() {
Expand All @@ -39,11 +40,17 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
if isTestingEnabled { disableAnimations() }
#endif

@Dependency(\.productsService) var productsService
productsService.load()
// Make sure services are loaded with proper default storage
// because products service updates premium flag in storage
withDependencies {
$0.defaultAppStorage = .asiliukShared
} operation: {
@Dependency(\.productsService) var productsService
productsService.load()

@Dependency(\.cloudSyncService) var cloudSyncService
cloudSyncService.load()
@Dependency(\.cloudSyncService) var cloudSyncService
cloudSyncService.load()
}
}
}

Expand Down
29 changes: 29 additions & 0 deletions BsuirScheduleApp/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -5335,6 +5335,35 @@
}
}
},
"screen.settings.select_something.title" : {
"extractionState" : "manual",
"localizations" : {
"be" : {
"stringUnit" : {
"state" : "translated",
"value" : "Выберыце што-небудзь"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Select something"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Выберите что-нибудь"
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"value" : "Виберіть щось"
}
}
}
},
"screen.settings.whatsNew.3_0.appIcons.subtitle" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ScheduleCoreTests"
BuildableName = "ScheduleCoreTests"
BlueprintName = "ScheduleCoreTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 1 addition & 1 deletion Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "7.9.0"),
.package(url: "https://github.com/pointfreeco/swift-composable-architecture.git", from: "1.7.0"),
.package(url: "https://github.com/pointfreeco/swift-composable-architecture.git", from: "1.15.0"),
.package(url: "https://github.com/pointfreeco/swift-url-routing.git", from: "0.6.0"),
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-algorithms.git", from: "1.1.0"),
Expand Down
36 changes: 12 additions & 24 deletions Modules/Sources/AppFeature/AppFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ public struct AppFeature {

var selection: CurrentSelection = .groups

var premiumClub = PremiumClubFeature.State(isModal: true)
var pinnedTab: PinnedTabFeature.State
var pinnedTab = PinnedTabFeature.State()
var groups = GroupsFeature.State()
var lecturers = LecturersFeature.State()
var settings = SettingsFeature.State()

public init() {
self._pinnedTab = .init(isPremiumLocked: !_premiumClub.hasPremium)
@Dependency(\.favorites) var favorites
@Dependency(\.pinnedScheduleService) var pinnedScheduleService
self.handleInitialSelection(favorites: favorites, pinnedScheduleService: pinnedScheduleService)
Expand All @@ -49,7 +47,6 @@ public struct AppFeature {
case setPinnedSchedule(ScheduleSource?)
case showSettingsButtonTapped

case premiumClub(PremiumClubFeature.Action)
case pinnedTab(PinnedTabFeature.Action)
case groups(GroupsFeature.Action)
case lecturers(LecturersFeature.Action)
Expand All @@ -66,16 +63,13 @@ public struct AppFeature {
Reduce { state, action in
switch action {
case .task:
return .merge(
.send(.premiumClub(.task)),
.run { send in
for await pinnedSchedule in pinnedScheduleService.schedule().values {
// Give time for schedule feature to handle unpin before removing tab view
await Task.yield()
await send(.setPinnedSchedule(pinnedSchedule))
}
return .run { send in
for await pinnedSchedule in pinnedScheduleService.schedule().values {
// Give time for schedule feature to handle unpin before removing tab view
await Task.yield()
await send(.setPinnedSchedule(pinnedSchedule))
}
)
}

case .closePremiumClubButtonTapped:
state.destination = nil
Expand Down Expand Up @@ -106,10 +100,6 @@ public struct AppFeature {
}
return .none

case let .premiumClub(._setIsPremium(value)):
state.pinnedTab.isPremiumLocked = !value
return .none

case .pinnedTab(.delegate(let action)):
switch action {
case .showPremiumClubPinned:
Expand Down Expand Up @@ -138,16 +128,12 @@ public struct AppFeature {
return .none
}

case .groups, .lecturers, .settings, .pinnedTab, .premiumClub, .destination:
case .groups, .lecturers, .settings, .pinnedTab, .destination:
return .none
}
}
.ifLet(\.$destination, action: \.destination)

Scope(state: \.premiumClub, action: \.premiumClub) {
PremiumClubFeature()
}

Scope(state: \.pinnedTab, action: \.pinnedTab) {
PinnedTabFeature()
}
Expand All @@ -166,7 +152,9 @@ public struct AppFeature {
}

private func showPremiumClub(state: inout State, source: PremiumClubFeature.Source?) {
state.premiumClub.source = source
state.destination = .premiumClub(state.premiumClub)
state.destination = .premiumClub(PremiumClubFeature.State(
isModal: true,
source: source
))
}
}
7 changes: 3 additions & 4 deletions Modules/Sources/AppFeature/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ private struct SettingsFeatureTab: View {

var body: some View {
WithPerceptionTracking {
NavigationStack(path: $store.path) {
SettingsFeatureView(store: store)
.navigationBarTitleDisplayMode(.inline)
}
SettingsFeatureView(
store: store
)
.tabItem {
Label("view.tabBar.settings.title", systemImage: "gearshape")
}
Expand Down
3 changes: 2 additions & 1 deletion Modules/Sources/AppFeature/Pinned/PinnedTabFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import EntityScheduleFeature
import ScheduleCore
import ComposableArchitecture
import ScheduleFeature
import BsuirCore

@Reducer
public struct PinnedTabFeature {
@ObservableState
public struct State: Equatable {
var isPremiumLocked: Bool
@SharedReader(.isPremiumUser) var isPremiumUser
var pinnedSchedule: PinnedScheduleFeature.State?
}

Expand Down
Loading

0 comments on commit b4f4687

Please sign in to comment.