Skip to content

Commit

Permalink
allow legacy job creation form show/hide as a temporary solution until
Browse files Browse the repository at this point in the history
new job creation method kinks are worked out
  • Loading branch information
aapis committed Aug 11, 2023
1 parent 97ae4a8 commit ab81a75
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 33 deletions.
4 changes: 2 additions & 2 deletions DLPrototype.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 134;
CURRENT_PROJECT_VERSION = 135;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down Expand Up @@ -1377,7 +1377,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 134;
CURRENT_PROJECT_VERSION = 135;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down
4 changes: 3 additions & 1 deletion DLPrototype/Views/Settings/Tabs/TodaySettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ struct TodaySettings: View {
@AppStorage("showExperimentalFeatures") private var showExperimentalFeatures: Bool = false
@AppStorage("today.maxCharsPerGroup") public var maxCharsPerGroup: Int = 2000
@AppStorage("today.colourizeExportableGroupedRecord") public var colourizeExportableGroupedRecord: Bool = false

@AppStorage("today.showLegacyForm") public var showLegacyJobForm: Bool = false

@State private var calendars: [CustomPickerItem] = []

@EnvironmentObject public var ce: CoreDataCalendarEvent
Expand Down Expand Up @@ -73,6 +74,7 @@ struct TodaySettings: View {
}
}

Toggle("Show legacy job creation form", isOn: $showLegacyJobForm)
Toggle("Show search on Today", isOn: $showSearch)
Toggle("Include all incomplete tasks in details pane", isOn: $showAllJobsInDetailsPane)

Expand Down
63 changes: 33 additions & 30 deletions DLPrototype/Views/Today/Today.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Today: View {

@AppStorage("showExperimentalFeatures") private var showExperimentalFeatures = false
@AppStorage("autoFixJobs") public var autoFixJobs: Bool = false
@AppStorage("today.showLegacyForm") public var showLegacyJobForm: Bool = false

@Environment(\.managedObjectContext) var moc
@EnvironmentObject public var nav: Navigation
Expand Down Expand Up @@ -47,36 +48,38 @@ struct Today: View {
var editor: some View {
VStack(alignment: .leading) {
// TODO: remove (currently testing usability w/o these fields)
// HStack {
// JobPickerUsing(onChange: {_,_ in }, supportsDynamicPicker: true, jobId: $jobId)
// .onReceive(Just(jobId)) { input in
// let filtered = input.filter { "0123456789".contains($0) }
// if filtered != input {
// jobId = filtered
// }
// }
//
// Text("Or").font(Theme.font)
//
// // TODO: background colours stack here, fix that
// FancyTextField(placeholder: "Task URL", lineLimit: 1, onSubmit: {}, text: $taskUrl)
// .onChange(of: taskUrl) { url in
// if !url.isEmpty {
// if let newUrl = URL(string: taskUrl) {
// jobId = UrlHelper.parts(of: newUrl).jid_string
// }
//
// if url.starts(with: "https:") {
// isUrl = true
// } else {
// isUrl = false
// }
// } else {
// isUrl = true
// }
// }
// .background(isUrl ? Color.clear : Theme.rowStatusRed)
// }
if showLegacyJobForm {
HStack {
JobPickerUsing(onChange: {_,_ in }, supportsDynamicPicker: true, jobId: $jobId)
.onReceive(Just(jobId)) { input in
let filtered = input.filter { "0123456789".contains($0) }
if filtered != input {
jobId = filtered
}
}

Text("Or").font(Theme.font)

// TODO: background colours stack here, fix that
FancyTextField(placeholder: "Task URL", lineLimit: 1, onSubmit: {}, text: $taskUrl)
.onChange(of: taskUrl) { url in
if !url.isEmpty {
if let newUrl = URL(string: taskUrl) {
jobId = UrlHelper.parts(of: newUrl).jid_string
}

if url.starts(with: "https:") {
isUrl = true
} else {
isUrl = false
}
} else {
isUrl = true
}
}
.background(isUrl ? Color.clear : Theme.rowStatusRed)
}
}

VStack(alignment: .leading) {
ZStack(alignment: .topLeading) {
Expand Down

0 comments on commit ab81a75

Please sign in to comment.