WIP: Refactoring mlchtCamera's Views #1

Draft
crystll1ne wants to merge 68 commits from dev/view-refactors into dev/main
Owner

Pasted from the GitHub pull request:

mlchtCamera's code is all over the place, and I'm dealing with the affects of this months after I've written it. I'd like to make it cleaner and more organized - and will need to in order to prepare for mlchtKit.

More details on mlchtKit and its purpose will be available once dev/mlchtkit is pushed to this repository.

Pasted from the GitHub pull request: mlchtCamera's code is all over the place, and I'm dealing with the affects of this months after I've written it. I'd like to make it cleaner and more organized - and will need to in order to prepare for mlchtKit. More details on mlchtKit and its purpose will be available once `dev/mlchtkit` is pushed to this repository.
- Removed various files from Copy Bundle Resources step
- Added Embed Build Information to the watchOS target
- Add CFBuildBran to show what branch Malachite is built from
- Add experimental DeveloperView from the DeveloperView/ folder
- Refactor MalachiteSettingsView into SettingsView/ folder
- Remove unnecessary code and comments
- Refactor SettingsView into multiple files
- Refactor SettingsView+Help into QuickHelpView/
- Refactor SettingsView into multiple files
- Refactor SettingsView+Help into QuickHelpView/
- Move internal settings to DeveloperView+Internal
- Add Quick Help entries for Compatibility and Developer
So the availability clause isn't working... what.

(cherry picked from commit 4bf97b9c9f)
- Added a few things to the DeveloperView
- Rename some localizations and functions
- Put CompatibilityView into sections for more clarity
- Switch to isFlashAvailable from hasFlash
- Remove some unnecessary code, formatting changes
Camera Control support for focus and zoom have been disabled for everyone as I work on keeping Camera Control + gestures synched.
Internal builds still have it force enabled
Took care of most of the setupView() function, updated PhotoPreviewView
use the functions I created there as well.

This commit also fixes generating iOS 18 and older app icons using an
(obviously undocumented) asset catalog compiler flag, and switches
NSLog a bit to show proper debug information.
These aren't stale, Xcode just can't find them anymore.
- Move initialization to its own class and out of viewDidLoad()
- Move preview layer building into CameraView+Preview.swift
- Move bringup to Camera+Bringup.swift
- Move UI hide/show to MalachiteViewUtils.swift
- Created a UIGestureRecognizer array for rewritten UI hide/show funcs
- Move various functions out of CameraView into classes that they fit into
- Move Camera Control init + delegate to CameraView+Controls
- Move Darwin notification init to CameraView+Notifications
- Moved overriden funcs to CameraView+Overrides

Other changes included in this commit:
- Create a .name property on UIGestureRecognizer to more easily manage them
- Rewrite dimensions argument for button building to generate corner radius
- Add option to block accidental gestures (swiping from the bottom), currently requires a restart
- Add option to disable Camera Control, currently requires a restart
- Add preference for Camera Control options + order, currently not customizable
- Rename localizations for internal options
- Fixed the game kit button logic in Preferences+Extension (intentionally broken elsewhere)
- Fixed various force unwrapping in bringup code to fix iOS simulator support
- Fixed crash on launch on (at least) iOS 17, probably fixes other versions too
Also some fixes in the Embed build information scripts
I'm committing this before what I am about to do breaks it. Currently,
everything is still working fine. If you are installing Malachite for the first
time, install the previous build first and then update. This build does not
have working requests for camera access or photo library additions, so the
app will die.
This should also fix any other permissions issues that I forgot to account for in the past.
- Moved deviceModel and deviceModelHasChanged into compatibilityPreferences
- Removed prefsVersion key, it was unused after the migratePreferences() rewrite
- Call compatibility.checkDeviceForHEICCompatibility() from Init
So this is awkward... I forgot that Apple's been using HEIC the entire time...
I was on autopilot
I guess it makes sense that isVideoHDREnabled = false fails...
- Buttons, sliders, and recognizers are now in the ControlLayer
   - TODO: Update DocC for them, rethink buttonBuilder.constraints...
- Flashlight level adjustment is now available outside of Camera Control
- Major changes to manual slider adjustments:
   - Only one slider can be active on the screen at a time
   - The lock button has been relocated to above the flashlight on/off toggle
   - This implementation fixes smaller displays having clipping issues
Will be moving these out later, just fixing up watermarking first...then will
finish CameraView.swift refactor, and finally get to this file fully.
Well, bug. Fixed the issue on <=iOS 17 where the buttons would fail to switch
Also fix a crash that should theoretically have never been possible to reach but would still have crashed the app.
The name stays unique and serves as the final change to Malachite for App Store Connect.
I honestly forgot that it existed because it was broken for a while, tested:
- iPhone 7 on 15.1 (D10AP, 19B74)
- iPad Pro (12.9-inch) (2nd generation) on 18.0.1 (J120AP, 22A3370)
- iPhone SE (2nd generation) on 26.4 (D79AP, 23E5218e)
- iPhone 17 Pro Max on 26.4 (V54AP, 23E5218e)
None of these functions are going to be used pre-iOS 18.0 anyway, so they
can safely be moved here under the availability clause.
I forgot if I added code to recheck HDR eligibility on camera switching, I'll need to check.
I'm replacing the names Apple provides me so that I can put in better ones.
To make it more resilient, I plan to use different identifiers for the camera
(type and position), but this is quick and dirty for my next commit.
Also includes various localization changes for future commits
I was working on other stuff when I noticed these
were put into the root of the project. Moderatly
annoying.
Really need to finish that .xcconfig defined build configuration setup...
macOS Sequoia 15.2 -> macOS Sequoia 15.6
I haven't finished the menus yet
Just waiting for cameras to come up before adding the UI menu like a smart person
The incompetence is maddening.
Because I need Xcode Cloud to work. Will probably just check what I changed
between the three build configurations and make it adjustable in an xcconfig
somewhere.
What?
- Moved around inits to somehow fix the multi-camera lag issue
- Put the controlLayer.initMenus() notification into the right place
This is nowhere near final, don't get your hopes up. I also
really hate the code.
- Fix flash brightness overlapping with focus title
- Fix photo section footer duplication issue
I spent a few hours on this, I just needed to apply rotations in different
places. Showed me another bug I need to fix, also switched the font
to SF Mono from Menlo.
Also see more MakerApple krap
Some other code cleanup I had staged, disable MP switching on the front camera,
fix telephoto camera setting being inconsistent.
WIP mainly because I need to refactor to MalachiteKit still, some stuff is still in temp
locations but otherwise it should be fine. Defaults to off, embeds a lot of data.
crystll1ne changed title from Refactoring mlchtCamera's Views to WIP: Refactoring mlchtCamera's Views 2026-03-30 15:19:48 -06:00
crystll1ne force-pushed dev/view-refactors from 185a314a1f to 8677954f1a 2026-03-30 15:24:44 -06:00 Compare
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin dev/view-refactors:dev/view-refactors
git switch dev/view-refactors

Merge

Merge the changes and update on Forgejo.
git switch dev/main
git merge --no-ff dev/view-refactors
git switch dev/view-refactors
git rebase dev/main
git switch dev/main
git merge --ff-only dev/view-refactors
git switch dev/view-refactors
git rebase dev/main
git switch dev/main
git merge --no-ff dev/view-refactors
git switch dev/main
git merge --squash dev/view-refactors
git switch dev/main
git merge --ff-only dev/view-refactors
git switch dev/main
git merge dev/view-refactors
git push origin dev/main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
crystll1ne/mlchtCamera!1
No description provided.