diff --git a/CHANGES.rst b/CHANGES.rst
index 3f22871f2..2c3295a36 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,9 @@
Changes in 0.7.x (2018-xx-xx)
===============================================
+Bug fix:
+ * Registration: reCAPTCHA does not work anymore on iOS 10 (#2119).
+
Improvements:
* Replace the deprecated MXMediaManager and MXMediaLoader interfaces use (see matrix-org/matrix-ios-sdk/pull/593).
* Replace the deprecated MXKAttachment and MXKImageView interfaces use (see matrix-org/matrix-ios-kit/pull/487).
diff --git a/Riot/Modules/Authentication/Views/AuthInputsView.h b/Riot/Modules/Authentication/Views/AuthInputsView.h
index e6ce0f9ac..f2c1dbbd8 100644
--- a/Riot/Modules/Authentication/Views/AuthInputsView.h
+++ b/Riot/Modules/Authentication/Views/AuthInputsView.h
@@ -51,7 +51,7 @@
@property (weak, nonatomic) IBOutlet UILabel *messageLabel;
-@property (weak, nonatomic) IBOutlet MXKAuthenticationRecaptchaWebView *recaptchaWebView;
+@property (weak, nonatomic) IBOutlet UIView *recaptchaContainer;
@property (weak, nonatomic) IBOutlet TermsView *termsView;
/**
diff --git a/Riot/Modules/Authentication/Views/AuthInputsView.m b/Riot/Modules/Authentication/Views/AuthInputsView.m
index 4b0747505..04a994521 100644
--- a/Riot/Modules/Authentication/Views/AuthInputsView.m
+++ b/Riot/Modules/Authentication/Views/AuthInputsView.m
@@ -1278,7 +1278,7 @@
// Hide other items
self.messageLabelTopConstraint.constant = 8;
self.messageLabel.hidden = YES;
- self.recaptchaWebView.hidden = YES;
+ self.recaptchaContainer.hidden = YES;
self.termsView.hidden = YES;
_currentLastContainer = nil;
@@ -1326,10 +1326,43 @@
self.messageLabel.hidden = NO;
self.messageLabel.text = NSLocalizedStringFromTable(@"auth_recaptcha_message", @"Vector", nil);
- self.recaptchaWebView.hidden = NO;
- self.currentLastContainer = self.recaptchaWebView;
-
- [self.recaptchaWebView openRecaptchaWidgetWithSiteKey:siteKey fromHomeServer:restClient.homeserver callback:callback];
+ self.recaptchaContainer.hidden = NO;
+ self.currentLastContainer = self.recaptchaContainer;
+
+ // IB does not support WKWebview in a xib before iOS 11
+ // So, add it by coding
+
+ // Do some cleaning/reset before
+ for (UIView *view in self.recaptchaContainer.subviews)
+ {
+ [view removeFromSuperview];
+ }
+
+ MXKAuthenticationRecaptchaWebView *reCaptchaWebView = [MXKAuthenticationRecaptchaWebView new];
+ reCaptchaWebView.translatesAutoresizingMaskIntoConstraints = NO;
+ [self.recaptchaContainer addSubview:reCaptchaWebView];
+
+ [self.recaptchaContainer addConstraints:
+ [NSLayoutConstraint constraintsWithVisualFormat:@"|-[view]-|"
+ options:0
+ metrics:0
+ views:@{
+ @"view": reCaptchaWebView
+ }
+ ]
+ ];
+ [self.recaptchaContainer addConstraints:
+ [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[view]-|"
+ options:0
+ metrics:0
+ views:@{
+ @"view": reCaptchaWebView
+ }
+ ]
+ ];
+
+
+ [reCaptchaWebView openRecaptchaWidgetWithSiteKey:siteKey fromHomeServer:restClient.homeserver callback:callback];
return YES;
}
diff --git a/Riot/Modules/Authentication/Views/AuthInputsView.xib b/Riot/Modules/Authentication/Views/AuthInputsView.xib
index c60119b25..1e34290d6 100644
--- a/Riot/Modules/Authentication/Views/AuthInputsView.xib
+++ b/Riot/Modules/Authentication/Views/AuthInputsView.xib
@@ -237,7 +237,7 @@
-
+
@@ -246,7 +246,7 @@
-
+
@@ -306,7 +306,7 @@
-
+