mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
ios: Use git_fetch and git_merge instead of pull
Now with the latest git_bindings we no longer use git_pull which would do a fetch + merge. It's good that these two actions are separated as I can then easily replace the git_merge with a smarter version implemented in git. Also, that way in the future, the git_bindings plugin will only be used for git_fetch and git_push for SSH. Everything else can be handled by dart_git.
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
PODS:
|
||||
- bonsoir (0.1.2):
|
||||
- Flutter
|
||||
- connectivity (0.0.1):
|
||||
- Flutter
|
||||
- Reachability
|
||||
@ -55,8 +57,6 @@ PODS:
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- git_bindings (0.0.1):
|
||||
- Flutter
|
||||
- GoogleAppMeasurement (6.6.0):
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
|
||||
- GoogleUtilities/MethodSwizzler (~> 6.0)
|
||||
@ -119,6 +119,7 @@ PODS:
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- bonsoir (from `.symlinks/plugins/bonsoir/ios`)
|
||||
- connectivity (from `.symlinks/plugins/connectivity/ios`)
|
||||
- device_info (from `.symlinks/plugins/device_info/ios`)
|
||||
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
|
||||
@ -127,7 +128,6 @@ DEPENDENCIES:
|
||||
- flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`)
|
||||
- flutter_sentry (from `.symlinks/plugins/flutter_sentry/ios`)
|
||||
- flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
|
||||
- git_bindings (from `.symlinks/plugins/git_bindings/ios`)
|
||||
- image_picker (from `.symlinks/plugins/image_picker/ios`)
|
||||
- in_app_purchase (from `.symlinks/plugins/in_app_purchase/ios`)
|
||||
- launch_review (from `.symlinks/plugins/launch_review/ios`)
|
||||
@ -158,6 +158,8 @@ SPEC REPOS:
|
||||
- Sentry
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
bonsoir:
|
||||
:path: ".symlinks/plugins/bonsoir/ios"
|
||||
connectivity:
|
||||
:path: ".symlinks/plugins/connectivity/ios"
|
||||
device_info:
|
||||
@ -174,8 +176,6 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/flutter_sentry/ios"
|
||||
flutter_webview_plugin:
|
||||
:path: ".symlinks/plugins/flutter_webview_plugin/ios"
|
||||
git_bindings:
|
||||
:path: ".symlinks/plugins/git_bindings/ios"
|
||||
image_picker:
|
||||
:path: ".symlinks/plugins/image_picker/ios"
|
||||
in_app_purchase:
|
||||
@ -200,6 +200,7 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/url_launcher/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
bonsoir: 8ef4e0ac3c66a4aba0f99ec70bc9f6fad7d2eadf
|
||||
connectivity: 6e94255659cc86dcbef1d452ad3e0491bb1b3e75
|
||||
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
|
||||
Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6
|
||||
@ -215,7 +216,6 @@ SPEC CHECKSUMS:
|
||||
flutter_sentry: e7e66f0717b5fba24f96891e879562bdd8985d36
|
||||
flutter_webview_plugin: ed9e8a6a96baf0c867e90e1bce2673913eeac694
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
git_bindings: 2136dc93ecfd22b3fdcafd03b582e7b64debf2b6
|
||||
GoogleAppMeasurement: 67458367830514fb20fd9e233496f1eef9d90185
|
||||
GoogleDataTransport: 672fb0ce96fe7f7f31d43672fca62ad2c9c86f7b
|
||||
GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
|
||||
|
@ -281,8 +281,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "
|
||||
";
|
||||
shellScript = "\n";
|
||||
};
|
||||
7C6C1F2893FB13AF19269048 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
@ -333,11 +332,11 @@
|
||||
"${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Sentry/Sentry.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/bonsoir/bonsoir.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/flutter_email_sender/flutter_email_sender.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/flutter_webview_plugin/flutter_webview_plugin.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/git_bindings/git_bindings.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/in_app_purchase/in_app_purchase.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/launch_review/launch_review.framework",
|
||||
@ -359,11 +358,11 @@
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sentry.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/bonsoir.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_email_sender.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_webview_plugin.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/git_bindings.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/in_app_purchase.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/launch_review.framework",
|
||||
|
@ -53,7 +53,12 @@ static FlutterMethodChannel* gitChannel = 0;
|
||||
[self handleMethodCallAsync:call result:result];
|
||||
});
|
||||
}
|
||||
else if ([@"gitPull" isEqualToString:method]) {
|
||||
else if ([@"gitFetch" isEqualToString:method]) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self handleMethodCallAsync:call result:result];
|
||||
});
|
||||
}
|
||||
else if ([@"gitMerge" isEqualToString:method]) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self handleMethodCallAsync:call result:result];
|
||||
});
|
||||
@ -333,10 +338,35 @@ bool handleError(FlutterResult result, int err) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ([@"gitPull" isEqualToString:method]) {
|
||||
else if ([@"gitFetch" isEqualToString:method]) {
|
||||
NSString *folderPath = arguments[@"folderPath"];
|
||||
NSString *remote = arguments[@"remote"];
|
||||
|
||||
|
||||
if (folderPath == nil || [folderPath length] == 0) {
|
||||
result([FlutterError errorWithCode:@"InvalidParams"
|
||||
message:@"Invalid folderPath" details:nil]);
|
||||
return;
|
||||
}
|
||||
if (remote == nil || [remote length] == 0) {
|
||||
result([FlutterError errorWithCode:@"InvalidParams"
|
||||
message:@"Invalid remote" details:nil]);
|
||||
return;
|
||||
}
|
||||
|
||||
gj_set_ssh_keys_paths((char*) sshPublicKeyPath, (char*) sshPrivateKeyPath, "");
|
||||
|
||||
int err = gj_git_fetch([folderPath UTF8String], [remote UTF8String]);
|
||||
if (!handleError(result, err)) {
|
||||
result(@YES);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ([@"gitMerge" isEqualToString:method]) {
|
||||
NSString *folderPath = arguments[@"folderPath"];
|
||||
NSString *authorName = arguments[@"authorName"];
|
||||
NSString *authorEmail = arguments[@"authorEmail"];
|
||||
NSString *branch = arguments[@"branch"];
|
||||
|
||||
if (folderPath == nil || [folderPath length] == 0) {
|
||||
result([FlutterError errorWithCode:@"InvalidParams"
|
||||
@ -353,10 +383,15 @@ bool handleError(FlutterResult result, int err) {
|
||||
message:@"Invalid authorEmail" details:nil]);
|
||||
return;
|
||||
}
|
||||
if (branch == nil || [branch length] == 0) {
|
||||
result([FlutterError errorWithCode:@"InvalidParams"
|
||||
message:@"Invalid branch" details:nil]);
|
||||
return;
|
||||
}
|
||||
|
||||
gj_set_ssh_keys_paths((char*) sshPublicKeyPath, (char*) sshPrivateKeyPath, "");
|
||||
|
||||
int err = gj_git_pull([folderPath UTF8String], [authorName UTF8String], [authorEmail UTF8String]);
|
||||
int err = gj_git_merge([folderPath UTF8String], [branch UTF8String], [authorName UTF8String], [authorEmail UTF8String]);
|
||||
if (!handleError(result, err)) {
|
||||
result(@YES);
|
||||
return;
|
||||
@ -364,16 +399,22 @@ bool handleError(FlutterResult result, int err) {
|
||||
}
|
||||
else if ([@"gitPush" isEqualToString:method]) {
|
||||
NSString *folderPath = arguments[@"folderPath"];
|
||||
NSString *remote = arguments[@"remote"];
|
||||
|
||||
if (folderPath == nil || [folderPath length] == 0) {
|
||||
result([FlutterError errorWithCode:@"InvalidParams"
|
||||
message:@"Invalid folderPath" details:nil]);
|
||||
return;
|
||||
}
|
||||
if (remote == nil || [remote length] == 0) {
|
||||
result([FlutterError errorWithCode:@"InvalidParams"
|
||||
message:@"Invalid remote" details:nil]);
|
||||
return;
|
||||
}
|
||||
|
||||
gj_set_ssh_keys_paths((char*) sshPublicKeyPath, (char*) sshPrivateKeyPath, "");
|
||||
|
||||
int err = gj_git_push([folderPath UTF8String]);
|
||||
int err = gj_git_push([folderPath UTF8String], [remote UTF8String]);
|
||||
if (!handleError(result, err)) {
|
||||
result(@YES);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user