Skip to content

Commit b84216d

Browse files
authored
Merge pull request #113 from QuickBlox/feature/linkPreview_tabbar
media attachments
2 parents 076dc1e + 1faeddf commit b84216d

122 files changed

Lines changed: 6234 additions & 1388 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

PublicCocoaPods/.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.3

PublicCocoaPods/QMChatViewController.podspec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Pod::Spec.new do |s|
3636
ss.source_files = 'QMChatViewController/QMChatLocationSnapshotter/*.{h,m}'
3737
end
3838

39+
s.subspec 'QMMediaPresenter' do |ss|
40+
ss.source_files = 'QMChatViewController/QMMediaPresenter/**/*.{h,m}'
41+
end
42+
3943
s.subspec 'Categories' do |ss|
4044
ss.dependency 'QMChatViewController/QMChatLocationSnapshotter'
4145
ss.source_files = 'QMChatViewController/Categories/*.{h,m}'
@@ -72,6 +76,7 @@ Pod::Spec.new do |s|
7276
s.prefix_header_contents = '#import <Quickblox/Quickblox.h>'
7377
s.dependency "QuickBlox", ">= 2.0"
7478
s.dependency "TTTAttributedLabel", "> 1.13"
75-
s.dependency "SDWebImage", "~> 3.6"
79+
s.dependency "SDWebImage", "~> 3.8.2"
80+
s.dependency "SexyTooltip"
7681

7782
end

QMCVDevelopment.podspec

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Pod::Spec.new do |s|
3434
ss.source_files = 'QMChatViewController/QMChatLocationSnapshotter/*.{h,m}'
3535
end
3636

37+
s.subspec 'QMMediaPresenter' do |ss|
38+
ss.source_files = 'QMChatViewController/QMMediaPresenter/**/*.{h,m}'
39+
end
40+
3741
s.subspec 'Categories' do |ss|
3842
ss.dependency 'QMCVDevelopment/QMChatLocationSnapshotter'
3943
ss.source_files = 'QMChatViewController/Categories/*.{h,m}'
@@ -44,6 +48,12 @@ Pod::Spec.new do |s|
4448
ss.source_files = 'QMChatViewController/Utils/**/*.{h,m}'
4549
end
4650

51+
s.subspec 'ViewModels' do |ss|
52+
53+
ss.dependency 'QMCVDevelopment/Categories'
54+
ss.source_files = 'QMChatViewController/ViewModels/**/*.{h,m}'
55+
end
56+
4757
s.subspec 'Sections' do |ss|
4858
ss.dependency 'QMCVDevelopment/QMChatDataSource'
4959
ss.source_files = 'QMChatViewController/QMChatSection/*.{h,m}'
@@ -68,7 +78,9 @@ Pod::Spec.new do |s|
6878
s.requires_arc = true
6979
s.xcconfig = { "FRAMEWORK_SEARCH_PATHS" => "$(PODS_ROOT)/../../Framework $(PODS_ROOT)/../External" }
7080
s.dependency "TTTAttributedLabel", "> 1.13"
71-
s.dependency "SDWebImage", "~> 3.6"
81+
s.dependency "SDWebImage", "~> 3.8.2"
82+
s.dependency "FFCircularProgressView"
83+
s.dependency "SexyTooltip"
7284

7385

7486
end

QMChatViewController/Categories/UIColor+QM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@interface UIColor (QM)
1212

13-
#pragma mark - Message bubble colors
13+
//MARK: - Message bubble colors
1414

