From fc6bf68b3de99f86d64f16655c060731d2f34a1e Mon Sep 17 00:00:00 2001
From: Romain Bertozzi <romain.bertozzi@savoirfairelinux.com>
Date: Thu, 9 Nov 2017 08:58:17 -0500
Subject: [PATCH] project: update RxRealm and RxDataSources

This commit updates the following dependencies:
- RxRealm
- RxDataSources
RxSwift is also updated to the 4.0.0 version.

There are minor compatibility changes in the source code to migrate the
project to these new versions.

Tuleap: #1747
Change-Id: I485aa725ad88283c2b66f797140d12b6facd6cd4
Reviewed-by: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
---
 Ring/Cartfile                                         |  4 ++--
 Ring/Cartfile.resolved                                |  8 ++++----
 Ring/Ring.xcodeproj/project.pbxproj                   |  6 ++++++
 .../SmartList/SmartlistViewController.storyboard      |  7 ++-----
 .../SmartList/SmartlistViewController.swift           | 11 ++++-------
 Ring/Ring/Features/Me/Me/MeViewController.swift       |  8 +++-----
 6 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/Ring/Cartfile b/Ring/Cartfile
index a3b764c39..a1c801085 100644
--- a/Ring/Cartfile
+++ b/Ring/Cartfile
@@ -1,5 +1,5 @@
-github "RxSwiftCommunity/RxRealm"
-github "RxSwiftCommunity/RxDataSources" == 1.0.3
+github "RxSwiftCommunity/RxRealm" ~> 0.7
+github "RxSwiftCommunity/RxDataSources" ~> 3.0
 github "pkluz/PKHUD"
 github "AliSoftware/Reusable" ~> 4.0
 github "SwiftyBeaver/SwiftyBeaver"
diff --git a/Ring/Cartfile.resolved b/Ring/Cartfile.resolved
index 8e13fb592..a68070b65 100644
--- a/Ring/Cartfile.resolved
+++ b/Ring/Cartfile.resolved
@@ -1,10 +1,10 @@
 github "AliSoftware/Reusable" "4.0.1"
-github "ReactiveX/RxSwift" "3.5.0"
-github "RxSwiftCommunity/RxDataSources" "1.0.4"
-github "RxSwiftCommunity/RxRealm" "0.6.0"
+github "ReactiveX/RxSwift" "4.0.0"
+github "RxSwiftCommunity/RxDataSources" "3.0.2"
+github "RxSwiftCommunity/RxRealm" "0.7.4"
 github "SwiftyBeaver/SwiftyBeaver" "1.4.2"
 github "ViccAlexander/Chameleon" "2.2.0"
 github "andreamazz/AMPopTip" "3.0.2"
 github "ashleymills/Reachability.swift" "v4.1.0"
 github "pkluz/PKHUD" "4.2.3"
-github "realm/realm-cocoa" "v2.8.3"
+github "realm/realm-cocoa" "v3.0.1"
diff --git a/Ring/Ring.xcodeproj/project.pbxproj b/Ring/Ring.xcodeproj/project.pbxproj
index a20f47adf..9c4b9e610 100644
--- a/Ring/Ring.xcodeproj/project.pbxproj
+++ b/Ring/Ring.xcodeproj/project.pbxproj
@@ -199,6 +199,7 @@
 		56BBC9D41EDC7A6D00CDAF8B /* libargon2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 56BBC9D31EDC7A6D00CDAF8B /* libargon2.a */; };
 		56BBC9DF1EDDC9D300CDAF8B /* LookupNameResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC9DE1EDDC9D300CDAF8B /* LookupNameResponse.m */; };
 		56C715FF1F0D36C600770048 /* ContactsAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 56C715FE1F0D36C600770048 /* ContactsAdapter.mm */; };
+		5C093F011FB495830011D90E /* Differentiator.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C093F001FB495830011D90E /* Differentiator.framework */; };
 		621231F91F880EDF009B86F0 /* UILabel+Ring.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621231F81F880EDF009B86F0 /* UILabel+Ring.swift */; };
 		621231FB1F8D6FEE009B86F0 /* MessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621231FA1F8D6FEE009B86F0 /* MessageCell.swift */; };
 		62A88D371F6C2ED400F8AB18 /* PresenceAdapterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A88D361F6C2ED400F8AB18 /* PresenceAdapterDelegate.swift */; };
@@ -447,6 +448,7 @@
 		56C715FE1F0D36C600770048 /* ContactsAdapter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContactsAdapter.mm; sourceTree = "<group>"; };
 		56C716001F0D36D900770048 /* ContactsAdapterDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsAdapterDelegate.swift; sourceTree = "<group>"; };
 		56C716021F0D466100770048 /* ContactsService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsService.swift; sourceTree = "<group>"; };
+		5C093F001FB495830011D90E /* Differentiator.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Differentiator.framework; path = Carthage/Build/iOS/Differentiator.framework; sourceTree = "<group>"; };
 		621231F81F880EDF009B86F0 /* UILabel+Ring.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+Ring.swift"; sourceTree = "<group>"; };
 		621231FA1F8D6FEE009B86F0 /* MessageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageCell.swift; sourceTree = "<group>"; };
 		62A88D351F6C2E5F00F8AB18 /* PresenceAdapter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PresenceAdapter.h; sourceTree = "<group>"; };
@@ -464,6 +466,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				5C093F011FB495830011D90E /* Differentiator.framework in Frameworks */,
 				0ED666101F9FED1C00743D42 /* AMPopTip.framework in Frameworks */,
 				0EEFBA3C1F83DA21000EDBAD /* libsecp256k1.a in Frameworks */,
 				1A3CA32B1F102BB700283748 /* Chameleon.framework in Frameworks */,
