mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-30 16:00:53 +08:00
ios: Handle expensive operations in a background thread
If we handle them in the main thread, then the UI blocks, especially when generating a new SSH key.
This commit is contained in:
@ -52,17 +52,17 @@ static FlutterMethodChannel* gitChannel = 0;
|
||||
result(filesDir);
|
||||
}
|
||||
else if ([@"gitClone" isEqualToString:method]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self handleMethodCallAsync:call result:result];
|
||||
});
|
||||
}
|
||||
else if ([@"gitPull" isEqualToString:method]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self handleMethodCallAsync:call result:result];
|
||||
});
|
||||
}
|
||||
else if ([@"gitPush" isEqualToString:method]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self handleMethodCallAsync:call result:result];
|
||||
});
|
||||
}
|
||||
@ -189,7 +189,7 @@ static FlutterMethodChannel* gitChannel = 0;
|
||||
}
|
||||
}
|
||||
else if ([@"generateSSHKeys" isEqualToString:method]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self handleMethodCallAsync:call result:result];
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user