├── .gitignore ├── AUTHORS ├── LICENSE ├── README.md └── ReceptionApp ├── Podfile ├── Podfile.lock ├── ReceptionApp.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── ReceptionApp.xcworkspace └── contents.xcworkspacedata ├── ReceptionApp ├── Airprint │ ├── BRAPrintPageRenderer.h │ ├── BRAPrintPageRenderer.m │ ├── BRAPrintPaper.h │ ├── BRAPrintPaper.m │ ├── BRAPrinter.h │ ├── BRAPrinter.m │ ├── BRAPrinterController.h │ └── BRAPrinterController.m ├── BRAAppDelegate.h ├── BRAAppDelegate.m ├── Base.lproj │ └── LaunchScreen.xib ├── Categories │ ├── Colors │ │ ├── UIColor+ComplementaryColors.h │ │ └── UIColor+ComplementaryColors.m │ ├── NSDate+TodayDay.h │ ├── NSDate+TodayDay.m │ ├── NSString+EmailValidity.h │ ├── NSString+EmailValidity.m │ ├── UIColor+HexAdditions.h │ ├── UIFont+CorporateFont.h │ ├── UIFont+CorporateFont.m │ ├── UITextField+TextInsets.h │ └── UITextField+TextInsets.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── badoo_blue.png │ │ └── badoo_blue@2x.png │ ├── badgeLine.imageset │ │ ├── Contents.json │ │ ├── badgeLine.png │ │ └── badgeLine@2x.png │ ├── badooBadgeLogo.imageset │ │ ├── Contents.json │ │ ├── badooBadgeLogo.png │ │ └── badooBadgeLogo@2x.png │ ├── check.imageset │ │ ├── Contents.json │ │ ├── check.png │ │ └── check@2x.png │ ├── checkAgreement.imageset │ │ ├── Contents.json │ │ ├── checkAgreement.png │ │ └── checkAgreement@2x.png │ ├── checkGray.imageset │ │ ├── Contents.json │ │ ├── checkGray.png │ │ └── checkGray@2x.png │ ├── drawing.imageset │ │ ├── Contents.json │ │ ├── drawing.png │ │ └── drawing@2x.png │ ├── headerLine.imageset │ │ ├── Contents.json │ │ ├── headerLine.png │ │ └── headerLine@2x.png │ ├── photo.imageset │ │ ├── Contents.json │ │ ├── photo.png │ │ └── photo@2x.png │ ├── retryAgreement.imageset │ │ ├── Contents.json │ │ ├── retryAgreement.png │ │ └── retryAgreement@2x.png │ ├── returnArrow.imageset │ │ ├── Contents.json │ │ ├── returnArrow.png │ │ └── returnArrow@2x.png │ ├── sample_badoo_logo_big.imageset │ │ ├── Contents.json │ │ └── sample_badoo_logo_big.png │ ├── sample_ok.imageset │ │ ├── Contents.json │ │ └── sample_ok.png │ ├── sample_photo.imageset │ │ ├── Contents.json │ │ └── sample_photo.png │ └── sample_redo.imageset │ │ ├── Contents.json │ │ └── sample_redo.png ├── Info.plist ├── Mail │ ├── BRAMailManager.h │ └── BRAMailManager.m ├── Model │ ├── BRAEmployee+DictionarySupport.h │ ├── BRAEmployee+DictionarySupport.m │ ├── BRAEmployee.h │ ├── BRAEmployee.m │ ├── BRAPerson.h │ ├── BRAPerson.m │ ├── BRASearchEmployeesDataSource.h │ ├── BRASearchEmployeesDataSource.m │ ├── BRASearchProviderProtocol.h │ ├── BRAVisitor.h │ └── BRAVisitor.m ├── Operations │ ├── BRAEmployeesDownloader.h │ ├── BRAEmployeesDownloader.m │ ├── BRAPDFRenderOperation.h │ └── BRAPDFRenderOperation.m ├── PrefixHeader.pch ├── Repository │ ├── BRARepository+VisitorAdditions.h │ ├── BRARepository+VisitorAdditions.m │ ├── BRARepository.h │ ├── BRARepository.m │ └── BRARepositoryProtocol.h ├── Resources │ ├── Agreement.html │ ├── Localizable.strings │ └── SampleEmployeeFile.json ├── SettingsManager │ ├── BRARepository+Settings.h │ ├── BRARepository+Settings.m │ ├── BRASettingsManager.h │ └── BRASettingsManager.m ├── SigninFlow │ ├── BRASigninFlow.h │ └── BRASigninFlow.m ├── UpdatesService │ ├── BRAEmployeesUpdater.h │ ├── BRAEmployeesUpdater.m │ ├── BRAEventHandlerProtocol.h │ ├── BRAExpiredObjectsCleaner.h │ ├── BRAExpiredObjectsCleaner.m │ ├── BRAPeriodicEventsService.h │ └── BRAPeriodicEventsService.m ├── ViewControllers │ ├── AgreementViewController │ │ ├── BRAAgreementViewController.h │ │ ├── BRAAgreementViewController.m │ │ └── BRAAgreementViewController.xib │ ├── Animators │ │ ├── BRAAnimator.h │ │ ├── BRAAnimator.m │ │ ├── BRAPopAnimator.h │ │ ├── BRAPopAnimator.m │ │ ├── BRAPushAnimator.h │ │ └── BRAPushAnimator.m │ ├── BadgeViewController │ │ ├── BRABadgeViewController.h │ │ ├── BRABadgeViewController.m │ │ └── BRABadgeViewController.xib │ ├── FormViewController │ │ ├── BRAFormViewController.h │ │ ├── BRAFormViewController.m │ │ └── BRAFormViewController.xib │ ├── MainViewController │ │ ├── BRAMainViewController.h │ │ ├── BRAMainViewController.m │ │ └── BRAMainViewController.xib │ ├── SearchTableViewController │ │ ├── BRASearchTableViewController.h │ │ ├── BRASearchTableViewController.m │ │ ├── BRASearchTableViewController.xib │ │ └── View │ │ │ ├── BRASearchTableViewCell+Employee.h │ │ │ ├── BRASearchTableViewCell+Employee.m │ │ │ ├── BRASearchTableViewCell.h │ │ │ └── BRASearchTableViewCell.m │ ├── SettignsViewController │ │ ├── BRASettingsViewController.h │ │ ├── BRASettingsViewController.m │ │ └── BRASettingsViewController.xib │ ├── SignInViewController │ │ ├── BRASignInViewController.h │ │ ├── BRASignInViewController.m │ │ └── BRASignInViewController.xib │ ├── SignOutViewController │ │ ├── BRASignOutViewController.h │ │ ├── BRASignOutViewController.m │ │ ├── BRASignOutViewController.xib │ │ ├── Flow │ │ │ ├── BRAVisitorSelectedFlowLayout.h │ │ │ └── BRAVisitorSelectedFlowLayout.m │ │ └── View │ │ │ ├── BRASelectNamesView.h │ │ │ ├── BRASelectNamesView.m │ │ │ └── BRASelectNamesView.xib │ ├── SingoutViewController │ │ ├── BRASignoutCollectionDataSource.h │ │ ├── BRASignoutCollectionDataSource.m │ │ └── View │ │ │ ├── BRASignoutCollectionCell.h │ │ │ └── BRASignoutCollectionCell.m │ ├── UIViewController+Factory │ │ ├── UIViewController+Factory.h │ │ └── UIViewController+Factory.m │ └── WebViewController │ │ ├── BRAWebViewController.h │ │ ├── BRAWebViewController.m │ │ └── BRAWebViewController.xib └── main.m └── ReceptionAppTests ├── Info.plist └── ReceptionAppTests.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | 26 | Pods/ 27 | 28 | # AppCode 29 | .idea/ -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # Names should be added to this file like so: 2 | # Name or Organization 3 | 4 | Anton Terekhov 5 | Joan Molinas 6 | 7 | &yet LLC 8 | Badoo -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Badoo Development 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### About 2 | 3 | We use `ReceptionApp` internally for tracking visitors in our office. 4 | It allows easy sign-in and sign-out functionality with additional following features: 5 | 6 | * Visitors are required to input personal information, like name, company, employee they came to see. 7 | * Visitors are required to sign "*Visitor agreement*" (creating a signature with a fingure). *Pdf with agreement, visitor name and signature will be generated later in the process*. 8 | * This data is sent to receptionist's email. 9 | * Badge is printed via AirPrint. 10 | * List of employees is fetched from URL, images are supported too. 11 | * Report of currently signed-in visitor can be generated. 12 | * Each morning automatic report is generated stating visitors who signed-in yesterday but haven't signed-out. 13 | 14 | ## How to configure 15 | 16 | 1. Fork the repo and run `pod install` 17 | 2. Change the link to the list of employees (in `BRASettingsManager`). An example json can be found in `SampleEmployeeFile.json` 18 | 3. Once installed on device go to **settings** (*double tap on the logo on top of the screen*) 19 | * Change pin code from default `0000`. 20 | * Specify email accounts (one to receive info about visitors, and one for the iPad itself). 21 | * Choose printer. 22 | 23 | ##### You also might want to change 24 | 25 | * Logo image 26 | * Visitor agreement 27 | 28 | 29 | ### License 30 | Source code is distributed under MIT license. 31 | 32 | ### Blog 33 | Read more at [techblog.badoo.com](https://techblog.badoo.com) -------------------------------------------------------------------------------- /ReceptionApp/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '8.0' 2 | 3 | target 'ReceptionApp' do 4 | pod 'JMBackgroundCameraView', :git => 'https://github.com/ulidev/JMBackgroundCameraView.git' 5 | pod 'SignatureView', :git => 'https://github.com/terekhovanton/SignatureView.git' 6 | pod 'mailcore2-ios', '~> 0.5.1' 7 | pod 'YapDatabase', '~> 2.4' 8 | pod 'libextobjc', '~> 0.4.1' 9 | pod 'Haneke', '~> 1.0' 10 | end 11 | 12 | target 'ReceptionAppTests' do 13 | 14 | end 15 | 16 | -------------------------------------------------------------------------------- /ReceptionApp/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CocoaLumberjack (2.0.1): 3 | - CocoaLumberjack/Default (= 2.0.1) 4 | - CocoaLumberjack/Extensions (= 2.0.1) 5 | - CocoaLumberjack/Core (2.0.1) 6 | - CocoaLumberjack/Default (2.0.1): 7 | - CocoaLumberjack/Core 8 | - CocoaLumberjack/Extensions (2.0.1): 9 | - CocoaLumberjack/Default 10 | - Haneke (1.0.1) 11 | - JMBackgroundCameraView (1.0) 12 | - libextobjc (0.4.1): 13 | - libextobjc/EXTADT (= 0.4.1) 14 | - libextobjc/EXTConcreteProtocol (= 0.4.1) 15 | - libextobjc/EXTKeyPathCoding (= 0.4.1) 16 | - libextobjc/EXTNil (= 0.4.1) 17 | - libextobjc/EXTSafeCategory (= 0.4.1) 18 | - libextobjc/EXTScope (= 0.4.1) 19 | - libextobjc/EXTSelectorChecking (= 0.4.1) 20 | - libextobjc/EXTSynthesize (= 0.4.1) 21 | - libextobjc/NSInvocation+EXT (= 0.4.1) 22 | - libextobjc/NSMethodSignature+EXT (= 0.4.1) 23 | - libextobjc/RuntimeExtensions (= 0.4.1) 24 | - libextobjc/UmbrellaHeader (= 0.4.1) 25 | - libextobjc/EXTADT (0.4.1): 26 | - libextobjc/RuntimeExtensions 27 | - libextobjc/EXTConcreteProtocol (0.4.1): 28 | - libextobjc/RuntimeExtensions 29 | - libextobjc/EXTKeyPathCoding (0.4.1): 30 | - libextobjc/RuntimeExtensions 31 | - libextobjc/EXTNil (0.4.1): 32 | - libextobjc/RuntimeExtensions 33 | - libextobjc/EXTSafeCategory (0.4.1): 34 | - libextobjc/RuntimeExtensions 35 | - libextobjc/EXTScope (0.4.1): 36 | - libextobjc/RuntimeExtensions 37 | - libextobjc/EXTSelectorChecking (0.4.1): 38 | - libextobjc/RuntimeExtensions 39 | - libextobjc/EXTSynthesize (0.4.1): 40 | - libextobjc/RuntimeExtensions 41 | - libextobjc/NSInvocation+EXT (0.4.1): 42 | - libextobjc/RuntimeExtensions 43 | - libextobjc/NSMethodSignature+EXT (0.4.1): 44 | - libextobjc/RuntimeExtensions 45 | - libextobjc/RuntimeExtensions (0.4.1) 46 | - libextobjc/UmbrellaHeader (0.4.1) 47 | - mailcore2-ios (0.5.1) 48 | - SignatureView (1.0) 49 | - YapDatabase (2.7.1): 50 | - YapDatabase/standard (= 2.7.1) 51 | - YapDatabase/standard (2.7.1): 52 | - CocoaLumberjack (~> 2) 53 | 54 | DEPENDENCIES: 55 | - Haneke (~> 1.0) 56 | - JMBackgroundCameraView (from `https://github.com/ulidev/JMBackgroundCameraView.git`) 57 | - libextobjc (~> 0.4.1) 58 | - mailcore2-ios (~> 0.5.1) 59 | - SignatureView (from `https://github.com/terekhovanton/SignatureView.git`) 60 | - YapDatabase (~> 2.4) 61 | 62 | EXTERNAL SOURCES: 63 | JMBackgroundCameraView: 64 | :git: https://github.com/ulidev/JMBackgroundCameraView.git 65 | SignatureView: 66 | :git: https://github.com/terekhovanton/SignatureView.git 67 | 68 | CHECKOUT OPTIONS: 69 | JMBackgroundCameraView: 70 | :commit: bbdda5a57e82cc06b4c15476fb7aa2c64b5243f6 71 | :git: https://github.com/ulidev/JMBackgroundCameraView.git 72 | SignatureView: 73 | :commit: 60b17efb46dd4e8b5d3aa38d23564edb42f10faa 74 | :git: https://github.com/terekhovanton/SignatureView.git 75 | 76 | SPEC CHECKSUMS: 77 | CocoaLumberjack: 019d1361244274a6138c788c6cb80baabc13fb8f 78 | Haneke: d60be8b96b228633b24708dd153169d6849d6f78 79 | JMBackgroundCameraView: 981ae4fffeae7fff06b9198930468fe37f8a2eaa 80 | libextobjc: a650fc1bf489a3d3a9bc2e621efa3e1006fc5471 81 | mailcore2-ios: f1c1cd3c91d8963293b6552ad11bf3c7cf8ef8a9 82 | SignatureView: a934552b22cf9d6f07cb25cecb85a4236740fbb6 83 | YapDatabase: e9ff9a189e99268a331575411e8462e4c6df2bc3 84 | 85 | COCOAPODS: 0.37.2 86 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrintPageRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAPrintPageRenderer : UIPrintPageRenderer 26 | 27 | @property (strong, nonatomic) UIImage *image; 28 | 29 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrintPageRenderer.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAPrintPageRenderer.h" 26 | 27 | @implementation BRAPrintPageRenderer 28 | 29 | - (void)drawPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)printableRect { 30 | CGSize imageSize = self.image.size; 31 | CGRect newRect = [self aspectFitRectFrom:printableRect forImageSize:imageSize]; 32 | [self.image drawInRect:newRect]; 33 | } 34 | 35 | - (CGRect)aspectFitRectFrom:(CGRect)printableRect forImageSize:(CGSize)imageSize { 36 | CGSize viewSize = printableRect.size; // size in which you want to draw 37 | 38 | CGFloat hfactor = imageSize.width / viewSize.width; 39 | CGFloat vfactor = imageSize.height / viewSize.height; 40 | 41 | CGFloat factor = MAX(hfactor, vfactor); 42 | 43 | // Divide the size by the greater of the vertical or horizontal shrinkage factor 44 | CGFloat newWidth = imageSize.width / factor; 45 | CGFloat newHeight = imageSize.height / factor; 46 | 47 | CGFloat xOffset = CGRectGetMidX(printableRect) - newWidth / 2; 48 | CGFloat yOffset = CGRectGetMidY(printableRect) - newHeight / 2; 49 | CGRect newRect = CGRectMake(xOffset, yOffset, newWidth, newHeight); 50 | return newRect; 51 | } 52 | 53 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrintPaper.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAPrintPaper : UIPrintPaper 26 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrintPaper.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAPrintPaper.h" 26 | 27 | #define POINTS_PER_INCH 72 28 | 29 | @implementation BRAPrintPaper 30 | 31 | - (CGSize)paperSize { 32 | return CGSizeMake(2 * POINTS_PER_INCH, 4 * POINTS_PER_INCH); 33 | } 34 | 35 | - (CGRect)printableRect { 36 | return CGRectMake(0.0f, 0.0f, 2 * POINTS_PER_INCH, 4 * POINTS_PER_INCH); 37 | } 38 | 39 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrinter.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAPrinter : UIPrinter 26 | 27 | + (instancetype)printer; 28 | + (void)savePrinterURL:(NSURL *)url; 29 | 30 | - (void)printBadgeImage:(UIImage *)badgeImage; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrinter.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAPrinter.h" 26 | #import "BRAPrintPageRenderer.h" 27 | #import "BRAPrintPaper.h" 28 | 29 | @interface BRAPrinter () 30 | @property (strong, nonatomic) UIPrintInteractionController *printInteractionController; 31 | @end 32 | 33 | @implementation BRAPrinter 34 | 35 | #pragma mark - staticIdentifiers 36 | 37 | + (instancetype)printer { 38 | NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; 39 | return (BRAPrinter *) [BRAPrinter printerWithURL:[ud URLForKey:[self printerUserDefaultsIdentifier]]]; 40 | } 41 | 42 | + (void)savePrinterURL:(NSURL *)url { 43 | NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; 44 | [ud setURL:url forKey:[self printerUserDefaultsIdentifier]]; 45 | [ud synchronize]; 46 | } 47 | 48 | + (NSString *)printerUserDefaultsIdentifier { 49 | return @"printerBonjourIdentifier"; 50 | } 51 | 52 | - (void)dealloc { 53 | _printInteractionController.delegate = nil; 54 | } 55 | 56 | - (void)printBadgeImage:(UIImage *)badgeImage { 57 | if ([BRAPrinter printer].URL) { 58 | UIPrintInteractionController *interactionController = [UIPrintInteractionController sharedPrintController]; 59 | interactionController.delegate = self; 60 | 61 | UIPrintInfo *printInfo = [UIPrintInfo printInfo]; 62 | printInfo.outputType = UIPrintInfoOutputPhoto; 63 | printInfo.jobName = NSLocalizedString(@"Contact reception for your badge", nil); 64 | interactionController.printInfo = printInfo; 65 | 66 | UIPrintFormatter *formatter = [[UIPrintFormatter alloc] init]; 67 | formatter.contentInsets = UIEdgeInsetsZero; 68 | formatter.perPageContentInsets = UIEdgeInsetsZero; 69 | interactionController.printFormatter = formatter; 70 | 71 | BRAPrintPageRenderer *renderer = [BRAPrintPageRenderer new]; 72 | renderer.image = badgeImage; 73 | interactionController.printPageRenderer = renderer; 74 | 75 | [interactionController printToPrinter:[BRAPrinter printer] completionHandler:nil]; 76 | } 77 | } 78 | 79 | #pragma mark - UIPrintInteractionControllerDelegate 80 | 81 | - (UIPrintPaper *)printInteractionController:(UIPrintInteractionController *)printInteractionController choosePaper:(NSArray *)paperList { 82 | return [BRAPrintPaper new]; 83 | } 84 | 85 | - (void)printInteractionControllerDidFinishJob:(UIPrintInteractionController *)printInteractionController { 86 | self.printInteractionController.delegate = nil; 87 | self.printInteractionController = nil; 88 | } 89 | 90 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrinterController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAPrinterController : UIPrinterPickerController 26 | 27 | + (UIPrinterPickerController *)printerPickerController; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Airprint/BRAPrinterController.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAPrinterController.h" 26 | #import "BRAPrinter.h" 27 | 28 | @implementation BRAPrinterController 29 | 30 | + (UIPrinterPickerController *)printerPickerController { 31 | return [self printerPickerControllerWithInitiallySelectedPrinter:[BRAPrinter printer]]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/BRAAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAAppDelegate : UIResponder 26 | 27 | @property (strong, nonatomic) UIWindow *window; 28 | 29 | @end 30 | 31 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/BRAAppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAAppDelegate.h" 26 | #import "BRAMainViewController.h" 27 | #import "UIViewController+Factory.h" 28 | #import "BRAEmployeesDownloader.h" 29 | #import "BRAPeriodicEventsService.h" 30 | #import "BRAEmployeesUpdater.h" 31 | #import "BRAExpiredObjectsCleaner.h" 32 | 33 | @interface BRAAppDelegate () 34 | @end 35 | 36 | @implementation BRAAppDelegate 37 | 38 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 39 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 40 | [self loadMainViewController]; 41 | [self.window makeKeyAndVisible]; 42 | 43 | [BRAEmployeesDownloader updateEmployees]; 44 | [self setupPeriodicEventsService]; 45 | 46 | return YES; 47 | } 48 | 49 | - (void)setupPeriodicEventsService { 50 | [[BRAPeriodicEventsService sharedInstance] registerEventHandler:[BRAEmployeesUpdater new]]; 51 | [[BRAPeriodicEventsService sharedInstance] registerEventHandler:[BRAExpiredObjectsCleaner new]]; 52 | } 53 | 54 | - (void)loadMainViewController { 55 | BRAMainViewController *mainViewController = [BRAMainViewController bra_controller]; 56 | [self.window addSubview:mainViewController.view]; 57 | self.window.rootViewController = mainViewController; 58 | } 59 | 60 | - (void)applicationWillResignActive:(UIApplication *)application { 61 | [[UIApplication sharedApplication] setIdleTimerDisabled:NO]; 62 | } 63 | 64 | - (void)applicationDidBecomeActive:(UIApplication *)application { 65 | [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/Colors/UIColor+ComplementaryColors.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface UIColor (ComplementaryColors) 26 | 27 | + (UIColor *)bra_corporateGreen; 28 | + (UIColor *)bra_corporateBlue; 29 | + (UIColor *)bra_corporateGray; 30 | + (UIColor *)bra_corporateRed; 31 | + (UIColor *)bra_corporateDarkGray; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/Colors/UIColor+ComplementaryColors.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "UIColor+ComplementaryColors.h" 26 | #import "UIColor+HexAdditions.h" 27 | 28 | @implementation UIColor (ComplementaryColors) 29 | 30 | + (UIColor *)bra_corporateGreen { 31 | return [UIColor colorWithRed:112/255.0f green:183/255.0f blue:76/255.0f alpha:1]; 32 | } 33 | 34 | + (UIColor *)bra_corporateBlue { 35 | return UIColorFromRGB(0x7da3cf); 36 | } 37 | 38 | + (UIColor *)bra_corporateGray { 39 | return UIColorFromRGB(0xF9F9FC); 40 | } 41 | 42 | + (UIColor *)bra_corporateRed { 43 | return UIColorFromRGB(0xF15C22); 44 | } 45 | 46 | + (UIColor *)bra_corporateDarkGray { 47 | return UIColorFromRGB(0xcdcdcd); 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/NSDate+TodayDay.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface NSDate (Day) 26 | 27 | - (NSInteger)bra_day; 28 | - (NSInteger)bra_hour; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/NSDate+TodayDay.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "NSDate+TodayDay.h" 26 | 27 | @implementation NSDate (Day) 28 | 29 | - (NSInteger)bra_day { 30 | NSCalendar *calendar = [NSCalendar currentCalendar]; 31 | NSDateComponents *components = [calendar components:NSCalendarUnitDay fromDate:self]; 32 | return [components day]; 33 | } 34 | 35 | - (NSInteger)bra_hour { 36 | NSCalendar *calendar = [NSCalendar currentCalendar]; 37 | NSDateComponents *components = [calendar components:NSCalendarUnitHour fromDate:self]; 38 | return [components hour]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/NSString+EmailValidity.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface NSString (EmailValidity) 26 | 27 | - (BOOL)bra_isValidEmailAddress; 28 | 29 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/NSString+EmailValidity.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "NSString+EmailValidity.h" 26 | 27 | @implementation NSString (EmailValidity) 28 | 29 | - (BOOL)bra_isValidEmailAddress { 30 | BOOL stricterFilter = NO; // Discussion http://blog.logichigh.com/2010/09/02/validating-an-e-mail-address/ 31 | NSString *stricterFilterString = @"^[A-Z0-9a-z\\._%+-]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,4}$"; 32 | NSString *laxString = @"^.+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2}[A-Za-z]*$"; 33 | NSString *emailRegex = stricterFilter ? stricterFilterString : laxString; 34 | NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; 35 | return [emailTest evaluateWithObject:self]; 36 | } 37 | 38 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/UIColor+HexAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #define UIColorFromRGB(rgbValue) \ 26 | [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ 27 | green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \ 28 | blue:((float)((rgbValue & 0x0000FF) >> 0))/255.0 \ 29 | alpha:1.0] 30 | 31 | #define UIColorFromRGBWithAlpha(rgbValue,a) \ 32 | [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ 33 | green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \ 34 | blue:((float)((rgbValue & 0x0000FF) >> 0))/255.0 \ 35 | alpha:a] 36 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/UIFont+CorporateFont.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface UIFont (CorporateFont) 26 | 27 | + (UIFont *)bra_corporateFontWithSize:(CGFloat)size; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/UIFont+CorporateFont.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "UIFont+CorporateFont.h" 26 | 27 | @implementation UIFont (CorporateFont) 28 | 29 | + (UIFont *)bra_corporateFontWithSize:(CGFloat)size { 30 | return [UIFont systemFontOfSize:size]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/UITextField+TextInsets.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface UITextField (TextInsets) 26 | 27 | - (void)bra_insetTextByPoints:(NSUInteger)pointsToInset; 28 | 29 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Categories/UITextField+TextInsets.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "UITextField+TextInsets.h" 26 | 27 | @implementation UITextField (TextInsets) 28 | 29 | - (void)bra_insetTextByPoints:(NSUInteger)pointsToInset { 30 | UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, pointsToInset, self.frame.size.height)]; 31 | leftView.backgroundColor = self.backgroundColor; 32 | self.leftView = leftView; 33 | self.leftViewMode = UITextFieldViewModeAlways; 34 | } 35 | 36 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "size" : "29x29", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "size" : "29x29", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "40x40", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "40x40", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "size" : "76x76", 25 | "idiom" : "ipad", 26 | "filename" : "badoo_blue.png", 27 | "scale" : "1x" 28 | }, 29 | { 30 | "size" : "76x76", 31 | "idiom" : "ipad", 32 | "filename" : "badoo_blue@2x.png", 33 | "scale" : "2x" 34 | } 35 | ], 36 | "info" : { 37 | "version" : 1, 38 | "author" : "xcode" 39 | } 40 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/AppIcon.appiconset/badoo_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/AppIcon.appiconset/badoo_blue.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/AppIcon.appiconset/badoo_blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/AppIcon.appiconset/badoo_blue@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/badgeLine.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "badgeLine.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "badgeLine@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/badgeLine.imageset/badgeLine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/badgeLine.imageset/badgeLine.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/badgeLine.imageset/badgeLine@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/badgeLine.imageset/badgeLine@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/badooBadgeLogo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "badooBadgeLogo.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "badooBadgeLogo@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/badooBadgeLogo.imageset/badooBadgeLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/badooBadgeLogo.imageset/badooBadgeLogo.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/badooBadgeLogo.imageset/badooBadgeLogo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/badooBadgeLogo.imageset/badooBadgeLogo@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/check.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "check.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "check@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/check.imageset/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/check.imageset/check.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/check.imageset/check@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/check.imageset/check@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/checkAgreement.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "checkAgreement.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "checkAgreement@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/checkAgreement.imageset/checkAgreement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/checkAgreement.imageset/checkAgreement.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/checkAgreement.imageset/checkAgreement@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/checkAgreement.imageset/checkAgreement@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/checkGray.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "checkGray.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "checkGray@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/checkGray.imageset/checkGray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/checkGray.imageset/checkGray.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/checkGray.imageset/checkGray@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/checkGray.imageset/checkGray@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/drawing.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "drawing.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "drawing@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/drawing.imageset/drawing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/drawing.imageset/drawing.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/drawing.imageset/drawing@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/drawing.imageset/drawing@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/headerLine.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "headerLine.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "headerLine@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/headerLine.imageset/headerLine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/headerLine.imageset/headerLine.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/headerLine.imageset/headerLine@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/headerLine.imageset/headerLine@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/photo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "photo.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "photo@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/photo.imageset/photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/photo.imageset/photo.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/photo.imageset/photo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/photo.imageset/photo@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/retryAgreement.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "retryAgreement.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "retryAgreement@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/retryAgreement.imageset/retryAgreement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/retryAgreement.imageset/retryAgreement.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/retryAgreement.imageset/retryAgreement@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/retryAgreement.imageset/retryAgreement@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/returnArrow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "returnArrow.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "returnArrow@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/returnArrow.imageset/returnArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/returnArrow.imageset/returnArrow.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/returnArrow.imageset/returnArrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/returnArrow.imageset/returnArrow@2x.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_badoo_logo_big.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "sample_badoo_logo_big.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_badoo_logo_big.imageset/sample_badoo_logo_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/sample_badoo_logo_big.imageset/sample_badoo_logo_big.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_ok.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "sample_ok.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_ok.imageset/sample_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/sample_ok.imageset/sample_ok.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_photo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "sample_photo.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_photo.imageset/sample_photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/sample_photo.imageset/sample_photo.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_redo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "sample_redo.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Images.xcassets/sample_redo.imageset/sample_redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badoo/ReceptionApp/63c94dcdc7fd6d8597cd7a0ccccebdd2456171f0/ReceptionApp/ReceptionApp/Images.xcassets/sample_redo.imageset/sample_redo.png -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.badoo.Badoo.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Mail/BRAMailManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @class BRAVisitor; 26 | 27 | @interface BRAMailManager : NSObject 28 | 29 | + (BOOL)canSendEmail; 30 | 31 | + (void)sendEmailWithVisitor:(BRAVisitor *)visitor badgeImage:(UIImage *)badgeImage; 32 | + (void)sendSignInReportWithVisitors:(NSArray *)signinVisitors; 33 | + (void)sendSignedOutEmailWithVisitor:(BRAVisitor *)visitor; 34 | 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAEmployee+DictionarySupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEmployee.h" 26 | 27 | @interface BRAEmployee (DictionarySupport) 28 | 29 | + (instancetype)employeeWithDictionary:(NSDictionary *)JSONDictionary; 30 | 31 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAEmployee+DictionarySupport.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEmployee+DictionarySupport.h" 26 | 27 | @implementation BRAEmployee (DictionarySupport) 28 | 29 | + (NSString *)imageURLKey { 30 | return @"image_url"; 31 | } 32 | 33 | + (NSString *)surnameKey { 34 | return @"surname"; 35 | } 36 | 37 | + (NSString *)nameKey { 38 | return @"name"; 39 | } 40 | 41 | + (NSString *)emailKey { 42 | return @"email"; 43 | } 44 | 45 | + (instancetype)employeeWithDictionary:(NSDictionary *)JSONDictionary { 46 | NSString *name = JSONDictionary[[self nameKey]]; 47 | NSString *surname = JSONDictionary[[self surnameKey]]; 48 | NSString *email = JSONDictionary[[self emailKey]]; 49 | NSString *imageURLString = JSONDictionary[[self imageURLKey]]; 50 | 51 | BRAEmployee *employee = [BRAEmployee new]; 52 | employee.name = name; 53 | employee.surname = surname; 54 | employee.email = email; 55 | employee.imageURL = [NSURL URLWithString:imageURLString]; 56 | 57 | return employee; 58 | } 59 | 60 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAEmployee.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRARepositoryProtocol.h" 26 | #import "BRAPerson.h" 27 | 28 | @interface BRAEmployee : BRAPerson 29 | 30 | @property (nonatomic, copy) NSURL *imageURL; 31 | 32 | @end 33 | 34 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAEmployee.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEmployee.h" 26 | 27 | @implementation BRAEmployee 28 | 29 | #pragma mark - BRARepositoryProtocol 30 | 31 | + (NSString *)version { 32 | return @"1.0"; 33 | } 34 | 35 | - (NSString *)key { 36 | NSString *allInfo = [NSString stringWithFormat:@"%@%@%@", self.name, self.surname, self.imageURL]; 37 | NSString *key = [NSString stringWithFormat:@"%lu", (unsigned long)[allInfo hash]]; 38 | return key; 39 | } 40 | 41 | - (BOOL)isExpired { 42 | return NO; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAPerson.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAPerson : NSObject 26 | 27 | @property (nonatomic, copy) NSString *name; 28 | @property (nonatomic, copy) NSString *surname; 29 | @property (nonatomic, copy) NSString *email; 30 | 31 | @end 32 | 33 | @interface BRAPerson (BRAConvenience) 34 | - (NSString *)nameAndSurname; 35 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAPerson.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAPerson.h" 26 | 27 | @implementation BRAPerson 28 | 29 | #pragma mark - NSCoding 30 | 31 | - (void)encodeWithCoder:(NSCoder *)aCoder { 32 | [aCoder encodeObject:self.name 33 | forKey:NSStringFromSelector(@selector(name))]; 34 | [aCoder encodeObject:self.surname 35 | forKey:NSStringFromSelector(@selector(surname))]; 36 | [aCoder encodeObject:self.email 37 | forKey:NSStringFromSelector(@selector(email))]; 38 | } 39 | 40 | - (id)initWithCoder:(NSCoder *)aDecoder { 41 | if (self = [super init]) { 42 | _name = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(name))]; 43 | _surname = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(surname))]; 44 | _email = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(email))]; 45 | } 46 | return self; 47 | } 48 | 49 | @end 50 | 51 | 52 | @implementation BRAPerson (BRAConvenience) 53 | 54 | - (NSString *)nameAndSurname { 55 | if ([self.surname length] > 0) { 56 | return [NSString stringWithFormat:@"%@ %@", self.name, self.surname]; 57 | } else { 58 | return self.name; 59 | } 60 | } 61 | 62 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRASearchEmployeesDataSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASearchProviderProtocol.h" 26 | #import "BRASearchTableViewCell.h" 27 | 28 | @interface BRASearchEmployeesDataSource : NSObject 29 | + (NSString *)cellIdentifier; 30 | + (NSString *)notFoundCellIdentifier; 31 | @end 32 | 33 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRASearchEmployeesDataSource.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASearchEmployeesDataSource.h" 26 | #import "BRASearchTableViewCell+Employee.h" 27 | #import "BRARepository.h" 28 | 29 | @interface BRASearchEmployeesDataSource () 30 | @property (nonatomic, copy) NSArray *employees; 31 | @property (nonatomic, copy) NSArray *filteredEmployees; 32 | @end 33 | 34 | @implementation BRASearchEmployeesDataSource 35 | 36 | - (NSArray *)employees { 37 | if (_employees == nil) { 38 | _employees = [[BRARepository sharedInstance] allObjectsOfClass:[BRAEmployee class]]; 39 | } 40 | return _employees; 41 | } 42 | 43 | - (NSArray *)filteredEmployees { 44 | if (_filteredEmployees == nil) { 45 | _filteredEmployees = self.employees; 46 | } 47 | return _filteredEmployees; 48 | } 49 | 50 | #pragma mark - UITableViewDataSource 51 | 52 | + (NSString *)cellIdentifier { 53 | return @"searchCellIdentifier"; 54 | } 55 | 56 | + (NSString *)notFoundCellIdentifier { 57 | return @"notFoundCellIdentifier"; 58 | } 59 | 60 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 61 | return 2; 62 | } 63 | 64 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 65 | if (section == 0) { 66 | return self.filteredEmployees.count ? 0 : 1; 67 | } 68 | return self.filteredEmployees.count; 69 | } 70 | 71 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 72 | if (indexPath.section == 0) { 73 | UITableViewCell *notFoundCell = [tableView dequeueReusableCellWithIdentifier:[[self class] notFoundCellIdentifier]]; 74 | notFoundCell.textLabel.text = NSLocalizedString(@"Not found", nil); 75 | return notFoundCell; 76 | } 77 | 78 | BRASearchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[[self class]cellIdentifier]]; 79 | BRAEmployee *selectedEmployee = self.filteredEmployees[(NSUInteger) indexPath.row]; 80 | [cell configureWithEmployee:selectedEmployee]; 81 | 82 | return cell; 83 | } 84 | 85 | #pragma mark - BRASearchProviderProtocol 86 | 87 | - (void)textDidChange:(NSString *)text { 88 | if (text.length == 0) { 89 | self.filteredEmployees = self.employees; 90 | } else { 91 | NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"nameAndSurname CONTAINS[cd] %@", text]; 92 | self.filteredEmployees = [self.employees filteredArrayUsingPredicate:searchPredicate]; 93 | } 94 | } 95 | 96 | - (id)objectAtIndexPath:(NSIndexPath *)indexPath { 97 | return self.filteredEmployees[(NSUInteger) indexPath.row]; 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRASearchProviderProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @protocol BRASearchProviderProtocol 26 | 27 | - (void)textDidChange:(NSString *)text; 28 | - (id)objectAtIndexPath:(NSIndexPath *)indexPath; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAVisitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAPerson.h" 26 | #import "BRARepositoryProtocol.h" 27 | 28 | @interface BRAVisitor : BRAPerson 29 | 30 | @property (nonatomic, copy) NSString *company; 31 | @property (nonatomic, strong) BRAPerson *employee; 32 | @property (nonatomic, copy) UIImage *profilePhoto; 33 | @property (nonatomic, copy) UIImage *signature; 34 | @property (nonatomic, copy) NSDate *date; 35 | 36 | @property (nonatomic, copy) NSData *signedAgreementPDFData; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Model/BRAVisitor.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAVisitor.h" 26 | #import "NSDate+TodayDay.h" 27 | 28 | @implementation BRAVisitor 29 | 30 | #pragma mark - BRAVisitorProtocol 31 | 32 | + (NSString *)version { 33 | return @"1.1"; 34 | } 35 | 36 | - (NSString *)key { 37 | NSTimeInterval interval = [self.date timeIntervalSince1970]; 38 | NSString *key = [NSString stringWithFormat:@"%f", interval]; 39 | return key; 40 | } 41 | 42 | - (BOOL)isExpired { 43 | if (self.date == nil) { 44 | return NO; 45 | } 46 | return [self.date bra_day] != [[NSDate date] bra_day]; 47 | } 48 | 49 | #pragma mark - NSCoding protocol 50 | 51 | - (void)encodeWithCoder:(NSCoder *)aCoder { 52 | [super encodeWithCoder:aCoder]; 53 | [aCoder encodeObject:self.company 54 | forKey:NSStringFromSelector(@selector(company))]; 55 | [aCoder encodeObject:self.employee 56 | forKey:NSStringFromSelector(@selector(employee))]; 57 | [aCoder encodeObject:self.profilePhoto 58 | forKey:NSStringFromSelector(@selector(profilePhoto))]; 59 | [aCoder encodeObject:self.signature 60 | forKey:NSStringFromSelector(@selector(signature))]; 61 | [aCoder encodeObject:self.date 62 | forKey:NSStringFromSelector(@selector(date))]; 63 | } 64 | 65 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 66 | if (self = [super initWithCoder:aDecoder]) { 67 | _company = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(company))]; 68 | _employee = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(employee))]; 69 | _profilePhoto = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(profilePhoto))]; 70 | _signature = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(signature))]; 71 | _date = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(date))]; 72 | } 73 | return self; 74 | } 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Operations/BRAEmployeesDownloader.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAEmployeesDownloader : NSObject 26 | 27 | + (void)updateEmployees; 28 | 29 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Operations/BRAEmployeesDownloader.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEmployeesDownloader.h" 26 | #import "BRASettingsManager.h" 27 | #import "BRAEmployee+DictionarySupport.h" 28 | #import "BRARepository.h" 29 | 30 | @interface BRAEmployeesDownloader () 31 | @end 32 | 33 | @implementation BRAEmployeesDownloader 34 | 35 | #pragma mark - Constants 36 | 37 | + (NSString *)employeesJSONKey { 38 | return @"employees"; 39 | } 40 | 41 | + (void)updateEmployees { 42 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^(void) { 43 | [self _updateEmployees]; 44 | }); 45 | } 46 | 47 | + (void)_updateEmployees { 48 | NSData *data = [self requestEmployeesList]; 49 | NSDictionary *jsonDictionary = [self jsonDictionaryFromData:data]; 50 | NSArray *employees = [self createEmployeesFromDictionary:jsonDictionary]; 51 | [self saveEmployeesToRepository:employees]; 52 | } 53 | 54 | #pragma mark - Custom Logic 55 | 56 | + (NSData *)requestEmployeesList { 57 | NSString *employeesURLString = [[BRASettingsManager sharedInstance] employeeFileURLString]; 58 | NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:employeesURLString]]; 59 | NSURLResponse *response = nil; 60 | NSError *error = nil; 61 | NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; 62 | if (error) { 63 | [self reportError:error]; 64 | return nil; 65 | } 66 | return data; 67 | } 68 | 69 | + (NSDictionary *)jsonDictionaryFromData:(NSData *)data { 70 | if (data == nil) { 71 | return nil; 72 | } 73 | 74 | NSError *deserializationError = nil; 75 | NSDictionary *jsonDictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&deserializationError]; 76 | if (deserializationError) { 77 | [self reportError:deserializationError]; 78 | return nil; 79 | } 80 | 81 | return jsonDictionary; 82 | } 83 | 84 | + (NSArray *)createEmployeesFromDictionary:(NSDictionary *)jsonDictionary { 85 | if (jsonDictionary == nil) { 86 | return nil; 87 | } 88 | 89 | NSMutableArray *employees = [NSMutableArray new]; 90 | NSArray *employeesDicts = jsonDictionary[[[self class] employeesJSONKey]]; 91 | for (NSDictionary *employeeDict in employeesDicts) { 92 | [employees addObject:[BRAEmployee employeeWithDictionary:employeeDict]]; 93 | } 94 | 95 | return [employees copy]; 96 | } 97 | 98 | + (void)saveEmployeesToRepository:(NSArray *)employees { 99 | if ([employees count] == 0) { 100 | return; 101 | } 102 | 103 | [[BRARepository sharedInstance] removeAllObjectsOfClass:[BRAEmployee class]]; 104 | for (BRAEmployee *employee in employees) { 105 | [[BRARepository sharedInstance] saveObject:employee]; 106 | } 107 | } 108 | 109 | + (void)reportError:(NSError *)error { 110 | dispatch_async(dispatch_get_main_queue(), ^{ 111 | [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) 112 | message:[error localizedDescription] 113 | delegate:nil 114 | cancelButtonTitle:NSLocalizedString(@"I understand", nil) 115 | otherButtonTitles:nil] show]; 116 | }); 117 | } 118 | 119 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Operations/BRAPDFRenderOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @class BRAVisitor; 26 | 27 | @interface BRAPDFRenderOperation : NSOperation 28 | 29 | + (instancetype)operationWithVisitor:(BRAVisitor *)visitor; 30 | 31 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ReceptionApp_PrefixHeader_pch 3 | #define ReceptionApp_PrefixHeader_pch 4 | 5 | @import Foundation; 6 | @import UIKit; 7 | 8 | #import 9 | 10 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Repository/BRARepository+VisitorAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRARepository.h" 26 | 27 | @class BRAVisitor; 28 | 29 | @interface BRARepository (VisitorAdditions) 30 | 31 | - (void)saveVisitor:(BRAVisitor *)visitor; 32 | - (NSArray *)signedInVisitors; 33 | - (void)deleteVisitor:(BRAVisitor *)visitor; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Repository/BRARepository+VisitorAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRARepository+VisitorAdditions.h" 26 | #import "BRAVisitor.h" 27 | 28 | @implementation BRARepository (VisitorAdditions) 29 | 30 | - (void)saveVisitor:(BRAVisitor *)visitor { 31 | [self saveObject:visitor]; 32 | } 33 | 34 | - (NSArray *)signedInVisitors { 35 | return [self allObjectsOfClass:[BRAVisitor class]]; 36 | } 37 | 38 | - (void)deleteVisitor:(BRAVisitor *)visitor { 39 | [self deleteObject:visitor]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Repository/BRARepository.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRARepositoryProtocol.h" 26 | 27 | @interface BRARepository : NSObject 28 | 29 | + (instancetype)sharedInstance; 30 | 31 | - (void)saveObject:(id)objectToSave; 32 | - (void)deleteObject:(id)objectToDelete; 33 | 34 | - (void)saveObject:(id)objectToSave withKey:(NSString *)key toCollection:(NSString *)collectionName; 35 | - (id)objectForKey:(NSString *)key inCollection:(NSString *)collectionName; 36 | - (void)deleteObjectForKey:(NSString *)key inCollection:(NSString *)collectionName; 37 | 38 | - (NSArray *)allObjectsOfClass:(Class)classObject; 39 | - (void)removeAllObjectsOfClass:(Class)aClass; 40 | 41 | - (void)clearExpiredObjects; 42 | 43 | @end 44 | 45 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Repository/BRARepositoryProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @protocol BRARepositoryProtocol 26 | 27 | + (NSString *)version; 28 | - (BOOL)isExpired; 29 | - (NSString *)key; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Resources/Agreement.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Visitor Agreement 6 | 18 | 19 | 20 | 21 |

