Skip to content

Commit 9e75369

Browse files
committed
Current -> environment
1 parent feeea95 commit 9e75369

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

Sources/App/Views/Blog/BlogActions+Index+View.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import Foundation
1616
import Plot
17+
import Dependencies
1718

1819
extension BlogActions {
1920

@@ -108,7 +109,8 @@ extension BlogActions {
108109
}
109110

110111
override func navMenuItems() -> [NavMenuItem] {
111-
if Current.environment() == .production {
112+
@Dependency(\.environment) var environment
113+
if environment.current() == .production {
112114
return [.supporters, .searchLink, .addPackage, .faq]
113115
} else {
114116
return [.supporters, .searchLink, .addPackage, .faq, .portal]

Sources/App/Views/Home/HomeIndex+View.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
import Plot
16+
import Dependencies
1617

1718

1819
enum HomeIndex {
@@ -114,10 +115,11 @@ enum HomeIndex {
114115
}
115116

116117
override func navMenuItems() -> [NavMenuItem] {
117-
if Current.environment() == .production {
118-
[.supporters, .addPackage, .blog, .faq]
118+
@Dependency(\.environment) var environment
119+
if environment.current() == .production {
120+
return [.supporters, .addPackage, .blog, .faq]
119121
} else {
120-
[.supporters, .addPackage, .blog, .faq, .portal]
122+
return [.supporters, .addPackage, .blog, .faq, .portal]
121123
}
122124
}
123125
}

Sources/App/Views/PublicPage.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ class PublicPage {
323323
/// The items to be rendered in the site navigation menu.
324324
/// - Returns: An array of `NavMenuItem` items used in `header`.
325325
func navMenuItems() -> [NavMenuItem] {
326-
if Current.environment() == .production {
326+
@Dependency(\.environment) var environment
327+
if environment.current() == .production {
327328
return [.supporters, .addPackage, .blog, .faq, .search]
328329
} else {
329330
return [.supporters, .addPackage, .blog, .faq, .search, .portal]

Sources/App/Views/Search/SearchShow+View.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
import Plot
16+
import Dependencies
1617

1718

1819
extension SearchShow {
@@ -64,7 +65,8 @@ extension SearchShow {
6465
}
6566

6667
override func navMenuItems() -> [NavMenuItem] {
67-
if Current.environment() == .production {
68+
@Dependency(\.environment) var environment
69+
if environment.current() == .production {
6870
return [.supporters, .addPackage, .blog, .faq]
6971
} else {
7072
return [.supporters, .addPackage, .blog, .faq, .portal]

Sources/App/routes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func routes(_ app: Application) throws {
138138
let auth = app.routes.grouped([app.sessions.middleware, UserSessionAuthenticator()])
139139
let redirect = auth.grouped(AuthenticatedUser.redirectMiddleware(path: SiteURL.login.relativeURL()))
140140

141-
if Current.environment() != .production {
141+
if environment.current() != .production {
142142
do {
143143
redirect.get(SiteURL.portal.pathComponents, use: PortalController.show)
144144
.excludeFromOpenAPI()

0 commit comments

Comments
 (0)