ios: Fix setSshKeys

Forgot to write the private key to disk
This commit is contained in:
Vishesh Handa
2019-06-04 15:22:24 +02:00
parent c4e5cbc3ad
commit 9cf0b9ad48

View File

@ -45,6 +45,9 @@ static FlutterMethodChannel* gitChannel = 0;
NSArray *sshPublicComponents = [NSArray arrayWithObjects:filesDir, @"ssh", @"id_rsa.pub", nil]; NSArray *sshPublicComponents = [NSArray arrayWithObjects:filesDir, @"ssh", @"id_rsa.pub", nil];
NSString *sshPublicKeyString = [NSString pathWithComponents:sshPublicComponents]; NSString *sshPublicKeyString = [NSString pathWithComponents:sshPublicComponents];
NSArray *sshPrivateComponents = [NSArray arrayWithObjects:filesDir, @"ssh", @"id_rsa", nil];
NSString *sshPrivateKeyString = [NSString pathWithComponents:sshPrivateComponents];
if ([@"getBaseDirectory" isEqualToString:method]) { if ([@"getBaseDirectory" isEqualToString:method]) {
result(filesDir); result(filesDir);
} }
@ -247,6 +250,14 @@ static FlutterMethodChannel* gitChannel = 0;
return; return;
} }
[privateKey writeToFile:sshPrivateKeyString atomically:YES encoding:NSUTF8StringEncoding error:&error];
if (error != nil) {
result([FlutterError errorWithCode:@"FAILED"
message:[error localizedDescription] details:nil]);
return;
}
result(@YES); result(@YES);
} }
else if ([@"dumpAppLogs" isEqualToString:method]) { else if ([@"dumpAppLogs" isEqualToString:method]) {