diff --git a/GMERemittance.xcodeproj/project.pbxproj b/GMERemittance.xcodeproj/project.pbxproj index 3ac5d824..ac70e55f 100644 --- a/GMERemittance.xcodeproj/project.pbxproj +++ b/GMERemittance.xcodeproj/project.pbxproj @@ -40,10 +40,8 @@ 0448C2A11FF34D9C001FEA77 /* RecipientViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0448C2A01FF34D9C001FEA77 /* RecipientViewModel.swift */; }; 04498A70203833D700AC4D99 /* Branch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04498A6F203833D700AC4D99 /* Branch.swift */; }; 04498A722039416E00AC4D99 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04498A712039416E00AC4D99 /* SettingViewController.swift */; }; - 04498A7420394AAF00AC4D99 /* ChangePasswordViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04498A7320394AAF00AC4D99 /* ChangePasswordViewModel.swift */; }; 044F5B1B20A3002B00E3584C /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 044F5B1A20A3002B00E3584C /* index.html */; }; 04546C4120329A36007EFE15 /* AboutGMEViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04546C4020329A36007EFE15 /* AboutGMEViewController.swift */; }; - 04546C452032B176007EFE15 /* WithdrawViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04546C442032B176007EFE15 /* WithdrawViewModel.swift */; }; 04546C472032E324007EFE15 /* CharacterExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04546C462032E324007EFE15 /* CharacterExtension.swift */; }; 045CB0C4202F27FA008DD982 /* SupportViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045CB0C3202F27FA008DD982 /* SupportViewController.swift */; }; 045CB0C6202F2A3D008DD982 /* _MessageComposeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045CB0C5202F2A3D008DD982 /* _MessageComposeViewController.swift */; }; @@ -131,19 +129,13 @@ 9F1F7A5C1FF2146000A4DD82 /* ReviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F1F7A5B1FF2146000A4DD82 /* ReviewViewController.swift */; }; 9F23DF4F20749DFE0025D6DF /* ExchangeRateMultipleCountryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F23DF4E20749DFE0025D6DF /* ExchangeRateMultipleCountryViewController.swift */; }; 9F23DF512074A02B0025D6DF /* MyCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F23DF502074A02B0025D6DF /* MyCollectionViewCell.swift */; }; - 9F2B5AF020218751002284F6 /* ProfileDocumentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2B5AEF20218751002284F6 /* ProfileDocumentViewController.swift */; }; 9F2E0D162059168C008611D1 /* LoadBalanceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2E0D152059168C008611D1 /* LoadBalanceViewController.swift */; }; 9F2E45A2204E8A3F00D0B28C /* CalendarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2E45A1204E8A3F00D0B28C /* CalendarViewController.swift */; }; 9F2ECFF72050F04C00AC880B /* MobileOperator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2ECFF62050F04C00AC880B /* MobileOperator.swift */; }; 9F3332AF208DAE7600E39C9F /* ExchangeRateData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3332AE208DAE7600E39C9F /* ExchangeRateData.swift */; }; - 9F3ADCE82004B85F0037A3A3 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3ADCE72004B85F0037A3A3 /* ProfileViewController.swift */; }; - 9F3ADCEA2004B8EC0037A3A3 /* ProfileEdit.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F3ADCE92004B8EC0037A3A3 /* ProfileEdit.storyboard */; }; - 9F3ADCEC2004BD510037A3A3 /* ProfileGeneralViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3ADCEB2004BD510037A3A3 /* ProfileGeneralViewController.swift */; }; - 9F3ADCF02004BF090037A3A3 /* ProfileChangePasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3ADCEF2004BF090037A3A3 /* ProfileChangePasswordViewController.swift */; }; 9F3CFC56202824E60034F588 /* TrackRecipientViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3CFC55202824E60034F588 /* TrackRecipientViewController.swift */; }; 9F3CFC582028272B0034F588 /* TrackRecipientViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3CFC572028272B0034F588 /* TrackRecipientViewModel.swift */; }; 9F40C3521FEAB0F4000CB53C /* KYCDocumentsUploadViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F40C3511FEAB0F4000CB53C /* KYCDocumentsUploadViewController.swift */; }; - 9F4E1324202060AA00843BF2 /* ProfileBankViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F4E1323202060AA00843BF2 /* ProfileBankViewController.swift */; }; 9F8FEF101FEE2D9F00CE550F /* RecipientListViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F8FEF0F1FEE2D9F00CE550F /* RecipientListViewController.storyboard */; }; 9F91871D200F3EF900669BAC /* CommentsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F91871C200F3EF900669BAC /* CommentsTableViewCell.swift */; }; 9F983C0A20245483001DCB3F /* _SplashScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F983C0920245483001DCB3F /* _SplashScreenViewController.swift */; }; @@ -156,7 +148,6 @@ 9FA0973E200E127A00F3B5EC /* LikesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA0973D200E127A00F3B5EC /* LikesViewController.swift */; }; 9FA09740200E129500F3B5EC /* CommentsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA0973F200E129500F3B5EC /* CommentsViewController.swift */; }; 9FB54C11200879B9003454E2 /* Profile.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FB54C10200879B9003454E2 /* Profile.storyboard */; }; - 9FB54C1320088EF7003454E2 /* WithdrawViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FB54C1220088EF7003454E2 /* WithdrawViewController.swift */; }; 9FCBD347202AE76900BAEB32 /* TrackPhaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCBD346202AE76900BAEB32 /* TrackPhaseViewController.swift */; }; 9FCBD349202AEBA100BAEB32 /* PayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCBD348202AEBA100BAEB32 /* PayoutViewController.swift */; }; 9FCBD34B202B179600BAEB32 /* PayoutTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCBD34A202B179600BAEB32 /* PayoutTableViewCell.swift */; }; @@ -169,7 +160,6 @@ 9FD2610D1FD00458007A511D /* GMERemittanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD2610C1FD00458007A511D /* GMERemittanceTests.swift */; }; 9FD261181FD00458007A511D /* GMERemittanceUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD261171FD00458007A511D /* GMERemittanceUITests.swift */; }; 9FD46F331FF256E5006C8341 /* TransferSuccessfulViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FD46F321FF256E5006C8341 /* TransferSuccessfulViewController.swift */; }; - A205DF5D201F38F60074B0C8 /* UserInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A205DF5C201F38F60074B0C8 /* UserInfoViewController.swift */; }; A214606120315A35001F3B37 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = A214606020315A35001F3B37 /* GoogleService-Info.plist */; }; A21CB1D3208084A0003D555A /* PaymentMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = A21CB1D2208084A0003D555A /* PaymentMode.swift */; }; A22162D0202C4A61000E915C /* TabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22162CF202C4A61000E915C /* TabBarViewController.swift */; }; @@ -181,8 +171,6 @@ A22F75032012006100B0FA15 /* likesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22F75022012006100B0FA15 /* likesTableViewCell.swift */; }; A2336583207DD44C0078DD77 /* BankBranch.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2336582207DD44C0078DD77 /* BankBranch.swift */; }; A248EA882088855B008D28DF /* Currrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = A248EA872088855B008D28DF /* Currrency.swift */; }; - A249B79C2020426C00BD3D13 /* UserInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A249B79B2020426C00BD3D13 /* UserInfoViewModel.swift */; }; - A249B79E20204B1600BD3D13 /* UserTemp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A249B79D20204B1600BD3D13 /* UserTemp.swift */; }; A24B44FA204CF108009BF491 /* InviteeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A24B44F9204CF108009BF491 /* InviteeModel.swift */; }; A24B44FC204D158F009BF491 /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A24B44FB204D158F009BF491 /* HomeViewModel.swift */; }; A252A4CC203ACFA0001EFF4C /* TransactionSuccessViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A252A4CB203ACFA0001EFF4C /* TransactionSuccessViewController.swift */; }; @@ -198,8 +186,6 @@ A25CF60B2046A92C0029BC12 /* ReferringViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A25CF60A2046A92C0029BC12 /* ReferringViewController.swift */; }; A2637C5820395B8F006EA9AA /* NotificationTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2637C5720395B8F006EA9AA /* NotificationTableViewCell.swift */; }; A2637C5A20395BA7006EA9AA /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2637C5920395BA7006EA9AA /* NotificationViewController.swift */; }; - A2661F30201EEA2900ECBF94 /* ProfileModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2661F2F201EEA2900ECBF94 /* ProfileModel.swift */; }; - A2661F32201EEC1C00ECBF94 /* ProfileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2661F31201EEC1C00ECBF94 /* ProfileViewModel.swift */; }; A270F08D2075C74300B78D00 /* AgentCountryList.swift in Sources */ = {isa = PBXBuildFile; fileRef = A270F08C2075C74300B78D00 /* AgentCountryList.swift */; }; A270F08F2075E34C00B78D00 /* PayoutMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = A270F08E2075E34C00B78D00 /* PayoutMode.swift */; }; A28C18201FEA5FBA0018AB97 /* KYCBankAndIDViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A28C181F1FEA5FBA0018AB97 /* KYCBankAndIDViewController.swift */; }; @@ -366,6 +352,8 @@ D937038421490C3800D93077 /* KycForm1ViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = D937036E21490C3800D93077 /* KycForm1ViewInterface.swift */; }; D937038521490C3800D93077 /* KycForm1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D937036F21490C3800D93077 /* KycForm1.storyboard */; }; D937038621490C3800D93077 /* KycForm1ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D937037021490C3800D93077 /* KycForm1ViewController.swift */; }; + D9380D2B2165A27B00E45156 /* ProfileChangePasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9380D2A2165A27B00E45156 /* ProfileChangePasswordViewController.swift */; }; + D9380D2D2165A2ED00E45156 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9380D2C2165A2ED00E45156 /* ProfileViewController.swift */; }; D94173B3214B40ED00D04BE5 /* KycModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94173B2214B40ED00D04BE5 /* KycModel.swift */; }; D945F11D213E1D5100A24824 /* SendMoneyReceiptModuleInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = D945F10A213E1D5100A24824 /* SendMoneyReceiptModuleInterface.swift */; }; D945F11E213E1D5100A24824 /* SendMoneyReceiptService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D945F10D213E1D5100A24824 /* SendMoneyReceiptService.swift */; }; @@ -590,10 +578,8 @@ 0448C2A01FF34D9C001FEA77 /* RecipientViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientViewModel.swift; sourceTree = ""; }; 04498A6F203833D700AC4D99 /* Branch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Branch.swift; sourceTree = ""; }; 04498A712039416E00AC4D99 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; - 04498A7320394AAF00AC4D99 /* ChangePasswordViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangePasswordViewModel.swift; sourceTree = ""; }; 044F5B1A20A3002B00E3584C /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = ""; }; 04546C4020329A36007EFE15 /* AboutGMEViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutGMEViewController.swift; sourceTree = ""; }; - 04546C442032B176007EFE15 /* WithdrawViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithdrawViewModel.swift; sourceTree = ""; }; 04546C462032E324007EFE15 /* CharacterExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterExtension.swift; sourceTree = ""; }; 045CB0C3202F27FA008DD982 /* SupportViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportViewController.swift; sourceTree = ""; }; 045CB0C5202F2A3D008DD982 /* _MessageComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = _MessageComposeViewController.swift; sourceTree = ""; }; @@ -685,19 +671,13 @@ 9F1F7A5B1FF2146000A4DD82 /* ReviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewViewController.swift; sourceTree = ""; }; 9F23DF4E20749DFE0025D6DF /* ExchangeRateMultipleCountryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExchangeRateMultipleCountryViewController.swift; sourceTree = ""; }; 9F23DF502074A02B0025D6DF /* MyCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyCollectionViewCell.swift; sourceTree = ""; }; - 9F2B5AEF20218751002284F6 /* ProfileDocumentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileDocumentViewController.swift; sourceTree = ""; }; 9F2E0D152059168C008611D1 /* LoadBalanceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadBalanceViewController.swift; sourceTree = ""; }; 9F2E45A1204E8A3F00D0B28C /* CalendarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarViewController.swift; sourceTree = ""; }; 9F2ECFF62050F04C00AC880B /* MobileOperator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileOperator.swift; sourceTree = ""; }; 9F3332AE208DAE7600E39C9F /* ExchangeRateData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExchangeRateData.swift; sourceTree = ""; }; - 9F3ADCE72004B85F0037A3A3 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = ""; }; - 9F3ADCE92004B8EC0037A3A3 /* ProfileEdit.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ProfileEdit.storyboard; sourceTree = ""; }; - 9F3ADCEB2004BD510037A3A3 /* ProfileGeneralViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileGeneralViewController.swift; sourceTree = ""; }; - 9F3ADCEF2004BF090037A3A3 /* ProfileChangePasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileChangePasswordViewController.swift; sourceTree = ""; }; 9F3CFC55202824E60034F588 /* TrackRecipientViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackRecipientViewController.swift; sourceTree = ""; }; 9F3CFC572028272B0034F588 /* TrackRecipientViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackRecipientViewModel.swift; sourceTree = ""; }; 9F40C3511FEAB0F4000CB53C /* KYCDocumentsUploadViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KYCDocumentsUploadViewController.swift; sourceTree = ""; }; - 9F4E1323202060AA00843BF2 /* ProfileBankViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileBankViewController.swift; sourceTree = ""; }; 9F8FEF0F1FEE2D9F00CE550F /* RecipientListViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = RecipientListViewController.storyboard; sourceTree = ""; }; 9F91871C200F3EF900669BAC /* CommentsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentsTableViewCell.swift; sourceTree = ""; }; 9F983C0920245483001DCB3F /* _SplashScreenViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = _SplashScreenViewController.swift; sourceTree = ""; }; @@ -710,7 +690,6 @@ 9FA0973D200E127A00F3B5EC /* LikesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LikesViewController.swift; sourceTree = ""; }; 9FA0973F200E129500F3B5EC /* CommentsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentsViewController.swift; sourceTree = ""; }; 9FB54C10200879B9003454E2 /* Profile.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Profile.storyboard; sourceTree = ""; }; - 9FB54C1220088EF7003454E2 /* WithdrawViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithdrawViewController.swift; sourceTree = ""; }; 9FCBD346202AE76900BAEB32 /* TrackPhaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackPhaseViewController.swift; sourceTree = ""; }; 9FCBD348202AEBA100BAEB32 /* PayoutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayoutViewController.swift; sourceTree = ""; }; 9FCBD34A202B179600BAEB32 /* PayoutTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayoutTableViewCell.swift; sourceTree = ""; }; @@ -729,7 +708,6 @@ 9FD261171FD00458007A511D /* GMERemittanceUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GMERemittanceUITests.swift; sourceTree = ""; }; 9FD261191FD00458007A511D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 9FD46F321FF256E5006C8341 /* TransferSuccessfulViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferSuccessfulViewController.swift; sourceTree = ""; }; - A205DF5C201F38F60074B0C8 /* UserInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoViewController.swift; sourceTree = ""; }; A214606020315A35001F3B37 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; A214606220315ECC001F3B37 /* GMERemittance.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GMERemittance.entitlements; sourceTree = ""; }; A21CB1D2208084A0003D555A /* PaymentMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentMode.swift; sourceTree = ""; }; @@ -742,8 +720,6 @@ A22F75022012006100B0FA15 /* likesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = likesTableViewCell.swift; sourceTree = ""; }; A2336582207DD44C0078DD77 /* BankBranch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankBranch.swift; sourceTree = ""; }; A248EA872088855B008D28DF /* Currrency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Currrency.swift; sourceTree = ""; }; - A249B79B2020426C00BD3D13 /* UserInfoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoViewModel.swift; sourceTree = ""; }; - A249B79D20204B1600BD3D13 /* UserTemp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserTemp.swift; sourceTree = ""; }; A24B44F9204CF108009BF491 /* InviteeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InviteeModel.swift; sourceTree = ""; }; A24B44FB204D158F009BF491 /* HomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModel.swift; sourceTree = ""; }; A252A4CB203ACFA0001EFF4C /* TransactionSuccessViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionSuccessViewController.swift; sourceTree = ""; }; @@ -759,8 +735,6 @@ A25CF60A2046A92C0029BC12 /* ReferringViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReferringViewController.swift; sourceTree = ""; }; A2637C5720395B8F006EA9AA /* NotificationTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTableViewCell.swift; sourceTree = ""; }; A2637C5920395BA7006EA9AA /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = ""; }; - A2661F2F201EEA2900ECBF94 /* ProfileModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileModel.swift; sourceTree = ""; }; - A2661F31201EEC1C00ECBF94 /* ProfileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewModel.swift; sourceTree = ""; }; A270F08C2075C74300B78D00 /* AgentCountryList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgentCountryList.swift; sourceTree = ""; }; A270F08E2075E34C00B78D00 /* PayoutMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayoutMode.swift; sourceTree = ""; }; A28C181F1FEA5FBA0018AB97 /* KYCBankAndIDViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KYCBankAndIDViewController.swift; sourceTree = ""; }; @@ -930,6 +904,8 @@ D937036E21490C3800D93077 /* KycForm1ViewInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KycForm1ViewInterface.swift; sourceTree = ""; }; D937036F21490C3800D93077 /* KycForm1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = KycForm1.storyboard; sourceTree = ""; }; D937037021490C3800D93077 /* KycForm1ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KycForm1ViewController.swift; sourceTree = ""; }; + D9380D2A2165A27B00E45156 /* ProfileChangePasswordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileChangePasswordViewController.swift; sourceTree = ""; }; + D9380D2C2165A2ED00E45156 /* ProfileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = ""; }; D94173B2214B40ED00D04BE5 /* KycModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KycModel.swift; sourceTree = ""; }; D945F10A213E1D5100A24824 /* SendMoneyReceiptModuleInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendMoneyReceiptModuleInterface.swift; sourceTree = ""; }; D945F10D213E1D5100A24824 /* SendMoneyReceiptService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendMoneyReceiptService.swift; sourceTree = ""; }; @@ -1418,21 +1394,9 @@ 9F3ADCE62004B80F0037A3A3 /* Profile */ = { isa = PBXGroup; children = ( + D9380D2C2165A2ED00E45156 /* ProfileViewController.swift */, + D9380D2A2165A27B00E45156 /* ProfileChangePasswordViewController.swift */, 9FB54C10200879B9003454E2 /* Profile.storyboard */, - 9F3ADCE92004B8EC0037A3A3 /* ProfileEdit.storyboard */, - 9F3ADCE72004B85F0037A3A3 /* ProfileViewController.swift */, - A2661F31201EEC1C00ECBF94 /* ProfileViewModel.swift */, - A2661F2F201EEA2900ECBF94 /* ProfileModel.swift */, - A249B79B2020426C00BD3D13 /* UserInfoViewModel.swift */, - A205DF5C201F38F60074B0C8 /* UserInfoViewController.swift */, - 9F3ADCEB2004BD510037A3A3 /* ProfileGeneralViewController.swift */, - 9F4E1323202060AA00843BF2 /* ProfileBankViewController.swift */, - 9F2B5AEF20218751002284F6 /* ProfileDocumentViewController.swift */, - 9FB54C1220088EF7003454E2 /* WithdrawViewController.swift */, - 04546C442032B176007EFE15 /* WithdrawViewModel.swift */, - 9F3ADCEF2004BF090037A3A3 /* ProfileChangePasswordViewController.swift */, - A249B79D20204B1600BD3D13 /* UserTemp.swift */, - 04498A7320394AAF00AC4D99 /* ChangePasswordViewModel.swift */, ); path = Profile; sourceTree = ""; @@ -3999,7 +3963,6 @@ A25CF60720467B700029BC12 /* Invite.storyboard in Resources */, 5565FF321FE275E5002934E9 /* SanFranciscoDisplay-Semibold.otf in Resources */, 9FB54C11200879B9003454E2 /* Profile.storyboard in Resources */, - 9F3ADCEA2004B8EC0037A3A3 /* ProfileEdit.storyboard in Resources */, 9FA0973A200E0DE100F3B5EC /* _Home.storyboard in Resources */, 5565FF211FE275E5002934E9 /* SanFranciscoText-Bold.otf in Resources */, 04EA4DB12026CD0E00BF6BED /* TrackTransfer.storyboard in Resources */, @@ -4371,7 +4334,6 @@ 045DFCAA2089A70E000F7699 /* ReferralCodeViewController.swift in Sources */, 9F9DF0CE1FEBCD41005B8F42 /* RecipientListTableViewCell.swift in Sources */, 0496B8551FE7E2830044810E /* SignUpViewModel.swift in Sources */, - A2661F30201EEA2900ECBF94 /* ProfileModel.swift in Sources */, D96A4FDC21460B4A00CFD507 /* SplashScreenViewInterface.swift in Sources */, D950BED721549242008367A1 /* HomeWireframeInput.swift in Sources */, D977859D215DC55F00754079 /* TransactionHistoryModuleInterface.swift in Sources */, @@ -4408,7 +4370,6 @@ D93702B42148EE6C00D93077 /* KycWireframe.swift in Sources */, D922D96A2135145F00D43053 /* SendMoneyParentViewInterface.swift in Sources */, 04E1032C2007A88600AE24A2 /* ScrollableProtocol.swift in Sources */, - 04546C452032B176007EFE15 /* WithdrawViewModel.swift in Sources */, D96BD119216479E200DFE7D8 /* WalletStatementInteractor.swift in Sources */, D9031140214786EA00AD5BA9 /* ForgotPasswordInteractorIO.swift in Sources */, D96A4FD821460B4A00CFD507 /* SplashScreenInteractorIO.swift in Sources */, @@ -4430,7 +4391,6 @@ A28C18201FEA5FBA0018AB97 /* KYCBankAndIDViewController.swift in Sources */, D946719F21426DFB003924DB /* LoginViewController.swift in Sources */, D922D9AE21351B7400D43053 /* SendMoneyVerificationWireframe.swift in Sources */, - A205DF5D201F38F60074B0C8 /* UserInfoViewController.swift in Sources */, D937038021490C3800D93077 /* KycForm1Interactor.swift in Sources */, 9F3332AF208DAE7600E39C9F /* ExchangeRateData.swift in Sources */, D97785AC215DD23400754079 /* TransactionModel.swift in Sources */, @@ -4454,7 +4414,6 @@ D97785A1215DC55F00754079 /* TransactionHistoryInteractor.swift in Sources */, D903113F214786EA00AD5BA9 /* ForgotPasswordInteractor.swift in Sources */, D922D9472135124200D43053 /* SendMoneyPaymentModeWireframe.swift in Sources */, - A249B79C2020426C00BD3D13 /* UserInfoViewModel.swift in Sources */, D962230C212BD7A100B7A115 /* ArrayExtension.swift in Sources */, 04B67E922046CA7A000A4248 /* WalletReviewViewController.swift in Sources */, 04B232DF2003732E00736B89 /* RequestNewCodeViewController.swift in Sources */, @@ -4473,7 +4432,6 @@ D922D9462135124200D43053 /* SendMoneyPaymentModeWireframeInput.swift in Sources */, D946719B21426DFB003924DB /* LoginWireframe.swift in Sources */, D9B7ADF62130048E009B0564 /* ExchangeRatesWireframeInput.swift in Sources */, - 9FB54C1320088EF7003454E2 /* WithdrawViewController.swift in Sources */, D9DC107B21639078008F3C51 /* MessageComposeInteractorIO.swift in Sources */, D937037C21490C3800D93077 /* KycForm1ModuleInterface.swift in Sources */, D9DAFE2521352F3300483E71 /* SenMoneyPaymentModeRecipientViewModel.swift in Sources */, @@ -4547,6 +4505,7 @@ D922D98521351AAE00D43053 /* SendMoneyExchangeRateServiceType.swift in Sources */, D922D91E2134DCF000D43053 /* EditReciepientService.swift in Sources */, 9F1F7A5C1FF2146000A4DD82 /* ReviewViewController.swift in Sources */, + D9380D2B2165A27B00E45156 /* ProfileChangePasswordViewController.swift in Sources */, D946719A21426DFB003924DB /* LoginPresenter.swift in Sources */, D92B802C2140C3CB00A25B26 /* MainWireframe.swift in Sources */, D922D9222134DCF000D43053 /* EditReciepientWireframeInput.swift in Sources */, @@ -4569,7 +4528,6 @@ 04BEF55A20593CFB007713F9 /* RewardViewController.swift in Sources */, D937034121490C1A00D93077 /* KycForm3Presenter.swift in Sources */, D96A4FDE21460B4A00CFD507 /* SplashScreenViewController.swift in Sources */, - A2661F32201EEC1C00ECBF94 /* ProfileViewModel.swift in Sources */, D9DC107921639078008F3C51 /* MessageComposeServiceType.swift in Sources */, 9FD1EE6A1FF0F48F00AC79FC /* PaymentMethodViewController.swift in Sources */, D92B80252140C3CB00A25B26 /* MainModuleInterface.swift in Sources */, @@ -4621,7 +4579,6 @@ A2B9D75B2020C87A007C1049 /* MyStoryTableViewCell.swift in Sources */, D9CB49732132908300B7A124 /* SendMoneyProvinceViewModel.swift in Sources */, 043629C5200A2ED900DD5E73 /* MobileRechargeViewController.swift in Sources */, - A249B79E20204B1600BD3D13 /* UserTemp.swift in Sources */, D97785A0215DC55F00754079 /* TransactionHistoryInteractorIO.swift in Sources */, D922D98821351AAE00D43053 /* SendMoneyExchangeRateInteractor.swift in Sources */, D922D98A21351AAE00D43053 /* SendMoneyExchangeRateWireframeInput.swift in Sources */, @@ -4638,10 +4595,7 @@ D922D9632135145F00D43053 /* SendMoneyParentServiceType.swift in Sources */, D9031142214786EA00AD5BA9 /* ForgotPasswordWireframe.swift in Sources */, 9F2ECFF72050F04C00AC880B /* MobileOperator.swift in Sources */, - 9F4E1324202060AA00843BF2 /* ProfileBankViewController.swift in Sources */, - 9F3ADCF02004BF090037A3A3 /* ProfileChangePasswordViewController.swift in Sources */, D922D9432135124200D43053 /* SendMoneyPaymentModeInteractorIO.swift in Sources */, - 04498A7420394AAF00AC4D99 /* ChangePasswordViewModel.swift in Sources */, D96BD118216479E200DFE7D8 /* WalletStatementInteractorIO.swift in Sources */, D90D55D021327CD600EEEE04 /* AddReciepientPresenter.swift in Sources */, D922D9482135124200D43053 /* SendMoneyPaymentModeViewController.swift in Sources */, @@ -4654,7 +4608,6 @@ D9B7ADF72130048E009B0564 /* ExchangeRatesWireframe.swift in Sources */, D96A4FFA2146625C00CFD507 /* RegisterInteractorIO.swift in Sources */, D9B7ADF82130048E009B0564 /* ExchangeRatesViewController.swift in Sources */, - 9F3ADCE82004B85F0037A3A3 /* ProfileViewController.swift in Sources */, D950BED321549242008367A1 /* HomeService.swift in Sources */, 9F3CFC56202824E60034F588 /* TrackRecipientViewController.swift in Sources */, D937037E21490C3800D93077 /* KycForm1ServiceType.swift in Sources */, @@ -4722,6 +4675,7 @@ 9FCBD34B202B179600BAEB32 /* PayoutTableViewCell.swift in Sources */, D922D94A2135124200D43053 /* SendMoneyPaymentModeViewInterface.swift in Sources */, 04498A70203833D700AC4D99 /* Branch.swift in Sources */, + D9380D2D2165A2ED00E45156 /* ProfileViewController.swift in Sources */, 722347F2205A8FF600296ADD /* SocialFeedViewModel.swift in Sources */, D945F122213E1D5100A24824 /* SendMoneyReceiptPresenter.swift in Sources */, 04BEF55C20593F0C007713F9 /* RewardCollectionViewCell.swift in Sources */, @@ -4766,14 +4720,12 @@ D9CB49872132A5F500B7A124 /* ItemsPickerViewController.swift in Sources */, D922D9422135124200D43053 /* SendMoneyPaymentModeServiceType.swift in Sources */, D937038421490C3800D93077 /* KycForm1ViewInterface.swift in Sources */, - 9F2B5AF020218751002284F6 /* ProfileDocumentViewController.swift in Sources */, D90D55CF21327CD600EEEE04 /* AddReciepientInteractorIO.swift in Sources */, D945F120213E1D5100A24824 /* SendMoneyReceiptInteractor.swift in Sources */, 043A8AFA1FE80BC2004DA154 /* KYCPersonalInfoViewController.swift in Sources */, 0496B84B1FE7DFBA0044810E /* Validation.swift in Sources */, D90D55D72132846000EEEE04 /* SendMoneyCountryModel.swift in Sources */, D937038621490C3800D93077 /* KycForm1ViewController.swift in Sources */, - 9F3ADCEC2004BD510037A3A3 /* ProfileGeneralViewController.swift in Sources */, D9CB49752132909500B7A124 /* SendMoneyDistrictViewModel.swift in Sources */, D95B5E3B21311057000C0B33 /* GmeContactsServiceType.swift in Sources */, D922D9672135145F00D43053 /* SendMoneyParentPresenter.swift in Sources */, diff --git a/GMERemittance/Extension/UIViewControllerExtension.swift b/GMERemittance/Extension/UIViewControllerExtension.swift index 26137157..74ec95dd 100644 --- a/GMERemittance/Extension/UIViewControllerExtension.swift +++ b/GMERemittance/Extension/UIViewControllerExtension.swift @@ -484,8 +484,8 @@ extension UIViewController { let destinationViewController = tabViewController.viewControllers![0] as! _HomeViewController - destinationViewController.numberCellsInCollectionView = 6 - destinationViewController.showAllCollectionViewCells = true +// destinationViewController.numberCellsInCollectionView = 6 +// destinationViewController.showAllCollectionViewCells = true destinationViewController.hidesBottomBarWhenPushed = false diff --git a/GMERemittance/FillKYC/PopUpGeneralInfo.swift b/GMERemittance/FillKYC/PopUpGeneralInfo.swift index 85f4b147..738c4712 100644 --- a/GMERemittance/FillKYC/PopUpGeneralInfo.swift +++ b/GMERemittance/FillKYC/PopUpGeneralInfo.swift @@ -504,11 +504,11 @@ class PopUpGeneralInfo: UIViewController { case 33: self.removeAnimate() self.removeFromParentViewController() - ProfileBankViewController.profileConnectionTimeOutCheck = 0 +// self.removeAnimate() case 34: self.removeAnimate() self.removeFromParentViewController() - ProfileBankViewController.profileConnectionTimeOutCheck = 0 +// self.removeAnimate() case 35: self.removeAnimate() self.removeFromParentViewController() @@ -528,7 +528,7 @@ class PopUpGeneralInfo: UIViewController { case 39: self.removeAnimate() self.removeFromParentViewController() - UserInfoViewController.profileEditConnectionTimeOutCheck = 0 +// self.removeAnimate() case 40: self.removeAnimate() self.removeFromParentViewController() diff --git a/GMERemittance/Profile/ChangePasswordViewModel.swift b/GMERemittance/Profile/ChangePasswordViewModel.swift deleted file mode 100644 index 1b05a213..00000000 --- a/GMERemittance/Profile/ChangePasswordViewModel.swift +++ /dev/null @@ -1,93 +0,0 @@ -// -// ChangePasswordViewModel.swift -// GMERemittance -// -// Created by Sujal on 2/18/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import Foundation - -class ChangePasswordViewModel: SignUpViewModel { - var passwordChanged: Box = Box(nil) - var oldPassword: String! - var newPassword: String! - var confirmPassword: String! - - var passwordConnectionTimeOut: Box = Box(nil) -} - -extension ChangePasswordViewModel { - - /** - to update old password - */ - func updateOldPassword(inputString: String) { - self.oldPassword = inputString - } - - /** - to update new password - */ - func updateNewPassword(inputString: String) { - self.newPassword = inputString - } - - /** - to confrim new password - */ - func updateConfirmPassword(inputString: String) { - self.confirmPassword = inputString - } - - /** - to validate empty textfield - */ - func validateFields() -> isValid { - guard oldPassword != nil && newPassword != nil && confirmPassword != nil else { - return .InValid("Please fill all the fields") - } - guard isValidPasswordLength(password: oldPassword) && isValidPasswordLength(password: newPassword) && isValidPasswordLength(password: confirmPassword) else { - return .InValid("Password lengths do not match the minimum criteria") - } - guard confirmPassword == newPassword else { - return .InValid("Passwords do not match") - } - return .Valid - } - - /** - Api request to change password - */ - func requestPasswordChanges() { - let userId: String = UserDefaults.standard.object(forKey: "com.gmeremit.username") as! String - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - RestApiMananger.sharedInstance.changePassword(userId: userId, currentPassword: oldPassword, newPassword: newPassword) { result in - switch result { - case .success(_): - UserDefaults.standard.set(self.newPassword.toBase64(), forKey: "com.gmeremit.password") - self.passwordChanged.value = true - case let .failure(errorJSON): - self.setErrorMessage(message: errorJSON["message"].stringValue) - self.passwordChanged.value = false - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: userId, password: self.password!) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.requestPasswordChanges() - } - } - case .logOutUser(): - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.passwordConnectionTimeOut.value = false - } - } - } - } -} diff --git a/GMERemittance/Profile/Profile.storyboard b/GMERemittance/Profile/Profile.storyboard index ee83829b..de1ceb57 100644 --- a/GMERemittance/Profile/Profile.storyboard +++ b/GMERemittance/Profile/Profile.storyboard @@ -1,5 +1,5 @@ - + @@ -32,223 +32,238 @@ - + - - - - - - - - - - - - - - - - - - - - - + + - - + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + - + - - - - + + + + + @@ -298,185 +313,200 @@ - + - + - - + + - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + + + + - - - - + + + + + + - - - - - - - - - - - - - + - + + + + + + + + + + + - + - - - - - + + + + + + + + - - - + - - - - - - - - + + + + + + - + - + - - - - + + + + + @@ -490,7 +520,7 @@ - + diff --git a/GMERemittance/Profile/ProfileBankViewController.swift b/GMERemittance/Profile/ProfileBankViewController.swift deleted file mode 100644 index 670d5e58..00000000 --- a/GMERemittance/Profile/ProfileBankViewController.swift +++ /dev/null @@ -1,271 +0,0 @@ -// -// ProfileBankViewController.swift -// GMERemittance -// -// Created by Fm-user on 1/30/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import Foundation -import UIKit - -class ProfileBankViewController: UIViewController { - - var userinfoviewmodel: UserInfoViewModel? - var alertController: UIAlertController! - - @IBOutlet weak var labelBankName: UILabel! - @IBOutlet weak var labelAccountNumber: UILabel! - @IBOutlet weak var labelVerificationIDType: UILabel! - @IBOutlet weak var labelVerificationIDNumber: UILabel! - @IBOutlet weak var labelExpiryDate: UILabel! - @IBOutlet weak var labelSourceIncome: UILabel! - - let pickerView = UIPickerView() - var pickerData: [String] = [String]() - - var editTextField: UITextField! - - private var selectedFundSouceIndex: Int! - private var selectedFundSource: String! - - private var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView() - - public static var profileConnectionTimeOutCheck = 0 - - @IBAction func goBack(_ sender: Any) { - navigationController?.popViewController(animated: true) - } - - override func viewDidLoad() { - super.viewDidLoad() - - setUpNavBar(id: 201, title: "Profile") - - guard userinfoviewmodel != nil else { - self.popUpMessageInfo(value: 16, title: "No Data Available", message: "Data not received") - return - } - - setUpAnotherLoginListener(genericviewmodel: userinfoviewmodel!) - - userinfoviewmodel!.userDataAvailable.value = nil - userinfoviewmodel!.userSourceFundAvailable.value = nil - userinfoviewmodel?.internetConnection.value = nil - - userinfoviewmodel?.userConnectionTimeOut.value = nil - /** - connection timeout - */ - userinfoviewmodel?.userConnectionTimeOut.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - if ProfileBankViewController.profileConnectionTimeOutCheck == 0{ - ProfileBankViewController.profileConnectionTimeOutCheck = ProfileBankViewController.profileConnectionTimeOutCheck+1 - self.popUpMessage(value: 33) - } - } - - /** - Internet check - */ - userinfoviewmodel?.internetConnection.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.popUpMessage(value: 15) - - } - /** - Update the view for Source fund - */ - userinfoviewmodel!.userSourceFundAvailable.bind { [weak self] in - guard $0 != nil else { - if let controller = self?.alertController { - controller.dismiss(animated: true, completion: nil) - } - return - } - - guard $0! else { - if ProfileBankViewController.profileConnectionTimeOutCheck == 0{ - ProfileBankViewController.profileConnectionTimeOutCheck = ProfileBankViewController.profileConnectionTimeOutCheck+1 - self?.popUpMessageError(value: 10, message: (self?.userinfoviewmodel?.getErrorMessage())!) - } - return - } - self?.setUpTextField() - } - - /** - Update the view for user detail - */ - userinfoviewmodel!.userDataAvailable.bind { [unowned self] in - guard $0 != nil else { - return - } - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.enableUserInteractions() - guard $0! else { - if ProfileBankViewController.profileConnectionTimeOutCheck == 0{ - ProfileBankViewController.profileConnectionTimeOutCheck = ProfileBankViewController.profileConnectionTimeOutCheck+1 - self.popUpMessageError(value: 10, message: self.userinfoviewmodel!.getErrorMessage()) - } - return - } - // self.labelSourceIncome.attributedText = self.getAttributedLabel(inputLabel: self.updatedString) - - self.labelSourceIncome.attributedText = self.getAttributedLabel(inputLabel: self.selectedFundSource) - - } - - - labelBankName.text = userinfoviewmodel!.getInfo().primaryBankName - labelAccountNumber.text = userinfoviewmodel!.getInfo().primaryAccountNumber - labelVerificationIDType.text = userinfoviewmodel!.getInfo().verificationIdType - labelVerificationIDNumber.text = userinfoviewmodel!.getInfo().verificationIdNumber - labelExpiryDate.text = unixTimeStampToDate(unixTimeStamp: userinfoviewmodel!.getInfo().expiryDate) - - selectedFundSource = userinfoviewmodel!.getInfo().sourceOfFund - - labelSourceIncome.attributedText = getAttributedLabel(inputLabel: selectedFundSource) - - labelSourceIncome.isUserInteractionEnabled = true - labelSourceIncome.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(editDetail(tapGestureRecognizer:)))) - } - - /** - To set data in textfield which is selected from picker view - */ - func setUpTextField() { - if self.userinfoviewmodel!.getSourceFundList().count > 0 { - self.pickerData = self.userinfoviewmodel!.getSourceFundList() - - selectedFundSouceIndex = pickerData.index(of: selectedFundSource) - self.editTextField.text = self.pickerData[selectedFundSouceIndex] - self.pickerView.dataSource = self - self.pickerView.delegate = self - pickerView.selectRow(selectedFundSouceIndex, inComponent: 0, animated: true) - self.editTextField.becomeFirstResponder() - } - } - - /** - To dispaly image and Text in single label - - parameter String : sourcr of fund - - returns: NSMutableAttributedString - */ - - func getAttributedLabel(inputLabel: String) -> NSMutableAttributedString { - - let fullString: NSMutableAttributedString = NSMutableAttributedString(string: "") - - // create our NSTextAttachment - let imageAttachment = NSTextAttachment() - imageAttachment.image = UIImage(named: "ic_profile_change_edit") - - // wrap the attachment in its own attributed string so we can append it - let imageString = NSAttributedString(attachment: imageAttachment) - - // add the NSTextAttachment wrapper to our full string, then add some more text. - fullString.append(imageString) - fullString.append(NSAttributedString(string: " ")) - fullString.append(NSAttributedString(string: inputLabel)) - - return fullString - } - - /** - To edit user Source of Fund. - */ - - @objc func editDetail(tapGestureRecognizer: UITapGestureRecognizer) { - - let title: String = "Source of Fund" - - alertController = UIAlertController(title: "Edit " + title, message: nil, preferredStyle: .alert) - - alertController.addTextField { (textField : UITextField!) -> Void in - textField.placeholder = "New value" - - if Reachability.isConnectedToNetwork() == true{ - textField.inputView = self.pickerView - self.editTextField = textField - self.editTextField.delegate = self - - if self.userinfoviewmodel!.getSourceFundList().count > 0 { - self.setUpTextField() - } else { - self.userinfoviewmodel!.fetchCDDList(cddName: cddCode.SourceFund.rawValue, param: nil) - } - } - } - - - let confirmAction = UIAlertAction(title: "Confirm", style: .default, handler: { - alert -> Void in - - let valueTextField = self.alertController.textFields![0] as UITextField - - if valueTextField.text! != "" { - self.selectedFundSource = valueTextField.text! - self.showActivityIndicator(activityIndicator: self.activityIndicator) - self.disableUserInteractions() - - self.userinfoviewmodel!.updateUserInfo(param: ["sourceOfFund": self.userinfoviewmodel!.getSourceFundID(index: self.selectedFundSouceIndex)]) - } else { - self.popUpMessageError(value: 10, message: "No data provided") - - } - }) - - let cancelAction = UIAlertAction(title: "Cancel", style: .destructive, handler: { - (action : UIAlertAction!) -> Void in - - }) - - cancelAction.setValue(UIColor.black, forKey: "titleTextColor") - confirmAction.setValue(UIColor(hex:0xEC1C24), forKey: "titleTextColor") - - alertController.addAction(cancelAction) - alertController.addAction(confirmAction) - - if Reachability.isConnectedToNetwork() == true{ - self.present(alertController, animated: true, completion: nil) - }else{ - popUpMessage(value: 15) - } - } -} - -extension ProfileBankViewController: UIPickerViewDataSource, UIPickerViewDelegate { - - func numberOfComponents(in pickerView: UIPickerView) -> Int { - return 1 - } - - func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { - return pickerData.count - } - - func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { - return pickerData[row] - } - - func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { - editTextField!.text = pickerData[row] - selectedFundSouceIndex = row - } -} - -extension ProfileBankViewController: UITextFieldDelegate { - - func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { - return false - } -} diff --git a/GMERemittance/Profile/ProfileDocumentViewController.swift b/GMERemittance/Profile/ProfileDocumentViewController.swift deleted file mode 100644 index 2db72eb5..00000000 --- a/GMERemittance/Profile/ProfileDocumentViewController.swift +++ /dev/null @@ -1,98 +0,0 @@ -// -// ProfileDocumentViewController.swift -// GMERemittance -// -// Created by Fm-user on 1/31/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import UIKit - -class ProfileDocumentViewController: UIViewController { - - @IBOutlet weak var imageViewIDFront: UIImageView! - @IBOutlet weak var imageViewIDBack: UIImageView! - @IBOutlet weak var imageViewPassbook: UIImageView! - @IBOutlet weak var imageViewPassport: UIImageView! - @IBOutlet weak var imageViewCloseUpSelfie: UIImageView! - - var userinfoviewmodel: UserInfoViewModel? - - override func viewDidLoad() { - super.viewDidLoad() - - setUpNavBar(id: 201, title: "Profile") - - guard userinfoviewmodel != nil else { - return - } - - setUpAnotherLoginListener(genericviewmodel: userinfoviewmodel!) - - userinfoviewmodel?.internetConnection.value = nil - /** - internet check - */ - userinfoviewmodel?.internetConnection.bind { [unowned self] in - guard $0 != nil else { - return - } - self.popUpMessage(value: 15) - - } - - guard userinfoviewmodel != nil else { - self.popUpMessageInfo(value: 16, title: "No Data Available", message: "Data not received") - return - } - - downloadImage(id: 1, url: URL(string: (userinfoviewmodel?.getInfo().regIdcardFrontUrl)!)!) - downloadImage(id: 2, url: URL(string: (userinfoviewmodel?.getInfo().regIdcardBackUrl)!)!) - downloadImage(id: 3, url: URL(string: (userinfoviewmodel?.getInfo().passbookUrl)!)!) - downloadImage(id: 4, url: URL(string: (userinfoviewmodel?.getInfo().passportUrl)!)!) - - if let url = userinfoviewmodel?.getInfo().selfieUrl{ - downloadImage(id: 5, url: URL(string: url)!) - } - } - - func getDataFromUrl(url: URL, completion: @escaping (Data?, URLResponse?, Error?) -> ()) { - URLSession.shared.dataTask(with: url) { data, response, error in - completion(data, response, error) - }.resume() - } - - /** - To download the image throug api call - - parameter Int: type of image - - parameter url: url of image - */ - - func downloadImage(id: Int, url: URL) { - - getDataFromUrl(url: url) { data, response, error in - guard let data = data, error == nil else { return } - - DispatchQueue.main.async() { - switch id { - case 1: - self.imageViewIDFront.image = UIImage(data: data) - case 2: - self.imageViewIDBack.image = UIImage(data: data) - case 3: - self.imageViewPassbook.image = UIImage(data: data) - case 4: - self.imageViewPassport.image = UIImage(data: data) - case 5: - self.imageViewCloseUpSelfie.image = UIImage(data: data) - default: - return - } - } - } - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - } -} diff --git a/GMERemittance/Profile/ProfileEdit.storyboard b/GMERemittance/Profile/ProfileEdit.storyboard deleted file mode 100644 index a6f2baf2..00000000 --- a/GMERemittance/Profile/ProfileEdit.storyboard +++ /dev/null @@ -1,1856 +0,0 @@ - - - - - - - - - - - - - - SanFranciscoDisplay-Regular - - - SanFranciscoText-Regular - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GMERemittance/Profile/ProfileGeneralViewController.swift b/GMERemittance/Profile/ProfileGeneralViewController.swift deleted file mode 100644 index 7d44f331..00000000 --- a/GMERemittance/Profile/ProfileGeneralViewController.swift +++ /dev/null @@ -1,435 +0,0 @@ -// -// ProfileEditViewController.swift -// GMERemittance -// -// Created by Fm-user on 1/9/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import UIKit - -class ProfileGeneralViewController: UIViewController { - - var userinfoviewmodel: UserInfoViewModel? - var alertController: UIAlertController! - - private var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView() - - @IBOutlet weak var labelFirstName: UILabel! - @IBOutlet weak var labelMiddleName: UILabel! - @IBOutlet weak var labelLastName: UILabel! - @IBOutlet weak var labelNickName: UILabel! - @IBOutlet weak var labelGender: UILabel! - @IBOutlet weak var labelDOB: UILabel! - @IBOutlet weak var labelMobile: UILabel! - @IBOutlet weak var labelEmail: UILabel! - @IBOutlet weak var labelCountry: UILabel! - @IBOutlet weak var labelCountryNative: UILabel! - @IBOutlet weak var labelProvince: UILabel! - @IBOutlet weak var labelOccupation: UILabel! - - private var indexTag: Int = 0 - private var selectedOccupationIndex: Int = 0 - private var selectedProvinceIndex: Int = 0 - - private var updatedString: String = "" - private var selectedOccupation: String! - private var selectedProvince: String! - - let pickerView = UIPickerView() - var pickerData: [String] = [String]() - - var editTextField: UITextField! - - public static var profileGeneralConnectionTimeOutCheck = 0 - - @IBAction func goBack(_ sender: Any) { - navigationController?.popViewController(animated: true) - } - - - override func viewDidLoad() { - super.viewDidLoad() - - setUpNavBar(id: 201, title: "Profile") - - guard userinfoviewmodel != nil else { - self.popUpMessageInfo(value: 16, title: "No Data Available", message: "Data not received") - return - } - - setUpAnotherLoginListener(genericviewmodel: userinfoviewmodel!) - - userinfoviewmodel!.userDataAvailable.value = nil - userinfoviewmodel!.userOccupationProvinceAvailable.value = nil - userinfoviewmodel?.internetConnection.value = nil - - userinfoviewmodel?.userConnectionTimeOut.value = nil - /** - connection timeout - */ - userinfoviewmodel?.userConnectionTimeOut.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - if ProfileGeneralViewController.profileGeneralConnectionTimeOutCheck == 0{ - ProfileGeneralViewController.profileGeneralConnectionTimeOutCheck = ProfileGeneralViewController.profileGeneralConnectionTimeOutCheck+1 - self.popUpMessage(value: 34) - } - } - - - /** - Internet check - */ - - userinfoviewmodel?.internetConnection.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.popUpMessage(value: 15) - } - - /** - Update the view for Occupation and Province - */ - userinfoviewmodel!.userOccupationProvinceAvailable.bind { [unowned self] in - guard $0 != nil else { - return - } - if $0 == 0 { - self.popUpMessageError(value: 10, message: (self.userinfoviewmodel?.getErrorMessage())!) - } else { - if $0 == 3 { - self.setUpTextField(category: 3) - } else if $0 == 5 { - self.setUpTextField(category: 5) - } else if $0 == -1 { - if self.alertController != nil { - self.alertController.dismiss(animated: true, completion: nil) - } - } - } - } - /** - Update the view for User data - */ - - userinfoviewmodel!.userDataAvailable.bind { [unowned self] in - guard $0 != nil else { - return - } - - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.enableUserInteractions() - - guard $0! else { - //self.popUpMessageError(value: 10, message: (self.userinfoviewmodel?.getErrorMessage())!) - return - } - - switch self.indexTag { - case 1: - self.labelNickName.attributedText = self.getAttributedLabel(inputLabel: self.updatedString) - UserDefaults.standard.set(self.updatedString, forKey: "com.gmeremit.nickName") //Updating UserDefaults so that when the user goes back to HomeScreen, the changes are reflected - case 3: - self.labelProvince.attributedText = self.getAttributedLabel(inputLabel: self.pickerData[self.selectedProvinceIndex]) - - case 5: - self.labelOccupation.attributedText = self.getAttributedLabel(inputLabel: self.pickerData[self.selectedOccupationIndex]) - default: - return - } - } - - if let firstName = userinfoviewmodel!.getInfo().firstName { - labelFirstName.text = firstName - } - if let lastName = userinfoviewmodel!.getInfo().lastName { - labelLastName.text = lastName - } - if let middleName = userinfoviewmodel!.getInfo().middleName { - labelMiddleName.text = middleName - } else { - labelMiddleName.text = "-" - } - if let gender = userinfoviewmodel!.getInfo().gender{ - labelGender.text = gender - } - if let dob = userinfoviewmodel!.getInfo().dateOfBirth { - labelDOB.text = unixTimeStampToDate(unixTimeStamp:dob ) - } - if let mobileNumber = userinfoviewmodel!.getInfo().mobileNumber { - labelMobile.text = mobileNumber - } - if let email = userinfoviewmodel!.getInfo().email{ - labelEmail.text = email - } - if let nativeCountry = userinfoviewmodel!.getInfo().nativeCountry{ - labelCountryNative.text = nativeCountry - } - if let country = userinfoviewmodel!.getInfo().country{ - labelCountry.text = country - } - if let nickName = userinfoviewmodel!.getInfo().nickName { - labelNickName.attributedText = getAttributedLabel(inputLabel: nickName) - } else { - labelNickName.attributedText = getAttributedLabel(inputLabel: "") - } - if let occupation = userinfoviewmodel!.getInfo().occupation{ - selectedOccupation = occupation - labelOccupation.attributedText = getAttributedLabel(inputLabel: selectedOccupation) - } - if let province = userinfoviewmodel!.getInfo().province{ - selectedProvince = province - labelProvince.attributedText = getAttributedLabel(inputLabel: selectedProvince) - } - - labelNickName.isUserInteractionEnabled = true - labelProvince.isUserInteractionEnabled = true - labelOccupation.isUserInteractionEnabled = true - - labelNickName.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(editDetail(tapGestureRecognizer:)))) - labelProvince.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(editDetail(tapGestureRecognizer:)))) - labelOccupation.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(editDetail(tapGestureRecognizer:)))) - } - - /** - Picker view data list - - parameter Integer: - - parameter: 5 for Occupation list - - parameter: 3 for Province list - */ - - func setUpTextField(category: Int) { - if category == 5 { - if let userinfoModelCount = self.userinfoviewmodel?.getOccupationList().count{ - if userinfoModelCount > 0{ - self.pickerData = (self.userinfoviewmodel?.getOccupationList())! - - if let selectedOccupationIndex = self.pickerData.index(of: selectedOccupation) { - self.editTextField.text = self.pickerData[selectedOccupationIndex] - self.pickerView.dataSource = self - self.pickerView.delegate = self - pickerView.selectRow(selectedOccupationIndex, inComponent: 0, animated: true) - } - } - } - - } else if category == 3 { - if let provinceCount = self.userinfoviewmodel?.getProvinceList().count { - if provinceCount > 0 { - self.pickerData = self.userinfoviewmodel!.getProvinceList() - if let selectedProvinceIndex = self.pickerData.index(of: selectedProvince) { - self.editTextField.text = self.pickerData[selectedProvinceIndex] - self.pickerView.dataSource = self - self.pickerView.delegate = self - pickerView.selectRow(selectedProvinceIndex, inComponent: 0, animated: true) - } - } - } - } - - self.editTextField.becomeFirstResponder() - } - - /** - To dispaly image and Text in single label - - parameter String : Occupation or Province - - returns: NSMutableAttributedString - */ - - func getAttributedLabel(inputLabel: String) -> NSMutableAttributedString { - - let fullString: NSMutableAttributedString = NSMutableAttributedString(string: "") - - // create our NSTextAttachment - let imageAttachment = NSTextAttachment() - imageAttachment.image = UIImage(named: "ic_profile_change_edit") - - // wrap the attachment in its own attributed string so we can append it - let imageString = NSAttributedString(attachment: imageAttachment) - - // add the NSTextAttachment wrapper to our full string, then add some more text. - fullString.append(imageString) - fullString.append(NSAttributedString(string: " ")) - fullString.append(NSAttributedString(string: inputLabel)) - - return fullString - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - - } - - /** - To edit user nick name, 0ccupation and province - */ - - @objc func editDetail(tapGestureRecognizer: UITapGestureRecognizer) { - let tappedLabel:UILabel = (tapGestureRecognizer.view as! UILabel) // Type cast it with the class for which you have added gesture - - var title: String = "" - - switch tappedLabel.tag { - - case 1: - indexTag = 1 - title = "Nick Name" - case 3: - indexTag = 3 - title = "Province" - if self.userinfoviewmodel!.getProvinceList().count > 0 { - self.pickerData = self.userinfoviewmodel!.getProvinceList() - } else { - pickerData = self.userinfoviewmodel!.getEmptyData() - self.userinfoviewmodel!.fetchCDDList(cddName: cddCode.Province.rawValue, param: ["countryId": "118"]) - } - case 5: - indexTag = 5 - title = "Occupation" - if Reachability.isConnectedToNetwork() == true{ - if self.userinfoviewmodel!.getOccupationList().count > 0 { - self.pickerData = self.userinfoviewmodel!.getOccupationList() - } else { - pickerData = self.userinfoviewmodel!.getEmptyData() - self.userinfoviewmodel!.fetchCDDList(cddName: cddCode.Occupation.rawValue, param: nil) - } - } - default: - title = "" - } - - alertController = UIAlertController(title: "Edit " + title, message: nil, preferredStyle: .alert) - - alertController.addTextField { (textField : UITextField!) -> Void in - - textField.placeholder = "New value" - - if self.indexTag == 5 { - if Reachability.isConnectedToNetwork() == true{ - textField.inputView = self.pickerView - self.editTextField = textField - self.editTextField.delegate = self - if self.userinfoviewmodel!.getOccupationList().count > 0 { - self.setUpTextField(category: self.indexTag) - } - } - } else if self.indexTag == 3 { - textField.inputView = self.pickerView - self.editTextField = textField - self.editTextField.delegate = self - if self.userinfoviewmodel!.getProvinceList().count > 0 { - self.setUpTextField(category: self.indexTag) - } - } else { - - textField.tag = 51 //unique identifier set - textField.delegate = self - } - } - - let confirmAction = UIAlertAction(title: "Confirm", style: .default, handler: { - alert -> Void in - - let valueTextField = self.alertController.textFields![0] as UITextField - - let trimmedString = valueTextField.text?.removeSpacesTrailingPreceding() - - if trimmedString != "" { - - self.updatedString = trimmedString! - - self.showActivityIndicator(activityIndicator: self.activityIndicator) - self.disableUserInteractions() - - switch tappedLabel.tag { - case 1: - self.userinfoviewmodel!.updateUserInfo(param: ["nickName": trimmedString!]) - case 3: - self.userinfoviewmodel!.updateUserInfo(param: ["provinceId": self.userinfoviewmodel!.getProvinceID(index: self.selectedProvinceIndex)]) - - case 5: - self.userinfoviewmodel!.updateUserInfo(param: ["occupation": self.userinfoviewmodel!.getOccupationID(index: self.selectedOccupationIndex)]) - default: - return - } - - } else { - - self.popUpMessageError(value: 10, message: "No data provided") - - //self.present(self.prepareAlert(title: "No updates done", message: "No data supplied"), animated: true, completion: nil ) - } - }) - - let cancelAction = UIAlertAction(title: "Cancel", style: .destructive, handler: { - (action : UIAlertAction!) -> Void in - - }) - - cancelAction.setValue(UIColor.black, forKey: "titleTextColor") - confirmAction.setValue(UIColor(hex:0xEC1C24), forKey: "titleTextColor") - - alertController.addAction(cancelAction) - alertController.addAction(confirmAction) - - - if Reachability.isConnectedToNetwork() == true{ - self.present(alertController, animated: true, completion: nil) - }else{ - popUpMessage(value: 15) - } - } -} - -extension ProfileGeneralViewController: UIPickerViewDataSource, UIPickerViewDelegate { - - func numberOfComponents(in pickerView: UIPickerView) -> Int { - return 1 - } - - func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { - return pickerData.count - } - - func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { - return pickerData[row] - } - - func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { - editTextField!.text = pickerData[row] - - if indexTag == 5 { - selectedOccupation = pickerData[row] - selectedOccupationIndex = row - } else if indexTag == 3 { - selectedProvince = pickerData[row] - selectedProvinceIndex = row - } - } -} - -extension ProfileGeneralViewController: UITextFieldDelegate { - - func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { - - if self.indexTag == 3 || self.indexTag == 5 { - return false - } - return true - } - - func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { - if textField.tag == 51 { - textField.tag = 0 - return false - } - return true - } -} diff --git a/GMERemittance/Profile/ProfileModel.swift b/GMERemittance/Profile/ProfileModel.swift deleted file mode 100644 index 270fe5c3..00000000 --- a/GMERemittance/Profile/ProfileModel.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// UserProfileModel.swift -// GMERemittance -// -// Created by FMI-12 on 1/29/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import Foundation -struct ProfileModel: Decodable { - var userId:String! - var firstName:String! - var middleName:String? - var nickName:String! - var lastName:String! - var mobileNumber:String! - var email:String? - var verificationCode:String? - // var verificationCodeExpiryDate:String? - var createdDate:String? - //var forgetCode:String? - //var forgetCodeExpiryDate:String? - //var userRoles:String? - var primaryBankName: String! - var isActive:Bool? - //var hasKyc:Bool? - var kyc: Bool! - var verified:Bool! - var walletNumber:String? - var availableBalance:String? - var dpUrl:String? - var rewardPoint: String? - -} diff --git a/GMERemittance/Profile/ProfileViewModel.swift b/GMERemittance/Profile/ProfileViewModel.swift deleted file mode 100644 index 8c2bff64..00000000 --- a/GMERemittance/Profile/ProfileViewModel.swift +++ /dev/null @@ -1,266 +0,0 @@ -// -// ProfileViewModel.swift -// GMERemittance -// -// Created by FMI-12 on 1/29/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import Foundation - - -class ProfileViewModel: ModelExtension { - - - var userDataAvailable:Box = Box(nil) - var imageSubmitted:Box = Box(nil) - - var profileConnectionTimeOut: Box = Box(nil) - - var availableBalance: String? - var rewardPoint: String? - var walletNumber: String? - - private var profileInfo: ProfileModel! - - private var user_id: String! - - private var userImageDocUrl: String? - - /** - Api request for user Information - - parameter String: UserId - */ - func fetchUserInfo(userId: String?) { - if userId == nil { - user_id = UserDefaults.standard.object(forKey: "com.gmeremit.username") as? String - } else { - user_id = userId! - } - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - RestApiMananger.sharedInstance.getUserDetails(userId: self.user_id) { result in - switch result { - case let .success(userJSON): - do { - self.profileInfo = try JSONDecoder().decode(ProfileModel.self, from: userJSON.rawData()) - - if userId == nil { - self.availableBalance = userJSON["availableBalance"].stringValue - self.rewardPoint = userJSON["rewardPoint"].stringValue - self.walletNumber = userJSON["walletNumber"].stringValue - } - - self.userDataAvailable.value = true - - } catch { - - self.userDataAvailable.value = false - } - - case let .failure(errorJSON): - self.setErrorMessage(message: "Update Failed:" + errorJSON["message"].stringValue) - self.userDataAvailable.value = false - - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: self.user_id!, password: self.getLoginPassword()) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.fetchUserInfo(userId: userId) - } - - } - case .logOutUser(): - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.profileConnectionTimeOut.value = false - } - } - } - } - - /** - Submit the Image provided - - parameter docType: type of document - - parameter imageBase64 data - */ - func provideImageForSubmission(docType: String, imageBase64: String) { - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - - let docParam = ["documentType": docType, "file": imageBase64] - RestApiMananger.sharedInstance.submitDocument(param: docParam, userId: self.user_id!) { result in - switch result { - case let .success(imageJSON): - if let docUrl = imageJSON["documentUrl"].rawString() { - self.updateUserInfo(param: ["dpUrl": docUrl]) - } else { - self.setErrorMessage(message:"No image URL generated") - self.imageSubmitted.value = false - } - case let .failure(errorJSON): - self.setErrorMessage(message: errorJSON["message"].stringValue) - self.imageSubmitted.value = false - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: self.user_id!, password: self.getLoginPassword()) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.provideImageForSubmission(docType: docType, imageBase64: imageBase64) - } - } - case .logOutUser(): - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.profileConnectionTimeOut.value = false - } - } - } - } - - /** - Api request to update user information - - parameter param: User information is in Dictionary - */ - func updateUserInfo(param: [String: String]) { - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - RestApiMananger.sharedInstance.updateUserDetail (userId: user_id, param: param) { result in - switch result { - case let .success(fetchedJSON): - UserDefaults.standard.set(fetchedJSON["dpUrl"].stringValue, forKey: "com.gmeremit.dpUrl") - self.imageSubmitted.value = true - case let .failure(errorJSON): - self.setErrorMessage(message: errorJSON["message"].stringValue) - self.imageSubmitted.value = false - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: self.user_id!, password: self.getLoginPassword()) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.updateUserInfo(param: param) - } - } - case .logOutUser(): - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.profileConnectionTimeOut.value = false - } - } - } - - } - - /** - to get proile info - - returns: profile Info - */ - func getProfileModel() -> ProfileModel { - return profileInfo - } - - /** - To get full name - - returns: Full name - */ - - func getFullName() -> String { - if profileInfo.middleName == nil { - return profileInfo.firstName + " " + profileInfo.lastName - } else { - return profileInfo.firstName + " " + profileInfo.middleName! + " " + profileInfo.lastName - } - } - /** - To get user balance - - returns: Amount - */ - func getAvailableBalance() -> String { - if let balance = availableBalance { - return balance - } - return "N/A" - - } - - /** - To get user email - - returns: email - */ - func getEmail() -> String { - if let email = profileInfo.email { - return email - } - return "Email: N/A" - } - - /** - To get user Phone nos. - - returns: Phone nos. - */ - func getPhone() -> String { - if let phone = profileInfo.mobileNumber { - return phone - } - return "Phone: N/A" - } - - /** - To get user wallet Nos. - - returns: wallet Nos. - */ - func getWalletNumber() -> String { - if let walletNum = walletNumber { - return walletNum - } - return "Wallet Number: N/A" - } - - /** - To get user bank name - - returns: bank name - */ - func getBankName() -> String { - if let bankName = profileInfo.primaryBankName { - return bankName - } - return "Primary Bank: N/A" - } - - //Added to determine if the user has filled kyc form - func hasFilledKYC() -> Bool { - if profileInfo.kyc { - return true - } - return false - } - - /// To deteemine verified account - func isVerified() -> Bool { - if profileInfo.verified! { - return true - } - return false - } - - /** - To get user reward point - - returns: points - */ - func getRewardPoint() -> String { - if let points = rewardPoint { - return points - } - return "N/A" - } -} diff --git a/GMERemittance/Profile/UserInfoViewController.swift b/GMERemittance/Profile/UserInfoViewController.swift deleted file mode 100644 index 06417769..00000000 --- a/GMERemittance/Profile/UserInfoViewController.swift +++ /dev/null @@ -1,103 +0,0 @@ -// -// ProfileAccountViewController.swift -// GMERemittance -// -// Created by FMI-12 on 1/29/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import UIKit - -class UserInfoViewController: UIViewController { - - private var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView() - private var userinfoviewmodel = UserInfoViewModel() - - private var count = 0 - public static var profileEditConnectionTimeOutCheck = 0 - - override func viewDidAppear(_ animated: Bool) { - setUpAnotherLoginListener(genericviewmodel: userinfoviewmodel) - - showActivityIndicator(activityIndicator: activityIndicator) - disableUserInteractions() - - userinfoviewmodel.userConnectionTimeOut.value = nil - /** - connection timeout - */ - userinfoviewmodel.userConnectionTimeOut.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - - if UserInfoViewController.profileEditConnectionTimeOutCheck == 0{ - UserInfoViewController.profileEditConnectionTimeOutCheck = UserInfoViewController.profileEditConnectionTimeOutCheck+1 - self.popUpMessage(value: 39) - } - } - - userinfoviewmodel.internetConnection.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - if self.count == 0{ - self.popUpMessage(value: 15) - } - self.count = self.count+1 - } - - userinfoviewmodel.userDataAvailable.bind { [weak self] in - guard $0 != nil else { - return - } - self?.dismissActivityIndicator(activityIndicator: (self?.activityIndicator)!) - self?.enableUserInteractions() - guard $0! else { - if UserInfoViewController.profileEditConnectionTimeOutCheck == 0{ - UserInfoViewController.profileEditConnectionTimeOutCheck = UserInfoViewController.profileEditConnectionTimeOutCheck+1 - self?.popUpMessageError(value: 10, message: (self?.userinfoviewmodel.getErrorMessage())!) - } - return - } - if UserDefaults.standard.object(forKey: "com.gmeremit.address") as? String == nil { - UserDefaults.standard.set(self?.userinfoviewmodel.getAddress(), forKey: "com.gmeremit.address") - } - } - userinfoviewmodel.fetchUserInfo() - } - - override func viewDidLoad() { - super.viewDidLoad() - - setUpNavBar(id: 201, title: "Profile") - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - } - - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - if (segue.identifier == "profileUserGeneral") { - let nextViewController = segue.destination as! ProfileGeneralViewController - if (self.userinfoviewmodel.getInfo().firstName) != nil{ - nextViewController.userinfoviewmodel = self.userinfoviewmodel - } - } else if (segue.identifier == "profileUserDocument") { - let nextViewController = segue.destination as! ProfileDocumentViewController - if (self.userinfoviewmodel.getInfo().firstName) != nil{ - nextViewController.userinfoviewmodel = self.userinfoviewmodel - } - } else if (segue.identifier == "profileUserBank") { - let nextViewController = segue.destination as! ProfileBankViewController - if (self.userinfoviewmodel.getInfo().firstName) != nil{ - nextViewController.userinfoviewmodel = self.userinfoviewmodel - } - } - } -} diff --git a/GMERemittance/Profile/UserInfoViewModel.swift b/GMERemittance/Profile/UserInfoViewModel.swift deleted file mode 100644 index 526343f8..00000000 --- a/GMERemittance/Profile/UserInfoViewModel.swift +++ /dev/null @@ -1,294 +0,0 @@ -// -// UserInfoViewModel.swift -// GMERemittance -// -// Created by FMI-12 on 1/30/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import Foundation - -class UserInfoViewModel: ModelExtension { - - var userDataAvailable:Box = Box(nil) - var userOccupationProvinceAvailable:Box = Box(nil) // -1 = handle keypad when user is auto logout, 0 = Error, 5 = Occupation, 3 = Province - var userSourceFundAvailable:Box = Box(nil) - var userConnectionTimeOut: Box = Box(nil) - - - private var cddOccupationList: [String] = [String] () - private var cddOccupationValueList: [String] = [String] () - - private var cddSourceFundList: [String] = [String] () - private var cddSourceFundValueList: [String] = [String] () - - private var cddProvinceList: [String] = [String] () - private var cddProvinceValueList: [String] = [String] () - - private var userInfo = KYCModel() - - let user_id = UserDefaults.standard.object(forKey: "com.gmeremit.username") as? String - - /** - APi request for user information - */ - func fetchUserInfo() { - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - RestApiMananger.sharedInstance.fetchUserInfoFromKyc(userId: user_id!) { result in - switch result { - case let .success(fetchedJSON): - guard fetchedJSON.count > 0 else { - self.userDataAvailable.value = false - return - } - - do { - self.userInfo = try JSONDecoder().decode(KYCModel.self, from: fetchedJSON.rawData()) - - self.userDataAvailable.value = true - - } catch { - - self.userDataAvailable.value = false - } - case let .failure(errorJSON): - self.setErrorMessage(message: errorJSON["message"].stringValue) - self.userDataAvailable.value = false - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: self.user_id!, password: self.getLoginPassword()) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.fetchUserInfo() - } - } - case .logOutUser(): - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.userConnectionTimeOut.value = false - } - } - } - } - - /** - APi Request to update userINfo - - parameter param: user info in Dictionary - */ - func updateUserInfo(param: [String: String]) { - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - - RestApiMananger.sharedInstance.updateUserInfoForKyc(userId: getUserId(), parameter: param) { result in - switch result { - case .success(_): - self.userDataAvailable.value = true - self.userDataAvailable.value = nil - case let .failure(errorJSON): - self.setErrorMessage(message: errorJSON["message"].stringValue) - self.userDataAvailable.value = false - self.userDataAvailable.value = nil - - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: self.user_id!, password: self.getLoginPassword()) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.updateUserInfo(param: param) - } - } - case .logOutUser(): - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.userConnectionTimeOut.value = false - } - } - } - - } - - /** - Api request for CddList value - - parameter cddName: Type of cddName - - parameter param: [:] - */ - func fetchCDDList(cddName: String, param: [String: String]?) { - let cdd_name = cddName - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - RestApiMananger.sharedInstance.getCDDListFor(cddCode: cddName, param: param) { result in - switch result { - case let .success(cddJSON): - switch cddName { - case cddCode.Occupation.rawValue: - self.cddOccupationList.removeAll() - self.cddOccupationValueList.removeAll() - case cddCode.SourceFund.rawValue: - self.cddSourceFundList.removeAll() - self.cddSourceFundValueList.removeAll() - case cddCode.Province.rawValue: - self.cddProvinceList.removeAll() - self.cddProvinceValueList.removeAll() - default: - return - } - - if cddJSON.count > 0 { - for i in 0 ... (cddJSON.count-1) { - do { - let cddNameValuePair = try JSONDecoder().decode(Cdd.self, from: cddJSON[i].rawData()) - switch cddName { - case cddCode.Occupation.rawValue: - self.cddOccupationList.append(cddNameValuePair.name) - self.cddOccupationValueList.append(cddNameValuePair.value) - case cddCode.SourceFund.rawValue: - self.cddSourceFundList.append(cddNameValuePair.name) - self.cddSourceFundValueList.append(cddNameValuePair.value) - case cddCode.Province.rawValue: - self.cddProvinceList.append(cddNameValuePair.name) - self.cddProvinceValueList.append(cddNameValuePair.value) - - default: - return - } - } catch { - switch cddName { - case cddCode.Occupation.rawValue: - self.userOccupationProvinceAvailable.value = 0 - case cddCode.SourceFund.rawValue: - self.userSourceFundAvailable.value = false - default: - return - } - break - } - } - } - switch cddName { - case cddCode.Occupation.rawValue: - self.userOccupationProvinceAvailable.value = 5 - case cddCode.Province.rawValue: - self.userOccupationProvinceAvailable.value = 3 - case cddCode.SourceFund.rawValue: - self.userSourceFundAvailable.value = true - default: - return - } - - case .failure(_): - switch cddName { - case cddCode.Occupation.rawValue: - self.userOccupationProvinceAvailable.value = 0 - case cddCode.SourceFund.rawValue: - self.userSourceFundAvailable.value = false - default: - return - } - - return - - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: self.user_id!, password: self.getLoginPassword()) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.fetchCDDList(cddName: cdd_name, param: param) - } - } - case .logOutUser(): - self.userOccupationProvinceAvailable.value = -1 - self.userSourceFundAvailable.value = nil - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.userConnectionTimeOut.value = false - } - - } - } - } - - /** - To get occupation List - - returns: occupation list - */ - func getOccupationList() -> [String] { - return cddOccupationList - } - - /** - - parameter index: position of occupation in an array - - returns: occupation - */ - - func getOccupationID(index: Int) -> String { - return cddOccupationValueList[index] - } - - /** - To get province List - - returns: privince list - */ - func getProvinceList() -> [String] { - return cddProvinceList - } - - /** - - parameter index: position of province in an array - - returns: province - */ - - func getProvinceID(index: Int) -> String { - return cddProvinceValueList[index] - } - - /** - To get source fund List - - returns: source fund list - */ - func getSourceFundList() -> [String] { - return cddSourceFundList - } - - /** - - parameter index: position of source fund in an array - - returns: source fund - */ - - func getSourceFundID(index: Int) -> String { - return cddSourceFundValueList[index] - } - - /** - To get user info - - returns: user info - */ - func getInfo() -> KYCModel { - return userInfo - } - - /** - To get address - - returns: address - */ - func getAddress() -> String { - return ""// userInfo.address + ", " + userInfo.city - } - - /** - To get data array - - returns: empty array - */ - func getEmptyData() -> [String] { - return [String]() - } -} diff --git a/GMERemittance/Profile/UserTemp.swift b/GMERemittance/Profile/UserTemp.swift deleted file mode 100644 index bb006906..00000000 --- a/GMERemittance/Profile/UserTemp.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// UserTemp.swift -// GMERemittance -// -// Created by FMI-12 on 1/30/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import Foundation -struct UserTemp: Codable { - - var fullName: String! - var gender: String! - var dateOfBirth: String! - var mobileNumber: String! - var email: String? - var nativeCountry: String! - var country: String! - var city: String! - var address: String! - var occupation: String! - var primaryBankName: String! - var primaryAccountNumber: String! - var verificationIdType: String! - var verificationIdNumber: String! - var expiryDate: String! - var regIdcardFrontUrl: String? - var regIdcardBackUrl: String? - var passbookUrl: String? - var passportUrl: String? -} diff --git a/GMERemittance/Profile/WithdrawViewController.swift b/GMERemittance/Profile/WithdrawViewController.swift deleted file mode 100644 index 65585fd1..00000000 --- a/GMERemittance/Profile/WithdrawViewController.swift +++ /dev/null @@ -1,183 +0,0 @@ -// -// WithdrawViewController.swift -// GMERemittance -// -// Created by Fm-user on 1/12/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import UIKit - -class WithdrawViewController: UIViewController { - - @IBOutlet weak var textViewWithdraw: UITextView! - @IBOutlet weak var textFieldAmount: UITextField! - - private var withdrawviewmodel = WithdrawViewModel() - private var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView() - - override func viewDidLoad() { - super.viewDidLoad() - - setUpNavBar(id: 201, title: "Withdraw") - - setUpAnotherLoginListener(genericviewmodel: withdrawviewmodel) - - hideKeyboardWhenTappedAround() - - // Do any additional setup after loading the view. - textViewWithdraw.delegate = self - textViewWithdraw.text = "Reason for withdraw" - textViewWithdraw.textColor = UIColor(red:0.78, green:0.78, blue:0.80, alpha:1.0) - - - withdrawviewmodel.withdrawConnectionTimeOut.value = nil - /** - connection timeout - */ - withdrawviewmodel.withdrawConnectionTimeOut.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.popUpMessage(value: 20) - } - - - withdrawviewmodel.internetConnection.value = nil - - /** - internet check - */ - - withdrawviewmodel.internetConnection.bind { [unowned self] in - guard $0 != nil else { - return - } - self.enableUserInteractions() - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.popUpMessage(value: 15) - } - - /** - Update the for send and withdraw request - */ - withdrawviewmodel.requestProcessed.bind { [unowned self] in - - guard $0 != nil else { - return - } - - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.enableUserInteractions() - - guard $0! else { - self.popUpMessageError(value: 10, message: self.withdrawviewmodel.getErrorMessage()) - return - } - guard let navController = self.navigationController else { - return - } - - if let popUpViewController = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "popUpInfo") as? PopUpGeneralInfo { - - popUpViewController.indexValue = 3 - - navController.addChildViewController(popUpViewController) - popUpViewController.view.frame = navController.view.bounds - navController.view.addSubview(popUpViewController.view) - popUpViewController.didMove(toParentViewController: navController) - } - } - } - - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. - } - - @IBAction func submitWithdrawRequest(_ sender: Any) { - withdrawviewmodel.setParam(amount: textFieldAmount.text!, reason: textViewWithdraw.text) - switch withdrawviewmodel.validateAmountandReason() { - - case .Valid: - confirmRequest() - - case .InValid(let error): - self.popUpMessageError(value: 11, message: error) - } - } - - /** - Conforming for request - */ - func confirmRequest() { - - let alertController = UIAlertController(title: "Enter your login password", message: nil, preferredStyle: .alert) - - alertController.addTextField { (textField : UITextField!) -> Void in - textField.placeholder = "Password" - textField.isSecureTextEntry = true - textField.tag = 51 - textField.delegate = self - } - - let confirmAction = UIAlertAction(title: "Confirm", style: .default, handler: { - alert -> Void in - - let valueTextField = alertController.textFields![0] as UITextField - - if valueTextField.text != "" { - self.disableUserInteractions() - self.showActivityIndicator(activityIndicator: self.activityIndicator) - self.withdrawviewmodel.sendWithdrawRequest(password: valueTextField.text!) - } else { - self.popUpMessageError(value: 11, message: "Password was missing") - } - }) - - let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: { - (action : UIAlertAction!) -> Void in - }) - - cancelAction.setValue(UIColor.black, forKey: "titleTextColor") - confirmAction.setValue(UIColor(hex:0xEC1C24), forKey: "titleTextColor") - - alertController.addAction(cancelAction) - alertController.addAction(confirmAction) - - self.present(alertController, animated: true, completion: nil) - - } -} - - -extension WithdrawViewController: UITextViewDelegate { - - func textViewDidBeginEditing(_ textViewWithdraw: UITextView) { - if textViewWithdraw.textColor == UIColor(red:0.78, green:0.78, blue:0.80, alpha:1.0) { - textViewWithdraw.text = nil - textViewWithdraw.textColor = UIColor(red:0.29, green:0.29, blue:0.29, alpha:1.0) - } - } - - func textViewDidEndEditing(_ textViewWithdraw: UITextView) { - if textViewWithdraw.text.isEmpty { - textViewWithdraw.text = "Reason for withdraw" - textViewWithdraw.textColor = UIColor(red:0.78, green:0.78, blue:0.80, alpha:1.0) - } - } - -} - -extension WithdrawViewController: UITextFieldDelegate { - func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { - if textField.tag == 51 { - textField.tag = 0 - return false - } - return true - } -} diff --git a/GMERemittance/Profile/WithdrawViewModel.swift b/GMERemittance/Profile/WithdrawViewModel.swift deleted file mode 100644 index fe2d7cbc..00000000 --- a/GMERemittance/Profile/WithdrawViewModel.swift +++ /dev/null @@ -1,79 +0,0 @@ -// -// WithdrawViewModel.swift -// GMERemittance -// -// Created by Sujal on 2/13/18. -// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. -// - -import Foundation - -class WithdrawViewModel: ModelExtension { - - var amount: String! - var reason: String! - - var requestProcessed: Box = Box(nil) - - var withdrawConnectionTimeOut: Box = Box(nil) - - let user_id = UserDefaults.standard.object(forKey: "com.gmeremit.username") as? String - - /** - To check validation for withdraw - */ - func validateAmountandReason() -> isValid { - if amount.isBlank || reason.isBlank || reason == "Reason for withdraw" { - return .InValid("Please fill all the fields") - } - return .Valid - } - - /** - To set amount and reason - - parametet amount: withdraw amount - - parameter reason: reason for withdraw - */ - func setParam(amount: String, reason: String) { - self.amount = amount.removeSpacesTrailingPreceding() - self.reason = reason.removeSpacesTrailingPreceding() - } - - /** - To request for withdraw - - parametet password: to comfirm with request user should type account password - */ - func sendWithdrawRequest(password: String) { - let passwordLocal = password - let userId = UserDefaults.standard.object(forKey: "com.gmeremit.username") as? String - let params: [String: String] = ["userId": userId!, "amount": amount, "reason": reason, "txnpassword": password] - if !Reachability.isConnectedToNetwork() { - self.internetConnection.value = false - } else { - RestApiMananger.sharedInstance.withdrawBalance(requestDetails: params) { result in - switch result { - - case .success(_): - self.requestProcessed.value = true - case let .failure(errorJSON): - self.setErrorMessage(message: errorJSON["message"].stringValue) - self.requestProcessed.value = false - case .updateAccessCode: - RestApiMananger.sharedInstance.updateAccessCode(userId: self.user_id!, password: self.getLoginPassword()) { - result in - if result != "Error"{ - let uuid = RestApiMananger.sharedInstance.getUUID() - UserDefaults.standard.set((result + ":" + uuid).toBase64(), forKey: "com.gmeremit.accessCode") - self.sendWithdrawRequest(password: passwordLocal) - } - } - case .logOutUser(): - RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - self.anotherLogin.value = true - case .timeOut: - self.withdrawConnectionTimeOut.value = false - } - } - } - } -} diff --git a/GMERemittance/SideMenu/SettingViewController.swift b/GMERemittance/SideMenu/SettingViewController.swift index e931784a..d941d7ce 100644 --- a/GMERemittance/SideMenu/SettingViewController.swift +++ b/GMERemittance/SideMenu/SettingViewController.swift @@ -25,12 +25,6 @@ class SettingViewController: UIViewController { self.navigationItem.title = "" } - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - } - /** - Redirect to change password view - */ @IBAction func redirectToChangePassword(_ sender: Any) { let storyboard = UIStoryboard.init(name: "Profile", bundle: Bundle.main) if let changePasswordViewController = storyboard.instantiateViewController(withIdentifier: "changePassword") as? ProfileChangePasswordViewController { diff --git a/GMERemittance/SideMenu/SideMenuViewController.swift b/GMERemittance/SideMenu/SideMenuViewController.swift index ec153acd..d78c7a40 100644 --- a/GMERemittance/SideMenu/SideMenuViewController.swift +++ b/GMERemittance/SideMenu/SideMenuViewController.swift @@ -97,9 +97,9 @@ class SideMenuViewController: UIViewController { @IBAction func withDraw(_ sender: Any) { let storyboard = UIStoryboard.init(name: "Profile", bundle: Bundle.main) - if let withDrawViewController = storyboard.instantiateViewController(withIdentifier: "withdraw") as? WithdrawViewController { - self.navigationController!.pushViewController(withDrawViewController, animated: true) - } +// if let withDrawViewController = storyboard.instantiateViewController(withIdentifier: "withdraw") as? WithdrawViewController { +// self.navigationController!.pushViewController(withDrawViewController, animated: true) +// } } diff --git a/GMERemittance/Social/MyStoryViewController.swift b/GMERemittance/Social/MyStoryViewController.swift index fd231918..e11630a9 100644 --- a/GMERemittance/Social/MyStoryViewController.swift +++ b/GMERemittance/Social/MyStoryViewController.swift @@ -883,8 +883,8 @@ class MyStoryViewController: UIViewController, UITableViewDelegate, UITableViewD case "showMoreOptions2"?: let homeViewController = segue.destination as! _HomeViewController - homeViewController.numberCellsInCollectionView = 6 - homeViewController.showAllCollectionViewCells = true +// homeViewController.numberCellsInCollectionView = 6 +// homeViewController.showAllCollectionViewCells = true default: return diff --git a/GMERemittance/Wallet/WalletViewController.swift b/GMERemittance/Wallet/WalletViewController.swift index 1b0b5876..7b99d662 100644 --- a/GMERemittance/Wallet/WalletViewController.swift +++ b/GMERemittance/Wallet/WalletViewController.swift @@ -24,7 +24,7 @@ class WalletViewController: UIViewController, UIScrollViewDelegate { private var activeTextField: UITextField? private var walletviewmodel = WalletViewModel() - private var profileviewmodel = ProfileViewModel() +// private var profileviewmodel = ProfileViewModel() private var tracktransactionviewmodel = TrackTransactionViewModel() public var transaction: Transaction? private var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView() @@ -46,395 +46,395 @@ class WalletViewController: UIViewController, UIScrollViewDelegate { setUpAnotherLoginListener(genericviewmodel: walletviewmodel) setUpAnotherLoginListener(genericviewmodel: tracktransactionviewmodel) - setUpAnotherLoginListener(genericviewmodel: profileviewmodel) +// setUpAnotherLoginListener(genericviewmodel: profileviewmodel) - profileviewmodel.profileConnectionTimeOut.value = nil +// profileviewmodel.profileConnectionTimeOut.value = nil /** connection timeout */ - profileviewmodel.profileConnectionTimeOut.bind { [unowned self] in - guard $0 != nil else { - return - } - self.stopLoading() - if WalletViewController.walletConnectionTimeOutCheck == 0{ - WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 - self.popUpMessage(value: 31) - } - } - - tracktransactionviewmodel.transactionListConnectionTimeOut.value = nil - /** - connection timeout - */ - tracktransactionviewmodel.transactionListConnectionTimeOut.bind { [unowned self] in - guard $0 != nil else { - return - } - self.stopLoading() - if WalletViewController.walletConnectionTimeOutCheck == 0{ - WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 - self.popUpMessage(value: 31) - } - } - - walletviewmodel.walletConnectionTimeOut.value = nil +// profileviewmodel.profileConnectionTimeOut.bind { [unowned self] in +// guard $0 != nil else { +// return +// } +// self.stopLoading() +// if WalletViewController.walletConnectionTimeOutCheck == 0{ +// WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 +// self.popUpMessage(value: 31) +// } +// } +// +// tracktransactionviewmodel.transactionListConnectionTimeOut.value = nil /** connection timeout */ - walletviewmodel.walletConnectionTimeOut.bind { [unowned self] in - guard $0 != nil else { - return - } - self.stopLoading() - if WalletViewController.walletConnectionTimeOutCheck == 0{ - WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 - self.popUpMessage(value: 31) - } - } - - setUpNetworkListener() - setUpNetworkListenerForProfile() - setUpProfileListener() - setUpTransactionListener() - setUpWalletDetailsListener() - - /*so that the value is reset and no error message is seen when going back and froth in error case*/ - self.walletviewmodel.walletActionPerformed.value = nil - - self.buttonMoneyRequestCount.setTitle("", for: .normal) - self.buttonMoneyRequestCount.isUserInteractionEnabled = false - - tracktransactionviewmodel.fetchTransactionListForTrackAndWallet(recipientId: "", recipientName: "", transactionType: "moneyRequest", startDate: nil, endDate: nil, txPage: nil, txSize: nil) - } - - override func viewDidLoad() { - super.viewDidLoad() - - setUpNavBar(id: 201, title: "Wallet to Wallet Transfer") - - NotificationCenter.default.addObserver(self, selector: #selector(appMovedToForeground), name: Notification.Name.UIApplicationWillEnterForeground, object: nil) - - registerTapListener() - - - self.startLoading() - walletviewmodel.getTransactionInfo() +// tracktransactionviewmodel.transactionListConnectionTimeOut.bind { [unowned self] in +// guard $0 != nil else { +// return +// } +// self.stopLoading() +// if WalletViewController.walletConnectionTimeOutCheck == 0{ +// WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 +// self.popUpMessage(value: 31) +// } +// } - scrollView.delegate = self - scrollView.addSubview(contentView) - scrollView.contentSize = CGSize(width: 2000, height:2000) - - if transaction != nil { - moneyRequestAccepted = true - segmentedControl.isUserInteractionEnabled = false - walletviewmodel.setMode(segmentIndex: 2) - walletviewmodel.setMoneyRequestTransactionID(id: transaction!.transactionId) - - textFieldID.text = transaction!.receiverId - textFieldAmount.text = transaction!.payoutAmountOriginal - - - textFieldID.isUserInteractionEnabled = false - } - textFieldID.delegate = self - textFieldAmount.delegate = self - textFieldMessage.delegate = self - - - segmentedControl.selectedSegmentIndex = 0 - segmentedControl.addTarget(self, action: #selector(modeChanged(_:)), for: .valueChanged) - - walletviewmodel.setMode(segmentIndex: 0) - } - - /** - Disable user interaction while fetching data from api - */ - func startLoading(){ - self.showActivityIndicator(activityIndicator: self.activityIndicator) - self.disableUserInteractions() - } - - /** - Enable user interaction while fetching data from api - */ - func stopLoading(){ - self.dismissActivityIndicator(activityIndicator: self.activityIndicator) - self.enableUserInteractions() - } - - /** - Check internet connection - */ - func setUpNetworkListener() { - walletviewmodel.internetConnection.bind { [unowned self] in - guard $0 != nil else { - return - } - self.walletviewmodel.internetConnection.value = nil - self.stopLoading() - self.popUpMessage(value: 15) - } - } - - func setUpNetworkListenerForProfile() { - profileviewmodel.internetConnection.bind { [unowned self] in - guard $0 != nil else { - return - } - self.profileviewmodel.internetConnection.value = nil - self.stopLoading() - self.popUpMessage(value: 15) - } - } - - /** - Set GMEUser name - */ - func setUpProfileListener() { - profileviewmodel.userDataAvailable.bind { [unowned self] in - guard $0 != nil else { - return - } - self.stopLoading() - if !($0!) { - if WalletViewController.walletConnectionTimeOutCheck == 0{ - WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 - self.popUpMessageError(value: 10, message: self.profileviewmodel.getErrorMessage()) - } - } else { - if !self.profileviewmodel.hasFilledKYC() { - self.popUpMessageError(value: 11, message: "User has not filled KYC form") - } else { - self.walletviewmodel.setGMEUsername(fullName: self.profileviewmodel.getFullName()) - self.performSegue(withIdentifier: "walletReview", sender: nil) - } - } - self.profileviewmodel.userDataAvailable.value = nil - } - } +// walletviewmodel.walletConnectionTimeOut.value = nil +// /** +// connection timeout +// */ +// walletviewmodel.walletConnectionTimeOut.bind { [unowned self] in +// guard $0 != nil else { +// return +// } +// self.stopLoading() +// if WalletViewController.walletConnectionTimeOutCheck == 0{ +// WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 +// self.popUpMessage(value: 31) +// } +// } - /** - Update the view with the transaction count - */ - func setUpTransactionListener() { - tracktransactionviewmodel.transactionListObtained.bind{ [weak self] in - guard $0 != nil else { - return - } - guard $0! else { - return - } - let requestCount = self?.tracktransactionviewmodel.getCount() - self?.buttonMoneyRequestCount.setTitle(String(requestCount!), for: .normal) - - if requestCount != nil { - if requestCount! > 0 { - self?.buttonMoneyRequestCount.isUserInteractionEnabled = true - } - } - } - } - - /** - Set maximum amount - */ - func setUpWalletDetailsListener() { - walletviewmodel.walletLimitsFetched.bind{ [unowned self] in - guard $0 != nil else { - return - } - self.stopLoading() - guard $0! else { - if WalletViewController.walletConnectionTimeOutCheck == 0{ - WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 - self.popUpMessageError(value: 10, message: self.walletviewmodel.getErrorMessage()) - } - self.walletviewmodel.walletLimitsFetched.value = nil - self.buttonSubmit.isUserInteractionEnabled = false - return - } - self.textFieldAmount.placeholder = "Maximum Amount" + " " + self.walletviewmodel.getMaximumTransferLimit() + " " + "KRW" - self.walletviewmodel.walletLimitsFetched.value = nil - } - } - - @objc func modeChanged(_ segControl: UISegmentedControl) { - - textFieldID.text = "" - textFieldMessage.text = "" - textFieldAmount.text = "" - - switch segControl.selectedSegmentIndex { - case 0: - labelID.text = "GME User ID of Receiver" - buttonSubmit.setTitle("Transfer", for: .normal) - walletviewmodel.setMode(segmentIndex: 0) - case 1: - labelID.text = "GME User ID of Sender" - buttonSubmit.setTitle("Request", for: .normal) - walletviewmodel.setMode(segmentIndex: 1) - default: - break - } - } - - - @IBAction func reviewTransferDetails(_ sender: Any) { - activeTextField?.resignFirstResponder() - - walletviewmodel.setParam(amount: textFieldAmount.text!, - gmeID: textFieldID.text!, - message: textFieldMessage.text!) - - switch walletviewmodel.validateFields() { - case .Valid: - self.startLoading() - profileviewmodel.fetchUserInfo(userId: walletviewmodel.getGMEID()) - case .InValid(let validationError): - self.popUpMessageError(value: 11, message: validationError) - } - } - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - switch segue.identifier { - case "walletReview"?: - let walletReviewViewController - = segue.destination as! WalletReviewViewController - walletReviewViewController.walletviewmodel = self.walletviewmodel - walletReviewViewController.moneyRequestAccepted = self.moneyRequestAccepted - case "walletTransfer"?: - activeTextField?.resignFirstResponder() - let walletTransactionListViewController - = segue.destination as! WalletTransactionListViewController - walletTransactionListViewController.walletStatus = "walletTransfer" - case "walletBorrow"?: - activeTextField?.resignFirstResponder() - let walletTransactionListViewController - = segue.destination as! WalletTransactionListViewController - walletTransactionListViewController.walletStatus = "walletBorrow" - case "moneyRequest"?: - activeTextField?.resignFirstResponder() - let moneyRequestViewController - = segue.destination as! MoneyRequestViewController - moneyRequestViewController.moneyRequests = tracktransactionviewmodel.getTransactions() - default: - return - } - - } -} - -extension WalletViewController: UITextFieldDelegate { - - - func textFieldDidBeginEditing(_ textField: UITextField) { - - activeTextField = textField - - checkScroll() - - if textField == textFieldAmount { - if textField.text!.contains("KRW") { - textField.text = textField.text!.replacingOccurrences(of: " KRW", with: "", options: NSString.CompareOptions.literal, range: nil) - } - } - } - - func textFieldDidEndEditing(_ textField: UITextField) { - - checkScroll() - - if textField == textFieldAmount { - if textField.text != "" && !textField.text!.contains("KRW") { - textField.text!.append(" KRW") - } - } - } - - func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { - - let inputText = (textField.text! as NSString).replacingCharacters(in: range, with: string) - if textField == textFieldAmount { - //^[0-9]+$ - if NSPredicate(format:"SELF MATCHES %@", "[0-9]*$").evaluate(with: inputText) { - return true - } - return false - } - return true - } - - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - switch textField { - case textFieldID: - textFieldAmount.becomeFirstResponder() - case textFieldMessage: - textFieldMessage.resignFirstResponder() - default: - return false - } - return true - } -} - -extension WalletViewController: ScrollableProtocol { - var offset: CGFloat { - get { - return stackView.frame.origin.y - 20 - } - } - - var viewScrolled: Bool { - get { - return isScrolled - } - } - - /** - Scroll logic - */ - func checkScroll() { - if !viewScrolled { - performScroll(direction: 0) - isScrolled = !isScrolled - } else { - performScroll(direction: 1) - isScrolled = !isScrolled - } - } - - func registerTapListener() { - let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(clearKeyboard)) - view.addGestureRecognizer(tap) - } - - /** - Dismiss keypad - */ - @objc func clearKeyboard() { - activeTextField?.resignFirstResponder() - if viewScrolled { - performScroll(direction: 1) - isScrolled = !isScrolled - } - } - - /** - Active keypad if direction is equal to 0 - - parameter direction: display keypad if direction is equal to 0 - */ - func performScroll(direction: Int) { - if direction == 0 { - UIView.animate(withDuration: 0.3, animations: { - self.view.frame = self.view.frame.offsetBy(dx: 0, dy: self.offset * -1) - }) - } else if direction == 1 { - UIView.animate(withDuration: 0.3, animations: { - self.view.frame = self.view.frame.offsetBy(dx: 0, dy: self.offset) - }) - } +// setUpNetworkListener() +// setUpNetworkListenerForProfile() +// setUpProfileListener() +// setUpTransactionListener() +// setUpWalletDetailsListener() +// +// /*so that the value is reset and no error message is seen when going back and froth in error case*/ +// self.walletviewmodel.walletActionPerformed.value = nil +// +// self.buttonMoneyRequestCount.setTitle("", for: .normal) +// self.buttonMoneyRequestCount.isUserInteractionEnabled = false +// +// tracktransactionviewmodel.fetchTransactionListForTrackAndWallet(recipientId: "", recipientName: "", transactionType: "moneyRequest", startDate: nil, endDate: nil, txPage: nil, txSize: nil) +// } +// +// override func viewDidLoad() { +// super.viewDidLoad() +// +// setUpNavBar(id: 201, title: "Wallet to Wallet Transfer") +// +// NotificationCenter.default.addObserver(self, selector: #selector(appMovedToForeground), name: Notification.Name.UIApplicationWillEnterForeground, object: nil) +// +// registerTapListener() +// +// +// self.startLoading() +// walletviewmodel.getTransactionInfo() +// +// scrollView.delegate = self +// scrollView.addSubview(contentView) +// scrollView.contentSize = CGSize(width: 2000, height:2000) +// +// if transaction != nil { +// moneyRequestAccepted = true +// segmentedControl.isUserInteractionEnabled = false +// walletviewmodel.setMode(segmentIndex: 2) +// walletviewmodel.setMoneyRequestTransactionID(id: transaction!.transactionId) +// +// textFieldID.text = transaction!.receiverId +// textFieldAmount.text = transaction!.payoutAmountOriginal +// +// +// textFieldID.isUserInteractionEnabled = false +// } +// textFieldID.delegate = self +// textFieldAmount.delegate = self +// textFieldMessage.delegate = self +// +// +// segmentedControl.selectedSegmentIndex = 0 +// segmentedControl.addTarget(self, action: #selector(modeChanged(_:)), for: .valueChanged) +// +// walletviewmodel.setMode(segmentIndex: 0) +// } +// +// /** +// Disable user interaction while fetching data from api +// */ +// func startLoading(){ +// self.showActivityIndicator(activityIndicator: self.activityIndicator) +// self.disableUserInteractions() +// } +// +// /** +// Enable user interaction while fetching data from api +// */ +// func stopLoading(){ +// self.dismissActivityIndicator(activityIndicator: self.activityIndicator) +// self.enableUserInteractions() +// } +// +// /** +// Check internet connection +// */ +// func setUpNetworkListener() { +// walletviewmodel.internetConnection.bind { [unowned self] in +// guard $0 != nil else { +// return +// } +// self.walletviewmodel.internetConnection.value = nil +// self.stopLoading() +// self.popUpMessage(value: 15) +// } +// } +// +// func setUpNetworkListenerForProfile() { +// profileviewmodel.internetConnection.bind { [unowned self] in +// guard $0 != nil else { +// return +// } +// self.profileviewmodel.internetConnection.value = nil +// self.stopLoading() +// self.popUpMessage(value: 15) +// } +// } +// +// /** +// Set GMEUser name +// */ +// func setUpProfileListener() { +// profileviewmodel.userDataAvailable.bind { [unowned self] in +// guard $0 != nil else { +// return +// } +// self.stopLoading() +// if !($0!) { +// if WalletViewController.walletConnectionTimeOutCheck == 0{ +// WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 +// self.popUpMessageError(value: 10, message: self.profileviewmodel.getErrorMessage()) +// } +// } else { +// if !self.profileviewmodel.hasFilledKYC() { +// self.popUpMessageError(value: 11, message: "User has not filled KYC form") +// } else { +// self.walletviewmodel.setGMEUsername(fullName: self.profileviewmodel.getFullName()) +// self.performSegue(withIdentifier: "walletReview", sender: nil) +// } +// } +// self.profileviewmodel.userDataAvailable.value = nil +// } +// } +// +// /** +// Update the view with the transaction count +// */ +// func setUpTransactionListener() { +// tracktransactionviewmodel.transactionListObtained.bind{ [weak self] in +// guard $0 != nil else { +// return +// } +// guard $0! else { +// return +// } +// let requestCount = self?.tracktransactionviewmodel.getCount() +// self?.buttonMoneyRequestCount.setTitle(String(requestCount!), for: .normal) +// +// if requestCount != nil { +// if requestCount! > 0 { +// self?.buttonMoneyRequestCount.isUserInteractionEnabled = true +// } +// } +// } +// } +// +// /** +// Set maximum amount +// */ +// func setUpWalletDetailsListener() { +// walletviewmodel.walletLimitsFetched.bind{ [unowned self] in +// guard $0 != nil else { +// return +// } +// self.stopLoading() +// guard $0! else { +// if WalletViewController.walletConnectionTimeOutCheck == 0{ +// WalletViewController.walletConnectionTimeOutCheck = WalletViewController.walletConnectionTimeOutCheck+1 +// self.popUpMessageError(value: 10, message: self.walletviewmodel.getErrorMessage()) +// } +// self.walletviewmodel.walletLimitsFetched.value = nil +// self.buttonSubmit.isUserInteractionEnabled = false +// return +// } +// self.textFieldAmount.placeholder = "Maximum Amount" + " " + self.walletviewmodel.getMaximumTransferLimit() + " " + "KRW" +// self.walletviewmodel.walletLimitsFetched.value = nil +// } +// } +// +// @objc func modeChanged(_ segControl: UISegmentedControl) { +// +// textFieldID.text = "" +// textFieldMessage.text = "" +// textFieldAmount.text = "" +// +// switch segControl.selectedSegmentIndex { +// case 0: +// labelID.text = "GME User ID of Receiver" +// buttonSubmit.setTitle("Transfer", for: .normal) +// walletviewmodel.setMode(segmentIndex: 0) +// case 1: +// labelID.text = "GME User ID of Sender" +// buttonSubmit.setTitle("Request", for: .normal) +// walletviewmodel.setMode(segmentIndex: 1) +// default: +// break +// } +// } +// +// +// @IBAction func reviewTransferDetails(_ sender: Any) { +// activeTextField?.resignFirstResponder() +// +// walletviewmodel.setParam(amount: textFieldAmount.text!, +// gmeID: textFieldID.text!, +// message: textFieldMessage.text!) +// +// switch walletviewmodel.validateFields() { +// case .Valid: +// self.startLoading() +// profileviewmodel.fetchUserInfo(userId: walletviewmodel.getGMEID()) +// case .InValid(let validationError): +// self.popUpMessageError(value: 11, message: validationError) +// } +// } +// +// override func prepare(for segue: UIStoryboardSegue, sender: Any?) { +// switch segue.identifier { +// case "walletReview"?: +// let walletReviewViewController +// = segue.destination as! WalletReviewViewController +// walletReviewViewController.walletviewmodel = self.walletviewmodel +// walletReviewViewController.moneyRequestAccepted = self.moneyRequestAccepted +// case "walletTransfer"?: +// activeTextField?.resignFirstResponder() +// let walletTransactionListViewController +// = segue.destination as! WalletTransactionListViewController +// walletTransactionListViewController.walletStatus = "walletTransfer" +// case "walletBorrow"?: +// activeTextField?.resignFirstResponder() +// let walletTransactionListViewController +// = segue.destination as! WalletTransactionListViewController +// walletTransactionListViewController.walletStatus = "walletBorrow" +// case "moneyRequest"?: +// activeTextField?.resignFirstResponder() +// let moneyRequestViewController +// = segue.destination as! MoneyRequestViewController +// moneyRequestViewController.moneyRequests = tracktransactionviewmodel.getTransactions() +// default: +// return +// } +// +// } +//} +// +//extension WalletViewController: UITextFieldDelegate { +// +// +// func textFieldDidBeginEditing(_ textField: UITextField) { +// +// activeTextField = textField +// +// checkScroll() +// +// if textField == textFieldAmount { +// if textField.text!.contains("KRW") { +// textField.text = textField.text!.replacingOccurrences(of: " KRW", with: "", options: NSString.CompareOptions.literal, range: nil) +// } +// } +// } +// +// func textFieldDidEndEditing(_ textField: UITextField) { +// +// checkScroll() +// +// if textField == textFieldAmount { +// if textField.text != "" && !textField.text!.contains("KRW") { +// textField.text!.append(" KRW") +// } +// } +// } +// +// func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { +// +// let inputText = (textField.text! as NSString).replacingCharacters(in: range, with: string) +// if textField == textFieldAmount { +// //^[0-9]+$ +// if NSPredicate(format:"SELF MATCHES %@", "[0-9]*$").evaluate(with: inputText) { +// return true +// } +// return false +// } +// return true +// } +// +// func textFieldShouldReturn(_ textField: UITextField) -> Bool { +// switch textField { +// case textFieldID: +// textFieldAmount.becomeFirstResponder() +// case textFieldMessage: +// textFieldMessage.resignFirstResponder() +// default: +// return false +// } +// return true +// } +//} +// +//extension WalletViewController: ScrollableProtocol { +// var offset: CGFloat { +// get { +// return stackView.frame.origin.y - 20 +// } +// } +// +// var viewScrolled: Bool { +// get { +// return isScrolled +// } +// } +// +// /** +// Scroll logic +// */ +// func checkScroll() { +// if !viewScrolled { +// performScroll(direction: 0) +// isScrolled = !isScrolled +// } else { +// performScroll(direction: 1) +// isScrolled = !isScrolled +// } +// } +// +// func registerTapListener() { +// let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(clearKeyboard)) +// view.addGestureRecognizer(tap) +// } +// +// /** +// Dismiss keypad +// */ +// @objc func clearKeyboard() { +// activeTextField?.resignFirstResponder() +// if viewScrolled { +// performScroll(direction: 1) +// isScrolled = !isScrolled +// } +// } +// +// /** +// Active keypad if direction is equal to 0 +// - parameter direction: display keypad if direction is equal to 0 +// */ +// func performScroll(direction: Int) { +// if direction == 0 { +// UIView.animate(withDuration: 0.3, animations: { +// self.view.frame = self.view.frame.offsetBy(dx: 0, dy: self.offset * -1) +// }) +// } else if direction == 1 { +// UIView.animate(withDuration: 0.3, animations: { +// self.view.frame = self.view.frame.offsetBy(dx: 0, dy: self.offset) +// }) +// } } } diff --git a/GMERemittance/_Home/_HomeViewController.swift b/GMERemittance/_Home/_HomeViewController.swift index 17598207..2864aeba 100644 --- a/GMERemittance/_Home/_HomeViewController.swift +++ b/GMERemittance/_Home/_HomeViewController.swift @@ -13,1486 +13,1491 @@ import Social import FacebookShare import FBSDKShareKit -class _HomeViewController: UIViewController, TableViewCellDelegate, FBSDKSharingDelegate { +class _HomeViewController: UIViewController{ - - enum TableViewCells: Int { - case balance = 0 - case collection = 1 - case status = 2 - case social = 3 - case loadMore = 4 - } - - - private var isTopMenuVisible: Bool = false - @IBOutlet weak var topMenuView: UIView! - @IBOutlet weak var tableViewTopConstraint: NSLayoutConstraint! - - @IBOutlet weak var buttonMenuItem0: UIButton! - @IBOutlet weak var buttonMenuItem1: UIButton! - @IBOutlet weak var buttonMenuItem2: UIButton! - - @IBOutlet weak var labelMenuItem0: UILabel! - @IBOutlet weak var labelMenuItem1: UILabel! - @IBOutlet weak var labelMenuItem2: UILabel! - - - private let homeviewmodel = HomeViewModel() - private let socialfeedviewmodel = SocialFeedViewModel() - private let profileViewModel = ProfileViewModel() - private let notificationviewmodel = NotificationViewModel() - - var page: Int = 0 - var size: Int = 20 - - var sections: [TableViewCells] = [.balance, .collection, .status, .social, .loadMore] - - private var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView() - private let imagePicker = UIImagePickerController() - - var showAllCollectionViewCells: Bool? - private let collectionViewItemsPerRow: CGFloat = 2 - private let insetForCollectionView: CGFloat = 5.0 - var numberCellsInCollectionView: Int? - private var longPressGesture: UILongPressGestureRecognizer! - - private var collectionViewMenuIndexArray: [Int]! - - - private var collectionViewMenuIconArray: [Int: String] = [0: "send-money", 1: "mobile-recharge", 2: "rate-today", 3: "track-transfer", 4: "transaction-statement", 5: "wallet-transfer", 6: "show-more"] - - private var collectionViewMenuNameArray: [Int: String] = [0: "Send Money", 1: "Mobile Recharge", 2: "Today's Rate", 3: "Track Your Transfer", 4: "Transaction Statement", 5: "Wallet to Wallet Transfer", 6: "More"] - - /* MORE Button is placed at the end of the array (position 7, index 6) and it is switched with the element at position 4 (index 3) when showing some/ all of the menu options */ - - @IBOutlet weak var imageViewUserImage: UIImageView! - - - @IBOutlet weak var tableView: UITableView! - - private var cell: TableViewCell! - - /*------ 0 => Text Status - ------ 1 => Image Upload - ------ 2 => Edit Status - */ - private var statusUploadMode:Int? //IMAGE OR TEXT STATUS UPLOAD - - private var editablePostIndex: Int! - private var selectedCell:Int? //SELECTED CELL - private var selectedImage:UIImage? //EDIT IMAGE FOR REMOVE OR DELETE - private var postStatus:String? // - private var heartStatus:Bool? - private var socialStatus:Bool? - private var likeCount:Int? - - - private var tappedIndex: Int? - - private var allowFetchRequest: Bool = true - private var newFeedsWillBeAppended: Bool = false - - private var refreshControl: UIRefreshControl! - - private var arrayIndexPath = [IndexPath] () - - private var showNotificationParameter: Bool = false - - private var editedIndex: Int! - - //--SETUP NAVBAR WHEN VIEW APPEARS PLUS RELOAD THE SOCIAL FEED WITH LOCAL DATA IF EXISTS - override func viewWillAppear(_ animated: Bool) { - - editedIndex = nil - - -// setUpAnotherLoginListener(genericviewmodel: socialfeedviewmodel) - setUpAnotherLoginListener(genericviewmodel: profileViewModel) -// setUpNetworkListener() - super.viewWillAppear(true) - - - self.tabBarController?.tabBar.isHidden = false - setNavBar() - setActionBarIcons(showNotificationParameter: true) - - bindUserStatusToUI() - - profileViewModel.fetchUserInfo(userId: nil) - - - tableView.reloadSections(NSIndexSet(index: 3) as IndexSet, with: .none) - - - if tappedIndex != nil { - tableView.scrollToRow(at: IndexPath(row: tappedIndex!, section: 3), at: UITableViewScrollPosition.bottom, animated: true) - } - notificationBind() - } - - override func viewWillDisappear(_ animated: Bool) { - super.viewWillAppear(animated) - self.navigationController?.navigationBar.topItem?.title = "" - } - - - - func setUpRefreshControl() { - refreshControl = UIRefreshControl() - - refreshControl.backgroundColor = UIColor(white: 0.98, alpha: 1.0) - refreshControl.tintColor = UIColor.red - refreshControl.addTarget(self, action: #selector(refresh(_:)), for: .valueChanged) - tableView.addSubview(refreshControl) - } - - @objc func refresh(_ sender: AnyObject) { - newFeedsWillBeAppended = false - } - - - //--ALL NAV BAR FUNCTIONS HERE - func setNavBar() { - let selector = #selector(self.showSideMenu) - self.setupPicturedNavBar(sideMenuAction: selector) - } - - @objc func showSideMenu() { -// performSegue(withIdentifier: "showSideMenu", sender: nil) - sideMenuController?.showLeftViewAnimated() - } - +} - func isVerifiedUser() -> Bool { - let val = (UserDefaults.standard.object(forKey: UserKeys.verified) as? Bool ) ?? false - print("value is") - print(val) - return val - } - - /** - Update User data in view - */ - - func bindUserStatusToUI() { - profileViewModel.userDataAvailable.value = nil - - profileViewModel.userDataAvailable.bind{ [weak self] in - guard $0 != nil else { - return - } - if $0! { -// -// let verified = UserDefaults.standard.object(forKey: UserKeys.verified) as! Bool -// -// if !verified { -// let isVerified = self?.profileViewModel.isVerified() -// -// if isVerified! { -// UserDefaults.standard.set(isVerified, forKey: UserKeys.verified) +//extension _HomeViewController: TableViewCellDelegate, FBSDKSharingDelegate { +// +//} +// enum TableViewCells: Int { +// case balance = 0 +// case collection = 1 +// case status = 2 +// case social = 3 +// case loadMore = 4 +// } +// +// +// private var isTopMenuVisible: Bool = false +// @IBOutlet weak var topMenuView: UIView! +// @IBOutlet weak var tableViewTopConstraint: NSLayoutConstraint! +// +// @IBOutlet weak var buttonMenuItem0: UIButton! +// @IBOutlet weak var buttonMenuItem1: UIButton! +// @IBOutlet weak var buttonMenuItem2: UIButton! +// +// @IBOutlet weak var labelMenuItem0: UILabel! +// @IBOutlet weak var labelMenuItem1: UILabel! +// @IBOutlet weak var labelMenuItem2: UILabel! +// +// +// private let homeviewmodel = HomeViewModel() +// private let socialfeedviewmodel = SocialFeedViewModel() +//// private let profileViewModel = ProfileViewModel() +// private let notificationviewmodel = NotificationViewModel() +// +// var page: Int = 0 +// var size: Int = 20 +// +// var sections: [TableViewCells] = [.balance, .collection, .status, .social, .loadMore] +// +// private var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView() +// private let imagePicker = UIImagePickerController() +// +// var showAllCollectionViewCells: Bool? +// private let collectionViewItemsPerRow: CGFloat = 2 +// private let insetForCollectionView: CGFloat = 5.0 +// var numberCellsInCollectionView: Int? +// private var longPressGesture: UILongPressGestureRecognizer! +// +// private var collectionViewMenuIndexArray: [Int]! +// +// +// private var collectionViewMenuIconArray: [Int: String] = [0: "send-money", 1: "mobile-recharge", 2: "rate-today", 3: "track-transfer", 4: "transaction-statement", 5: "wallet-transfer", 6: "show-more"] +// +// private var collectionViewMenuNameArray: [Int: String] = [0: "Send Money", 1: "Mobile Recharge", 2: "Today's Rate", 3: "Track Your Transfer", 4: "Transaction Statement", 5: "Wallet to Wallet Transfer", 6: "More"] +// +// /* MORE Button is placed at the end of the array (position 7, index 6) and it is switched with the element at position 4 (index 3) when showing some/ all of the menu options */ +// +// @IBOutlet weak var imageViewUserImage: UIImageView! +// +// +// @IBOutlet weak var tableView: UITableView! +// +// private var cell: TableViewCell! +// +// /*------ 0 => Text Status +// ------ 1 => Image Upload +// ------ 2 => Edit Status +// */ +// private var statusUploadMode:Int? //IMAGE OR TEXT STATUS UPLOAD +// +// private var editablePostIndex: Int! +// private var selectedCell:Int? //SELECTED CELL +// private var selectedImage:UIImage? //EDIT IMAGE FOR REMOVE OR DELETE +// private var postStatus:String? // +// private var heartStatus:Bool? +// private var socialStatus:Bool? +// private var likeCount:Int? +// +// +// private var tappedIndex: Int? +// +// private var allowFetchRequest: Bool = true +// private var newFeedsWillBeAppended: Bool = false +// +// private var refreshControl: UIRefreshControl! +// +// private var arrayIndexPath = [IndexPath] () +// +// private var showNotificationParameter: Bool = false +// +// private var editedIndex: Int! +// +// //--SETUP NAVBAR WHEN VIEW APPEARS PLUS RELOAD THE SOCIAL FEED WITH LOCAL DATA IF EXISTS +// override func viewWillAppear(_ animated: Bool) { +// +// editedIndex = nil +// +// +//// setUpAnotherLoginListener(genericviewmodel: socialfeedviewmodel) +// setUpAnotherLoginListener(genericviewmodel: profileViewModel) +//// setUpNetworkListener() +// super.viewWillAppear(true) +// +// +// self.tabBarController?.tabBar.isHidden = false +// setNavBar() +// setActionBarIcons(showNotificationParameter: true) +// +// bindUserStatusToUI() +// +// profileViewModel.fetchUserInfo(userId: nil) +// +// +// tableView.reloadSections(NSIndexSet(index: 3) as IndexSet, with: .none) +// +// +// if tappedIndex != nil { +// tableView.scrollToRow(at: IndexPath(row: tappedIndex!, section: 3), at: UITableViewScrollPosition.bottom, animated: true) +// } +// notificationBind() +// } +// +// override func viewWillDisappear(_ animated: Bool) { +// super.viewWillAppear(animated) +// self.navigationController?.navigationBar.topItem?.title = "" +// } +// +// +// +// func setUpRefreshControl() { +// refreshControl = UIRefreshControl() +// +// refreshControl.backgroundColor = UIColor(white: 0.98, alpha: 1.0) +// refreshControl.tintColor = UIColor.red +// refreshControl.addTarget(self, action: #selector(refresh(_:)), for: .valueChanged) +// tableView.addSubview(refreshControl) +// } +// +// @objc func refresh(_ sender: AnyObject) { +// newFeedsWillBeAppended = false +// } +// +// +// //--ALL NAV BAR FUNCTIONS HERE +// func setNavBar() { +// let selector = #selector(self.showSideMenu) +// self.setupPicturedNavBar(sideMenuAction: selector) +// } +// +// @objc func showSideMenu() { +//// performSegue(withIdentifier: "showSideMenu", sender: nil) +// sideMenuController?.showLeftViewAnimated() +// } +// +// +// func isVerifiedUser() -> Bool { +// let val = (UserDefaults.standard.object(forKey: UserKeys.verified) as? Bool ) ?? false +// print("value is") +// print(val) +// return val +// } +// +// +// /** +// Update User data in view +// */ +// +// func bindUserStatusToUI() { +// profileViewModel.userDataAvailable.value = nil +// +// profileViewModel.userDataAvailable.bind{ [weak self] in +// guard $0 != nil else { +// return +// } +// if $0! { +//// +//// let verified = UserDefaults.standard.object(forKey: UserKeys.verified) as! Bool +//// +//// if !verified { +//// let isVerified = self?.profileViewModel.isVerified() +//// +//// if isVerified! { +//// UserDefaults.standard.set(isVerified, forKey: UserKeys.verified) +//// } +//// } +//// +//// UserDefaults.standard.set(self?.profileViewModel.getAvailableBalance(), forKey: "com.gmeremit.balance") +//// UserDefaults.standard.set(self?.profileViewModel.getRewardPoint(), forKey: "com.gmeremit.rewardPoint") +//// UserDefaults.standard.set(self?.profileViewModel.getWalletNumber(), forKey: "com.gmeremit.walletNumber") +//// +// +// /// TABLE RELOADED +// self?.tableView.reloadData() +// } +// +// self?.profileViewModel.userDataAvailable.value = nil +// +// } +// } +// +// func notificationBind(){ +// notificationviewmodel.fetchNotification(page: self.page, size: self.size) +// +// notificationviewmodel.notificationFetch.bind{ [weak self] in +// guard $0 != nil else { +// return +// } +// +// guard $0! else { +// //self?.popUpMessageError(value: 10, message: (self?.notificationviewmodel.getErrorMessage())!) +// return +// } +// //Update the view +// +// self?.enableUserInteractions() +// +// if self?.activityIndicator != nil { +// self?.dismissActivityIndicator(activityIndicator: (self?.activityIndicator)!) +// } +// +// if (self?.notificationviewmodel.showNotification())!{ +// self?.showNotificationParameter = true +// self?.setActionBarIcons(showNotificationParameter: true) +// } else { +// self?.showNotificationParameter = false +// self?.setActionBarIcons(showNotificationParameter: false) +// } +// } +// } +// +// +// func registerCMUser() { +// +// let appDelegate = UIApplication.shared.delegate as! AppDelegate +// appDelegate.notificationSet.bind { [unowned self] in +// guard $0 != nil else { +// return +// } +// self.homeviewmodel.cmRegistrationId(cmRegistrationId: appDelegate.cmRegistrationId!) +// } +// } +// +// +// /** +// @developer : Suraj Shrestha +// @date : 2018/02/12 +// @des : Add action bar icons i.e notification and support +// code refractored by ccr, almost maney many good things added. all bad things are left by previous dev :D +// */ +// func setActionBarIcons(showNotificationParameter: Bool){ +// let supportImage = UIImage(named: "ic_support")?.withRenderingMode(.alwaysOriginal) +// let supportButton = UIBarButtonItem(image:supportImage, style: .plain, target: self, action: #selector(showSupport)) +// let notificationImage: UIImage! +// if showNotificationParameter { +// notificationImage = UIImage(named: "ic_notificationDot")?.withRenderingMode(.alwaysOriginal) +// } else { +// notificationImage = UIImage(named: "ic_notification")?.withRenderingMode(.alwaysOriginal) +// } +// let notificationButton = UIBarButtonItem(image: notificationImage, style: .plain, target: self, action: #selector(showNotification)) +// self.navigationItem.rightBarButtonItems=[notificationButton,supportButton] +// } +// +// /** +// @developer : Suraj Shrestha +// @date : 2018/02/12 +// @des : Show support actions +// */ +// @objc func showSupport() { +// let alert = UIAlertController(title:nil, message:"We are there to help you \n (Available time 10:00AM - 6:00PM)", preferredStyle: .actionSheet) +// alert.view.subviews.last?.subviews.last?.backgroundColor = UIColor.darkGray +// +// let liveChat = UIAlertAction(title: "Live Chat", style: .default) { +// UIAlertAction in +// } +// let contactNumber = UIAlertAction(title: "1588 6864", style: .default) { +// UIAlertAction in +// self.startCall(contactNumber: "1588 6864") +// } +// let supportEmail = UIAlertAction(title: "support@gmeremit.com", style: .default) { +// UIAlertAction in +// +// let storyboard = UIStoryboard.init(name: "MessageCompose", bundle: Bundle.main) +// if let messageViewController = storyboard.instantiateViewController(withIdentifier: "message") as? MessageComposeViewController { +// self.navigationController!.pushViewController(messageViewController, animated: true) +// } +// } +// +// liveChat.setValue(UIImage(named:"ic_live_chat")?.withRenderingMode(.alwaysOriginal),forKey:"image") +// contactNumber.setValue(UIImage(named:"ic_call")?.withRenderingMode(.alwaysOriginal),forKey:"image") +// supportEmail.setValue(UIImage(named:"ic_email")?.withRenderingMode(.alwaysOriginal),forKey:"image") +// +// // TODO: have to enable when zendesk is provided +// // alert.addAction(liveChat) +// alert.addAction(contactNumber) +// alert.addAction(supportEmail) +// alert.view.tintColor = UIColor.red +// +// alert.view.subviews.last?.subviews.last?.layer.cornerRadius = 10 +// +// alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil)) +// present(alert, animated: true, completion: nil) +// } +// +// +// func startCall(contactNumber: String){ +// if let url = URL(string: "tel://\(contactNumber.removeWhitespacesInBetween())"), UIApplication.shared.canOpenURL(url) { +// if #available(iOS 10, *) { +// UIApplication.shared.open(url) +// } else { +// UIApplication.shared.openURL(url) +// } +// } +// } +// +// @objc func showNotification(){ +// performSegue(withIdentifier: "notification", sender: nil) +// } +// +// override func viewDidLoad() { +// super.viewDidLoad() +// setupDelegates() +// hideKeyboardWhenTappedAround() +// setUpRefreshControl() +// setNavBar() +//// setupNavigationNotifications() +// +// +// if !isVerifiedUser() { +//// self.alert(message: "Your document is in verification process. Thereafter you can enjoy GME online service. Thank you for registering with us!.") +// let message = "Your document is in verification process. Thereafter you can enjoy GME online service. Thank you for registering with us!." +// self.alertWithOkCancel(message: message, title: "Alert!", okAction: { +// // go to kyc +// if let navigation = self.navigationController { +// let wireframe = KycWireframe() +// wireframe.pushMainView(in: navigation) +// } +// }, cancelAction: nil) +// } +// +// if numberCellsInCollectionView == nil { +// numberCellsInCollectionView = 4 +// } +// +// if showAllCollectionViewCells == nil { +// showAllCollectionViewCells = false +// } +// +// /* Checks if the user's custom menu is available or not */ +// if let menuArray = UserDefaults.standard.array(forKey: "com.gmeremit.collectionViewMenuIndexArray") as? [Int] { +// collectionViewMenuIndexArray = menuArray +// +// /* While loading the app (but not from myStoryViewController), MORE button should be shown */ +// +// if numberCellsInCollectionView == 4 { +// if collectionViewMenuIndexArray[3] != 6 { +// collectionViewMenuIndexArray.swapAt(3, 6) +// } +// } else if numberCellsInCollectionView == 6 { +// if collectionViewMenuIndexArray[3] == 6 { +// collectionViewMenuIndexArray.swapAt(3, 6) +// } +// } +// +// } else { +// collectionViewMenuIndexArray = [0, 1, 2, 6, 4, 5, 3] +// UserDefaults.standard.set(collectionViewMenuIndexArray, forKey: "com.gmeremit.collectionViewMenuIndexArray") +// } +// +// longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(self.handleLongGesture(gesture:))) +// +// imagePicker.delegate = self +// +// tableView.tableFooterView = UIView() +// +// registerCMUser() +// +// if UserDefaults.standard.bool(forKey: "com.gmeremit.showImageAlert") { +// self.addUserProfileImage() +// } +// +// } +// +// private func getAboutMeNotificationName() -> Notification.Name { +// return Notification.Name.init(SideMenuNavigationNotifications.aboutGme) +// } +// +// private func getSupportNotificationName() -> Notification.Name { +// return Notification.Name.init(SideMenuNavigationNotifications.support) +// } +// +// private func getSettingNotificationName() -> Notification.Name { +// return Notification.Name.init(SideMenuNavigationNotifications.setting) +// } +// +// +// @objc private func showSideMenuAboutGme() { +// let vc = UIStoryboard.init(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "AboutGMEViewController") as! AboutGMEViewController +// self.navigationController?.pushViewController(vc, animated: true) +// } +// +// @objc private func showSideMenuSetting() { +// let vc = UIStoryboard.init(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "SettingViewController") as! SettingViewController +// self.navigationController?.pushViewController(vc, animated: true) +// } +// +// @objc private func showSideMenuSupport() { +// let vc = UIStoryboard.init(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "SupportViewController") as! SupportViewController +// self.navigationController?.pushViewController(vc, animated: true) +// } +// +// private func setupDelegates() { +// tableView.delegate = self +// tableView.dataSource = self +// } +// +// +// override func prepare(for segue: UIStoryboardSegue, sender: Any?) { +// switch segue.identifier { +// case "statusUpdate"?: +// let statusUploadViewController = segue.destination as! StatusUploadViewController +// statusUploadViewController.statusUploadMode = statusUploadMode +// statusUploadViewController.editablePostIndex = editablePostIndex +// statusUploadViewController.socialfeedviewmodel = socialfeedviewmodel +// statusUploadViewController.showNotificationParameter = showNotificationParameter +// case "showLikedBy"?: +// let likedByViewController = segue.destination as! LikesViewController +// likedByViewController.socialfeedviewmodel = socialfeedviewmodel +// likedByViewController.tappedIndex = tappedIndex +// case "showCommentsBy"?: +// let commentsViewController = segue.destination as! CommentsViewController +// commentsViewController.socialfeedviewmodel = socialfeedviewmodel +// commentsViewController.tappedIndex = tappedIndex +// case "myStory"?: +// let myStoryViewController = segue.destination as! MyStoryViewController +// myStoryViewController.socialfeedviewmodel = socialfeedviewmodel +// myStoryViewController.showNotificationParameter = showNotificationParameter +// +// case "notification"?: +// let notificationViewController = segue.destination as! NotificationViewController +// notificationViewController.socialfeedviewmodel = socialfeedviewmodel +// default: +// return +// } +// } +//} +// +// +///*---------------ALL ACTIONS RELATED TO SOCIAL WALL HERE------------ +// +// */ +// +//extension _HomeViewController { +// +// //UPLOAD TEXT AS STATUS +// @objc func uploadTextStatus(_ sender: TableViewCell) { +// +// statusUploadMode = 0 +// self.performSegue(withIdentifier: "statusUpdate", sender: nil) +// } +// +// //UPLOAD IMAGE AS STATUS +// @objc func uploadImageStatus(_ sender: TableViewCell) { +// statusUploadMode = 1 +// self.performSegue(withIdentifier: "statusUpdate", sender: nil) +// } +// +// //DATA BINDING +// func bindFeedsDataToUI() { +// +// socialfeedviewmodel.socialFeedsRxValue.bind { [weak self] in +// guard $0 != nil, self?.socialfeedviewmodel != nil else { +// return +// } +// guard $0! != 0 else { +// //self.popUpMessageError(value: 10, message: self.socialfeedviewmodel.getErrorMessage()) +// self?.socialfeedviewmodel.socialFeedsRxValue.value = nil +// +// return +// +// } +// switch $0! { +// +// case socialWallCode.fetchPostsPublic.rawValue: +// let count = self?.socialfeedviewmodel.getPublicSocialFeedsCount() +// if count! > 0 { +// if (self?.newFeedsWillBeAppended)! { +// +// self?.arrayIndexPath.removeAll() +// +// self?.tableView.beginUpdates() +// let currentCount = self?.socialfeedviewmodel.getCurrentlyFetchedFeedCount() +// +// for i in 0...(self?.socialfeedviewmodel.getCurrentlyFetchedFeedCount())!-1 { +// self?.arrayIndexPath.append(IndexPath.init(row: count! - currentCount! + i, section: 3)) +// } +// +// self?.tableView.insertRows(at: (self?.arrayIndexPath)!, with: .automatic) +// +// self?.tableView.endUpdates() +// +// +// self?.tableView.cellForRow(at: IndexPath(row: 0, section: 4))?.isHidden = false +// +// } else { +// +// if (self?.refreshControl.isRefreshing)! { +// self?.refreshControl.endRefreshing() +// } +// self?.tableView.reloadSections(NSIndexSet(index: 3) as IndexSet, with: .none) +// self?.tableView.reloadSections(NSIndexSet(index: 4) as IndexSet, with: .none) // } // } // -// UserDefaults.standard.set(self?.profileViewModel.getAvailableBalance(), forKey: "com.gmeremit.balance") -// UserDefaults.standard.set(self?.profileViewModel.getRewardPoint(), forKey: "com.gmeremit.rewardPoint") -// UserDefaults.standard.set(self?.profileViewModel.getWalletNumber(), forKey: "com.gmeremit.walletNumber") -// - - /// TABLE RELOADED - self?.tableView.reloadData() - } - - self?.profileViewModel.userDataAvailable.value = nil - - } - } - - func notificationBind(){ - notificationviewmodel.fetchNotification(page: self.page, size: self.size) - - notificationviewmodel.notificationFetch.bind{ [weak self] in - guard $0 != nil else { - return - } - - guard $0! else { - //self?.popUpMessageError(value: 10, message: (self?.notificationviewmodel.getErrorMessage())!) - return - } - //Update the view - - self?.enableUserInteractions() - - if self?.activityIndicator != nil { - self?.dismissActivityIndicator(activityIndicator: (self?.activityIndicator)!) - } - - if (self?.notificationviewmodel.showNotification())!{ - self?.showNotificationParameter = true - self?.setActionBarIcons(showNotificationParameter: true) - } else { - self?.showNotificationParameter = false - self?.setActionBarIcons(showNotificationParameter: false) - } - } - } - - - func registerCMUser() { - - let appDelegate = UIApplication.shared.delegate as! AppDelegate - appDelegate.notificationSet.bind { [unowned self] in - guard $0 != nil else { - return - } - self.homeviewmodel.cmRegistrationId(cmRegistrationId: appDelegate.cmRegistrationId!) - } - } - - - /** - @developer : Suraj Shrestha - @date : 2018/02/12 - @des : Add action bar icons i.e notification and support - code refractored by ccr, almost maney many good things added. all bad things are left by previous dev :D - */ - func setActionBarIcons(showNotificationParameter: Bool){ - let supportImage = UIImage(named: "ic_support")?.withRenderingMode(.alwaysOriginal) - let supportButton = UIBarButtonItem(image:supportImage, style: .plain, target: self, action: #selector(showSupport)) - let notificationImage: UIImage! - if showNotificationParameter { - notificationImage = UIImage(named: "ic_notificationDot")?.withRenderingMode(.alwaysOriginal) - } else { - notificationImage = UIImage(named: "ic_notification")?.withRenderingMode(.alwaysOriginal) - } - let notificationButton = UIBarButtonItem(image: notificationImage, style: .plain, target: self, action: #selector(showNotification)) - self.navigationItem.rightBarButtonItems=[notificationButton,supportButton] - } - - /** - @developer : Suraj Shrestha - @date : 2018/02/12 - @des : Show support actions - */ - @objc func showSupport() { - let alert = UIAlertController(title:nil, message:"We are there to help you \n (Available time 10:00AM - 6:00PM)", preferredStyle: .actionSheet) - alert.view.subviews.last?.subviews.last?.backgroundColor = UIColor.darkGray - - let liveChat = UIAlertAction(title: "Live Chat", style: .default) { - UIAlertAction in - } - let contactNumber = UIAlertAction(title: "1588 6864", style: .default) { - UIAlertAction in - self.startCall(contactNumber: "1588 6864") - } - let supportEmail = UIAlertAction(title: "support@gmeremit.com", style: .default) { - UIAlertAction in - - let storyboard = UIStoryboard.init(name: "MessageCompose", bundle: Bundle.main) - if let messageViewController = storyboard.instantiateViewController(withIdentifier: "message") as? MessageComposeViewController { - self.navigationController!.pushViewController(messageViewController, animated: true) - } - } - - liveChat.setValue(UIImage(named:"ic_live_chat")?.withRenderingMode(.alwaysOriginal),forKey:"image") - contactNumber.setValue(UIImage(named:"ic_call")?.withRenderingMode(.alwaysOriginal),forKey:"image") - supportEmail.setValue(UIImage(named:"ic_email")?.withRenderingMode(.alwaysOriginal),forKey:"image") - - // TODO: have to enable when zendesk is provided - // alert.addAction(liveChat) - alert.addAction(contactNumber) - alert.addAction(supportEmail) - alert.view.tintColor = UIColor.red - - alert.view.subviews.last?.subviews.last?.layer.cornerRadius = 10 - - alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil)) - present(alert, animated: true, completion: nil) - } - - - func startCall(contactNumber: String){ - if let url = URL(string: "tel://\(contactNumber.removeWhitespacesInBetween())"), UIApplication.shared.canOpenURL(url) { - if #available(iOS 10, *) { - UIApplication.shared.open(url) - } else { - UIApplication.shared.openURL(url) - } - } - } - - @objc func showNotification(){ - performSegue(withIdentifier: "notification", sender: nil) - } - - override func viewDidLoad() { - super.viewDidLoad() - setupDelegates() - hideKeyboardWhenTappedAround() - setUpRefreshControl() - setNavBar() -// setupNavigationNotifications() - - - if !isVerifiedUser() { -// self.alert(message: "Your document is in verification process. Thereafter you can enjoy GME online service. Thank you for registering with us!.") - let message = "Your document is in verification process. Thereafter you can enjoy GME online service. Thank you for registering with us!." - self.alertWithOkCancel(message: message, title: "Alert!", okAction: { - // go to kyc - if let navigation = self.navigationController { - let wireframe = KycWireframe() - wireframe.pushMainView(in: navigation) - } - }, cancelAction: nil) - } - - if numberCellsInCollectionView == nil { - numberCellsInCollectionView = 4 - } - - if showAllCollectionViewCells == nil { - showAllCollectionViewCells = false - } - - /* Checks if the user's custom menu is available or not */ - if let menuArray = UserDefaults.standard.array(forKey: "com.gmeremit.collectionViewMenuIndexArray") as? [Int] { - collectionViewMenuIndexArray = menuArray - - /* While loading the app (but not from myStoryViewController), MORE button should be shown */ - - if numberCellsInCollectionView == 4 { - if collectionViewMenuIndexArray[3] != 6 { - collectionViewMenuIndexArray.swapAt(3, 6) - } - } else if numberCellsInCollectionView == 6 { - if collectionViewMenuIndexArray[3] == 6 { - collectionViewMenuIndexArray.swapAt(3, 6) - } - } - - } else { - collectionViewMenuIndexArray = [0, 1, 2, 6, 4, 5, 3] - UserDefaults.standard.set(collectionViewMenuIndexArray, forKey: "com.gmeremit.collectionViewMenuIndexArray") - } - - longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(self.handleLongGesture(gesture:))) - - imagePicker.delegate = self - - tableView.tableFooterView = UIView() - - registerCMUser() - - if UserDefaults.standard.bool(forKey: "com.gmeremit.showImageAlert") { - self.addUserProfileImage() - } - - } - - private func getAboutMeNotificationName() -> Notification.Name { - return Notification.Name.init(SideMenuNavigationNotifications.aboutGme) - } - - private func getSupportNotificationName() -> Notification.Name { - return Notification.Name.init(SideMenuNavigationNotifications.support) - } - - private func getSettingNotificationName() -> Notification.Name { - return Notification.Name.init(SideMenuNavigationNotifications.setting) - } - - - @objc private func showSideMenuAboutGme() { - let vc = UIStoryboard.init(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "AboutGMEViewController") as! AboutGMEViewController - self.navigationController?.pushViewController(vc, animated: true) - } - - @objc private func showSideMenuSetting() { - let vc = UIStoryboard.init(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "SettingViewController") as! SettingViewController - self.navigationController?.pushViewController(vc, animated: true) - } - - @objc private func showSideMenuSupport() { - let vc = UIStoryboard.init(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "SupportViewController") as! SupportViewController - self.navigationController?.pushViewController(vc, animated: true) - } - - private func setupDelegates() { - tableView.delegate = self - tableView.dataSource = self - } - - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - switch segue.identifier { - case "statusUpdate"?: - let statusUploadViewController = segue.destination as! StatusUploadViewController - statusUploadViewController.statusUploadMode = statusUploadMode - statusUploadViewController.editablePostIndex = editablePostIndex - statusUploadViewController.socialfeedviewmodel = socialfeedviewmodel - statusUploadViewController.showNotificationParameter = showNotificationParameter - case "showLikedBy"?: - let likedByViewController = segue.destination as! LikesViewController - likedByViewController.socialfeedviewmodel = socialfeedviewmodel - likedByViewController.tappedIndex = tappedIndex - case "showCommentsBy"?: - let commentsViewController = segue.destination as! CommentsViewController - commentsViewController.socialfeedviewmodel = socialfeedviewmodel - commentsViewController.tappedIndex = tappedIndex - case "myStory"?: - let myStoryViewController = segue.destination as! MyStoryViewController - myStoryViewController.socialfeedviewmodel = socialfeedviewmodel - myStoryViewController.showNotificationParameter = showNotificationParameter - - case "notification"?: - let notificationViewController = segue.destination as! NotificationViewController - notificationViewController.socialfeedviewmodel = socialfeedviewmodel - default: - return - } - } -} - - -/*---------------ALL ACTIONS RELATED TO SOCIAL WALL HERE------------ - - */ - -extension _HomeViewController { - - //UPLOAD TEXT AS STATUS - @objc func uploadTextStatus(_ sender: TableViewCell) { - - statusUploadMode = 0 - self.performSegue(withIdentifier: "statusUpdate", sender: nil) - } - - //UPLOAD IMAGE AS STATUS - @objc func uploadImageStatus(_ sender: TableViewCell) { - statusUploadMode = 1 - self.performSegue(withIdentifier: "statusUpdate", sender: nil) - } - - //DATA BINDING - func bindFeedsDataToUI() { - - socialfeedviewmodel.socialFeedsRxValue.bind { [weak self] in - guard $0 != nil, self?.socialfeedviewmodel != nil else { - return - } - guard $0! != 0 else { - //self.popUpMessageError(value: 10, message: self.socialfeedviewmodel.getErrorMessage()) - self?.socialfeedviewmodel.socialFeedsRxValue.value = nil - - return - - } - switch $0! { - - case socialWallCode.fetchPostsPublic.rawValue: - let count = self?.socialfeedviewmodel.getPublicSocialFeedsCount() - if count! > 0 { - if (self?.newFeedsWillBeAppended)! { - - self?.arrayIndexPath.removeAll() - - self?.tableView.beginUpdates() - let currentCount = self?.socialfeedviewmodel.getCurrentlyFetchedFeedCount() - - for i in 0...(self?.socialfeedviewmodel.getCurrentlyFetchedFeedCount())!-1 { - self?.arrayIndexPath.append(IndexPath.init(row: count! - currentCount! + i, section: 3)) - } - - self?.tableView.insertRows(at: (self?.arrayIndexPath)!, with: .automatic) - - self?.tableView.endUpdates() - - - self?.tableView.cellForRow(at: IndexPath(row: 0, section: 4))?.isHidden = false - - } else { - - if (self?.refreshControl.isRefreshing)! { - self?.refreshControl.endRefreshing() - } - self?.tableView.reloadSections(NSIndexSet(index: 3) as IndexSet, with: .none) - self?.tableView.reloadSections(NSIndexSet(index: 4) as IndexSet, with: .none) - } - } - - case socialWallCode.deletePost.rawValue: - self?.socialfeedviewmodel.removeSocialFeed(atIndex: (self?.tappedIndex!)!) - self?.tableView.deleteRows(at: [IndexPath(item: (self?.tappedIndex!)!, section: 3)], with: .automatic) - - case socialWallCode.likeUnlikePost.rawValue: - self?.socialfeedviewmodel.updateSocialFeedArrayLikeNumber(atIndex: (self?.tappedIndex!)!) - self?.tableView.reloadRows(at: [IndexPath(item: (self?.tappedIndex!)!, section: 3)], with: UITableViewRowAnimation.automatic) - - case socialWallCode.reportPost.rawValue: - self?.reportSendAlert() - - case socialWallCode.createUpdatePost.rawValue: - self?.dismissActivityIndicator(activityIndicator: (self?.activityIndicator)!) - self?.tableView.reloadSections(IndexSet(integer: 3), with: UITableViewRowAnimation.automatic) - - guard let index = self?.editedIndex else { - return - } - self?.tableView.scrollToRow(at: IndexPath(row: index, section: 3), at: UITableViewScrollPosition.none, animated: false) - self?.editedIndex = nil - - let alert = UIAlertController(title:"", message:"This post is made private." , preferredStyle: .actionSheet) - self?.present(alert, animated: true, completion: nil) - let when = DispatchTime.now() + 2 - DispatchQueue.main.asyncAfter(deadline: when){ - alert.dismiss(animated: true, completion: nil) - } - - default: - return - } - self?.socialfeedviewmodel.socialFeedsRxValue.value = nil - } - - } - - - - - - /// loadBalance - @objc func loadBalanceTap(_ sender: TableViewCell) { - guard let navController = self.navigationController else { return } - - let popUpViewController = UIStoryboard(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "loadBalance") as! LoadBalanceViewController - - navController.addChildViewController(popUpViewController) - popUpViewController.view.frame = navController.view.bounds - navController.view.addSubview(popUpViewController.view) - popUpViewController.didMove(toParentViewController: navController) - } - - - @objc func rewardTap(_ sender: TableViewCell) { - let storyboard = UIStoryboard.init(name: "Reward", bundle: Bundle.main) - let vController = storyboard.instantiateViewController(withIdentifier: "RewardViewController") as! RewardViewController - self.navigationController!.pushViewController(vController, animated: true) - } - - @objc func agentTap(_ sender: TableViewCell) { - let storyboard = UIStoryboard.init(name: "_Home", bundle: Bundle.main) - let vController = storyboard.instantiateViewController(withIdentifier: "PayoutViewController") as! PayoutViewController - self.navigationController!.pushViewController(vController, animated: true) - - } - - @IBAction func showMyStories(_ sender: Any) { - self.performSegue(withIdentifier: "myStory", sender: nil) - } - - //DISPLAY FEEDS ON THE GME WALL - func getTableViewCell(indexPath: IndexPath, socialFeed : SocialFeed, mode: Int) -> UITableViewCell { - - let cell: TableViewCell! - - switch mode { - case 1: - cell = tableView.dequeueReusableCell(withIdentifier: "socialCellText", for: indexPath) as! TableViewCell - cell.labelStatus.text = socialFeed.feedText - cell.labelStatus.textColor = UIColor(red:0.29, green:0.29, blue:0.29, alpha:1.0) - case 2: - cell = tableView.dequeueReusableCell(withIdentifier: "socialCellImage", for: indexPath) as! TableViewCell - cell.imageViewSocial.sd_setImage(with: URL(string: socialFeed.feedImage!)!, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) - - cell.postImageHeight.constant = view.frame.width - - case 3: - - cell = tableView.dequeueReusableCell(withIdentifier: "socialCellTextImage", for: indexPath) as! TableViewCell - cell.labelStatus.text = socialFeed.feedText - cell.labelStatus.textColor = UIColor(red:0.29, green:0.29, blue:0.29, alpha:1.0) - cell.imageViewSocial.sd_setImage(with: URL(string: socialFeed.feedImage!)!, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) - - cell.postImageHeight.constant = view.frame.width - - default: - cell = tableView.dequeueReusableCell(withIdentifier: "socialCellTextImage", for: indexPath) as! TableViewCell - } - - cell.layer.borderColor = UIColor(red:0.91, green:0.93, blue:0.95, alpha:1.0).cgColor - cell.layer.borderWidth = 2 - cell.imageViewUserImage.layer.cornerRadius = cell.imageViewUserImage.frame.height / 2 - - cell.viewSocialActionConstraint.constant = 58.5 - cell.imageViewUserImage.layer.cornerRadius = cell.imageViewUserImage.frame.height / 2 - - cell.editPostButton?.addTarget(self, action:#selector(showPostOptions(_:)), for:.touchUpInside) - cell.heartButton?.addTarget(self, action:#selector(toggleLike(_:)), for:.touchUpInside) - cell.likeButton?.addTarget(self, action:#selector(showLikes(_:)), for:.touchUpInside) - cell.commentButton?.addTarget(self, action: #selector(showComments(_:)), for: .touchUpInside) - - //Display USERNAME who has posted the feed - cell.labelSocialUsername.text = socialfeedviewmodel.getFullName(feed: socialFeed) - - //Display USER IMAGE - cell.labelUserNameInitial.isHidden = false - cell.labelUserNameInitial.backgroundColor = UIColor(hex: 0x2e3192) - cell.labelUserNameInitial.layer.cornerRadius = cell.labelUserNameInitial.frame.height / 2 - cell.labelUserNameInitial.text = socialFeed.firstName.prefix(1).uppercased() - - if let userDpString = socialFeed.userDpUrl { - if let userDpUrl = URL(string: userDpString) { - cell.imageViewUserImage.isHidden = false - - cell.imageViewUserImage.sd_setImage(with: userDpUrl, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) - } - cell.labelUserNameInitial.isHidden = true - } - - //Display timeStamp (ago date) - cell.labelTimeStamp.text = socialFeed.agoDate - - //Display LIKE status - if socialFeed.liked { - cell.heartButton?.setImage(UIImage(named:"ic_heartfull"), for: UIControlState.normal) - } - else { - cell.heartButton?.setImage(UIImage(named:"ic_heart"), for: UIControlState.normal) - } - - //Display total number of LIKES - if socialFeed.totalLike > 1 { - cell.likeButton.setTitle("\(socialFeed.totalLike) Likes", for:UIControlState.normal) - } - else { - cell.likeButton.setTitle("\(socialFeed.totalLike) Like", for:UIControlState.normal) - } - - //Display total number of COMMENTS - if socialFeed.totalComment > 1 { - cell.commentButton.setTitle(" \(socialFeed.totalComment) Comments", for: UIControlState.normal) - } - else { - cell.commentButton.setTitle(" \(socialFeed.totalComment) Comment", for: UIControlState.normal) - } - return cell - } - - /** - To determine the specific cell for edit the post - */ - @objc func showPostOptions(_ sender: TableViewCell) { - guard let clickedCell = sender.superview?.superview?.superview as? TableViewCell else { - return - } - if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { - - enumeratePostOptions(index: clickedCellIndexPath.row) - } - } - - /** - Alert message for current user - */ - func enumeratePostOptions(index: Int) { - let alert = UIAlertController(title:nil, message:nil, preferredStyle: .actionSheet) - - if self.socialfeedviewmodel.postBelongsToMe(postIndex: index) { - - let edit = UIAlertAction(title: "Edit this post", style: .default) { - UIAlertAction in - self.statusUploadMode = 2 - self.editablePostIndex = index - self.performSegue(withIdentifier: "statusUpdate", sender: nil) - - } - - let delete = UIAlertAction(title: "Delete this post", style: .default) { - UIAlertAction in - - self.deleteConfirmation(postIndex: index) - } - - let moveToPrivate = UIAlertAction(title: "Hide this post from GME Community", style: .default) { - UIAlertAction in - -// self.tappedIndex = index - - let feedToEdit = self.socialfeedviewmodel.getSocialFeedAt(index: index) - - if let feedText = feedToEdit.feedText { - self.socialfeedviewmodel.updateFeedText(text: feedText) - } - if let feedImageId = feedToEdit.feedImageId { - self.socialfeedviewmodel.setFeedImageId(imageId: feedImageId) - } - - self.editedIndex = index - self.showActivityIndicator(activityIndicator: self.activityIndicator) - self.socialfeedviewmodel.updateSocialFeed(feed: feedToEdit, index: index, toggle: true) - } - - let cancel = UIAlertAction(title: "Cancel", style: .destructive) { - UIAlertAction in - } - - alert.addAction(moveToPrivate) - alert.addAction(edit) - alert.addAction(delete) - alert.addAction(cancel) - - } else { - let report = UIAlertAction(title: "Report", style: .default) { - UIAlertAction in - self.reportAlert(postIndex: index) - } - - let share = UIAlertAction(title: "Share this post", style: .default) { - UIAlertAction in - if self.socialfeedviewmodel.getSocialFeedAt(index: index).feedImageId == nil{ - self.sharePost(postIndex: index) - } - } - - let cancel = UIAlertAction(title: "Cancel", style: .destructive) { - UIAlertAction in - } - - alert.addAction(report) - if self.socialfeedviewmodel.getSocialFeedAt(index: index).feedImageId == nil{ - alert.addAction(share) - } - alert.addAction(cancel) - } - present(alert, animated: true, completion: nil) - } - - /** - Share the status of GME app to facebook - */ - - func sharePost(postIndex: Int){ - - let content = FBSDKShareLinkContent() - content.contentURL = URL(string: "https://itunes.apple.com/us/app/gme/id1366910197?ls=1&mt=8") - // content.hashtag = FBSDKHashtag(string: "#FeelingGood") - - if let shareText = self.socialfeedviewmodel.getSocialFeedAt(index: postIndex).feedText{ - content.quote = shareText - } - let dialog = FBSDKShareDialog() - dialog.fromViewController = self - - dialog.shareContent = content - - dialog.delegate = self - if !dialog.canShow() { - dialog.mode = FBSDKShareDialogMode.native - } - dialog.show() - - } - - func sharer(_ sharer: FBSDKSharing!, didCompleteWithResults results: [AnyHashable : Any]!) { - - } - - func sharer(_ sharer: FBSDKSharing!, didFailWithError error: Error!) { - - } - - func sharerDidCancel(_ sharer: FBSDKSharing!) { - - } - - - - - func deleteConfirmation(postIndex: Int) { - let alert = UIAlertController(title: nil, message: "Are you sure you want to delete?", preferredStyle: .actionSheet) - let cancel = UIAlertAction(title: "Cancel", style: .destructive) { - UIAlertAction in - } - let delete = UIAlertAction(title: "Delete", style: .destructive) { - UIAlertAction in - self.tappedIndex = postIndex - self.socialfeedviewmodel.deleteSocialFeed(feedId: self.socialfeedviewmodel.getSocialFeedAt(index: postIndex).id) - } - alert.addAction(cancel) - alert.addAction(delete) - present(alert, animated: true, completion: nil) - } - - - @objc func loadMore(_ sender: TableViewCell) { - newFeedsWillBeAppended = true - tableView.cellForRow(at: IndexPath(row: 0, section: 4))?.isHidden = true - socialfeedviewmodel.fetchSocialFeeds(isPublic: true, loadMore: true) - } - - /* LIKE OR DISLIKE A POST WHEN TAPPPED */ - @objc func toggleLike(_ sender: TableViewCell) { - - guard let clickedCell = sender.superview?.superview?.superview?.superview as? TableViewCell else { - return - } - if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { - tappedIndex = clickedCellIndexPath.row - let tappedFeed = socialfeedviewmodel.getSocialFeedAt(index: tappedIndex!) - socialfeedviewmodel.likeDislikePost(feedId: tappedFeed.id, liked: tappedFeed.liked) - } - } - - /** - To determine the specific index of like button on table view - */ - @objc func showLikes(_ sender: TableViewCell) { - - guard let clickedCell = sender.superview?.superview?.superview?.superview as? TableViewCell else { - return - } - if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { - - tappedIndex = clickedCellIndexPath.row - - let tappedFeed = socialfeedviewmodel.getSocialFeedAt(index: tappedIndex!) - - if tappedFeed.totalLike > 0 { - - guard Reachability.isConnectedToNetwork() else { - self.popUpMessage(value: 15) - return - } - - self.performSegue(withIdentifier: "showLikedBy", sender: nil) - } - } - } - - /** - To determine the specific index of comment button on table view - */ - @objc func showComments(_ sender: TableViewCell) { - - guard let clickedCell = sender.superview?.superview?.superview?.superview as? TableViewCell else { - return - } - if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { - - tappedIndex = clickedCellIndexPath.row - - guard Reachability.isConnectedToNetwork() else { - self.popUpMessage(value: 15) - return - } - - self.performSegue(withIdentifier: "showCommentsBy", sender: nil) - } - } - - /** - To display alert message for report - */ - func reportAlert(postIndex: Int) { - let alert = UIAlertController(title:nil, message:nil, preferredStyle: .actionSheet) - - let feedToReport = self.socialfeedviewmodel.getSocialFeedAt(index: postIndex) - - let spam = UIAlertAction(title: "It’s spam", style: .default) { - UIAlertAction in - - self.socialfeedviewmodel.reportSocialFeed(feedId: feedToReport.id, reportMessage: "This is spam") - - } - - let inappropriate = UIAlertAction(title: "It’s inappropriate", style: .default) { - UIAlertAction in - - self.socialfeedviewmodel.reportSocialFeed(feedId: feedToReport.id, reportMessage: "This is inappropriate") - } - - let cancel = UIAlertAction(title: "Cancel", style: .destructive) { - UIAlertAction in - - } - alert.addAction(spam) - alert.addAction(inappropriate) - alert.addAction(cancel) - present(alert, animated: true, completion: nil) - } - - /** - To display alert message after report is send - */ - func reportSendAlert() { - let alert = UIAlertController(title:nil, message:"Your report has been send for review.", preferredStyle: .actionSheet) - - let cancel = UIAlertAction(title: "OK", style: .cancel) { - UIAlertAction in - - } - alert.addAction(cancel) - present(alert, animated: true, completion: nil) - - } - - /** - Update available balance of user - */ - func setAvailableBalanceInStringAttributeFormat(label: UILabel){ - - var amount = "N/A" - - let balance = UserDefaults.standard.object(forKey: "com.gmeremit.balance") as? String - - if balance != "N/A" && balance != nil && balance != "" { - amount = getCommaAddedAmountString(amountString: balance!) - } - - let amountUnit = " USD" - - let fontAttribute = [ NSAttributedStringKey.font: UIFont(name: "SanFranciscoDisplay-Regular", size: 18.0)! ] - - let amountAttribute = NSMutableAttributedString(string: amount) - let amountUnitAttribute = NSMutableAttributedString(string: amountUnit,attributes: fontAttribute) - - amountUnitAttribute.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor(hex:0x4a4a4a), range: NSRange(location:0, length: amountUnitAttribute.length)) - - let balanceAttribute = NSMutableAttributedString() - - balanceAttribute.append(amountAttribute) - balanceAttribute.append(amountUnitAttribute) - - label.attributedText = balanceAttribute - } -} - - -/*---------------MAIN TABLE VIEW------------ - -----------------HANDLES THEN NUMBER OF CELLS IN TABLEVIEW------------ - -----------------HANDLES THE NUMBER OF SECTIONS IN TABLEVIEW------------ - -----------------HANDLES THE SECTION HEIGHT IN TABLEVIEW------------ -*/ - -extension _HomeViewController: UIScrollViewDelegate { - - @IBAction func scrollToTop(_ sender: Any) { - tableView.scrollToRow(at: IndexPath(row:0, section: 0), at: UITableViewScrollPosition.top, animated: true) - } - - func scrollViewDidScroll(_ scrollView: UIScrollView) { - - if tableView.indexPathsForVisibleRows!.contains(IndexPath(row: 0, section: 1)) && isTopMenuVisible { - - topMenuView.isHidden = true - tableViewTopConstraint.constant = 0 - isTopMenuVisible = false - } - - if !tableView.indexPathsForVisibleRows!.contains(IndexPath(row: 0, section: 1)) && !isTopMenuVisible { - - setUpTopMenu() - - topMenuView.isHidden = false - tableViewTopConstraint.constant = topMenuView.frame.height - isTopMenuVisible = true - } - - } - - func setUpTopMenu() { - if let menuIndexArray = UserDefaults.standard.array(forKey: "com.gmeremit.collectionViewMenuIndexArray") as? [Int] { - buttonMenuItem0.setImage(UIImage(named: collectionViewMenuIconArray[menuIndexArray[0]]!), for: .normal) - buttonMenuItem0.tag = menuIndexArray[0] - - buttonMenuItem1.setImage(UIImage(named: collectionViewMenuIconArray[menuIndexArray[1]]!), for: .normal) - buttonMenuItem1.tag = menuIndexArray[1] - - buttonMenuItem2.setImage(UIImage(named: collectionViewMenuIconArray[menuIndexArray[2]]!), for: .normal) - buttonMenuItem2.tag = menuIndexArray[2] - - labelMenuItem0.text = collectionViewMenuNameArray[menuIndexArray[0]] - labelMenuItem1.text = collectionViewMenuNameArray[menuIndexArray[1]] - labelMenuItem2.text = collectionViewMenuNameArray[menuIndexArray[2]] - - buttonMenuItem0.addTarget(self, action: #selector(performRedirection(_:)), for: .touchUpInside) - buttonMenuItem1.addTarget(self, action: #selector(performRedirection(_:)), for: .touchUpInside) - buttonMenuItem2.addTarget(self, action: #selector(performRedirection(_:)), for: .touchUpInside) - } - } - - @objc func performRedirection(_ sender: UIButton) { - - switch sender.tag { - - case 0: - if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as! Bool) { - self.performSegue(withIdentifier: "recipientList", sender: nil) - } else { - self.popUpMessage(value: 13) - } - - case 1: - if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as! Bool) { - self.performSegue(withIdentifier: "mobileRecharge", sender: nil) - } else { - self.popUpMessage(value: 13) - } - - case 2: - self.performSegue(withIdentifier: "todayRate", sender: nil) - - case 3: - self.performSegue(withIdentifier: "trackTransfer", sender: nil) - - case 4: - self.performSegue(withIdentifier: "transactionStatement", sender: nil) - - case 5: - if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as! Bool) { - self.performSegue(withIdentifier: "walletTransfer", sender: nil) - } else { - self.popUpMessage(value: 13) - } - - default: - return - } - } -} - -extension _HomeViewController: UITableViewDelegate, UITableViewDataSource { - - - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - guard let index = TableViewCells.init(rawValue: indexPath.section) else {return 0} - switch index { - case .balance: - return 100 - - case .collection: - let widthCell = ((view.frame.width - (insetForCollectionView * 3) ) - 10) / 2 - let heightForCollectionViewCell = widthCell * (170 / 120) - if showAllCollectionViewCells! { - return heightForCollectionViewCell * 1.7 - } else { - return heightForCollectionViewCell * 1.151 - } - - case .status: - tableView.estimatedRowHeight = 100 - return UITableViewAutomaticDimension - - case .social: - tableView.estimatedRowHeight = 300 - return UITableViewAutomaticDimension - - case .loadMore: - tableView.estimatedRowHeight = 100 - return UITableViewAutomaticDimension - - default: - return 0 - } - } - - func numberOfSections(in tableView: UITableView) -> Int { - return self.sections.count - } - - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - guard let index = TableViewCells.init(rawValue: section) else {return 0} - switch index { - case .balance: - return 1 - case .collection: - return 1 - case .status: - return 1 - case .social: - if allowFetchRequest && self.socialfeedviewmodel.getPublicSocialFeedsCount() == 0 { - socialfeedviewmodel.fetchSocialFeeds(isPublic: true, loadMore: false) - allowFetchRequest = false - return 0 - } - return self.socialfeedviewmodel.getPublicSocialFeedsCount() - - case .loadMore: - return 1 - - default: - return 0 - } - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - - guard let index = TableViewCells.init(rawValue: indexPath.section) else {return UITableViewCell()} - - switch index { - - case .balance: - - cell = tableView.dequeueReusableCell(withIdentifier: "topCell", for: indexPath) as! TableViewCell - cell.viewTop.alpha = 1 - cell.btnRewardPoint.setTitle(UserDefaults.standard.object(forKey: "com.gmeremit.rewardPoint") as? String, for: .normal) - cell.btnRewardPoint.addTarget(self, action:#selector(rewardTap(_:)), for:.touchUpInside) - setAvailableBalanceInStringAttributeFormat(label: cell.labelAvailableBalance) - let nickName = UserDefaults.standard.object(forKey: "com.gmeremit.nickName") as? String - if nickName == nil || nickName == "" { - let nameArray = (UserDefaults.standard.object(forKey: "com.gmeremit.fullName") as! String).split(separator: " ") - if let firstName = nameArray.first { - cell.labelUsername.text = String(firstName) - } - } - return cell - - case .collection: - - cell = tableView.dequeueReusableCell(withIdentifier: "collectionCell", for: indexPath) as! TableViewCell - cell.collectionView.isScrollEnabled = false - cell.collectionView.dataSource = self - cell.collectionView.delegate = self - cell.collectionView.reloadData() - cell.buttonShowless?.addTarget(self, action:#selector(showLessButtonTap(_:)), for:.touchUpInside) - - if showAllCollectionViewCells! { - cell.buttonShowless.isHidden = false - - } else { - cell.buttonShowless.isHidden = true - - } - cell.collectionView.addGestureRecognizer(longPressGesture) - - return cell - - case .status: - - cell = tableView.dequeueReusableCell(withIdentifier: "statusCell", for: indexPath) as! TableViewCell - - - cell.labelUserNameInitialStatus.isHidden = false - cell.labelUserNameInitialStatus.backgroundColor = UIColor(hex: 0x2e3192) - cell.labelUserNameInitialStatus.layer.cornerRadius = cell.labelUserNameInitialStatus.frame.height / 2 - cell.labelUserNameInitialStatus.text = getFirstName().prefix(1).uppercased() - - - let userDpString = UserDefaults.standard.object(forKey: "com.gmeremit.dpUrl") as? String - if let userDpUrl = URL(string: userDpString!) { - - cell.imageViewUserStatus.isHidden = false - - cell.imageViewUserStatus.sd_setImage(with: userDpUrl, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) - - cell.imageViewUserStatus.layer.cornerRadius = cell.imageViewUserStatus.frame.height/2 - - cell.labelUserNameInitialStatus.isHidden = true - } - - cell.buttonUploadStatus.addTarget(self, action: #selector(uploadTextStatus(_:)), for: .touchUpInside) - cell.buttonUploadImage.addTarget(self, action: #selector(uploadImageStatus(_:)), for: .touchUpInside) - return cell - - case .social: - - - socialfeedviewmodel.setAccessType(accessType: "public") - - let socialFeed = self.socialfeedviewmodel.getSocialFeedAt(index:indexPath.row) - - if socialFeed.feedText != nil && socialFeed.feedText != "" { - if socialFeed.feedImageId != nil { - //CASE 3: text and image - return self.getTableViewCell(indexPath: indexPath, socialFeed: socialFeed, mode: 3) - } else { - //CASE 1: only text - return self.getTableViewCell(indexPath: indexPath, socialFeed: socialFeed, mode: 1) - } - } else { - //CASE 2: only image - return self.getTableViewCell(indexPath: indexPath, socialFeed: socialFeed, mode: 2) - } - - - case .loadMore: - - cell = tableView.dequeueReusableCell(withIdentifier: "loadMoreCell", for: indexPath) as! TableViewCell - - - if socialfeedviewmodel.loadMore() { - cell.buttonLoadMore.addTarget(self, action: #selector(loadMore(_:)), for: .touchUpInside) - cell.buttonLoadMore.isHidden = false - } else { - cell.buttonLoadMore.isHidden = true - } - - return cell - - default: - return cell - } - - } - -} - - -/*---------------IMAGE RELATED TASKS------------ - -----------------IMAGE DIALOG------------ - -----------------GALLERY AND CAMERA ACTION------------*/ - -extension _HomeViewController { - - func addUserProfileImage(){ - - guard let tabController = self.tabBarController else { - return - } - - self.navigationController?.navigationBar.isUserInteractionEnabled = false - - let popUpViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "popUpAddUserProfile") as! PopUpAddUserProfileViewController - - tabController.addChildViewController(popUpViewController) - popUpViewController.view.frame = tabController.view.bounds - tabController.view.addSubview(popUpViewController.view) - popUpViewController.didMove(toParentViewController: tabController) - - } - - - @objc func showUploadOptions(tapGestureRecognizer: UITapGestureRecognizer) { - - let alert = UIAlertController(title: "Choose Image", message: nil, preferredStyle: .actionSheet) - - alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { _ in - self.openCamera() - })) - - alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { _ in - self.openGallery() - })) - - alert.addAction(UIAlertAction.init(title: "Cancel", style: .destructive, handler: nil)) - - self.dismiss(animated: false, completion: nil) - self.present(alert, animated: true, completion: nil) - } - - func openCamera() { - if(UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera)) { - imagePicker.sourceType = UIImagePickerControllerSourceType.camera - imagePicker.allowsEditing = false - present(imagePicker, animated: true, completion: nil) - } - else { - let alert = UIAlertController(title: "Warning", message: "You don't have camera", preferredStyle: .alert) - alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) - self.present(alert, animated: true, completion: nil) - } - } - - func openGallery() { - imagePicker.delegate = self - imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary - imagePicker.allowsEditing = false - - present(imagePicker, animated: true, completion: nil) - } - -} - - - -/*---------------NAVIGATION PICKER------------ - -----------------HANDLES IMAGE PICKING------------ - -----------------HANDLES PICKING FROM CAMERA AND GALLERY------------*/ - -extension _HomeViewController: UINavigationControllerDelegate, UIImagePickerControllerDelegate { - - func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { - - if let image = info[UIImagePickerControllerOriginalImage] as? UIImage { - - //imageView.image = image - - dismiss(animated: true, completion: nil) - } - } - - func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - dismiss(animated: true, completion: nil) - } - -} - - -/*---------------COLLECTION VIEW------------ ------------------HANDLES COLLECTION VIEW ITEMS------------ ------------------HANDLES COLLECTION VIEW MARGINS------------ ------------------HANDLES COLLECTION VIEW ITEMS DRAG------------*/ - -extension _HomeViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { - - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - - return numberCellsInCollectionView! - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - - let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "transactionCell", for: indexPath) as! TransactionCollectionViewCell - - if numberCellsInCollectionView == 4 { - cell.btnDragNdrop.isHidden = true - } else { - cell.btnDragNdrop.isHidden = false - } - - cell.transactionLabel.text = collectionViewMenuNameArray[collectionViewMenuIndexArray[indexPath.row]] - cell.transactionImageView.image = UIImage(named: collectionViewMenuIconArray[collectionViewMenuIndexArray[indexPath.row]]!) - - return cell - } - - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - - switch collectionViewMenuIndexArray[indexPath.row] { - - case 0: - - if self.isVerifiedUser() { - let viewcontroller = UIStoryboard.init(name: "RecipientListViewController", bundle: nil).instantiateViewController(withIdentifier: "RecipientListViewController") as! RecipientListViewController - self.navigationController?.pushViewController(viewcontroller, animated: true) - } else { - self.popUpMessage(value: 13) - } - - case 1: - self.alert(message: "This feature is coming soon") - return - if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as? Bool ?? false) { - self.performSegue(withIdentifier: "mobileRecharge", sender: nil) - } else { - self.popUpMessage(value: 13) - } - - case 2: - let exchangeRateWireFrame = ExchangeRatesWireframe() - if let navigation = self.navigationController { - exchangeRateWireFrame.pushMainView(in: navigation) - } - case 3: - self.performSegue(withIdentifier: "trackTransfer", sender: nil) - - case 4: - let wireframe = TransactionHistoryWireframe() - if let navigation = self.navigationController { - wireframe.pushMainView(in: navigation) - } - - - case 5: - self.alert(message: "This feature is coming soon") - return - - case 6: - showAllCollectionViewCells = true - numberCellsInCollectionView = 6 - /* Send MORE button to the last position by switching it with the 4th item in the menu" */ - collectionViewMenuIndexArray.swapAt(3, 6) - tableView.reloadSections(NSIndexSet(index: 1) as IndexSet, with: .none) - - default: - return - } - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { - - return UIEdgeInsetsMake(insetForCollectionView, insetForCollectionView, insetForCollectionView, insetForCollectionView) - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { - - return insetForCollectionView - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { - - return insetForCollectionView - } - - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - - let itemWidth = (collectionView.frame.width - insetForCollectionView * 2 - insetForCollectionView) / collectionViewItemsPerRow - - return CGSize(width: itemWidth, height: itemWidth * 120/170) - } - - func collectionView(_ collectionView: UICollectionView, canMoveItemAt indexPath: IndexPath) -> Bool { - if numberCellsInCollectionView! > 4 { - return true - } else { - return false - } - } - - func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { - - //collectionViewMenuIndexArray.swapAt(sourceIndexPath.row, destinationIndexPath.row) - - let elemetToMove = collectionViewMenuIndexArray[sourceIndexPath.row] - collectionViewMenuIndexArray.remove(at: sourceIndexPath.row) - - collectionViewMenuIndexArray.insert(elemetToMove, at: destinationIndexPath.row) - - - /* Save the user's swapped menu to be loaded next time the app is resumed */ - UserDefaults.standard.set(collectionViewMenuIndexArray, forKey: "com.gmeremit.collectionViewMenuIndexArray") - - tableView.reloadSections(NSIndexSet(index: 1) as IndexSet, with: .none) - } - - @objc func handleLongGesture(gesture: UILongPressGestureRecognizer) { - - if let tappedCollectionView = gesture.view as? UICollectionView { - - switch(gesture.state) { - - case .began: - guard let selectedIndexPath = tappedCollectionView.indexPathForItem(at: gesture.location(in: tappedCollectionView)) else { - break - } - tappedCollectionView.beginInteractiveMovementForItem(at: selectedIndexPath) - case .changed: - tappedCollectionView.updateInteractiveMovementTargetPosition(gesture.location(in: gesture.view!)) - case .ended: - tappedCollectionView.endInteractiveMovement() - default: - tappedCollectionView.cancelInteractiveMovement() - } - } - } - - @objc func showLessButtonTap(_ sender: TableViewCell) { - showAllCollectionViewCells = false - numberCellsInCollectionView = 4 - /* Bring MORE button to the 4th position by switching it with the last item in the menu" */ - collectionViewMenuIndexArray.swapAt(3, 6) - tableView.reloadSections(NSIndexSet(index: 1) as IndexSet, with: .none) - - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - } - - override func viewDidDisappear(_ animated: Bool) { - //RestApiMananger.sharedInstance.cancelExistingNetworkCalls() - } -} - +// case socialWallCode.deletePost.rawValue: +// self?.socialfeedviewmodel.removeSocialFeed(atIndex: (self?.tappedIndex!)!) +// self?.tableView.deleteRows(at: [IndexPath(item: (self?.tappedIndex!)!, section: 3)], with: .automatic) +// +// case socialWallCode.likeUnlikePost.rawValue: +// self?.socialfeedviewmodel.updateSocialFeedArrayLikeNumber(atIndex: (self?.tappedIndex!)!) +// self?.tableView.reloadRows(at: [IndexPath(item: (self?.tappedIndex!)!, section: 3)], with: UITableViewRowAnimation.automatic) +// +// case socialWallCode.reportPost.rawValue: +// self?.reportSendAlert() +// +// case socialWallCode.createUpdatePost.rawValue: +// self?.dismissActivityIndicator(activityIndicator: (self?.activityIndicator)!) +// self?.tableView.reloadSections(IndexSet(integer: 3), with: UITableViewRowAnimation.automatic) +// +// guard let index = self?.editedIndex else { +// return +// } +// self?.tableView.scrollToRow(at: IndexPath(row: index, section: 3), at: UITableViewScrollPosition.none, animated: false) +// self?.editedIndex = nil +// +// let alert = UIAlertController(title:"", message:"This post is made private." , preferredStyle: .actionSheet) +// self?.present(alert, animated: true, completion: nil) +// let when = DispatchTime.now() + 2 +// DispatchQueue.main.asyncAfter(deadline: when){ +// alert.dismiss(animated: true, completion: nil) +// } +// +// default: +// return +// } +// self?.socialfeedviewmodel.socialFeedsRxValue.value = nil +// } +// +// } +// +// +// +// +// +// /// loadBalance +// @objc func loadBalanceTap(_ sender: TableViewCell) { +// guard let navController = self.navigationController else { return } +// +// let popUpViewController = UIStoryboard(name: "_Home", bundle: nil).instantiateViewController(withIdentifier: "loadBalance") as! LoadBalanceViewController +// +// navController.addChildViewController(popUpViewController) +// popUpViewController.view.frame = navController.view.bounds +// navController.view.addSubview(popUpViewController.view) +// popUpViewController.didMove(toParentViewController: navController) +// } +// +// +// @objc func rewardTap(_ sender: TableViewCell) { +// let storyboard = UIStoryboard.init(name: "Reward", bundle: Bundle.main) +// let vController = storyboard.instantiateViewController(withIdentifier: "RewardViewController") as! RewardViewController +// self.navigationController!.pushViewController(vController, animated: true) +// } +// +// @objc func agentTap(_ sender: TableViewCell) { +// let storyboard = UIStoryboard.init(name: "_Home", bundle: Bundle.main) +// let vController = storyboard.instantiateViewController(withIdentifier: "PayoutViewController") as! PayoutViewController +// self.navigationController!.pushViewController(vController, animated: true) +// +// } +// +// @IBAction func showMyStories(_ sender: Any) { +// self.performSegue(withIdentifier: "myStory", sender: nil) +// } +// +// //DISPLAY FEEDS ON THE GME WALL +// func getTableViewCell(indexPath: IndexPath, socialFeed : SocialFeed, mode: Int) -> UITableViewCell { +// +// let cell: TableViewCell! +// +// switch mode { +// case 1: +// cell = tableView.dequeueReusableCell(withIdentifier: "socialCellText", for: indexPath) as! TableViewCell +// cell.labelStatus.text = socialFeed.feedText +// cell.labelStatus.textColor = UIColor(red:0.29, green:0.29, blue:0.29, alpha:1.0) +// case 2: +// cell = tableView.dequeueReusableCell(withIdentifier: "socialCellImage", for: indexPath) as! TableViewCell +// cell.imageViewSocial.sd_setImage(with: URL(string: socialFeed.feedImage!)!, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) +// +// cell.postImageHeight.constant = view.frame.width +// +// case 3: +// +// cell = tableView.dequeueReusableCell(withIdentifier: "socialCellTextImage", for: indexPath) as! TableViewCell +// cell.labelStatus.text = socialFeed.feedText +// cell.labelStatus.textColor = UIColor(red:0.29, green:0.29, blue:0.29, alpha:1.0) +// cell.imageViewSocial.sd_setImage(with: URL(string: socialFeed.feedImage!)!, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) +// +// cell.postImageHeight.constant = view.frame.width +// +// default: +// cell = tableView.dequeueReusableCell(withIdentifier: "socialCellTextImage", for: indexPath) as! TableViewCell +// } +// +// cell.layer.borderColor = UIColor(red:0.91, green:0.93, blue:0.95, alpha:1.0).cgColor +// cell.layer.borderWidth = 2 +// cell.imageViewUserImage.layer.cornerRadius = cell.imageViewUserImage.frame.height / 2 +// +// cell.viewSocialActionConstraint.constant = 58.5 +// cell.imageViewUserImage.layer.cornerRadius = cell.imageViewUserImage.frame.height / 2 +// +// cell.editPostButton?.addTarget(self, action:#selector(showPostOptions(_:)), for:.touchUpInside) +// cell.heartButton?.addTarget(self, action:#selector(toggleLike(_:)), for:.touchUpInside) +// cell.likeButton?.addTarget(self, action:#selector(showLikes(_:)), for:.touchUpInside) +// cell.commentButton?.addTarget(self, action: #selector(showComments(_:)), for: .touchUpInside) +// +// //Display USERNAME who has posted the feed +// cell.labelSocialUsername.text = socialfeedviewmodel.getFullName(feed: socialFeed) +// +// //Display USER IMAGE +// cell.labelUserNameInitial.isHidden = false +// cell.labelUserNameInitial.backgroundColor = UIColor(hex: 0x2e3192) +// cell.labelUserNameInitial.layer.cornerRadius = cell.labelUserNameInitial.frame.height / 2 +// cell.labelUserNameInitial.text = socialFeed.firstName.prefix(1).uppercased() +// +// if let userDpString = socialFeed.userDpUrl { +// if let userDpUrl = URL(string: userDpString) { +// cell.imageViewUserImage.isHidden = false +// +// cell.imageViewUserImage.sd_setImage(with: userDpUrl, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) +// } +// cell.labelUserNameInitial.isHidden = true +// } +// +// //Display timeStamp (ago date) +// cell.labelTimeStamp.text = socialFeed.agoDate +// +// //Display LIKE status +// if socialFeed.liked { +// cell.heartButton?.setImage(UIImage(named:"ic_heartfull"), for: UIControlState.normal) +// } +// else { +// cell.heartButton?.setImage(UIImage(named:"ic_heart"), for: UIControlState.normal) +// } +// +// //Display total number of LIKES +// if socialFeed.totalLike > 1 { +// cell.likeButton.setTitle("\(socialFeed.totalLike) Likes", for:UIControlState.normal) +// } +// else { +// cell.likeButton.setTitle("\(socialFeed.totalLike) Like", for:UIControlState.normal) +// } +// +// //Display total number of COMMENTS +// if socialFeed.totalComment > 1 { +// cell.commentButton.setTitle(" \(socialFeed.totalComment) Comments", for: UIControlState.normal) +// } +// else { +// cell.commentButton.setTitle(" \(socialFeed.totalComment) Comment", for: UIControlState.normal) +// } +// return cell +// } +// +// /** +// To determine the specific cell for edit the post +// */ +// @objc func showPostOptions(_ sender: TableViewCell) { +// guard let clickedCell = sender.superview?.superview?.superview as? TableViewCell else { +// return +// } +// if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { +// +// enumeratePostOptions(index: clickedCellIndexPath.row) +// } +// } +// +// /** +// Alert message for current user +// */ +// func enumeratePostOptions(index: Int) { +// let alert = UIAlertController(title:nil, message:nil, preferredStyle: .actionSheet) +// +// if self.socialfeedviewmodel.postBelongsToMe(postIndex: index) { +// +// let edit = UIAlertAction(title: "Edit this post", style: .default) { +// UIAlertAction in +// self.statusUploadMode = 2 +// self.editablePostIndex = index +// self.performSegue(withIdentifier: "statusUpdate", sender: nil) +// +// } +// +// let delete = UIAlertAction(title: "Delete this post", style: .default) { +// UIAlertAction in +// +// self.deleteConfirmation(postIndex: index) +// } +// +// let moveToPrivate = UIAlertAction(title: "Hide this post from GME Community", style: .default) { +// UIAlertAction in +// +//// self.tappedIndex = index +// +// let feedToEdit = self.socialfeedviewmodel.getSocialFeedAt(index: index) +// +// if let feedText = feedToEdit.feedText { +// self.socialfeedviewmodel.updateFeedText(text: feedText) +// } +// if let feedImageId = feedToEdit.feedImageId { +// self.socialfeedviewmodel.setFeedImageId(imageId: feedImageId) +// } +// +// self.editedIndex = index +// self.showActivityIndicator(activityIndicator: self.activityIndicator) +// self.socialfeedviewmodel.updateSocialFeed(feed: feedToEdit, index: index, toggle: true) +// } +// +// let cancel = UIAlertAction(title: "Cancel", style: .destructive) { +// UIAlertAction in +// } +// +// alert.addAction(moveToPrivate) +// alert.addAction(edit) +// alert.addAction(delete) +// alert.addAction(cancel) +// +// } else { +// let report = UIAlertAction(title: "Report", style: .default) { +// UIAlertAction in +// self.reportAlert(postIndex: index) +// } +// +// let share = UIAlertAction(title: "Share this post", style: .default) { +// UIAlertAction in +// if self.socialfeedviewmodel.getSocialFeedAt(index: index).feedImageId == nil{ +// self.sharePost(postIndex: index) +// } +// } +// +// let cancel = UIAlertAction(title: "Cancel", style: .destructive) { +// UIAlertAction in +// } +// +// alert.addAction(report) +// if self.socialfeedviewmodel.getSocialFeedAt(index: index).feedImageId == nil{ +// alert.addAction(share) +// } +// alert.addAction(cancel) +// } +// present(alert, animated: true, completion: nil) +// } +// +// /** +// Share the status of GME app to facebook +// */ +// +// func sharePost(postIndex: Int){ +// +// let content = FBSDKShareLinkContent() +// content.contentURL = URL(string: "https://itunes.apple.com/us/app/gme/id1366910197?ls=1&mt=8") +// // content.hashtag = FBSDKHashtag(string: "#FeelingGood") +// +// if let shareText = self.socialfeedviewmodel.getSocialFeedAt(index: postIndex).feedText{ +// content.quote = shareText +// } +// let dialog = FBSDKShareDialog() +// dialog.fromViewController = self +// +// dialog.shareContent = content +// +// dialog.delegate = self +// if !dialog.canShow() { +// dialog.mode = FBSDKShareDialogMode.native +// } +// dialog.show() +// +// } +// +// func sharer(_ sharer: FBSDKSharing!, didCompleteWithResults results: [AnyHashable : Any]!) { +// +// } +// +// func sharer(_ sharer: FBSDKSharing!, didFailWithError error: Error!) { +// +// } +// +// func sharerDidCancel(_ sharer: FBSDKSharing!) { +// +// } +// +// +// +// +// func deleteConfirmation(postIndex: Int) { +// let alert = UIAlertController(title: nil, message: "Are you sure you want to delete?", preferredStyle: .actionSheet) +// let cancel = UIAlertAction(title: "Cancel", style: .destructive) { +// UIAlertAction in +// } +// let delete = UIAlertAction(title: "Delete", style: .destructive) { +// UIAlertAction in +// self.tappedIndex = postIndex +// self.socialfeedviewmodel.deleteSocialFeed(feedId: self.socialfeedviewmodel.getSocialFeedAt(index: postIndex).id) +// } +// alert.addAction(cancel) +// alert.addAction(delete) +// present(alert, animated: true, completion: nil) +// } +// +// +// @objc func loadMore(_ sender: TableViewCell) { +// newFeedsWillBeAppended = true +// tableView.cellForRow(at: IndexPath(row: 0, section: 4))?.isHidden = true +// socialfeedviewmodel.fetchSocialFeeds(isPublic: true, loadMore: true) +// } +// +// /* LIKE OR DISLIKE A POST WHEN TAPPPED */ +// @objc func toggleLike(_ sender: TableViewCell) { +// +// guard let clickedCell = sender.superview?.superview?.superview?.superview as? TableViewCell else { +// return +// } +// if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { +// tappedIndex = clickedCellIndexPath.row +// let tappedFeed = socialfeedviewmodel.getSocialFeedAt(index: tappedIndex!) +// socialfeedviewmodel.likeDislikePost(feedId: tappedFeed.id, liked: tappedFeed.liked) +// } +// } +// +// /** +// To determine the specific index of like button on table view +// */ +// @objc func showLikes(_ sender: TableViewCell) { +// +// guard let clickedCell = sender.superview?.superview?.superview?.superview as? TableViewCell else { +// return +// } +// if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { +// +// tappedIndex = clickedCellIndexPath.row +// +// let tappedFeed = socialfeedviewmodel.getSocialFeedAt(index: tappedIndex!) +// +// if tappedFeed.totalLike > 0 { +// +// guard Reachability.isConnectedToNetwork() else { +// self.popUpMessage(value: 15) +// return +// } +// +// self.performSegue(withIdentifier: "showLikedBy", sender: nil) +// } +// } +// } +// +// /** +// To determine the specific index of comment button on table view +// */ +// @objc func showComments(_ sender: TableViewCell) { +// +// guard let clickedCell = sender.superview?.superview?.superview?.superview as? TableViewCell else { +// return +// } +// if let clickedCellIndexPath = tableView.indexPath(for: clickedCell) { +// +// tappedIndex = clickedCellIndexPath.row +// +// guard Reachability.isConnectedToNetwork() else { +// self.popUpMessage(value: 15) +// return +// } +// +// self.performSegue(withIdentifier: "showCommentsBy", sender: nil) +// } +// } +// +// /** +// To display alert message for report +// */ +// func reportAlert(postIndex: Int) { +// let alert = UIAlertController(title:nil, message:nil, preferredStyle: .actionSheet) +// +// let feedToReport = self.socialfeedviewmodel.getSocialFeedAt(index: postIndex) +// +// let spam = UIAlertAction(title: "It’s spam", style: .default) { +// UIAlertAction in +// +// self.socialfeedviewmodel.reportSocialFeed(feedId: feedToReport.id, reportMessage: "This is spam") +// +// } +// +// let inappropriate = UIAlertAction(title: "It’s inappropriate", style: .default) { +// UIAlertAction in +// +// self.socialfeedviewmodel.reportSocialFeed(feedId: feedToReport.id, reportMessage: "This is inappropriate") +// } +// +// let cancel = UIAlertAction(title: "Cancel", style: .destructive) { +// UIAlertAction in +// +// } +// alert.addAction(spam) +// alert.addAction(inappropriate) +// alert.addAction(cancel) +// present(alert, animated: true, completion: nil) +// } +// +// /** +// To display alert message after report is send +// */ +// func reportSendAlert() { +// let alert = UIAlertController(title:nil, message:"Your report has been send for review.", preferredStyle: .actionSheet) +// +// let cancel = UIAlertAction(title: "OK", style: .cancel) { +// UIAlertAction in +// +// } +// alert.addAction(cancel) +// present(alert, animated: true, completion: nil) +// +// } +// +// /** +// Update available balance of user +// */ +// func setAvailableBalanceInStringAttributeFormat(label: UILabel){ +// +// var amount = "N/A" +// +// let balance = UserDefaults.standard.object(forKey: "com.gmeremit.balance") as? String +// +// if balance != "N/A" && balance != nil && balance != "" { +// amount = getCommaAddedAmountString(amountString: balance!) +// } +// +// let amountUnit = " USD" +// +// let fontAttribute = [ NSAttributedStringKey.font: UIFont(name: "SanFranciscoDisplay-Regular", size: 18.0)! ] +// +// let amountAttribute = NSMutableAttributedString(string: amount) +// let amountUnitAttribute = NSMutableAttributedString(string: amountUnit,attributes: fontAttribute) +// +// amountUnitAttribute.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor(hex:0x4a4a4a), range: NSRange(location:0, length: amountUnitAttribute.length)) +// +// let balanceAttribute = NSMutableAttributedString() +// +// balanceAttribute.append(amountAttribute) +// balanceAttribute.append(amountUnitAttribute) +// +// label.attributedText = balanceAttribute +// } +//} +// +// +///*---------------MAIN TABLE VIEW------------ +// -----------------HANDLES THEN NUMBER OF CELLS IN TABLEVIEW------------ +// -----------------HANDLES THE NUMBER OF SECTIONS IN TABLEVIEW------------ +// -----------------HANDLES THE SECTION HEIGHT IN TABLEVIEW------------ +//*/ +// +//extension _HomeViewController: UIScrollViewDelegate { +// +// @IBAction func scrollToTop(_ sender: Any) { +// tableView.scrollToRow(at: IndexPath(row:0, section: 0), at: UITableViewScrollPosition.top, animated: true) +// } +// +// func scrollViewDidScroll(_ scrollView: UIScrollView) { +// +// if tableView.indexPathsForVisibleRows!.contains(IndexPath(row: 0, section: 1)) && isTopMenuVisible { +// +// topMenuView.isHidden = true +// tableViewTopConstraint.constant = 0 +// isTopMenuVisible = false +// } +// +// if !tableView.indexPathsForVisibleRows!.contains(IndexPath(row: 0, section: 1)) && !isTopMenuVisible { +// +// setUpTopMenu() +// +// topMenuView.isHidden = false +// tableViewTopConstraint.constant = topMenuView.frame.height +// isTopMenuVisible = true +// } +// +// } +// +// func setUpTopMenu() { +// if let menuIndexArray = UserDefaults.standard.array(forKey: "com.gmeremit.collectionViewMenuIndexArray") as? [Int] { +// buttonMenuItem0.setImage(UIImage(named: collectionViewMenuIconArray[menuIndexArray[0]]!), for: .normal) +// buttonMenuItem0.tag = menuIndexArray[0] +// +// buttonMenuItem1.setImage(UIImage(named: collectionViewMenuIconArray[menuIndexArray[1]]!), for: .normal) +// buttonMenuItem1.tag = menuIndexArray[1] +// +// buttonMenuItem2.setImage(UIImage(named: collectionViewMenuIconArray[menuIndexArray[2]]!), for: .normal) +// buttonMenuItem2.tag = menuIndexArray[2] +// +// labelMenuItem0.text = collectionViewMenuNameArray[menuIndexArray[0]] +// labelMenuItem1.text = collectionViewMenuNameArray[menuIndexArray[1]] +// labelMenuItem2.text = collectionViewMenuNameArray[menuIndexArray[2]] +// +// buttonMenuItem0.addTarget(self, action: #selector(performRedirection(_:)), for: .touchUpInside) +// buttonMenuItem1.addTarget(self, action: #selector(performRedirection(_:)), for: .touchUpInside) +// buttonMenuItem2.addTarget(self, action: #selector(performRedirection(_:)), for: .touchUpInside) +// } +// } +// +// @objc func performRedirection(_ sender: UIButton) { +// +// switch sender.tag { +// +// case 0: +// if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as! Bool) { +// self.performSegue(withIdentifier: "recipientList", sender: nil) +// } else { +// self.popUpMessage(value: 13) +// } +// +// case 1: +// if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as! Bool) { +// self.performSegue(withIdentifier: "mobileRecharge", sender: nil) +// } else { +// self.popUpMessage(value: 13) +// } +// +// case 2: +// self.performSegue(withIdentifier: "todayRate", sender: nil) +// +// case 3: +// self.performSegue(withIdentifier: "trackTransfer", sender: nil) +// +// case 4: +// self.performSegue(withIdentifier: "transactionStatement", sender: nil) +// +// case 5: +// if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as! Bool) { +// self.performSegue(withIdentifier: "walletTransfer", sender: nil) +// } else { +// self.popUpMessage(value: 13) +// } +// +// default: +// return +// } +// } +//} +// +//extension _HomeViewController: UITableViewDelegate, UITableViewDataSource { +// +// +// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { +// guard let index = TableViewCells.init(rawValue: indexPath.section) else {return 0} +// switch index { +// case .balance: +// return 100 +// +// case .collection: +// let widthCell = ((view.frame.width - (insetForCollectionView * 3) ) - 10) / 2 +// let heightForCollectionViewCell = widthCell * (170 / 120) +// if showAllCollectionViewCells! { +// return heightForCollectionViewCell * 1.7 +// } else { +// return heightForCollectionViewCell * 1.151 +// } +// +// case .status: +// tableView.estimatedRowHeight = 100 +// return UITableViewAutomaticDimension +// +// case .social: +// tableView.estimatedRowHeight = 300 +// return UITableViewAutomaticDimension +// +// case .loadMore: +// tableView.estimatedRowHeight = 100 +// return UITableViewAutomaticDimension +// +// default: +// return 0 +// } +// } +// +// func numberOfSections(in tableView: UITableView) -> Int { +// return self.sections.count +// } +// +// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { +// guard let index = TableViewCells.init(rawValue: section) else {return 0} +// switch index { +// case .balance: +// return 1 +// case .collection: +// return 1 +// case .status: +// return 1 +// case .social: +// if allowFetchRequest && self.socialfeedviewmodel.getPublicSocialFeedsCount() == 0 { +// socialfeedviewmodel.fetchSocialFeeds(isPublic: true, loadMore: false) +// allowFetchRequest = false +// return 0 +// } +// return self.socialfeedviewmodel.getPublicSocialFeedsCount() +// +// case .loadMore: +// return 1 +// +// default: +// return 0 +// } +// } +// +// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// +// guard let index = TableViewCells.init(rawValue: indexPath.section) else {return UITableViewCell()} +// +// switch index { +// +// case .balance: +// +// cell = tableView.dequeueReusableCell(withIdentifier: "topCell", for: indexPath) as! TableViewCell +// cell.viewTop.alpha = 1 +// cell.btnRewardPoint.setTitle(UserDefaults.standard.object(forKey: "com.gmeremit.rewardPoint") as? String, for: .normal) +// cell.btnRewardPoint.addTarget(self, action:#selector(rewardTap(_:)), for:.touchUpInside) +// setAvailableBalanceInStringAttributeFormat(label: cell.labelAvailableBalance) +// let nickName = UserDefaults.standard.object(forKey: "com.gmeremit.nickName") as? String +// if nickName == nil || nickName == "" { +// let nameArray = (UserDefaults.standard.object(forKey: "com.gmeremit.fullName") as! String).split(separator: " ") +// if let firstName = nameArray.first { +// cell.labelUsername.text = String(firstName) +// } +// } +// return cell +// +// case .collection: +// +// cell = tableView.dequeueReusableCell(withIdentifier: "collectionCell", for: indexPath) as! TableViewCell +// cell.collectionView.isScrollEnabled = false +// cell.collectionView.dataSource = self +// cell.collectionView.delegate = self +// cell.collectionView.reloadData() +// cell.buttonShowless?.addTarget(self, action:#selector(showLessButtonTap(_:)), for:.touchUpInside) +// +// if showAllCollectionViewCells! { +// cell.buttonShowless.isHidden = false +// +// } else { +// cell.buttonShowless.isHidden = true +// +// } +// cell.collectionView.addGestureRecognizer(longPressGesture) +// +// return cell +// +// case .status: +// +// cell = tableView.dequeueReusableCell(withIdentifier: "statusCell", for: indexPath) as! TableViewCell +// +// +// cell.labelUserNameInitialStatus.isHidden = false +// cell.labelUserNameInitialStatus.backgroundColor = UIColor(hex: 0x2e3192) +// cell.labelUserNameInitialStatus.layer.cornerRadius = cell.labelUserNameInitialStatus.frame.height / 2 +// cell.labelUserNameInitialStatus.text = getFirstName().prefix(1).uppercased() +// +// +// let userDpString = UserDefaults.standard.object(forKey: "com.gmeremit.dpUrl") as? String +// if let userDpUrl = URL(string: userDpString!) { +// +// cell.imageViewUserStatus.isHidden = false +// +// cell.imageViewUserStatus.sd_setImage(with: userDpUrl, placeholderImage: nil, options: [.progressiveDownload,.scaleDownLargeImages], completed: nil) +// +// cell.imageViewUserStatus.layer.cornerRadius = cell.imageViewUserStatus.frame.height/2 +// +// cell.labelUserNameInitialStatus.isHidden = true +// } +// +// cell.buttonUploadStatus.addTarget(self, action: #selector(uploadTextStatus(_:)), for: .touchUpInside) +// cell.buttonUploadImage.addTarget(self, action: #selector(uploadImageStatus(_:)), for: .touchUpInside) +// return cell +// +// case .social: +// +// +// socialfeedviewmodel.setAccessType(accessType: "public") +// +// let socialFeed = self.socialfeedviewmodel.getSocialFeedAt(index:indexPath.row) +// +// if socialFeed.feedText != nil && socialFeed.feedText != "" { +// if socialFeed.feedImageId != nil { +// //CASE 3: text and image +// return self.getTableViewCell(indexPath: indexPath, socialFeed: socialFeed, mode: 3) +// } else { +// //CASE 1: only text +// return self.getTableViewCell(indexPath: indexPath, socialFeed: socialFeed, mode: 1) +// } +// } else { +// //CASE 2: only image +// return self.getTableViewCell(indexPath: indexPath, socialFeed: socialFeed, mode: 2) +// } +// +// +// case .loadMore: +// +// cell = tableView.dequeueReusableCell(withIdentifier: "loadMoreCell", for: indexPath) as! TableViewCell +// +// +// if socialfeedviewmodel.loadMore() { +// cell.buttonLoadMore.addTarget(self, action: #selector(loadMore(_:)), for: .touchUpInside) +// cell.buttonLoadMore.isHidden = false +// } else { +// cell.buttonLoadMore.isHidden = true +// } +// +// return cell +// +// default: +// return cell +// } +// +// } +// +//} +// +// +///*---------------IMAGE RELATED TASKS------------ +// -----------------IMAGE DIALOG------------ +// -----------------GALLERY AND CAMERA ACTION------------*/ +// +//extension _HomeViewController { +// +// func addUserProfileImage(){ +// +// guard let tabController = self.tabBarController else { +// return +// } +// +// self.navigationController?.navigationBar.isUserInteractionEnabled = false +// +// let popUpViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "popUpAddUserProfile") as! PopUpAddUserProfileViewController +// +// tabController.addChildViewController(popUpViewController) +// popUpViewController.view.frame = tabController.view.bounds +// tabController.view.addSubview(popUpViewController.view) +// popUpViewController.didMove(toParentViewController: tabController) +// +// } +// +// +// @objc func showUploadOptions(tapGestureRecognizer: UITapGestureRecognizer) { +// +// let alert = UIAlertController(title: "Choose Image", message: nil, preferredStyle: .actionSheet) +// +// alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { _ in +// self.openCamera() +// })) +// +// alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { _ in +// self.openGallery() +// })) +// +// alert.addAction(UIAlertAction.init(title: "Cancel", style: .destructive, handler: nil)) +// +// self.dismiss(animated: false, completion: nil) +// self.present(alert, animated: true, completion: nil) +// } +// +// func openCamera() { +// if(UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera)) { +// imagePicker.sourceType = UIImagePickerControllerSourceType.camera +// imagePicker.allowsEditing = false +// present(imagePicker, animated: true, completion: nil) +// } +// else { +// let alert = UIAlertController(title: "Warning", message: "You don't have camera", preferredStyle: .alert) +// alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) +// self.present(alert, animated: true, completion: nil) +// } +// } +// +// func openGallery() { +// imagePicker.delegate = self +// imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary +// imagePicker.allowsEditing = false +// +// present(imagePicker, animated: true, completion: nil) +// } +// +//} +// +// +// +///*---------------NAVIGATION PICKER------------ +// -----------------HANDLES IMAGE PICKING------------ +// -----------------HANDLES PICKING FROM CAMERA AND GALLERY------------*/ +// +//extension _HomeViewController: UINavigationControllerDelegate, UIImagePickerControllerDelegate { +// +// func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { +// +// if let image = info[UIImagePickerControllerOriginalImage] as? UIImage { +// +// //imageView.image = image +// +// dismiss(animated: true, completion: nil) +// } +// } +// +// func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { +// dismiss(animated: true, completion: nil) +// } +// +//} +// +// +///*---------------COLLECTION VIEW------------ +//-----------------HANDLES COLLECTION VIEW ITEMS------------ +//-----------------HANDLES COLLECTION VIEW MARGINS------------ +//-----------------HANDLES COLLECTION VIEW ITEMS DRAG------------*/ +// +//extension _HomeViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { +// +// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { +// +// return numberCellsInCollectionView! +// } +// +// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { +// +// let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "transactionCell", for: indexPath) as! TransactionCollectionViewCell +// +// if numberCellsInCollectionView == 4 { +// cell.btnDragNdrop.isHidden = true +// } else { +// cell.btnDragNdrop.isHidden = false +// } +// +// cell.transactionLabel.text = collectionViewMenuNameArray[collectionViewMenuIndexArray[indexPath.row]] +// cell.transactionImageView.image = UIImage(named: collectionViewMenuIconArray[collectionViewMenuIndexArray[indexPath.row]]!) +// +// return cell +// } +// +// func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { +// +// switch collectionViewMenuIndexArray[indexPath.row] { +// +// case 0: +// +// if self.isVerifiedUser() { +// let viewcontroller = UIStoryboard.init(name: "RecipientListViewController", bundle: nil).instantiateViewController(withIdentifier: "RecipientListViewController") as! RecipientListViewController +// self.navigationController?.pushViewController(viewcontroller, animated: true) +// } else { +// self.popUpMessage(value: 13) +// } +// +// case 1: +// self.alert(message: "This feature is coming soon") +// return +// if (UserDefaults.standard.object(forKey: "com.gmeremit.isVerified") as? Bool ?? false) { +// self.performSegue(withIdentifier: "mobileRecharge", sender: nil) +// } else { +// self.popUpMessage(value: 13) +// } +// +// case 2: +// let exchangeRateWireFrame = ExchangeRatesWireframe() +// if let navigation = self.navigationController { +// exchangeRateWireFrame.pushMainView(in: navigation) +// } +// case 3: +// self.performSegue(withIdentifier: "trackTransfer", sender: nil) +// +// case 4: +// let wireframe = TransactionHistoryWireframe() +// if let navigation = self.navigationController { +// wireframe.pushMainView(in: navigation) +// } +// +// +// case 5: +// self.alert(message: "This feature is coming soon") +// return +// +// case 6: +// showAllCollectionViewCells = true +// numberCellsInCollectionView = 6 +// /* Send MORE button to the last position by switching it with the 4th item in the menu" */ +// collectionViewMenuIndexArray.swapAt(3, 6) +// tableView.reloadSections(NSIndexSet(index: 1) as IndexSet, with: .none) +// +// default: +// return +// } +// } +// +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { +// +// return UIEdgeInsetsMake(insetForCollectionView, insetForCollectionView, insetForCollectionView, insetForCollectionView) +// } +// +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { +// +// return insetForCollectionView +// } +// +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { +// +// return insetForCollectionView +// } +// +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { +// +// let itemWidth = (collectionView.frame.width - insetForCollectionView * 2 - insetForCollectionView) / collectionViewItemsPerRow +// +// return CGSize(width: itemWidth, height: itemWidth * 120/170) +// } +// +// func collectionView(_ collectionView: UICollectionView, canMoveItemAt indexPath: IndexPath) -> Bool { +// if numberCellsInCollectionView! > 4 { +// return true +// } else { +// return false +// } +// } +// +// func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { +// +// //collectionViewMenuIndexArray.swapAt(sourceIndexPath.row, destinationIndexPath.row) +// +// let elemetToMove = collectionViewMenuIndexArray[sourceIndexPath.row] +// collectionViewMenuIndexArray.remove(at: sourceIndexPath.row) +// +// collectionViewMenuIndexArray.insert(elemetToMove, at: destinationIndexPath.row) +// +// +// /* Save the user's swapped menu to be loaded next time the app is resumed */ +// UserDefaults.standard.set(collectionViewMenuIndexArray, forKey: "com.gmeremit.collectionViewMenuIndexArray") +// +// tableView.reloadSections(NSIndexSet(index: 1) as IndexSet, with: .none) +// } +// +// @objc func handleLongGesture(gesture: UILongPressGestureRecognizer) { +// +// if let tappedCollectionView = gesture.view as? UICollectionView { +// +// switch(gesture.state) { +// +// case .began: +// guard let selectedIndexPath = tappedCollectionView.indexPathForItem(at: gesture.location(in: tappedCollectionView)) else { +// break +// } +// tappedCollectionView.beginInteractiveMovementForItem(at: selectedIndexPath) +// case .changed: +// tappedCollectionView.updateInteractiveMovementTargetPosition(gesture.location(in: gesture.view!)) +// case .ended: +// tappedCollectionView.endInteractiveMovement() +// default: +// tappedCollectionView.cancelInteractiveMovement() +// } +// } +// } +// +// @objc func showLessButtonTap(_ sender: TableViewCell) { +// showAllCollectionViewCells = false +// numberCellsInCollectionView = 4 +// /* Bring MORE button to the 4th position by switching it with the last item in the menu" */ +// collectionViewMenuIndexArray.swapAt(3, 6) +// tableView.reloadSections(NSIndexSet(index: 1) as IndexSet, with: .none) +// +// } +// +// override func didReceiveMemoryWarning() { +// super.didReceiveMemoryWarning() +// } +// +// override func viewDidDisappear(_ animated: Bool) { +// //RestApiMananger.sharedInstance.cancelExistingNetworkCalls() +// } +//} +//