Skip to content

Commit

Permalink
Add "--" picker option for selections when adding tree
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinejr committed Feb 1, 2021
1 parent 52f5de9 commit 8d76da3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Next
- Disabled longpress actions on textfields without caret (paste etc.)

- When adding a tree, add additional "--" field in keyboard picker when you don't want to select a Specie/Supervisor/Site yet.

## 0.2.0
- Added count of trees to upload on the list.
Expand Down
12 changes: 6 additions & 6 deletions Tree Tracker/Screens/Details/AddLocalTreeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ final class AddLocalTreeViewModel: TreeDetailsViewModel {
.init(placeholder: "Species",
text: species?.name,
input: .keyboard(.selection(
self.species.map(\.name),
["--"] + self.species.map(\.name),
initialIndexSelected: self.species.firstIndex { $0.id == species?.id },
indexSelected: { [weak self] selectedSpecies in
species = self?.species[safe: selectedSpecies]
species = self?.species[safe: selectedSpecies - 1]
self?.presentCurrentAssetFields(asset: asset, coordinates: coordinates, species: species, supervisor: supervisor, site: site, notes: notes)
}),
.done()),
Expand All @@ -130,10 +130,10 @@ final class AddLocalTreeViewModel: TreeDetailsViewModel {
.init(placeholder: "Supervisor",
text: supervisor?.name,
input: .keyboard(.selection(
self.supervisors.map(\.name),
["--"] + self.supervisors.map(\.name),
initialIndexSelected: supervisors.firstIndex { $0.id == supervisor?.id },
indexSelected: { [weak self] selectedSupervisor in
supervisor = self?.supervisors[safe: selectedSupervisor]
supervisor = self?.supervisors[safe: selectedSupervisor - 1]
self?.presentCurrentAssetFields(asset: asset, coordinates: coordinates, species: species, supervisor: supervisor, site: site, notes: notes)
}),
.done()),
Expand All @@ -142,10 +142,10 @@ final class AddLocalTreeViewModel: TreeDetailsViewModel {
.init(placeholder: "Site",
text: site?.name,
input: .keyboard(.selection(
self.sites.map(\.name),
["--"] + self.sites.map(\.name),
initialIndexSelected: self.sites.firstIndex { $0.id == site?.id },
indexSelected: { [weak self] selectedSite in
site = self?.sites[safe: selectedSite]
site = self?.sites[safe: selectedSite - 1]
self?.presentCurrentAssetFields(asset: asset, coordinates: coordinates, species: species, supervisor: supervisor, site: site, notes: notes)
}),
.done()),
Expand Down

0 comments on commit 8d76da3

Please sign in to comment.