Files
PojavLauncher_iOS/Natives/FileListViewController.m
T
khanhduytran0 2a9d3909f8 Internal, renderer and UI changes + 1.19-pre1 support
Minecraft 1.19 support:
- Since 1.19-pre1, LWJGL 3.3.1 is used. However, LWJGL 3.2.3 still works with it, at least for this Minecraft release.
- Added a hack to skip calling to ObjC codes (skipped an asset file to skip setting the icon)
- JNA version replacing: now only change to 5.8.0 if version < 5.8.0

Internal changes:
- Cleanup: moved global functions to a new place
- Handle demo user correctly: actually authenticate the game with demo's access token and use the Xbox gamertag as the username
- Start moving strings to Localizable.strings (WIP)
- Re-wrote the Microsoft authentication and account management to Objective-C
- Assets downloading: added a tiny sleep call so that the UI won’t be frozen when too many tasks are executed at the same time

Renderers changes
- gl4es: `init_constructor` is now enabled, therefore moved the preload part to before `eglInitialize` (or EGL will be de-init after gl4es's hardware test).
- gl4es-extra (aka holy gl4es 1.1.4) is now used to replace the regular gl4es. This fixes VBO issue on version < 1.13 and some extra stuff. https://github.com/PojavLauncherTeam/gl4es-114-extra/commit/d6cf5c4
- Removed gl4es 1.1.5 and `Disable gl4es shaderconv` as it's unnecessary for now
- Removed vgpu, as it requires some missing extensions when come to shaders

User interface:
- The account selection list now displays the skin head (or the Xbox gamerpic if demo) and the account type
2022-05-22 11:31:14 +07:00

74 lines
2.4 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 files
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]];
}
}
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.fileList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
cell.textLabel.text = [self.fileList objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self dismissViewControllerAnimated:YES completion:nil];
self.whenItemSelected(self.fileList [indexPath.row]);
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSString *str = [self.fileList objectAtIndex:indexPath.row];
NSFileManager *fm = [NSFileManager defaultManager];
NSString *path = [NSString stringWithFormat:@"%@/%@.json", self.listPath, str];
if (self.whenDelete != nil) {
self.whenDelete(path);
}
[fm removeItemAtPath:path error:nil];
[self.fileList removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
@end