@@ -573,6 +576,7 @@
 		02AED8171DD4C4B000F740BA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				5C093F001FB495830011D90E /* Differentiator.framework */,
 				0ED6660F1F9FED1C00743D42 /* AMPopTip.framework */,
 				62DFAB2B1F9FF030002D6F9C /* Reachability.framework */,
 				0EEFBA3B1F83DA21000EDBAD /* libsecp256k1.a */,
@@ -1310,6 +1314,7 @@
 				"$(SRCROOT)/Carthage/Build/iOS/Chameleon.framework",
 				"$(SRCROOT)/Carthage/build/iOS/AMPopTip.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/Reachability.framework",
+				"$(SRCROOT)/Carthage/Build/iOS/Differentiator.framework",
 			);
 			name = "⚙️ Copy Frameworks";
 			outputPaths = (
@@ -1324,6 +1329,7 @@
 				"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SwiftyBeaver.framework",
 				"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Chameleon.framework",
 				"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/AMPopTip.framework",
+				"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Differentiator.framework",
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
diff --git a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.storyboard b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.storyboard
index 7dc41fb51..9a07b37b9 100644
--- a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.storyboard
+++ b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.storyboard
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Raw-Ee-7sK">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Raw-Ee-7sK">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -78,9 +78,6 @@
                                 <color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
                                 <offsetWrapper key="searchFieldBackgroundPositionAdjustment" horizontal="0.0" vertical="0.0"/>
                                 <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="namePhonePad" returnKeyType="done"/>
-                                <connections>
-                                    <outlet property="delegate" destination="Raw-Ee-7sK" id="Gew-Uj-8Rz"/>
-                                </connections>
                             </searchBar>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="HFM-G6-hMN">
                                 <rect key="frame" x="0.0" y="132" width="375" height="535"/>
diff --git a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift
index 546b53c96..c01873446 100644
--- a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift
+++ b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift
@@ -136,10 +136,6 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
 
     func setupDataSources() {
 
-        //Create DataSources for conversations and filtered conversations
-        let conversationsDataSource = RxTableViewSectionedReloadDataSource<ConversationSection>()
-        let searchResultsDatasource = RxTableViewSectionedReloadDataSource<ConversationSection>()
-
         //Configure cells closure for the datasources
         let configureCell: (TableViewSectionedDataSource, UITableView, IndexPath, ConversationSection.Item)
             -> UITableViewCell = {
@@ -205,14 +201,15 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
                 return cell
         }
 
+        //Create DataSources for conversations and filtered conversations
+        let conversationsDataSource = RxTableViewSectionedReloadDataSource<ConversationSection>(configureCell: configureCell)
+        let searchResultsDatasource = RxTableViewSectionedReloadDataSource<ConversationSection>(configureCell: configureCell)
+
         //Allows to delete
         conversationsDataSource.canEditRowAtIndexPath = { _ in
             return true
         }
 
-        conversationsDataSource.configureCell = configureCell
-        searchResultsDatasource.configureCell = configureCell
-
         //Bind TableViews to DataSources
         self.viewModel.conversations
             .bind(to: self.conversationsTableView.rx.items(dataSource: conversationsDataSource))
diff --git a/Ring/Ring/Features/Me/Me/MeViewController.swift b/Ring/Ring/Features/Me/Me/MeViewController.swift
index 6d7d34a42..ea631c0ec 100644
--- a/Ring/Ring/Features/Me/Me/MeViewController.swift
+++ b/Ring/Ring/Features/Me/Me/MeViewController.swift
@@ -67,8 +67,6 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
 
     func setUpDataSource() {
 
-        let settingsItmeDataSource = RxTableViewSectionedReloadDataSource<SettingsSection>()
-
         let configureCell: (TableViewSectionedDataSource, UITableView, IndexPath, SettingsSection.Item)
             -> UITableViewCell = {
                 ( dataSource: TableViewSectionedDataSource<SettingsSection>,
@@ -98,13 +96,13 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas
                 }
         }
 
-        settingsItmeDataSource.configureCell = configureCell
+        let settingsItemDataSource = RxTableViewSectionedReloadDataSource<SettingsSection>(configureCell: configureCell)
         self.viewModel.settings
-            .bind(to: self.settingsTable.rx.items(dataSource: settingsItmeDataSource))
+            .bind(to: self.settingsTable.rx.items(dataSource: settingsItemDataSource))
             .disposed(by: disposeBag)
 
         //Set header titles
-        settingsItmeDataSource.titleForHeaderInSection = { dataSource, index in
+        settingsItemDataSource.titleForHeaderInSection = { dataSource, index in
             return dataSource.sectionModels[index].header
         }
     }
-- 
GitLab