1515
/**
1616
* @return A color object containing HSB values similar to the iOS 7 messages app green bubble color.

QMChatViewController/Categories/UIImage+Cropper.m

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,29 +68,69 @@ - (UIImage *)imageByScaleAndCrop:(CGSize)targetSize {
6868
}
6969

7070
- (UIImage *)imageByCircularScaleAndCrop:(CGSize)targetSize {
71+
//bitmap context properties
72+
float scaleFactor = [[UIScreen mainScreen] scale];
7173

72-
//Create the bitmap graphics context
73-
UIGraphicsBeginImageContextWithOptions(targetSize, NO, 0.0);
74+
CGColorSpaceRef colorSpace =
75+
CGColorSpaceCreateDeviceRGB();
76+
CGContextRef context =
77+
CGBitmapContextCreate(NULL,
78+
targetSize.width * scaleFactor,
79+
targetSize.height * scaleFactor,
80+
8,
81+
targetSize.width * scaleFactor * 4,
82+
colorSpace,
83+
kCGImageAlphaPremultipliedFirst);
84+
85+
CGContextScaleCTM(context,
86+
scaleFactor,
87+
scaleFactor);
88+
89+
CGContextBeginPath(context);
90+
91+
CGContextAddArc(context,
92+
targetSize.width / 2,
93+
targetSize.height / 2,
94+
targetSize.width / 2,
95+
0,
96+
2 * M_PI,
97+
0);
98+
99+
CGContextClosePath(context);
100+
101+
CGFloat widthFactor = targetSize.width / self.size.width;
102+
CGFloat heightFactor = targetSize.height / self.size.height;
103+
104+
if (widthFactor > heightFactor) {
105+
scaleFactor = widthFactor;
106+
}
107+
else {
108+
109+
scaleFactor = heightFactor;
110+
}
111+
112+
float w = self.size.width * scaleFactor;
113+
float h = self.size.height * scaleFactor;
74114

75-
CGContextRef context = UIGraphicsGetCurrentContext();
76-
// Create and CLIP to a CIRCULAR Path
77-
// (This could be replaced with any closed path if you want a different shaped clip)
78-
CGContextBeginPath (context);
79-
CGContextAddArc(context, targetSize.width / 2, targetSize.height / 2, targetSize.width / 2, 0, 2 * M_PI, 0);
80-
CGContextClosePath (context);
81115
CGContextClip(context);
82-
//Set the SCALE factor for the graphics context
83-
//All future draw calls will be scaled by this factor
84-
CGContextScaleCTM (context, targetSize.width / self.size.width, targetSize.height / self.size.height);
85-
// Draw the IMAGE
86-
CGRect myRect = CGRectMake(0, 0, self.size.width, self.size.height);
87-
[self drawInRect:myRect];
116+
//draw image into bitmap context
117+
CGContextDrawImage(context,
118+
CGRectMake(0,0, w, h),
119+
self.CGImage);
88120

89-
UIImage *circularImage = UIGraphicsGetImageFromCurrentImageContext();
121+
CGImageRef renderedImage =
122+
CGBitmapContextCreateImage(context);
90123

91-
UIGraphicsEndImageContext();
124+
//tidy up
125+
CGColorSpaceRelease(colorSpace);
126+
CGContextRelease(context);
127+
128+
UIImage *image =
129+
[UIImage imageWithCGImage:renderedImage
130+
scale:0
131+
orientation:self.imageOrientation];
92132

93-
return circularImage;
133+
return image;
94134
}
95135

96136
@end

QMChatViewController/Categories/UIImageView+QMLocationSnapshot.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ - (void)setSnapshotWithLocationCoordinate:(CLLocationCoordinate2D)locationCoordi
3838
self.image = nil;
3939
[self qm_cancelPreviousSnapshotCreation];
4040

41-
NSString *key = [NSString stringWithFormat:@"%lf/%lf",locationCoordinate.latitude, locationCoordinate.longitude];
41+
NSString *key = [NSString stringWithFormat:@"%lf/%lf", locationCoordinate.latitude, locationCoordinate.longitude];
4242

4343
self.qm_snapshotKey = key;
4444

@@ -48,10 +48,8 @@ - (void)setSnapshotWithLocationCoordinate:(CLLocationCoordinate2D)locationCoordi
4848
key:key
4949
completion:^(UIImage *snapshot) {
5050

51-
__typeof(weakSelf)strongSelf = weakSelf;
52-
if ([strongSelf.qm_snapshotKey isEqualToString:key]) {
53-
54-
strongSelf.image = snapshot;
51+
if ([weakSelf.qm_snapshotKey isEqualToString:key]) {
52+
weakSelf.image = snapshot;
5553
}
5654
}];
5755
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "Image.png",
6+
"scale" : "1x"
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+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "ic_audio.pdf"
6+
}
7+
],
8+
"info" : {
9+
"version" : 1,
10+
"author" : "xcode"
11+
},
12+
"properties" : {
13+
"template-rendering-intent" : "template"
14+
}
15+
}
Binary file not shown.

0 commit comments

Comments
 (0)