Fix adding config from bot
This commit is contained in:
parent
fe558163cc
commit
f8b2cce618
3 changed files with 21 additions and 36 deletions
|
@ -48,10 +48,6 @@ int main(int argc, char *argv[])
|
||||||
AllowSetForegroundWindow(0);
|
AllowSetForegroundWindow(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_IOS)
|
|
||||||
QtAppDelegateInitialize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
app.registerTypes();
|
app.registerTypes();
|
||||||
|
|
||||||
app.setApplicationName(APPLICATION_NAME);
|
app.setApplicationName(APPLICATION_NAME);
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
|
@interface QIOSApplicationDelegate
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface QIOSApplicationDelegate (AmneziaVPNDelegate)
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -3,25 +3,15 @@
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
@implementation QtAppDelegate {
|
UIView *_screen;
|
||||||
UIView *_screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
+(QtAppDelegate *)sharedQtAppDelegate {
|
|
||||||
static dispatch_once_t pred;
|
|
||||||
static QtAppDelegate *shared = nil;
|
|
||||||
dispatch_once(&pred, ^{
|
|
||||||
shared = [[super alloc] init];
|
|
||||||
});
|
|
||||||
return shared;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@implementation QIOSApplicationDelegate (AmneziaVPNDelegate)
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||||
{
|
{
|
||||||
[application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum];
|
[application setMinimumBackgroundFetchInterval: UIApplicationBackgroundFetchIntervalMinimum];
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
NSLog(@"Did this launch option happen");
|
NSLog(@"Application didFinishLaunchingWithOptions");
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,31 +60,27 @@
|
||||||
- (BOOL)application:(UIApplication *)app
|
- (BOOL)application:(UIApplication *)app
|
||||||
openURL:(NSURL *)url
|
openURL:(NSURL *)url
|
||||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
|
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
|
||||||
|
|
||||||
NSLog(@"Application openURL: %@", url);
|
|
||||||
if (url.fileURL) {
|
if (url.fileURL) {
|
||||||
QString filePath(url.path.UTF8String);
|
QString filePath(url.path.UTF8String);
|
||||||
if (filePath.isEmpty()) return NO;
|
if (filePath.isEmpty()) return NO;
|
||||||
|
|
||||||
if (filePath.contains("backup")) {
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||||
IosController::Instance()->importBackupFromOutside(filePath);
|
NSLog(@"Application openURL: %@", url);
|
||||||
} else {
|
|
||||||
QFile file(filePath);
|
if (filePath.contains("backup")) {
|
||||||
bool isOpenFile = file.open(QIODevice::ReadOnly);
|
IosController::Instance()->importBackupFromOutside(filePath);
|
||||||
QByteArray data = file.readAll();
|
} else {
|
||||||
|
QFile file(filePath);
|
||||||
|
bool isOpenFile = file.open(QIODevice::ReadOnly);
|
||||||
|
QByteArray data = file.readAll();
|
||||||
|
|
||||||
|
IosController::Instance()->importConfigFromOutside(QString(data));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
IosController::Instance()->importConfigFromOutside(QString(data));
|
|
||||||
}
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QtAppDelegateInitialize()
|
|
||||||
{
|
|
||||||
[[UIApplication sharedApplication] setDelegate: [QtAppDelegate sharedQtAppDelegate]];
|
|
||||||
NSLog(@"Created a new AppDelegate");
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue