├── Screens └── SampleScreen.png ├── DBChatAvatarSample ├── DBChatAvatarSample │ ├── .DS_Store │ ├── Resources │ │ ├── DBAvatars.xcassets │ │ │ ├── Avatar_1.imageset │ │ │ │ ├── Avatar_1.png │ │ │ │ └── Contents.json │ │ │ ├── Avatar_2.imageset │ │ │ │ ├── Avatar_2.png │ │ │ │ └── Contents.json │ │ │ ├── Avatar_3.imageset │ │ │ │ ├── Avatar_3.png │ │ │ │ └── Contents.json │ │ │ ├── Avatar_4.imageset │ │ │ │ ├── Avatar_4.png │ │ │ │ └── Contents.json │ │ │ ├── Avatar_5.imageset │ │ │ │ ├── Avatar_5.png │ │ │ │ └── Contents.json │ │ │ ├── UserPlaceholder.imageset │ │ │ │ ├── UserPlaceholder.png │ │ │ │ └── Contents.json │ │ │ └── LaunchImage.launchimage │ │ │ │ └── Contents.json │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ └── Base.lproj │ │ │ ├── LaunchScreen.xib │ │ │ └── Main.storyboard │ ├── Classes │ │ ├── Controllers │ │ │ ├── DBChatsController.h │ │ │ └── DBChatsController.m │ │ ├── Helpers │ │ │ └── UIImage+ │ │ │ │ ├── UIImage+Default.h │ │ │ │ └── UIImage+Default.m │ │ ├── Managers │ │ │ ├── DBChatManager.h │ │ │ └── DBChatManager.m │ │ ├── Views │ │ │ ├── DBChatCell.h │ │ │ └── DBChatCell.m │ │ └── Model │ │ │ ├── DBChat.h │ │ │ ├── DBUser.h │ │ │ ├── DBChat.m │ │ │ └── DBUser.m │ ├── AppDelegate.h │ ├── main.m │ ├── Info.plist │ └── AppDelegate.m ├── DBChatAvatarSample.xcodeproj │ ├── xcuserdata │ │ ├── di.xcuserdatad │ │ │ ├── xcdebugger │ │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── xcschemes │ │ │ │ └── xcschememanagement.plist │ │ └── dianashumskaya.xcuserdatad │ │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── DBChatAvatarSample.xcscheme │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcuserdata │ │ │ ├── di.xcuserdatad │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── dianashumskaya.xcuserdatad │ │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── DBChatAvatarSample.xccheckout │ └── project.pbxproj └── Podfile ├── DBChatAvatarView ├── DBAvatarView.h ├── DBStatusView.h ├── DBChatAvatarView.h ├── DBAvatarView.m ├── DBStatusView.m └── DBChatAvatarView.m ├── DBChatAvatarView.podspec ├── LICENSE ├── README.md └── .gitignore /Screens/SampleScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/Screens/SampleScreen.png -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample/.DS_Store -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/xcuserdata/di.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/xcuserdata/dianashumskaya.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_1.imageset/Avatar_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_1.imageset/Avatar_1.png -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_2.imageset/Avatar_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_2.imageset/Avatar_2.png -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_3.imageset/Avatar_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_3.imageset/Avatar_3.png -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_4.imageset/Avatar_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_4.imageset/Avatar_4.png -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_5.imageset/Avatar_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_5.imageset/Avatar_5.png -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/UserPlaceholder.imageset/UserPlaceholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/UserPlaceholder.imageset/UserPlaceholder.png -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.xcworkspace/xcuserdata/di.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.xcworkspace/xcuserdata/di.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.xcworkspace/xcuserdata/dianashumskaya.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dibelogrivaya/DBChatAvatarView/HEAD/DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.xcworkspace/xcuserdata/dianashumskaya.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DBChatAvatarView/DBAvatarView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBAvatarView.h 3 | // 4 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | @interface DBAvatarView : UIView 10 | 11 | @property (nonatomic) UIColor *borderColor; 12 | 13 | - (void)reset; 14 | - (void)setImage:(UIImage *)image; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Controllers/DBChatsController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatsController.h 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DBChatsController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Helpers/UIImage+/UIImage+Default.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Default.h 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (Default) 12 | 13 | + (UIImage *)defaultUserPlaceholder; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Managers/DBChatManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatManager.h 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DBChatManager : NSObject 12 | 13 | + (instancetype)instance; 14 | 15 | - (NSArray *)sampleChats; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Helpers/UIImage+/UIImage+Default.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Default.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import "UIImage+Default.h" 10 | 11 | @implementation UIImage (Default) 12 | 13 | + (UIImage *)defaultUserPlaceholder { 14 | return [UIImage imageNamed:@"UserPlaceholder"]; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Views/DBChatCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatCell.h 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DBChat; 12 | 13 | @interface DBChatCell : UITableViewCell 14 | 15 | @property (strong, nonatomic) DBChat *chat; 16 | 17 | + (NSString *)cellID; 18 | + (CGFloat)cellHeight; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Avatar_1.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 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Avatar_2.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 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Avatar_3.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 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Avatar_4.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 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/Avatar_5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Avatar_5.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 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.xcworkspace/xcuserdata/dianashumskaya.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/UserPlaceholder.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "UserPlaceholder.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 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/xcuserdata/di.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DBChatAvatarSample.xcscheme 8 | 9 | orderHint 10 | 3 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DBChatAvatarView/DBStatusView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBStatusView.h 3 | // 4 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | @interface DBStatusView : UIView 10 | 11 | @property (nonatomic, assign) BOOL hasStatus; 12 | @property (nonatomic) UIColor *statusColor; 13 | @property (nonatomic) UIColor *borderColor; 14 | @property (nonatomic, assign) CGFloat borderWidth; 15 | @property (nonatomic, assign) CGFloat borderScale; 16 | 17 | - (void)reset; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Model/DBChat.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBChat.h 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DBChat : NSObject 12 | 13 | @property (copy, nonatomic, readonly) NSString *name; 14 | @property (copy, nonatomic, readonly) NSArray *users; 15 | 16 | + (instancetype)chatWithName:(NSString *)chatName users:(NSArray *)chatUsers; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Model/DBUser.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBUser.h 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DBUser : NSObject 12 | 13 | @property (copy, nonatomic, readonly) NSString *name; 14 | @property (copy, nonatomic, readonly) NSString *avatar; 15 | @property (assign, nonatomic, readonly) BOOL isOnline; 16 | 17 | + (instancetype)userWithName:(NSString *)userName avatar:(NSString *)userAvatarName onlineStatus:(BOOL)userOnline; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DBChatAvatarSample/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | source 'git@github.com:dibelogrivaya/db-specs.git' 3 | 4 | platform :ios, '8.0' 5 | 6 | project 'DBChatAvatarSample' 7 | 8 | inhibit_all_warnings! 9 | use_frameworks! 10 | 11 | target 'DBChatAvatarSample' do 12 | 13 | pod 'DBChatAvatarView' 14 | 15 | end 16 | 17 | post_install do |installer_representation| 18 | puts("Update debug pod settings to speed up build time") 19 | Dir.glob(File.join("Pods", "**", "Pods*{debug,Private}.xcconfig")).each do |file| 20 | File.open(file, 'a') { |f| f.puts "\nDEBUG_INFORMATION_FORMAT = dwarf" } 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /DBChatAvatarView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "DBChatAvatarView" 3 | s.version = "1.1" 4 | s.summary = "Group avatar for chat." 5 | 6 | s.homepage = "https://github.com/dibelogrivaya" 7 | s.license = { :type => "MIT", :file => "LICENSE" } 8 | s.author = { "Diana Belogrivaya" => "diana.belogrivaya@gmail.com" } 9 | s.source = { :http => 'https://github.com/dibelogrivaya/DBChatAvatarView/archive/1.1.tar.gz' } 10 | s.requires_arc = true 11 | 12 | s.source_files = ['DBChatAvatarView/*.{h,m}'] 13 | s.platforms = { :ios => "8.0" } 14 | 15 | s.dependency 'UIColor+Hex' 16 | end -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/xcuserdata/dianashumskaya.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DBChatAvatarSample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 26172A4F1A7D1D39006BA402 16 | 17 | primary 18 | 19 | 20 | 26172A681A7D1D3A006BA402 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DBChatAvatarView/DBChatAvatarView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatAvatarView.h 3 | // 4 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | @class DBChatAvatarView; 10 | 11 | typedef NS_ENUM(NSInteger, DBChatAvatarState) { 12 | DBChatAvatarStateNone, 13 | DBChatAvatarStateOffline, 14 | DBChatAvatarStateOnline 15 | }; 16 | 17 | @protocol DBChatAvatarViewDataSource 18 | 19 | - (NSInteger)numberOfUsersInChatAvatarView:(DBChatAvatarView *)chatAvatarView; 20 | - (DBChatAvatarState)stateForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView; 21 | - (UIImage *)imageForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView; 22 | 23 | @end 24 | 25 | @interface DBChatAvatarView : UIView 26 | 27 | @property (weak, nonatomic) id chatAvatarDataSource; 28 | 29 | - (void)reloadAvatars; 30 | - (void)reset; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Model/DBChat.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBChat.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import "DBChat.h" 10 | 11 | @interface DBChat () 12 | 13 | @property (copy, nonatomic, readwrite) NSString *name; 14 | @property (copy, nonatomic, readwrite) NSArray *users; 15 | 16 | @end 17 | 18 | @implementation DBChat 19 | 20 | + (instancetype)chatWithName:(NSString *)chatName users:(NSArray *)chatUsers { 21 | return [[[self class] alloc] initWithName:chatName users:chatUsers]; 22 | } 23 | 24 | - (instancetype)initWithName:(NSString *)chatName users:(NSArray *)chatUsers { 25 | if (self = [super init]) { 26 | _name = chatName; 27 | _users = chatUsers; 28 | } 29 | return self; 30 | } 31 | 32 | #pragma mark - NSCopying 33 | 34 | - (instancetype)copyWithZone:(NSZone *)zone { 35 | return [[[self class] allocWithZone:zone] initWithName:_name users:_users]; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Diana Belogrivaya 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 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Model/DBUser.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBUser.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import "DBUser.h" 10 | 11 | @interface DBUser () 12 | 13 | @property (copy, nonatomic, readwrite) NSString *name; 14 | @property (copy, nonatomic, readwrite) NSString *avatar; 15 | @property (assign, nonatomic, readwrite) BOOL isOnline; 16 | 17 | @end 18 | 19 | @implementation DBUser 20 | 21 | + (instancetype)userWithName:(NSString *)userName avatar:(NSString *)userAvatarName onlineStatus:(BOOL)userOnline { 22 | return [[[self class] alloc] initWithName:userName avatar:userAvatarName onlineStatus:userOnline]; 23 | } 24 | 25 | - (instancetype)initWithName:(NSString *)userName avatar:(NSString *)userAvatarName onlineStatus:(BOOL)userOnline { 26 | if (self = [super init]) { 27 | _name = userName; 28 | _avatar = userAvatarName; 29 | _isOnline = userOnline; 30 | } 31 | return self; 32 | } 33 | 34 | #pragma mark - NSCopying 35 | 36 | - (instancetype)copyWithZone:(NSZone *)zone { 37 | return [[[self class] allocWithZone:zone] initWithName:_name avatar:_avatar onlineStatus:_isOnline]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /DBChatAvatarView/DBAvatarView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBAvatarView.m 3 | // 4 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 5 | // 6 | 7 | #import "DBAvatarView.h" 8 | 9 | @implementation DBAvatarView { 10 | UIImage *_image; 11 | } 12 | 13 | - (instancetype)init { 14 | if (self = [super init]) { 15 | [self setup]; 16 | } 17 | return self; 18 | } 19 | 20 | - (void)reset { 21 | self.hidden = YES; 22 | } 23 | 24 | - (void)setup { 25 | self.backgroundColor = [UIColor clearColor]; 26 | _borderColor = [UIColor colorWithWhite:.8f alpha:.8f]; 27 | 28 | self.layer.shouldRasterize = YES; 29 | self.layer.rasterizationScale = [UIScreen mainScreen].scale; 30 | 31 | [self reset]; 32 | } 33 | 34 | - (void)setImage:(UIImage *)image { 35 | _image = image; 36 | 37 | [self setNeedsDisplay]; 38 | } 39 | 40 | - (void)drawRect:(CGRect)rect { 41 | CGFloat kLineWidth = 1.f; 42 | UIBezierPath *ovalPath = [UIBezierPath bezierPathWithOvalInRect:self.bounds]; 43 | [[UIColor whiteColor] setFill]; 44 | [ovalPath fill]; 45 | [ovalPath addClip]; 46 | [_image drawInRect:self.bounds]; 47 | [_borderColor setStroke]; 48 | ovalPath.lineWidth = kLineWidth; 49 | [ovalPath strokeWithBlendMode:kCGBlendModeNormal alpha:1.f]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/DBAvatars.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Controllers/DBChatsController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatsController.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import "DBChatsController.h" 10 | 11 | #import "DBChatCell.h" 12 | #import "DBChatManager.h" 13 | 14 | @interface DBChatsController () 15 | 16 | @property (strong, nonatomic) NSArray *chats; 17 | 18 | @end 19 | 20 | @implementation DBChatsController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | self.chats = [[DBChatManager instance] sampleChats]; 26 | 27 | [self.tableView reloadData]; 28 | } 29 | 30 | #pragma mark - Table view data source 31 | 32 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 33 | return [self.chats count]; 34 | } 35 | 36 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 37 | DBChatCell *cell = (DBChatCell *)[tableView dequeueReusableCellWithIdentifier:[DBChatCell cellID] forIndexPath:indexPath]; 38 | 39 | DBChat *chat = self.chats[indexPath.row]; 40 | [cell setChat:chat]; 41 | 42 | return cell; 43 | } 44 | 45 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 46 | return [DBChatCell cellHeight]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | DBChatAvatar 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UIRequiresFullScreen 36 | 37 | UIStatusBarHidden 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DBChatAvatarView 2 | 3 | The control, which allow you to create group avatar for chat. 4 | 5 | [![Xcode](https://img.shields.io/badge/Xcode-9.0-blue.svg?style=flat)](https://developer.apple.com/xcode) 6 | [![Platform](https://img.shields.io/badge/platform-iOS(%3E%3D8)-orange.svg?style=flat)](https://github.com/dibelogrivaya/DBChatAvatarView) 7 | [![License](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat)](https://github.com/dibelogrivaya/DBChatAvatarView) 8 | 9 | ## Screenshot 10 | 11 | ![Sample screen](https://github.com/medinaonly/DBChatAvatarSample/blob/master/Screens/SampleScreen.png) 12 | 13 | 14 | ## Installation 15 | 16 | ```objc 17 | source 'git@github.com:dibelogrivaya/db-specs.git' 18 | pod "DBChatAvatarView" 19 | ``` 20 | 21 | ## Usage 22 | 23 | * Import `DBChatAvatarView.h` in your view. 24 | * Create a new `DBChatAvatarView` with Storyboards or via code. 25 | 26 | ```objc 27 | DBChatAvatarView *chatAvatarView = [[DBChatAvatarView alloc] initWithFrame:frame]; 28 | [self.view addSubview:chatAvatarView]; 29 | ``` 30 | 31 | * Implement protocol `DBChatAvatarViewDataSource` 32 | 33 | ```objc 34 | @protocol DBChatAvatarViewDataSource 35 | 36 | - (NSInteger)numberOfUsersInChatAvatarView:(DBChatAvatarView *)chatAvatarView; 37 | - (DBChatAvatarState)stateForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView; 38 | - (UIImage *)imageForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView; 39 | 40 | @end 41 | 42 | ``` 43 | 44 | * Reload 45 | 46 | ```objc 47 | 48 | [chatAvatarView reloadAvatars]; 49 | 50 | ``` 51 | 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | *.xcworkspace 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | Pods/* 40 | Podfile.lock 41 | DBChatAvatarSample/Pods/* 42 | 43 | # Carthage 44 | # 45 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 46 | # Carthage/Checkouts 47 | 48 | Carthage/Build 49 | 50 | # fastlane 51 | # 52 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 53 | # screenshots whenever they are needed. 54 | # For more information about the recommended setup visit: 55 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 56 | 57 | fastlane/report.xml 58 | fastlane/Preview.html 59 | fastlane/screenshots 60 | fastlane/test_output 61 | 62 | # Code Injection 63 | # 64 | # After new code Injection tools there's a generated folder /iOSInjectionProject 65 | # https://github.com/johnno1962/injectionforxcode 66 | 67 | iOSInjectionProject/ 68 | 69 | .DS_Store 70 | 71 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.xcworkspace/xcshareddata/DBChatAvatarSample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 10B41D6B-9EAB-4FAD-961D-85967C747706 9 | IDESourceControlProjectName 10 | DBChatAvatarSample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 7C6D8829EB56B843AF8882F0B1303E36C7A26DB6 14 | github.com:medinaonly/DBChatAvatarSample.git 15 | 16 | IDESourceControlProjectPath 17 | DBChatAvatarSample.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 7C6D8829EB56B843AF8882F0B1303E36C7A26DB6 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:medinaonly/DBChatAvatarSample.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 7C6D8829EB56B843AF8882F0B1303E36C7A26DB6 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 7C6D8829EB56B843AF8882F0B1303E36C7A26DB6 36 | IDESourceControlWCCName 37 | DBChatAvatarSample 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /DBChatAvatarView/DBStatusView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBStatusView.m 3 | // 4 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 5 | // 6 | 7 | #import "DBStatusView.h" 8 | 9 | @implementation DBStatusView 10 | 11 | - (instancetype)init { 12 | if (self = [super init]) { 13 | [self setup]; 14 | } 15 | return self; 16 | } 17 | 18 | - (void)reset { 19 | self.hidden = YES; 20 | } 21 | 22 | - (void)setup { 23 | self.backgroundColor = [UIColor clearColor]; 24 | 25 | _statusColor = [UIColor whiteColor]; 26 | _borderColor = [UIColor whiteColor]; 27 | 28 | _borderWidth = 4.f; 29 | _hasStatus = NO; 30 | _borderScale = 1.f; 31 | 32 | self.layer.shouldRasterize = YES; 33 | self.layer.rasterizationScale = [UIScreen mainScreen].scale; 34 | 35 | [self reset]; 36 | } 37 | 38 | - (void)setBorderColor:(UIColor *)borderColor { 39 | _borderColor = borderColor; 40 | [self setNeedsDisplay]; 41 | } 42 | 43 | - (void)setStatusColor:(UIColor *)statusColor { 44 | _statusColor = statusColor; 45 | [self setNeedsDisplay]; 46 | } 47 | 48 | - (void)setHasStatus:(BOOL)hasStatus { 49 | _hasStatus = hasStatus; 50 | [self setNeedsDisplay]; 51 | } 52 | 53 | - (void)setBorderWidth:(CGFloat)borderWidth { 54 | _borderWidth = borderWidth; 55 | [self setNeedsDisplay]; 56 | } 57 | 58 | - (void)setBorderScale:(CGFloat)borderScale { 59 | _borderScale = borderScale; 60 | [self setNeedsDisplay]; 61 | } 62 | 63 | - (void)drawRect:(CGRect)rect { 64 | UIBezierPath *ovalPath = [UIBezierPath bezierPathWithOvalInRect:self.bounds]; 65 | [_statusColor setFill]; 66 | [ovalPath fill]; 67 | [ovalPath addClip]; 68 | [_borderColor setStroke]; 69 | ovalPath.lineWidth = _borderWidth * _borderScale; 70 | [ovalPath strokeWithBlendMode:kCGBlendModeNormal alpha:1.f]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Views/DBChatCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatCell.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import "DBChatCell.h" 10 | 11 | #import "DBChat.h" 12 | #import "DBUser.h" 13 | #import "UIImage+Default.h" 14 | 15 | #import "DBChatAvatarView.h" 16 | 17 | static NSString* const kCellIdentifier = @"CHAT_CELL_IDENTIFIER"; 18 | static const CGFloat kCellHeight = 70.f; 19 | 20 | @interface DBChatCell () 21 | 22 | @property (weak, nonatomic) IBOutlet DBChatAvatarView *vwAvatarView; 23 | @property (weak, nonatomic) IBOutlet UILabel *lblName; 24 | 25 | @end 26 | 27 | @implementation DBChatCell 28 | 29 | + (NSString *)cellID { 30 | return kCellIdentifier; 31 | } 32 | 33 | + (CGFloat)cellHeight { 34 | return kCellHeight; 35 | } 36 | 37 | - (void)awakeFromNib { 38 | [super awakeFromNib]; 39 | 40 | self.selectionStyle = UITableViewCellSelectionStyleNone; 41 | 42 | self.lblName.numberOfLines = 0; 43 | 44 | self.vwAvatarView.chatAvatarDataSource = self; 45 | } 46 | 47 | - (void)prepareForReuse { 48 | [super prepareForReuse]; 49 | 50 | [self.vwAvatarView reset]; 51 | } 52 | 53 | - (void)setChat:(DBChat *)chat { 54 | _chat = chat; 55 | 56 | self.lblName.text = _chat.name; 57 | [self.vwAvatarView reloadAvatars]; 58 | } 59 | 60 | #pragma mark - DBChatAvatarViewDataSource 61 | 62 | - (NSInteger)numberOfUsersInChatAvatarView:(DBChatAvatarView *)chatAvatarView { 63 | return _chat.users.count; 64 | } 65 | 66 | - (DBChatAvatarState)stateForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView { 67 | DBUser *user = _chat.users[avatarIndex]; 68 | return user.isOnline ? DBChatAvatarStateOnline : DBChatAvatarStateOffline; 69 | } 70 | 71 | - (UIImage *)imageForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView { 72 | DBUser *user = _chat.users[avatarIndex]; 73 | return (user.avatar && user.avatar.length > 0) ? [UIImage imageNamed:user.avatar] : [UIImage defaultUserPlaceholder]; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | 20 | [application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide]; 21 | 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application { 26 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 27 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | - (void)applicationWillEnterForeground:(UIApplication *)application { 36 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 37 | } 38 | 39 | - (void)applicationDidBecomeActive:(UIApplication *)application { 40 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 41 | } 42 | 43 | - (void)applicationWillTerminate:(UIApplication *)application { 44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Classes/Managers/DBChatManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatManager.m 3 | // DBChatAvatarSample 4 | // 5 | // Created by Diana Belogrivaya on 31/01/2015. 6 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 7 | // 8 | 9 | #import "DBChatManager.h" 10 | 11 | #import "DBChat.h" 12 | #import "DBUser.h" 13 | 14 | @implementation DBChatManager 15 | 16 | + (instancetype)instance { 17 | static id _sharedClient = nil; 18 | static dispatch_once_t onceToken; 19 | 20 | dispatch_once(&onceToken, ^{ 21 | _sharedClient = [self new]; 22 | }); 23 | 24 | return _sharedClient; 25 | } 26 | 27 | - (NSArray *)sampleNames { 28 | static NSArray *names; 29 | static dispatch_once_t onceToken; 30 | 31 | dispatch_once(&onceToken, ^{ 32 | names = @[ 33 | @"John Doe", 34 | @"Jane Doe", 35 | @"Tim Cook" 36 | ]; 37 | }); 38 | 39 | return names; 40 | } 41 | 42 | - (NSArray *)sampleChatNames { 43 | static NSArray *chatNames; 44 | static dispatch_once_t onceToken; 45 | 46 | dispatch_once(&onceToken, ^{ 47 | chatNames = @[ 48 | @"New York City Points of Interest", 49 | @"World Health Organization", 50 | @"Best New York attractions for locals and tourists alike", 51 | @"Computers" 52 | ]; 53 | }); 54 | 55 | return chatNames; 56 | } 57 | 58 | - (NSArray *)sampleAvatars { 59 | static NSArray *avatars; 60 | static dispatch_once_t onceToken; 61 | 62 | dispatch_once(&onceToken, ^{ 63 | avatars = @[ 64 | @"Avatar_1", 65 | @"Avatar_2", 66 | @"Avatar_3", 67 | @"Avatar_4", 68 | @"Avatar_5", 69 | @"" 70 | ]; 71 | }); 72 | 73 | return avatars; 74 | } 75 | 76 | - (NSString *)randomChatName { 77 | NSArray *items = [self sampleChatNames]; 78 | return items[arc4random_uniform((int32_t)[items count])]; 79 | } 80 | 81 | - (NSString *)randomName { 82 | NSArray *items = [self sampleNames]; 83 | return items[arc4random_uniform((int32_t)[items count])]; 84 | } 85 | 86 | - (NSString *)randomAvatar { 87 | NSArray *items = [self sampleAvatars]; 88 | return items[arc4random_uniform((int32_t)[items count])]; 89 | } 90 | 91 | - (BOOL)randomStatus { 92 | return [@(arc4random_uniform(2)) boolValue]; 93 | } 94 | 95 | - (NSArray *)sampleChats { 96 | static NSArray *chats; 97 | static dispatch_once_t onceToken; 98 | 99 | dispatch_once(&onceToken, ^{ 100 | chats = [self randomChats]; 101 | }); 102 | 103 | return chats; 104 | } 105 | 106 | - (NSArray *)randomChats { 107 | NSMutableArray *chats = [NSMutableArray new]; 108 | @autoreleasepool { 109 | NSInteger chatCount = 100; 110 | for (int i = 0; i < chatCount; i++) { 111 | NSInteger userCount = MAX(1, arc4random_uniform(5)); 112 | NSMutableArray *users = [NSMutableArray new]; 113 | for (int j = 0; j < userCount; j++) { 114 | DBUser *user = [DBUser userWithName:[self randomName] 115 | avatar:[self randomAvatar] 116 | onlineStatus:[self randomStatus]]; 117 | [users addObject:user]; 118 | } 119 | DBChat *chat = [DBChat chatWithName:[self randomChatName] 120 | users:users]; 121 | [chats addObject:chat]; 122 | } 123 | } 124 | return chats; 125 | } 126 | 127 | @end 128 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/xcuserdata/dianashumskaya.xcuserdatad/xcschemes/DBChatAvatarSample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /DBChatAvatarView/DBChatAvatarView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBChatAvatarView.m 3 | // 4 | // Copyright (c) 2015 Diana Belogrivaya. All rights reserved. 5 | // 6 | 7 | #import "DBChatAvatarView.h" 8 | 9 | #import "UIColor+HEX.h" 10 | 11 | #import "DBStatusView.h" 12 | #import "DBAvatarView.h" 13 | 14 | static const NSInteger kMaxVisibleAvatar = 4; 15 | 16 | @interface DBChatAvatarView () 17 | 18 | @property (assign, nonatomic) NSInteger totalCount; 19 | 20 | @property (strong, nonatomic) NSArray *statusViews; 21 | @property (strong, nonatomic) NSArray *avatarViews; 22 | 23 | @end 24 | 25 | @implementation DBChatAvatarView 26 | 27 | - (instancetype)initWithFrame:(CGRect)frame { 28 | if (self = [super initWithFrame:frame]) { 29 | [self baseInit]; 30 | } 31 | return self; 32 | } 33 | 34 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 35 | if (self = [super initWithCoder:aDecoder]) { 36 | [self baseInit]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)baseInit { 42 | self.backgroundColor = [UIColor clearColor]; 43 | 44 | self.avatarViews = @[]; 45 | for (int i = 0; i < 4; i++) { 46 | DBAvatarView *avatarView = [[DBAvatarView alloc] init]; 47 | [self addSubview:avatarView]; 48 | self.avatarViews = [self.avatarViews arrayByAddingObject:avatarView]; 49 | } 50 | 51 | self.statusViews = @[]; 52 | for (int i = 0; i < 4; i++) { 53 | DBStatusView *statusView = [[DBStatusView alloc] init]; 54 | [self addSubview:statusView]; 55 | self.statusViews = [self.statusViews arrayByAddingObject:statusView]; 56 | } 57 | 58 | [self reset]; 59 | } 60 | 61 | - (void)reset { 62 | self.totalCount = 0; 63 | 64 | for (DBAvatarView *avatarView in self.avatarViews) { 65 | [avatarView reset]; 66 | } 67 | 68 | for (DBStatusView *statusView in self.statusViews) { 69 | [statusView reset]; 70 | } 71 | } 72 | 73 | - (void)reloadAvatars { 74 | [self reset]; 75 | 76 | NSInteger usersCount = [self.chatAvatarDataSource numberOfUsersInChatAvatarView:self]; 77 | self.totalCount = MIN(kMaxVisibleAvatar, usersCount); 78 | 79 | if (self.totalCount > 0) { 80 | CGFloat width = 0; 81 | CGSize size = self.frame.size; 82 | 83 | if (self.totalCount == 1) { 84 | width = floorf(size.width); 85 | [self updateAvatarViewAtIndex:0 withFrame:CGRectMake(0, 0, width, width)]; 86 | return; 87 | } 88 | 89 | if (self.totalCount == 2) { 90 | width = floorf(size.width * 0.7); 91 | [self updateAvatarViewAtIndex:0 withFrame:CGRectMake(0, (size.height - width), width, width)]; 92 | [self updateAvatarViewAtIndex:1 withFrame:CGRectMake((size.width - width), 0, width, width)]; 93 | return; 94 | } 95 | 96 | if (self.totalCount == 3) { 97 | CGFloat kPadding = 1.f; 98 | width = floorf(size.width * 0.5) - kPadding * 2; 99 | [self updateAvatarViewAtIndex:0 withFrame:CGRectMake((size.width - width) * 0.5, 1.5, width, width)]; 100 | [self updateAvatarViewAtIndex:1 withFrame:CGRectMake(kPadding, (size.height - width) - 1.5, width, width)]; 101 | [self updateAvatarViewAtIndex:2 withFrame:CGRectMake((size.width - width), (size.height - width) - 1.5, width, width)]; 102 | return; 103 | } 104 | 105 | CGFloat kPadding = 1.f; 106 | width = floorf(size.width * 0.5) - kPadding * 2; 107 | [self updateAvatarViewAtIndex:0 withFrame:CGRectMake(kPadding, kPadding, width, width)]; 108 | [self updateAvatarViewAtIndex:1 withFrame:CGRectMake((size.width - width), kPadding, width, width)]; 109 | [self updateAvatarViewAtIndex:2 withFrame:CGRectMake(kPadding, (size.height - width), width, width)]; 110 | [self updateAvatarViewAtIndex:3 withFrame:CGRectMake((size.width - width), (size.height - width), width, width)]; 111 | } 112 | } 113 | 114 | - (void)updateAvatarViewAtIndex:(NSInteger)index withFrame:(CGRect)frame { 115 | DBAvatarView *avatarView = self.avatarViews[index]; 116 | avatarView.hidden = NO; 117 | avatarView.frame = frame; 118 | 119 | UIImage *image = [self.chatAvatarDataSource imageForAvatarAtIndex:index inChatAvatarView:self]; 120 | [avatarView setImage:image]; 121 | 122 | DBChatAvatarState state = [self.chatAvatarDataSource stateForAvatarAtIndex:index inChatAvatarView:self]; 123 | DBStatusView *statusView = self.statusViews[index]; 124 | statusView.borderScale = (float)1/self.totalCount; 125 | 126 | CGFloat kStatusViewSide = CGRectGetWidth(avatarView.frame) / 3.5; 127 | CGRect statusRect = CGRectMake(avatarView.frame.origin.x + avatarView.frame.size.width - kStatusViewSide, avatarView.frame.origin.y + avatarView.frame.size.height - kStatusViewSide - 1.f, kStatusViewSide, kStatusViewSide); 128 | statusView.frame = statusRect; 129 | statusView.hidden = NO; 130 | [statusView setStatusColor:[self statusColorForState:state]]; 131 | } 132 | 133 | - (UIColor *)statusColorForState:(DBChatAvatarState)state { 134 | switch (state) { 135 | case DBChatAvatarStateOffline: return [UIColor colorWithHex:0xE46663]; 136 | case DBChatAvatarStateOnline: return [UIColor colorWithHex:0x91D66E]; 137 | default: return [UIColor lightGrayColor]; 138 | } 139 | return [UIColor lightGrayColor]; 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample/Resources/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | AvenirNext-Regular 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /DBChatAvatarSample/DBChatAvatarSample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 26172A561A7D1D39006BA402 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172A551A7D1D39006BA402 /* main.m */; }; 11 | 26172A591A7D1D39006BA402 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172A581A7D1D39006BA402 /* AppDelegate.m */; }; 12 | 26172A841A7D1DD7006BA402 /* DBChat.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172A831A7D1DD7006BA402 /* DBChat.m */; }; 13 | 26172A871A7D1DE3006BA402 /* DBUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172A861A7D1DE3006BA402 /* DBUser.m */; }; 14 | 26172A8A1A7D2011006BA402 /* DBChatsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172A891A7D2011006BA402 /* DBChatsController.m */; }; 15 | 26172A8D1A7D203B006BA402 /* DBChatCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172A8C1A7D203B006BA402 /* DBChatCell.m */; }; 16 | 26172A901A7D20DF006BA402 /* DBChatManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172A8F1A7D20DF006BA402 /* DBChatManager.m */; }; 17 | 26172AA61A7D3068006BA402 /* UIImage+Default.m in Sources */ = {isa = PBXBuildFile; fileRef = 26172AA51A7D3068006BA402 /* UIImage+Default.m */; }; 18 | 268B3B2F1A84E9E40072596E /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 268B3B161A84E9E40072596E /* LaunchScreen.xib */; }; 19 | 268B3B301A84E9E40072596E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 268B3B181A84E9E40072596E /* Main.storyboard */; }; 20 | 268B3B311A84E9E40072596E /* DBAvatars.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 268B3B1A1A84E9E40072596E /* DBAvatars.xcassets */; }; 21 | 268B3B321A84E9E40072596E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 268B3B1B1A84E9E40072596E /* Images.xcassets */; }; 22 | F68DA003C3173C79E648A677 /* Pods_DBChatAvatarSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 970FEE5B7599CC66C0DA4CE2 /* Pods_DBChatAvatarSample.framework */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 26172A501A7D1D39006BA402 /* DBChatAvatarSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DBChatAvatarSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 26172A541A7D1D39006BA402 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 26172A551A7D1D39006BA402 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | 26172A571A7D1D39006BA402 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 30 | 26172A581A7D1D39006BA402 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 31 | 26172A821A7D1DD7006BA402 /* DBChat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBChat.h; sourceTree = ""; }; 32 | 26172A831A7D1DD7006BA402 /* DBChat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBChat.m; sourceTree = ""; }; 33 | 26172A851A7D1DE3006BA402 /* DBUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBUser.h; sourceTree = ""; }; 34 | 26172A861A7D1DE3006BA402 /* DBUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBUser.m; sourceTree = ""; }; 35 | 26172A881A7D2011006BA402 /* DBChatsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBChatsController.h; sourceTree = ""; }; 36 | 26172A891A7D2011006BA402 /* DBChatsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBChatsController.m; sourceTree = ""; }; 37 | 26172A8B1A7D203B006BA402 /* DBChatCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBChatCell.h; sourceTree = ""; }; 38 | 26172A8C1A7D203B006BA402 /* DBChatCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBChatCell.m; sourceTree = ""; }; 39 | 26172A8E1A7D20DF006BA402 /* DBChatManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBChatManager.h; sourceTree = ""; }; 40 | 26172A8F1A7D20DF006BA402 /* DBChatManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBChatManager.m; sourceTree = ""; }; 41 | 26172AA41A7D3068006BA402 /* UIImage+Default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Default.h"; sourceTree = ""; }; 42 | 26172AA51A7D3068006BA402 /* UIImage+Default.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Default.m"; sourceTree = ""; }; 43 | 268B3B171A84E9E40072596E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 44 | 268B3B191A84E9E40072596E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 268B3B1A1A84E9E40072596E /* DBAvatars.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DBAvatars.xcassets; sourceTree = ""; }; 46 | 268B3B1B1A84E9E40072596E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 47 | 8030DE6D1696ADE4D1D98718 /* Pods-DBChatAvatarSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DBChatAvatarSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-DBChatAvatarSample/Pods-DBChatAvatarSample.release.xcconfig"; sourceTree = ""; }; 48 | 970FEE5B7599CC66C0DA4CE2 /* Pods_DBChatAvatarSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DBChatAvatarSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | EDEF89E13AD8FC19817CB57D /* Pods-DBChatAvatarSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DBChatAvatarSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DBChatAvatarSample/Pods-DBChatAvatarSample.debug.xcconfig"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 26172A4D1A7D1D39006BA402 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | F68DA003C3173C79E648A677 /* Pods_DBChatAvatarSample.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 0251E6A8200F9B73004A0BDE /* Managers */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 26172A8E1A7D20DF006BA402 /* DBChatManager.h */, 68 | 26172A8F1A7D20DF006BA402 /* DBChatManager.m */, 69 | ); 70 | path = Managers; 71 | sourceTree = ""; 72 | }; 73 | 0CE0971B3549307A31F477E2 /* Pods */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | EDEF89E13AD8FC19817CB57D /* Pods-DBChatAvatarSample.debug.xcconfig */, 77 | 8030DE6D1696ADE4D1D98718 /* Pods-DBChatAvatarSample.release.xcconfig */, 78 | ); 79 | name = Pods; 80 | sourceTree = ""; 81 | }; 82 | 26172A471A7D1D39006BA402 = { 83 | isa = PBXGroup; 84 | children = ( 85 | 26172A521A7D1D39006BA402 /* DBChatAvatarSample */, 86 | 268B3B151A84E9E40072596E /* Resources */, 87 | 26172A511A7D1D39006BA402 /* Products */, 88 | 0CE0971B3549307A31F477E2 /* Pods */, 89 | 9D67331B8CDC025A4A7723A9 /* Frameworks */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 26172A511A7D1D39006BA402 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 26172A501A7D1D39006BA402 /* DBChatAvatarSample.app */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 26172A521A7D1D39006BA402 /* DBChatAvatarSample */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 26172A571A7D1D39006BA402 /* AppDelegate.h */, 105 | 26172A581A7D1D39006BA402 /* AppDelegate.m */, 106 | 26172A7A1A7D1D8E006BA402 /* Classes */, 107 | 26172A531A7D1D39006BA402 /* Supporting Files */, 108 | ); 109 | path = DBChatAvatarSample; 110 | sourceTree = ""; 111 | }; 112 | 26172A531A7D1D39006BA402 /* Supporting Files */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 26172A541A7D1D39006BA402 /* Info.plist */, 116 | 26172A551A7D1D39006BA402 /* main.m */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | 26172A7A1A7D1D8E006BA402 /* Classes */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 0251E6A8200F9B73004A0BDE /* Managers */, 125 | 26172A7B1A7D1D8E006BA402 /* Controllers */, 126 | 26172A7F1A7D1D8E006BA402 /* Views */, 127 | 26172A7E1A7D1D8E006BA402 /* Model */, 128 | 26172A9E1A7D2F22006BA402 /* Helpers */, 129 | ); 130 | path = Classes; 131 | sourceTree = ""; 132 | }; 133 | 26172A7B1A7D1D8E006BA402 /* Controllers */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 26172A881A7D2011006BA402 /* DBChatsController.h */, 137 | 26172A891A7D2011006BA402 /* DBChatsController.m */, 138 | ); 139 | path = Controllers; 140 | sourceTree = ""; 141 | }; 142 | 26172A7E1A7D1D8E006BA402 /* Model */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 26172A821A7D1DD7006BA402 /* DBChat.h */, 146 | 26172A831A7D1DD7006BA402 /* DBChat.m */, 147 | 26172A851A7D1DE3006BA402 /* DBUser.h */, 148 | 26172A861A7D1DE3006BA402 /* DBUser.m */, 149 | ); 150 | path = Model; 151 | sourceTree = ""; 152 | }; 153 | 26172A7F1A7D1D8E006BA402 /* Views */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 26172A8B1A7D203B006BA402 /* DBChatCell.h */, 157 | 26172A8C1A7D203B006BA402 /* DBChatCell.m */, 158 | ); 159 | path = Views; 160 | sourceTree = ""; 161 | }; 162 | 26172A9E1A7D2F22006BA402 /* Helpers */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 26172AA31A7D304C006BA402 /* UIImage+ */, 166 | ); 167 | path = Helpers; 168 | sourceTree = ""; 169 | }; 170 | 26172AA31A7D304C006BA402 /* UIImage+ */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 26172AA41A7D3068006BA402 /* UIImage+Default.h */, 174 | 26172AA51A7D3068006BA402 /* UIImage+Default.m */, 175 | ); 176 | path = "UIImage+"; 177 | sourceTree = ""; 178 | }; 179 | 268B3B151A84E9E40072596E /* Resources */ = { 180 | isa = PBXGroup; 181 | children = ( 182 | 268B3B161A84E9E40072596E /* LaunchScreen.xib */, 183 | 268B3B181A84E9E40072596E /* Main.storyboard */, 184 | 268B3B1A1A84E9E40072596E /* DBAvatars.xcassets */, 185 | 268B3B1B1A84E9E40072596E /* Images.xcassets */, 186 | ); 187 | name = Resources; 188 | path = DBChatAvatarSample/Resources; 189 | sourceTree = ""; 190 | }; 191 | 9D67331B8CDC025A4A7723A9 /* Frameworks */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 970FEE5B7599CC66C0DA4CE2 /* Pods_DBChatAvatarSample.framework */, 195 | ); 196 | name = Frameworks; 197 | sourceTree = ""; 198 | }; 199 | /* End PBXGroup section */ 200 | 201 | /* Begin PBXNativeTarget section */ 202 | 26172A4F1A7D1D39006BA402 /* DBChatAvatarSample */ = { 203 | isa = PBXNativeTarget; 204 | buildConfigurationList = 26172A731A7D1D3A006BA402 /* Build configuration list for PBXNativeTarget "DBChatAvatarSample" */; 205 | buildPhases = ( 206 | 4D344115624D4C1CB1C6EFD2 /* [CP] Check Pods Manifest.lock */, 207 | 26172A4C1A7D1D39006BA402 /* Sources */, 208 | 26172A4D1A7D1D39006BA402 /* Frameworks */, 209 | 26172A4E1A7D1D39006BA402 /* Resources */, 210 | DBF8C5FB9CF69F11E14B2E4A /* [CP] Embed Pods Frameworks */, 211 | 82EF788BF4766A0C341275E8 /* [CP] Copy Pods Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | ); 217 | name = DBChatAvatarSample; 218 | productName = DBChatAvatarSample; 219 | productReference = 26172A501A7D1D39006BA402 /* DBChatAvatarSample.app */; 220 | productType = "com.apple.product-type.application"; 221 | }; 222 | /* End PBXNativeTarget section */ 223 | 224 | /* Begin PBXProject section */ 225 | 26172A481A7D1D39006BA402 /* Project object */ = { 226 | isa = PBXProject; 227 | attributes = { 228 | LastUpgradeCheck = 0920; 229 | ORGANIZATIONNAME = "Diana Belogrivaya"; 230 | TargetAttributes = { 231 | 26172A4F1A7D1D39006BA402 = { 232 | CreatedOnToolsVersion = 6.1.1; 233 | DevelopmentTeam = E5KMUL42ET; 234 | }; 235 | }; 236 | }; 237 | buildConfigurationList = 26172A4B1A7D1D39006BA402 /* Build configuration list for PBXProject "DBChatAvatarSample" */; 238 | compatibilityVersion = "Xcode 3.2"; 239 | developmentRegion = English; 240 | hasScannedForEncodings = 0; 241 | knownRegions = ( 242 | en, 243 | Base, 244 | ); 245 | mainGroup = 26172A471A7D1D39006BA402; 246 | productRefGroup = 26172A511A7D1D39006BA402 /* Products */; 247 | projectDirPath = ""; 248 | projectRoot = ""; 249 | targets = ( 250 | 26172A4F1A7D1D39006BA402 /* DBChatAvatarSample */, 251 | ); 252 | }; 253 | /* End PBXProject section */ 254 | 255 | /* Begin PBXResourcesBuildPhase section */ 256 | 26172A4E1A7D1D39006BA402 /* Resources */ = { 257 | isa = PBXResourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 268B3B2F1A84E9E40072596E /* LaunchScreen.xib in Resources */, 261 | 268B3B321A84E9E40072596E /* Images.xcassets in Resources */, 262 | 268B3B301A84E9E40072596E /* Main.storyboard in Resources */, 263 | 268B3B311A84E9E40072596E /* DBAvatars.xcassets in Resources */, 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | }; 267 | /* End PBXResourcesBuildPhase section */ 268 | 269 | /* Begin PBXShellScriptBuildPhase section */ 270 | 4D344115624D4C1CB1C6EFD2 /* [CP] Check Pods Manifest.lock */ = { 271 | isa = PBXShellScriptBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | ); 275 | inputPaths = ( 276 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 277 | "${PODS_ROOT}/Manifest.lock", 278 | ); 279 | name = "[CP] Check Pods Manifest.lock"; 280 | outputPaths = ( 281 | "$(DERIVED_FILE_DIR)/Pods-DBChatAvatarSample-checkManifestLockResult.txt", 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | shellPath = /bin/sh; 285 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 286 | showEnvVarsInLog = 0; 287 | }; 288 | 82EF788BF4766A0C341275E8 /* [CP] Copy Pods Resources */ = { 289 | isa = PBXShellScriptBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | ); 293 | inputPaths = ( 294 | ); 295 | name = "[CP] Copy Pods Resources"; 296 | outputPaths = ( 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | shellPath = /bin/sh; 300 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DBChatAvatarSample/Pods-DBChatAvatarSample-resources.sh\"\n"; 301 | showEnvVarsInLog = 0; 302 | }; 303 | DBF8C5FB9CF69F11E14B2E4A /* [CP] Embed Pods Frameworks */ = { 304 | isa = PBXShellScriptBuildPhase; 305 | buildActionMask = 2147483647; 306 | files = ( 307 | ); 308 | inputPaths = ( 309 | "${SRCROOT}/Pods/Target Support Files/Pods-DBChatAvatarSample/Pods-DBChatAvatarSample-frameworks.sh", 310 | "${BUILT_PRODUCTS_DIR}/DBChatAvatarView/DBChatAvatarView.framework", 311 | "${BUILT_PRODUCTS_DIR}/UIColor+Hex/UIColor_Hex.framework", 312 | ); 313 | name = "[CP] Embed Pods Frameworks"; 314 | outputPaths = ( 315 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DBChatAvatarView.framework", 316 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UIColor_Hex.framework", 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | shellPath = /bin/sh; 320 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DBChatAvatarSample/Pods-DBChatAvatarSample-frameworks.sh\"\n"; 321 | showEnvVarsInLog = 0; 322 | }; 323 | /* End PBXShellScriptBuildPhase section */ 324 | 325 | /* Begin PBXSourcesBuildPhase section */ 326 | 26172A4C1A7D1D39006BA402 /* Sources */ = { 327 | isa = PBXSourcesBuildPhase; 328 | buildActionMask = 2147483647; 329 | files = ( 330 | 26172A8A1A7D2011006BA402 /* DBChatsController.m in Sources */, 331 | 26172A8D1A7D203B006BA402 /* DBChatCell.m in Sources */, 332 | 26172AA61A7D3068006BA402 /* UIImage+Default.m in Sources */, 333 | 26172A841A7D1DD7006BA402 /* DBChat.m in Sources */, 334 | 26172A591A7D1D39006BA402 /* AppDelegate.m in Sources */, 335 | 26172A561A7D1D39006BA402 /* main.m in Sources */, 336 | 26172A871A7D1DE3006BA402 /* DBUser.m in Sources */, 337 | 26172A901A7D20DF006BA402 /* DBChatManager.m in Sources */, 338 | ); 339 | runOnlyForDeploymentPostprocessing = 0; 340 | }; 341 | /* End PBXSourcesBuildPhase section */ 342 | 343 | /* Begin PBXVariantGroup section */ 344 | 268B3B161A84E9E40072596E /* LaunchScreen.xib */ = { 345 | isa = PBXVariantGroup; 346 | children = ( 347 | 268B3B171A84E9E40072596E /* Base */, 348 | ); 349 | name = LaunchScreen.xib; 350 | sourceTree = ""; 351 | }; 352 | 268B3B181A84E9E40072596E /* Main.storyboard */ = { 353 | isa = PBXVariantGroup; 354 | children = ( 355 | 268B3B191A84E9E40072596E /* Base */, 356 | ); 357 | name = Main.storyboard; 358 | sourceTree = ""; 359 | }; 360 | /* End PBXVariantGroup section */ 361 | 362 | /* Begin XCBuildConfiguration section */ 363 | 26172A711A7D1D3A006BA402 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 368 | CLANG_CXX_LIBRARY = "libc++"; 369 | CLANG_ENABLE_MODULES = YES; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 372 | CLANG_WARN_BOOL_CONVERSION = YES; 373 | CLANG_WARN_COMMA = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_EMPTY_BODY = YES; 377 | CLANG_WARN_ENUM_CONVERSION = YES; 378 | CLANG_WARN_INFINITE_RECURSION = YES; 379 | CLANG_WARN_INT_CONVERSION = YES; 380 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 381 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 383 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 384 | CLANG_WARN_STRICT_PROTOTYPES = YES; 385 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | ENABLE_STRICT_OBJC_MSGSEND = YES; 391 | ENABLE_TESTABILITY = YES; 392 | GCC_C_LANGUAGE_STANDARD = gnu99; 393 | GCC_DYNAMIC_NO_PIC = NO; 394 | GCC_NO_COMMON_BLOCKS = YES; 395 | GCC_OPTIMIZATION_LEVEL = 0; 396 | GCC_PREPROCESSOR_DEFINITIONS = ( 397 | "DEBUG=1", 398 | "$(inherited)", 399 | ); 400 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 401 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 402 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 403 | GCC_WARN_UNDECLARED_SELECTOR = YES; 404 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 405 | GCC_WARN_UNUSED_FUNCTION = YES; 406 | GCC_WARN_UNUSED_VARIABLE = YES; 407 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 408 | MTL_ENABLE_DEBUG_INFO = YES; 409 | ONLY_ACTIVE_ARCH = YES; 410 | SDKROOT = iphoneos; 411 | }; 412 | name = Debug; 413 | }; 414 | 26172A721A7D1D3A006BA402 /* Release */ = { 415 | isa = XCBuildConfiguration; 416 | buildSettings = { 417 | ALWAYS_SEARCH_USER_PATHS = NO; 418 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 419 | CLANG_CXX_LIBRARY = "libc++"; 420 | CLANG_ENABLE_MODULES = YES; 421 | CLANG_ENABLE_OBJC_ARC = YES; 422 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 423 | CLANG_WARN_BOOL_CONVERSION = YES; 424 | CLANG_WARN_COMMA = YES; 425 | CLANG_WARN_CONSTANT_CONVERSION = YES; 426 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 427 | CLANG_WARN_EMPTY_BODY = YES; 428 | CLANG_WARN_ENUM_CONVERSION = YES; 429 | CLANG_WARN_INFINITE_RECURSION = YES; 430 | CLANG_WARN_INT_CONVERSION = YES; 431 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 432 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 433 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 434 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 435 | CLANG_WARN_STRICT_PROTOTYPES = YES; 436 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 437 | CLANG_WARN_UNREACHABLE_CODE = YES; 438 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 439 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 440 | COPY_PHASE_STRIP = YES; 441 | ENABLE_NS_ASSERTIONS = NO; 442 | ENABLE_STRICT_OBJC_MSGSEND = YES; 443 | GCC_C_LANGUAGE_STANDARD = gnu99; 444 | GCC_NO_COMMON_BLOCKS = YES; 445 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 446 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 447 | GCC_WARN_UNDECLARED_SELECTOR = YES; 448 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 449 | GCC_WARN_UNUSED_FUNCTION = YES; 450 | GCC_WARN_UNUSED_VARIABLE = YES; 451 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 452 | MTL_ENABLE_DEBUG_INFO = NO; 453 | SDKROOT = iphoneos; 454 | VALIDATE_PRODUCT = YES; 455 | }; 456 | name = Release; 457 | }; 458 | 26172A741A7D1D3A006BA402 /* Debug */ = { 459 | isa = XCBuildConfiguration; 460 | baseConfigurationReference = EDEF89E13AD8FC19817CB57D /* Pods-DBChatAvatarSample.debug.xcconfig */; 461 | buildSettings = { 462 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 463 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 464 | CODE_SIGN_IDENTITY = "iPhone Developer"; 465 | DEVELOPMENT_TEAM = E5KMUL42ET; 466 | INFOPLIST_FILE = DBChatAvatarSample/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | PRODUCT_BUNDLE_IDENTIFIER = "di.$(PRODUCT_NAME:rfc1034identifier)"; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | TARGETED_DEVICE_FAMILY = "1,2"; 471 | }; 472 | name = Debug; 473 | }; 474 | 26172A751A7D1D3A006BA402 /* Release */ = { 475 | isa = XCBuildConfiguration; 476 | baseConfigurationReference = 8030DE6D1696ADE4D1D98718 /* Pods-DBChatAvatarSample.release.xcconfig */; 477 | buildSettings = { 478 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 479 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 480 | CODE_SIGN_IDENTITY = "iPhone Developer"; 481 | DEVELOPMENT_TEAM = E5KMUL42ET; 482 | INFOPLIST_FILE = DBChatAvatarSample/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 484 | PRODUCT_BUNDLE_IDENTIFIER = "di.$(PRODUCT_NAME:rfc1034identifier)"; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TARGETED_DEVICE_FAMILY = "1,2"; 487 | }; 488 | name = Release; 489 | }; 490 | /* End XCBuildConfiguration section */ 491 | 492 | /* Begin XCConfigurationList section */ 493 | 26172A4B1A7D1D39006BA402 /* Build configuration list for PBXProject "DBChatAvatarSample" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 26172A711A7D1D3A006BA402 /* Debug */, 497 | 26172A721A7D1D3A006BA402 /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | 26172A731A7D1D3A006BA402 /* Build configuration list for PBXNativeTarget "DBChatAvatarSample" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 26172A741A7D1D3A006BA402 /* Debug */, 506 | 26172A751A7D1D3A006BA402 /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | defaultConfigurationName = Release; 510 | }; 511 | /* End XCConfigurationList section */ 512 | }; 513 | rootObject = 26172A481A7D1D39006BA402 /* Project object */; 514 | } 515 | --------------------------------------------------------------------------------