* Move control loaders to CustomControlsUtils.m
* WIP Drawer support (currently broken)
Also, updated MetalANGLE for helping debug stuff on crash.
* temp
* ControlDrawer: free orientation
* Avoid scrolling the hotbar in grab mode
* Popover: fix the frame inside the arrow
* Changes
- Attempt to allow Microsoft login when offline.
- Custom controls: drawer and sub-buttons are now visible.
- Pickers in Preferences: pre-select at the saved index.
* Bump version code to 4, hide sub-button by default
* Fix text trucanting
* impl scroll buttons, rewrite some parts to objc
* Virtual mouse implementation
Also, possible fix for popover crashes on iPad
Exception type: NSInternalInconsistencyException
> Reason: Tried to set <UIBarButtonItem: 0x10fee5660> menuOnTouchDown
menu=0x2810dce10 image=<UIImage:0x280149050 symbol(system:
ellipsis.circle) {20, 19} baseline=3.5,contentInsets={1, 1.5, 1,
1.5},alignmentRectInsets={-0.5, 0, -0.5, 0}
config=<traits=(UserInterfaceIdiom = Pad, DisplayScale = 2,
DisplayGamut = sRGB, HorizontalSizeClass = Regular, VerticalSizeClass
= Regular, UserInterfaceStyle = Dark, UserInterfaceLayoutDirection =
LTR, PreferredContentSizeCategory = L, AccessibilityContrast =
Normal)>> as sourceView of
<_UIAlertControllerActionSheetRegularPresentationController:
0x12043f5a0>, even though it is not a kind of UIView.
* Swap item between hands by double-tap item moment
* Basic editor (only several stuff implemented)
There's no save/load yet, so it's just a preview for now.
* Control editor (preview only)
TODO: Color picker for iOS < 14
* Save, load and set default are here
* Changes
- Ported Snap and Align from Android
- Added options: create and delete button
TODO:
- color picker for iOS < 14
- drawer editor
- maybe more
* Editor: Added orientation changer for drawer
Added some more check to determine whether dynamic position should be
visible (when the button is not a sub-button, or the parent drawer
doesn't use the FREE orientation)
* Editor: implemented adding drawer and sub-button
* Added a warning about unfinished custom controls
Co-authored-by: Duy Tran Khanh <[email protected]>
79 lines
2.6 KiB
Objective-C
79 lines
2.6 KiB
Objective-C
#import "FileListViewController.h"
|
|
|
|
@interface FileListViewController () {
|
|
}
|
|
|
|
@property(nonatomic, strong) NSMutableArray *fileList;
|
|
|
|
@end
|
|
|
|
@implementation FileListViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
|
|
if (self.fileList == nil) {
|
|
self.fileList = [NSMutableArray array];
|
|
} else {
|
|
[self.fileList removeAllObjects];
|
|
}
|
|
|
|
// List accounts
|
|
NSFileManager *fm = [NSFileManager defaultManager];
|
|
NSArray *files = [fm contentsOfDirectoryAtPath:self.listPath error:nil];
|
|
for(NSString *file in files) {
|
|
NSString *path = [self.listPath stringByAppendingPathComponent:file];
|
|
BOOL isDir = NO;
|
|
[fm fileExistsAtPath:path isDirectory:(&isDir)];
|
|
if(!isDir && [file hasSuffix:@".json"]) {
|
|
[self.fileList addObject:[file stringByDeletingPathExtension]];
|
|
}
|
|
}
|
|
|
|
CGRect screenBounds = [[UIScreen mainScreen] bounds];
|
|
|
|
int width = (int) roundf(screenBounds.size.width);
|
|
int height = (int) roundf(screenBounds.size.height) - self.navigationController.navigationBar.frame.size.height;
|
|
|
|
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
|
|
}
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
|
{
|
|
return [self.fileList count];
|
|
}
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
NSString *simpleTableIdentifier = @"cell";
|
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
|
|
|
|
if (cell == nil) {
|
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
|
|
}
|
|
|
|
cell.textLabel.text = [self.fileList objectAtIndex:indexPath.row];
|
|
return cell;
|
|
}
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
NSString *str = [self.fileList objectAtIndex:indexPath.row];
|
|
self.whenItemSelected(str);
|
|
}
|
|
|
|
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
|
// TODO: invalidate token
|
|
|
|
NSString *str = [self.fileList objectAtIndex:indexPath.row];
|
|
NSFileManager *fm = [NSFileManager defaultManager];
|
|
[fm removeItemAtPath:[NSString stringWithFormat:@"%@/%@.json", self.listPath, str] error:nil];
|
|
[self.fileList removeObjectAtIndex:indexPath.row];
|
|
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
|
}
|
|
}
|
|
|
|
@end
|