diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f75e2c1..f370fcf2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ -# Setting up a Python environment and pre-commit. +# Setting up a Python environment and prek (pre-commit hooks). + +# >>> python3 -m venv .venv # Unix or MacOS: -# >>> python3 -m venv venv -# >>> source venv/bin/activate +# >>> source .venv/bin/activate # Windows: -# >>> python -m venv venv -# >>> venv\Scripts\activate.bat +# >>> .venv\Scripts\activate.bat # >>> pip install --upgrade pip -# >>> pip install pre-commit -# >>> pre-commit install -# >>> pre-commit run --all-files +# >>> pip install prek +# >>> prek install +# >>> prek run --all-files repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -22,7 +22,7 @@ repos: - id: check-yaml - repo: https://github.com/realm/SwiftLint - rev: 0.63.1 + rev: 0.63.2 hooks: - id: swiftlint name: run swiftlint linting check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec572ee1..5942d454 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,5 @@ + + # Contributing to Scribe-iOS Thank you for your interest in contributing! @@ -8,17 +10,16 @@ Following these guidelines helps to communicate that you respect the time of the If you have questions or would like to communicate with the team, please [join us in our public Matrix chat rooms](https://matrix.to/#/#scribe_community:matrix.org). We'd be happy to hear from you! - - -# **Contents** +## Contents -- [First steps as a contributor](#first-steps) +- [First steps as a contributor](#first-steps-as-a-contributor) +- [Mentorship and Growth](#mentorship-and-growth) - [Learning the tech stack](#learning-the-tech) -- [Development environment](#dev-env) +- [Development environment](#development-environment) - [Note on debugging](#note-on-debugging) -- [Build Schemes Selection](#build-scheme) +- [Build Schemes Selection](#build-scheme-selection) - [Testing](#testing) -- [Issues and projects](#issues-projects) +- [Issues and projects](#issues-and-projects) - [Bug reports](#bug-reports) - [Feature requests](#feature-requests) - [Pull requests](#pull-requests) @@ -27,9 +28,7 @@ If you have questions or would like to communicate with the team, please [join u - [Documentation](#documentation) - [Design](#design) - - -## First steps as a contributor [`⇧`](#contents) +## First steps as a contributor Thank you for your interest in contributing to Scribe-iOS! We look forward to welcoming you to the community and working with you to build an tools for language learners to communicate effectively :) The following are some suggested steps for people interested in joining our community: @@ -46,9 +45,25 @@ Thank you for your interest in contributing to Scribe-iOS! We look forward to we > [!NOTE] > Those new to Swift or wanting to work on their Swift skills are more than welcome to contribute! The team would be happy to help you on your development journey :) - +Back to top. + +## Mentorship and Growth + +Onboarding and mentoring new members is vital to a healthy open-source community. + +We need contributors who are onboarded to gain new skills and take on greater roles by triaging issues, reviewing contributions, and maintaining the project. We also need them to help new contributors to grow as well. Please let us know if you have goals to develop as an open-source contributor and we'll work with you to achieve them. -## Learning the tech stack [`⇧`](#contents) +We also have expectations about the behavior of those who want to grow with us. Mentorship is earned, not given. + +To be blunt, those who are mainly sending AI generated contributions are not demonstrating an interest in growing their skills and are not helping to develop the project. This is not to say that all uses of AI for contributions are bad, but **AI should be a tool, not the contributor itself**. + +Continued constructive contributions, new open issues, and clear communication helps the project. We would be happy to help community members who can make these contributions to expand their skills and take on further responsibilities. + +If you like the sound of this, then we look forward to working with you! + +Back to top. + +## Learning the tech stack Scribe is very open to contributions from people in the early stages of their coding journey! The following is a select list of documentation pages to help you understand the technologies we use. @@ -74,9 +89,9 @@ Scribe is very open to contributions from people in the early stages of their co

