Commit d28b7488 authored by Thibault Wittemberg's avatar Thibault Wittemberg

project: conform to a swifty way of coding

This commit:
- adapts code to a more Swifty way of coding
- uses previously added frameworks to make the code "type safer"

Change-Id: I5332e2843e82cac4f4f9af79714993863ef5963d
parent 69981855
disabled_rules: # rule identifiers to exclude from running
- todo
opt_in_rules: # some rules are only opt-in
- empty_count
......
......@@ -18,7 +18,7 @@
0273C2FF1E0C438F00CF00BA /* AccountAdapterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0273C2FE1E0C438F00CF00BA /* AccountAdapterDelegate.swift */; };
0273C3051E0C68B100CF00BA /* CreateProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0273C3031E0C68B100CF00BA /* CreateProfileViewController.swift */; };
0273C3061E0C68B100CF00BA /* CreateRingAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0273C3041E0C68B100CF00BA /* CreateRingAccountViewController.swift */; };
0273C3081E0C68BF00CF00BA /* RoundedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0273C3071E0C68BF00CF00BA /* RoundedButton.swift */; };
0273C3081E0C68BF00CF00BA /* DesignableButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0273C3071E0C68BF00CF00BA /* DesignableButton.swift */; };
029CE9D71E1D8C860000C8E1 /* ServiceEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029CE9D61E1D8C860000C8E1 /* ServiceEventTests.swift */; };
02AED8191DD4C4B100F740BA /* librestbed.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 02AED8181DD4C4B100F740BA /* librestbed.a */; };
02B22DFC1DF755BB000358C9 /* AccountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02B22DFA1DF755BB000358C9 /* AccountModel.swift */; };
......@@ -30,9 +30,8 @@
02DD80C81E1EAD70009A3510 /* AccountConfigModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DD80C71E1EAD70009A3510 /* AccountConfigModel.swift */; };
02DD80CA1E1EAF1A009A3510 /* AccountCredentialsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DD80C91E1EAF1A009A3510 /* AccountCredentialsModel.swift */; };
02DD80CD1E1EB2E4009A3510 /* ConfigKeyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DD80CC1E1EB2E4009A3510 /* ConfigKeyModel.swift */; };
02E1A0251DDE4ABA00D75B59 /* BoolStringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043866371D2304A700E06CE2 /* BoolStringExtension.swift */; };
02E1A0251DDE4ABA00D75B59 /* String+Bool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043866371D2304A700E06CE2 /* String+Bool.swift */; };
043866211D218B1100E06CE2 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 043866201D218B1100E06CE2 /* AudioToolbox.framework */; };
043866361D22D06500E06CE2 /* AccountTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043866351D22D06500E06CE2 /* AccountTableViewCell.swift */; };
043999F71D1C2D9D00E99CD9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043999F61D1C2D9D00E99CD9 /* AppDelegate.swift */; };
04399A031D1C2D9D00E99CD9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04399A021D1C2D9D00E99CD9 /* Images.xcassets */; };
04399A111D1C2D9D00E99CD9 /* RingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04399A101D1C2D9D00E99CD9 /* RingTests.swift */; };
......@@ -94,6 +93,10 @@
04399B151D1C341A00E99CD9 /* libyaml-cpp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 04399AE31D1C341A00E99CD9 /* libyaml-cpp.a */; };
1A1E476D1F0E808500EA9A36 /* Reusable.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1E476C1F0E808500EA9A36 /* Reusable.framework */; };
1A1E476F1F0E894600EA9A36 /* SwiftyBeaver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1E476E1F0E894600EA9A36 /* SwiftyBeaver.framework */; };
1A3D28A71F0EB9DB00B524EE /* Bool+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A3D28A61F0EB9DB00B524EE /* Bool+String.swift */; };
1A3D28A91F0EBF0200B524EE /* UIView+Ring.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A3D28A81F0EBF0200B524EE /* UIView+Ring.swift */; };
1A8306331F0EDAA50099D98C /* AccountTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A8306321F0EDAA50099D98C /* AccountTableViewCell.swift */; };
1AABA7461F0FE9C000739605 /* UIColor+Ring.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AABA7451F0FE9C000739605 /* UIColor+Ring.swift */; };
1ABE07BA1F0C16F100D36361 /* ContactViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABE07B91F0C16F100D36361 /* ContactViewModel.swift */; };
1ABE07BC1F0C22CC00D36361 /* WalkthroughStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1ABE07BB1F0C22CC00D36361 /* WalkthroughStoryboard.storyboard */; };
1ABE07D21F0D8FE800D36361 /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ABE07D01F0D8FE800D36361 /* Images.swift */; };
......@@ -113,7 +116,6 @@
563AEC771EA664C0003A5641 /* RegistrationResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 563AEC761EA664C0003A5641 /* RegistrationResponse.m */; };
564775831EE5CFC500A0C855 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564775811EE5CFC500A0C855 /* Realm.framework */; };
564775841EE5CFC500A0C855 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564775821EE5CFC500A0C855 /* RealmSwift.framework */; };
564C44591E8D7F8F000F92B1 /* LocalizedStringTableNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564C44581E8D7F8F000F92B1 /* LocalizedStringTableNames.swift */; };
564C445B1E8EA44E000F92B1 /* Durations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564C445A1E8EA44E000F92B1 /* Durations.swift */; };
564C44601E943C37000F92B1 /* NameRegistrationAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 564C445F1E943C37000F92B1 /* NameRegistrationAdapter.mm */; };
564C44621E943DE6000F92B1 /* NameService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564C44611E943DE6000F92B1 /* NameService.swift */; };
......@@ -128,7 +130,7 @@
56AC64DF1E804ECC00EA1AA9 /* SwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AC64DE1E804ECC00EA1AA9 /* SwitchCell.swift */; };
56AC64E11E80542300EA1AA9 /* TextFieldCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AC64E01E80542300EA1AA9 /* TextFieldCell.swift */; };
56AC64E31E805F0200EA1AA9 /* TextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AC64E21E805F0200EA1AA9 /* TextCell.swift */; };
56AC650E1E85694D00EA1AA9 /* RoundedTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AC650D1E85694D00EA1AA9 /* RoundedTextField.swift */; };
56AC650E1E85694D00EA1AA9 /* DesignableTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AC650D1E85694D00EA1AA9 /* DesignableTextField.swift */; };
56BBC99F1ED714CB00CDAF8B /* MessagesAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC99E1ED714CB00CDAF8B /* MessagesAdapter.mm */; };
56BBC9A21ED714DF00CDAF8B /* MessagesAdapterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC9A01ED714DF00CDAF8B /* MessagesAdapterDelegate.swift */; };
56BBC9A31ED714DF00CDAF8B /* ConversationsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC9A11ED714DF00CDAF8B /* ConversationsService.swift */; };
......@@ -150,7 +152,6 @@
56BBC9DF1EDDC9D300CDAF8B /* LookupNameResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC9DE1EDDC9D300CDAF8B /* LookupNameResponse.m */; };
56BBC9E01EDDC9E600CDAF8B /* ConversationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC9AF1ED7155700CDAF8B /* ConversationViewModel.swift */; };
56BBC9E31EDDCC8100CDAF8B /* ConversationSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC9E21EDDCC8100CDAF8B /* ConversationSection.swift */; };
56BBC9E71EDE1DDF00CDAF8B /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BBC9E61EDE1DDF00CDAF8B /* Colors.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -187,7 +188,7 @@
0273C3001E0C445200CF00BA /* RingPrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RingPrefixHeader.pch; path = Ring/RingPrefixHeader.pch; sourceTree = "<group>"; };
0273C3031E0C68B100CF00BA /* CreateProfileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateProfileViewController.swift; sourceTree = "<group>"; };
0273C3041E0C68B100CF00BA /* CreateRingAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateRingAccountViewController.swift; sourceTree = "<group>"; };
0273C3071E0C68BF00CF00BA /* RoundedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoundedButton.swift; sourceTree = "<group>"; };
0273C3071E0C68BF00CF00BA /* DesignableButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DesignableButton.swift; sourceTree = "<group>"; };
028568301DF610A9003A8D8D /* RingTests-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RingTests-Bridging-Header.h"; sourceTree = "<group>"; };
029CE9D61E1D8C860000C8E1 /* ServiceEventTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceEventTests.swift; sourceTree = "<group>"; };
02AED8181DD4C4B100F740BA /* librestbed.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librestbed.a; path = ../DEPS/x86_64/lib/librestbed.a; sourceTree = "<group>"; };
......@@ -201,8 +202,7 @@
02DD80C91E1EAF1A009A3510 /* AccountCredentialsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountCredentialsModel.swift; sourceTree = "<group>"; };
02DD80CC1E1EB2E4009A3510 /* ConfigKeyModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigKeyModel.swift; sourceTree = "<group>"; };
043866201D218B1100E06CE2 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
043866351D22D06500E06CE2 /* AccountTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountTableViewCell.swift; sourceTree = "<group>"; };
043866371D2304A700E06CE2 /* BoolStringExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoolStringExtension.swift; sourceTree = "<group>"; };
043866371D2304A700E06CE2 /* String+Bool.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Bool.swift"; sourceTree = "<group>"; };
043999F31D1C2D9D00E99CD9 /* Ring.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Ring.app; sourceTree = BUILT_PRODUCTS_DIR; };
043999F61D1C2D9D00E99CD9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
04399A021D1C2D9D00E99CD9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
......@@ -274,6 +274,10 @@
04399AE31D1C341A00E99CD9 /* libyaml-cpp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libyaml-cpp.a"; path = "../fat/lib/libyaml-cpp.a"; sourceTree = "<group>"; };
1A1E476C1F0E808500EA9A36 /* Reusable.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Reusable.framework; path = Carthage/Build/iOS/Reusable.framework; sourceTree = "<group>"; };
1A1E476E1F0E894600EA9A36 /* SwiftyBeaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyBeaver.framework; path = Carthage/Build/iOS/SwiftyBeaver.framework; sourceTree = "<group>"; };
1A3D28A61F0EB9DB00B524EE /* Bool+String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Bool+String.swift"; sourceTree = "<group>"; };
1A3D28A81F0EBF0200B524EE /* UIView+Ring.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Ring.swift"; sourceTree = "<group>"; };
1A8306321F0EDAA50099D98C /* AccountTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountTableViewCell.swift; sourceTree = "<group>"; };
1AABA7451F0FE9C000739605 /* UIColor+Ring.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Ring.swift"; sourceTree = "<group>"; };
1ABE07B91F0C16F100D36361 /* ContactViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactViewModel.swift; sourceTree = "<group>"; };
1ABE07BB1F0C22CC00D36361 /* WalkthroughStoryboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = WalkthroughStoryboard.storyboard; sourceTree = "<group>"; };
1ABE07D01F0D8FE800D36361 /* Images.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = "<group>"; };
......@@ -296,7 +300,6 @@
563AEC761EA664C0003A5641 /* RegistrationResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegistrationResponse.m; sourceTree = "<group>"; };
564775811EE5CFC500A0C855 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Realm.framework; path = Carthage/Build/iOS/Realm.framework; sourceTree = "<group>"; };
564775821EE5CFC500A0C855 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RealmSwift.framework; path = Carthage/Build/iOS/RealmSwift.framework; sourceTree = "<group>"; };
564C44581E8D7F8F000F92B1 /* LocalizedStringTableNames.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalizedStringTableNames.swift; sourceTree = "<group>"; };
564C445A1E8EA44E000F92B1 /* Durations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Durations.swift; sourceTree = "<group>"; };
564C445E1E943C37000F92B1 /* NameRegistrationAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NameRegistrationAdapter.h; sourceTree = "<group>"; };
564C445F1E943C37000F92B1 /* NameRegistrationAdapter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NameRegistrationAdapter.mm; sourceTree = "<group>"; };
......@@ -312,15 +315,13 @@
56AC64DE1E804ECC00EA1AA9 /* SwitchCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwitchCell.swift; sourceTree = "<group>"; };
56AC64E01E80542300EA1AA9 /* TextFieldCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldCell.swift; sourceTree = "<group>"; };
56AC64E21E805F0200EA1AA9 /* TextCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextCell.swift; sourceTree = "<group>"; };
56AC650D1E85694D00EA1AA9 /* RoundedTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoundedTextField.swift; sourceTree = "<group>"; };
56AC650D1E85694D00EA1AA9 /* DesignableTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DesignableTextField.swift; sourceTree = "<group>"; };
56BBC99D1ED714CB00CDAF8B /* MessagesAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagesAdapter.h; sourceTree = "<group>"; };
56BBC99E1ED714CB00CDAF8B /* MessagesAdapter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MessagesAdapter.mm; sourceTree = "<group>"; };
56BBC9A01ED714DF00CDAF8B /* MessagesAdapterDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessagesAdapterDelegate.swift; sourceTree = "<group>"; };
56BBC9A11ED714DF00CDAF8B /* ConversationsService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationsService.swift; sourceTree = "<group>"; };
56BBC9A51ED7151500CDAF8B /* MessageModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageModel.swift; sourceTree = "<group>"; };
56BBC9A71ED7152300CDAF8B /* SmartlistViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SmartlistViewController.swift; sourceTree = "<group>"; };
56BBC9A91ED7153800CDAF8B /* Global.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Global.strings; path = Base.lproj/Global.strings; sourceTree = "<group>"; };
56BBC9AB1ED7154300CDAF8B /* Smartlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Smartlist.strings; path = Base.lproj/Smartlist.strings; sourceTree = "<group>"; };
56BBC9AE1ED7155700CDAF8B /* ConversationModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationModel.swift; sourceTree = "<group>"; };
56BBC9AF1ED7155700CDAF8B /* ConversationViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationViewModel.swift; sourceTree = "<group>"; };
56BBC9B21ED7156500CDAF8B /* ConversationCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationCell.swift; sourceTree = "<group>"; };
......@@ -338,7 +339,6 @@
56BBC9DD1EDDC9D300CDAF8B /* LookupNameResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LookupNameResponse.h; sourceTree = "<group>"; };
56BBC9DE1EDDC9D300CDAF8B /* LookupNameResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LookupNameResponse.m; sourceTree = "<group>"; };
56BBC9E21EDDCC8100CDAF8B /* ConversationSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConversationSection.swift; sourceTree = "<group>"; };
56BBC9E61EDE1DDF00CDAF8B /* Colors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -500,6 +500,7 @@
02E1A0271DDE4C3900D75B59 /* Account */ = {
isa = PBXGroup;
children = (
1A8306321F0EDAA50099D98C /* AccountTableViewCell.swift */,
02B22DFA1DF755BB000358C9 /* AccountModel.swift */,
5516C29E1E71CEFF009D3D2D /* AccountModelHelper.swift */,
02B22DFB1DF755BB000358C9 /* CreateRingAccountViewModel.swift */,
......@@ -540,9 +541,8 @@
043866341D22D04E00E06CE2 /* UI */ = {
isa = PBXGroup;
children = (
0273C3071E0C68BF00CF00BA /* RoundedButton.swift */,
043866351D22D06500E06CE2 /* AccountTableViewCell.swift */,
56AC650D1E85694D00EA1AA9 /* RoundedTextField.swift */,
0273C3071E0C68BF00CF00BA /* DesignableButton.swift */,
56AC650D1E85694D00EA1AA9 /* DesignableTextField.swift */,
);
path = UI;
sourceTree = "<group>";
......@@ -551,7 +551,10 @@
isa = PBXGroup;
children = (
56BBC9BB1ED7161200CDAF8B /* Date+Helpers.swift */,
043866371D2304A700E06CE2 /* BoolStringExtension.swift */,
043866371D2304A700E06CE2 /* String+Bool.swift */,
1A3D28A61F0EB9DB00B524EE /* Bool+String.swift */,
1A3D28A81F0EBF0200B524EE /* UIView+Ring.swift */,
1AABA7451F0FE9C000739605 /* UIColor+Ring.swift */,
);
path = Extensions;
sourceTree = "<group>";
......@@ -589,7 +592,6 @@
56BBC9AD1ED7154800CDAF8B /* Conversations */,
56BBC9A41ED7150200CDAF8B /* Messages */,
564C44571E8D7F68000F92B1 /* Constants */,
56AC64D61E80121200EA1AA9 /* Internationalization */,
0273C3021E0C689600CF00BA /* Walkthrough */,
02EFCACF1E0C3DD600FD8ED1 /* Bridging */,
02E1A0271DDE4C3900D75B59 /* Account */,
......@@ -756,22 +758,11 @@
isa = PBXGroup;
children = (
1ABE07C51F0D862D00D36361 /* Generated */,
56BBC9E61EDE1DDF00CDAF8B /* Colors.swift */,
564C44581E8D7F8F000F92B1 /* LocalizedStringTableNames.swift */,
564C445A1E8EA44E000F92B1 /* Durations.swift */,
);
path = Constants;
sourceTree = "<group>";
};
56AC64D61E80121200EA1AA9 /* Internationalization */ = {
isa = PBXGroup;
children = (
56BBC9AB1ED7154300CDAF8B /* Smartlist.strings */,
56BBC9A91ED7153800CDAF8B /* Global.strings */,
);
name = Internationalization;
sourceTree = "<group>";
};
56AC64DD1E804EB500EA1AA9 /* Cells */ = {
isa = PBXGroup;
children = (
......@@ -1038,14 +1029,16 @@
557086521E8ADB9D001A7CE4 /* SystemAdapter.mm in Sources */,
5669A8031EAA58E6003C7B93 /* LinkDeviceToAccountViewController.swift in Sources */,
0273C3051E0C68B100CF00BA /* CreateProfileViewController.swift in Sources */,
02E1A0251DDE4ABA00D75B59 /* BoolStringExtension.swift in Sources */,
02E1A0251DDE4ABA00D75B59 /* String+Bool.swift in Sources */,
04399AAC1D1C304300E99CD9 /* AccountAdapter.mm in Sources */,
1AABA7461F0FE9C000739605 /* UIColor+Ring.swift in Sources */,
02DD80C81E1EAD70009A3510 /* AccountConfigModel.swift in Sources */,
02B22E091DF7585F000358C9 /* DaemonService.swift in Sources */,
0273C3061E0C68B100CF00BA /* CreateRingAccountViewController.swift in Sources */,
56BBC99F1ED714CB00CDAF8B /* MessagesAdapter.mm in Sources */,
56BBC9CF1EDC5E7000CDAF8B /* MessageCell.swift in Sources */,
02C9B63F1E1D4E8C00F82F0C /* ServiceEvent.swift in Sources */,
1A3D28A71F0EB9DB00B524EE /* Bool+String.swift in Sources */,
56BBC9D21EDC5E7000CDAF8B /* MessageViewModel.swift in Sources */,
02DD80CD1E1EB2E4009A3510 /* ConfigKeyModel.swift in Sources */,
56BBC9E31EDDCC8100CDAF8B /* ConversationSection.swift in Sources */,
......@@ -1059,14 +1052,13 @@
56AC64E11E80542300EA1AA9 /* TextFieldCell.swift in Sources */,
1ABE07E21F0D924700D36361 /* Strings.swift in Sources */,
56AC64E31E805F0200EA1AA9 /* TextCell.swift in Sources */,
56AC650E1E85694D00EA1AA9 /* RoundedTextField.swift in Sources */,
56AC650E1E85694D00EA1AA9 /* DesignableTextField.swift in Sources */,
56BBC9BF1ED7168400CDAF8B /* SmartlistViewModel.swift in Sources */,
02B22E011DF755E5000358C9 /* MainTabBarViewController.swift in Sources */,
564C44641E943E1E000F92B1 /* NameRegistrationAdapterDelegate.swift in Sources */,
043999F71D1C2D9D00E99CD9 /* AppDelegate.swift in Sources */,
02B22DFC1DF755BB000358C9 /* AccountModel.swift in Sources */,
56AC64DF1E804ECC00EA1AA9 /* SwitchCell.swift in Sources */,
56BBC9E71EDE1DDF00CDAF8B /* Colors.swift in Sources */,
56BBC9B91ED715FE00CDAF8B /* ContactModel.swift in Sources */,
56BBC9BA1ED715FE00CDAF8B /* ContactHelper.swift in Sources */,
04399AAE1D1C304300E99CD9 /* Utils.mm in Sources */,
......@@ -1075,17 +1067,18 @@
563AEC771EA664C0003A5641 /* RegistrationResponse.m in Sources */,
02B22DFD1DF755BB000358C9 /* CreateRingAccountViewModel.swift in Sources */,
564C445B1E8EA44E000F92B1 /* Durations.swift in Sources */,
1A8306331F0EDAA50099D98C /* AccountTableViewCell.swift in Sources */,
56BBC9DF1EDDC9D300CDAF8B /* LookupNameResponse.m in Sources */,
1A3D28A91F0EBF0200B524EE /* UIView+Ring.swift in Sources */,
1ABE07D21F0D8FE800D36361 /* Images.swift in Sources */,
56BBC9CD1EDC5E7000CDAF8B /* MessageAccessoryView.swift in Sources */,
02DD80CA1E1EAF1A009A3510 /* AccountCredentialsModel.swift in Sources */,
0273C3081E0C68BF00CF00BA /* RoundedButton.swift in Sources */,
0273C3081E0C68BF00CF00BA /* DesignableButton.swift in Sources */,
56BBC9BC1ED7161200CDAF8B /* Date+Helpers.swift in Sources */,
562FB6CD1EFAD18A00C61A78 /* ConversationViewController.swift in Sources */,
564C44621E943DE6000F92B1 /* NameService.swift in Sources */,
56BBC9E01EDDC9E600CDAF8B /* ConversationViewModel.swift in Sources */,
1ABE07BA1F0C16F100D36361 /* ContactViewModel.swift in Sources */,
043866361D22D06500E06CE2 /* AccountTableViewCell.swift in Sources */,
04399AAD1D1C304300E99CD9 /* DRingAdapter.mm in Sources */,
0273C2FF1E0C438F00CF00BA /* AccountAdapterDelegate.swift in Sources */,
02B22DFF1DF755DB000358C9 /* AccountsService.swift in Sources */,
......@@ -1094,7 +1087,6 @@
56BBC9A21ED714DF00CDAF8B /* MessagesAdapterDelegate.swift in Sources */,
56BBC9B41ED7156500CDAF8B /* ConversationCell.swift in Sources */,
564C44601E943C37000F92B1 /* NameRegistrationAdapter.mm in Sources */,
564C44591E8D7F8F000F92B1 /* LocalizedStringTableNames.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -19,8 +19,9 @@
*/
import UIKit
import Reusable
class AccountTableViewCell: UITableViewCell {
class AccountTableViewCell: UITableViewCell, NibReusable {
// MARK: - Properties
@IBOutlet weak var activeSwitch: UISwitch!
......@@ -29,15 +30,6 @@ class AccountTableViewCell: UITableViewCell {
var account: AccountModel!
// MARK: - UITableViewCell
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
// MARK: - Actions
@IBAction func switchAccountState(_ sender: UISwitch) {
// account.isEnabled = sender.isOn
......
......@@ -140,17 +140,11 @@ class CreateRingAccountViewModel {
.asObservable().map ({ status in
switch status {
case .lookingUp:
return NSLocalizedString("LookingForUsernameAvailability",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Createaccount.lookingForUsernameAvailability.smartString
case .invalid:
return NSLocalizedString("InvalidUsername",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Createaccount.invalidUsername.smartString
case .alreadyTaken:
return NSLocalizedString("UsernameAlreadyTaken",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Createaccount.usernameAlreadyTaken.smartString
default:
return ""
}
......@@ -181,7 +175,7 @@ class CreateRingAccountViewModel {
//Loookup name request observer
self.username.asObservable().subscribe(onNext: { [unowned self] username in
self.nameService.lookupName(withAccount: "", nameserver: "", name: username)
}).addDisposableTo(disposeBag)
}).disposed(by: disposeBag)
//Name registration observer
self.accountService
......@@ -200,7 +194,7 @@ class CreateRingAccountViewModel {
name: self.username.value)
}
})
.addDisposableTo(disposeBag)
.disposed(by: disposeBag)
//Account creation state observer
self.accountService
......@@ -215,7 +209,7 @@ class CreateRingAccountViewModel {
}
}, onError: { _ in
self.accountCreationState.onError(AccountCreationError.unknown)
}).addDisposableTo(disposeBag)
}).disposed(by: disposeBag)
}
}
......@@ -238,34 +232,22 @@ extension AccountCreationError: LocalizedError {
var title: String {
switch self {
case .generic:
return NSLocalizedString("AccountCannotBeFoundTitle",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Alerts.accountCannotBeFoundTitle.smartString
case .network:
return NSLocalizedString("AccountNoNetworkTitle",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Alerts.accountNoNetworkTitle.smartString
default:
return NSLocalizedString("AccountDefaultErrorTitle",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Alerts.accountDefaultErrorTitle.smartString
}
}
var message: String {
switch self {
case .generic:
return NSLocalizedString("AcountCannotBeFoundMessage",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Alerts.accountDefaultErrorMessage.smartString
case .network:
return NSLocalizedString("AccountNoNetworkMessage",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Alerts.accountNoNetworkMessage.smartString
default:
return NSLocalizedString("AccountDefaultErrorMessage",
tableName: LocalizedStringTableNames.walkthrough,
comment: "")
return L10n.Alerts.accountDefaultErrorMessage.smartString
}
}
}
......@@ -20,9 +20,16 @@
import Foundation
/**
Time interval between TextField events in seconds
*/
let textFieldThrottlingDuration = 0.5
public enum Durations {
case textFieldThrottlingDuration
case alertFlashDuration
let alertFlashDuration = 1.0
var value: Double {
switch self {
case .textFieldThrottlingDuration:
return 0.5
case .alertFlashDuration:
return 1.0
}
}
}
......@@ -13,64 +13,83 @@ private class RingStringsBundleToken {}
// swiftlint:disable valid_docs
enum L10n {
/// Account Added
static let accountAddedTitle = L10n.tr("AccountAddedTitle")
/// Can't find account
static let accountCannotBeFoundTitle = L10n.tr("AccountCannotBeFoundTitle")
/// The account couldn't be created.
static let accountDefaultErrorMessage = L10n.tr("AccountDefaultErrorMessage")
/// Unknown error
static let accountDefaultErrorTitle = L10n.tr("AccountDefaultErrorTitle")
/// Could not add account because Ring couldn't connect to the distributed network. Check your device connectivity.
static let accountNoNetworkMessage = L10n.tr("AccountNoNetworkMessage")
/// Can't connect to the network
static let accountNoNetworkTitle = L10n.tr("AccountNoNetworkTitle")
/// Account couldn't be found on the Ring network. Make sure it was exported on Ring from an existing device, and that provided credentials are correct.
static let acountCannotBeFoundMessage = L10n.tr("AcountCannotBeFoundMessage")
/// Choose strong password you will remember to protect your Ring account.
static let chooseStrongPassword = L10n.tr("ChooseStrongPassword")
/// Conversations
static let conversations = L10n.tr("Conversations")
/// Create a Ring account
static let createAccount = L10n.tr("CreateAccount")
/// Create your Ring account
static let createAccountFormTitle = L10n.tr("CreateAccountFormTitle")
/// Enter new username
static let enterNewUsernamePlaceholder = L10n.tr("EnterNewUsernamePlaceholder")
/// Home
static let homeTabBarTitle = L10n.tr("HomeTabBarTitle")
/// Invalid username
static let invalidUsername = L10n.tr("InvalidUsername")
/// Link this device to an account
static let linkDeviceButton = L10n.tr("LinkDeviceButton")
/// Looking for username availability...
static let lookingForUsernameAvailability = L10n.tr("LookingForUsernameAvailability")
/// New Password
static let newPasswordPlaceholder = L10n.tr("NewPasswordPlaceholder")
/// No results
static let noResults = L10n.tr("NoResults")
/// 6 characters minimum
static let passwordCharactersNumberError = L10n.tr("PasswordCharactersNumberError")
/// Passwords do not match
static let passwordNotMatchingError = L10n.tr("PasswordNotMatchingError")
/// Register public username (experimental)
static let registerPublicUsername = L10n.tr("RegisterPublicUsername")
/// Repeat new password
static let repeatPasswordPlaceholder = L10n.tr("RepeatPasswordPlaceholder")
/// Searching...
static let searching = L10n.tr("Searching")
/// User found
static let userFound = L10n.tr("UserFound")
/// Username already taken
static let usernameAlreadyTaken = L10n.tr("UsernameAlreadyTaken")
/// Adding account
static let waitCreateAccountTitle = L10n.tr("WaitCreateAccountTitle")
/// A Ring account allows you to reach people securely in peer to peer through fully distributed network
static let welcomeText = L10n.tr("WelcomeText")
/// Welcome to Ring
static let welcomeTitle = L10n.tr("WelcomeTitle")
/// Yesterday
static let yesterday = L10n.tr("Yesterday")
enum Alerts {
/// Account Added
static let accountAddedTitle = L10n.tr("alerts.accountAddedTitle")
/// Can't find account
static let accountCannotBeFoundTitle = L10n.tr("alerts.accountCannotBeFoundTitle")
/// The account couldn't be created.
static let accountDefaultErrorMessage = L10n.tr("alerts.accountDefaultErrorMessage")
/// Unknown error
static let accountDefaultErrorTitle = L10n.tr("alerts.accountDefaultErrorTitle")
/// Could not add account because Ring couldn't connect to the distributed network. Check your device connectivity.
static let accountNoNetworkMessage = L10n.tr("alerts.accountNoNetworkMessage")
/// Can't connect to the network
static let accountNoNetworkTitle = L10n.tr("alerts.accountNoNetworkTitle")
/// Account couldn't be found on the Ring network. Make sure it was exported on Ring from an existing device, and that provided credentials are correct.
static let acountCannotBeFoundMessage = L10n.tr("alerts.acountCannotBeFoundMessage")
}
enum Createaccount {
/// Choose strong password you will remember to protect your Ring account.
static let chooseStrongPassword = L10n.tr("createAccount.chooseStrongPassword")
/// Create your Ring account
static let createAccountFormTitle = L10n.tr("createAccount.createAccountFormTitle")
/// Enter new username
static let enterNewUsernamePlaceholder = L10n.tr("createAccount.enterNewUsernamePlaceholder")
/// Invalid username
static let invalidUsername = L10n.tr("createAccount.invalidUsername")
/// Loading...
static let loading = L10n.tr("createAccount.loading")
/// Looking for username availability...
static let lookingForUsernameAvailability = L10n.tr("createAccount.lookingForUsernameAvailability")
/// New Password
static let newPasswordPlaceholder = L10n.tr("createAccount.newPasswordPlaceholder")
/// 6 characters minimum
static let passwordCharactersNumberError = L10n.tr("createAccount.passwordCharactersNumberError")
/// Passwords do not match
static let passwordNotMatchingError = L10n.tr("createAccount.passwordNotMatchingError")
/// Register public username (experimental)
static let registerPublicUsername = L10n.tr("createAccount.registerPublicUsername")
/// Repeat new password
static let repeatPasswordPlaceholder = L10n.tr("createAccount.repeatPasswordPlaceholder")
/// Username already taken
static let usernameAlreadyTaken = L10n.tr("createAccount.usernameAlreadyTaken")
/// Adding account
static let waitCreateAccountTitle = L10n.tr("createAccount.waitCreateAccountTitle")
}
enum Global {
/// Home
static let homeTabBarTitle = L10n.tr("global.homeTabBarTitle")
/// Ok
static let ok = L10n.tr("global.ok")
}
enum Smartlist {
/// Conversations
static let conversations = L10n.tr("smartlist.conversations")
/// No results
static let noResults = L10n.tr("smartlist.noResults")
/// Searching...
static let searching = L10n.tr("smartlist.searching")
/// User found
static let userFound = L10n.tr("smartlist.userFound")
/// Yesterday
static let yesterday = L10n.tr("smartlist.yesterday")
}
enum Welcome {
/// Create a Ring account
static let createAccount = L10n.tr("welcome.createAccount")
/// Link this device to an account
static let linkDeviceButton = L10n.tr("welcome.linkDeviceButton")
/// A Ring account allows you to reach people securely in peer to peer through fully distributed network
static let text = L10n.tr("welcome.text")
/// Welcome to Ring
static let title = L10n.tr("welcome.title")
}
}
struct LocalizableString {
......
......@@ -39,7 +39,7 @@ class ContactHelper {
} else {
userName.value = lookupNameResponse.address
}
}).addDisposableTo(disposeBag)
}).disposed(by: disposeBag)
nameService.lookupAddress(withAccount: "", nameserver: "", address: ringId)
......
......@@ -73,7 +73,7 @@ class ContactViewModel {
} else {
self.userName.value = lookupNameResponse.address
}
}).addDisposableTo(disposeBag)
}).disposed(by: disposeBag)
nameService.lookupAddress(withAccount: "", nameserver: "", address: self.contact.ringId)
}
......
......@@ -20,8 +20,9 @@
import UIKit
import RxSwift
import Reusable
class ConversationCell: UITableViewCell {
class ConversationCell: UITableViewCell, NibReusable {
@IBOutlet weak var profileImage: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
......@@ -30,11 +31,6 @@ class ConversationCell: UITableViewCell {
@IBOutlet weak var lastMessageDateLabel: UILabel!
@IBOutlet weak var lastMessagePreviewLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
self.newMessagesIndicator.backgroundColor = UIColor.red
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<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" reuseIdentifier="ConversationCellId" rowHeight="76" id="KGk-i7-Jjw" customClass="ConversationCell" customModule="Ring" customModuleProvider="target">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="76" id="KGk-i7-Jjw" customClass="ConversationCell" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="358" height="76"/>
<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="358" height="76"/>
<rect key="frame" x="0.0" y="0.0" width="358" height="75.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_contact_picture" translatesAutoresizingMaskIntoConstraints="NO" id="pFB-Jn-TNP">
......
......@@ -71,7 +71,7 @@ class ConversationViewController: UIViewController, UITextFieldDelegate {
}
func setupUI() {
self.viewModel?.userName.asObservable().bind(to: self.navigationItem.rx.title).addDisposableTo(disposeBag)
self.viewModel?.userName.asObservable().bind(to: self.navigationItem.rx.title).disposed(by: disposeBag)
self.tableView.contentInset.bottom = messageAccessoryView.frame.size.height
self.tableView.scrollIndicatorInsets.bottom = messageAccessoryView.frame.size.height
......@@ -97,22 +97,21 @@ class ConversationViewController: UIViewController, UITextFieldDelegate {
self.tableView.separatorStyle = .none
//Register cell
self.tableView.register(UINib.init(nibName: "MessageCell", bundle: nil),
forCellReuseIdentifier: "MessageCellId")
self.tableView.register(cellType: MessageCell.self)
//Bind the TableView to the ViewModel
self.viewModel?.messages
.bind(to: tableView.rx.items(cellIdentifier: "MessageCellId",
.bind(to: tableView.rx.items(cellIdentifier: "MessageCell",
cellType: MessageCell.self)) { _, messageViewModel, cell in
cell.messageLabel.text = messageViewModel.content
cell.bubblePosition = messageViewModel.bubblePosition()
}.addDisposableTo(disposeBag)
}.disposed(by: disposeBag)
//Scroll to bottom when reloaded
self.tableView.rx.methodInvoked(#selector(UITableView.reloadData)).subscribe(onNext: { _ in
self.scrollToBottomIfNeed()
self.updateBottomOffset()
}).addDisposableTo(disposeBag)
}).disposed(by: disposeBag)
}
fileprivate func updateBottomOffset() {
......@@ -153,7 +152,7 @@ class ConversationViewController: UIViewController, UITextFieldDelegate {
}
lazy var messageAccessoryView: MessageAccessoryView = {