Commit 8b84f945 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

account: add blocked contact list

Change-Id: I5491d2bc0eb10f42e2688250a8ca5ecd8b2a422b
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 40533583
......@@ -100,8 +100,16 @@
0E0FF1B51FC3947B003898C2 /* DBManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0FF1B41FC3947B003898C2 /* DBManager.swift */; };
0E0FF1B71FC398B3003898C2 /* ConversationDataHepler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0FF1B61FC398B3003898C2 /* ConversationDataHepler.swift */; };
0E0FF1B91FC398C5003898C2 /* InteractionDataHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0FF1B81FC398C5003898C2 /* InteractionDataHelper.swift */; };
0E20E4C72031FF560087C868 /* BlockContactsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E20E4C52031FF560087C868 /* BlockContactsCell.swift */; };
0E20E4C82031FF560087C868 /* BlockContactsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E20E4C62031FF560087C868 /* BlockContactsCell.xib */; };
0E2D5F531F9145C800D574BF /* LinkNewDeviceCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2D5F521F9145C800D574BF /* LinkNewDeviceCell.swift */; };
0E2D5F551F9145F200D574BF /* LinkNewDeviceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E2D5F541F9145F200D574BF /* LinkNewDeviceCell.xib */; };
0E36979920322D46009A68CA /* BlockListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E36979720322D46009A68CA /* BlockListViewController.swift */; };
0E36979D20322D75009A68CA /* BlockListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E36979C20322D75009A68CA /* BlockListViewModel.swift */; };
0E36979F20322E6F009A68CA /* BlockListViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0E36979E20322E6F009A68CA /* BlockListViewController.storyboard */; };
0E3697A1203235EA009A68CA /* BannedContactItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3697A0203235EA009A68CA /* BannedContactItem.swift */; };
0E3697A8203243D3009A68CA /* BannedContactCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3697A6203243D3009A68CA /* BannedContactCell.swift */; };
0E3697A9203243D3009A68CA /* BannedContactCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E3697A7203243D3009A68CA /* BannedContactCell.xib */; };
0E403F811F7D797300C80BC2 /* MessageCellGenerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E403F801F7D797300C80BC2 /* MessageCellGenerated.swift */; };
0E403F831F7D79B000C80BC2 /* MessageCellGenerated.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E403F821F7D79B000C80BC2 /* MessageCellGenerated.xib */; };
0E44B62F202B9DE40060F71B /* LocalNotificationsHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E44B62E202B9DE40060F71B /* LocalNotificationsHelper.swift */; };
......@@ -370,8 +378,16 @@
0E0FF1B41FC3947B003898C2 /* DBManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DBManager.swift; sourceTree = "<group>"; };
0E0FF1B61FC398B3003898C2 /* ConversationDataHepler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationDataHepler.swift; sourceTree = "<group>"; };
0E0FF1B81FC398C5003898C2 /* InteractionDataHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractionDataHelper.swift; sourceTree = "<group>"; };
0E20E4C52031FF560087C868 /* BlockContactsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockContactsCell.swift; sourceTree = "<group>"; };
0E20E4C62031FF560087C868 /* BlockContactsCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BlockContactsCell.xib; sourceTree = "<group>"; };
0E2D5F521F9145C800D574BF /* LinkNewDeviceCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinkNewDeviceCell.swift; sourceTree = "<group>"; };
0E2D5F541F9145F200D574BF /* LinkNewDeviceCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LinkNewDeviceCell.xib; sourceTree = "<group>"; };
0E36979720322D46009A68CA /* BlockListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockListViewController.swift; sourceTree = "<group>"; };
0E36979C20322D75009A68CA /* BlockListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockListViewModel.swift; sourceTree = "<group>"; };
0E36979E20322E6F009A68CA /* BlockListViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = BlockListViewController.storyboard; sourceTree = "<group>"; };
0E3697A0203235EA009A68CA /* BannedContactItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannedContactItem.swift; sourceTree = "<group>"; };
0E3697A6203243D3009A68CA /* BannedContactCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannedContactCell.swift; sourceTree = "<group>"; };
0E3697A7203243D3009A68CA /* BannedContactCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BannedContactCell.xib; sourceTree = "<group>"; };
0E403F801F7D797300C80BC2 /* MessageCellGenerated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageCellGenerated.swift; sourceTree = "<group>"; };
0E403F821F7D79B000C80BC2 /* MessageCellGenerated.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MessageCellGenerated.xib; sourceTree = "<group>"; };
0E44B62E202B9DE40060F71B /* LocalNotificationsHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalNotificationsHelper.swift; sourceTree = "<group>"; };
......@@ -988,6 +1004,28 @@
path = DBHelpers;
sourceTree = "<group>";
};
0E20E4C22031FEFF0087C868 /* BlockListCell */ = {
isa = PBXGroup;
children = (
0E20E4C52031FF560087C868 /* BlockContactsCell.swift */,
0E20E4C62031FF560087C868 /* BlockContactsCell.xib */,
);
name = BlockListCell;
sourceTree = "<group>";
};
0E36979B20322D4D009A68CA /* BlockList */ = {
isa = PBXGroup;
children = (
0E36979720322D46009A68CA /* BlockListViewController.swift */,
0E36979C20322D75009A68CA /* BlockListViewModel.swift */,
0E36979E20322E6F009A68CA /* BlockListViewController.storyboard */,
0E3697A0203235EA009A68CA /* BannedContactItem.swift */,
0E3697A6203243D3009A68CA /* BannedContactCell.swift */,
0E3697A7203243D3009A68CA /* BannedContactCell.xib */,
);
name = BlockList;
sourceTree = "<group>";
};
0E44B62D202B9DC40060F71B /* Helpers */ = {
isa = PBXGroup;
children = (
......@@ -1012,6 +1050,7 @@
0E5AFE0A1F8EBC040040D539 /* Cells */ = {
isa = PBXGroup;
children = (
0E20E4C22031FEFF0087C868 /* BlockListCell */,
0EAA9DAD2029F054005E245C /* Proxy */,
0E5AFE0B1F8EBC1E0040D539 /* DeviceCell */,
);
......@@ -1235,6 +1274,7 @@
1A2D18D91F2918F300B2C785 /* Me */ = {
isa = PBXGroup;
children = (
0E36979B20322D4D009A68CA /* BlockList */,
0E5AFE0A1F8EBC040040D539 /* Cells */,
1A2D18EC1F2919D800B2C785 /* MeViewController.storyboard */,
1A5DC02B1F3565250075E8EF /* MeViewController.swift */,
......@@ -1554,6 +1594,7 @@
0EAA9DB52029F0AA005E245C /* ProxyCell.xib in Resources */,
1ABE07DF1F0D91A800D36361 /* LaunchScreen.storyboard in Resources */,
1A5DC0381F35675E0075E8EF /* ContactRequestCell.xib in Resources */,
0E20E4C82031FF560087C868 /* BlockContactsCell.xib in Resources */,
1A0C4EDA1F1D4B1B00550433 /* WelcomeViewController.storyboard in Resources */,
5CE66F751FBF769B00EE9291 /* InitialLoadingViewController.storyboard in Resources */,
1A5DC03E1F35678D0075E8EF /* ContactRequestsViewController.storyboard in Resources */,
......@@ -1561,6 +1602,8 @@
1A2D18B31F2915C500B2C785 /* ConversationViewController.storyboard in Resources */,
0E7CF4DF2017918300CD967D /* ButtonsContainerView.xib in Resources */,
1A2D18A01F27A6D600B2C785 /* LinkDeviceViewController.storyboard in Resources */,
0E3697A9203243D3009A68CA /* BannedContactCell.xib in Resources */,
0E36979F20322E6F009A68CA /* BlockListViewController.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1678,6 +1721,7 @@
621231F91F880EDF009B86F0 /* UILabel+Ring.swift in Sources */,
1A2D18AC1F29149D00B2C785 /* MeCoordinator.swift in Sources */,
1A2D18C51F29180700B2C785 /* ContactModel.swift in Sources */,
0E3697A8203243D3009A68CA /* BannedContactCell.swift in Sources */,
1A2D18F71F292D7200B2C785 /* MessageCellSent.swift in Sources */,
04399AAC1D1C304300E99CD9 /* AccountAdapter.mm in Sources */,
0E68571120238546008B0717 /* CallMakeable.swift in Sources */,
......@@ -1734,6 +1778,7 @@
1A2D18FC1F292DAD00B2C785 /* ConversationCell.swift in Sources */,
0E48F9D31FDF150700D6CC08 /* ContactRequestManager.swift in Sources */,
0E7CF4DD20165BFB00CD967D /* ButtonsContainerViewModel.swift in Sources */,
0E20E4C72031FF560087C868 /* BlockContactsCell.swift in Sources */,
1A5DC0371F35675E0075E8EF /* ContactRequestCell.swift in Sources */,
1A20417C1F1E56FF00C08435 /* WelcomeViewModel.swift in Sources */,
1A5DC03D1F35678D0075E8EF /* ContactRequestItem.swift in Sources */,
......@@ -1741,11 +1786,13 @@
1A2041821F1E906B00C08435 /* CreateProfileViewModel.swift in Sources */,
1A0C4EE31F1D673600550433 /* InjectionBag.swift in Sources */,
564C44641E943E1E000F92B1 /* NameRegistrationAdapterDelegate.swift in Sources */,
0E36979920322D46009A68CA /* BlockListViewController.swift in Sources */,
1A2D18AA1F29131900B2C785 /* ConversationsCoordinator.swift in Sources */,
62AF685E201A61FF003AA9E8 /* AudioService.swift in Sources */,
043999F71D1C2D9D00E99CD9 /* AppDelegate.swift in Sources */,
1A2041861F1EA19600C08435 /* CreateAccountViewController.swift in Sources */,
0EDCC8601F98150500B121D7 /* UIView+Rx.swift in Sources */,
0E36979D20322D75009A68CA /* BlockListViewModel.swift in Sources */,
1A2D18C21F29180700B2C785 /* AccountCredentialsModel.swift in Sources */,
0E9D844B1FA7DBAA00C561EB /* ContactRequestTabBarItem.swift in Sources */,
1A2D18FF1F29352D00B2C785 /* MeViewModel.swift in Sources */,
......@@ -1762,6 +1809,7 @@
0E6949791FA7E71C0029B60A /* BaseViewController.swift in Sources */,
56C715FF1F0D36C600770048 /* ContactsAdapter.mm in Sources */,
1A5DC0281F3564AA0075E8EF /* MessageModel.swift in Sources */,
0E3697A1203235EA009A68CA /* BannedContactItem.swift in Sources */,
56BBC9DF1EDDC9D300CDAF8B /* LookupNameResponse.m in Sources */,
1A2041911F1FD46300C08435 /* DesignableView.swift in Sources */,
0ED2B6FE1F96A16C001572F0 /* LinkNewDeviceViewModel.swift in Sources */,
......
......@@ -50,6 +50,11 @@ extension UIViewController {
// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
enum StoryboardScene {
enum BlockListViewController: StoryboardType {
static let storyboardName = "BlockListViewController"
static let initialScene = InitialSceneType<Ring.BlockListViewController>(storyboard: BlockListViewController.self)
}
enum CallViewController: StoryboardType {
static let storyboardName = "CallViewController"
......
......@@ -9,12 +9,16 @@ import Foundation
enum L10n {
enum Accountpage {
/// Block List
static let blockedContacts = L10n.tr("Localizable", "accountPage.blockedContacts")
/// Devices
static let devicesListHeader = L10n.tr("Localizable", "accountPage.devicesListHeader")
/// Enable Push Notifications
static let enableProxy = L10n.tr("Localizable", "accountPage.enableProxy")
/// Settings
static let settingsHeader = L10n.tr("Localizable", "accountPage.settingsHeader")
/// UNBLOCK
static let unblockContact = L10n.tr("Localizable", "accountPage.unblockContact")
}
enum Actions {
......
......@@ -38,7 +38,7 @@ enum MessageSequencing {
enum GeneratedMessageType: String {
case sendContactRequest = "The invitation has been sent"
case receivedContactRequest = "Contact request received"
case contactRequestAccepted = "Contact accepted"
case contactRequestAccepted = "Contact added"
}
class MessageViewModel {
......
/*
* Copyright (C) 2018 Savoir-faire Linux Inc.
*
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import UIKit
import Reusable
import RxSwift
class BannedContactCell: UITableViewCell, NibReusable {
@IBOutlet weak var fallbackAvatar: UILabel!
@IBOutlet weak var profileImageView: UIImageView!
@IBOutlet weak var fallbackAvatarImage: UIImageView!
@IBOutlet weak var userNameLabel: UILabel!
@IBOutlet weak var displayNameLabel: UILabel!
@IBOutlet weak var unblockButton: UIButton!
var disposeBag = DisposeBag()
override func prepareForReuse() {
self.disposeBag = DisposeBag()
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="72" id="KGk-i7-Jjw" customClass="BannedContactCell" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="72"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="71.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="swh-nI-ECy" userLabel="Fallback Avatar">
<rect key="frame" x="16" y="16" width="40" height="40"/>
<color key="backgroundColor" red="1" green="0.5" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Cyq-bh-BOu"/>
<constraint firstAttribute="width" constant="40" id="VUo-YT-tIh"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="20"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="fallback_avatar" translatesAutoresizingMaskIntoConstraints="NO" id="Exq-jK-jxm" userLabel="Fallback image">
<rect key="frame" x="16" y="16" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="2ej-m5-IHC"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="40" id="3w2-Yi-Gfa"/>
<constraint firstAttribute="width" constant="40" id="g2l-33-BTJ"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="40" id="nzZ-1E-4Bl"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YZy-Ew-WGd">
<rect key="frame" x="16" y="16" width="40" height="40"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="P1w-ya-Ltr"/>
<constraint firstAttribute="width" constant="40" id="muV-WA-AgK"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="a37-VQ-Ddu">
<rect key="frame" x="240" y="21" width="70" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="4oX-FR-x1H"/>
<constraint firstAttribute="height" constant="30" id="Hvp-5x-4GE"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="UNBLOCK">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hik-h4-XBB">
<rect key="frame" x="64" y="16" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1dZ-bK-85e">
<rect key="frame" x="64" y="56" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="1dZ-bK-85e" firstAttribute="leading" secondItem="swh-nI-ECy" secondAttribute="trailing" constant="8" id="98C-0J-HmI"/>
<constraint firstItem="a37-VQ-Ddu" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="D9v-96-V0h"/>
<constraint firstItem="a37-VQ-Ddu" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1dZ-bK-85e" secondAttribute="trailing" constant="20" id="HIW-ph-KNY"/>
<constraint firstItem="swh-nI-ECy" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="M9p-Od-bYQ"/>
<constraint firstItem="Hik-h4-XBB" firstAttribute="leading" secondItem="swh-nI-ECy" secondAttribute="trailing" constant="8" id="QOj-yK-xtk"/>
<constraint firstItem="1dZ-bK-85e" firstAttribute="bottom" secondItem="YZy-Ew-WGd" secondAttribute="bottom" id="QYG-dh-yJn"/>
<constraint firstItem="Exq-jK-jxm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="T8f-qb-lGM"/>
<constraint firstItem="Exq-jK-jxm" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="W5g-cz-PBA"/>
<constraint firstItem="a37-VQ-Ddu" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hik-h4-XBB" secondAttribute="trailing" constant="20" id="YbE-T6-0fc"/>
<constraint firstItem="YZy-Ew-WGd" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="fdt-e2-2aE"/>
<constraint firstItem="Hik-h4-XBB" firstAttribute="top" secondItem="YZy-Ew-WGd" secondAttribute="top" id="gta-qQ-G03"/>
<constraint firstItem="YZy-Ew-WGd" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="i4J-dL-dEq"/>
<constraint firstAttribute="trailing" secondItem="a37-VQ-Ddu" secondAttribute="trailing" constant="10" id="ljc-2e-5QH"/>
<constraint firstItem="swh-nI-ECy" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="zBN-3Z-bIs"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="displayNameLabel" destination="Hik-h4-XBB" id="VZd-fj-VsS"/>
<outlet property="fallbackAvatar" destination="swh-nI-ECy" id="q7Z-yD-0ic"/>
<outlet property="fallbackAvatarImage" destination="Exq-jK-jxm" id="LhB-oS-z7p"/>
<outlet property="profileImageView" destination="YZy-Ew-WGd" id="9c1-7E-uR4"/>
<outlet property="unblockButton" destination="a37-VQ-Ddu" id="h8m-6N-NAM"/>
<outlet property="userNameLabel" destination="1dZ-bK-85e" id="kWa-9i-lHi"/>
</connections>
</tableViewCell>
</objects>
<resources>
<image name="fallback_avatar" width="82" height="82"/>
</resources>
</document>
/*
* Copyright (C) 2018 Savoir-faire Linux Inc.
*
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
class BannedContactItem {
let contact: ContactModel
var image: Data?
var displayName: String?
init(withContact contact: ContactModel) {
self.contact = contact
}
}
/*
* Copyright (C) 2018 Savoir-faire Linux Inc.
*
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import UIKit
import Reusable
import RxSwift
class BlockContactsCell: UITableViewCell, NibReusable {
@IBOutlet weak var label: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
self.accessoryType = .disclosureIndicator
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="BlockContactsCell" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Blocked Contacts" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wlQ-aw-PJj">
<rect key="frame" x="16" y="11" width="135" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="wlQ-aw-PJj" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="MtK-dF-zZ3"/>
<constraint firstItem="wlQ-aw-PJj" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="fP9-5E-Hir"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="label" destination="wlQ-aw-PJj" id="PsF-AH-7YS"/>
</connections>
</tableViewCell>
</objects>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="cWr-kq-EfK">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Block List View Controller-->
<scene sceneID="CDw-GO-ni9">
<objects>
<viewController hidesBottomBarWhenPushed="YES" id="cWr-kq-EfK" customClass="BlockListViewController" customModule="Ring" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="YKN-B2-7X7">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="72" estimatedRowHeight="72" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="eGc-th-VK5">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="No blocked contacts" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nUo-eH-a0f">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="eGc-th-VK5" firstAttribute="top" secondItem="YKN-B2-7X7" secondAttribute="top" id="5Nj-Mt-QeY"/>
<constraint firstItem="nUo-eH-a0f" firstAttribute="top" secondItem="YKN-B2-7X7" secondAttribute="top" id="6YC-L1-UO0"/>
<constraint firstItem="nUo-eH-a0f" firstAttribute="leading" secondItem="wN6-Fz-tau" secondAttribute="leading" id="7G3-4b-v8w"/>
<constraint firstItem="nUo-eH-a0f" firstAttribute="trailing" secondItem="wN6-Fz-tau" secondAttribute="trailing" id="DwO-qn-bYX"/>
<constraint firstItem="wN6-Fz-tau" firstAttribute="bottom" secondItem="nUo-eH-a0f" secondAttribute="bottom" id="gsh-dP-Os8"/>
<constraint firstItem="eGc-th-VK5" firstAttribute="trailing" secondItem="wN6-Fz-tau" secondAttribute="trailing" id="uq4-pz-rcL"/>
<constraint firstItem="eGc-th-VK5" firstAttribute="leading" secondItem="wN6-Fz-tau" secondAttribute="leading" id="xU3-rh-8zX"/>
<constraint firstItem="eGc-th-VK5" firstAttribute="bottom" secondItem="wN6-Fz-tau" secondAttribute="bottom" id="xqa-be-YtG"/>
</constraints>
<viewLayoutGuide key="safeArea" id="wN6-Fz-tau"/>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<connections>
<outlet property="noBlockedContactLabel" destination="nUo-eH-a0f" id="0zv-9l-3GL"/>
<outlet property="tableView" destination="eGc-th-VK5" id="4JY-jU-2Xb"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="aSs-T9-tPs" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.80000000000000004" y="136.28185907046478"/>
</scene>
</scenes>
</document>
/*
* Copyright (C) 2018 Savoir-faire Linux Inc.
*
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import UIKit
import RxSwift
import RxCocoa
import SwiftyBeaver
import Reusable
class BlockListViewController: UIViewController, StoryboardBased, ViewModelBased {
var viewModel: BlockListViewModel!
let disposeBag = DisposeBag()
let cellIdentifier = "BannedContactCell"
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var noBlockedContactLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = L10n.Accountpage.blockedContacts
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.setupTableView()
self.viewModel.contactListNotEmpty
.observeOn(MainScheduler.instance)
.bind(to: self.noBlockedContactLabel.rx.isHidden)
.disposed(by: self.disposeBag)
}
func setupTableView() {
self.tableView.rowHeight = 64.0
self.tableView.allowsSelection = false
//Register cell
self.tableView.register(cellType: BannedContactCell.self)
self.viewModel
.blockedContactsItems
.observeOn(MainScheduler.instance)
.bind(to: tableView.rx.items(cellIdentifier: cellIdentifier,
cellType: BannedContactCell.self))
{ [unowned self] _, item, cell in
if let displayName = item.displayName {
cell.displayNameLabel.text = displayName
}
if let name = item.contact.userName {
cell.userNameLabel.text = name
} else {
cell.userNameLabel.text = item.contact.ringId
}