Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for mounting folders from iOS #543

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -10,10 +10,12 @@
#include <netdb.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import "AppDelegate.h"
#import "SceneDelegate.h"
#import "PasteboardDevice.h"
#import "LocationDevice.h"
#import "TerminalViewController.h"
#import "UserPreferences.h"
#import "iOSFS.h"
#include "kernel/init.h"
#include "kernel/calls.h"
#include "fs/dyndev.h"
@@ -133,7 +135,9 @@ - (int)boot {
die_handler = ios_handle_die;
NSString *sockTmp = [NSTemporaryDirectory() stringByAppendingString:@"ishsock"];
sock_tmp_prefix = strdup(sockTmp.UTF8String);


filesystems[IOS_FILESYSTEM_ID] = &iosfs;
filesystems[IOS_UNSAFE_FILESYSTEM_ID] = &iosfs_unsafe;
tty_drivers[TTY_CONSOLE_MAJOR] = &ios_console_driver;
set_console_device(TTY_CONSOLE_MAJOR, 1);
err = create_stdio("/dev/console", TTY_CONSOLE_MAJOR, 1);
@@ -226,6 +230,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
if (self.window != nil) {
// For iOS <13, where the app delegate owns the window instead of the scene
TerminalViewController *vc = (TerminalViewController *) self.window.rootViewController;
currentTerminalViewController = vc;
[vc startNewSession];
}
return YES;
@@ -6,9 +6,12 @@
//

#import <UIKit/UIKit.h>
#import "TerminalViewController.h"

NS_ASSUME_NONNULL_BEGIN

extern TerminalViewController *currentTerminalViewController;

This comment has been minimized.

@tbodt

tbodt Dec 16, 2019
Member

I don't really like this way of getting the view controller. My other ideas are way more annoying to implement though.


API_AVAILABLE(ios(13))
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>

@@ -6,7 +6,8 @@
//

#import "SceneDelegate.h"
#import "TerminalViewController.h"

TerminalViewController *currentTerminalViewController = NULL;

@interface SceneDelegate ()

@@ -40,4 +41,17 @@ - (NSUserActivity *)stateRestorationActivityForScene:(UIScene *)scene {
return activity;
}

- (void)sceneDidBecomeActive:(UIScene *)scene {
TerminalViewController *terminalViewController = (TerminalViewController *) self.window.rootViewController;;
currentTerminalViewController = terminalViewController;
}

- (void)sceneWillResignActive:(UIScene *)scene {
TerminalViewController *terminalViewController = (TerminalViewController *) self.window.rootViewController;

if (currentTerminalViewController == terminalViewController) {
currentTerminalViewController = NULL;
}
}

@end
@@ -0,0 +1,9 @@
//
// iOSFS.h
// iSH
//
// Created by Noah Peeters on 26.10.19.
//

extern const struct fs_ops iosfs;
extern const struct fs_ops iosfs_unsafe;