Merge pull request #2120 from vector-im/riot_2119

Registration: reCAPTCHA does not work anymore on iOS 10
This commit is contained in:
manuroe
2018-12-12 08:37:43 +01:00
committed by GitHub
4 changed files with 45 additions and 9 deletions
+3
View File
@@ -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).
@@ -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;
/**
@@ -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;
}
@@ -237,7 +237,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<webView hidden="YES" contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="whs-Ob-uzD" customClass="MXKAuthenticationRecaptchaWebView">
<view hidden="YES" contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="whs-Ob-uzD">
<rect key="frame" x="0.0" y="27.5" width="600" height="500"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
@@ -246,7 +246,7 @@
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityIdentifier" value="AuthInputsViewRecaptchaWebView"/>
</userDefinedRuntimeAttributes>
</webView>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Sz8-Gm-Piu" customClass="TermsView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="27.5" width="600" height="183"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -306,7 +306,7 @@
<outlet property="phoneContainerTopConstraint" destination="sZH-Qr-87A" id="p1Y-TU-0wX"/>
<outlet property="phoneSeparator" destination="0Uh-dj-10x" id="Jke-kf-F4W"/>
<outlet property="phoneTextField" destination="4Md-Fk-tj9" id="H5a-mC-cGM"/>
<outlet property="recaptchaWebView" destination="whs-Ob-uzD" id="0S8-PN-Ykm"/>
<outlet property="recaptchaContainer" destination="whs-Ob-uzD" id="0S8-PN-Ykm"/>
<outlet property="repeatPasswordContainer" destination="rb1-L5-udI" id="NjO-O7-WYX"/>
<outlet property="repeatPasswordSeparator" destination="ddx-5u-PbG" id="MtA-Rf-dhU"/>
<outlet property="repeatPasswordTextField" destination="BQM-LP-8Eq" id="mgM-dU-mJo"/>