Adjust login screen to brand colors.

Also changed login button style and added empty url input check.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2020-11-11 15:29:51 +01:00
Родитель 6133af9531
Коммит 0bd27e0335
2 изменённых файлов: 37 добавлений и 19 удалений

Просмотреть файл

@ -54,12 +54,25 @@
self.serverUrl.attributedPlaceholder = [[NSAttributedString alloc] initWithString:serverUrlPlaceholderText
attributes:@{NSForegroundColorAttributeName:[[NCAppBranding brandTextColor] colorWithAlphaComponent:0.5]}];
self.login.backgroundColor = [NCAppBranding brandTextColor];
[self.login setTitleColor:[NCAppBranding brandColor] forState:UIControlStateNormal];
self.login.backgroundColor = [NCAppBranding brandColor];
self.login.layer.borderColor = [NCAppBranding brandTextColor].CGColor;
[self.login setTitleColor:[NCAppBranding brandTextColor] forState:UIControlStateNormal];
self.login.layer.cornerRadius = 26;
self.login.clipsToBounds = YES;
self.login.titleLabel.minimumScaleFactor = 0.5f;
self.login.titleLabel.numberOfLines = 1;
self.login.titleLabel.adjustsFontSizeToFitWidth = YES;
self.login.layer.borderWidth = 1.0;
[self.login setTitle:NSLocalizedString(@"Log in", nil) forState:UIControlStateNormal];
self.activityIndicatorView.color = [NCAppBranding brandTextColor];
self.activityIndicatorView.hidden = YES;
self.imageBaseUrl.image = [self.imageBaseUrl.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self.imageBaseUrl setTintColor:[NCAppBranding brandTextColor]];
self.cancel.hidden = !(multiAccountEnabled && [[NCDatabaseManager sharedInstance] numberOfAccounts] > 0);
[self.cancel setTitle:NSLocalizedString(@"Cancel", nil) forState:UIControlStateNormal];
[self.cancel setTitleColor:[NCAppBranding brandTextColor] forState:UIControlStateNormal];
@ -78,7 +91,14 @@
- (IBAction)login:(id)sender
{
_serverURL = self.serverUrl.text;
NSString *serverInputText = [self.serverUrl.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if ([serverInputText isEqualToString:@""]) {
[self->_serverUrl becomeFirstResponder];
return;
}
_serverURL = serverInputText;
// Check whether baseUrl contain protocol. If not add https:// by default.
if(![_serverURL hasPrefix:@"https"] && ![_serverURL hasPrefix:@"http"]) {
@ -178,7 +198,7 @@
actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) {
[_serverUrl becomeFirstResponder];
[self->_serverUrl becomeFirstResponder];
}];
[alert addAction:okButton];

Просмотреть файл

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@ -39,16 +37,6 @@
<outlet property="delegate" destination="-1" id="JxR-kN-b17"/>
</connections>
</textField>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WaC-p3-cE0">
<rect key="frame" x="0.0" y="307" width="375" height="52"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.28099492970000001" green="0.3251131223" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<state key="normal" title="Login"/>
<connections>
<action selector="login:" destination="-1" eventType="touchUpInside" id="N8h-1K-h4U"/>
</connections>
</button>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="Dkt-lG-hBg">
<rect key="frame" x="339" y="239" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
@ -65,6 +53,16 @@
<action selector="cancel:" destination="-1" eventType="touchUpInside" id="jep-NM-iny"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WaC-p3-cE0">
<rect key="frame" x="87" y="307" width="200" height="52"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.28099492970000001" green="0.3251131223" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<state key="normal" title="Log in"/>
<connections>
<action selector="login:" destination="-1" eventType="touchUpInside" id="N8h-1K-h4U"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.0" green="0.50980392159999999" blue="0.78823529410000004" alpha="1" colorSpace="calibratedRGB"/>
<point key="canvasLocation" x="32.799999999999997" y="52.623688155922046"/>