diff --git a/Cartfile b/Cartfile index 4881ea6..246ad1a 100644 --- a/Cartfile +++ b/Cartfile @@ -10,12 +10,12 @@ github "MortimerGoro/MGSwipeTableCell" github "ashleymills/Reachability.swift" ~> 3.0 github "artemkrachulov/AKMaskField.git" github "krzyzanowskim/CryptoSwift" - +github "ninjaprox/NVActivityIndicatorView" + github "RooyeKhat-Media/Gifu" "v2.0.0-b" github "RooyeKhat-Media/ALCameraViewController" "1.2.7" -github "RooyeKhat-Media/IGProtoBuffLibrary" "build54" -github "RooyeKhat-Media/INSPhotoGallery" "1.1.0-d" +github "RooyeKhat-Media/INSPhotoGallery" "1.1.01" github "RooyeKhat-Media/Starscream" "2.0.4-a" github "RooyeKhat-Media/DBAttachmentPickerController" "1.1.4-a" - -#development repos +github "RooyeKhat-Media/swift-protobuf" "4c9b588" +github "RooyeKhat-Media/IGProtoBuffLibrary" "18158ab" \ No newline at end of file diff --git a/Cartfile.resolved b/Cartfile.resolved index b7946a9..be15bd9 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,19 +1,20 @@ -github "KennethTsang/GrowingTextView" "0.2.4" -github "MortimerGoro/MGSwipeTableCell" "1.5.6" -github "ReactiveX/RxSwift" "3.4.1" +github "KennethTsang/GrowingTextView" "0.3.0" +github "MortimerGoro/MGSwipeTableCell" "1.6.1" +github "ReactiveX/RxSwift" "3.6.1" github "RooyeKhat-Media/ALCameraViewController" "1.2.7" github "RooyeKhat-Media/DBAttachmentPickerController" "1.1.4-a" github "RooyeKhat-Media/Gifu" "v2.0.0-b" -github "RooyeKhat-Media/IGProtoBuffLibrary" "build54" -github "RooyeKhat-Media/INSPhotoGallery" "1.1.0-d" -github "RooyeKhat-Media/Protobuf-Swift" "3.0.13-d" +github "RooyeKhat-Media/IGProtoBuffLibrary" "18158ab3c5e15e62e3d7d591d7feb69fd85051d4" +github "RooyeKhat-Media/INSPhotoGallery" "1.1.01" github "RooyeKhat-Media/Starscream" "2.0.4-a" -github "RxSwiftCommunity/RxRealm" "0.6.0" +github "RooyeKhat-Media/swift-protobuf" "4c9b5889ba4bdc0e314620ddfa3e8885f1a804c7" +github "RxSwiftCommunity/RxRealm" "0.7.2" github "SnapKit/SnapKit" "3.2.0" github "TakeScoop/SwiftyRSA" "0.5.0" github "artemkrachulov/AKMaskField" "v2.0.3" -github "ashleymills/Reachability.swift" "v3" -github "facebook/pop" "1.0.9" +github "ashleymills/Reachability.swift" "v3.0" +github "facebook/pop" "1.0.10" github "jdg/MBProgressHUD" "1.0.0" -github "krzyzanowskim/CryptoSwift" "0.6.9" -github "realm/realm-cocoa" "v2.7.0" +github "krzyzanowskim/CryptoSwift" "0.7.2" +github "ninjaprox/NVActivityIndicatorView" "4.0.0" +github "realm/realm-cocoa" "v2.10.2" diff --git a/Fabric.framework/run b/Fabric.framework/run old mode 100644 new mode 100755 diff --git a/Fabric.framework/uploadDSYM b/Fabric.framework/uploadDSYM old mode 100644 new mode 100755 diff --git a/iGap.xcodeproj/project.pbxproj b/iGap.xcodeproj/project.pbxproj index 3bf999c..73cd4f1 100644 --- a/iGap.xcodeproj/project.pbxproj +++ b/iGap.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 4F9386F81EAE335200397C3B /* IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F9386F71EAE335200397C3B /* IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift */; }; 4F9F3E6A1EBA0D91008E05C1 /* IGPushResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F9F3E691EBA0D91008E05C1 /* IGPushResponse.swift */; }; + 4FFCE2A01EEAF21400F7D0AE /* IGRegistrationStepPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FFCE29F1EEAF21400F7D0AE /* IGRegistrationStepPasswordViewController.swift */; }; 931585151E6D567000F4C04B /* IGUserPrivacy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 931585141E6D567000F4C04B /* IGUserPrivacy.swift */; }; 93193F281E5811BA0039AC0C /* IGGroupInfoTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93193F271E5811BA0039AC0C /* IGGroupInfoTableViewController.swift */; }; 93193F2A1E5811FF0039AC0C /* IGGroupInfoEditNameTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93193F291E5811FF0039AC0C /* IGGroupInfoEditNameTableViewController.swift */; }; @@ -48,7 +49,9 @@ 93AA67CE1E4F407E0053380C /* IGChannelInfoMemberListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93AA67CD1E4F407E0053380C /* IGChannelInfoMemberListTableViewCell.swift */; }; 93AA67D01E4F40C80053380C /* IGChannelInfoAdminsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93AA67CF1E4F40C80053380C /* IGChannelInfoAdminsTableViewCell.swift */; }; 93C299941E77D5FD00EE37C4 /* IGChannelAndGroupInfoSharedAudioAndVoiceTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93C299931E77D5FD00EE37C4 /* IGChannelAndGroupInfoSharedAudioAndVoiceTableViewCell.swift */; }; + 93CE90811EC4B93F002BFEC1 /* NVActivityIndicatorView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93CE90801EC4B93F002BFEC1 /* NVActivityIndicatorView.framework */; }; 93E181E41E77E7EE005C3593 /* IGChannelAndGroupInfoSharedMediaFileTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E181E31E77E7EE005C3593 /* IGChannelAndGroupInfoSharedMediaFileTableViewCell.swift */; }; + DF3EDEF64399AA713B2D0C2F /* IGRequestSignaling.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF3336180FA238BCCE8F3FB9 /* IGRequestSignaling.swift */; }; FA0953071E1B87E40043ED3F /* IGSettingStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA0953061E1B87E40043ED3F /* IGSettingStoryboard.storyboard */; }; FA0953401E1B97700043ED3F /* IGAccountTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09530E1E1B97700043ED3F /* IGAccountTableViewController.swift */; }; FA0953411E1B97700043ED3F /* IGActiveSessionObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09530F1E1B97700043ED3F /* IGActiveSessionObject.swift */; }; @@ -97,7 +100,6 @@ FA09536C1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09533A1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift */; }; FA09536D1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09533B1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift */; }; FA09536E1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionTerminateAllSessionsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09533C1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionTerminateAllSessionsTableViewCell.swift */; }; - FA09536F1E1B97700043ED3F /* IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09533D1E1B97700043ED3F /* IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift */; }; FA0953701E1B97700043ED3F /* IGSettingsChatStickersModalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09533E1E1B97700043ED3F /* IGSettingsChatStickersModalView.swift */; }; FA0953711E1B97700043ED3F /* IGSettingTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA09533F1E1B97700043ED3F /* IGSettingTableViewController.swift */; }; FA0953821E1B97E20043ED3F /* IGChooseContactToAddNewGroupTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA0953731E1B97E20043ED3F /* IGChooseContactToAddNewGroupTableViewCell.swift */; }; @@ -125,6 +127,11 @@ FA11E28D1DE99BF400A2F87C /* IGFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA11E28C1DE99BF400A2F87C /* IGFactory.swift */; }; FA1C449C1DC716A20016C346 /* IGCountry.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA1C449B1DC716A20016C346 /* IGCountry.swift */; }; FA2EBB941E2F44BD00BD8E9F /* Splash.gif in Resources */ = {isa = PBXBuildFile; fileRef = FA2EBB931E2F44BD00BD8E9F /* Splash.gif */; }; + FA3306361F445A570096031A /* IRANSans.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FA3306351F445A570096031A /* IRANSans.ttf */; }; + FA33063B1F445AE80096031A /* IRANSans_Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FA3306371F445AE80096031A /* IRANSans_Bold.ttf */; }; + FA33063C1F445AE80096031A /* IRANSans_Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FA3306381F445AE80096031A /* IRANSans_Light.ttf */; }; + FA33063D1F445AE90096031A /* IRANSans_Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FA3306391F445AE80096031A /* IRANSans_Medium.ttf */; }; + FA33063E1F445AE90096031A /* IRANSans_UltraLight.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FA33063A1F445AE80096031A /* IRANSans_UltraLight.ttf */; }; FA358D1E1E0A6F49001D0935 /* IGChatsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA358D1D1E0A6F49001D0935 /* IGChatsTableViewController.swift */; }; FA358D201E0A6F6A001D0935 /* IGGroupsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA358D1F1E0A6F6A001D0935 /* IGGroupsTableViewController.swift */; }; FA358D221E0A6F76001D0935 /* IGChannelsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA358D211E0A6F76001D0935 /* IGChannelsTableViewController.swift */; }; @@ -173,6 +180,8 @@ FA63BAB11DD70F36000B60AD /* IGRequestClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA63BAB01DD70F36000B60AD /* IGRequestClient.swift */; }; FA6791DC1DE41239003CFA4F /* IGErrorRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA6791DB1DE41239003CFA4F /* IGErrorRequest.swift */; }; FA68A2111DD9B0E9003A6651 /* IGRecentsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA68A2101DD9B0E9003A6651 /* IGRecentsTableViewController.swift */; }; + FA6A22761F41D0210063DF07 /* iGap-Fontico.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FA6A22751F41CB0B0063DF07 /* iGap-Fontico.ttf */; }; + FA6A22781F41D73E0063DF07 /* IGRequestQrCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA6A22771F41D73E0063DF07 /* IGRequestQrCode.swift */; }; FA77C2A71E2B85E4001B2152 /* IGRegistredUserInfoTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA77C2A61E2B85E4001B2152 /* IGRegistredUserInfoTableViewController.swift */; }; FA7A2ED31DF5830F00164435 /* IGRegisteredUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7A2ED21DF5830F00164435 /* IGRegisteredUser.swift */; }; FA8F224C1DD89910005A90D1 /* IGRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8F224B1DD89910005A90D1 /* IGRoom.swift */; }; @@ -188,6 +197,14 @@ FA96EF541DEB09A6009BE640 /* IGRequestChat.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA96EF531DEB09A6009BE640 /* IGRequestChat.swift */; }; FAA30F671DAA6F790061B8C9 /* IGWebSocketManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA30F661DAA6F790061B8C9 /* IGWebSocketManager.swift */; }; FAA932F51DF45748002CC631 /* IGEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA932F41DF45748002CC631 /* IGEnums.swift */; }; + FAA9DFB01F4B1B330076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFAF1F4B1B330076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift */; }; + FAA9DFB21F4B1B600076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFB11F4B1B600076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift */; }; + FAA9DFB41F4B1C200076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFB31F4B1C200076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift */; }; + FAA9DFB61F4B1CB50076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFB51F4B1CB50076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift */; }; + FAA9DFB81F4B1CC10076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFB71F4B1CC10076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift */; }; + FAA9DFBA1F4B1CC90076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFB91F4B1CC90076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift */; }; + FAA9DFBC1F4B1CD60076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFBB1F4B1CD60076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift */; }; + FAA9DFBE1F4B23390076A22F /* IGTwoStepVerification.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA9DFBD1F4B23380076A22F /* IGTwoStepVerification.swift */; }; FAAC57D31DE2CE9F00A28058 /* IGDownloadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAC57D21DE2CE9F00A28058 /* IGDownloadManager.swift */; }; FAB09D9B1DB76F81001A27C4 /* IGRequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB09D9A1DB76F81001A27C4 /* IGRequestManager.swift */; }; FAB2C2DF1DF7F6E8001F30B5 /* IGSessionInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAB2C2DE1DF7F6E8001F30B5 /* IGSessionInfo.swift */; }; @@ -212,13 +229,17 @@ FAD580971DDC61DD00A242DE /* IGMessageCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD580961DDC61DD00A242DE /* IGMessageCollectionView.swift */; }; FAD580991DDC67EB00A242DE /* IGMessageCollectionViewCellSizeCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD580981DDC67EB00A242DE /* IGMessageCollectionViewCellSizeCalculator.swift */; }; FAD94C701E0136D0006D8D91 /* IGMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD94C6F1E0136D0006D8D91 /* IGMedia.swift */; }; + FAD959051F48AD8600FBD306 /* MTBBarcodeScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = FAD959041F48AD8600FBD306 /* MTBBarcodeScanner.m */; }; + FAD959071F48D4EF00FBD306 /* IGSettingQrScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD959061F48D4EF00FBD306 /* IGSettingQrScannerViewController.swift */; }; FADE97B31DF2DBF100FF714A /* IGMusicPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FADE97B21DF2DBF100FF714A /* IGMusicPlayer.swift */; }; FAEA75D91DDAFFA200C387F1 /* IGRoomMessageLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEA75D81DDAFFA200C387F1 /* IGRoomMessageLocation.swift */; }; FAEA75DB1DDB012800C387F1 /* IGRoomMessageLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEA75DA1DDB012800C387F1 /* IGRoomMessageLog.swift */; }; FAEA75DD1DDB035400C387F1 /* IGRoomMessageContact.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEA75DC1DDB035400C387F1 /* IGRoomMessageContact.swift */; }; + FAEC02D71F439E47001EB4B6 /* IGRegistrationStepQrViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEC02D61F439E47001EB4B6 /* IGRegistrationStepQrViewController.swift */; }; FAEE8D8F1E30ABA100599600 /* IGClientCondition.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEE8D8E1E30ABA100599600 /* IGClientCondition.swift */; }; FAEEB0C11E1BC04E00B6775F /* IGContactManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEEB0C01E1BC04E00B6775F /* IGContactManager.swift */; }; FAEEB0C31E1BC11600B6775F /* IGContact.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEEB0C21E1BC11600B6775F /* IGContact.swift */; }; + FAF5D2E71F8D81A900A26EE1 /* SwiftProtobuf.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAF5D2E61F8D81A600A26EE1 /* SwiftProtobuf.framework */; }; FAF78EAD1E2EA77700C6F523 /* DBAttachmentPickerControllerLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAF78EAC1E2EA77700C6F523 /* DBAttachmentPickerControllerLibrary.framework */; }; FAF796051DAA392F0030509B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FAF796001DAA392F0030509B /* Assets.xcassets */; }; FAF796061DAA392F0030509B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FAF796011DAA392F0030509B /* LaunchScreen.storyboard */; }; @@ -249,6 +270,7 @@ /* Begin PBXFileReference section */ 4F9386F71EAE335200397C3B /* IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift; sourceTree = ""; }; 4F9F3E691EBA0D91008E05C1 /* IGPushResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGPushResponse.swift; sourceTree = ""; }; + 4FFCE29F1EEAF21400F7D0AE /* IGRegistrationStepPasswordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRegistrationStepPasswordViewController.swift; sourceTree = ""; }; 931585141E6D567000F4C04B /* IGUserPrivacy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGUserPrivacy.swift; sourceTree = ""; }; 93193F271E5811BA0039AC0C /* IGGroupInfoTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGGroupInfoTableViewController.swift; sourceTree = ""; }; 93193F291E5811FF0039AC0C /* IGGroupInfoEditNameTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGGroupInfoEditNameTableViewController.swift; sourceTree = ""; }; @@ -288,7 +310,9 @@ 93AA67CD1E4F407E0053380C /* IGChannelInfoMemberListTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChannelInfoMemberListTableViewCell.swift; sourceTree = ""; }; 93AA67CF1E4F40C80053380C /* IGChannelInfoAdminsTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChannelInfoAdminsTableViewCell.swift; sourceTree = ""; }; 93C299931E77D5FD00EE37C4 /* IGChannelAndGroupInfoSharedAudioAndVoiceTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChannelAndGroupInfoSharedAudioAndVoiceTableViewCell.swift; sourceTree = ""; }; + 93CE90801EC4B93F002BFEC1 /* NVActivityIndicatorView.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NVActivityIndicatorView.framework; path = Carthage/Build/iOS/NVActivityIndicatorView.framework; sourceTree = ""; }; 93E181E31E77E7EE005C3593 /* IGChannelAndGroupInfoSharedMediaFileTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChannelAndGroupInfoSharedMediaFileTableViewCell.swift; sourceTree = ""; }; + DF3336180FA238BCCE8F3FB9 /* IGRequestSignaling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRequestSignaling.swift; sourceTree = ""; }; FA0953061E1B87E40043ED3F /* IGSettingStoryboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = IGSettingStoryboard.storyboard; sourceTree = ""; }; FA09530E1E1B97700043ED3F /* IGAccountTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGAccountTableViewController.swift; sourceTree = ""; }; FA09530F1E1B97700043ED3F /* IGActiveSessionObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGActiveSessionObject.swift; sourceTree = ""; }; @@ -337,7 +361,6 @@ FA09533A1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift; sourceTree = ""; }; FA09533B1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift; sourceTree = ""; }; FA09533C1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionTerminateAllSessionsTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityActiveSessionTerminateAllSessionsTableViewCell.swift; sourceTree = ""; }; - FA09533D1E1B97700043ED3F /* IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift; sourceTree = ""; }; FA09533E1E1B97700043ED3F /* IGSettingsChatStickersModalView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingsChatStickersModalView.swift; sourceTree = ""; }; FA09533F1E1B97700043ED3F /* IGSettingTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingTableViewController.swift; sourceTree = ""; }; FA0953731E1B97E20043ED3F /* IGChooseContactToAddNewGroupTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChooseContactToAddNewGroupTableViewCell.swift; sourceTree = ""; }; @@ -366,6 +389,11 @@ FA11E28C1DE99BF400A2F87C /* IGFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGFactory.swift; sourceTree = ""; }; FA1C449B1DC716A20016C346 /* IGCountry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGCountry.swift; sourceTree = ""; }; FA2EBB931E2F44BD00BD8E9F /* Splash.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Splash.gif; sourceTree = ""; }; + FA3306351F445A570096031A /* IRANSans.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = IRANSans.ttf; sourceTree = ""; }; + FA3306371F445AE80096031A /* IRANSans_Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = IRANSans_Bold.ttf; sourceTree = ""; }; + FA3306381F445AE80096031A /* IRANSans_Light.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = IRANSans_Light.ttf; sourceTree = ""; }; + FA3306391F445AE80096031A /* IRANSans_Medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = IRANSans_Medium.ttf; sourceTree = ""; }; + FA33063A1F445AE80096031A /* IRANSans_UltraLight.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = IRANSans_UltraLight.ttf; sourceTree = ""; }; FA358D1D1E0A6F49001D0935 /* IGChatsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChatsTableViewController.swift; sourceTree = ""; }; FA358D1F1E0A6F6A001D0935 /* IGGroupsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGGroupsTableViewController.swift; sourceTree = ""; }; FA358D211E0A6F76001D0935 /* IGChannelsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGChannelsTableViewController.swift; sourceTree = ""; }; @@ -417,6 +445,8 @@ FA63BAB01DD70F36000B60AD /* IGRequestClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRequestClient.swift; sourceTree = ""; }; FA6791DB1DE41239003CFA4F /* IGErrorRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGErrorRequest.swift; sourceTree = ""; }; FA68A2101DD9B0E9003A6651 /* IGRecentsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRecentsTableViewController.swift; sourceTree = ""; }; + FA6A22751F41CB0B0063DF07 /* iGap-Fontico.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "iGap-Fontico.ttf"; sourceTree = ""; }; + FA6A22771F41D73E0063DF07 /* IGRequestQrCode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRequestQrCode.swift; sourceTree = ""; }; FA752C321E1EC571008694C6 /* iGap.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = iGap.entitlements; path = ../iGap.entitlements; sourceTree = ""; }; FA77C2A61E2B85E4001B2152 /* IGRegistredUserInfoTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRegistredUserInfoTableViewController.swift; sourceTree = ""; }; FA7A2ED21DF5830F00164435 /* IGRegisteredUser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRegisteredUser.swift; sourceTree = ""; }; @@ -433,6 +463,14 @@ FA96EF531DEB09A6009BE640 /* IGRequestChat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRequestChat.swift; sourceTree = ""; }; FAA30F661DAA6F790061B8C9 /* IGWebSocketManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IGWebSocketManager.swift; path = "WebSocket Manager/IGWebSocketManager.swift"; sourceTree = ""; }; FAA932F41DF45748002CC631 /* IGEnums.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IGEnums.swift; path = ../Model/Objects/IGEnums.swift; sourceTree = ""; }; + FAA9DFAF1F4B1B330076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift; sourceTree = ""; }; + FAA9DFB11F4B1B600076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift; sourceTree = ""; }; + FAA9DFB31F4B1C200076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift; sourceTree = ""; }; + FAA9DFB51F4B1CB50076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift; sourceTree = ""; }; + FAA9DFB71F4B1CC10076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift; sourceTree = ""; }; + FAA9DFB91F4B1CC90076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift; sourceTree = ""; }; + FAA9DFBB1F4B1CD60076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift; sourceTree = ""; }; + FAA9DFBD1F4B23380076A22F /* IGTwoStepVerification.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGTwoStepVerification.swift; sourceTree = ""; }; FAAC57D21DE2CE9F00A28058 /* IGDownloadManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGDownloadManager.swift; sourceTree = ""; }; FAB09D9A1DB76F81001A27C4 /* IGRequestManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IGRequestManager.swift; path = "Request Manager/IGRequestManager.swift"; sourceTree = ""; }; FAB2C2DE1DF7F6E8001F30B5 /* IGSessionInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSessionInfo.swift; sourceTree = ""; }; @@ -457,13 +495,18 @@ FAD580961DDC61DD00A242DE /* IGMessageCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGMessageCollectionView.swift; sourceTree = ""; }; FAD580981DDC67EB00A242DE /* IGMessageCollectionViewCellSizeCalculator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGMessageCollectionViewCellSizeCalculator.swift; sourceTree = ""; }; FAD94C6F1E0136D0006D8D91 /* IGMedia.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGMedia.swift; sourceTree = ""; }; + FAD959031F48AD8600FBD306 /* MTBBarcodeScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTBBarcodeScanner.h; sourceTree = ""; }; + FAD959041F48AD8600FBD306 /* MTBBarcodeScanner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTBBarcodeScanner.m; sourceTree = ""; }; + FAD959061F48D4EF00FBD306 /* IGSettingQrScannerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGSettingQrScannerViewController.swift; sourceTree = ""; }; FADE97B21DF2DBF100FF714A /* IGMusicPlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGMusicPlayer.swift; sourceTree = ""; }; FAEA75D81DDAFFA200C387F1 /* IGRoomMessageLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRoomMessageLocation.swift; sourceTree = ""; }; FAEA75DA1DDB012800C387F1 /* IGRoomMessageLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRoomMessageLog.swift; sourceTree = ""; }; FAEA75DC1DDB035400C387F1 /* IGRoomMessageContact.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRoomMessageContact.swift; sourceTree = ""; }; + FAEC02D61F439E47001EB4B6 /* IGRegistrationStepQrViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGRegistrationStepQrViewController.swift; sourceTree = ""; }; FAEE8D8E1E30ABA100599600 /* IGClientCondition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGClientCondition.swift; sourceTree = ""; }; FAEEB0C01E1BC04E00B6775F /* IGContactManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGContactManager.swift; sourceTree = ""; }; FAEEB0C21E1BC11600B6775F /* IGContact.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IGContact.swift; sourceTree = ""; }; + FAF5D2E61F8D81A600A26EE1 /* SwiftProtobuf.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftProtobuf.framework; path = Carthage/Build/iOS/SwiftProtobuf.framework; sourceTree = ""; }; FAF78EAC1E2EA77700C6F523 /* DBAttachmentPickerControllerLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DBAttachmentPickerControllerLibrary.framework; path = Carthage/Build/iOS/DBAttachmentPickerControllerLibrary.framework; sourceTree = ""; }; FAF795EA1DAA330C0030509B /* iGap.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iGap.app; sourceTree = BUILT_PRODUCTS_DIR; }; FAF796001DAA392F0030509B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -523,6 +566,8 @@ FAC42C861E36267400F2CB5C /* Crashlytics.framework in Frameworks */, FAF985B21E2E10EC00B26940 /* SnapKit.framework in Frameworks */, FAF985B51E2E10EC00B26940 /* SwiftyRSA.framework in Frameworks */, + 93CE90811EC4B93F002BFEC1 /* NVActivityIndicatorView.framework in Frameworks */, + FAF5D2E71F8D81A900A26EE1 /* SwiftProtobuf.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -581,6 +626,7 @@ FA0953081E1B88660043ED3F /* Setting */ = { isa = PBXGroup; children = ( + FAA9DFAE1F4B1B330076A22F /* TwoStep Verification */, FA09530E1E1B97700043ED3F /* IGAccountTableViewController.swift */, FA09530F1E1B97700043ED3F /* IGActiveSessionObject.swift */, FA0953101E1B97700043ED3F /* IGActiveSessionsParentCell.swift */, @@ -628,10 +674,10 @@ FA09533A1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift */, FA09533B1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift */, FA09533C1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionTerminateAllSessionsTableViewCell.swift */, - FA09533D1E1B97700043ED3F /* IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift */, FA09533E1E1B97700043ED3F /* IGSettingsChatStickersModalView.swift */, FA09533F1E1B97700043ED3F /* IGSettingTableViewController.swift */, 9366D98B1E363C2400998BA3 /* IGSettingAboutWebViewViewController.swift */, + FAD959061F48D4EF00FBD306 /* IGSettingQrScannerViewController.swift */, ); path = Setting; sourceTree = ""; @@ -696,6 +742,7 @@ FA2EBB911E2F44BD00BD8E9F /* Assets */ = { isa = PBXGroup; children = ( + FA6A22741F41CAFB0063DF07 /* Fonts */, FA2EBB921E2F44BD00BD8E9F /* Gif */, ); path = Assets; @@ -789,6 +836,8 @@ FA50A8C81DD35EFD00C6D2EA /* IGRegistrationStepProfileInfoViewController.swift */, FA50A8C91DD35EFD00C6D2EA /* IGRegistrationStepSelectCountryTableViewController.swift */, FA50A8CA1DD35EFD00C6D2EA /* IGRegistrationStepTermsViewController.swift */, + 4FFCE29F1EEAF21400F7D0AE /* IGRegistrationStepPasswordViewController.swift */, + FAEC02D61F439E47001EB4B6 /* IGRegistrationStepQrViewController.swift */, ); path = "Splash and Register"; sourceTree = ""; @@ -850,6 +899,8 @@ FA63BAA81DD70E77000B60AD /* IGRequestInfo.swift */, FA63BAA21DD70D94000B60AD /* IGRequestSystem.swift */, FA63BAA61DD70E1A000B60AD /* IGRequestUser.swift */, + FA6A22771F41D73E0063DF07 /* IGRequestQrCode.swift */, + DF3336180FA238BCCE8F3FB9 /* IGRequestSignaling.swift */, 4F9F3E691EBA0D91008E05C1 /* IGPushResponse.swift */, ); path = Requests; @@ -866,6 +917,19 @@ path = "Tabbar Sub Controllers"; sourceTree = ""; }; + FA6A22741F41CAFB0063DF07 /* Fonts */ = { + isa = PBXGroup; + children = ( + FA6A22751F41CB0B0063DF07 /* iGap-Fontico.ttf */, + FA3306351F445A570096031A /* IRANSans.ttf */, + FA3306371F445AE80096031A /* IRANSans_Bold.ttf */, + FA3306381F445AE80096031A /* IRANSans_Light.ttf */, + FA3306391F445AE80096031A /* IRANSans_Medium.ttf */, + FA33063A1F445AE80096031A /* IRANSans_UltraLight.ttf */, + ); + path = Fonts; + sourceTree = ""; + }; FA77C2A51E2B85D2001B2152 /* Chat and User Info */ = { isa = PBXGroup; children = ( @@ -886,6 +950,7 @@ FA7A2ED21DF5830F00164435 /* IGRegisteredUser.swift */, FAEEB0C21E1BC11600B6775F /* IGContact.swift */, FAEE8D8E1E30ABA100599600 /* IGClientCondition.swift */, + FAA9DFBD1F4B23380076A22F /* IGTwoStepVerification.swift */, ); path = Objects; sourceTree = ""; @@ -893,6 +958,7 @@ FA930D961E5B178F00069EE1 /* ThirdParty Libraries */ = { isa = PBXGroup; children = ( + FAD959021F48AD8600FBD306 /* MTBBarcodeScanner */, FA0CC8101E5DD99400556283 /* Thread */, FA0CC7FF1E5D7D4400556283 /* ActiveLabel */, FA42EF121E5C593500CF8A32 /* TTTAttributedLabel */, @@ -947,6 +1013,20 @@ path = Managers; sourceTree = ""; }; + FAA9DFAE1F4B1B330076A22F /* TwoStep Verification */ = { + isa = PBXGroup; + children = ( + FAA9DFAF1F4B1B330076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift */, + FAA9DFB11F4B1B600076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift */, + FAA9DFB31F4B1C200076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift */, + FAA9DFB51F4B1CB50076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift */, + FAA9DFB71F4B1CC10076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift */, + FAA9DFB91F4B1CC90076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift */, + FAA9DFBB1F4B1CD60076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift */, + ); + path = "TwoStep Verification"; + sourceTree = ""; + }; FAD530561E0BD6C300FE6C54 /* Custom Master Controllers */ = { isa = PBXGroup; children = ( @@ -967,8 +1047,8 @@ FAD5305F1E0BD80800FE6C54 /* NavigationController */ = { isa = PBXGroup; children = ( - FAD530601E0BD80800FE6C54 /* IGNavigationBar.swift */, FAD530611E0BD80800FE6C54 /* IGNavigationController.swift */, + FAD530601E0BD80800FE6C54 /* IGNavigationBar.swift */, FAD530641E0BDE2A00FE6C54 /* IGNavigationItem.swift */, ); path = NavigationController; @@ -988,7 +1068,6 @@ isa = PBXGroup; children = ( FAD580801DDC48F500A242DE /* Controller */, - FAD580811DDC48F500A242DE /* Factories */, FAD580821DDC48F500A242DE /* Layout */, FAD580831DDC48F500A242DE /* Model */, FAD580841DDC48F500A242DE /* View */, @@ -1004,13 +1083,6 @@ path = Controller; sourceTree = ""; }; - FAD580811DDC48F500A242DE /* Factories */ = { - isa = PBXGroup; - children = ( - ); - path = Factories; - sourceTree = ""; - }; FAD580821DDC48F500A242DE /* Layout */ = { isa = PBXGroup; children = ( @@ -1042,6 +1114,15 @@ path = View; sourceTree = ""; }; + FAD959021F48AD8600FBD306 /* MTBBarcodeScanner */ = { + isa = PBXGroup; + children = ( + FAD959031F48AD8600FBD306 /* MTBBarcodeScanner.h */, + FAD959041F48AD8600FBD306 /* MTBBarcodeScanner.m */, + ); + path = MTBBarcodeScanner; + sourceTree = ""; + }; FAF795E11DAA330C0030509B = { isa = PBXGroup; children = ( @@ -1127,6 +1208,8 @@ FAF985881E2E10EC00B26940 /* Frameworks */ = { isa = PBXGroup; children = ( + FAF5D2E61F8D81A600A26EE1 /* SwiftProtobuf.framework */, + 93CE90801EC4B93F002BFEC1 /* NVActivityIndicatorView.framework */, 931DC8C81E388418008F04A9 /* CoreLocation.framework */, FAC42C831E36267400F2CB5C /* Fabric.framework */, FAC42C841E36267400F2CB5C /* Crashlytics.framework */, @@ -1228,12 +1311,18 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + FA33063D1F445AE90096031A /* IRANSans_Medium.ttf in Resources */, FAD580951DDC5C4E00A242DE /* IGMessageCollectionViewCell.xib in Resources */, + FA33063C1F445AE80096031A /* IRANSans_Light.ttf in Resources */, 937455F91E63021E007694CE /* IGForwardMessageAudioAndVoiceAttachment.xib in Resources */, + FA6A22761F41D0210063DF07 /* iGap-Fontico.ttf in Resources */, + FA33063E1F445AE90096031A /* IRANSans_UltraLight.ttf in Resources */, FAD57EE21E191DB000FC17D9 /* IGMessageLogCollectionViewCell.xib in Resources */, FA0953071E1B87E40043ED3F /* IGSettingStoryboard.storyboard in Resources */, FA5EC5DB1E06728C006E2850 /* IGChatRoomListTableViewCell.xib in Resources */, FAF796071DAA392F0030509B /* Main.storyboard in Resources */, + FA33063B1F445AE80096031A /* IRANSans_Bold.ttf in Resources */, + FA3306361F445A570096031A /* IRANSans.ttf in Resources */, FAF7960A1DAA39460030509B /* Info.plist in Resources */, FA4BD8A41DF2A53400CCB239 /* IGMusicViewController.xib in Resources */, FA2EBB941E2F44BD00BD8E9F /* Splash.gif in Resources */, @@ -1259,7 +1348,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "@see https://fabric.io/kits/ios/crashlytics/install"; + shellScript = "./Fabric.framework/run a8bb9474c4f59357347dbd3fd5707ca541e2a740 73c66be76fb6cd1becc07ca6b9a77d9dd134ff35089fe7aa02dbfa33ad57b654"; }; FADF684C1DB2607B00DC5038 /* [RS] Set Build Number */ = { isa = PBXShellScriptBuildPhase; @@ -1273,7 +1362,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#!/bin/bash\n# Set the build number to the count of Git commits\n#buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')\n#/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\""; + shellScript = "#!/bin/bash\n# Set the build number to the count of Git commits\npreviousCommits=400\ncommitsCount=$(git rev-list HEAD | wc -l | tr -d ' ')\nbuildNumber=$(expr \"$previousCommits\" + \"$commitsCount\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\""; }; FAF985B71E2E110900B26940 /* [RS] Copy Carthage Frameworks */ = { isa = PBXShellScriptBuildPhase; @@ -1302,6 +1391,8 @@ "$(SRCROOT)/Carthage/Build/iOS/SwiftyRSA.framework", "$(SRCROOT)/Carthage/Build/iOS/DBAttachmentPickerControllerLibrary.framework", "$(SRCROOT)/Carthage/Build/iOS/IGProtoBuff.framework", + "$(SRCROOT)/Carthage/Build/iOS/NVActivityIndicatorView.framework", + "$(SRCROOT)/Carthage/Build/iOS/SwiftProtobuf.framework", ); name = "[RS] Copy Carthage Frameworks"; outputPaths = ( @@ -1334,9 +1425,12 @@ FA42EF0A1E5C224F00CF8A32 /* FrameStore.swift in Sources */, FA0CC8091E5D7D4400556283 /* ActiveType.swift in Sources */, FAD530621E0BD80800FE6C54 /* IGNavigationBar.swift in Sources */, + FAD959071F48D4EF00FBD306 /* IGSettingQrScannerViewController.swift in Sources */, + FAEC02D71F439E47001EB4B6 /* IGRegistrationStepQrViewController.swift in Sources */, FAEEB0C31E1BC11600B6775F /* IGContact.swift in Sources */, FA0953491E1B97700043ED3F /* IGSetNickNameTableViewController.swift in Sources */, FA63BAAB1DD70E9C000B60AD /* IGRequestFile.swift in Sources */, + FAA9DFB81F4B1CC10076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift in Sources */, FA0953451E1B97700043ED3F /* IGDeleteAccountTableViewController.swift in Sources */, FA0953601E1B97700043ED3F /* IGSettingContactsBlockListTableViewCell.swift in Sources */, FA8F22581DD89F7C005A90D1 /* IGAvatar.swift in Sources */, @@ -1351,12 +1445,14 @@ FA09538E1E1B97E20043ED3F /* SSRadioButton.swift in Sources */, FA0953511E1B97700043ED3F /* IGSettingChatClearChacheTableViewController.swift in Sources */, FA42EF0D1E5C224F00CF8A32 /* Array.swift in Sources */, + 4FFCE2A01EEAF21400F7D0AE /* IGRegistrationStepPasswordViewController.swift in Sources */, FA09538C1E1B97E20043ED3F /* IGNewGroupBottomViewCollectionCell.swift in Sources */, FA96EF4E1DEB0431009BE640 /* IGMessageSender.swift in Sources */, FA0953431E1B97700043ED3F /* IGDeleteAccountConfirmationTableViewController.swift in Sources */, FA09538A1E1B97E20043ED3F /* IGCreateNewGroupTableViewController.swift in Sources */, FA63BAA01DD70D60000B60AD /* IGRequestWrapper.swift in Sources */, FA42EF111E5C224F00CF8A32 /* ImageSourceHelpers.swift in Sources */, + FAA9DFBA1F4B1CC90076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift in Sources */, FAB09D9B1DB76F81001A27C4 /* IGRequestManager.swift in Sources */, FA0953471E1B97700043ED3F /* IGPrivacyAndSecurityWhoCanSeeTableViewController.swift in Sources */, FA41C6F01DC9DFD600598383 /* IGGlobal.swift in Sources */, @@ -1386,6 +1482,7 @@ FAB2C2DF1DF7F6E8001F30B5 /* IGSessionInfo.swift in Sources */, 931585151E6D567000F4C04B /* IGUserPrivacy.swift in Sources */, FA0953831E1B97E20043ED3F /* IGChooseMemberFromContactsToCreateGroup.swift in Sources */, + FAA9DFB41F4B1C200076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift in Sources */, 93193F2C1E5812420039AC0C /* IGGroupEditDescriptionTableViewController.swift in Sources */, FA09535D1E1B97700043ED3F /* IGSettingChooseContactToAddToBlockListTableViewController.swift in Sources */, FA09538D1E1B97E20043ED3F /* IGAddNewContactTableViewCell.swift in Sources */, @@ -1412,10 +1509,12 @@ FA50A8CE1DD35EFD00C6D2EA /* IGRegistrationStepProfileInfoViewController.swift in Sources */, 937455FB1E63F77F007694CE /* IGForwardMessageAudioAndVoiceAttachmentView.swift in Sources */, FA5EC5E11E069A1E006E2850 /* IGTextAttachment.swift in Sources */, + FAD959051F48AD8600FBD306 /* MTBBarcodeScanner.m in Sources */, FA42EF081E5C224F00CF8A32 /* AnimatedFrame.swift in Sources */, FA0953581E1B97700043ED3F /* IGSettingChatWallpaperLibraryCollectionViewController.swift in Sources */, FA09536C1E1B97700043ED3F /* IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift in Sources */, FA0953641E1B97700043ED3F /* IGSettingHaveCheckmarkOntheLeftTableViewController.swift in Sources */, + FA6A22781F41D73E0063DF07 /* IGRequestQrCode.swift in Sources */, FA63BAA31DD70D94000B60AD /* IGRequestSystem.swift in Sources */, FA42EEF81E5C205D00CF8A32 /* IGImageView.swift in Sources */, 93AA67D01E4F40C80053380C /* IGChannelInfoAdminsTableViewCell.swift in Sources */, @@ -1447,6 +1546,7 @@ FAEA75DB1DDB012800C387F1 /* IGRoomMessageLog.swift in Sources */, FAA30F671DAA6F790061B8C9 /* IGWebSocketManager.swift in Sources */, FAA932F51DF45748002CC631 /* IGEnums.swift in Sources */, + FAA9DFB61F4B1CB50076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift in Sources */, FAD580941DDC5C4E00A242DE /* IGMessageCollectionViewCell.swift in Sources */, FA0953561E1B97700043ED3F /* IGSettingChatTableViewController.swift in Sources */, FAD5808F1DDC5C1900A242DE /* IGMessageGeneralCollectionViewCell.swift in Sources */, @@ -1474,6 +1574,7 @@ FAEEB0C11E1BC04E00B6775F /* IGContactManager.swift in Sources */, 93AA67C61E4F38620053380C /* IGChannelInfoSharedMediaDetailTableViewController.swift in Sources */, 93193F361E5814570039AC0C /* IGGroupInfoAdminsAndModeratorsListTableViewController.swift in Sources */, + FAA9DFBC1F4B1CD60076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift in Sources */, FA09535F1E1B97700043ED3F /* IGSettingContactBlockTableViewCell.swift in Sources */, FA42EF0B1E5C224F00CF8A32 /* GIFAnimatable.swift in Sources */, 93AA67CC1E4F40260053380C /* IGChannelInfoMemberListInviteLinkTableViewCell.swift in Sources */, @@ -1496,6 +1597,7 @@ 93AA67BE1E4F35770053380C /* IGChannelInfoEditDescriptionTableViewController.swift in Sources */, 93193F381E5814980039AC0C /* IGGroupInfoAdminListTableViewController.swift in Sources */, FA63BAAD1DD70F09000B60AD /* IGRequestGroup.swift in Sources */, + FAA9DFBE1F4B23390076A22F /* IGTwoStepVerification.swift in Sources */, FA09534B1E1B97700043ED3F /* IGSettingAccountPhoneNumberTableViewController.swift in Sources */, FAD580861DDC49A200A242DE /* IGMessageViewController.swift in Sources */, 93AA67CE1E4F407E0053380C /* IGChannelInfoMemberListTableViewCell.swift in Sources */, @@ -1512,12 +1614,14 @@ 93321E7C1E5C12A3004D4454 /* IGForwardContactsTableViewCell.swift in Sources */, FA0CC8121E5DD99400556283 /* Thread.swift in Sources */, FA50A8CD1DD35EFD00C6D2EA /* IGRegistrationStepPhoneViewController.swift in Sources */, - FA09536F1E1B97700043ED3F /* IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift in Sources */, + FAA9DFB01F4B1B330076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift in Sources */, FA8F224E1DD89AC5005A90D1 /* IGRoomMessage.swift in Sources */, FA0953871E1B97E20043ED3F /* IGCreateNewChannelTableViewController.swift in Sources */, FAD530631E0BD80800FE6C54 /* IGNavigationController.swift in Sources */, FAAC57D31DE2CE9F00A28058 /* IGDownloadManager.swift in Sources */, FA358D201E0A6F6A001D0935 /* IGGroupsTableViewController.swift in Sources */, + DF3EDEF64399AA713B2D0C2F /* IGRequestSignaling.swift in Sources */, + FAA9DFB21F4B1B600076A22F /* IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1647,6 +1751,7 @@ CODE_SIGN_ENTITLEMENTS = iGap/iGap.entitlements; CODE_SIGN_IDENTITY = "iPhone Distribution: RooyeKhat Media (MZ7XTDD264)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = MZ7XTDD264; FRAMEWORK_SEARCH_PATHS = ( @@ -1660,7 +1765,7 @@ ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = net.iGap; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "45f83c5e-152b-4a01-9a04-dcfa5bc973b4"; + PROVISIONING_PROFILE = "5cf7b122-99b1-4f8a-8b4f-6dfec169b3e8"; PROVISIONING_PROFILE_SPECIFIER = RooyeKhat; SWIFT_OBJC_BRIDGING_HEADER = "iGap/Supporting FIles/iGap-Bridging-Header.h"; SWIFT_VERSION = 3.0; @@ -1673,7 +1778,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = iGap/iGap.entitlements; CODE_SIGN_IDENTITY = "iPhone Distribution: RooyeKhat Media (MZ7XTDD264)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = MZ7XTDD264; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1686,8 +1792,8 @@ LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = net.iGap; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "56503802-988c-4251-a13f-d9fe4bef21a9"; - PROVISIONING_PROFILE_SPECIFIER = iGap; + PROVISIONING_PROFILE = "5cf7b122-99b1-4f8a-8b4f-6dfec169b3e8"; + PROVISIONING_PROFILE_SPECIFIER = RooyeKhat; SWIFT_OBJC_BRIDGING_HEADER = "iGap/Supporting FIles/iGap-Bridging-Header.h"; SWIFT_VERSION = 3.0; }; diff --git a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationBar.swift b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationBar.swift index 625c6b4..6576856 100644 --- a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationBar.swift +++ b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationBar.swift @@ -14,10 +14,10 @@ class IGNavigationBar: UINavigationBar, UINavigationBarDelegate { override func awakeFromNib() { super.awakeFromNib() - self.tintColor = UIColor.organizationalColor() + self.tintColor = UIColor.white self.isTranslucent = false //self.barStyle = .black - self.barTintColor = UIColor.white + self.barTintColor = UIColor.organizationalColor() self.layer.shadowColor = UIColor.darkGray.cgColor self.layer.shadowOffset = CGSize(width: 2.0, height: 2.0) self.layer.shadowRadius = 4.0 @@ -31,10 +31,10 @@ class IGNavigationBar: UINavigationBar, UINavigationBarDelegate { override func layoutSubviews() { super.layoutSubviews() - + for items in self.items! { if items.leftBarButtonItems != nil { - + for item in items.leftBarButtonItems! { item.setBackgroundVerticalPositionAdjustment(-100, for: .default) item.setBackgroundVerticalPositionAdjustment(-100, for: .compact) @@ -49,10 +49,35 @@ class IGNavigationBar: UINavigationBar, UINavigationBarDelegate { //barButton.imageInsets = UIEdgeInsetsMake(0.0, -20, 50, 0) //item.imageInsets = UIEdgeInsetsMake(0.0, -20, 50, 0) } + +// super.layoutSubviews() +// +// frame = CGRect(x: frame.origin.x, y: 0, width: frame.size.width, height: 56.0) +// +// // title position (statusbar height / 2) +// setTitleVerticalPositionAdjustment(-10, for: UIBarMetrics.default) +// +// for subview in self.subviews { +// var stringFromClass = NSStringFromClass(subview.classForCoder) +// if stringFromClass.contains("BarBackground") { +// subview.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: 56.0) +// subview.backgroundColor = .yellow +// +// } +// +// stringFromClass = NSStringFromClass(subview.classForCoder) +// if stringFromClass.contains("BarContent") { +// +// subview.frame = CGRect(x: subview.frame.origin.x, y: 20, width: subview.frame.width, height: 56.0) +// +// subview.backgroundColor = UIColor(red: 20/255, green: 20/255, blue: 20/255, alpha: 0.4) +// +// } +// } } - override func sizeThatFits(_ size: CGSize) -> CGSize { - let newSize :CGSize = CGSize(width: UIScreen.main.bounds.width, height: 56) - return newSize - } +// override func sizeThatFits(_ size: CGSize) -> CGSize { +// let newSize :CGSize = CGSize(width: UIScreen.main.bounds.width, height: 156) +// return newSize +// } } diff --git a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationController.swift b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationController.swift index f284ba2..bf81fb3 100644 --- a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationController.swift +++ b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationController.swift @@ -10,11 +10,17 @@ import UIKit -class IGNavigationController: UINavigationController ,UINavigationBarDelegate { +class IGNavigationController: UINavigationController, UINavigationBarDelegate { override func viewDidLoad() { super.viewDidLoad() - addShadowToBar() +// addShadowToBar() + + +// self.setNavigationBarHidden(true, animated: false) +// let customNavigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 64)) +// self.view.addSubview(customNavigationBar) + self.navigationBar.topItem?.backBarButtonItem?.setTitlePositionAdjustment(UIOffset(horizontal: 0, vertical: 50), for: UIBarMetrics.default) } @@ -32,128 +38,129 @@ class IGNavigationController: UINavigationController ,UINavigationBarDelegate { } - override func viewDidAppear(_ animated: Bool) { - UIApplication.shared.statusBarStyle = .default - // self.navigationBar.topItem?.backBarButtonItem?.backButtonTitlePositionAdjustment(for: UIBarMetrics.compactPrompt) - // self.navigationBar.topItem?.backBarButtonItem?.backButtonBackgroundVerticalPositionAdjustment(for: UIBarMetrics.compactPrompt) - // self.navigationBar.backItem. - let cancelBtn = UIButton() - cancelBtn.frame = CGRect(x: 8, y: 0, width: 60, height: 60) - cancelBtn.backgroundColor = UIColor.yellow - let topLeftbarButtonItem = UIBarButtonItem(customView: cancelBtn) - self.navigationBar.topItem?.backBarButtonItem = topLeftbarButtonItem - } - - - func addShadowToBar() { - self.navigationBar.layer.shadowColor = UIColor.darkGray.cgColor - self.navigationBar.layer.shadowOffset = CGSize(width: 2.0, height: 2.0) - self.navigationBar.layer.shadowRadius = 4.0 - self.navigationBar.layer.shadowOpacity = 0.35 - } - - func setRightBarButtonItem(rightBarButton : UIButton, rightBarButtonImage:UIImage?=nil){ -// if rightBarButtonImage != nil { -// rightBarButton.setImage(rightBarButtonImage, for: UIControlState.normal) -// //set frame - rightBarButton.frame = CGRect(x:0,y: 0,width: 40, height:40) - roundUserImage(rightBarButton) -// }else{ -// rightBarButton.setTitle("Done", for: .normal) -// rightBarButton.setTitleColor(UIColor.red, for: .normal) -// rightBarButton.frame = CGRect(x:0,y: 0,width: 60, height:60) -// } - let barButton = UIBarButtonItem(customView: rightBarButton) - self.navigationBar.topItem?.rightBarButtonItem = barButton - } - - - func roundUserImage(_ Button:UIButton){ - Button.layer.borderWidth = 0 - Button.layer.masksToBounds = true - let borderUserImageColor = UIColor.organizationalColor() - Button.layer.borderColor = borderUserImageColor.cgColor - Button.layer.cornerRadius = Button.frame.size.height/2 - Button.clipsToBounds = true - } - - func setTitleView(_ titleView : UIView){ - titleView.backgroundColor = UIColor.yellow - self.navigationItem.titleView = titleView - self.navigationBar.topItem?.titleView = titleView - - - } - - - func setCenterView() { - let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 45)) - let nameLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 21)) - nameLabel.text = "John Smith" - nameLabel.textAlignment = .center - nameLabel.font = UIFont.boldSystemFont(ofSize: 16) - let lastSeenStatusLabel = UILabel(frame: CGRect(x: 0, y: 22, width: 150, height: 21)) - lastSeenStatusLabel.text = "Online" - lastSeenStatusLabel.textColor = UIColor.organizationalColor() - lastSeenStatusLabel.textAlignment = .center - lastSeenStatusLabel.font = UIFont.boldSystemFont(ofSize: 9) - titleView.addSubview(nameLabel) - titleView.addSubview(lastSeenStatusLabel) - self.navigationBar.topItem?.titleView = titleView - } - - func getHightOfNavigationBar()->(CGFloat) { - let navBarHeight = self.navigationBar.frame.size.height - return navBarHeight - } - - func connectingTitleView() { - let connectingTitleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 30)) - let activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 30, height: 30)) - connectingTitleView.addSubview(activityIndicator) - activityIndicator.startAnimating() - let textLabel = UILabel(frame: CGRect(x: 30, y: 5, width: 100, height: 21)) - textLabel.text = "Connecting.." - textLabel.textColor = UIColor.black - connectingTitleView.addSubview(textLabel) - activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray - self.navigationBar.topItem?.titleView = connectingTitleView - - } - func updatingTitleView(){ - let updatingTitleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 30)) - let activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 30, height: 30)) - updatingTitleView.addSubview(activityIndicator) - activityIndicator.startAnimating() - let textLabel = UILabel(frame: CGRect(x: 30, y: 5, width: 100, height: 21)) - textLabel.text = "Updating.." - textLabel.textColor = UIColor.black - updatingTitleView.addSubview(textLabel) - activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray - self.navigationBar.topItem?.titleView = updatingTitleView - } +// override func viewDidAppear(_ animated: Bool) { +// UIApplication.shared.statusBarStyle = .default +// // self.navigationBar.topItem?.backBarButtonItem?.backButtonTitlePositionAdjustment(for: UIBarMetrics.compactPrompt) +// // self.navigationBar.topItem?.backBarButtonItem?.backButtonBackgroundVerticalPositionAdjustment(for: UIBarMetrics.compactPrompt) +// // self.navigationBar.backItem. +// let cancelBtn = UIButton() +// cancelBtn.frame = CGRect(x: 8, y: 0, width: 60, height: 60) +// cancelBtn.backgroundColor = UIColor.yellow +// let topLeftbarButtonItem = UIBarButtonItem(customView: cancelBtn) +// self.navigationBar.topItem?.backBarButtonItem = topLeftbarButtonItem +// } + + +// func addShadowToBar() { +// self.navigationBar.layer.shadowColor = UIColor.darkGray.cgColor +// self.navigationBar.layer.shadowOffset = CGSize(width: 2.0, height: 2.0) +// self.navigationBar.layer.shadowRadius = 4.0 +// self.navigationBar.layer.shadowOpacity = 0.35 +// } + +// func setRightBarButtonItem(rightBarButton : UIButton, rightBarButtonImage:UIImage?=nil){ +//// if rightBarButtonImage != nil { +//// rightBarButton.setImage(rightBarButtonImage, for: UIControlState.normal) +//// //set frame +// rightBarButton.frame = CGRect(x:0,y: 0,width: 40, height:40) +// roundUserImage(rightBarButton) +//// }else{ +//// rightBarButton.setTitle("Done", for: .normal) +//// rightBarButton.setTitleColor(UIColor.red, for: .normal) +//// rightBarButton.frame = CGRect(x:0,y: 0,width: 60, height:60) +//// } +// let barButton = UIBarButtonItem(customView: rightBarButton) +// self.navigationBar.topItem?.rightBarButtonItem = barButton +// } +// +// +// func roundUserImage(_ Button:UIButton){ +// Button.layer.borderWidth = 0 +// Button.layer.masksToBounds = true +// let borderUserImageColor = UIColor.organizationalColor() +// Button.layer.borderColor = borderUserImageColor.cgColor +// Button.layer.cornerRadius = Button.frame.size.height/2 +// Button.clipsToBounds = true +// } +// +// func setTitleView(_ titleView : UIView){ +// titleView.backgroundColor = UIColor.yellow +// self.navigationItem.titleView = titleView +// self.navigationBar.topItem?.titleView = titleView +// +// +// } + + +// func setCenterView() { +// let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 45)) +// let nameLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 21)) +// nameLabel.text = "John Smith" +// nameLabel.textAlignment = .center +// nameLabel.font = UIFont.boldSystemFont(ofSize: 16) +// let lastSeenStatusLabel = UILabel(frame: CGRect(x: 0, y: 22, width: 150, height: 21)) +// lastSeenStatusLabel.text = "Online" +// lastSeenStatusLabel.textColor = UIColor.organizationalColor() +// lastSeenStatusLabel.textAlignment = .center +// lastSeenStatusLabel.font = UIFont.boldSystemFont(ofSize: 9) +// titleView.addSubview(nameLabel) +// titleView.addSubview(lastSeenStatusLabel) +// self.navigationBar.topItem?.titleView = titleView +// } + +// func getHightOfNavigationBar()->(CGFloat) { +// let navBarHeight = self.navigationBar.frame.size.height +// return navBarHeight +// } + +// func connectingTitleView() { +// let connectingTitleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 30)) +// let activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 30, height: 30)) +// activityIndicator.tintColor = UIColor.white +// connectingTitleView.addSubview(activityIndicator) +// activityIndicator.startAnimating() +// let textLabel = UILabel(frame: CGRect(x: 30, y: 5, width: 100, height: 21)) +// textLabel.text = "Connecting.." +// textLabel.textColor = UIColor.white +// connectingTitleView.addSubview(textLabel) +// activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray +// self.navigationBar.topItem?.titleView = connectingTitleView +// +// } +// func updatingTitleView(){ +// let updatingTitleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 30)) +// let activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 30, height: 30)) +// updatingTitleView.addSubview(activityIndicator) +// activityIndicator.startAnimating() +// let textLabel = UILabel(frame: CGRect(x: 30, y: 5, width: 100, height: 21)) +// textLabel.text = "Updating.." +// textLabel.textColor = UIColor.black +// updatingTitleView.addSubview(textLabel) +// activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray +// self.navigationBar.topItem?.titleView = updatingTitleView +// } - func isTyping(){ - let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 45)) - let nameLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 21)) - nameLabel.text = "John Smith" - nameLabel.textAlignment = .center - nameLabel.font = UIFont.boldSystemFont(ofSize: 16) - let dotsLoader = IGDotActivityIndicator(frame: CGRect(x: 0, y: 0, width: 40, height: 21)) - let isTyping = UITextField(frame: CGRect(x: 20, y: 22, width: 150, height: 21)) - isTyping.text = "is typing" - isTyping.font = UIFont.systemFont(ofSize: 14) - //isTyping.textAlignment = .center - isTyping.leftView = dotsLoader - isTyping.leftViewMode = UITextFieldViewMode.always - isTyping.textColor = UIColor.organizationalColor() - isTyping.isUserInteractionEnabled = false - titleView.addSubview(nameLabel) - //titleView.addSubview(dotsLoader) - titleView.addSubview(isTyping) - self.navigationBar.topItem?.titleView = titleView - - - } +// func isTyping(){ +// let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 45)) +// let nameLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 21)) +// nameLabel.text = "John Smith" +// nameLabel.textAlignment = .center +// nameLabel.font = UIFont.boldSystemFont(ofSize: 16) +// let dotsLoader = IGDotActivityIndicator(frame: CGRect(x: 0, y: 0, width: 40, height: 21)) +// let isTyping = UITextField(frame: CGRect(x: 20, y: 22, width: 150, height: 21)) +// isTyping.text = "is typing" +// isTyping.font = UIFont.systemFont(ofSize: 14) +// //isTyping.textAlignment = .center +// isTyping.leftView = dotsLoader +// isTyping.leftViewMode = UITextFieldViewMode.always +// isTyping.textColor = UIColor.organizationalColor() +// isTyping.isUserInteractionEnabled = false +// titleView.addSubview(nameLabel) +// //titleView.addSubview(dotsLoader) +// titleView.addSubview(isTyping) +// self.navigationBar.topItem?.titleView = titleView +// +// +// } } diff --git a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift index e1d66e3..d19fc3c 100644 --- a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift +++ b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift @@ -45,12 +45,13 @@ class IGNavigationItem: UINavigationItem { } func configure() { - let rightViewFrame = CGRect(x:0, y:0, width: 50, height:80) + let rightViewFrame = CGRect(x:0, y:0, width: 40, height:40) rightViewContainer = IGTappableView(frame: rightViewFrame) rightViewContainer!.backgroundColor = UIColor.clear let rightBarButton = UIBarButtonItem(customView: rightViewContainer!) self.rightBarButtonItem = rightBarButton } + //MARK: - Connecting func setNavigationItemForConnecting() { setNavigationItemWithCenterActivityIndicator(text: "Connecting") @@ -69,7 +70,7 @@ class IGNavigationItem: UINavigationItem { let label = UILabel() label.font = UIFont.systemFont(ofSize: 17.0, weight: UIFontWeightSemibold) label.textAlignment = .center - label.textColor = UIColor.darkGray + label.textColor = UIColor.white label.text = text centerViewContainer?.addSubview(label) label.snp.makeConstraints { (make) in @@ -77,7 +78,7 @@ class IGNavigationItem: UINavigationItem { make.centerY.equalTo(self.centerViewContainer!.snp.centerY).offset(-5) } - let activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: .gray) + let activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: .white) centerViewContainer?.addSubview(activityIndicatorView) activityIndicatorView.startAnimating() activityIndicatorView.snp.makeConstraints { (make) in @@ -116,13 +117,8 @@ class IGNavigationItem: UINavigationItem { self.title = "" backViewContainer?.addAction { self.backViewContainer?.isUserInteractionEnabled = false - //self.hud = MBProgressHUD.showAdded(to: self.backViewContainer!, animated: true) - // self.hud.mode = .indeterminate _ = self.navigationController?.popViewController(animated: true) - // self.hud.hide(animated: true) - - } - + } } //MARK: - Modal VCs @@ -140,28 +136,30 @@ class IGNavigationItem: UINavigationItem { } private func addTitleLabel(title: String) { - let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 80)) - let label = UILabel(frame: CGRect(x: 0, y: 20, width: 150, height: 31)) + let height = self.navigationController?.navigationBar.frame.height + let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 150, height: 40)) + let label = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 40)) label.font = UIFont.systemFont(ofSize: 17.0, weight: UIFontWeightBold) label.textAlignment = .center label.text = title + label.textColor = UIColor.white titleView.addSubview(label) self.titleView = titleView } private func addModalViewRightItem(title: String) { - let rightViewFrame = CGRect(x:0, y:0, width: 50, height:80) + let rightViewFrame = CGRect(x:0, y:0, width: 50, height:40) rightViewContainer = IGTappableView(frame: rightViewFrame) rightViewContainer!.backgroundColor = UIColor.clear let rightBarButton = UIBarButtonItem(customView: rightViewContainer!) self.rightBarButtonItem = rightBarButton - let labelFrame = CGRect(x: -40, y: 20, width: 100, height:31) + let labelFrame = CGRect(x: -40, y: 0, width: 100, height:40) let label = UILabel(frame: labelFrame) label.textAlignment = .right label.text = title - label.textColor = UIColor.organizationalColor() + label.textColor = UIColor.white rightViewContainer!.addSubview(label) } @@ -175,7 +173,7 @@ class IGNavigationItem: UINavigationItem { let labelFrame = CGRect(x: -10, y: 20, width: 100, height:31) let label = UILabel(frame: labelFrame) label.text = title - label.textColor = UIColor.organizationalColor() + label.textColor = UIColor.white leftViewContainer!.addSubview(label) } @@ -187,12 +185,12 @@ class IGNavigationItem: UINavigationItem { } private func addSettingButton() { - let leftViewFrame = CGRect(x:0, y:0, width: 50, height:80) + let leftViewFrame = CGRect(x:0, y:0, width: 50, height:40) leftViewContainer = IGTappableView(frame: leftViewFrame) leftViewContainer!.backgroundColor = UIColor.clear let leftBarButton = UIBarButtonItem(customView: leftViewContainer!) self.leftBarButtonItem = leftBarButton - let settingViewFrame = CGRect(x: -10, y: 20, width: 31, height:31) + let settingViewFrame = CGRect(x: -10, y: 5, width: 31, height:31) let settingButtonImageView = UIImageView(frame: settingViewFrame) settingButtonImageView.image = UIImage(named:"IG_Nav_Bar_Menu") settingButtonImageView.tintColor = UIColor.organizationalColor() @@ -200,7 +198,7 @@ class IGNavigationItem: UINavigationItem { } private func addComopseButton() { - let composeButtonFrame = CGRect(x: 30, y: 20, width: 31, height:31) + let composeButtonFrame = CGRect(x: 20, y: 5, width: 31, height:31) let composeButtonImageView = UIImageView(frame: composeButtonFrame) composeButtonImageView.image = UIImage(named:"IG_Nav_Bar_Compose") composeButtonImageView.tintColor = UIColor.organizationalColor() @@ -208,8 +206,8 @@ class IGNavigationItem: UINavigationItem { } private func addiGapLogo() { - let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 67, height: 23)) - let logoImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 67, height: 23)) + let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 67, height: 40)) + let logoImageView = UIImageView(frame: CGRect(x: 0, y: 8, width: 67, height: 23)) logoImageView.image = UIImage(named: "IG_Nav_Bar_Logo") logoImageView.contentMode = .scaleAspectFit @@ -277,8 +275,7 @@ class IGNavigationItem: UINavigationItem { } private func setRoomAvatar(_ room: IGRoom) { - let avatarViewFrame = CGRect(x: 10, y: 10, width: 50, height:50) - + let avatarViewFrame = CGRect(x: 0, y: 0, width: 40, height:40) let avatarView = IGAvatarView(frame: avatarViewFrame) avatarView.setRoom(room) @@ -292,24 +289,26 @@ class IGNavigationItem: UINavigationItem { private func setRoomInfo(_ room: IGRoom) { self.centerViewContainer?.subviews.forEach { $0.removeFromSuperview() } + self.centerViewContainer = IGTappableView(frame: CGRect(x: 0, y: 0, width: 200, height: 45)) self.titleView = self.centerViewContainer - - if (UIScreen.main.bounds.width) == 320.0 { - self.centerViewMainLabel = UILabel(frame: CGRect(x: -10, y: 0, width: 200, height: 18)) - } else { +// if (UIScreen.main.bounds.width) == 320.0 { +// self.centerViewMainLabel = UILabel(frame: CGRect(x: -10, y: 0, width: 200, height: 18)) +// } else { +// self.centerViewMainLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 18)) +// } self.centerViewMainLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 18)) - } self.centerViewMainLabel!.text = room.title + self.centerViewMainLabel!.textColor = UIColor.white self.centerViewMainLabel!.textAlignment = .center - self.centerViewMainLabel!.font = UIFont.boldSystemFont(ofSize: 16) + self.centerViewMainLabel!.font = UIFont.igFont(ofSize: 16.0, weight: .bold)//boldSystemFont(ofSize: 16) self.centerViewContainer!.addSubview(self.centerViewMainLabel!) self.centerViewSubLabel = UILabel()//frame: CGRect(x: 0, y: 20, width: 200, height: 16)) - self.centerViewSubLabel!.textColor = UIColor.organizationalColor() + self.centerViewSubLabel!.textColor = UIColor.white self.centerViewSubLabel!.textAlignment = .center - self.centerViewSubLabel!.font = UIFont.boldSystemFont(ofSize: 12) + self.centerViewSubLabel!.font = UIFont.igFont(ofSize: 12.0, weight: .regular)//boldSystemFont(ofSize: 12) self.centerViewContainer!.addSubview(self.centerViewSubLabel!) self.centerViewSubLabel!.snp.makeConstraints { (make) in make.top.equalTo(self.centerViewMainLabel!.snp.bottom).offset(3) diff --git a/iGap/Controller/Custom Master Controllers/Tabbar/IGTabBarController.swift b/iGap/Controller/Custom Master Controllers/Tabbar/IGTabBarController.swift index 11d82d5..cc19386 100644 --- a/iGap/Controller/Custom Master Controllers/Tabbar/IGTabBarController.swift +++ b/iGap/Controller/Custom Master Controllers/Tabbar/IGTabBarController.swift @@ -14,12 +14,18 @@ class IGTabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() + self.tabBar.barTintColor = UIColor.organizationalColor() + } + + override func viewWillAppear(_ animated: Bool) { + selectedItemTitleMustbeBold() } override func viewDidAppear(_ animated: Bool) { selectedItemTitleMustbeBold() } + override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { selectedItemTitleMustbeBold() } @@ -28,11 +34,11 @@ class IGTabBarController: UITabBarController { for item in tabBar.items!{ if tabBar.selectedItem == item { let selectedTitleFont = UIFont.systemFont(ofSize: 9, weight: UIFontWeightBold) - let selectedTitleColor = UIColor.organizationalColor() + let selectedTitleColor = UIColor.white item.setTitleTextAttributes([NSFontAttributeName: selectedTitleFont, NSForegroundColorAttributeName: selectedTitleColor], for: UIControlState.normal) }else{ let normalTitleFont = UIFont.systemFont(ofSize: 9, weight: UIFontWeightRegular) - let normalTitleColor = UIColor(red: 136.0/255.0, green: 136.0/255.0, blue: 136.0/255.0, alpha: 136.0/255.0) + let normalTitleColor = UIColor(red: 176.0/255.0, green: 224.0/255.0, blue: 230.0/255.0, alpha: 1.0) item.setTitleTextAttributes([NSFontAttributeName: normalTitleFont, NSForegroundColorAttributeName: normalTitleColor], for: UIControlState.normal) } } diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift index a4fbffd..dcaac99 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsAndModeratorsTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsAndModeratorsTableViewController.swift index b301452..7f4bdef 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsAndModeratorsTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsAndModeratorsTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -91,7 +91,7 @@ class IGChannelInfoAdminsAndModeratorsTableViewController: UITableViewController func fetchAdminChannelMemberFromServer() { channelModeratorIndicator.startAnimating() channelAdminIndicator.startAnimating() - IGChannelGetMemberListRequest.Generator.generate(room: room!, filterRole: .all).success({ (protoResponse) in + IGChannelGetMemberListRequest.Generator.generate(room: room!, offset: Int32(self.adminMember.count + self.moderatorMember.count), limit: 40, filterRole: .all).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let getChannelMemberList as IGPChannelGetMemberListResponse: diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsListTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsListTableViewController.swift index 6a42b65..e54888f 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsListTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsListTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsTableViewCell.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsTableViewCell.swift index ccafdd7..dc50308 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsTableViewCell.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoAdminsTableViewCell.swift @@ -58,9 +58,9 @@ class IGChannelInfoAdminsTableViewCell: UITableViewCell { adminRecentlyStatusLabel.text = "Service Notification" break } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - self.setUser(member) - } +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { +// self.setUser(member) +// } } diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditDescriptionTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditDescriptionTableViewController.swift index 97fb248..5c57899 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditDescriptionTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditDescriptionTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditNameTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditNameTableViewController.swift index a396d21..d2200b5 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditNameTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditNameTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -25,10 +25,10 @@ class IGChannelInfoEditNameTableViewController: UITableViewController , UITextFi super.viewDidLoad() channelNameTextField.delegate = self channelNameTextField.becomeFirstResponder() - self.tableView.backgroundView = UIImageView(image: UIImage(named: "IG_Settigns_Bg")) + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: "Done", title: "Name") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self navigationItem.rightViewContainer?.addAction { diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditTypeTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditTypeTableViewController.swift index c3fab63..c4fcdce 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditTypeTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoEditTypeTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewCell.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewCell.swift index 39584c8..acfc264 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewCell.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewCell.swift @@ -76,9 +76,9 @@ class IGChannelInfoMemberListTableViewCell: UITableViewCell { memberRecentlyStatusLabel.text = "Service Notification" break } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - self.setUser(member) - } +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { +// self.setUser(member) +// } } diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewController.swift index 8726410..86b3fc6 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoMemberListTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -152,7 +152,7 @@ class IGChannelInfoMemberListTableViewController: UITableViewController , UIGest func fetchChannelMemberFromServer() { self.hud = MBProgressHUD.showAdded(to: self.view, animated: true) self.hud.mode = .indeterminate - IGChannelGetMemberListRequest.Generator.generate(room: room!, filterRole: filterRole).success({ (protoResponse) in + IGChannelGetMemberListRequest.Generator.generate(room: room!, offset: Int32(self.allMember.count), limit: 40, filterRole: filterRole).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let getChannelMemberList as IGPChannelGetMemberListResponse: diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoSharedMediaDetailTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoSharedMediaDetailTableViewController.swift index f202d0e..6f8d1d8 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoSharedMediaDetailTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoSharedMediaDetailTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift index 4913ba8..bcd09b3 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import RxRealm import RxSwift @@ -17,8 +17,10 @@ import RxCocoa import IGProtoBuff import MGSwipeTableCell import MBProgressHUD +import INSPhotoGalleryFramework +import NVActivityIndicatorView -class IGChannelInfoTableViewController: UITableViewController , UIGestureRecognizerDelegate { +class IGChannelInfoTableViewController: UITableViewController , UIGestureRecognizerDelegate , NVActivityIndicatorViewable { @IBOutlet weak var channelSignMessageCell: UITableViewCell! @@ -56,11 +58,15 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni // var rooms : Results! var notificationToken: NotificationToken? var connectionStatus: IGAppManager.ConnectionStatus? + var avatars: [IGAvatar] = [] + var deleteView: IGTappableView? + var userAvatar: IGAvatar? override func viewDidLoad() { super.viewDidLoad() requestToGetRoom() + requestToGetAvatarList() imagePicker.delegate = self tableView.estimatedRowHeight = 44.0 tableView.rowHeight = UITableViewAutomaticDimension @@ -104,7 +110,7 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni channelSignMessageCell.isHidden = true cameraButton.isHidden = false } - self.tableView.backgroundView = UIImageView(image: UIImage(named: "IG_Settigns_Bg")) + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) tableView.tableFooterView = UIView() let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Channel Info") @@ -152,6 +158,10 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni // break // } // } + channelImage.avatarImageView?.isUserInteractionEnabled = true + let tap = UITapGestureRecognizer.init(target: self, action: #selector(self.handleTap(recognizer:))) + channelImage.avatarImageView?.addGestureRecognizer(tap) + } @@ -187,6 +197,184 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni } } + + @objc func handleTap(recognizer:UITapGestureRecognizer) { + if recognizer.state == .ended { + if let userAvatar = room?.channelRoom?.avatar { + showAvatar( avatar: userAvatar) + } + } + } + + var avatarPhotos : [INSPhotoViewable]? + var galleryPhotos: INSPhotosViewController? + var lastIndex: Array.Index? + var currentAvatarId: Int64? + var timer = Timer() + func showAvatar(avatar : IGAvatar) { + var photos: [INSPhotoViewable] = self.avatars.map { (avatar) -> IGMedia in + return IGMedia(avatar: avatar) + } + avatarPhotos = photos + let currentPhoto = photos[0] + let deleteViewFrame = CGRect(x:320, y:595, width: 25 , height:25) + let trashImageView = UIImageView() + trashImageView.image = UIImage(named: "IG_Trash_avatar") + trashImageView.frame = CGRect(x: 0, y: 0, width: 25, height: 25) + if myRole == .owner || myRole == .admin { + deleteView = IGTappableView(frame: deleteViewFrame) + deleteView?.addSubview(trashImageView) + deleteView?.addAction { + self.didTapOnTrashButton() + } + } else { + deleteView = nil + } + + let downloadIndicatorMainView = UIView() + let downloadViewFrame = self.view.bounds + downloadIndicatorMainView.backgroundColor = UIColor.white + downloadIndicatorMainView.frame = downloadViewFrame + let andicatorViewFrame = CGRect(x: view.bounds.midX, y: view.bounds.midY,width: 50 , height: 50) + let activityIndicatorView = NVActivityIndicatorView(frame: andicatorViewFrame, + type: NVActivityIndicatorType.audioEqualizer) + downloadIndicatorMainView.addSubview(activityIndicatorView) + + let galleryPreview = INSPhotosViewController(photos: photos, initialPhoto: currentPhoto, referenceView: nil, deleteView: deleteView, downloadView: downloadIndicatorMainView) + galleryPhotos = galleryPreview + present(galleryPreview, animated: true, completion: nil) + activityIndicatorView.startAnimating() + activityIndicatorView.startAnimating() + + DispatchQueue.main.async { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + + let thisPhoto = galleryPreview.accessCurrentPhotoDetail() + + //self.avatarPhotos.index(of:thisPhoto) + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + self.lastIndex = index + let currentAvatarFile = self.avatars[index].file + self.currentAvatarId = self.avatars[index].id + if currentAvatarFile?.status == .downloading { + return + } + + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + galleryPreview.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) + } + + } + + } + scheduledTimerWithTimeInterval() + } + + func didTapOnTrashButton() { + timer.invalidate() + let thisPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + let thisAvatarId = self.avatars[index].id + IGGroupAvatarDeleteRequest.Generator.generate(avatarId: thisAvatarId, roomId: (room?.id)!).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let channelAvatarDeleteResponse as IGPGroupAvatarDeleteResponse : + IGGroupAvatarDeleteRequest.Handler.interpret(response: channelAvatarDeleteResponse) + self.avatarPhotos?.remove(at: index) + self.avatars.remove(at: index) + default: + break + } + } + }).error ({ (errorCode, waitTime) in + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + + + + + } + } + + + func requestToGetAvatarList() { + if let currentRoomID = room?.id { + IGGroupAvatarGetListRequest.Generator.generate(roomId: currentRoomID).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let channelAvatarGetListResponse as IGPGroupAvatarGetListResponse: + let responseAvatars = IGGroupAvatarGetListRequest.Handler.interpret(response: channelAvatarGetListResponse) + self.avatars = responseAvatars + default: + break + } + } + }).error ({ (errorCode, waitTime) in + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + } + } + + func scheduledTimerWithTimeInterval(){ + // Scheduling timer to Call the function **Countdown** with the interval of 1 seconds + timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true) + } + + @objc func updateCounting(){ + let nextPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === nextPhoto}) { + let currentAvatarFile = self.avatars[index].file + let nextAvatarId = self.avatars[index].id + if nextAvatarId != self.currentAvatarId { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + if currentAvatarFile?.status == .downloading { + return + } + + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + self.galleryPhotos?.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) + } + self.currentAvatarId = nextAvatarId + } else { + + } + } + } + @IBAction func didTapOnCameraBtn(_ sender: UIButton) { let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupAdminListTableViewCell.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupAdminListTableViewCell.swift index 9e0f629..8290322 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupAdminListTableViewCell.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupAdminListTableViewCell.swift @@ -58,9 +58,9 @@ class IGGroupAdminListTableViewCell: UITableViewCell { groupAdminLastRecentlyLabel.text = "Service Notification" break } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - self.setUser(member) - } +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { +// self.setUser(member) +// } } diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupEditDescriptionTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupEditDescriptionTableViewController.swift index 7ac60e1..5cc1ded 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupEditDescriptionTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupEditDescriptionTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminListTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminListTableViewController.swift index af143ca..2cd2290 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminListTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminListTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -206,7 +206,7 @@ class IGGroupInfoAdminListTableViewController: UITableViewController , UIGesture func fetchGroupAdminOrModeratorFromServer() { self.hud = MBProgressHUD.showAdded(to: self.view, animated: true) self.hud.mode = .indeterminate - IGGroupGetMemberListRequest.Generator.generate(room: room!, filterRole: filterRole).success({ (protoResponse) in + IGGroupGetMemberListRequest.Generator.generate(room: room!, offset: Int32(self.allMembers.count), limit: 40, filterRole: filterRole).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let getChannelMemberList as IGPGroupGetMemberListResponse: diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminsAndModeratorsListTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminsAndModeratorsListTableViewController.swift index b4a387a..f828a35 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminsAndModeratorsListTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoAdminsAndModeratorsListTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -92,7 +92,7 @@ class IGGroupInfoAdminsAndModeratorsListTableViewController: UITableViewControll func fetchAdminChannelMemberFromServer() { moderatorIndicator.startAnimating() adminsIndicator.startAnimating() - IGGroupGetMemberListRequest.Generator.generate(room: room!, filterRole: .all).success({ (protoResponse) in + IGGroupGetMemberListRequest.Generator.generate(room: room!, offset: Int32(self.adminMember.count + self.moderatorMember.count), limit: 40, filterRole: .all).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let getChannelMemberList as IGPGroupGetMemberListResponse: diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditNameTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditNameTableViewController.swift index ece3de2..bfd4e0e 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditNameTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditNameTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -24,10 +24,10 @@ class IGGroupInfoEditNameTableViewController: UITableViewController , UITextFiel super.viewDidLoad() groupNameTextField.delegate = self groupNameTextField.becomeFirstResponder() - self.tableView.backgroundView = UIImageView(image: UIImage(named: "IG_Settigns_Bg")) + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: "Done", title: "Name") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self navigationItem.rightViewContainer?.addAction { diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditTypeTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditTypeTableViewController.swift index 8e573c9..2839104 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditTypeTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoEditTypeTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoMemberListTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoMemberListTableViewController.swift index c84d42d..54de357 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoMemberListTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoMemberListTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -163,7 +163,7 @@ class IGGroupInfoMemberListTableViewController: UITableViewController , UIGestur func fetchGroupMemberFromServer() { self.hud = MBProgressHUD.showAdded(to: self.view, animated: true) self.hud.mode = .indeterminate - IGGroupGetMemberListRequest.Generator.generate(room: room!, filterRole: filterRole).success({ (protoResponse) in + IGGroupGetMemberListRequest.Generator.generate(room: room!, offset: Int32(self.allMember.count), limit: 40, filterRole: filterRole).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let getGroupMemberList as IGPGroupGetMemberListResponse: diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift index f33e5a8..7d84f2c 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import RxRealm import RxSwift @@ -17,8 +17,10 @@ import RxCocoa import IGProtoBuff import MGSwipeTableCell import MBProgressHUD +import INSPhotoGalleryFramework +import NVActivityIndicatorView -class IGGroupInfoTableViewController: UITableViewController , UIGestureRecognizerDelegate{ +class IGGroupInfoTableViewController: UITableViewController , UIGestureRecognizerDelegate , NVActivityIndicatorViewable { @IBOutlet weak var groupNameLabelTrailingConstraint: NSLayoutConstraint! @IBOutlet weak var groupDescriptionLabelTrailingConstraint: NSLayoutConstraint! @@ -54,20 +56,30 @@ class IGGroupInfoTableViewController: UITableViewController , UIGestureRecognize var mode : String? = "Members" var notificationToken: NotificationToken? var connectionStatus: IGAppManager.ConnectionStatus? + var avatars: [IGAvatar] = [] + var deleteView: IGTappableView? + var userAvatar: IGAvatar? + override func viewDidLoad() { super.viewDidLoad() requestToGetRoom() + requestToGetAvatarList() myRole = room?.groupRoom?.role showGroupInfo() imagePicker.delegate = self - self.tableView.backgroundView = UIImageView(image: UIImage(named: "IG_Settigns_Bg")) + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) tableView.tableFooterView = UIView() let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Group Info") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self + + groupAvatarView.avatarImageView?.isUserInteractionEnabled = true + let tap = UITapGestureRecognizer.init(target: self, action: #selector(self.handleTap(recognizer:))) + groupAvatarView.avatarImageView?.addGestureRecognizer(tap) + switch myRole! { case .admin: cameraButton.isHidden = false @@ -335,6 +347,186 @@ class IGGroupInfoTableViewController: UITableViewController , UIGestureRecognize } } + + func handleTap(recognizer:UITapGestureRecognizer) { + if recognizer.state == .ended { + if let userAvatar = room?.groupRoom?.avatar { + showAvatar( avatar: userAvatar) + } + } + } + + var avatarPhotos : [INSPhotoViewable]? + var galleryPhotos: INSPhotosViewController? + var lastIndex: Array.Index? + var currentAvatarId: Int64? + var timer = Timer() + func showAvatar(avatar : IGAvatar) { + var photos: [INSPhotoViewable] = self.avatars.map { (avatar) -> IGMedia in + return IGMedia(avatar: avatar) + } + avatarPhotos = photos + let currentPhoto = photos[0] + let deleteViewFrame = CGRect(x:320, y:595, width: 25 , height:25) + let trashImageView = UIImageView() + trashImageView.image = UIImage(named: "IG_Trash_avatar") + trashImageView.frame = CGRect(x: 0, y: 0, width: 25, height: 25) + if myRole == .owner || myRole == .admin { + deleteView = IGTappableView(frame: deleteViewFrame) + deleteView?.addSubview(trashImageView) + deleteView?.addAction { + self.didTapOnTrashButton() + } + } else { + deleteView = nil + } + + let downloadIndicatorMainView = UIView() + let downloadViewFrame = self.view.bounds + downloadIndicatorMainView.backgroundColor = UIColor.white + downloadIndicatorMainView.frame = downloadViewFrame + let andicatorViewFrame = CGRect(x: view.bounds.midX, y: view.bounds.midY,width: 50 , height: 50) + let activityIndicatorView = NVActivityIndicatorView(frame: andicatorViewFrame, + type: NVActivityIndicatorType.audioEqualizer) + downloadIndicatorMainView.addSubview(activityIndicatorView) + + let galleryPreview = INSPhotosViewController(photos: photos, initialPhoto: currentPhoto, referenceView: nil, deleteView: deleteView, downloadView: downloadIndicatorMainView) + galleryPhotos = galleryPreview + present(galleryPreview, animated: true, completion: nil) + activityIndicatorView.startAnimating() + activityIndicatorView.startAnimating() + + DispatchQueue.main.async { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + + let thisPhoto = galleryPreview.accessCurrentPhotoDetail() + + //self.avatarPhotos.index(of:thisPhoto) + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + self.lastIndex = index + let currentAvatarFile = self.avatars[index].file + self.currentAvatarId = self.avatars[index].id + if currentAvatarFile?.status == .downloading { + return + } + + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + galleryPreview.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) + } + + } + + } + scheduledTimerWithTimeInterval() + } + + func scheduledTimerWithTimeInterval(){ + // Scheduling timer to Call the function **Countdown** with the interval of 1 seconds + timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true) + } + + func updateCounting(){ + let nextPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === nextPhoto}) { + let currentAvatarFile = self.avatars[index].file + let nextAvatarId = self.avatars[index].id + if nextAvatarId != self.currentAvatarId { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + if currentAvatarFile?.status == .downloading { + return + } + + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + self.galleryPhotos?.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) + } + self.currentAvatarId = nextAvatarId + } else { + + } + } + } + + + + func didTapOnTrashButton() { + timer.invalidate() + let thisPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + let thisAvatarId = self.avatars[index].id + IGGroupAvatarDeleteRequest.Generator.generate(avatarId: thisAvatarId, roomId: (room?.id)!).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let groupAvatarDeleteResponse as IGPGroupAvatarDeleteResponse : + IGGroupAvatarDeleteRequest.Handler.interpret(response: groupAvatarDeleteResponse) + self.avatarPhotos?.remove(at: index) + self.avatars.remove(at: index) + default: + break + } + } + }).error ({ (errorCode, waitTime) in + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + + + + + } + } + + + func requestToGetAvatarList() { + if let currentRoomID = room?.id { + IGGroupAvatarGetListRequest.Generator.generate(roomId: currentRoomID).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let groupAvatarGetListResponse as IGPGroupAvatarGetListResponse: + let responseAvatars = IGGroupAvatarGetListRequest.Handler.interpret(response: groupAvatarGetListResponse) + self.avatars = responseAvatars + default: + break + } + } + }).error ({ (errorCode, waitTime) in + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + } + } + func showGroupInfo() { groupNameTitleLabel.text = room?.title diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupSharedMediaListTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupSharedMediaListTableViewController.swift index 293c73b..afbb385 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupSharedMediaListTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupSharedMediaListTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff diff --git a/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift b/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift index ba3a61f..740a1b2 100644 --- a/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift +++ b/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift @@ -13,13 +13,23 @@ import Contacts import RealmSwift import IGProtoBuff import MBProgressHUD +import NVActivityIndicatorView +import INSPhotoGalleryFramework -class IGRegistredUserInfoTableViewController: UITableViewController , UIGestureRecognizerDelegate { +class IGRegistredUserInfoTableViewController: UITableViewController , UIGestureRecognizerDelegate , NVActivityIndicatorViewable { var user: IGRegisteredUser? var previousRoomId: Int64? var room: IGRoom? var hud = MBProgressHUD() + var avatars: [IGAvatar] = [] + var deleteView: IGTappableView? + var userAvatar: IGAvatar? + var avatarPhotos : [INSPhotoViewable]? + var galleryPhotos: INSPhotosViewController? + var lastIndex: Array.Index? + var currentAvatarId: Int64? + var timer = Timer() @IBOutlet weak var avatarView: IGAvatarView! @IBOutlet weak var blockContactLabel: UILabel! @@ -30,6 +40,7 @@ class IGRegistredUserInfoTableViewController: UITableViewController , UIGestureR override func viewDidLoad() { super.viewDidLoad() if user != nil { + requestToGetAvatarList() self.avatarView.setUser(user!) self.displayNameLabel.text = user!.displayName if let phone = user?.phone { @@ -50,6 +61,10 @@ class IGRegistredUserInfoTableViewController: UITableViewController , UIGestureR } } } + avatarView.avatarImageView?.isUserInteractionEnabled = true + let tap = UITapGestureRecognizer.init(target: self, action: #selector(self.handleTap(recognizer:))) + avatarView.avatarImageView?.addGestureRecognizer(tap) + let navigaitonItem = self.navigationItem as! IGNavigationItem navigaitonItem.addNavigationViewItems(rightItemText: nil, title: "Contact Info") navigaitonItem.navigationController = self.navigationController as? IGNavigationController @@ -136,6 +151,198 @@ class IGRegistredUserInfoTableViewController: UITableViewController , UIGestureR } } + func requestToGetAvatarList() { + if let currentUserId = user?.id { + IGUserAvatarGetListRequest.Generator.generate(userId: currentUserId).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let UserAvatarGetListoResponse as IGPUserAvatarGetListResponse: + let responseAvatars = IGUserAvatarGetListRequest.Handler.interpret(response: UserAvatarGetListoResponse, userId: currentUserId) + self.avatars = responseAvatars + for avatar in self.avatars { + let avatarView = IGImageView() + // avatarView.setImage(avatar: avatar) + } + + + default: + break + } + } + }).error ({ (errorCode, waitTime) in + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + } + } + + + func handleTap(recognizer:UITapGestureRecognizer) { + if recognizer.state == .ended { + if let userAvatar = user?.avatar { + showAvatar( avatar: userAvatar) + } + } + } + + + func showAvatar(avatar : IGAvatar) { + var photos: [INSPhotoViewable] = self.avatars.map { (avatar) -> IGMedia in + return IGMedia(avatar: avatar) + } + avatarPhotos = photos + let currentPhoto = photos[0] + let deleteViewFrame = CGRect(x:320, y:595, width: 25 , height:25) + let trashImageView = UIImageView() + trashImageView.image = UIImage(named: "IG_Trash_avatar") + trashImageView.frame = CGRect(x: 0, y: 0, width: 25, height: 25) + let currentUserID = IGAppManager.sharedManager.userID() + if let userID = user?.id { + if userID == currentUserID { + deleteView = IGTappableView(frame: deleteViewFrame) + deleteView?.addSubview(trashImageView) + deleteView?.addAction { + self.didTapOnTrashButton() + } + + } else { + deleteView = nil + } + } + + let downloadIndicatorMainView = UIView() + let downloadViewFrame = self.view.bounds + downloadIndicatorMainView.backgroundColor = UIColor.white + downloadIndicatorMainView.frame = downloadViewFrame + let andicatorViewFrame = CGRect(x: view.bounds.midX, y: view.bounds.midY,width: 50 , height: 50) + let activityIndicatorView = NVActivityIndicatorView(frame: andicatorViewFrame,type: NVActivityIndicatorType.audioEqualizer) + downloadIndicatorMainView.addSubview(activityIndicatorView) + + let galleryPreview = INSPhotosViewController(photos: photos, initialPhoto: currentPhoto, referenceView: nil, deleteView: deleteView, downloadView: downloadIndicatorMainView) + galleryPhotos = galleryPreview + present(galleryPreview, animated: true, completion: nil) + activityIndicatorView.startAnimating() + DispatchQueue.main.async { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + let thisPhoto = galleryPreview.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + self.lastIndex = index + let currentAvatarFile = self.avatars[index].file + self.currentAvatarId = self.avatars[index].id + if currentAvatarFile?.status == .downloading { + return + } + + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + galleryPreview.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) + } + + } + + } + scheduledTimerWithTimeInterval() + } + + func scheduledTimerWithTimeInterval(){ + // Scheduling timer to Call the function **Countdown** with the interval of 1 seconds + timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true) + } + + func updateCounting(){ + timer.invalidate() + let nextPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === nextPhoto}) { + let currentAvatarFile = self.avatars[index].file + let nextAvatarId = self.avatars[index].id + if nextAvatarId != self.currentAvatarId { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + if currentAvatarFile?.status == .downloading { + return + } + + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + self.galleryPhotos?.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) + } + self.currentAvatarId = nextAvatarId + } else { + + } + } + scheduledTimerWithTimeInterval() + } + + + + + func setThumbnailForAttachments() { + if let attachment = self.userAvatar?.file { + // self.currentPhoto.isHidden = false + + } + } + + + func didTapOnTrashButton() { + timer.invalidate() + let thisPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + let thisAvatarId = self.avatars[index].id + IGUserAvatarDeleteRequest.Generator.generate(avatarID: thisAvatarId).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let userAvatarDeleteResponse as IGPUserAvatarDeleteResponse : + IGUserAvatarDeleteRequest.Handler.interpret(response: userAvatarDeleteResponse) + self.avatarPhotos?.remove(at: index) + self.scheduledTimerWithTimeInterval() + default: + break + } + } + }).error ({ (errorCode, waitTime) in + self.timer.invalidate() + self.scheduledTimerWithTimeInterval() + + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + + } + } + + + func createChat() { if let selectedUser = user { let hud = MBProgressHUD.showAdded(to: self.view.superview!, animated: true) diff --git a/iGap/Controller/View Controllers/New Conversation/IGChooseMemberFromContactsToCreateGroup.swift b/iGap/Controller/View Controllers/New Conversation/IGChooseMemberFromContactsToCreateGroup.swift index fe3a009..d3adb9d 100644 --- a/iGap/Controller/View Controllers/New Conversation/IGChooseMemberFromContactsToCreateGroup.swift +++ b/iGap/Controller/View Controllers/New Conversation/IGChooseMemberFromContactsToCreateGroup.swift @@ -38,7 +38,7 @@ class IGChooseMemberFromContactsToCreateGroup: UITableViewController , UISearchR // } // } - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() var contactStore = CNContactStore() var contacts = [CNContact]() var contactSections : [Section]? diff --git a/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift b/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift index a2d3131..e944143 100644 --- a/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift +++ b/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift @@ -21,7 +21,7 @@ class IGCreateNewChannelTableViewController: UITableViewController { let width = CGFloat(0.5) var invitedLink : String? var igpRoom : IGPRoom! - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() override func viewDidLoad() { super.viewDidLoad() @@ -64,7 +64,7 @@ class IGCreateNewChannelTableViewController: UITableViewController { DispatchQueue.main.async { switch protoResponse { case let channelCreateRespone as IGPChannelCreateResponse : - IGClientGetRoomRequest.Generator.generate(roomId: channelCreateRespone.igpRoomId).success({ (protoResponse) in + IGClientGetRoomRequest.Generator.generate(roomId: channelCreateRespone.igpRoomID).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let getRoomProtoResponse as IGPClientGetRoomResponse: @@ -79,7 +79,7 @@ class IGCreateNewChannelTableViewController: UITableViewController { }, completion: { (uploadTask) in if let token = uploadTask.token { - IGChannelAddAvatarRequest.Generator.generate(attachment: token , roomID: getRoomProtoResponse.igpRoom.igpId).success({ (protoResponse) in + IGChannelAddAvatarRequest.Generator.generate(attachment: token , roomID: getRoomProtoResponse.igpRoom.igpID).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let channelAvatarAddResponse as IGPChannelAvatarAddResponse: diff --git a/iGap/Controller/View Controllers/New Conversation/IGCreateNewChatTableViewController.swift b/iGap/Controller/View Controllers/New Conversation/IGCreateNewChatTableViewController.swift index 1135c46..ad7faa1 100644 --- a/iGap/Controller/View Controllers/New Conversation/IGCreateNewChatTableViewController.swift +++ b/iGap/Controller/View Controllers/New Conversation/IGCreateNewChatTableViewController.swift @@ -19,7 +19,7 @@ class IGCreateNewChatTableViewController: UITableViewController, UISearchResults class User: NSObject { let registredUser: IGRegisteredUser - let name: String + @objc let name: String var section :Int? init(registredUser: IGRegisteredUser){ self.registredUser = registredUser diff --git a/iGap/Controller/View Controllers/New Conversation/IGCreateNewGroupTableViewController.swift b/iGap/Controller/View Controllers/New Conversation/IGCreateNewGroupTableViewController.swift index d711d10..6895901 100644 --- a/iGap/Controller/View Controllers/New Conversation/IGCreateNewGroupTableViewController.swift +++ b/iGap/Controller/View Controllers/New Conversation/IGCreateNewGroupTableViewController.swift @@ -21,7 +21,7 @@ class IGCreateNewGroupTableViewController: UITableViewController , UIGestureReco var imagePicker = UIImagePickerController() let borderName = CALayer() let width = CGFloat(0.5) - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() var mode : String? var roomId : Int64? var selectedUsersToCreateGroup = [IGRegisteredUser]() @@ -206,7 +206,7 @@ class IGCreateNewGroupTableViewController: UITableViewController , UIGestureReco DispatchQueue.main.async { switch protoResponse { case let groupCreateRespone as IGPGroupCreateResponse: - IGClientGetRoomRequest.Generator.generate(roomId: groupCreateRespone.igpRoomId).success({ (protoResponse) in + IGClientGetRoomRequest.Generator.generate(roomId: groupCreateRespone.igpRoomID).success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { case let getRoomProtoResponse as IGPClientGetRoomResponse: @@ -228,7 +228,7 @@ class IGCreateNewGroupTableViewController: UITableViewController , UIGestureReco }, completion: { (uploadTask) in if let token = uploadTask.token { - IGGroupAvatarAddRequest.Generator.generate(attachment: token , roomID: getRoomProtoResponse.igpRoom.igpId).success({ (protoResponse) in + IGGroupAvatarAddRequest.Generator.generate(attachment: token , roomID: getRoomProtoResponse.igpRoom.igpID).success({ (protoResponse) in DispatchQueue.main.async { @@ -266,7 +266,7 @@ class IGCreateNewGroupTableViewController: UITableViewController , UIGestureReco self.dismiss(animated: true, completion: { NotificationCenter.default.post(name: NSNotification.Name(rawValue: kIGNotificationNameDidCreateARoom), object: nil, - userInfo: ["room": getRoomProtoResponse.igpRoom.igpId]) + userInfo: ["room": getRoomProtoResponse.igpRoom.igpID]) }) default: diff --git a/iGap/Controller/View Controllers/New Conversation/IGForwardMessageTableViewController.swift b/iGap/Controller/View Controllers/New Conversation/IGForwardMessageTableViewController.swift index ea22c82..caa7194 100644 --- a/iGap/Controller/View Controllers/New Conversation/IGForwardMessageTableViewController.swift +++ b/iGap/Controller/View Controllers/New Conversation/IGForwardMessageTableViewController.swift @@ -10,7 +10,7 @@ import UIKit import Contacts -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import IGProtoBuff import MGSwipeTableCell diff --git a/iGap/Controller/View Controllers/New Conversation/SSRadioButton.swift b/iGap/Controller/View Controllers/New Conversation/SSRadioButton.swift index 5dbdf57..0af5edb 100644 --- a/iGap/Controller/View Controllers/New Conversation/SSRadioButton.swift +++ b/iGap/Controller/View Controllers/New Conversation/SSRadioButton.swift @@ -14,7 +14,7 @@ import UIKit class SSRadioButton: UIButton { - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() fileprivate var circleLayer = CAShapeLayer() fileprivate var fillCircleLayer = CAShapeLayer() override var isSelected: Bool { diff --git a/iGap/Controller/View Controllers/Setting/IGDeleteAccountConfirmationTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGDeleteAccountConfirmationTableViewController.swift index 5892361..06f150c 100644 --- a/iGap/Controller/View Controllers/Setting/IGDeleteAccountConfirmationTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGDeleteAccountConfirmationTableViewController.swift @@ -28,9 +28,7 @@ class IGDeleteAccountConfirmationTableViewController: UITableViewController , UI super.viewDidLoad() addBottomBorder() self.navigationController?.navigationBar.tintColor = UIColor.organizationalColor() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let currentUserId = IGAppManager.sharedManager.userID() let realm = try! Realm() let predicate = NSPredicate(format: "id = %lld", currentUserId!) diff --git a/iGap/Controller/View Controllers/Setting/IGDeleteAccountTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGDeleteAccountTableViewController.swift index a970e15..a376c02 100644 --- a/iGap/Controller/View Controllers/Setting/IGDeleteAccountTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGDeleteAccountTableViewController.swift @@ -17,13 +17,11 @@ class IGDeleteAccountTableViewController: UITableViewController , UIGestureRecog var hud = MBProgressHUD() override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) tableView.tableFooterView = UIView() let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil , title: "Delete Account") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self diff --git a/iGap/Controller/View Controllers/Setting/IGPrivacyAndSecurityWhoCanSeeTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGPrivacyAndSecurityWhoCanSeeTableViewController.swift index 9339738..f85ff8e 100644 --- a/iGap/Controller/View Controllers/Setting/IGPrivacyAndSecurityWhoCanSeeTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGPrivacyAndSecurityWhoCanSeeTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -28,11 +28,9 @@ class IGPrivacyAndSecurityWhoCanSeeTableViewController: UITableViewController , var cell : UITableViewCell! override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self navigationItem.addNavigationViewItems(rightItemText: "Done", title: mode) diff --git a/iGap/Controller/View Controllers/Setting/IGSettingAboutWebViewViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingAboutWebViewViewController.swift index 3444850..df402fd 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingAboutWebViewViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingAboutWebViewViewController.swift @@ -10,15 +10,24 @@ import UIKit -class IGSettingAboutWebViewViewController: UIViewController { +class IGSettingAboutWebViewViewController: UIViewController, UIGestureRecognizerDelegate { var pageUrl : String? + var pageTitle: String? + @IBOutlet weak var igapWebview: UIWebView! override func viewDidLoad() { super.viewDidLoad() + + let navigationItem = self.navigationItem as! IGNavigationItem + navigationItem.addNavigationViewItems(rightItemText: nil, title: pageTitle!) + navigationItem.navigationController = self.navigationController as? IGNavigationController + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + if pageUrl != nil { - let url = NSURL(string: self.pageUrl!) - let request = NSURLRequest(url: url as! URL) + let url = URL(string: self.pageUrl!)! + let request = NSURLRequest(url: url) igapWebview.loadRequest(request as URLRequest) } // Do any additional setup after loading the view. diff --git a/iGap/Controller/View Controllers/Setting/IGSettingAccountPhoneNumberTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingAccountPhoneNumberTableViewController.swift index fd3970e..97cf796 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingAccountPhoneNumberTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingAccountPhoneNumberTableViewController.swift @@ -13,13 +13,11 @@ import UIKit class IGSettingAccountPhoneNumberTableViewController: UITableViewController { @IBOutlet weak var firstCell: UITableViewCell! - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() override func viewDidLoad() { super.viewDidLoad() self.navigationController?.navigationBar.barTintColor = UIColor.white - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) setBarbuttonItems() } override func viewDidAppear(_ animated: Bool) { diff --git a/iGap/Controller/View Controllers/Setting/IGSettingAccountUsernameTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingAccountUsernameTableViewController.swift index 8832d5e..88e9fba 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingAccountUsernameTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingAccountUsernameTableViewController.swift @@ -37,7 +37,7 @@ class IGSettingAccountUsernameTableViewController: UITableViewController , UIGes usernameTextField.text = userInDb.username } - self.tableView.backgroundView = UIImageView(image: UIImage(named: "IG_Settigns_Bg")) + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: "Done", title: "Username") diff --git a/iGap/Controller/View Controllers/Setting/IGSettingAddContactTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingAddContactTableViewController.swift index cc5de62..4619859 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingAddContactTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingAddContactTableViewController.swift @@ -14,7 +14,7 @@ class IGSettingAddContactTableViewController: UITableViewController { let borderName = CALayer() let width = CGFloat(0.5) - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() let tableviewBackgroundColor = UIColor(red: 239/255, green: 238/255, blue: 246/255, alpha: 1) override func viewDidLoad() { diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatCatchContactAndGroupsTableViewCell.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatCatchContactAndGroupsTableViewCell.swift index e278390..a273187 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatCatchContactAndGroupsTableViewCell.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatCatchContactAndGroupsTableViewCell.swift @@ -29,7 +29,7 @@ class IGSettingChatCatchContactAndGroupsTableViewCell: UITableViewCell { func roundUserImage(){ contactImageView.layer.borderWidth = 0 contactImageView.layer.masksToBounds = true - let borderUserImageColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let borderUserImageColor = UIColor.organizationalColor() contactImageView.layer.borderColor = borderUserImageColor.cgColor contactImageView.layer.cornerRadius = contactImageView.frame.size.height/2 contactImageView.clipsToBounds = true diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatCatchTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatCatchTableViewController.swift index e162002..5d92ac1 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatCatchTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatCatchTableViewController.swift @@ -20,9 +20,7 @@ class IGSettingChatCatchTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) } override func viewDidAppear(_ animated: Bool) { diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatClearChacheTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatClearChacheTableViewController.swift index 338e7f1..60e9ba7 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatClearChacheTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatClearChacheTableViewController.swift @@ -17,23 +17,22 @@ class IGSettingChatClearChacheTableViewController: UITableViewController { @IBOutlet weak var audioAndVoicesSizeLabel: UILabel! @IBOutlet weak var imagesAndGIFsSize: UILabel! - var navBarTitle = "Cached Data" - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + var navBarTitle = "Cached Data" + let greenColor = UIColor.organizationalColor() override func viewDidLoad() { super.viewDidLoad() setupEditBtn() self.navigationItem.title = navBarTitle - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView - } - override func didReceiveMemoryWarning() { + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) + } + + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() - } + } override func numberOfSections(in tableView: UITableView) -> Int { return 2 - } + } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { var numberOfRows = 0 @@ -44,30 +43,30 @@ class IGSettingChatClearChacheTableViewController: UITableViewController { numberOfRows = 1 default: break - } - return numberOfRows } + return numberOfRows + } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section == 1 { showConfirmDeleteAlertView() - } } + } override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { if tableView.isEditing == true { - // label.text = "0" + // label.text = "0" doneButtonClicked() - } } + } override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { if indexPath.section == 0 { return true - } - return false } + return false + } override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { return true - } + } func setupEditBtn(){ let editBtn = UIButton() editBtn.setTitleColor(UIColor.organizationalColor(), for: .normal) @@ -81,7 +80,7 @@ class IGSettingChatClearChacheTableViewController: UITableViewController { let barButtonItem = UIBarButtonItem(customView: editBtn) barButtonItem.imageInsets = UIEdgeInsets(top: 0, left: 50, bottom: 0, right: 0) self.navigationItem.rightBarButtonItem = barButtonItem - } + } func editButtonClicked(){ self.tableView.allowsMultipleSelectionDuringEditing = false self.tableView.setEditing(true, animated: true) @@ -98,11 +97,11 @@ class IGSettingChatClearChacheTableViewController: UITableViewController { let topRightbarButtonItem = UIBarButtonItem(customView: doneBtn) topRightbarButtonItem.imageInsets = UIEdgeInsets(top: 0, left: 75, bottom: 0, right: 0) self.navigationItem.rightBarButtonItem = topRightbarButtonItem - } + } func doneButtonClicked(){ tableView?.setEditing(false, animated: true) setupEditBtn() - } + } func showConfirmDeleteAlertView(){ let deleteConfirmAlertView = UIAlertController(title: "Are you sure you want to delete the all data?", message: nil, preferredStyle: .actionSheet) let deleteAction = UIAlertAction(title: "Delete", style:.default , handler: { diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatFontSizeTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatFontSizeTableViewController.swift index a509740..498993c 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatFontSizeTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatFontSizeTableViewController.swift @@ -11,29 +11,29 @@ import UIKit class IGSettingChatFontSizeTableViewController: UITableViewController { - + @IBOutlet weak var deviceSettingSwitcher: UISwitch! @IBOutlet weak var mediumFontSizeCell: UITableViewCell! - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() var currentSelectedCellIndexPath : IndexPath? override func viewDidLoad() { super.viewDidLoad() setBarbuttonItem() setDefualtFontSize() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) deviceSettingSwitcher.addTarget(self, action: #selector(IGSettingChatFontSizeTableViewController.stateChanged), for: UIControlEvents.valueChanged) } - override func numberOfSections(in tableView: UITableView) -> Int { + + override func numberOfSections(in tableView: UITableView) -> Int { var numberOfSection = 0 if deviceSettingSwitcher.isOn{ numberOfSection = 1 }else{ - numberOfSection = 2 + numberOfSection = 2 } return numberOfSection } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { var numberOfRows : Int = 0 switch section { @@ -48,17 +48,17 @@ class IGSettingChatFontSizeTableViewController: UITableViewController { } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section != 0 { - if let currentCell = tableView.cellForRow(at: indexPath){ - currentCell.selectedBackgroundView?.backgroundColor = UIColor.clear - if currentCell != mediumFontSizeCell { - mediumFontSizeCell.accessoryType = .none - } - if (currentCell.accessoryType == UITableViewCellAccessoryType.none) { - currentCell.accessoryType = UITableViewCellAccessoryType.checkmark - }else{ - (currentCell.accessoryType = UITableViewCellAccessoryType.none) + if let currentCell = tableView.cellForRow(at: indexPath){ + currentCell.selectedBackgroundView?.backgroundColor = UIColor.clear + if currentCell != mediumFontSizeCell { + mediumFontSizeCell.accessoryType = .none + } + if (currentCell.accessoryType == UITableViewCellAccessoryType.none) { + currentCell.accessoryType = UITableViewCellAccessoryType.checkmark + }else{ + (currentCell.accessoryType = UITableViewCellAccessoryType.none) + } } - } } currentSelectedCellIndexPath = indexPath } @@ -85,7 +85,7 @@ class IGSettingChatFontSizeTableViewController: UITableViewController { } func setDefualtFontSize(){ mediumFontSizeCell.accessoryType = .checkmark - } + } func setBarbuttonItem(){ //nextButton let doneBtn = UIButton() @@ -98,8 +98,8 @@ class IGSettingChatFontSizeTableViewController: UITableViewController { doneBtn.addTarget(self, action: #selector(IGSettingChatFontSizeTableViewController.doneButtonClicked), for: UIControlEvents.touchUpInside) let topRightBarbuttonItem = UIBarButtonItem(customView: doneBtn) self.navigationItem.rightBarButtonItem = topRightBarbuttonItem - } + } func doneButtonClicked(){ } - + } diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatStickersTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatStickersTableViewController.swift index b664505..c5ec6e9 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatStickersTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatStickersTableViewController.swift @@ -1,12 +1,12 @@ /* -* This is the source code of iGap for iOS - * It is licensed under GNU AGPL v3.0 -* You should have received a copy of the license in this archive (see LICENSE). -* Copyright © 2017 , iGap - www.iGap.net -* iGap Messenger | Free, Fast and Secure instant messaging application -* The idea of the RooyeKhat Media Company - www.RooyeKhat.co -* All rights reserved. -*/ + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ import UIKit //import LGSemiModalNavController @@ -20,7 +20,7 @@ class IGSettingChatStickersTableViewController: UITableViewController { collectionView?.delegate = self } } - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() let stickerText = ["Lorem","Ipsum","Dolor"] let stickerImageView = ["arrow21","boy","face.jpg"] let numberOfStickerText = [20,12,15] diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatTableViewController.swift index 6f74c0b..e77acbf 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatTableViewController.swift @@ -14,10 +14,8 @@ class IGSettingChatTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView - } + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) + } override func viewDidAppear(_ animated: Bool) { self.tableView.isUserInteractionEnabled = true @@ -28,7 +26,7 @@ class IGSettingChatTableViewController: UITableViewController { override func numberOfSections(in tableView: UITableView) -> Int { return 5 - } + } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { var numberOfRows : Int = 0 @@ -49,6 +47,7 @@ class IGSettingChatTableViewController: UITableViewController { } return numberOfRows } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { // if indexPath.section == 0 { @@ -137,4 +136,4 @@ class IGSettingChatTableViewController: UITableViewController { present(deleteAllChatsAlert, animated: true, completion: nil) } - } +} diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatWallpaperTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatWallpaperTableViewController.swift index dd90237..33956c3 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatWallpaperTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatWallpaperTableViewController.swift @@ -16,18 +16,16 @@ class IGSettingChatWallpaperTableViewController: UITableViewController,UINavigat override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView - } + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) + } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() - } + } override func numberOfSections(in tableView: UITableView) -> Int { return 1 - } + } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { var numberOfRows : Int = 0 diff --git a/iGap/Controller/View Controllers/Setting/IGSettingChatWhenDownloadDataTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingChatWhenDownloadDataTableViewController.swift index 3ce9a85..059f300 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingChatWhenDownloadDataTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingChatWhenDownloadDataTableViewController.swift @@ -19,9 +19,7 @@ class IGSettingChatWhenDownloadDataTableViewController: UITableViewController { var checked = [false,false,false,false] override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) } override func numberOfSections(in tableView: UITableView) -> Int { return 1 diff --git a/iGap/Controller/View Controllers/Setting/IGSettingContactBlockListTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingContactBlockListTableViewController.swift index e048c72..0e7eb33 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingContactBlockListTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingContactBlockListTableViewController.swift @@ -24,12 +24,10 @@ class IGSettingContactBlockListTableViewController: UITableViewController , UIGe super.viewDidLoad() fetchBlockedContactsFromServer() hud.hide(animated: true) - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: "Edit", title: "BlockedList") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self diff --git a/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift b/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift index a0fa716..926215b 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift @@ -62,9 +62,9 @@ class IGSettingContactTableViewCell: UITableViewCell { lastSeenStatusLabel.text = "Service Notification" break } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - self.setUser(user) - } +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { +// self.setUser(user) +// } } diff --git a/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift index ff318cd..1443b61 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift @@ -18,7 +18,7 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult class User:NSObject { let registredUser: IGRegisteredUser - let name:String! + @objc let name:String! var section :Int? init(registredUser: IGRegisteredUser){ self.registredUser = registredUser @@ -40,6 +40,7 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult var filteredTableData = [CNContact]() var resultSearchController = UISearchController() var hud = MBProgressHUD() + override func viewDidLoad() { super.viewDidLoad() setupSearchBar() @@ -47,7 +48,7 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult resultSearchController.searchBar.delegate = self let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Contacts") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self @@ -55,19 +56,11 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult switch changes { case .initial: self.tableView.reloadData() - break - case .update(_, let deletions, let insertions, let modifications): + case .update(_,_,_,_): self.tableView.reloadData() - - print("updating members tableV") - - self.tableView.reloadData() - break case .error(let err): - // An error occurred while opening the Realm file on the background worker thread fatalError("\(err)") break - } } @@ -76,19 +69,9 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult switch changes { case .initial: self.tableView.reloadData() - break - case .update(_, let deletions, let insertions, let modifications): - print("updating members tableV") - // Query messages have changed, so apply them to the TableView - // self.tableView.beginUpdates() - // self.tableView.insertRows(at: insertions.map { IndexPath(row: $0, section: 1) }, with: .none) - // self.tableView.deleteRows(at: deletions.map { IndexPath(row: $0, section: 1) }, with: .none) - // self.tableView.reloadRows(at: modifications.map { IndexPath(row: $0, section: 1) }, with: .none) - // self.tableView.endUpdates() + case .update(_,_,_,_): self.tableView.reloadData() - break case .error(let err): - // An error occurred while opening the Realm file on the background worker thread fatalError("\(err)") break } @@ -103,14 +86,13 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult override func viewWillAppear(_ animated: Bool) { fetchBlockedContactsFromServer() - } - func addressBookDidChange() { + @objc func addressBookDidChange() { tableView.reloadData() } - func fetchBlockedContactsFromServer(){ + func fetchBlockedContactsFromServer() { self.hud = MBProgressHUD.showAdded(to: self.view, animated: true) self.hud.mode = .indeterminate IGUserContactsGetBlockedListRequest.Generator.generate().success({ (protoResponse) in @@ -149,6 +131,7 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult @IBAction func addBarButtonClicked(_ sender: UIBarButtonItem) { performSegue(withIdentifier: "GoToAddNewContactPage", sender: self) } + var sections : [Section]{ if self.contactSections != nil { return self.contactSections! @@ -172,32 +155,26 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult self.contactSections = sections return self.contactSections! } - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } + // MARK: - Table view data source override func numberOfSections(in tableView: UITableView) -> Int { - // #warning Incomplete implementation, return the number of sections if (self.resultSearchController.isActive) { return 1 - }else{ + } else { return self.sections.count + 1 } } + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - // #warning Incomplete implementation, return the number of rows if (self.resultSearchController.isActive) { return self.filteredTableData.count - }else{ - if section == 0 { - return 1 - }else{ - - return self.sections[ section - 1 ].users.count - } + } else if section == 0 { + return 1 + } else { + return self.sections[ section - 1 ].users.count } } + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cell = UITableViewCell() if !(self.resultSearchController.isActive) && indexPath.section == 0 { @@ -216,18 +193,17 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult } return cell } - override func tableView(_ tableView: UITableView, - titleForHeaderInSection section: Int) - -> String { - if section == 0 { - return " " - } - tableView.headerView(forSection: section)?.backgroundColor = UIColor.red - if !self.sections[section - 1].users.isEmpty { - return self.collation.sectionTitles[section - 1] - }else{ - return "" - } + + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String { + if section == 0 { + return " " + } + tableView.headerView(forSection: section)?.backgroundColor = UIColor.red + if !self.sections[section - 1].users.isEmpty { + return self.collation.sectionTitles[section - 1] + }else{ + return "" + } } override func sectionIndexTitles(for tableView: UITableView) -> [String]? { diff --git a/iGap/Controller/View Controllers/Setting/IGSettingHaveCheckmarkOntheLeftTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingHaveCheckmarkOntheLeftTableViewController.swift index 4ca6cac..0bbc367 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingHaveCheckmarkOntheLeftTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingHaveCheckmarkOntheLeftTableViewController.swift @@ -31,13 +31,11 @@ class IGSettingHaveCheckmarkOntheLeftTableViewController: UITableViewController currentUser = realm.objects(IGRegisteredUser.self).filter(predicate).first! self.navigationItem.title = navBarTitle - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: "Done", title: mode) navigationItem.navigationController = self.navigationController as! IGNavigationController - let navigationController = self.navigationController as! IGNavigationController + let navigationController = self.navigationController as? IGNavigationController navigationItem.rightViewContainer?.addAction { self.doneButtonClicked() } diff --git a/iGap/Controller/View Controllers/Setting/IGSettingNotificationTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingNotificationTableViewController.swift index b3b4530..6acb7d2 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingNotificationTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingNotificationTableViewController.swift @@ -24,13 +24,11 @@ class IGSettingNotificationTableViewController: UITableViewController { @IBOutlet weak var inAppSoundsSwitch: UISwitch! @IBOutlet weak var groupNotificationSoundLabel: UILabel! - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) doNotDistrubSwitch.addTarget(self, action: #selector(IGSettingNotificationTableViewController.stateChanged), for: UIControlEvents.valueChanged) } diff --git a/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityPasscodeLockTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityPasscodeLockTableViewController.swift index e425e15..0807309 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityPasscodeLockTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityPasscodeLockTableViewController.swift @@ -20,9 +20,7 @@ class IGSettingPrivacy_SecurityPasscodeLockTableViewController: UITableViewContr var index : Int? override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Passcode Lock") } @@ -42,8 +40,8 @@ class IGSettingPrivacy_SecurityPasscodeLockTableViewController: UITableViewContr override func numberOfSections(in tableView: UITableView) -> Int { if loadItForSecendTime == false { - return 1 - }else{ + return 1 + } else { return 2 } } diff --git a/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityTableViewController.swift index 044a068..f0596a9 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingPrivacy&SecurityTableViewController.swift @@ -13,7 +13,7 @@ import RealmSwift import MBProgressHUD import IGProtoBuff -class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGestureRecognizerDelegate { +class IGSettingPrivacy_SecurityTableViewController: UITableViewController, UIGestureRecognizerDelegate { @IBOutlet weak var AlloLoginSwitch: UISwitch! @IBOutlet weak var whoCanSeeProfilePhotoLabel: UILabel! @@ -21,6 +21,8 @@ class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGe @IBOutlet weak var numberOfBlockedContacts: UILabel! @IBOutlet weak var whoCanSeeLastSeenLabel: UILabel! @IBOutlet weak var whoCanAddingToGroupLabel: UILabel! + + var selectedIndexPath : IndexPath! var hud = MBProgressHUD() var blockedUsers = try! Realm().objects(IGRegisteredUser.self).filter("isBlocked == 1" ) @@ -32,38 +34,36 @@ class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGe var lastSeenUserPrivacy: IGPrivacyLevel? var groupInviteUserPrivacy: IGPrivacyLevel? var channelInviteUserPrivacy: IGPrivacyLevel? + var twoStepVerification: IGTwoStepVerification? + override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Privacy & Security") navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self + fetchBlockedContactsFromServer() + let predicate = NSPredicate(format: "isBlocked == 1") blockedUsers = try! Realm().objects(IGRegisteredUser.self).filter(predicate) - numberOfBlockedContacts.text = "\(blockedUsers.count) Contact" + numberOfBlockedContacts.text = "\(blockedUsers.count) users" self.notificationToken = blockedUsers.addNotificationBlock { (changes: RealmCollectionChange) in switch changes { case .initial: self.tableView.reloadData() break - case .update(_, let deletions, let insertions, let modifications): - self.tableView.reloadData() - + case .update(_,_,_,_): print("updating members tableV") - self.tableView.reloadData() - break case .error(let err): // An error occurred while opening the Realm file on the background worker thread fatalError("\(err)") - break - + break } } @@ -72,7 +72,7 @@ class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGe case .initial: self.tableView.reloadData() break - case .update(_, let deletions, let insertions, let modifications): + case .update(_,_,_,_): print("updating members tableV") // Query messages have changed, so apply them to the TableView self.tableView.reloadData() @@ -143,8 +143,8 @@ class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGe } } - } + override func viewWillAppear(_ animated: Bool) { self.tableView.isUserInteractionEnabled = true fetchBlockedContactsFromServer() @@ -208,7 +208,8 @@ class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGe } } } - func fetchBlockedContactsFromServer(){ + + func fetchBlockedContactsFromServer(){ IGUserContactsGetBlockedListRequest.Generator.generate().success({ (protoResponse) in DispatchQueue.main.async { switch protoResponse { @@ -240,60 +241,76 @@ class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGe } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - var numberOfRows : Int = 0 switch section { case 0: - numberOfRows = 5 + return 5 case 1: - numberOfRows = 1 + return 2 default: - break + return 0 } - return numberOfRows } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { selectedIndexPath = indexPath - if indexPath.section == 0 && indexPath.row == 0 { - self.tableView.isUserInteractionEnabled = false - performSegue(withIdentifier: "GoToBlockListPageFromPrivacyAndSecurity", sender: self) - //selectedIndexPath = indexPath - } - if indexPath.section == 0 && indexPath.row != 0 { - self.tableView.isUserInteractionEnabled = false - performSegue(withIdentifier: "GoToWhoCanSeeYourPrivacyAndPolicyPage", sender: self) - } - - if indexPath.section == 1 { - switch indexPath.row { - case 1 : + if indexPath.section == 0 { + if indexPath.row == 0 { self.tableView.isUserInteractionEnabled = false - performSegue(withIdentifier: "GoToPassCodeLockSettingsPage", sender: self) - case 2 : + performSegue(withIdentifier: "GoToBlockListPageFromPrivacyAndSecurity", sender: self) + } else { self.tableView.isUserInteractionEnabled = false - performSegue(withIdentifier: "GoToTwoStepVerificationPage", sender: self) + performSegue(withIdentifier: "GoToWhoCanSeeYourPrivacyAndPolicyPage", sender: self) + } + } else if indexPath.section == 1 { + switch indexPath.row { case 0 : self.tableView.isUserInteractionEnabled = false performSegue(withIdentifier: "GoToActiveSessionListPage", sender: self) - default: + case 1 : + self.tableView.isUserInteractionEnabled = false + let hud = MBProgressHUD.showAdded(to: self.view, animated: true) + hud.mode = .indeterminate + IGUserTwoStepVerificationGetPasswordDetailRequest.Generator.generate().success({ (protoResponse) in + DispatchQueue.main.async { + hud.hide(animated: true) + switch protoResponse { + case let getPasswordDetailsResponse as IGPUserTwoStepVerificationGetPasswordDetailResponse: + self.twoStepVerification = IGUserTwoStepVerificationGetPasswordDetailRequest.Handler.interpret(response: getPasswordDetailsResponse) + self.performSegue(withIdentifier: "ShowTwoStepVerificationPassword", sender: self) + default: + self.showAlert(title: "Alert", message: "Bad response") + } + } + }).error({ (errorCode, waitTime) in + switch errorCode { + case .userTwoStepVerificationGetPasswordDetailsBadPayload: + self.showAlert(title: "Alert", message: "Bad payload") + case .userTwoStepVerificationGetPasswordDetailsInternalServerError: + self.showAlert(title: "Alert", message: "Internal Server Error") + case .userTwoStepVerificationGetPasswordDetailsForbidden: + self.showAlert(title: "Alert", message: "Forbidden") + case .userTwoStepVerificationGetPasswordDetailsNoPassword: + self.performSegue(withIdentifier: "GoToTwoStepVerificationPage", sender: self) + default: + break + } + }).send() + case 2 : + self.tableView.isUserInteractionEnabled = false + performSegue(withIdentifier: "GoToPassCodeLockSettingsPage", sender: self) + default: break } } - //selectedIndexPath = indexPath - } - override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { - var footerText = "" - if section == 1 { - footerText = "" - //"Switch this on to use the PC and iPad version of iGap, and to login to other iGap web and mobile services." - } - return footerText } + @IBAction func goBackToPrivacyAndSecurityList(seque:UIStoryboardSegue){ - numberOfBlockedContacts.text = "\(blockedUsers.count) Contact " + numberOfBlockedContacts.text = "\(blockedUsers.count) users" } + + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - if let whoCanSeeYourPrivacyAndSetting = segue.destination as? IGPrivacyAndSecurityWhoCanSeeTableViewController { if selectedIndexPath.section == 0 { switch selectedIndexPath.row { @@ -323,6 +340,8 @@ class IGSettingPrivacy_SecurityTableViewController: UITableViewController , UIGe break } } + } else if let destinationVC = segue.destination as? IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController { + destinationVC.twoStepVerification = twoStepVerification } } } diff --git a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionMoreDetailsTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionMoreDetailsTableViewController.swift index da528ec..c4f05b8 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionMoreDetailsTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionMoreDetailsTableViewController.swift @@ -25,11 +25,10 @@ class IGSettingPrivacyAndSecurityActiveSessionMoreDetailsTableViewController: UI @IBOutlet weak var SelectedSessionDeviceModelLabel: UILabel! @IBOutlet weak var selectedSessionImageview: UIImageView! var hud = MBProgressHUD() + override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) SessionInfoCell.selectionStyle = UITableViewCellSelectionStyle.none let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Active Sessions") diff --git a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift b/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift index 0112c97..2d8a671 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell.swift @@ -11,7 +11,7 @@ import UIKit class IGSettingPrivacyAndSecurityActiveSessionsDetailTableViewCell: UITableViewCell { - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() @IBOutlet weak var activeSessionImageView: UIImageView! @IBOutlet weak var activeSessionTitle: UILabel! diff --git a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift index 4a76611..c0c229c 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityActiveSessionsTableViewController.swift @@ -22,9 +22,7 @@ class IGSettingPrivacyAndSecurityActiveSessionsTableViewController: UITableViewC override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Active Sessions") navigationItem.navigationController = self.navigationController as? IGNavigationController diff --git a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift deleted file mode 100644 index 7097fcd..0000000 --- a/iGap/Controller/View Controllers/Setting/IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.swift +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This is the source code of iGap for iOS - * It is licensed under GNU AGPL v3.0 - * You should have received a copy of the license in this archive (see LICENSE). - * Copyright © 2017 , iGap - www.iGap.net - * iGap Messenger | Free, Fast and Secure instant messaging application - * The idea of the RooyeKhat Media Company - www.RooyeKhat.co - * All rights reserved. - */ - -import UIKit - -class IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController: UITableViewController { - - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) - override func viewDidLoad() { - super.viewDidLoad() - setupNextBarButtonItem() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView - } - override func numberOfSections(in tableView: UITableView) -> Int { - return 1 - } - override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 4 - } - override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) { - let header: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView - header.textLabel?.text = header.textLabel?.text?.capitalized - header.textLabel?.textAlignment = .center - } - - func setupNextBarButtonItem(){ - let doneBtn = UIButton() - doneBtn.frame = CGRect(x: 8, y: 300, width: 60, height: 0) - let normalTitleFont = UIFont.systemFont(ofSize: UIFont.buttonFontSize, weight: UIFontWeightSemibold) - let normalTitleColor = greenColor - let attributeText = [NSFontAttributeName: normalTitleFont, NSForegroundColorAttributeName: normalTitleColor] - let doneTitle = NSAttributedString(string: "Done", attributes: attributeText) - doneBtn.setAttributedTitle(doneTitle, for: .normal) - doneBtn.addTarget(self, action: #selector(IGSettingPrivacyAndSecurityTwoStepVerificationTableViewController.doneButtonClicked), for: UIControlEvents.touchUpInside) - let topRightBarbuttonItem = UIBarButtonItem(customView: doneBtn) - self.navigationItem.rightBarButtonItem = topRightBarbuttonItem - } - func doneButtonClicked(){ - let alert = UIAlertController(title: "Check Your E-mail", message: "Please check your e-mail and click on the vallidation link to complete Two-Step Verification setup. ", preferredStyle: UIAlertControllerStyle.alert) - alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) - alert.view.tintColor = greenColor - self.present(alert, animated: true, completion: nil) - } - -} - diff --git a/iGap/Controller/View Controllers/Setting/IGSettingQrScannerViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingQrScannerViewController.swift new file mode 100644 index 0000000..4a9ed31 --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/IGSettingQrScannerViewController.swift @@ -0,0 +1,107 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SnapKit +import MBProgressHUD +import SwiftProtobuf +import IGProtoBuff + +class IGSettingQrScannerViewController: UIViewController , UIGestureRecognizerDelegate{ + + var previewView: UIView! + var scanner: MTBBarcodeScanner? + + override func viewDidLoad() { + super.viewDidLoad() + + previewView = UIView(frame: CGRect.zero) + self.view.addSubview(previewView) + previewView.snp.makeConstraints { (make) in + make.center.equalToSuperview() + make.height.equalTo(previewView.snp.width) + make.left.equalTo(self.view.snp.left).offset(16) + make.right.equalTo(self.view.snp.right).offset(-16) + } + scanner = MTBBarcodeScanner(previewView: previewView) + + let navigationItem = self.navigationItem as! IGNavigationItem + navigationItem.addNavigationViewItems(rightItemText: nil, title: "QR Scanner") + navigationItem.navigationController = self.navigationController as? IGNavigationController + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + MTBBarcodeScanner.requestCameraPermission(success: { success in + if success { + do { + try self.scanner?.startScanning(resultBlock: { codes in + if let codes = codes { + for code in codes { + if let stringValue = code.stringValue { + self.resolveScannedQrCode(stringValue) + self.scanner?.stopScanning() + return + } + } + } + }) + } catch { + NSLog("Unable to start scanning") + } + } else { + // no access to camera + } + }) + + } + + override func viewWillDisappear(_ animated: Bool) { + self.scanner?.stopScanning() + + super.viewWillDisappear(animated) + } + + + + func resolveScannedQrCode(_ code: String) { + print("Found code: \(code)") + + if code.contains("igap://") { + + } else { + //try signing in other device + let hud = MBProgressHUD.showAdded(to: self.view, animated: true) + hud.mode = .indeterminate + IGUserVerifyNewDeviceRequest.Generator.generate(token: code).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let userVerifyNewDeviceProtoResponse as IGPUserVerifyNewDeviceResponse: + let newDeviceResponse = IGUserVerifyNewDeviceRequest.Handler.interpret(response: userVerifyNewDeviceProtoResponse) + let alertTitle = "New Device Login" + let alertMessage = "App Name: \(newDeviceResponse.appName)\nBuild Version: \(newDeviceResponse.buildVersion)\nApp Version: \(newDeviceResponse.appVersion)\nPlatform: \(newDeviceResponse.platform)\nPlatform Version: \(newDeviceResponse.platformVersion)\nDevice: \(newDeviceResponse.device)\nDevice Name: \(newDeviceResponse.devicename)" + self.showAlert(title: alertTitle, message: alertMessage, action: { + self.dismiss(animated: true, completion: nil) + }, completion: nil) + default: + break + } + } + }).error({ (error, waitTime) in + + }).send() + } + } + + +} diff --git a/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift index 853d76f..c17171f 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift @@ -15,11 +15,14 @@ import INSPhotoGalleryFramework import RxRealm import RxSwift import Gifu -class IGSettingTableViewController: UITableViewController { +import NVActivityIndicatorView +class IGSettingTableViewController: UITableViewController , NVActivityIndicatorViewable { @IBOutlet weak var usernameLabel: UILabel! @IBOutlet weak var userAvatarView: IGAvatarView! @IBOutlet weak var cameraButton: UIButton! + @IBOutlet weak var versionCell: UITableViewCell! + @IBOutlet weak var versionLabel: UILabel! var imagePicker = UIImagePickerController() let borderName = CALayer() @@ -29,7 +32,7 @@ class IGSettingTableViewController: UITableViewController { var avatars: [IGAvatar] = [] var deleteView: IGTappableView? var userAvatar: IGAvatar? - var downloadIndicatorMainView : IGDownloadUploadIndicatorView? + //var downloadIndicatorMainView : IGDownloadUploadIndicatorView? let disposeBag = DisposeBag() @@ -39,6 +42,8 @@ class IGSettingTableViewController: UITableViewController { requestToGetAvatarList() let currentUserId = IGAppManager.sharedManager.userID() + self.clearsSelectionOnViewWillAppear = true + let realm = try! Realm() let predicate = NSPredicate(format: "id = %lld", currentUserId!) if let userInDb = realm.objects(IGRegisteredUser.self).filter(predicate).first { @@ -65,20 +70,35 @@ class IGSettingTableViewController: UITableViewController { //roundUserImage(cameraButton) let cameraBtnImage = UIImage(named: "camera") cameraButton.setBackgroundImage(cameraBtnImage, for: .normal) - self.tableView.backgroundView = UIImageView(image: UIImage(named: "IG_Settigns_Bg")) + + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) + tableView.tableFooterView = UIView() imagePicker.delegate = self + if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { + self.versionLabel.text = "iGap iOS Client V \(version)" + } + + } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) self.tableView.isUserInteractionEnabled = true - requestToGetAvatarList() + // requestToGetAvatarList() } override func viewWillAppear(_ animated: Bool) { self.tableView.isUserInteractionEnabled = true - + } + + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.tableView.isUserInteractionEnabled = true + if let indexPath = tableView.indexPathForSelectedRow { + tableView.deselectRow(at: indexPath, animated: animated) + } } func requestToGetAvatarList() { @@ -91,7 +111,7 @@ class IGSettingTableViewController: UITableViewController { self.avatars = responseAvatars for avatar in self.avatars { let avatarView = IGImageView() - avatarView.setImage(avatar: avatar) + // avatarView.setImage(avatar: avatar) } @@ -126,14 +146,15 @@ class IGSettingTableViewController: UITableViewController { var avatarPhotos : [INSPhotoViewable]? var galleryPhotos: INSPhotosViewController? + var lastIndex: Array.Index? + var currentAvatarId: Int64? + var timer = Timer() func showAvatar(avatar : IGAvatar) { var photos: [INSPhotoViewable] = self.avatars.map { (avatar) -> IGMedia in - // setMediaIndicator(avatar: avatar) return IGMedia(avatar: avatar) } avatarPhotos = photos let currentPhoto = photos[0] - let deleteViewFrame = CGRect(x:320, y:595, width: 25 , height:25) let trashImageView = UIImageView() trashImageView.image = UIImage(named: "IG_Trash_avatar") @@ -144,83 +165,84 @@ class IGSettingTableViewController: UITableViewController { deleteView?.addAction { self.didTapOnTrashButton() } - downloadIndicatorMainView = IGDownloadUploadIndicatorView(frame: downloadViewFrame) - let galleryPreview = INSPhotosViewController(photos: photos, initialPhoto: currentPhoto, referenceView: nil, deleteView: deleteView, downloadView: nil) + let downloadIndicatorMainView = UIView() + downloadIndicatorMainView.backgroundColor = UIColor.white + downloadIndicatorMainView.frame = downloadViewFrame + let andicatorViewFrame = CGRect(x: view.bounds.midX, y: view.bounds.midY,width: 50 , height: 50) + let activityIndicatorView = NVActivityIndicatorView(frame: andicatorViewFrame, + type: NVActivityIndicatorType.audioEqualizer) + downloadIndicatorMainView.addSubview(activityIndicatorView) + + let galleryPreview = INSPhotosViewController(photos: photos, initialPhoto: currentPhoto, referenceView: nil, deleteView: deleteView, downloadView: downloadIndicatorMainView) galleryPhotos = galleryPreview present(galleryPreview, animated: true, completion: nil) - - } - - func setMediaIndicator(avatar: IGAvatar) { - if let msgAttachment = avatar.file { - if let messageAttachmentVariableInCache = IGAttachmentManager.sharedManager.getRxVariable(attachmentPrimaryKeyId: msgAttachment.primaryKeyId!) { - self.userAvatar?.file = messageAttachmentVariableInCache.value - } else { - self.userAvatar?.file = msgAttachment.detach() - let attachmentRef = ThreadSafeReference(to: msgAttachment) - IGAttachmentManager.sharedManager.add(attachmentRef: attachmentRef) - self.userAvatar?.file = IGAttachmentManager.sharedManager.getRxVariable(attachmentPrimaryKeyId: msgAttachment.primaryKeyId!)?.value - } + activityIndicatorView.startAnimating() + //activityIndicatorView.startAnimating() + + DispatchQueue.main.async { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + let thisPhoto = galleryPreview.accessCurrentPhotoDetail() - if let variableInCache = IGAttachmentManager.sharedManager.getRxVariable(attachmentPrimaryKeyId: msgAttachment.primaryKeyId!) { - self.userAvatar?.file = variableInCache.value - variableInCache.asObservable().subscribe({ (event) in - DispatchQueue.main.async { - self.updateAttachmentDownloadUploadIndicatorView() - } - }).addDisposableTo(disposeBag) - } else { + //self.avatarPhotos.index(of:thisPhoto) + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + self.lastIndex = index + let currentAvatarFile = self.avatars[index].file + self.currentAvatarId = self.avatars[index].id + if currentAvatarFile?.status == .downloading { + return } - //MARK: ▶︎ Rx End - //self.forwardedMessageAudioAndVoiceViewHeightConstraint.constant = 0 - self.userAvatarView.isHidden = false - self.downloadIndicatorMainView?.isHidden = false - let progress = Progress(totalUnitCount: 100) - progress.completedUnitCount = 0 - - // self.sharedMediaImageView.setThumbnail(for: msgAttachment) - // self.forwardedMessageMediaContainerViewHeightConstraint.constant = messageSizes.forwardedMessageAttachmentHeight //+ 20 - - if msgAttachment.status != .ready { - self.downloadIndicatorMainView?.size = msgAttachment.sizeToString() - self.downloadIndicatorMainView?.delegate = self - } - - - } - + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + galleryPreview.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) + } + + } + + } + scheduledTimerWithTimeInterval() + } + func scheduledTimerWithTimeInterval(){ + // Scheduling timer to Call the function **Countdown** with the interval of 1 seconds + timer = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true) } - - func updateAttachmentDownloadUploadIndicatorView() { - if let attachment = self.userAvatar?.file { - - if attachment.status == .ready { - self.downloadIndicatorMainView?.setState(attachment.status) - setThumbnailForAttachments() - if attachment.type == .image { - // self.currentPhoto.setThumbnail(for: attachment) + func updateCounting(){ + let nextPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === nextPhoto}) { + let currentAvatarFile = self.avatars[index].file + let nextAvatarId = self.avatars[index].id + if nextAvatarId != self.currentAvatarId { + let size = CGSize(width: 30, height: 30) + self.startAnimating(size, message: nil, type: NVActivityIndicatorType.ballRotateChase) + if currentAvatarFile?.status == .downloading { + return } - return - } - - - switch attachment.type { - case .video, .image: - self.downloadIndicatorMainView?.setFileType(.media) - self.downloadIndicatorMainView?.setState(attachment.status) - if attachment.status == .downloading || attachment.status == .uploading { - self.downloadIndicatorMainView?.setPercentage(attachment.downloadUploadPercent) + + if let attachment = currentAvatarFile { + IGDownloadManager.sharedManager.download(file: attachment, previewType: .originalFile, completion: { + self.galleryPhotos?.hiddenDownloadView() + self.stopAnimating() + }, failure: { + + }) } - default: - break + self.currentAvatarId = nextAvatarId + } else { + } } - } + + + func setThumbnailForAttachments() { if let attachment = self.userAvatar?.file { // self.currentPhoto.isHidden = false @@ -230,21 +252,40 @@ class IGSettingTableViewController: UITableViewController { func didTapOnTrashButton() { - -// galleryPhotos?.currentPhotoViewController = { [weak self] photo in -// if let index = self?.avatarPhotos?.index(where: {$0 === photo}) { -// print(self?.avatars[index].id) -// // let indexPath = IndexPath(item: index, section: 0) -// //let cell = collectionView.cellForItem(at: indexPath) as? ExampleCollectionViewCell -// } -// return nil -// } -// if let index = self.avatarPhotos?.index(where: {$0 === photo}) { -// print(avatars[index].id) -// -// } - - } + timer.invalidate() + let thisPhoto = galleryPhotos?.accessCurrentPhotoDetail() + if let index = self.avatarPhotos?.index(where: {$0 === thisPhoto}) { + let thisAvatarId = self.avatars[index].id + IGUserAvatarDeleteRequest.Generator.generate(avatarID: thisAvatarId).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let userAvatarDeleteResponse as IGPUserAvatarDeleteResponse : + IGUserAvatarDeleteRequest.Handler.interpret(response: userAvatarDeleteResponse) + self.avatarPhotos?.remove(at: index) + self.scheduledTimerWithTimeInterval() + default: + break + } + } + }).error ({ (errorCode, waitTime) in + self.scheduledTimerWithTimeInterval() + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + + } + } + override func numberOfSections(in tableView: UITableView) -> Int { return 3 @@ -253,11 +294,11 @@ class IGSettingTableViewController: UITableViewController { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { switch section { case 0: - return 1 + return 6 case 1: - return 2 - case 2 : - return 2 + return 1 + case 2: + return 1 default: return 0 } @@ -266,39 +307,39 @@ class IGSettingTableViewController: UITableViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - if indexPath.section == 0 && indexPath.row == 0 { - self.tableView.isUserInteractionEnabled = false - performSegue(withIdentifier: "GoToAccountSettingPage", sender: self) - } - if indexPath.section == 1 && indexPath.row == 0 { - self.tableView.isUserInteractionEnabled = false - - performSegue(withIdentifier: "GoToContactListPage", sender: self) - } - if indexPath.section == 1 && indexPath.row == 2 { - self.tableView.isUserInteractionEnabled = false - - performSegue(withIdentifier: "GoToChatSettingPage", sender: self) - } - if indexPath.section == 1 && indexPath.row == 3 { - self.tableView.isUserInteractionEnabled = false - - performSegue(withIdentifier: "GoToNotificationSettingsPage", sender: self) - } - if indexPath.section == 1 && indexPath.row == 1 { - self.tableView.isUserInteractionEnabled = false - performSegue(withIdentifier: "GoToPrivacyAndPolicySettingsPage", sender: self) - } - if indexPath.section == 2 && indexPath.row == 0 { - shareContent = "Hey Join iGap and start new connection with friends and family for free, no matter what device they are on!\niGap Limitless Connection\nwww.iGap.net" - let activityViewController = UIActivityViewController(activityItems: [shareContent as NSString], applicationActivities: nil) - - present(activityViewController, animated: true, completion: {}) - } - if indexPath.section == 2 && indexPath.row == 1 { + if indexPath.section == 0 { + if indexPath.row == 0 { + self.tableView.isUserInteractionEnabled = false + performSegue(withIdentifier: "GoToAccountSettingPage", sender: self) + } else if indexPath.row == 1 { + self.tableView.isUserInteractionEnabled = false + performSegue(withIdentifier: "GoToContactListPage", sender: self) + } else if indexPath.row == 2 { + self.tableView.isUserInteractionEnabled = false + performSegue(withIdentifier: "GoToPrivacyAndPolicySettingsPage", sender: self) + } else if indexPath.row == 3 { + shareContent = "Hey Join iGap and start new connection with friends and family for free, no matter what device they are on!\niGap Limitless Connection\nwww.iGap.net" + let activityViewController = UIActivityViewController(activityItems: [shareContent as NSString], applicationActivities: nil) + + present(activityViewController, animated: true, completion: {}) + } else if indexPath.row == 4 { + self.tableView.isUserInteractionEnabled = false + performSegue(withIdentifier: "GoToAboutSettingPage", sender: self) + } else if indexPath.row == 5 { + showLogoutActionSheet() + } else if indexPath.row == 6 { + self.tableView.isUserInteractionEnabled = false + performSegue(withIdentifier: "GoToChatSettingPage", sender: self) + } else if indexPath.row == 7 { + self.tableView.isUserInteractionEnabled = false + performSegue(withIdentifier: "GoToNotificationSettingsPage", sender: self) + } + + } else if indexPath.section == 1 && indexPath.row == 0 { self.tableView.isUserInteractionEnabled = false - performSegue(withIdentifier: "GoToAboutSettingPage", sender: self) + performSegue(withIdentifier: "ShowQRScanner", sender: self) } + self.tableView.deselectRow(at: indexPath, animated: false) } override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { @@ -411,6 +452,40 @@ extension IGSettingTableViewController: UIImagePickerControllerDelegate { func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { dismiss(animated: true, completion: nil) } + + + + func showLogoutActionSheet(){ + let logoutConfirmAlertView = UIAlertController(title: "Are you sure you want to Log out?", message: nil, preferredStyle: .actionSheet) + let logoutAction = UIAlertAction(title: "Log out", style:.default , handler: { + (alert: UIAlertAction) -> Void in + self.dismiss(animated: true, completion: { + let appDelegate = UIApplication.shared.delegate as! AppDelegate + appDelegate.logoutAndShowRegisterViewController() + IGWebSocketManager.sharedManager.closeConnection() + }) + + }) + let cancelAction = UIAlertAction(title: "Cancel", style:.cancel , handler: { + (alert: UIAlertAction) -> Void in + }) + logoutConfirmAlertView.addAction(logoutAction) + logoutConfirmAlertView.addAction(cancelAction) + let alertActions = logoutConfirmAlertView.actions + for action in alertActions { + if action.title == "Log out"{ + let logoutColor = UIColor.red + action.setValue(logoutColor, forKey: "titleTextColor") + } + } + logoutConfirmAlertView.view.tintColor = UIColor.organizationalColor() + if let popoverController = logoutConfirmAlertView.popoverPresentationController { + popoverController.sourceView = self.tableView + popoverController.sourceRect = CGRect(x: self.tableView.frame.midX-self.tableView.frame.midX/2, y: self.tableView.frame.midX-self.tableView.frame.midX/2, width: self.tableView.frame.midX, height: self.tableView.frame.midY) + popoverController.permittedArrowDirections = UIPopoverArrowDirection.init(rawValue: 0) + } + present(logoutConfirmAlertView, animated: true, completion: nil) + } } extension IGSettingTableViewController: UINavigationControllerDelegate { diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift new file mode 100644 index 0000000..8712e71 --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController.swift @@ -0,0 +1,27 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SwiftProtobuf +import IGProtoBuff +import MBProgressHUD + +class IGSettingPrivacyAndSecurityTwoStepVerificationChangeEmailTableViewController: UITableViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var emailTextField: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } + +} diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift new file mode 100644 index 0000000..0064fd2 --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController.swift @@ -0,0 +1,26 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SwiftProtobuf +import IGProtoBuff +import MBProgressHUD + +class IGSettingPrivacyAndSecurityTwoStepVerificationChangeHintTableViewController: UITableViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var hintTextField: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } +} diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift new file mode 100644 index 0000000..bd5e5d3 --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController.swift @@ -0,0 +1,30 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SwiftProtobuf +import IGProtoBuff +import MBProgressHUD + +class IGSettingPrivacyAndSecurityTwoStepVerificationChangePasswordTableViewController: UITableViewController, UIGestureRecognizerDelegate { + + + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var verifyTextField: UITextField! + + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } + +} diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift new file mode 100644 index 0000000..b4e8f6d --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController.swift @@ -0,0 +1,30 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SwiftProtobuf +import IGProtoBuff +import MBProgressHUD + +class IGSettingPrivacyAndSecurityTwoStepVerificationChangeSecurityQuestionsTableViewController: UITableViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var question1TextField: UITextField! + @IBOutlet weak var answer1TextField: UITextField! + @IBOutlet weak var question2TextField: UITextField! + @IBOutlet weak var answer2TextField: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } + +} diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift new file mode 100644 index 0000000..24c60bf --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift @@ -0,0 +1,52 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SwiftProtobuf +import IGProtoBuff +import MBProgressHUD + +class IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController: UITableViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var unverifiedEmailContainerView: UIView! + @IBOutlet weak var unverifiedEmailAddressLabel: IGLabel! + + var twoStepVerification: IGTwoStepVerification? + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + + let navigationItem = self.navigationItem as! IGNavigationItem + navigationItem.addNavigationViewItems(rightItemText: "", title: "Options") + navigationItem.navigationController = self.navigationController as? IGNavigationController + } + + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if indexPath.row == 0 { + //remove password + } else if indexPath.row == 1 { + self.performSegue(withIdentifier: "showChangePassword", sender: self) + } else if indexPath.row == 2 { + self.performSegue(withIdentifier: "showChangeHint", sender: self) + } else if indexPath.row == 3 { + self.performSegue(withIdentifier: "showChangeSecurityQuestions", sender: self) + } else if indexPath.row == 4 { + self.performSegue(withIdentifier: "showChangeEmail", sender: self) + } + } + + @IBAction func didTapOnResentVerifyCodeButton(_ sender: UIButton) { + + } +} diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift new file mode 100644 index 0000000..3c69b15 --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController.swift @@ -0,0 +1,63 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SwiftProtobuf +import IGProtoBuff +import MBProgressHUD + +class IGSettingPrivacyAndSecurityTwoStepVerificationSetTwoStepVerificationTableViewController: UITableViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var verifyTextField: UITextField! + @IBOutlet weak var question1TextField: UITextField! + @IBOutlet weak var answer1TextField: UITextField! + @IBOutlet weak var question2TextField: UITextField! + @IBOutlet weak var answer2TextField: UITextField! + @IBOutlet weak var hintTextField: UITextField! + @IBOutlet weak var emailTextField: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } + + + +// override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) { +// let header: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView +// header.textLabel?.text = header.textLabel?.text?.capitalized +// header.textLabel?.textAlignment = .center +// } +// +// func setupNextBarButtonItem(){ +// let doneBtn = UIButton() +// doneBtn.frame = CGRect(x: 8, y: 300, width: 60, height: 0) +// let normalTitleFont = UIFont.systemFont(ofSize: UIFont.buttonFontSize, weight: UIFontWeightSemibold) +// let normalTitleColor = greenColor +// let attributeText = [NSFontAttributeName: normalTitleFont, NSForegroundColorAttributeName: normalTitleColor] +// let doneTitle = NSAttributedString(string: "Done", attributes: attributeText) +// doneBtn.setAttributedTitle(doneTitle, for: .normal) +// doneBtn.addTarget(self, action: #selector(doneButtonClicked), for: UIControlEvents.touchUpInside) +// let topRightBarbuttonItem = UIBarButtonItem(customView: doneBtn) +// self.navigationItem.rightBarButtonItem = topRightBarbuttonItem +// } +// +// func doneButtonClicked(){ +// let alert = UIAlertController(title: "Check Your E-mail", message: "Please check your e-mail and click on the vallidation link to complete Two-Step Verification setup. ", preferredStyle: UIAlertControllerStyle.alert) +// alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) +// alert.view.tintColor = greenColor +// self.present(alert, animated: true, completion: nil) +// } + +} + diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift new file mode 100644 index 0000000..c1365fd --- /dev/null +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift @@ -0,0 +1,127 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import SwiftProtobuf +import IGProtoBuff +import MBProgressHUD + +class IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController: UITableViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var passwordTextField: UITextField! + + var twoStepVerification: IGTwoStepVerification? + + override func viewDidLoad() { + super.viewDidLoad() + + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + + let navigationItem = self.navigationItem as! IGNavigationItem + navigationItem.addNavigationViewItems(rightItemText: "Verify", title: "Password") + navigationItem.navigationController = self.navigationController as? IGNavigationController + navigationItem.rightViewContainer?.addAction { + self.verifyPassword() + } + } + + + override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { + if let hint = self.twoStepVerification?.hint { + return "Hint: \(hint)" + } + return "" + } + + func verifyPassword() { + self.performSegue(withIdentifier: "showTwoStepOptions", sender: self) + return + if let password = passwordTextField.text, password != "" { + self.tableView.isUserInteractionEnabled = false + self.tableView.isScrollEnabled = false + let hud = MBProgressHUD.showAdded(to: self.view, animated: true) + hud.mode = .indeterminate + + IGUserTwoStepVerificationCheckPasswordRequest.Generator.generate(password: password).success({ (protoResponse) in + DispatchQueue.main.async { + if protoResponse is IGPUserTwoStepVerificationCheckPasswordResponse { + hud.hide(animated: true) + self.tableView.isUserInteractionEnabled = true + self.tableView.isScrollEnabled = true + self.performSegue(withIdentifier: "showTwoStepOptions", sender: self) + } else { + //invalid proto response class + //should never happen! + hud.hide(animated: true) + self.tableView.isUserInteractionEnabled = true + self.tableView.isScrollEnabled = true + } + } + }).error({ (errorCode, waitTime) in + DispatchQueue.main.async { + hud.hide(animated: true) + self.tableView.isUserInteractionEnabled = true + self.tableView.isScrollEnabled = true + switch errorCode { + case .userTwoStepVerificationCheckPasswordBadPayload: + self.showAlert(title: "Error", message: "Bad Payload") + case .userTwoStepVerificationCheckPasswordInternalServerError: + self.showAlert(title: "Error", message: "Internal Server Error") + case .userTwoStepVerificationCheckPasswordInvalidPassword: + self.showAlert(title: "Error", message: "Invalid Password") + case .userTwoStepVerificationCheckPasswordMaxTryLock: + self.showAlert(title: "Error", message: "Maximum try reached. Please try after \(waitTime!) seconds") + case .userTwoStepVerificationCheckPasswordNoPassword: + self.showAlert(title: "Error", message: "Password is not set for this account") + case.timeout: + self.showAlert(title: "Error", message: "Timeout") + default: + self.showAlert(title: "Error", message: "Unknown Error") + } + } + }).send() + } + } + + @IBAction func didTapOnForgotPasswordButton(_ sender: UIButton) { + let alertVC = UIAlertController(title: "Forgot Password?", message: "Which option do you want to use to change your password?", preferredStyle: .actionSheet) + + + let email = UIAlertAction(title: "Email", style: .default) { (action) in + let hud = MBProgressHUD.showAdded(to: self.view, animated: true) + hud.mode = .indeterminate + self.tableView.isScrollEnabled = false + IGUserTwoStepVerificationRequestRecoveryTokenRequest.Generator.generate().success({ (success) in + + }).error({ (errorCode, waitTime) in + + }).send() + } + let questions = UIAlertAction(title: "Recovery Questions", style: .default) { (action) in + self.performSegue(withIdentifier: "changePasswordWithQuestions", sender: self) + } + let cancel = UIAlertAction(title: "Cancel", style: .cancel) { (action) in + + } + alertVC.addAction(email) + alertVC.addAction(questions) + alertVC.addAction(cancel) + + self.present(alertVC, animated: true, completion: nil) + } + + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if let destinationVC = segue.destination as? IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController { + destinationVC.twoStepVerification = twoStepVerification + } + } +} diff --git a/iGap/Controller/View Controllers/Setting/iGAccountTableViewController.swift b/iGap/Controller/View Controllers/Setting/iGAccountTableViewController.swift index f214194..5a480a0 100644 --- a/iGap/Controller/View Controllers/Setting/iGAccountTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/iGAccountTableViewController.swift @@ -27,13 +27,11 @@ class IGAccountTableViewController: UITableViewController , UINavigationControll override func viewDidLoad() { super.viewDidLoad() self.navigationItem.title = "Account" - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) showAccountDetail() let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "Account") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self } @@ -147,7 +145,7 @@ class IGAccountTableViewController: UITableViewController , UINavigationControll self.dismiss(animated: true, completion: { let appDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.logoutAndShowRegisterViewController() - IGWebSocketManager.sharedManager.closeConnection(reconnect: true) + IGWebSocketManager.sharedManager.closeConnection() }) }) diff --git a/iGap/Controller/View Controllers/Setting/iGDeleteAccountReasonTableViewController.swift b/iGap/Controller/View Controllers/Setting/iGDeleteAccountReasonTableViewController.swift index 7a6dac3..1778510 100644 --- a/iGap/Controller/View Controllers/Setting/iGDeleteAccountReasonTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/iGDeleteAccountReasonTableViewController.swift @@ -26,14 +26,12 @@ class IGDeleteAccountReasonTableViewController: UITableViewController , UIGestur tickImageView.isHidden = true secondCellTickImageView.isHidden = true thirdCellTickImageView.isHidden = true - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: "Done", title: "Delete Account") let navigationController = self.navigationController as! IGNavigationController - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self navigationItem.rightViewContainer?.addAction { self.doneButtonClicked() diff --git a/iGap/Controller/View Controllers/Setting/iGPhoneNumberPageViewController.swift b/iGap/Controller/View Controllers/Setting/iGPhoneNumberPageViewController.swift index 91ebd6f..17bd8dd 100644 --- a/iGap/Controller/View Controllers/Setting/iGPhoneNumberPageViewController.swift +++ b/iGap/Controller/View Controllers/Setting/iGPhoneNumberPageViewController.swift @@ -12,11 +12,10 @@ import UIKit class iGPhoneNumberPageViewController: UIViewController { - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) + self.view.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) setBarbuttonItem() } @IBAction func changeNumberButtonClicked(_ sender: UIButton) {} diff --git a/iGap/Controller/View Controllers/Setting/iGSetEmailTableViewController.swift b/iGap/Controller/View Controllers/Setting/iGSetEmailTableViewController.swift index 6ef7b46..4eeb088 100644 --- a/iGap/Controller/View Controllers/Setting/iGSetEmailTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/iGSetEmailTableViewController.swift @@ -20,9 +20,7 @@ class IGSetEmailTableViewController: UITableViewController,UITextFieldDelegate , override func viewDidLoad() { super.viewDidLoad() emailTextField.keyboardType = .emailAddress - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let currentUserId = IGAppManager.sharedManager.userID() let realm = try! Realm() let predicate = NSPredicate(format: "id = %lld", currentUserId!) diff --git a/iGap/Controller/View Controllers/Setting/iGSetNickNameTableViewController.swift b/iGap/Controller/View Controllers/Setting/iGSetNickNameTableViewController.swift index 0b5f01c..351261c 100644 --- a/iGap/Controller/View Controllers/Setting/iGSetNickNameTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/iGSetNickNameTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import MBProgressHUD import IGProtoBuff @@ -17,15 +17,13 @@ import IGProtoBuff class IGSetNickNameTableViewController: UITableViewController , UITextFieldDelegate , UIGestureRecognizerDelegate { @IBOutlet weak var nickNameTextField: UITextField! - let greenColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1) + let greenColor = UIColor.organizationalColor() var hud = MBProgressHUD() var limitLength = 16 override func viewDidLoad() { super.viewDidLoad() nickNameTextField.delegate = self - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: "Done", title: "Nickname") navigationItem.navigationController = self.navigationController as! IGNavigationController diff --git a/iGap/Controller/View Controllers/Setting/iGSettingAboutTableViewController.swift b/iGap/Controller/View Controllers/Setting/iGSettingAboutTableViewController.swift index 35ed8e7..ed32aa4 100644 --- a/iGap/Controller/View Controllers/Setting/iGSettingAboutTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/iGSettingAboutTableViewController.swift @@ -18,15 +18,21 @@ class IGSettingAboutTableViewController: UITableViewController , UIGestureRecogn override func viewDidLoad() { super.viewDidLoad() - let backImage = UIImage(named: "IG_Settigns_Bg") - let backgroundImageView = UIImageView(image: backImage) - self.tableView.backgroundView = backgroundImageView + self.tableView.backgroundColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.addNavigationViewItems(rightItemText: nil, title: "About") - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self + + if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { + self.appVersionLabel.text = version + } + + //appVersionLabel.text = Bundle.main. } + + override func viewDidAppear(_ animated: Bool) { self.tableView.isUserInteractionEnabled = true } @@ -81,12 +87,13 @@ class IGSettingAboutTableViewController: UITableViewController , UIGestureRecogn switch index! { case 0: destination.pageUrl = "https://www.igap.net" + destination.pageTitle = "iGap Home" case 1: destination.pageUrl = "https://blog.igap.net" + destination.pageTitle = "iGap Blog" case 2: destination.pageUrl = "https://support.igap.net" - - + destination.pageTitle = "Support" default: break } diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPasswordViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPasswordViewController.swift new file mode 100644 index 0000000..562735c --- /dev/null +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPasswordViewController.swift @@ -0,0 +1,175 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import IGProtoBuff +import SwiftProtobuf +import MBProgressHUD + +class IGRegistrationStepPasswordViewController: UIViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var passwordTextField: UITextField! + + var hud = MBProgressHUD() + + override func viewDidLoad() { + super.viewDidLoad() + self.passwordTextField.isSecureTextEntry = true + + let navigaitonItem = self.navigationItem as! IGNavigationItem + navigaitonItem.addNavigationViewItems(rightItemText: "Next", title: "Verification Code") + navigaitonItem.rightViewContainer?.addAction { + self.nextStep() + } + navigaitonItem.navigationController = self.navigationController as? IGNavigationController + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.passwordTextField.becomeFirstResponder() + + IGUserTwoStepVerificationGetPasswordDetailRequest.Generator.generate().success({ (responseProto) in + DispatchQueue.main.async { + switch responseProto { + case let passwordDetailReponse as IGPUserTwoStepVerificationGetPasswordDetailResponse: + let interpretedResponse = IGUserTwoStepVerificationGetPasswordDetailRequest.Handler.interpret(response: passwordDetailReponse) + if let hint = interpretedResponse.hint { + self.passwordTextField.placeholder = hint + } + default: + break + } + } + }).error { (errorCode, waitTime) in + + }.send() + + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + } + + + func nextStep() { + if passwordTextField.text==nil || passwordTextField.text=="" { + DispatchQueue.main.async { + let alertVC = UIAlertController(title: "Error", message: "Please enter your password.", preferredStyle: .alert) + let ok = UIAlertAction(title: "OK", style: .default, handler: nil) + alertVC.addAction(ok) + self.present(alertVC, animated: true, completion: nil) + } + return + } + + self.hud = MBProgressHUD.showAdded(to: self.view, animated: true) + self.hud.mode = .indeterminate + + if let password = passwordTextField.text { + IGUserTwoStepVerificationVerifyPasswordRequest.Generator.generate(password: password).success({ (verifyPasswordReponse) in + DispatchQueue.main.async { + switch verifyPasswordReponse { + case let verifyPasswordReponse as IGPUserTwoStepVerificationVerifyPasswordResponse: + let interpretedResponse = IGUserTwoStepVerificationVerifyPasswordRequest.Handler.interpret(response: verifyPasswordReponse) + IGAppManager.sharedManager.save(token: interpretedResponse) + self.loginUser(token: interpretedResponse) + + default: + break + } + } + }).error({ (errorCode, waitTime) in + var errorTitle = "" + var errorBody = "" + switch errorCode { + case .userTwoStepVerificationVerifyPasswordBadPayload : + errorTitle = "Error" + errorBody = "Invalid payload" + break + case .userTwoStepVerificationVerifyPasswordInternalServerError : + errorTitle = "Error" + errorBody = "Inernal server error. Try agian later and if problem persists contact iGap support." + break + case .userTwoStepVerificationVerifyPasswordMaxTryLock : + errorTitle = "" + errorBody = "Too many failed password verification attempt." + break + case .userTwoStepVerificationVerifyPasswordInvalidPassword : + errorTitle = "Invalid Code" + errorBody = "The password you entered is not valid. Verify the password and try again." + break + case .timeout: + errorTitle = "Timeout" + errorBody = "Please try again later." + break + default: + errorTitle = "Unknown error" + errorBody = "An error occured. Please try again later.\nCode \(errorCode)" + break + } + if waitTime != nil && waitTime != 0 { + errorBody += "\nPlease try again in \(waitTime!) seconds." + } + DispatchQueue.main.async { + let alert = UIAlertController(title: errorTitle, message: errorBody, preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.hud.hide(animated: true) + self.present(alert, animated: true, completion: nil) + } + + }).send() + } + } + + fileprivate func loginUser(token: String) { + IGUserLoginRequest.Generator.generate(token: token).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case _ as IGPUserLoginResponse: + IGAppManager.sharedManager.setUserLoginSuccessful() + + IGUserInfoRequest.Generator.generate(userID: IGAppManager.sharedManager.userID()!).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let userInfoResponse as IGPUserInfoResponse: + let igpUser = userInfoResponse.igpUser + IGFactory.shared.saveRegistredUsers([igpUser]) + break + default: + break + } + self.hud.hide(animated: true) + IGAppManager.sharedManager.setUserLoginSuccessful() + self.dismiss(animated: true, completion: nil) + } + }).error({ (errorCode, waitTime) in + DispatchQueue.main.async { + self.hud.hide(animated: true) + let alertVC = UIAlertController(title: "Error", message: "There was an error logging you in. Try again please.", preferredStyle: .alert) + let ok = UIAlertAction(title: "OK", style: .default, handler: nil) + alertVC.addAction(ok) + self.present(alertVC, animated: true, completion: nil) + } + }).send() + + default: + break + } + } + }).error({ (errorCode, waitTime) in + + }).send() + } + +} diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift index ebce98f..e9185d7 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift @@ -10,7 +10,7 @@ import UIKit import AKMaskField -import ProtocolBuffers +import SwiftProtobuf import MBProgressHUD import RxSwift import IGProtoBuff @@ -78,34 +78,42 @@ class IGRegistrationStepPhoneViewController: UIViewController { }, onDisposed: { }).addDisposableTo(disposeBag) + + + let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapOnBackground)) + self.view.addGestureRecognizer(tapRecognizer) } + func didTapOnBackground() { + self.phoneNumberField.resignFirstResponder() + } + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.navigationItem.hidesBackButton = true - countryBackgroundView.layer.cornerRadius = 17.0; + countryBackgroundView.layer.cornerRadius = 6.0; countryBackgroundView.layer.masksToBounds = true countryBackgroundView.layer.borderWidth = 1.0 - countryBackgroundView.layer.borderColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1.0).cgColor + countryBackgroundView.layer.borderColor = UIColor.organizationalColor().cgColor let tapOnCountry = UITapGestureRecognizer(target: self, action: #selector(showCountriesList)) countryBackgroundView.addGestureRecognizer(tapOnCountry) - phoneNumberBackgroundView.layer.cornerRadius = 17.0; + phoneNumberBackgroundView.layer.cornerRadius = 6.0; phoneNumberBackgroundView.layer.masksToBounds = true phoneNumberBackgroundView.layer.borderWidth = 1.0 - phoneNumberBackgroundView.layer.borderColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1.0).cgColor + phoneNumberBackgroundView.layer.borderColor = UIColor.organizationalColor().cgColor - countryCodeBackgroundView.layer.cornerRadius = 17.0; + countryCodeBackgroundView.layer.cornerRadius = 6.0; countryCodeBackgroundView.layer.masksToBounds = true countryCodeBackgroundView.layer.borderWidth = 1.0 - countryCodeBackgroundView.layer.borderColor = UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1.0).cgColor + countryCodeBackgroundView.layer.borderColor = UIColor.organizationalColor().cgColor let terms1 = NSMutableAttributedString(string: "By signing up you agree to our ", attributes: [NSForegroundColorAttributeName: UIColor(red: 114/255.0, green: 114/255.0, blue: 114/255.0, alpha: 1.0)]) let terms2 = NSAttributedString(string: "Terms of Service", - attributes: [NSForegroundColorAttributeName: UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 182.0/255.0, alpha: 1.0)]) + attributes: [NSForegroundColorAttributeName: UIColor.organizationalColor()]) terms1.append(terms2) termLabel.attributedText = terms1 let tapOnTerms = UITapGestureRecognizer(target: self, action: #selector(showTerms)) @@ -128,6 +136,11 @@ class IGRegistrationStepPhoneViewController: UIViewController { @IBAction func didTapOnNextBarButtonItem(_ sender: UIBarButtonItem) { } + @IBAction func didTapOnLoginUsingQRCode(_ sender: UIButton) { + self.performSegue(withIdentifier: "showQRCode", sender: self) + } + + func didTapOnNext() { if connectionStatus == .waitingForNetwork || connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift index f0bf9f6..470c786 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift @@ -11,7 +11,7 @@ import UIKit import CameraViewController import IGProtoBuff -import ProtocolBuffers +import SwiftProtobuf class IGRegistrationStepProfileInfoViewController: UITableViewController { @@ -71,7 +71,7 @@ class IGRegistrationStepProfileInfoViewController: UITableViewController { DispatchQueue.main.async { switch protoResponse { case let userInfoResponse as IGPUserInfoResponse: - let igpUser = (userInfoResponse.igpUser)! + let igpUser = userInfoResponse.igpUser IGFactory.shared.saveRegistredUsers([igpUser]) break default: diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepQrViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepQrViewController.swift new file mode 100644 index 0000000..113b6b8 --- /dev/null +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepQrViewController.swift @@ -0,0 +1,151 @@ +// +// IGRegistrationStepQrViewController.swift +// iGap +// +// Created by Kayvan on 8/16/17. +// Copyright © 2017 RooyeKhat Media. All rights reserved. +// + +import UIKit +import IGProtoBuff +import SwiftProtobuf +import MBProgressHUD + +class IGRegistrationStepQrViewController: UIViewController, UIGestureRecognizerDelegate { + + @IBOutlet weak var imageView: UIImageView! + + var expirayDate: Int32 = 0 + var imageData: Data = Data() + + override func viewDidLoad() { + super.viewDidLoad() + + let navigaitonItem = self.navigationItem as! IGNavigationItem + navigaitonItem.addNavigationViewItems(rightItemText: nil, title: "Login Using QR") + + navigaitonItem.navigationController = self.navigationController as? IGNavigationController + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + + NotificationCenter.default.addObserver(forName: IGNotificationPushLoginToken.name, object: nil, queue: .main) { (notificaion) in + if let userInfo = notificaion.userInfo { + let userID: Int64 = userInfo["userID"] as! Int64 + let token = userInfo["token"] as! String + let username = userInfo["username"] as! String + let authorHash = userInfo["authorHash"] as! String + + IGAppManager.sharedManager.save(userID: userID) + IGAppManager.sharedManager.save(username: username) + IGAppManager.sharedManager.save(authorHash: authorHash) + IGAppManager.sharedManager.save(token: token) + + IGAppManager.sharedManager.setUserLoginSuccessful() + + self.loginUser(token: token) + } + } + + NotificationCenter.default.addObserver(forName: IGNotificationPushTwoStepVerification.name, object: nil, queue: .main) { (notificaion) in + if let userInfo = notificaion.userInfo { + let userID: Int64 = userInfo["userID"] as! Int64 + let username = userInfo["username"] as! String + let authorHash = userInfo["authorHash"] as! String + + IGAppManager.sharedManager.save(userID: userID) + IGAppManager.sharedManager.save(username: username) + IGAppManager.sharedManager.save(authorHash: authorHash) + + IGAppManager.sharedManager.setUserLoginSuccessful() + + self.performSegue(withIdentifier:"twoStepPassword", sender: nil) + } + + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + getNewQrCode() + } + + func getNewQrCode() { + let hud = MBProgressHUD.showAdded(to: self.view, animated: true) + hud.mode = .indeterminate + IGQrCodeNewDeviceRequest.Generator.generate().success( { (protoResponse) in + DispatchQueue.main.async { + hud.hide(animated: true) + switch protoResponse { + case let qrCodeNewDeviceProtoResponse as IGPQrCodeNewDeviceResponse: + (self.expirayDate, self.imageData) = IGQrCodeNewDeviceRequest.Handler.interpret(response: qrCodeNewDeviceProtoResponse) + self.imageView.image = UIImage(data: self.imageData) + DispatchQueue.main.asyncAfter(deadline: .now() + Double(exactly: self.expirayDate)! , execute: { + self.getNewQrCode() + }) + break + default: + break + } + } + }).error( { (errorCode, waitTime) in + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + hud.hide(animated: true) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + }).send() + } + + func checkIfShouldUpdateQr() { + + } + + + + fileprivate func loginUser(token: String) { + let hud = MBProgressHUD.showAdded(to: self.view, animated: true) + hud.mode = .indeterminate + IGUserLoginRequest.Generator.generate(token: token).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case _ as IGPUserLoginResponse: + IGAppManager.sharedManager.setUserLoginSuccessful() + IGUserInfoRequest.Generator.generate(userID: IGAppManager.sharedManager.userID()!).success({ (protoResponse) in + DispatchQueue.main.async { + switch protoResponse { + case let userInfoResponse as IGPUserInfoResponse: + let igpUser = userInfoResponse.igpUser + IGFactory.shared.saveRegistredUsers([igpUser]) + break + default: + break + } + hud.hide(animated: true) + IGAppManager.sharedManager.setUserLoginSuccessful() + self.dismiss(animated: true, completion: nil) + } + }).error({ (errorCode, waitTime) in + DispatchQueue.main.async { + hud.hide(animated: true) + let alertVC = UIAlertController(title: "Error", message: "There was an error logging you in. Try again please.", preferredStyle: .alert) + let ok = UIAlertAction(title: "OK", style: .default, handler: nil) + alertVC.addAction(ok) + self.present(alertVC, animated: true, completion: nil) + } + }).send() + default: + break + } + } + }).error({ (errorCode, waitTime) in + + }).send() + } +} diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepTermsViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepTermsViewController.swift index 295b7b6..56cc33e 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepTermsViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepTermsViewController.swift @@ -39,7 +39,8 @@ class IGRegistrationStepTermsViewController: UIViewController { switch responseProto { case let pageInfoResponse as IGPInfoPageResponse: let body = IGInfoPageRequest.Handler.interpret(response: pageInfoResponse) - self.webView.loadHTMLString(body, baseURL: nil) + let htmlString = "" + body + self.webView.loadHTMLString(htmlString, baseURL: nil) default: break } diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift index d879afd..941bae7 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift @@ -10,7 +10,7 @@ import UIKit import IGProtoBuff -import ProtocolBuffers +import SwiftProtobuf import MBProgressHUD class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGestureRecognizerDelegate { @@ -184,8 +184,8 @@ class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGest } fileprivate func verifyUser() { - hud = MBProgressHUD.showAdded(to: self.view, animated: true) - hud.mode = .indeterminate + self.hud = MBProgressHUD.showAdded(to: self.view, animated: true) + self.hud.mode = .indeterminate if let code = Int32(codeTextField.text!){ IGUserVerifyRequest.Generator.generate(usename: self.username!, code: code).success({ (responseProto) in DispatchQueue.main.async { @@ -200,65 +200,71 @@ class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGest } } }).error({ (errorCode, waitTime) in - var errorTitle = "" - var errorBody = "" - switch errorCode { - case .userVerifyBadPayload: - errorTitle = "Error" - errorBody = "Invalid payload" - break - case .userVerifyBadPayloadInvalidCode: - errorTitle = "Error" - errorBody = "The code payload is invalid." - break - case .userVerifyBadPayloadInvalidUsername: - errorTitle = "Error" - errorBody = "Username payload is invalid." - break - case .userVerifyInternalServerError: - errorTitle = "Error" - errorBody = "Inernal server error. Try agian later and if problem persists contact iGap support." - break - case .userVerifyUserNotFound: - errorTitle = "Error" - errorBody = "Could not found the request user. Try agian later and if problem persists contact iGap support." - break - case .userVerifyBlockedUser: - errorTitle = "Error" - errorBody = "This use is blocked. You cannot register." - break - case .userVerifyInvalidCode: - errorTitle = "Invalid Code" - errorBody = "The code you entred is not valid. Verify the code and try again." - break - case .userVerifyExpiredCode: - errorTitle = "Invalid Code" - errorBody = "Code has been expired. Please request a new code." - break - case .userVerifyMaxTryLock: - errorTitle = "" - errorBody = "To many failed code verification attempt." - break - case .timeout: - errorTitle = "Timeout" - errorBody = "Please try again later." - break - default: - errorTitle = "Unknown error" - errorBody = "An error occured. Please try again later.\nCode \(errorCode)" - break - } - if waitTime != nil && waitTime != 0 { - errorBody += "\nPlease try again in \(waitTime!) seconds." - } - DispatchQueue.main.async { - let alert = UIAlertController(title: errorTitle, message: errorBody, preferredStyle: .alert) - let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) - alert.addAction(okAction) - self.hud.hide(animated: true) - self.present(alert, animated: true, completion: nil) + if errorCode == .userVerifyTwoStepVerificationEnabled { + DispatchQueue.main.async { + self.hud.hide(animated: false) + self.performSegue(withIdentifier:"twoStepPassword", sender: nil); + } + }else{ + var errorTitle = "" + var errorBody = "" + switch errorCode { + case .userVerifyBadPayload: + errorTitle = "Error" + errorBody = "Invalid payload" + break + case .userVerifyBadPayloadInvalidCode: + errorTitle = "Error" + errorBody = "The code payload is invalid." + break + case .userVerifyBadPayloadInvalidUsername: + errorTitle = "Error" + errorBody = "Username payload is invalid." + break + case .userVerifyInternalServerError: + errorTitle = "Error" + errorBody = "Inernal server error. Try agian later and if problem persists contact iGap support." + break + case .userVerifyUserNotFound: + errorTitle = "Error" + errorBody = "Could not found the request user. Try agian later and if problem persists contact iGap support." + break + case .userVerifyBlockedUser: + errorTitle = "Error" + errorBody = "This use is blocked. You cannot register." + break + case .userVerifyInvalidCode: + errorTitle = "Invalid Code" + errorBody = "The code you entred is not valid. Verify the code and try again." + break + case .userVerifyExpiredCode: + errorTitle = "Invalid Code" + errorBody = "Code has been expired. Please request a new code." + break + case .userVerifyMaxTryLock: + errorTitle = "" + errorBody = "Too many failed code verification attempt." + break + case .timeout: + errorTitle = "Timeout" + errorBody = "Please try again later." + break + default: + errorTitle = "Unknown error" + errorBody = "An error occured. Please try again later.\nCode \(errorCode)" + break + } + if waitTime != nil && waitTime != 0 { + errorBody += "\nPlease try again in \(waitTime!) seconds." + } + DispatchQueue.main.async { + let alert = UIAlertController(title: errorTitle, message: errorBody, preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.hud.hide(animated: true) + self.present(alert, animated: true, completion: nil) + } } - }).send() } } @@ -277,7 +283,7 @@ class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGest DispatchQueue.main.async { switch protoResponse { case let userInfoResponse as IGPUserInfoResponse: - let igpUser = (userInfoResponse.igpUser)! + let igpUser = userInfoResponse.igpUser IGFactory.shared.saveRegistredUsers([igpUser]) break default: diff --git a/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift index c4f3afb..56aa42d 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift @@ -10,31 +10,27 @@ import UIKit import Gifu +import SnapKit class IGSplashScreenViewController: UIViewController { - @IBOutlet weak var backgroundLatyer: UIView! - @IBOutlet weak var mainImageView: GIFImageView! - @IBOutlet weak var secondCenterImageView: UIImageView! + @IBOutlet weak var backgroundLayer: UIView! + @IBOutlet weak var gifImageView: GIFImageView! + @IBOutlet weak var pageControll: UIPageControl! + + @IBOutlet weak var topView: UIView! + @IBOutlet weak var skipButton: UIButton! + + @IBOutlet weak var bottomView: UIView! @IBOutlet weak var animateCityImageView: UIImageView! @IBOutlet weak var greenTreeImageView: UIImageView! - @IBOutlet weak var CenterImageView: UIImageView! - @IBOutlet weak var secondIGapLabel: UILabel! - @IBOutlet weak var iGapLabel: UILabel! - @IBOutlet weak var limitlessConnectionLabel: UILabel! - @IBOutlet weak var descriptionTextView: UITextView! @IBOutlet weak var startButton: UIButton! - @IBOutlet weak var skipButton: UIButton! - @IBOutlet weak var pageControll: UIPageControl! - @IBOutlet weak var topView: UIView! - @IBOutlet weak var scrollView: UIScrollView! - @IBOutlet weak var secendDescriptionTextView: UITextView! - @IBOutlet weak var thirdDescriptionTextView: UITextView! - @IBOutlet weak var fourthDescriptionTextView: UITextView! - @IBOutlet weak var fifthDescriptionTextView: UITextView! - var pageIndex : Int = 0 + + + var numberOfPages: Int = 6 + var pageIndex: Int = 0 override func viewDidLoad() { super.viewDidLoad() @@ -43,40 +39,116 @@ class IGSplashScreenViewController: UIViewController { self.navigationController?.isNavigationBarHidden = true animateCityImage() - handlePageControll() - scrollView.delegate = self - scrollView.contentSize = CGSize(width: self.view.frame.width*5, height: scrollView.frame.size.height) - scrollView.backgroundColor = UIColor.clear + addSwipegestureRecognizer() + + pageControll.numberOfPages = numberOfPages + pageControll.isUserInteractionEnabled = false + startButton.layer.borderWidth = 0 startButton.layer.cornerRadius = 15 startButton.alpha = 0.0 - + + skipButton.layer.borderWidth = 0 + skipButton.layer.cornerRadius = 8 NotificationCenter.default.addObserver(self, selector: #selector(animateCityImage), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) + let gradient: CAGradientLayer = CAGradientLayer() + let gradientStartColor = UIColor(hexString: "bae6ff") + let gradientCebterColor = UIColor(hexString: "e4f5ff") + let gradientEndColor = UIColor.white + gradient.colors = [gradientStartColor.cgColor, gradientCebterColor.cgColor, gradientEndColor.cgColor] + gradient.locations = [0.0 , 0.25, 0.5] + gradient.startPoint = CGPoint(x: 1.0, y: 0.0) + gradient.endPoint = CGPoint(x: 1.0, y: 1.0) + gradient.frame = CGRect(x: 0.0, y: 0.0, width: self.topView.frame.size.width, height: self.topView.frame.size.height) + + self.topView.layer.insertSublayer(gradient, at: 0) + + + let images = ["IG_Splash_Cute_1", "IG_Splash_Cute_2", "IG_Splash_Cute_3", "IG_Splash_Cute_4", "IG_Splash_Cute_5", "IG_Splash_Cute_6"] + let titles = ["Limitless Connection", "Security & Privacy", "Chat", "File Transferring", "Voice Call", "Everything for free in iGap!"] + let descriptions = ["Build your own world by iGap right now.\nIt takes only few minutes to join iGap community.", + "iGap attaches the utmost importance to your security and privacy using the individual encryption algorithms and guarantees a safe and secure connection between you, your friends and family.", + "You can have one-on-one or group chats and even create your own channel and add members in order to share information with millions of people.", + "You have an authority to transfer any file with any size and type or save them on your cloud storage; and then share anything you'd like to with anyone you'd want to.", + "You can make thoroughly free and secure voice calls to anyone on iGap and save your money. iGap voice call is P2P-based with no servers' interference in voice transmission.", + "Let's stop waiting!\niGap is thoroughly free. So, just now build your own world freely."] + + for i in 0.. 0 { + changeView(for: pageIndex - 1) + } + case UISwipeGestureRecognizerDirection.left: + if pageIndex < (numberOfPages - 1) { + changeView(for: pageIndex + 1) + } + default: + break + } + } + } + + func changeView(for page: Int) { + pageControll.currentPage = page + pageIndex = page + UIView.animate(withDuration: 0.5, animations: { + for view in self.topView.subviews { + if (view == self.skipButton && self.pageIndex != self.numberOfPages - 1) || view.tag == self.pageIndex { + view.alpha = 1.0 + } else { + view.alpha = 0.0 + } + } + if self.pageIndex == self.numberOfPages - 1 { + self.startButton.alpha = 1.0 + } else { + self.startButton.alpha = 0.0 + } + }) { (completed) in + } } } diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift index a5c6696..fe449fe 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift @@ -10,7 +10,7 @@ import UIKit import IGProtoBuff -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import RxRealm import RxSwift @@ -28,7 +28,9 @@ class IGChannelsTableViewController: UITableViewController { var notificationToken: NotificationToken? var connectionStatus: IGAppManager.ConnectionStatus? var hud = MBProgressHUD() - + var isLoadingMoreRooms: Bool = false + var numberOfRoomFetchedInLastRequest: Int = -1 + private let disposeBag = DisposeBag() override func viewDidLoad() { @@ -82,6 +84,11 @@ class IGChannelsTableViewController: UITableViewController { //self.setTabbarHidden(false, animated: true) } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tableView.isUserInteractionEnabled = true + } + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. @@ -90,11 +97,13 @@ class IGChannelsTableViewController: UITableViewController { //MARK: Room List actions @objc private func fetchRoomList() { - IGClientGetRoomListRequest.Generator.generate().success { (responseProtoMessage) in + isLoadingMoreRooms = true + IGClientGetRoomListRequest.Generator.generate(offset: 0, limit: 40).success { (responseProtoMessage) in DispatchQueue.main.async { + self.isLoadingMoreRooms = false switch responseProtoMessage { case let response as IGPClientGetRoomListResponse: - IGClientGetRoomListRequest.Handler.interpret(response: response) + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) default: break; } @@ -482,3 +491,37 @@ extension IGChannelsTableViewController { }.send() } } + + +extension IGChannelsTableViewController { + override func scrollViewDidScroll(_ scrollView: UIScrollView) { + let remaining = scrollView.contentSize.height - (scrollView.frame.size.height + scrollView.contentOffset.y) + if remaining < 100 { + self.loadMoreRooms() + } + } +} + + + +extension IGChannelsTableViewController { + func loadMoreRooms() { + if !isLoadingMoreRooms && numberOfRoomFetchedInLastRequest % 40 == 0 { + isLoadingMoreRooms = true + let offset = rooms!.count + IGClientGetRoomListRequest.Generator.generate(offset: Int32(offset), limit: 40).success { (responseProtoMessage) in + DispatchQueue.main.async { + self.isLoadingMoreRooms = false + switch responseProtoMessage { + case let response as IGPClientGetRoomListResponse: + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) + default: + break; + } + } + }.error({ (errorCode, waitTime) in + + }).send() + } + } +} diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift index 67538e2..d8212e6 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift @@ -10,7 +10,7 @@ import UIKit import IGProtoBuff -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import RxRealm import RxSwift @@ -26,7 +26,8 @@ class IGChatsTableViewController: UITableViewController { var notificationToken: NotificationToken? var hud = MBProgressHUD() var connectionStatus: IGAppManager.ConnectionStatus? - + var isLoadingMoreRooms: Bool = false + var numberOfRoomFetchedInLastRequest: Int = -1 override func viewDidLoad() { super.viewDidLoad() @@ -78,6 +79,11 @@ class IGChatsTableViewController: UITableViewController { //self.setTabbarHidden(false, animated: true) } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tableView.isUserInteractionEnabled = true + } + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. @@ -86,11 +92,13 @@ class IGChatsTableViewController: UITableViewController { //MARK: Room List actions @objc private func fetchRoomList() { - IGClientGetRoomListRequest.Generator.generate().success { (responseProtoMessage) in + isLoadingMoreRooms = true + IGClientGetRoomListRequest.Generator.generate(offset: 0, limit: 40).success { (responseProtoMessage) in DispatchQueue.main.async { + self.isLoadingMoreRooms = false switch responseProtoMessage { case let response as IGPClientGetRoomListResponse: - IGClientGetRoomListRequest.Handler.interpret(response: response) + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) default: break; } @@ -479,3 +487,37 @@ extension IGChatsTableViewController { } } + + +extension IGChatsTableViewController { + override func scrollViewDidScroll(_ scrollView: UIScrollView) { + let remaining = scrollView.contentSize.height - (scrollView.frame.size.height + scrollView.contentOffset.y) + if remaining < 100 { + self.loadMoreRooms() + } + } +} + + + +extension IGChatsTableViewController { + func loadMoreRooms() { + if !isLoadingMoreRooms && numberOfRoomFetchedInLastRequest % 40 == 0 { + isLoadingMoreRooms = true + let offset = rooms!.count + IGClientGetRoomListRequest.Generator.generate(offset: Int32(offset), limit: 40).success { (responseProtoMessage) in + DispatchQueue.main.async { + self.isLoadingMoreRooms = false + switch responseProtoMessage { + case let response as IGPClientGetRoomListResponse: + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) + default: + break; + } + } + }.error({ (errorCode, waitTime) in + + }).send() + } + } +} diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift index be95e42..b4a29d1 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import RxRealm import RxSwift @@ -26,7 +26,8 @@ class IGGroupsTableViewController: UITableViewController { var notificationToken: NotificationToken? var hud = MBProgressHUD() var connectionStatus: IGAppManager.ConnectionStatus? - + var isLoadingMoreRooms: Bool = false + var numberOfRoomFetchedInLastRequest: Int = -1 override func viewDidLoad() { super.viewDidLoad() @@ -76,6 +77,11 @@ class IGGroupsTableViewController: UITableViewController { self.tableView.isUserInteractionEnabled = true } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tableView.isUserInteractionEnabled = true + } + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. @@ -84,11 +90,13 @@ class IGGroupsTableViewController: UITableViewController { //MARK: Room List actions @objc private func fetchRoomList() { - IGClientGetRoomListRequest.Generator.generate().success { (responseProtoMessage) in + isLoadingMoreRooms = true + IGClientGetRoomListRequest.Generator.generate(offset: 0, limit: 40).success { (responseProtoMessage) in DispatchQueue.main.async { + self.isLoadingMoreRooms = false switch responseProtoMessage { case let response as IGPClientGetRoomListResponse: - IGClientGetRoomListRequest.Handler.interpret(response: response) + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) default: break; } @@ -479,3 +487,37 @@ extension IGGroupsTableViewController { } } + + +extension IGGroupsTableViewController { + override func scrollViewDidScroll(_ scrollView: UIScrollView) { + let remaining = scrollView.contentSize.height - (scrollView.frame.size.height + scrollView.contentOffset.y) + if remaining < 100 { + self.loadMoreRooms() + } + } +} + + + +extension IGGroupsTableViewController { + func loadMoreRooms() { + if !isLoadingMoreRooms && numberOfRoomFetchedInLastRequest % 40 == 0 { + isLoadingMoreRooms = true + let offset = rooms!.count + IGClientGetRoomListRequest.Generator.generate(offset: Int32(offset), limit: 40).success { (responseProtoMessage) in + DispatchQueue.main.async { + self.isLoadingMoreRooms = false + switch responseProtoMessage { + case let response as IGPClientGetRoomListResponse: + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) + default: + break; + } + } + }.error({ (errorCode, waitTime) in + + }).send() + } + } +} diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift index bc0c6db..87878e4 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift @@ -9,7 +9,7 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf import RealmSwift import RxRealm import RxSwift @@ -27,7 +27,9 @@ class IGRecentsTableViewController: UITableViewController { var notificationToken: NotificationToken? var hud = MBProgressHUD() var connectionStatus: IGAppManager.ConnectionStatus? - + var isLoadingMoreRooms: Bool = false + var numberOfRoomFetchedInLastRequest: Int = -1 + private let disposeBag = DisposeBag() private func updateNavigationBarBasedOnNetworkStatus(_ status: IGAppManager.ConnectionStatus) { @@ -140,7 +142,11 @@ class IGRecentsTableViewController: UITableViewController { }, onDisposed: { }).addDisposableTo(disposeBag) + } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tableView.isUserInteractionEnabled = true self.notificationToken = rooms!.addNotificationBlock { (changes: RealmCollectionChange) in switch changes { @@ -180,18 +186,19 @@ class IGRecentsTableViewController: UITableViewController { selector: #selector(segueToChatNotificationReceived(_:)), name: NSNotification.Name(rawValue: kIGNotificationNameDidCreateARoom), object: nil) - } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - self.tableView.isUserInteractionEnabled = true - } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) self.tableView.isUserInteractionEnabled = true } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tableView.isUserInteractionEnabled = true + self.notificationToken?.stop() + } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() @@ -216,12 +223,14 @@ class IGRecentsTableViewController: UITableViewController { @objc private func fetchRoomList() { let clientCondition = IGClientCondition() - IGClientGetRoomListRequest.Generator.generate().success { (responseProtoMessage) in + isLoadingMoreRooms = true + IGClientGetRoomListRequest.Generator.generate(offset: 0, limit: 40).success { (responseProtoMessage) in + self.isLoadingMoreRooms = false DispatchQueue.main.async { switch responseProtoMessage { case let response as IGPClientGetRoomListResponse: self.sendClientCondition(clientCondition: clientCondition) - IGClientGetRoomListRequest.Handler.interpret(response: response) + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) default: break; } @@ -788,3 +797,35 @@ extension IGRecentsTableViewController { } +extension IGRecentsTableViewController { + override func scrollViewDidScroll(_ scrollView: UIScrollView) { + let remaining = scrollView.contentSize.height - (scrollView.frame.size.height + scrollView.contentOffset.y) + if remaining < 100 { + self.loadMoreRooms() + } + } +} + + + +extension IGRecentsTableViewController { + func loadMoreRooms() { + if !isLoadingMoreRooms && numberOfRoomFetchedInLastRequest % 40 == 0 { + isLoadingMoreRooms = true + let offset = rooms!.count + IGClientGetRoomListRequest.Generator.generate(offset: Int32(offset), limit: 40).success { (responseProtoMessage) in + DispatchQueue.main.async { + self.isLoadingMoreRooms = false + switch responseProtoMessage { + case let response as IGPClientGetRoomListResponse: + self.numberOfRoomFetchedInLastRequest = IGClientGetRoomListRequest.Handler.interpret(response: response) + default: + break; + } + } + }.error({ (errorCode, waitTime) in + + }).send() + } + } +} diff --git a/iGap/General/IGGlobal.swift b/iGap/General/IGGlobal.swift index e5a4089..292ab37 100644 --- a/iGap/General/IGGlobal.swift +++ b/iGap/General/IGGlobal.swift @@ -9,13 +9,15 @@ */ import UIKit -import ProtocolBuffers +import SwiftProtobuf let kIGUserLoggedInNotificationName = "im.igap.ios.user.logged.in" let kIGNotificationNameDidCreateARoom = "im.igap.ios.room.created" let kIGNoticationForPushUserExpire = "im.igap.ios.user.expire" -let statusBarTappedNotification = Notification(name: Notification.Name(rawValue: "im.igap.statusbarTapped")) +let IGNotificationStatusBarTapped = Notification(name: Notification.Name(rawValue: "im.igap.statusbarTapped")) +let IGNotificationPushLoginToken = Notification(name: Notification.Name(rawValue: "im.igap.ios.user.push.token")) +let IGNotificationPushTwoStepVerification = Notification(name: Notification.Name(rawValue: "im.igap.ios.user.push.two.step")) class IGGlobal { @@ -65,41 +67,37 @@ extension UIColor { //MARK: General Colors class func organizationalColor() -> UIColor { - return UIColor(red: 49.0/255.0, green: 189.0/255.0, blue: 181.0/255.0, alpha: 1.0) + return UIColor(red:0/255.0, green:176.0/255.0, blue:191.0/255.0, alpha:1.0) } class func organizationalColorLight() -> UIColor { - return UIColor(red:191.0/255.0, green:239.0/255.0, blue:238.0/255.0, alpha:1.0) + return UIColor(red:180.0/255.0, green:255.0/255.0, blue:255.0/255.0, alpha:1.0) } //MARK: MessageCVCell Bubble + class func outgoingChatBuubleBackgroundColor() -> UIColor { + return UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) + } + class func incommingChatBuubleBackgroundColor() -> UIColor { - return UIColor(red: 242.0/255.0, green: 242.0/255.0, blue: 242.0/255.0, alpha: 1.0) + return UIColor.white } class func chatBubbleBackground(isIncommingMessage: Bool) -> UIColor { if isIncommingMessage { return UIColor.incommingChatBuubleBackgroundColor() } else { - return UIColor.organizationalColorLight() + return UIColor.outgoingChatBuubleBackgroundColor() } } class func chatBubbleTextColor(isIncommingMessage: Bool) -> UIColor { - if isIncommingMessage { - return UIColor(red: 53.0/255.0, green: 53.0/255.0, blue: 53.0/255.0, alpha: 1.0) - } else { - return UIColor(red: 53.0/255.0, green: 53.0/255.0, blue: 53.0/255.0, alpha: 1.0)//.white - } + return UIColor(red: 51.0/255.0, green: 51.0/255.0, blue: 51.0/255.0, alpha: 1.0) } //MARK: MessageCVCell Time class func chatTimeTextColor(isIncommingMessage: Bool) -> UIColor { - if isIncommingMessage { - return UIColor(red: 59.0/255.0, green: 59.0/255.0, blue: 59.0/255.0, alpha: 1.0) - } else { - return UIColor(red: 59.0/255.0, green: 59.0/255.0, blue: 59.0/255.0, alpha: 1.0) - } + return UIColor(red: 105.0/255.0, green: 123.0/255.0, blue: 135.0/255.0, alpha: 1.0) } //MARK: MessageCVCell Forward @@ -180,10 +178,15 @@ extension UIColor { //MARK: - extension Date { - func convertToHumanReadable() -> String { + func convertToHumanReadable(onlyTimeIfToday: Bool = false) -> String { let dateFormatter = DateFormatter() - dateFormatter.dateFormat = "HH:mm" + let calendar = NSCalendar.current + if onlyTimeIfToday && !calendar.isDateInToday(self) { + dateFormatter.dateFormat = "MMM, dd" + return dateFormatter.string(from: self) + } + dateFormatter.dateFormat = "HH:mm" let hour = calendar.component(Calendar.Component.hour, from: self) let min = calendar.component(Calendar.Component.minute, from: self) return "\(String(format: "%02d", hour)):\(String(format: "%02d", min))" @@ -217,9 +220,9 @@ extension Date { let dateString = dateFormatter.string(from: self) dateFormatter.dateFormat = "h:mm a" let timeString = dateFormatter.string(from: self) - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - self.humanReadableForLastSeen() - } +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { +// self.humanReadableForLastSeen() +// } return dateString + " at " + timeString @@ -260,6 +263,17 @@ extension UIViewController { func isTabbarHidden() -> Bool { return (self.tabBarController?.tabBar.frame.origin.y)! >= self.view.frame.maxY } + + func showAlert(title: String, message: String, action: (()->())? = nil, completion: (() -> Swift.Void)? = nil) { + let alertVC = UIAlertController(title: title, message: message, preferredStyle: .alert) + let okAction = UIAlertAction(title: "Ok", style: .default) { (alertAction) in + if let action = action { + action() + } + } + alertVC.addAction(okAction) + self.present(alertVC, animated: true, completion: completion) + } } //MARK: - @@ -422,3 +436,48 @@ extension UIImage { } } + +//MARK: - +extension UIFont { + + enum FontWeight { + case ultraLight + case light + case regular + case medium + case bold + } + + class func igFont(ofSize fontSize: CGFloat, weight: FontWeight = .regular) -> UIFont { + switch weight { + case .ultraLight: + return UIFont(name: "IRANSans-UltraLight", size: fontSize)! + case .light: + return UIFont(name: "IRANSans-Light", size: fontSize)! + case .regular: + return UIFont(name: "IRANSans", size: fontSize)! + case .medium: + return UIFont(name: "IRANSans-Medium", size: fontSize)! + case .bold: + return UIFont(name: "IRANSans-Bold", size: fontSize)! + } + } + +// func bold() -> UIFont { +// return withTraits(traits: .traitBold) +// } + +// func italic() -> UIFont { +// return withTraits(traits: .traitItalic) +// } + +// func withTraits(traits:UIFontDescriptorSymbolicTraits...) -> UIFont { +// +// if let result = CTFontCreateCopyWithSymbolicTraits(self as CTFont, 0, nil, .traitItalic, .traitItalic) { +// return result as UIFont +// } +// +// let descriptor = self.fontDescriptor.withSymbolicTraits(UIFontDescriptorSymbolicTraits(traits))! +// return UIFont(descriptor: descriptor, size: 0) +// } +} diff --git a/iGap/General/IGRealm.swift b/iGap/General/IGRealm.swift index 42e3ef0..2e66218 100644 --- a/iGap/General/IGRealm.swift +++ b/iGap/General/IGRealm.swift @@ -12,7 +12,7 @@ import RealmSwift import Foundation class IGRealmString: Object { - dynamic var innerString: String = "" + @objc dynamic var innerString: String = "" override static func primaryKey() -> String { return "innerString" diff --git a/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift b/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift index add9185..bd5c061 100644 --- a/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift +++ b/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift @@ -1,5 +1,3 @@ -// -// IGMessageViewController.swift /* * This is the source code of iGap for iOS * It is licensed under GNU AGPL v3.0 @@ -12,7 +10,7 @@ import UIKit import IGProtoBuff -import ProtocolBuffers +import SwiftProtobuf import GrowingTextView import pop import SnapKit @@ -150,7 +148,7 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate , UIG var canBecomeFirstResponder: Bool { return true } let navigationItem = self.navigationItem as! IGNavigationItem navigationItem.setNavigationBarForRoom(room!) - navigationItem.navigationController = self.navigationController as! IGNavigationController + navigationItem.navigationController = self.navigationController as? IGNavigationController let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self navigationItem.rightViewContainer?.addAction { @@ -211,14 +209,16 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate , UIG self.collectionView.keyboardDismissMode = .none self.collectionView.dataSource = self self.collectionView.delegate = self + + + let bgColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0) - - self.view.backgroundColor = UIColor.white - self.view.superview?.backgroundColor = UIColor.white - self.view.superview?.superview?.backgroundColor = UIColor.white - self.view.superview?.superview?.superview?.backgroundColor = UIColor.white - self.view.superview?.superview?.superview?.superview?.backgroundColor = UIColor.white - + self.view.backgroundColor = bgColor + self.view.superview?.backgroundColor = bgColor + self.view.superview?.superview?.backgroundColor = bgColor + self.view.superview?.superview?.superview?.backgroundColor = bgColor + self.view.superview?.superview?.superview?.superview?.backgroundColor = bgColor + let inputTextViewInitialHeight:CGFloat = 22.0 //initial without reply || forward || attachment || text self.inputTextViewHeight = inputTextViewInitialHeight @@ -232,13 +232,13 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate , UIG inputTextView.contentInset = UIEdgeInsets(top: -5, left: 0, bottom: -5, right: 0) - inputBarLeftView.layer.cornerRadius = 19.0 + inputBarLeftView.layer.cornerRadius = 6.0//19.0 inputBarLeftView.layer.masksToBounds = true - inputBarRightiew.layer.cornerRadius = 19.0 + inputBarRightiew.layer.cornerRadius = 6.0//19.0 inputBarRightiew.layer.masksToBounds = true - inputBarBackgroundView.layer.cornerRadius = 19.0 + inputBarBackgroundView.layer.cornerRadius = 6.0//19.0 inputBarBackgroundView.layer.masksToBounds = false inputBarBackgroundView.layer.shadowColor = UIColor.black.cgColor inputBarBackgroundView.layer.shadowOffset = CGSize(width: 0, height: 0) @@ -247,14 +247,14 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate , UIG inputBarBackgroundView.layer.borderColor = UIColor(red: 209.0/255.0, green: 209.0/255.0, blue: 209.0/255.0, alpha: 1.0).cgColor inputBarBackgroundView.layer.borderWidth = 1.0 - inputBarView.layer.cornerRadius = 19.0 + inputBarView.layer.cornerRadius = 6.0//19.0 inputBarView.layer.masksToBounds = true - inputBarRecordView.layer.cornerRadius = 19.0 + inputBarRecordView.layer.cornerRadius = 6.0//19.0 inputBarRecordView.layer.masksToBounds = false inputBarRecodingBlinkingView.layer.cornerRadius = 8.0 inputBarRecodingBlinkingView.layer.masksToBounds = false - inputBarRecordRightView.layer.cornerRadius = 19.0 + inputBarRecordRightView.layer.cornerRadius = 6.0//19.0 inputBarRecordRightView.layer.masksToBounds = false inputBarRecordView.isHidden = true @@ -2036,7 +2036,7 @@ extension IGMessageViewController { } func addNotificationObserverForTapOnStatusBar() { - NotificationCenter.default.addObserver(forName: statusBarTappedNotification.name, object: .none, queue: .none) { _ in + NotificationCenter.default.addObserver(forName: IGNotificationStatusBarTapped.name, object: .none, queue: .none) { _ in if self.collectionView.contentSize.height < self.collectionView.frame.height { return } diff --git a/iGap/Libraries/Chat Screen/Layout/IGMessageCollectionViewFlowLayout.swift b/iGap/Libraries/Chat Screen/Layout/IGMessageCollectionViewFlowLayout.swift index 6b81122..9c81bfe 100644 --- a/iGap/Libraries/Chat Screen/Layout/IGMessageCollectionViewFlowLayout.swift +++ b/iGap/Libraries/Chat Screen/Layout/IGMessageCollectionViewFlowLayout.swift @@ -1,6 +1,3 @@ -// -// IGMessageCollectionViewFlowLayout.swift -// iGap /* * This is the source code of iGap for iOS * It is licensed under GNU AGPL v3.0 diff --git a/iGap/Libraries/Chat Screen/View/IGMessageCollectionView.swift b/iGap/Libraries/Chat Screen/View/IGMessageCollectionView.swift index fb43c64..adeca65 100644 --- a/iGap/Libraries/Chat Screen/View/IGMessageCollectionView.swift +++ b/iGap/Libraries/Chat Screen/View/IGMessageCollectionView.swift @@ -1,4 +1,3 @@ -// /* * This is the source code of iGap for iOS * It is licensed under GNU AGPL v3.0 diff --git a/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.swift b/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.swift index 303b31c..518c39d 100644 --- a/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.swift +++ b/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.swift @@ -125,11 +125,11 @@ class IGMessageCollectionViewCell: IGMessageGeneralCollectionViewCell { } class func messageBodyTextViewFont() -> UIFont { - return UIFont.systemFont(ofSize: 14.0) + return UIFont.igFont(ofSize: 14.0)//.systemFont(ofSize: 14.0) } class func replyToLabelFont() -> UIFont { - return UIFont.systemFont(ofSize: 14.0) + return UIFont.igFont(ofSize: 14.0) } /* @@ -229,7 +229,7 @@ class IGMessageCollectionViewCell: IGMessageGeneralCollectionViewCell { self.mainBubbleView.layer.cornerRadius = 18 self.mainBubbleView.layer.masksToBounds = true - self.mainBubbleView.layer.borderColor = UIColor.incommingChatBuubleBackgroundColor().cgColor + self.mainBubbleView.layer.borderColor = UIColor(red: 179.0/255.0, green: 179.0/255.0, blue: 179.0/255.0, alpha: 1.0).cgColor self.mediaContainerView.layer.cornerRadius = 18 self.mediaContainerView.layer.masksToBounds = true @@ -237,11 +237,11 @@ class IGMessageCollectionViewCell: IGMessageGeneralCollectionViewCell { self.forwardedMediaDownloadUploadIndicatorView.shouldShowSize = true self.senderAvatarBackView.layer.cornerRadius = 15 - self.senderAvatarBackView.layer.masksToBounds = false - self.senderAvatarBackView.layer.shadowColor = UIColor.black.cgColor - self.senderAvatarBackView.layer.shadowOpacity = 0.25 - self.senderAvatarBackView.layer.shadowRadius = 4.0 - self.senderAvatarBackView.layer.shadowOffset = CGSize(width: 0, height: 0) + self.senderAvatarBackView.layer.masksToBounds = true +// self.senderAvatarBackView.layer.shadowColor = UIColor.black.cgColor +// self.senderAvatarBackView.layer.shadowOpacity = 0.25 +// self.senderAvatarBackView.layer.shadowRadius = 4.0 +// self.senderAvatarBackView.layer.shadowOffset = CGSize(width: 0, height: 0) //self.senderAvatarImageView.layer.cornerRadius = 15 //self.senderAvatarImageView.layer.masksToBounds = true @@ -388,7 +388,7 @@ class IGMessageCollectionViewCell: IGMessageGeneralCollectionViewCell { if isIncommingMessage { - self.mainBubbleView.layer.borderWidth = 1.0 + self.mainBubbleView.layer.borderWidth = 0.0 self.attachmentContainreView.backgroundColor = UIColor.white if let sender = message.authorUser { self.senderNaemLabel.text = sender.displayName @@ -398,7 +398,7 @@ class IGMessageCollectionViewCell: IGMessageGeneralCollectionViewCell { self.senderNaemLabel.text = "" } } else { - self.mainBubbleView.layer.borderWidth = 0.0 + self.mainBubbleView.layer.borderWidth = 1.0 self.senderNaemLabel.text = "" } @@ -777,22 +777,22 @@ class IGMessageCollectionViewCell: IGMessageGeneralCollectionViewCell { //MARK: Body Text (message) if let body = message.message { - let start = Date.timeIntervalSinceReferenceDate +// let start = Date.timeIntervalSinceReferenceDate bodyViewHeightConstraint.constant = messageSizes.messageBodyHeight - let step1 = Date.timeIntervalSinceReferenceDate - print("message.id: \(message.id) Step1: -> \(step1 - start)") +// let step1 = Date.timeIntervalSinceReferenceDate +// print("message.id: \(message.id) Step1: -> \(step1 - start)") bodyLabel.text = body - let step2 = Date.timeIntervalSinceReferenceDate - print("message.id: \(message.id) Step2: -> \(step2 - step1)") +// let step2 = Date.timeIntervalSinceReferenceDate +// print("message.id: \(message.id) Step2: -> \(step2 - step1)") bodyView.isHidden = false - let step3 = Date.timeIntervalSinceReferenceDate - print("message.id: \(message.id) Step3: -> \(step3 - step2)") +// let step3 = Date.timeIntervalSinceReferenceDate +// print("message.id: \(message.id) Step3: -> \(step3 - step2)") bodyLabel.isHidden = false - let step4 = Date.timeIntervalSinceReferenceDate - print("message.id: \(message.id) Step4: -> \(step4 - step3)") +// let step4 = Date.timeIntervalSinceReferenceDate +// print("message.id: \(message.id) Step4: -> \(step4 - step3)") timeLabelBottomConstraint.constant = 11.0 - let step5 = Date.timeIntervalSinceReferenceDate - print("message.id: \(message.id) Step4: -> \(step5 - step4)") +// let step5 = Date.timeIntervalSinceReferenceDate +// print("message.id: \(message.id) Step4: -> \(step5 - step4)") timeLabel.backgroundColor = UIColor.clear bodyView.backgroundColor = UIColor.clear bodyLabel.textColor = UIColor.chatBubbleTextColor(isIncommingMessage: isIncommingMessage) @@ -839,7 +839,7 @@ class IGMessageCollectionViewCell: IGMessageGeneralCollectionViewCell { self.statusIndicatorImageView.image = UIImage(named: "IG_Message_Cell_State_Sent") case .delivered: self.statusIndicatorImageView.image = UIImage(named: "IG_Message_Cell_State_Delivered") - case .seen: + case .seen,.listened: self.statusIndicatorImageView.image = UIImage(named: "IG_Message_Cell_State_Seen") case .failed, .unknown: self.statusIndicatorImageView.image = nil diff --git a/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.xib b/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.xib index f3110f0..93abe7a 100644 --- a/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.xib +++ b/iGap/Libraries/Chat Screen/View/IGMessageCollectionViewCell.xib @@ -1,10 +1,10 @@ - + - + @@ -50,14 +50,14 @@ - - + @@ -76,7 +76,7 @@ -