Просмотр исходного кода

psi.SendFeedback now delegates error handling to the caller

Miro Kuratczyk 8 лет назад
Родитель
Сommit
759930e1e9

+ 9 - 1
MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.m

@@ -362,7 +362,15 @@
            [self logMessage:@"Error getting config for feedback upload"];
         }
 
-        GoPsiSendFeedback(connectionConfigJson, feedbackJson, b64EncodedPublicKey, uploadServer, @"", uploadServerHeaders);
+        NSError *e;
+
+        GoPsiSendFeedback(connectionConfigJson, feedbackJson, b64EncodedPublicKey, uploadServer, @"", uploadServerHeaders, &e);
+
+        if (e != nil) {
+            [self logMessage:[NSString stringWithFormat: @"Feedback upload error: %@", e.localizedDescription]];
+        } else {
+            [self logMessage:@"Feedback upload successful"];
+        }
     });
 }
 

+ 2 - 7
MobileLibrary/psi/psi.go

@@ -179,13 +179,8 @@ func SetClientVerificationPayload(clientVerificationPayload string) {
 }
 
 // Encrypt and upload feedback.
-func SendFeedback(configJson, diagnosticsJson, b64EncodedPublicKey, uploadServer, uploadPath, uploadServerHeaders string) {
-	err := psiphon.SendFeedback(configJson, diagnosticsJson, b64EncodedPublicKey, uploadServer, uploadPath, uploadServerHeaders)
-	if err != nil {
-		psiphon.NoticeAlert("error uploading feedback: %s", err)
-	} else {
-		psiphon.NoticeInfo("feedback uploaded successfully")
-	}
+func SendFeedback(configJson, diagnosticsJson, b64EncodedPublicKey, uploadServer, uploadPath, uploadServerHeaders string) error {
+	return psiphon.SendFeedback(configJson, diagnosticsJson, b64EncodedPublicKey, uploadServer, uploadPath, uploadServerHeaders)
 }
 
 // Get build info from tunnel-core