Visitor Agreement

22 | 23 |

At Badoo, we operate an open plan office that we find generates a creative and exciting environment to work in. We 24 | think that this environment and buzz is unique, and therefore we want all of our visitors to experience this too!

25 | 26 |

However, because of this, we do need certain assurances from our visitors that what they learn about their visit, 27 | stays confidential - after all it's what makes us who we are!

28 | 29 |

Please therefore sign below and return to reception.

30 | 31 |

Thanks, and enjoy Badoo!

32 | 33 |

Your Name: .................................

34 |

Your Company Name: .................................

35 |

Your Signature: .................................

36 |

Date: .................................

37 | 38 | 39 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Resources/Localizable.strings: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* Localization file */ 3 | 4 | 5 | "Visitor: %@" = "Visitor: %@"; 6 | "
Agreement and badge are in attachment
" = "
Agreement and badge are in attachment
"; 7 | "Signed-in visitors report" = "Signed-in visitors report"; 8 | "Sending error" = "Sending error"; 9 | "Visitor: %@,
Date: %@,
Email: %@,
Company: %@,
Here to see: %@.
" = "Visitor: %@,
Date: %@,
Email: %@,
Company: %@,
Here to see: %@.
"; 10 | "I understand" = "I understand"; 11 | "Error" = "Error"; 12 | "%@, Version %@" = "%@, Version %@"; 13 | "Please sign the agreement first!" = "Please sign the agreement first!"; 14 | "Printer is not available." = "Printer is not available."; 15 | "iPad's email is not configured." = "iPad's email is not configured."; 16 | "Receiver's email is not configured." = "Receiver's email is not configured."; 17 | "Please fill in all fields, no cutting corners!" = "Please fill in all fields, no cutting corners!"; 18 | "Enter pin here" = "Enter pin here"; 19 | "Enter" = "Enter"; 20 | "Cancel" = "Cancel"; 21 | "Incorrect Pin!" = "Incorrect Pin!"; 22 | "Please try again" = "Please try again"; 23 | "Not found" = "Not found"; 24 | "Settings" = "Settings"; 25 | "Email is not valid!" = "Email is not valid!"; 26 | "Pin is not valid!" = "Pin is not valid!"; 27 | "Need a printer" = "Need a printer"; 28 | "Loading..." = "Loading..."; 29 | "To enter settings, please enter pin" = "To enter settings, please enter pin"; 30 | "Contact reception for your badge" = "Contact reception for your badge"; 31 | "Sign Out:" = "Sign Out:"; 32 | "What's your name?" = "What's your name?"; -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/Resources/SampleEmployeeFile.json: -------------------------------------------------------------------------------- 1 | { 2 | "version" : 1.0, 3 | "employees" : [ 4 | { 5 | "name" : "John", 6 | "surname" : "Johnson", 7 | "position" : "iOS Developer", 8 | "department" : "Mobile", 9 | "image_url" : "http://some_site/john.png" 10 | }, 11 | { 12 | "name" : "Kelly", 13 | "surname" : "Kelison", 14 | "position" : "Java Developer", 15 | "department" : "Mobile", 16 | "image_url" : "http://some_site/kelly.png" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/SettingsManager/BRARepository+Settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRARepository.h" 26 | 27 | @interface BRARepository (Settings) 28 | 29 | - (NSString *)pinCode; 30 | - (NSString *)email; 31 | - (NSString *)devEmail; 32 | - (NSString *)employeeURLString; 33 | - (NSString *)printerName; 34 | - (NSString *)accountToSendEmail; 35 | - (NSString *)accountPassword; 36 | - (NSString *)portSMTP; 37 | - (NSString *)SMTPServer; 38 | 39 | 40 | - (void)savePinCode:(NSString *)newPinCode; 41 | - (void)saveEmail:(NSString *)newEmail; 42 | - (void)saveDevEmail:(NSString *)newDevEmail; 43 | - (void)saveEmployeeURLString:(NSString *)newURLString; 44 | - (void)savePrinterName:(NSString *)newName; 45 | - (void)saveAccountToSendEmail:(NSString *)newAccount; 46 | - (void)savePasswordAccount:(NSString *)newPassword; 47 | - (void)savePortSMTP:(NSString *)newPort; 48 | - (void)saveSMTPServer:(NSString *)newSMTPServer; 49 | 50 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/SettingsManager/BRARepository+Settings.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRARepository+Settings.h" 26 | 27 | @implementation BRARepository (Settings) 28 | 29 | #pragma mark - Constants 30 | 31 | + (NSString *)settingCollectionName { 32 | return @"BRASettingsCollection"; 33 | } 34 | 35 | + (NSString *)pinCodeKey { 36 | return @"PinCode"; 37 | } 38 | 39 | + (NSString *)emailKey { 40 | return @"Email"; 41 | } 42 | 43 | + (NSString *)devEmailKey { 44 | return @"DevEmail"; 45 | } 46 | 47 | + (NSString *)employeeURLStringKey { 48 | return @"EmployeeURLString"; 49 | } 50 | 51 | + (NSString *)printerNameKey { 52 | return @"Printer"; 53 | } 54 | 55 | + (NSString *)accountKey { 56 | return @"Account"; 57 | } 58 | 59 | + (NSString *)passwordKey { 60 | return @"Password"; 61 | } 62 | 63 | + (NSString *)portKey { 64 | return @"Port"; 65 | } 66 | 67 | + (NSString *)SMTPServerKey { 68 | return @"SMTPServer"; 69 | } 70 | 71 | #pragma mark - Public API 72 | 73 | - (NSString *)pinCode { 74 | return [self objectForKey:[[self class] pinCodeKey] inCollection:[[self class] settingCollectionName]]; 75 | } 76 | 77 | - (NSString *)email { 78 | return [self objectForKey:[[self class] emailKey] inCollection:[[self class] settingCollectionName]]; 79 | } 80 | 81 | - (NSString *)devEmail { 82 | return [self objectForKey:[[self class] devEmailKey] inCollection:[[self class] settingCollectionName]]; 83 | } 84 | 85 | - (NSString *)employeeURLString { 86 | return [self objectForKey:[[self class] employeeURLStringKey] inCollection:[[self class] settingCollectionName]]; 87 | } 88 | 89 | - (NSString *)printerName { 90 | return [self objectForKey:[[self class] printerNameKey] inCollection:[[self class] settingCollectionName]]; 91 | } 92 | 93 | - (NSString *)accountToSendEmail { 94 | return [self objectForKey:[[self class] accountKey] inCollection:[[self class] settingCollectionName]]; 95 | } 96 | 97 | - (NSString *)accountPassword { 98 | return [self objectForKey:[[self class] passwordKey] inCollection:[[self class] settingCollectionName]]; 99 | } 100 | 101 | - (NSString *)portSMTP { 102 | return [self objectForKey:[[self class] portKey] inCollection:[[self class] settingCollectionName]]; 103 | } 104 | 105 | - (NSString *)SMTPServer { 106 | return [self objectForKey:[[self class] SMTPServerKey] inCollection:[[self class] settingCollectionName]]; 107 | } 108 | 109 | - (void)savePinCode:(NSString *)newPinCode { 110 | [self saveObject:newPinCode withKey:[[self class] pinCodeKey] toCollection:[[self class] settingCollectionName]]; 111 | } 112 | 113 | - (void)saveEmail:(NSString *)newEmail { 114 | [self saveObject:newEmail withKey:[[self class] emailKey] toCollection:[[self class] settingCollectionName]]; 115 | } 116 | 117 | - (void)saveDevEmail:(NSString *)newEmail { 118 | [self saveObject:newEmail withKey:[[self class] devEmailKey] toCollection:[[self class] settingCollectionName]]; 119 | } 120 | 121 | - (void)saveEmployeeURLString:(NSString *)newURLString { 122 | [self saveObject:newURLString withKey:[[self class] employeeURLStringKey] toCollection:[[self class] settingCollectionName]]; 123 | } 124 | 125 | - (void)savePrinterName:(NSString *)newName { 126 | [self saveObject:newName withKey:[[self class] printerNameKey] toCollection:[[self class] settingCollectionName]]; 127 | } 128 | 129 | - (void)saveAccountToSendEmail:(NSString *)newAccount { 130 | [self saveObject:newAccount withKey:[[self class] accountKey] toCollection:[[self class] settingCollectionName]]; 131 | } 132 | 133 | - (void)savePasswordAccount:(NSString *)newPassword { 134 | [self saveObject:newPassword withKey:[[self class] passwordKey] toCollection:[[self class] settingCollectionName]]; 135 | } 136 | 137 | - (void)savePortSMTP:(NSString *)newPort { 138 | [self saveObject:newPort withKey:[[self class] portKey] toCollection:[[self class] settingCollectionName]]; 139 | } 140 | 141 | - (void)saveSMTPServer:(NSString *)newSMTPServer { 142 | [self saveObject:newSMTPServer withKey:[[self class] SMTPServerKey] toCollection:[[self class] settingCollectionName]]; 143 | } 144 | 145 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/SettingsManager/BRASettingsManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRASettingsManager : NSObject 26 | 27 | + (instancetype)sharedInstance; 28 | 29 | @property (copy, nonatomic) NSString *email; 30 | @property (copy, nonatomic) NSString *pinCode; 31 | @property (copy, nonatomic) NSString *devEmail; 32 | @property (copy, nonatomic, readonly) NSString *currentAppVersion; 33 | @property (copy, nonatomic) NSString *employeeFileURLString; 34 | @property (copy, nonatomic) NSString *printerName; 35 | @property (copy, nonatomic) NSString *accountToSendEmail; 36 | @property (copy, nonatomic) NSString *accountPassword; 37 | @property (copy, nonatomic) NSString *portSMTP; 38 | @property (copy, nonatomic) NSString *SMTPServer; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/SigninFlow/BRASigninFlow.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @class BRAVisitor; 26 | 27 | extern NSString *const BRASigninExpiredNotification; 28 | 29 | @interface BRASigninFlow : NSObject 30 | 31 | + (instancetype)sharedInstance; 32 | 33 | - (void)startFlow; 34 | - (void)finishFlowWithBadgeImage:(UIImage *)badgeImage; 35 | 36 | @property (nonatomic, strong, readonly) BRAVisitor *currentVisitor; 37 | 38 | - (void)registerUserAction; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/SigninFlow/BRASigninFlow.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASigninFlow.h" 26 | #import "BRAVisitor.h" 27 | #import "BRARepository+VisitorAdditions.h" 28 | #import "BRAPrinter.h" 29 | #import "BRAMailManager.h" 30 | #import "BRAPDFRenderOperation.h" 31 | 32 | NSString *const BRASigninExpiredNotification = @"BRASigninExpiredNotification"; 33 | 34 | @interface BRASigninFlow () 35 | @property (nonatomic, strong, readwrite) BRAVisitor *currentVisitor; 36 | @property (nonatomic, strong) NSTimer *expiryTimer; 37 | @property (nonatomic, strong) BRAPrinter *printer; 38 | @end 39 | 40 | @implementation BRASigninFlow 41 | 42 | + (NSUInteger)minutesToWaitForActivityBeforeExpire { 43 | return 3; 44 | } 45 | 46 | + (instancetype)sharedInstance { 47 | static BRASigninFlow *sharedInstance = nil; 48 | static dispatch_once_t onceToken; 49 | dispatch_once(&onceToken, ^{ 50 | sharedInstance = [[BRASigninFlow alloc] init]; 51 | }); 52 | return sharedInstance; 53 | } 54 | 55 | - (void)registerUserAction { 56 | [self scheduleTimer]; 57 | } 58 | 59 | - (void)startFlow { 60 | self.currentVisitor = [BRAVisitor new]; 61 | [self scheduleTimer]; 62 | } 63 | 64 | - (void)finishFlowWithBadgeImage:(UIImage *)badgeImage { 65 | [self.expiryTimer invalidate]; 66 | [[BRARepository sharedInstance] saveVisitor:self.currentVisitor]; 67 | [self printBadge:badgeImage]; 68 | 69 | BRAPDFRenderOperation *pdfRenderOperation = [BRAPDFRenderOperation operationWithVisitor:self.currentVisitor]; 70 | @weakify(self); 71 | pdfRenderOperation.completionBlock = ^ { 72 | @strongify(self); 73 | [BRAMailManager sendEmailWithVisitor:self.currentVisitor badgeImage:badgeImage]; 74 | }; 75 | [[NSOperationQueue mainQueue] addOperation:pdfRenderOperation]; 76 | } 77 | 78 | - (void)printBadge:(UIImage *)badgeImage { 79 | self.printer = [BRAPrinter printer]; 80 | [self.printer printBadgeImage:badgeImage]; 81 | } 82 | 83 | - (void)scheduleTimer { 84 | [self.expiryTimer invalidate]; 85 | self.expiryTimer = [NSTimer scheduledTimerWithTimeInterval:[[self class] minutesToWaitForActivityBeforeExpire] * 60.0f 86 | target:self 87 | selector:@selector(signinExpired:) 88 | userInfo:nil 89 | repeats:NO]; 90 | } 91 | 92 | - (void)signinExpired:(id)signinExpired { 93 | [[NSNotificationCenter defaultCenter] postNotificationName:BRASigninExpiredNotification object:nil]; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/UpdatesService/BRAEmployeesUpdater.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEventHandlerProtocol.h" 26 | 27 | @interface BRAEmployeesUpdater : NSObject 28 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/UpdatesService/BRAEmployeesUpdater.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEmployeesUpdater.h" 26 | #import "BRAEmployeesDownloader.h" 27 | #import "NSDate+TodayDay.h" 28 | 29 | @implementation BRAEmployeesUpdater 30 | 31 | + (NSInteger)dayToUpdateListOfEmployees { 32 | return 21; 33 | } 34 | 35 | #pragma mark - BRAUpdateHandlerProtocol 36 | 37 | - (NSString *)key { 38 | return @"EmployeesUpdater"; 39 | } 40 | 41 | - (BOOL)shouldScheduleNextEvent { 42 | return YES; 43 | } 44 | 45 | - (NSDate *)nextEventDate { 46 | NSDate *now = [NSDate date]; 47 | NSDate *targetMonth = now; 48 | NSCalendar *calendar = [NSCalendar currentCalendar]; 49 | 50 | if ([now bra_day] >= [[self class] dayToUpdateListOfEmployees]) { 51 | NSDateComponents *nextMonthComponents = [NSDateComponents new]; 52 | nextMonthComponents.month = 1; 53 | targetMonth = [calendar dateByAddingComponents:nextMonthComponents toDate:now options:0]; 54 | } 55 | 56 | NSDateComponents *nextMonthSpecificDayComponents = [calendar components:(NSCalendarUnitEra | NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:targetMonth]; 57 | nextMonthSpecificDayComponents.day = [[self class] dayToUpdateListOfEmployees]; 58 | NSDate *nextMonthSpecificDay = [calendar dateFromComponents:nextMonthSpecificDayComponents]; 59 | return nextMonthSpecificDay; 60 | } 61 | 62 | - (void)handleEventAtDate:(NSDate *)eventDate { 63 | [BRAEmployeesDownloader updateEmployees]; 64 | } 65 | 66 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/UpdatesService/BRAEventHandlerProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @protocol BRAEventHandlerProtocol 26 | 27 | #pragma mark - Handler Info 28 | 29 | - (NSString *)key; 30 | 31 | #pragma mark - Event Info 32 | 33 | - (BOOL)shouldScheduleNextEvent; 34 | - (NSDate *)nextEventDate; 35 | 36 | #pragma mark - Event Handling 37 | 38 | - (void)handleEventAtDate:(NSDate *)eventDate; 39 | 40 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/UpdatesService/BRAExpiredObjectsCleaner.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEventHandlerProtocol.h" 26 | 27 | extern NSString * const BRAExpiredVisitorsWereRemovedNotificationName; 28 | 29 | @interface BRAExpiredObjectsCleaner : NSObject 30 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/UpdatesService/BRAExpiredObjectsCleaner.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAExpiredObjectsCleaner.h" 26 | #import "BRAMailManager.h" 27 | #import "BRARepository+VisitorAdditions.h" 28 | #import "NSDate+TodayDay.h" 29 | 30 | NSString * const BRAExpiredVisitorsWereRemovedNotificationName = @"BRAExpiredVisitorsWereRemovedNotification"; 31 | 32 | @implementation BRAExpiredObjectsCleaner 33 | 34 | + (NSInteger)checkForExpiryHour { 35 | return 6; 36 | } 37 | 38 | #pragma mark - BRAUpdateHandlerProtocol 39 | 40 | - (NSString *)key { 41 | return @"ExpiredObjectsCleaner"; 42 | } 43 | 44 | - (BOOL)shouldScheduleNextEvent { 45 | return YES; 46 | } 47 | 48 | - (NSDate *)nextEventDate { 49 | NSDate *now = [NSDate date]; 50 | 51 | NSDateComponents *tomorrowComponents = [NSDateComponents new]; 52 | if ([now bra_hour] >= [[self class] checkForExpiryHour]) { 53 | tomorrowComponents.day = 1; 54 | } 55 | NSCalendar *calendar = [NSCalendar currentCalendar]; 56 | NSDate *nextDate = [calendar dateByAddingComponents:tomorrowComponents toDate:now options:0]; 57 | 58 | NSDateComponents *nextDateAt6AMComponents = [calendar components:(NSCalendarUnitEra | NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:nextDate]; 59 | nextDateAt6AMComponents.hour = [[self class] checkForExpiryHour]; 60 | NSDate *nextDateAt6AM = [calendar dateFromComponents:nextDateAt6AMComponents]; 61 | return nextDateAt6AM; 62 | } 63 | 64 | - (void)handleEventAtDate:(NSDate *)eventDate { 65 | NSArray *signedInVisitors = [[BRARepository sharedInstance] signedInVisitors]; 66 | if ([signedInVisitors count]) { 67 | [BRAMailManager sendSignInReportWithVisitors:signedInVisitors]; 68 | } 69 | [[BRARepository sharedInstance] clearExpiredObjects]; 70 | [[NSNotificationCenter defaultCenter] postNotificationName:BRAExpiredVisitorsWereRemovedNotificationName object:nil]; 71 | } 72 | 73 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/UpdatesService/BRAPeriodicEventsService.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @protocol BRAEventHandlerProtocol; 26 | 27 | @interface BRAPeriodicEventsService : NSObject 28 | 29 | + (instancetype)sharedInstance; 30 | 31 | - (void)registerEventHandler:(id)updateHandler; 32 | - (void)removeUpdateHandlerForKey:(NSString *)handlerKey; 33 | 34 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/UpdatesService/BRAPeriodicEventsService.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAPeriodicEventsService.h" 26 | #import "BRAEventHandlerProtocol.h" 27 | 28 | @interface BRAPeriodicEventsService () 29 | @property (strong, nonatomic) NSMutableDictionary *handlers; 30 | @property (strong, nonatomic) NSMutableDictionary *timers; 31 | @end 32 | 33 | @implementation BRAPeriodicEventsService 34 | 35 | #pragma mark - Life Cycle 36 | 37 | - (void)dealloc { 38 | for (NSString *timerKey in _timers) { 39 | NSTimer *timer = _timers[timerKey]; 40 | [timer invalidate]; 41 | } 42 | } 43 | 44 | + (instancetype)sharedInstance { 45 | static BRAPeriodicEventsService *sharedInstance = nil; 46 | static dispatch_once_t onceToken; 47 | dispatch_once(&onceToken, ^{ 48 | sharedInstance = [[BRAPeriodicEventsService alloc] init]; 49 | }); 50 | return sharedInstance; 51 | } 52 | 53 | - (instancetype)init { 54 | self = [super init]; 55 | if (self) { 56 | _handlers = [NSMutableDictionary new]; 57 | _timers = [NSMutableDictionary new]; 58 | } 59 | 60 | return self; 61 | } 62 | 63 | #pragma mark - Public API 64 | 65 | - (void)registerEventHandler:(id )updateHandler { 66 | NSParameterAssert([updateHandler conformsToProtocol:@protocol(BRAEventHandlerProtocol)]); 67 | if (![updateHandler conformsToProtocol:@protocol(BRAEventHandlerProtocol)]) { 68 | return; 69 | } 70 | 71 | NSString *handlerKey = [updateHandler key]; 72 | if (self.handlers[handlerKey]) { 73 | [self removeUpdateHandlerForKey:handlerKey]; 74 | } 75 | 76 | self.handlers[handlerKey] = updateHandler; 77 | [self scheduleOrRemoveHandler:updateHandler]; 78 | } 79 | 80 | - (void)removeUpdateHandlerForKey:(NSString *)handlerKey { 81 | [self removeTimerForKey:handlerKey]; 82 | [self.handlers removeObjectForKey:handlerKey]; 83 | } 84 | 85 | #pragma mark - Helpers 86 | 87 | - (void)scheduleOrRemoveHandler:(id )updateHandler { 88 | NSString *handlerKey = [updateHandler key]; 89 | if ([updateHandler shouldScheduleNextEvent]) { 90 | NSTimer *timer = [[NSTimer alloc] initWithFireDate:[updateHandler nextEventDate] 91 | interval:1.0f 92 | target:self 93 | selector:@selector(timerTicked:) 94 | userInfo:nil 95 | repeats:NO]; 96 | self.timers[handlerKey] = timer; 97 | [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode]; 98 | } else { 99 | [self removeUpdateHandlerForKey:handlerKey]; 100 | } 101 | } 102 | 103 | - (void)removeTimerForKey:(NSString *)key { 104 | NSTimer *timer = self.timers[key]; 105 | [timer invalidate]; 106 | [self.timers removeObjectForKey:key]; 107 | } 108 | 109 | - (NSString *)keyForTimer:(NSTimer *)timer { 110 | NSArray *keys = [self.timers allKeysForObject:timer]; 111 | return [keys count] ? keys[0] : nil; 112 | } 113 | 114 | - (void)timerTicked:(NSTimer *)timer { 115 | NSString *handlerKey = [self keyForTimer:timer]; 116 | [self removeTimerForKey:handlerKey]; 117 | id handler = self.handlers[handlerKey]; 118 | [handler handleEventAtDate:timer.fireDate]; 119 | [self scheduleOrRemoveHandler:handler]; 120 | } 121 | 122 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/AgreementViewController/BRAAgreementViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAAgreementViewController : UIViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/Animators/BRAAnimator.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAAnimator : NSObject 26 | 27 | + (id)animatorForOperation:(UINavigationControllerOperation)operation; 28 | + (CGFloat)defaultAnimationDuration; 29 | + (CGFloat)initialSpringVelocity; 30 | + (CGFloat)springWithDamping; 31 | @end 32 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/Animators/BRAAnimator.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAAnimator.h" 26 | #import "BRAPopAnimator.h" 27 | #import "BRAPushAnimator.h" 28 | 29 | @implementation BRAAnimator 30 | 31 | + (id )animatorForOperation:(UINavigationControllerOperation)operation { 32 | if (operation == UINavigationControllerOperationPush) { 33 | return [BRAPushAnimator new]; 34 | } else { 35 | return [BRAPopAnimator new]; 36 | } 37 | } 38 | 39 | + (CGFloat)defaultAnimationDuration { 40 | return 0.5f; 41 | } 42 | 43 | + (CGFloat)springWithDamping { 44 | return 0.8f; 45 | } 46 | 47 | + (CGFloat)initialSpringVelocity { 48 | return 1.0f; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/Animators/BRAPopAnimator.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAPopAnimator : NSObject 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/Animators/BRAPopAnimator.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAAnimator.h" 26 | #import "BRAPopAnimator.h" 27 | 28 | @implementation BRAPopAnimator 29 | 30 | - (NSTimeInterval)transitionDuration:(id )transitionContext { 31 | return [BRAAnimator defaultAnimationDuration]; 32 | } 33 | 34 | - (void)animateTransition:(id )transitionContext { 35 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 36 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 37 | UIView *toView = toViewController.view; 38 | UIView *fromView = fromViewController.view; 39 | [transitionContext.containerView addSubview:toView]; 40 | toView.frame = CGRectOffset(toView.frame, -CGRectGetMaxX(fromView.frame), 0.0f); 41 | 42 | [UIView animateWithDuration:[self transitionDuration:transitionContext] 43 | delay:0 44 | usingSpringWithDamping:[BRAAnimator springWithDamping] 45 | initialSpringVelocity:[BRAAnimator initialSpringVelocity] 46 | options:UIViewAnimationOptionCurveEaseInOut 47 | animations:^{ 48 | toView.frame = fromView.frame; 49 | fromView.frame = CGRectOffset(fromView.frame, CGRectGetWidth(fromView.frame), 0.0f); 50 | } 51 | completion:^(BOOL finished) { 52 | [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; 53 | }]; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/Animators/BRAPushAnimator.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAPushAnimator : NSObject 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/Animators/BRAPushAnimator.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAAnimator.h" 26 | #import "BRAPushAnimator.h" 27 | 28 | @implementation BRAPushAnimator 29 | 30 | - (NSTimeInterval)transitionDuration:(id )transitionContext { 31 | return [BRAAnimator defaultAnimationDuration]; 32 | } 33 | 34 | - (void)animateTransition:(id )transitionContext { 35 | transitionContext.containerView.superview.clipsToBounds = NO; 36 | 37 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 38 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 39 | UIView *toView = toViewController.view; 40 | UIView *fromView = fromViewController.view; 41 | [transitionContext.containerView addSubview:toView]; 42 | toView.frame = CGRectOffset(toView.frame, CGRectGetMaxX(fromView.frame), 0.0f); 43 | 44 | [UIView animateWithDuration:[self transitionDuration:transitionContext] 45 | delay:0 46 | usingSpringWithDamping:[BRAAnimator springWithDamping] 47 | initialSpringVelocity:[BRAAnimator initialSpringVelocity] 48 | options:UIViewAnimationOptionCurveEaseInOut 49 | animations:^{ 50 | toView.frame = fromView.frame; 51 | fromView.frame = CGRectOffset(fromView.frame, -CGRectGetWidth(fromView.frame), 0.0f); 52 | } 53 | completion:^(BOOL finished) { 54 | [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; 55 | }]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/BadgeViewController/BRABadgeViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRABadgeViewController : UIViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/FormViewController/BRAFormViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAFormViewController : UIViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/MainViewController/BRAMainViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | extern NSString * const BRAMainViewShouldHideHeaderViewNotification; 26 | extern NSString * const BRAMainViewShouldShowHeaderViewNotification; 27 | 28 | @interface BRAMainViewController : UIViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SearchTableViewController/BRASearchTableViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEmployee.h" 26 | #import "BRASearchProviderProtocol.h" 27 | 28 | typedef void (^BRASearchCompletionBlock)(BRAPerson *person); 29 | 30 | @interface BRASearchTableViewController : UITableViewController 31 | 32 | @property (nonatomic, strong) id searchDataSource; 33 | @property (nonatomic, copy) BRASearchCompletionBlock completionBlock; 34 | 35 | - (instancetype)initWithCompletionBlock:(BRASearchCompletionBlock)completionBlock; 36 | - (void)nameDidChange:(NSString *)name; 37 | @end 38 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SearchTableViewController/BRASearchTableViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import "BRASearchTableViewController.h" 27 | #import "BRAsearchTableViewCell.h" 28 | #import "BRASearchEmployeesDataSource.h" 29 | 30 | @interface BRASearchTableViewController () 31 | @end 32 | 33 | @implementation BRASearchTableViewController 34 | 35 | - (instancetype)initWithCompletionBlock:(BRASearchCompletionBlock)completionBlock { 36 | if (self = [super init]) { 37 | _completionBlock = [completionBlock copy]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)viewDidLoad { 43 | [super viewDidLoad]; 44 | 45 | self.tableView.rowHeight = 60; 46 | self.tableView.tableFooterView = [UIView new]; 47 | self.tableView.delegate = self; 48 | self.tableView.dataSource = self.searchDataSource; 49 | [self.tableView registerClass:[BRASearchTableViewCell class] forCellReuseIdentifier:[BRASearchEmployeesDataSource cellIdentifier]]; 50 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:[BRASearchEmployeesDataSource notFoundCellIdentifier]]; 51 | } 52 | 53 | - (void)dealloc { 54 | self.tableView.dataSource = nil; 55 | self.tableView.delegate = nil; 56 | } 57 | 58 | - (void)nameDidChange:(NSString *)name { 59 | NSAssert(self.searchDataSource, @"You need to attach datasource"); 60 | if (self.searchDataSource) { 61 | [self.searchDataSource textDidChange:name]; 62 | [self.tableView reloadData]; 63 | } 64 | } 65 | 66 | #pragma mark - Delegate 67 | 68 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 69 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 70 | if (self.completionBlock != nil) { 71 | if (indexPath.section == 1) { 72 | BRAEmployee *employee = [self.searchDataSource objectAtIndexPath:indexPath]; 73 | self.completionBlock(employee); 74 | } 75 | } 76 | } 77 | 78 | - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 79 | [cell.imageView hnk_cancelSetImage]; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SearchTableViewController/BRASearchTableViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SearchTableViewController/View/BRASearchTableViewCell+Employee.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASearchTableViewCell.h" 26 | 27 | @interface BRASearchTableViewCell (Employee) 28 | 29 | - (void)configureWithEmployee:(BRAEmployee *)employee; 30 | 31 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SearchTableViewController/View/BRASearchTableViewCell+Employee.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import 27 | #import "BRASearchTableViewCell+Employee.h" 28 | 29 | @implementation BRASearchTableViewCell (Employee) 30 | 31 | + (UIImage *)defaultImage { 32 | return [UIImage imageNamed:@"sample_photo"]; 33 | } 34 | 35 | + (NSString *)cacheFormatIdentifier { 36 | return @"SearchTableCell"; 37 | } 38 | 39 | - (void)configureWithEmployee:(BRAEmployee *)employee { 40 | self.textLabel.text = employee.nameAndSurname; 41 | HNKCacheFormat *format = [HNKCache sharedCache].formats[[[self class] cacheFormatIdentifier]]; 42 | if (!format) { 43 | format = [[HNKCacheFormat alloc] initWithName:[[self class] cacheFormatIdentifier]]; 44 | format.size = CGSizeMake(60, 60); 45 | format.scaleMode = HNKScaleModeAspectFill; 46 | format.diskCapacity = 10 * 1024 * 1024; 47 | format.preloadPolicy = HNKPreloadPolicyLastSession; 48 | } 49 | self.imageView.hnk_cacheFormat = format; 50 | 51 | [self.imageView hnk_setImageFromURL:employee.imageURL placeholder:[[self class] defaultImage]]; 52 | } 53 | 54 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SearchTableViewController/View/BRASearchTableViewCell.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAEmployee.h" 26 | 27 | @interface BRASearchTableViewCell : UITableViewCell 28 | 29 | @end 30 | 31 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SearchTableViewController/View/BRASearchTableViewCell.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASearchTableViewCell.h" 26 | 27 | @implementation BRASearchTableViewCell 28 | 29 | + (CGFloat)imageMarginFraction { 30 | return 0.125f; 31 | } 32 | 33 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 34 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 35 | if (self) { 36 | self.imageView.layer.masksToBounds = YES; 37 | } 38 | 39 | return self; 40 | } 41 | 42 | - (void)layoutSubviews { 43 | [super layoutSubviews]; 44 | 45 | CGFloat delta = CGRectGetHeight(self.contentView.bounds) * [[self class] imageMarginFraction]; 46 | CGFloat sideWidth = CGRectGetHeight(self.contentView.bounds) - 2 * delta; 47 | 48 | self.imageView.frame = CGRectMake(2 * delta, delta, sideWidth, sideWidth); 49 | self.imageView.layer.cornerRadius = CGRectGetWidth(self.imageView.frame)/2; 50 | 51 | CGRect labelFrame = self.textLabel.frame; 52 | labelFrame.origin.x = CGRectGetMaxX(self.imageView.frame) + 2 * delta; 53 | self.textLabel.frame = labelFrame; 54 | 55 | self.separatorInset = UIEdgeInsetsMake(0.0f, CGRectGetMinX(self.textLabel.frame), 0.0f, 0.0f); 56 | } 57 | 58 | - (void)prepareForReuse { 59 | self.imageView.image = nil; 60 | self.textLabel.text = @""; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SettignsViewController/BRASettingsViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRASettingsViewController : UIViewController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignInViewController/BRASignInViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "UIColor+ComplementaryColors.h" 26 | 27 | @interface BRASignInViewController : UIViewController 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignInViewController/BRASignInViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASignInViewController.h" 26 | #import "BRAAgreementViewController.h" 27 | #import "UIViewController+Factory.h" 28 | #import "BRASigninFlow.h" 29 | #import "BRAVisitor.h" 30 | #import "BRASignOutViewController.h" 31 | #import "BRARepository+VisitorAdditions.h" 32 | #import "BRAExpiredObjectsCleaner.h" 33 | 34 | @interface BRASignInViewController () 35 | 36 | - (IBAction)signInTapped:(UIButton *)sender; 37 | - (IBAction)signOutTapped:(UIButton *)sender; 38 | 39 | @property (weak, nonatomic) IBOutlet UILabel *leavingLabel; 40 | @property (weak, nonatomic) IBOutlet UIButton *signoutButton; 41 | @property (weak, nonatomic) IBOutlet UIButton *signinButton; 42 | @property (weak, nonatomic) IBOutlet UILabel *centerLine; 43 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *verticalHeightLabelConstraint; 44 | @property (assign, nonatomic) CGFloat labelHeight; 45 | 46 | @end 47 | 48 | @implementation BRASignInViewController 49 | 50 | #pragma mark - Class methods 51 | 52 | + (BOOL)shouldPresentSignoutButton { 53 | BRARepository *repository = [BRARepository sharedInstance]; 54 | return repository.signedInVisitors.count > 0; 55 | } 56 | 57 | + (CGFloat)defaultVerticalHeightLabelConstraint { 58 | return 280; 59 | } 60 | 61 | #pragma mark - 62 | 63 | - (void)dealloc { 64 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 65 | } 66 | 67 | - (void)viewDidLoad { 68 | [super viewDidLoad]; 69 | self.labelHeight = self.verticalHeightLabelConstraint.constant; 70 | [self setupButtons]; 71 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(expiredVisitorRemovedNotification:) name:BRAExpiredVisitorsWereRemovedNotificationName object:nil]; 72 | } 73 | 74 | - (void)setupButtons { 75 | self.signinButton.layer.cornerRadius = 2; 76 | self.signoutButton.layer.cornerRadius = 2; 77 | self.signinButton.exclusiveTouch = YES; 78 | self.signoutButton.exclusiveTouch = YES; 79 | } 80 | 81 | - (void)viewDidAppear:(BOOL)animated { 82 | [super viewDidAppear:animated]; 83 | [[BRASigninFlow sharedInstance] startFlow]; 84 | } 85 | 86 | - (void)viewWillAppear:(BOOL)animated { 87 | [super viewWillAppear:animated]; 88 | [self updateViewState]; 89 | } 90 | 91 | - (void)updateViewState { 92 | [UIView animateWithDuration:0.33f 93 | animations:^ { 94 | if ([[self class] shouldPresentSignoutButton]) { 95 | [self showSignoutButton]; 96 | } else { 97 | [self hideSignoutButton]; 98 | } 99 | }]; 100 | } 101 | 102 | - (void)hideSignoutButton { 103 | self.verticalHeightLabelConstraint.constant = [[self class] defaultVerticalHeightLabelConstraint]; 104 | self.leavingLabel.hidden = YES; 105 | self.signoutButton.hidden = YES; 106 | self.centerLine.hidden = YES; 107 | } 108 | 109 | - (void)showSignoutButton { 110 | self.verticalHeightLabelConstraint.constant = self.labelHeight; 111 | self.leavingLabel.hidden = NO; 112 | self.signoutButton.hidden = NO; 113 | self.centerLine.hidden = NO; 114 | } 115 | 116 | #pragma mark - IBActions 117 | 118 | - (IBAction)signInTapped:(UIButton *)sender { 119 | [[BRASigninFlow sharedInstance] registerUserAction]; 120 | [[BRASigninFlow sharedInstance] currentVisitor].date = [NSDate date]; 121 | [self.navigationController pushViewController:[BRAAgreementViewController bra_controller] animated:YES]; 122 | } 123 | 124 | - (IBAction)signOutTapped:(UIButton *)sender { 125 | [[BRASigninFlow sharedInstance] registerUserAction]; 126 | BRASignOutViewController *signoutViewController = [BRASignOutViewController bra_controller]; 127 | [self.navigationController pushViewController:signoutViewController animated:YES]; 128 | } 129 | 130 | #pragma mark - Notifications 131 | 132 | - (void)expiredVisitorRemovedNotification:(NSNotification *)notification { 133 | [self updateViewState]; 134 | } 135 | 136 | @end 137 | 138 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignOutViewController/BRASignOutViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASelectNamesView.h" 26 | 27 | @interface BRASignOutViewController : UIViewController 28 | 29 | + (NSString *)cellIdentifier; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignOutViewController/BRASignOutViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignOutViewController/Flow/BRAVisitorSelectedFlowLayout.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAVisitorSelectedFlowLayout : UICollectionViewFlowLayout 26 | 27 | - (instancetype)initWithRowSelectedIndexPath:(NSIndexPath *)indexPath; 28 | 29 | + (CGSize)cellSize; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignOutViewController/Flow/BRAVisitorSelectedFlowLayout.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAVisitorSelectedFlowLayout.h" 26 | 27 | @interface BRAVisitorSelectedFlowLayout () 28 | @property (nonatomic, strong) NSIndexPath *indexPath; 29 | @end 30 | 31 | @implementation BRAVisitorSelectedFlowLayout 32 | 33 | + (CGSize)cellSize { 34 | return CGSizeMake(154, 154); 35 | } 36 | 37 | - (instancetype)initWithRowSelectedIndexPath:(NSIndexPath *)indexPath { 38 | if (self = [super init]) { 39 | _indexPath = indexPath; 40 | } 41 | return self; 42 | } 43 | - (NSInteger)numberOfCellsInSection:(NSInteger)section { 44 | return [self.collectionView numberOfItemsInSection:section]; 45 | } 46 | 47 | - (CGSize)collectionViewContentSize { 48 | return CGSizeMake(self.collectionView.contentSize.width, [self itemSize].height); 49 | } 50 | 51 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { 52 | NSMutableArray *attributes = [NSMutableArray new]; 53 | for (int j = 0; j < [self numberOfCellsInSection:0]; j++) { 54 | NSIndexPath *indexPath = [NSIndexPath indexPathForItem:j inSection:0]; 55 | [attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]]; 56 | } 57 | return attributes; 58 | } 59 | 60 | - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath { 61 | UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; 62 | attributes.center = [self centerWithIndexPath:indexPath]; 63 | attributes.size = [[self class] cellSize]; 64 | attributes.alpha = indexPath.row != self.indexPath.row ? 0 : 1; 65 | return attributes; 66 | } 67 | 68 | - (CGPoint)initialCenterWithIndexPath:(NSIndexPath *)indexPath { 69 | return [self.collectionView layoutAttributesForItemAtIndexPath:indexPath].center; 70 | } 71 | 72 | - (CGPoint)centerWithIndexPath:(NSIndexPath *)indexPath { 73 | CGPoint center; 74 | if (indexPath.row != self.indexPath.row) { 75 | CGPoint initialCenter = [self initialCenterWithIndexPath:indexPath]; 76 | center = CGPointMake(initialCenter.x, CGRectGetHeight(self.collectionView.frame) + [[self class] cellSize].height); 77 | } else { 78 | center = CGPointMake(CGRectGetWidth(self.collectionView.bounds)/2, [[self class] cellSize].height/2); 79 | } 80 | 81 | return center; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignOutViewController/View/BRASelectNamesView.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAVisitor.h" 26 | 27 | @protocol BRASelectNamesDelegate 28 | - (void)nameDidSelected:(NSString *)name; 29 | @end 30 | 31 | @interface BRASelectNamesView : UIView 32 | 33 | @property (nonatomic, strong) NSString *nameAndSurname; 34 | @property (nonatomic, weak) id delegate; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SignOutViewController/View/BRASelectNamesView.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASelectNamesView.h" 26 | 27 | @interface BRASelectNamesView () 28 | @property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *buttons; 29 | @end 30 | 31 | @implementation BRASelectNamesView 32 | 33 | #pragma mark - Class methods 34 | 35 | + (NSUInteger)randomNumberWithFinalNumber:(NSUInteger)finalNumber { 36 | return arc4random() % finalNumber; 37 | } 38 | 39 | + (NSArray *)surnames { 40 | static NSArray *surnames; 41 | static dispatch_once_t onceToken; 42 | dispatch_once(&onceToken, ^{ 43 | surnames = @[@"Smith", @"Jones", @"Taylor", @"Williams", @"Brown", @"Davies", @"Evans", @"Wilson", @"Thomas", @"Roberts", @"Johnson", @"Lewis", @"Walker", @"Robinson", @"Wood", @"Thompson", @"White"]; 44 | }); 45 | return surnames; 46 | } 47 | 48 | + (NSString *)randomSurname { 49 | NSArray *surnames = [self surnames]; 50 | NSUInteger random = [self randomNumberWithFinalNumber:surnames.count - 1]; 51 | return surnames[random]; 52 | } 53 | 54 | #pragma mark - Life Cycle 55 | 56 | - (void)awakeFromNib { 57 | [super awakeFromNib]; 58 | [self setupButtons]; 59 | } 60 | 61 | #pragma mark - private API 62 | 63 | - (void)setupNames { 64 | NSUInteger correctButtonNameIndex = [[self class] randomNumberWithFinalNumber:self.buttons.count]; 65 | [self.buttons[correctButtonNameIndex] setTitle:self.nameAndSurname forState:UIControlStateNormal]; 66 | 67 | for (UIButton *button in self.buttons) { 68 | if (button.titleLabel.text == nil) { 69 | [button setTitle:[NSString stringWithFormat:@"%@ %@", [self visitorName], [[self class] randomSurname]] forState:UIControlStateNormal]; 70 | } 71 | } 72 | } 73 | 74 | - (void)setupButtons { 75 | for (UIButton *buttons in self.buttons) { 76 | buttons.layer.cornerRadius = 2; 77 | buttons.layer.masksToBounds = YES; 78 | } 79 | } 80 | 81 | - (NSString *)visitorName { 82 | NSString *name = [[self.nameAndSurname componentsSeparatedByString:@" "] firstObject]; 83 | return name; 84 | } 85 | 86 | #pragma mark - Setters 87 | 88 | - (void)setNameAndSurname:(NSString *)nameAndSurname { 89 | if (nameAndSurname != nil) { 90 | _nameAndSurname = nameAndSurname; 91 | [self setupNames]; 92 | } 93 | } 94 | 95 | #pragma mark - Actions 96 | 97 | - (IBAction)firstNameSelected:(UIButton *)sender { 98 | [self.delegate nameDidSelected:sender.titleLabel.text]; 99 | } 100 | 101 | - (IBAction)secondNameSelected:(UIButton *)sender { 102 | [self.delegate nameDidSelected:sender.titleLabel.text]; 103 | } 104 | 105 | - (IBAction)thirdNameSelected:(UIButton *)sender { 106 | [self.delegate nameDidSelected:sender.titleLabel.text]; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SingoutViewController/BRASignoutCollectionDataSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAVisitor.h" 26 | 27 | @interface BRASignoutCollectionDataSource : NSObject 28 | 29 | - (NSUInteger)numberOfVisitors; 30 | - (BRAVisitor *)visitorAtIndex:(NSInteger)index; 31 | - (void)removeVisitorAtIndexPath:(NSIndexPath *)indexPath; 32 | 33 | @end 34 | 35 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SingoutViewController/BRASignoutCollectionDataSource.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASignoutCollectionDataSource.h" 26 | #import "BRASignOutViewController.h" 27 | #import "BRARepository+VisitorAdditions.h" 28 | #import "BRASignoutCollectionCell.h" 29 | 30 | @interface BRASignoutCollectionDataSource () 31 | 32 | @property (nonatomic, strong) BRARepository *visitorRepository; 33 | @property (nonatomic, strong) NSArray *visitors; 34 | 35 | @end 36 | 37 | @implementation BRASignoutCollectionDataSource 38 | 39 | - (instancetype)init { 40 | if (self = [super init]) { 41 | self.visitorRepository = [BRARepository sharedInstance]; 42 | [self reloadVisitors]; 43 | } 44 | return self; 45 | } 46 | 47 | #pragma mark - Data Source 48 | 49 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { 50 | return 1; 51 | } 52 | 53 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 54 | return self.visitors.count; 55 | } 56 | 57 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 58 | BRASignoutCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[BRASignOutViewController cellIdentifier] forIndexPath:indexPath]; 59 | cell.cellImage = [self.visitors[(NSUInteger) indexPath.row] profilePhoto]; 60 | return cell; 61 | } 62 | 63 | #pragma mark - private api 64 | 65 | - (void)reloadVisitors { 66 | self.visitors = self.visitorRepository.signedInVisitors; 67 | } 68 | 69 | #pragma mark - public api 70 | 71 | - (NSUInteger)numberOfVisitors { 72 | return [self.visitors count]; 73 | } 74 | 75 | - (BRAVisitor *)visitorAtIndex:(NSInteger)index { 76 | return self.visitors[(NSUInteger) index]; 77 | } 78 | 79 | - (void)removeVisitorAtIndexPath:(NSIndexPath *)indexPath { 80 | [self.visitorRepository deleteVisitor:self.visitors[(NSUInteger) indexPath.row]]; 81 | [self reloadVisitors]; 82 | 83 | } 84 | @end 85 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SingoutViewController/View/BRASignoutCollectionCell.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRASignoutCollectionCell : UICollectionViewCell 26 | 27 | @property (nonatomic, strong) UIImage *cellImage; 28 | 29 | @end 30 | 31 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/SingoutViewController/View/BRASignoutCollectionCell.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRASignoutCollectionCell.h" 26 | 27 | @interface BRASignoutCollectionCell () 28 | 29 | @property (nonatomic, strong) UIImageView *cellImageView; 30 | 31 | @end 32 | 33 | @implementation BRASignoutCollectionCell 34 | 35 | #pragma mark - Class methods 36 | 37 | + (UIColor *)backgroundColor { 38 | return [UIColor colorWithWhite:0.95 alpha:1.0]; 39 | } 40 | 41 | #pragma mark - private 42 | 43 | - (void)layoutSubviews { 44 | [super layoutSubviews]; 45 | self.layer.cornerRadius = CGRectGetWidth(self.frame)/2; 46 | self.layer.masksToBounds = YES; 47 | self.contentView.backgroundColor = [[self class] backgroundColor]; 48 | } 49 | 50 | - (void)setupCellImageView { 51 | self.cellImageView = [[UIImageView alloc] initWithFrame:self.contentView.frame]; 52 | self.cellImageView.image = self.cellImage; 53 | self.cellImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 54 | self.cellImageView.layer.masksToBounds = YES; 55 | self.cellImageView.contentMode = UIViewContentModeScaleAspectFill; 56 | [self.contentView addSubview:self.cellImageView]; 57 | } 58 | 59 | 60 | #pragma mark - Setter 61 | 62 | - (void)setCellImage:(UIImage *)cellImage { 63 | if (![_cellImage isEqual:cellImage]) { 64 | _cellImage = cellImage; 65 | [self setupCellImageView]; 66 | } 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/UIViewController+Factory/UIViewController+Factory.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface UIViewController (Factory) 26 | 27 | + (instancetype)bra_controller; 28 | 29 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/UIViewController+Factory/UIViewController+Factory.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "UIViewController+Factory.h" 26 | 27 | @implementation UIViewController (Factory) 28 | 29 | + (NSString *)nibName { 30 | return NSStringFromClass([self class]); 31 | } 32 | 33 | + (instancetype)bra_controller { 34 | UIViewController *mainViewController = [[self alloc] initWithNibName:[self nibName] bundle:nil]; 35 | return mainViewController; 36 | } 37 | 38 | @end -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/WebViewController/BRAWebViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface BRAWebViewController : UIViewController 26 | 27 | @property (strong, nonatomic) NSURLRequest *request; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/WebViewController/BRAWebViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2015-present Badoo Trading Limited. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BRAWebViewController.h" 26 | 27 | @interface BRAWebViewController () 28 | @property (weak, nonatomic) IBOutlet UIWebView *webView; 29 | @property (nonatomic) BOOL initialPageLoaded; 30 | @end 31 | 32 | @implementation BRAWebViewController 33 | 34 | - (void)viewDidLoad { 35 | [super viewDidLoad]; 36 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone 37 | target:self 38 | action:@selector(done:)]; 39 | self.title = NSLocalizedString(@"Loading...", nil); 40 | self.webView.delegate = self; 41 | [self.webView loadRequest:self.request]; 42 | } 43 | 44 | - (void)done:(UIBarButtonItem *)item { 45 | [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; 46 | } 47 | 48 | #pragma mark - UIWebViewDelegate 49 | 50 | - (void)webViewDidFinishLoad:(UIWebView *)webView { 51 | NSString *pageTitle = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; 52 | self.title = pageTitle; 53 | if ([[webView stringByEvaluatingJavaScriptFromString:@"document.readyState"] isEqualToString:@"complete"]) { 54 | self.initialPageLoaded = YES; 55 | } 56 | } 57 | 58 | - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { 59 | return !self.initialPageLoaded; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/ViewControllers/WebViewController/BRAWebViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionApp/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Badoo Trading Limited, 2010-present. All rights reserved. 3 | // 4 | 5 | #import "BRAAppDelegate.h" 6 | 7 | int main(int argc, char * argv[]) { 8 | @autoreleasepool { 9 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([BRAAppDelegate class])); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.badoo.Badoo.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ReceptionApp/ReceptionAppTests/ReceptionAppTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ReceptionAppTests.m 3 | // ReceptionAppTests 4 | // 5 | // Created by Joan Molinas on 08/07/2015. 6 | // Copyright (c) 2015 Badoo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ReceptionAppTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ReceptionAppTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------