- +Back to top. -# Development environment [`⇧`](#contents) +## Development environment Scribe-iOS is developed using the [Swift](https://developer.apple.com/swift/) coding language. Those new to Swift or wanting to develop their skills are more than welcome to contribute! The first step on your Swift journey would be to read through the [Swift documentation](https://docs.swift.org/swift-book/index.html). The general steps to setting up a development environment are: @@ -117,12 +132,13 @@ git remote add upstream https://github.com/scribe-org/Scribe-iOS.git - `origin` (forked repository) - `upstream` (Scribe-iOS repository) -3. (Optional) Install [pre-commit](https://pre-commit.com/) and its hooks to check for and correct common errors in commits: +3. (Optional) Install [prek](https://prek.j178.dev/) pre-commit hooks to check for and correct common errors in commits: ```bash -pip install pre-commit -pre-commit install -# pre-commit run --all-files +pip install --upgrade pip # make sure that pip is at the latest version +pip install prek +prek install +# prek --all-files ``` 4. Open the Scribe-iOS directory in Xcode @@ -144,7 +160,7 @@ pre-commit install > [!NOTE] > Feel free to contact the team in the [iOS room on Matrix](https://matrix.to/#/#ScribeiOS:matrix.org) if you're having problems getting your environment setup! - +Back to top. ### Note on debugging @@ -156,9 +172,9 @@ The Xcode debugger often doesn't work as expected for Scribe as the keyboards th - When you get a window telling you to "choose an app to run", don't choose Scribe as you might expect, but instead scroll down and select Xcode Previews - Occasionally you'll be met with just a black screen on startup, in which case you can press Home (or ⇧-⌘-H) and then go directly to Scribe or an app for keyboard testing - +Back to top. -## Build Schemes Selection [`⇧`](#contents) +## Build Schemes Selection The project includes two build schemes, each corresponding to a different application.There are other targets corresponding to the individual keyboards which are shipped within the `Scribe` target. @@ -167,13 +183,13 @@ Build schemes can be selected from the top bar next to device selection. 1. Scribe → Scribe Language Keyboards app (IME) 2. Conjugate → Scribe Conjugate verb conjugation app - +Back to top. -## Testing [`⇧`](#contents) +## Testing Writing unit tests is essential to guarantee the dependability and sustainability of the Scribe-iOS codebase. Unit tests confirm that individual components of the application work as intended by detecting errors at an early stage, thus making the debugging process easier and boosting assurance for upcoming modifications. An unchanging testing method helps new team members grasp project norms and anticipated actions. -In addition to the [pre-commit](https://pre-commit.com/) hooks that are set up during the [development environment section](#dev-env), Scribe-iOS includes a testing suite that should be ran before all pull requests and subsequent commits. +In addition to the [prek](https://prek.j178.dev/) pre-commit hooks that are set up during the [development environment section](#development-environment), Scribe-iOS includes a testing suite that should be ran before all pull requests and subsequent commits. Please run the following in the project root: @@ -218,9 +234,9 @@ python3 Tests/process_coverage_report.py code_coverage.json > [!NOTE] > See [Tests/process_coverage_report.py](./Tests/process_coverage_report.py) for details. - +Back to top. -# Issues and projects [`⇧`](#contents) +## Issues and projects The [issue tracker for Scribe-iOS](https://github.com/scribe-org/Scribe-iOS/issues) is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests). Scribe also organizes related issues into [projects](https://github.com/scribe-org/Scribe-iOS/projects). @@ -229,9 +245,9 @@ The [issue tracker for Scribe-iOS](https://github.com/scribe-org/Scribe-iOS/issu Be sure to check the [`-next release-`](https://github.com/scribe-org/Scribe-iOS/labels/-next%20release-) and [`-priority-`](https://github.com/scribe-org/Scribe-iOS/labels/-priority-) labels in the [issues](https://github.com/scribe-org/Scribe-iOS/issues) for those that are most important, as well as those marked [`good first issue`](https://github.com/scribe-org/Scribe-iOS/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) that are tailored for first-time contributors. - +Back to top. -# Bug reports [`⇧`](#contents) +## Bug reports A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you! @@ -255,15 +271,15 @@ To make the above steps easier, the Scribe team asks that contributors report bu Again, thank you for your time in reporting issues! - +Back to top. -# Feature requests [`⇧`](#contents) +## Feature requests Feature requests are more than welcome! Please take a moment to find out whether your idea fits with the scope and aims of the project. When making a suggestion, provide as much detail and context as possible, and further make clear the degree to which you would like to contribute in its development. Feature requests are marked with the [`Feature`](https://github.com/scribe-org/Scribe-iOS/issues?q=is%3Aissue%20state%3Aopen%20type%3AFeature) type, and can be made using the [feature request](https://github.com/scribe-org/Scribe-iOS/issues/new?assignees=&labels=feature&template=feature_request.yml) template. - +Back to top. -# Pull requests [`⇧`](#contents) +## Pull requests Good pull requests - patches, improvements and new features - are the foundation of our community making Scribe-iOS. They should remain focused in scope and avoid containing unrelated commits. Note that all contributions to this project will be made under [the specified license](https://github.com/scribe-org/Scribe-iOS/blob/main/LICENSE.txt) and should follow the coding indentation and style standards ([contact us](https://matrix.to/#/#scribe_community:matrix.org) if unsure). @@ -308,18 +324,18 @@ When making a contribution, adhering to the [GitHub flow](https://guides.github. Thank you in advance for your contributions! - +Back to top. -# Data edits [`⇧`](#contents) +## Data edits > [!NOTE]\ > Please see the [Wikidata and Scribe Guide](https://github.com/scribe-org/Organization/blob/main/WIKIDATAGUIDE.md) for an overview of [Wikidata](https://www.wikidata.org/) and how Scribe uses it. Scribe does not accept direct edits to the grammar files as they are sourced from [Wikidata](https://www.wikidata.org/). Edits can be discussed and the [Scribe-Data](https://github.com/scribe-org/Scribe-Data) queries will be changed. If there is a problem with one of the files, then the fix should be made on [Wikidata](https://www.wikidata.org/) and not on Scribe. Feel free to let us know that edits have been made by [opening a data issue](https://github.com/scribe-org/Conjugate-iOS/issues/new?assignees=&labels=data&template=data_wikidata.yml) or contacting us in the [issues for Scribe-Data](https://github.com/scribe-org/Scribe-Data/issues) and we'll be happy to integrate them! - +Back to top. -# Localization [`⇧`](#contents) +## Localization Visit Weblate project @@ -335,15 +351,15 @@ Please run the [update_i18n_keys.sh](https://github.com/scribe-org/Scribe-iOS/bl Translation status - +Back to top. -# Documentation [`⇧`](#contents) +## Documentation Documentation is an invaluable way to contribute to coding projects as it allows others to more easily understand the project structure and contribute. Issues related to documentation are marked with the [`documentation`](https://github.com/scribe-org/Scribe-iOS/labels/documentation) label. - +Back to top. -# Design [`⇧`](#contents) +## Design Public Figma Designs @@ -352,3 +368,5 @@ Documentation is an invaluable way to contribute to coding projects as it allows Designs for Scribe are done in the [public design file in Figma](https://www.figma.com/file/c8945w2iyoPYVhsqW7vRn6/scribe_public_designs?node-id=405%3A464). Those interested in helping with Scribe's design are also welcome to share their ideas using the [design improvement](https://github.com/scribe-org/Scribe-iOS/issues/new?assignees=&labels=design&template=design_improvement.yml) template that makes an issue marked with the [`design`](https://github.com/scribe-org/Scribe-iOS/issues?q=is%3Aopen+is%3Aissue+label%3Adesign) label. All branding elements such as logos, icons, colors and fonts should follow those that are set out in [scribe-org/Organization](https://github.com/scribe-org/Organization). As the project is fully open source, these elements are also open for discussion. Efforts in making Scribe products professional with a distinct and cohesive identity are much appreciated! + +Back to top. diff --git a/Keyboards/KeyboardsBase/DynamicConjugationViewController.swift b/Keyboards/KeyboardsBase/DynamicConjugationViewController.swift index d801f9b6..a3f7cf66 100644 --- a/Keyboards/KeyboardsBase/DynamicConjugationViewController.swift +++ b/Keyboards/KeyboardsBase/DynamicConjugationViewController.swift @@ -6,12 +6,14 @@ import UIKit class DynamicConjugationViewController: UIViewController { + var isInfoState: Bool = false // MARK: UI Components private var leftArrowButton: UIButton! private var rightArrowButton: UIButton! private var buttonContainerView: UIView! + private var pageControl: UIPageControl? // MARK: Navigation Data @@ -55,6 +57,7 @@ class DynamicConjugationViewController: UIViewController { super.viewDidLoad() view.backgroundColor = keyboardBgColor setupUI() + setupPageControl() } override func viewDidLayoutSubviews() { @@ -118,6 +121,26 @@ class DynamicConjugationViewController: UIViewController { ]) } + /// Builds page control for linear navigation mode. + private func setupPageControl() { + guard isInfoState, let cases = linearCases else { return } + + let pc = UIPageControl() + pc.numberOfPages = cases.count + pc.currentPage = currentCaseIndex + pc.pageIndicatorTintColor = keyCharColor.withAlphaComponent(0.3) + pc.currentPageIndicatorTintColor = keyCharColor + pc.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(pc) + + NSLayoutConstraint.activate([ + pc.centerXAnchor.constraint(equalTo: view.centerXAnchor), + pc.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -12) + ]) + + self.pageControl = pc + } + // MARK: Display /// Displays the current navigation level. @@ -133,10 +156,7 @@ class DynamicConjugationViewController: UIViewController { commandBar?.isShowingInfoButton = false let options = currentLevel.options - guard !options.isEmpty else { - commandBar?.text = commandPromptSpacing + "No options available" - return - } + guard !options.isEmpty else { return } // Create button grid. let count = options.count @@ -182,6 +202,9 @@ class DynamicConjugationViewController: UIViewController { button.layer.shadowRadius = 0 button.tag = index button.addTarget(self, action: #selector(optionButtonTapped(_:)), for: .touchUpInside) + if isInfoState { + button.contentEdgeInsets = UIEdgeInsets(top: 8, left: 12, bottom: 8, right: 12) + } // Determine the display value. let displayValue: String? @@ -233,7 +256,7 @@ class DynamicConjugationViewController: UIViewController { case .finalValue(let value): // Skip empty values. - guard !value.isEmpty else { return } + guard !value.isEmpty, !isInfoState else { return } // Insert text and close. proxy.insertText(value + " ") @@ -262,6 +285,8 @@ class DynamicConjugationViewController: UIViewController { displayCurrentLevel() } } + + pageControl?.currentPage = currentCaseIndex } /// Handles right arrow button tap. @@ -279,6 +304,8 @@ class DynamicConjugationViewController: UIViewController { } } // Tree mode: right arrow does nothing. + + pageControl?.currentPage = currentCaseIndex } /// Updates the enabled state of arrow buttons. diff --git a/Keyboards/KeyboardsBase/InterfaceVariables.swift b/Keyboards/KeyboardsBase/InterfaceVariables.swift index a5a509f3..0d68c76a 100644 --- a/Keyboards/KeyboardsBase/InterfaceVariables.swift +++ b/Keyboards/KeyboardsBase/InterfaceVariables.swift @@ -114,6 +114,7 @@ enum ConjViewShiftButtonsState { var keyboardState: KeyboardState = .letters var shiftButtonState: ShiftButtonState = .normal var commandState: CommandState = .idle +var prevToInvalidState: CommandState = .idle var autoActionState: AutoActionState = .suggest var conjViewShiftButtonsState: ConjViewShiftButtonsState = .bothInactive var pluralWords: Set? diff --git a/Keyboards/KeyboardsBase/Keyboard.xib b/Keyboards/KeyboardsBase/Keyboard.xib index 29c5703d..05d32246 100644 --- a/Keyboards/KeyboardsBase/Keyboard.xib +++ b/Keyboards/KeyboardsBase/Keyboard.xib @@ -1,9 +1,9 @@ - + - + @@ -15,38 +15,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -60,8 +28,6 @@ - - @@ -75,241 +41,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - +