forked from wordpress-mobile/WordPress-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into task/switch-to-can-blaze
# Conflicts: # Podfile.lock
- Loading branch information
Showing
74 changed files
with
669 additions
and
1,081 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
WordPress/Classes/ViewRelated/Blog/Settings/SettingsCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import SwiftUI | ||
|
||
struct SettingsCell: View { | ||
let title: String | ||
let value: String? | ||
var placeholder: String? | ||
|
||
var body: some View { | ||
HStack { | ||
Text(title) | ||
.layoutPriority(1) | ||
.foregroundColor(.primary) | ||
Spacer() | ||
Text(value ?? (placeholder ?? "")) | ||
.foregroundColor(.secondary) | ||
} | ||
.lineLimit(1) | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
WordPress/Classes/ViewRelated/Blog/Settings/SettingsPicker.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import SwiftUI | ||
|
||
struct SettingsPicker<T: Hashable>: View { | ||
let title: String | ||
@Binding var selection: T | ||
let values: [SettingsPickerValue<T>] | ||
|
||
init(title: String, selection: Binding<T>, values: [SettingsPickerValue<T>]) { | ||
self.title = title | ||
self._selection = selection | ||
self.values = values | ||
} | ||
|
||
var body: some View { | ||
NavigationLink(destination: { | ||
SettingsPickerListView(selection: $selection, values: values) | ||
.navigationTitle(title) | ||
}, label: { | ||
let value = values.first { $0.id == selection } | ||
SettingsCell(title: title, value: value?.title) | ||
}) | ||
} | ||
} | ||
|
||
struct SettingsPickerValue<T: Hashable>: Identifiable { | ||
let title: String | ||
let id: T | ||
var hint: String? | ||
} | ||
|
||
struct SettingsPickerListView<T: Hashable>: View { | ||
@Binding var selection: T | ||
let values: [SettingsPickerValue<T>] | ||
|
||
var body: some View { | ||
List { | ||
Section(content: { | ||
ForEach(values, content: makeRow) | ||
}, footer: { | ||
if let hint = values.first(where: { $0.id == selection })?.hint { | ||
Text(hint) | ||
} | ||
}) | ||
} | ||
.listStyle(.insetGrouped) | ||
} | ||
|
||
private func makeRow(for value: SettingsPickerValue<T>) -> some View { | ||
Button(action: { | ||
guard selection != value.id else { return } | ||
selection = value.id | ||
}) { | ||
HStack { | ||
Text(value.title) | ||
Spacer() | ||
if value.id == selection { | ||
Image(systemName: "checkmark") | ||
.font(.headline) | ||
.foregroundColor(.accentColor) | ||
|
||
} | ||
} | ||
.contentShape(Rectangle()) | ||
} | ||
.buttonStyle(.plain) | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
WordPress/Classes/ViewRelated/Blog/Site Settings/BlogSiteVisibilityHelper.h
This file was deleted.
Oops, something went wrong.
75 changes: 0 additions & 75 deletions
75
WordPress/Classes/ViewRelated/Blog/Site Settings/BlogSiteVisibilityHelper.m
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.