Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #532 from razeware/development
Browse files Browse the repository at this point in the history
v1.0.6: 🐼monium
  • Loading branch information
sammyd authored Nov 11, 2020
2 parents c5d904f + 2bc39d4 commit 9a8f847
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 40 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ on:

jobs:
SwiftLint:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: GitHub Action for SwiftLint
uses: norio-nomura/[email protected]
with:
args: --config Emitron/.swiftlint.yml
- name: Install Swiftlint
run: brew install swiftlint

- name: Run Swiftlint
run: swiftlint --config Emitron/.swiftlint.yml
6 changes: 3 additions & 3 deletions Emitron/Emitron.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2394,7 +2394,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
PRODUCT_BUNDLE_IDENTIFIER = "com.razeware.emitron.ios$(BUNDLE_ID_SUFFIX)";
PRODUCT_MODULE_NAME = Emitron;
PRODUCT_NAME = raywenderlich;
Expand Down Expand Up @@ -2599,7 +2599,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
PRODUCT_BUNDLE_IDENTIFIER = "com.razeware.emitron.ios$(BUNDLE_ID_SUFFIX)";
PRODUCT_MODULE_NAME = Emitron;
PRODUCT_NAME = raywenderlich;
Expand All @@ -2625,7 +2625,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
PRODUCT_BUNDLE_IDENTIFIER = "com.razeware.emitron.ios$(BUNDLE_ID_SUFFIX)";
PRODUCT_MODULE_NAME = Emitron;
PRODUCT_NAME = raywenderlich;
Expand Down
6 changes: 3 additions & 3 deletions Emitron/Emitron/Assets.xcassets/Colours/Text/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 1 addition & 1 deletion Emitron/Emitron/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension String {
static let library = "Library"
static let loading = "Loading…"
static let myTutorials = "My Tutorials"
static let newest = "Newest"
static let newest = "Newest"
static let popularity = "Popularity"
static let resetFilters = "Reset Filters"
static let search = "Search…"
Expand Down
2 changes: 1 addition & 1 deletion Emitron/Emitron/Downloads/DownloadService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ extension DownloadService {
extension DownloadService {
private func configureWifiObservation() {
// Track the network status
networkMonitor.pathUpdateHandler = { [weak self] path in
networkMonitor.pathUpdateHandler = { [weak self] _ in
self?.checkQueueStatus()
}
networkMonitor.start(queue: DispatchQueue.global(qos: .utility))
Expand Down
4 changes: 2 additions & 2 deletions Emitron/Emitron/Models/ContentSubscriptionPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ enum ContentSubscriptionPlan: Int, Codable {
var displayString: String {
switch self {
case .beginner:
return "Beginner"
return "Beginner Subscription"
case .professional:
return "Professional"
return "Professional Subscription"
}
}

Expand Down
11 changes: 11 additions & 0 deletions Emitron/Emitron/Models/SettingsOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,14 @@ enum SettingsOption: Int, Identifiable, CaseIterable {
}
}
}

// MARK: - Option Selection
extension SettingsOption {
static func getOptions(for canDownload: Bool) -> [SettingsOption] {
if canDownload {
return SettingsOption.allCases
} else {
return [.playbackSpeed, .closedCaptionOn]
}
}
}
2 changes: 1 addition & 1 deletion Emitron/Emitron/Networking/JSONAPI/JSONAPIDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class JSONAPIDocument {
// MARK: - Properties
var meta: [String: Any] = [:]
var included: [JSONAPIResource] = []
var data: [JSONAPIResource] = []
var data: [JSONAPIResource] = []
var errors: [JSONAPIError] = []
var links: [String: URL] = [:]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import SwiftyJSON
public class JSONAPIRelationship {
// MARK: - Properties
var meta: [String: Any] = [:]
var data: [JSONAPIResource] = []
var data: [JSONAPIResource] = []
var links: [String: URL] = [:]
var type: String = ""

Expand Down
2 changes: 1 addition & 1 deletion Emitron/Emitron/Networking/Requests/Parameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ enum Param {

static func sort(for value: ParameterSortValue,
descending: Bool) -> Parameter {
let key = "sort"
let key = "sort"
let value = "\(descending ? "-" : "")\(value.rawValue)"

return Parameter(key: key, value: value, displayName: "Sort", sortOrdinal: 0)
Expand Down
2 changes: 1 addition & 1 deletion Emitron/Emitron/Sessions/SessionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class SessionController: NSObject, UserModelController, ObservablePrePostFactoOb
// Update the user
self.user = user.with(permissions: permissions)
// Ensure guardpost is aware, and hence the keychain is updated
self.guardpost.updateUser(with: user)
self.guardpost.updateUser(with: self.user)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Emitron/Emitron/UI/App Root/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct LoginView: View {

PagerView(pageCount: 2, showIndicator: true) {
VStack {
Spacer()
Image("welcomeArtwork1")
.resizable()
.aspectRatio(contentMode: .fit)
Expand All @@ -57,6 +58,7 @@ struct LoginView: View {
.font(.uiLabel)
.foregroundColor(.contentText)
.multilineTextAlignment(.center)
Spacer()
}
.background(Color.backgroundColor)

Expand Down
17 changes: 12 additions & 5 deletions Emitron/Emitron/UI/Library/Filtering/FiltersHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ struct FiltersHeaderView: View {
isExpanded.toggle()
}) {
HStack {
Text(filterGroup.type.name)
Text("\(filterGroup.type.name)\(filterCount)")
.foregroundColor(.titleText)
.font(.uiLabelBold)

Spacer()
Text(isExpanded ? "Hide (\(numOfOnFilters))" : "Show (\(numOfOnFilters))")

Image(systemName: isExpanded ? "chevron.up" : "chevron.down")
.foregroundColor(.contentText)
.font(.uiLabelBold)
}
Expand All @@ -72,11 +72,18 @@ struct FiltersHeaderView: View {
}
}
}


private var filterCount: String {
if numOfOnFilters > 0 {
return "\(numOfOnFilters)"
}
return ""
}

private var numOfOnFilters: Int {
filterGroup.filters.filter(\.isOn).count
}

private var expandedView: some View {
VStack(alignment: .leading, spacing: 8) {
ForEach(Array(filterGroup.filters), id: \.self) { filter in
Expand Down
17 changes: 11 additions & 6 deletions Emitron/Emitron/UI/Library/LibraryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct LibraryView: View {
.background(Color.backgroundColor.edgesIgnoringSafeArea(.all))
}
}

private var contentControlsSection: some View {
VStack {
searchAndFilterControls
Expand Down Expand Up @@ -104,12 +104,17 @@ struct LibraryView: View {
HStack {
Image("sort")
.foregroundColor(.textButtonText)

Text(filters.sortFilter.name)
.font(.uiLabelBold)
.foregroundColor(.textButtonText)
if [.loading, .loadingAdditional].contains(libraryRepository.state) {
Text(filters.sortFilter.name)
.font(.uiLabel)
.foregroundColor(Color.gray)
} else {
Text(filters.sortFilter.name)
.font(.uiLabelBold)
.foregroundColor(.textButtonText)
}
}
}
}.disabled([.loading, .loadingAdditional].contains(libraryRepository.state))
}
}

Expand Down
8 changes: 5 additions & 3 deletions Emitron/Emitron/UI/Settings/SettingsList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ import SwiftUI

struct SettingsList {
@ObservedObject private var settingsManager: SettingsManager
private var canDownload: Bool
}

// MARK: - View
extension SettingsList: View {
var body: some View {
VStack(spacing: 0) {
ForEach(SettingsOption.allCases) { self[$0] }
ForEach(SettingsOption.getOptions(for: canDownload)) { self[$0] }
}
}
}
Expand All @@ -48,15 +49,16 @@ struct SettingsList_Previews: PreviewProvider {
}

static var list: some View {
SettingsList( settingsManager: .init(initialValue: .current) )
SettingsList(settingsManager: .init(initialValue: .current), canDownload: true)
.background(Color.backgroundColor)
}
}

// MARK: - internal
extension SettingsList {
init(settingsManager: ObservedObject<SettingsManager>) {
init(settingsManager: ObservedObject<SettingsManager>, canDownload: Bool) {
_settingsManager = settingsManager
self.canDownload = canDownload
}
}

Expand Down
5 changes: 4 additions & 1 deletion Emitron/Emitron/UI/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ struct SettingsView: View {
var body: some View {
NavigationView {
VStack {
SettingsList(settingsManager: _settingsManager)
SettingsList(
settingsManager: _settingsManager,
canDownload: sessionController.user?.canDownload ?? false
)
.navigationBarTitle(String.settings)
.navigationBarItems(trailing: dismissButton)
.padding([.horizontal], 20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private extension ContentListView {
cardsView
loadMoreView
// Hack to make sure there's some spacing at the bottom of the list
Color.clear.frame(height: 0)
Color.backgroundColor
}
}

Expand Down
4 changes: 3 additions & 1 deletion Emitron/Emitron/UI/Shared/Tags/TagView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import SwiftUI

struct TagView: View {
private static let defaultIconHeight: CGFloat = 12.0

private struct SizeKey: PreferenceKey {
static func reduce(value: inout CGSize?, nextValue: () -> CGSize?) {
value = value ?? nextValue()
Expand All @@ -49,7 +51,7 @@ struct TagView: View {
.resizable()
.aspectRatio(contentMode: .fit)
.foregroundColor(textColor)
.frame(height: height)
.frame(height: Self.defaultIconHeight)

Text(text.uppercased())
.foregroundColor(textColor)
Expand Down
8 changes: 4 additions & 4 deletions Emitron/emitronScreenshots/SnapshotHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ open class Snapshot: NSObject {

private extension XCUIElementAttributes {
var isNetworkLoadingIndicator: Bool {
if hasWhiteListedIdentifier {
if hasAllowedIdentifier {
return false
}

Expand All @@ -248,10 +248,10 @@ private extension XCUIElementAttributes {
return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize
}

var hasWhiteListedIdentifier: Bool {
let whiteListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"]
var hasAllowedIdentifier: Bool {
let allowedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"]

return whiteListedIdentifiers.contains(identifier)
return allowedIdentifiers.contains(identifier)
}

func isStatusBar(_ deviceWidth: CGFloat) -> Bool {
Expand Down

0 comments on commit 9a8f847

Please sign in to comment.