Browse Source

分享群聊功能改造(支持单人发送)

Steven 2 years ago
parent
commit
c35108b6f7

+ 6 - 6
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj

@@ -819,7 +819,6 @@
 		BCB909142852EF0000F5FF69 /* KSDragWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB909122852EF0000F5FF69 /* KSDragWindow.m */; };
 		BCB9091728530E9C00F5FF69 /* KSShopCardView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB9091628530E9C00F5FF69 /* KSShopCardView.m */; };
 		BCB9091928530EA500F5FF69 /* KSShopCardView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCB9091828530EA500F5FF69 /* KSShopCardView.xib */; };
-		BCB9FA16286C7F6C005D766B /* KSShareGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB9FA15286C7F6C005D766B /* KSShareGroupViewController.m */; };
 		BCB9FA27286D799B005D766B /* KSScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB9FA25286D799A005D766B /* KSScanViewController.m */; };
 		BCB9FA2B286D79A4005D766B /* ScanNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB9FA28286D79A4005D766B /* ScanNavView.m */; };
 		BCB9FA2C286D79A4005D766B /* ScanNavView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCB9FA29286D79A4005D766B /* ScanNavView.xib */; };
@@ -878,6 +877,7 @@
 		BCD457AC286469600010B493 /* PublicNoticeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCD457AA286469600010B493 /* PublicNoticeView.xib */; };
 		BCD457AF28646B580010B493 /* NoticeSourceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD457AE28646B580010B493 /* NoticeSourceModel.m */; };
 		BCD959C928DB071B00B70314 /* MusicTagView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD959C828DB071B00B70314 /* MusicTagView.m */; };
+		BCD959CC28DB0BAB00B70314 /* KSImageShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCD959CB28DB0BAB00B70314 /* KSImageShareViewController.m */; };
 		BCDE35862893B0E200A9A560 /* KSLoadingSuccessView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCDE35852893B0E200A9A560 /* KSLoadingSuccessView.m */; };
 		BCDE35882897B40000A9A560 /* shareImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = BCDE35872897B40000A9A560 /* shareImage@2x.png */; };
 		BCDE358E289A7D8700A9A560 /* KSGroupTagImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCDE358D289A7D8700A9A560 /* KSGroupTagImageView.m */; };
@@ -2367,8 +2367,6 @@
 		BCB9091528530E9C00F5FF69 /* KSShopCardView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSShopCardView.h; sourceTree = "<group>"; };
 		BCB9091628530E9C00F5FF69 /* KSShopCardView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSShopCardView.m; sourceTree = "<group>"; };
 		BCB9091828530EA500F5FF69 /* KSShopCardView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KSShopCardView.xib; sourceTree = "<group>"; };
-		BCB9FA14286C7F6C005D766B /* KSShareGroupViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSShareGroupViewController.h; sourceTree = "<group>"; };
-		BCB9FA15286C7F6C005D766B /* KSShareGroupViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSShareGroupViewController.m; sourceTree = "<group>"; };
 		BCB9FA25286D799A005D766B /* KSScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSScanViewController.m; sourceTree = "<group>"; };
 		BCB9FA26286D799B005D766B /* KSScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSScanViewController.h; sourceTree = "<group>"; };
 		BCB9FA28286D79A4005D766B /* ScanNavView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanNavView.m; sourceTree = "<group>"; };
@@ -2443,6 +2441,8 @@
 		BCD457AE28646B580010B493 /* NoticeSourceModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoticeSourceModel.m; sourceTree = "<group>"; };
 		BCD959C728DB071B00B70314 /* MusicTagView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicTagView.h; sourceTree = "<group>"; };
 		BCD959C828DB071B00B70314 /* MusicTagView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MusicTagView.m; sourceTree = "<group>"; };
+		BCD959CA28DB0BAB00B70314 /* KSImageShareViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSImageShareViewController.h; sourceTree = "<group>"; };
+		BCD959CB28DB0BAB00B70314 /* KSImageShareViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSImageShareViewController.m; sourceTree = "<group>"; };
 		BCDE35842893B0E200A9A560 /* KSLoadingSuccessView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KSLoadingSuccessView.h; sourceTree = "<group>"; };
 		BCDE35852893B0E200A9A560 /* KSLoadingSuccessView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSLoadingSuccessView.m; sourceTree = "<group>"; };
 		BCDE35872897B40000A9A560 /* shareImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "shareImage@2x.png"; sourceTree = "<group>"; };
@@ -3265,8 +3265,8 @@
 				2779346A27E324A10010E277 /* Define */,
 				2779346E27E324A10010E277 /* ThirdPart */,
 				2779350B27E324A40010E277 /* Base */,
-				BCB9FA14286C7F6C005D766B /* KSShareGroupViewController.h */,
-				BCB9FA15286C7F6C005D766B /* KSShareGroupViewController.m */,
+				BCD959CA28DB0BAB00B70314 /* KSImageShareViewController.h */,
+				BCD959CB28DB0BAB00B70314 /* KSImageShareViewController.m */,
 			);
 			path = Common;
 			sourceTree = "<group>";
@@ -6839,7 +6839,6 @@
 				BCB6357027F6D2A300ACFDCF /* ClassroomService.m in Sources */,
 				BCB6359A27F6D2AB00ACFDCF /* ClassVideoListView.m in Sources */,
 				2723B61D27F157D500E0B90B /* GroupNoticeViewController.m in Sources */,
-				BCB9FA16286C7F6C005D766B /* KSShareGroupViewController.m in Sources */,
 				BC0212F727FC4A080040569F /* SubjectImageCell.m in Sources */,
 				277935D027E324A90010E277 /* ALCalendarDate.m in Sources */,
 				BC4CF27428D0285400961C61 /* HomeQualityMusicCellView.m in Sources */,
@@ -7037,6 +7036,7 @@
 				BC4CF2A528D1B07800961C61 /* WidgetBottomButtonView.m in Sources */,
 				2723B63327F157D500E0B90B /* ChatComplainBodyView.m in Sources */,
 				2779357927E324A70010E277 /* KSImageButton.m in Sources */,
+				BCD959CC28DB0BAB00B70314 /* KSImageShareViewController.m in Sources */,
 				BC802D9228B897610079E350 /* LiveApplyingView.m in Sources */,
 				2779351827E324A60010E277 /* NSObject+KSImpChangeTool.m in Sources */,
 				BC8C2C5D2823F57100FBA5D5 /* AddressDetailBodyView.m in Sources */,

BIN
KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 16
KulexiuForStudent/KulexiuForStudent/Common/Define/PrefixHeader.pch

@@ -131,23 +131,7 @@ shouldPrevent = NO; \
 #define strongObj(object) try {} @catch (...){} __typeof__(object) object = object##_##weak_;
 #endif
 
-//3. 测试且非 ARC 环境
-#ifndef weakObj
-#define weakObj(object) autoreleasepool {} __block __typeof__(object) object##_##block_ = object;
-#endif
-
-#ifndef strongObj
-#define strongObj(object) autoreleasepool {} __typeof__(object) object = object##_##block_;
-#endif
 
-//4. 正式且非 ARC 环境
-#ifndef weakObj
-#define weakObj(object) try {} @catch (...){} __block __typeof__(object) object##_##block_ = object;
-#endif
-
-#ifndef strongObj
-#define strongObj(object) try {} @catch (...){} __typeof__(object) object = object##_##block_;
-#endif
 
 // Include any system framework and library headers here that should be included in all compilation units.
 // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.

+ 12 - 4
KulexiuForStudent/KulexiuForStudent/Common/KSShareGroupViewController.h → KulexiuForStudent/KulexiuForStudent/Common/KSImageShareViewController.h

@@ -1,11 +1,16 @@
 //
-//  KSShareGroupViewController.h
+//  KSImageShareViewController.h
 //  KulexiuForStudent
 //
-//  Created by 王智 on 2022/6/29.
+//  Created by 王智 on 2022/9/21.
 //
 
 #import "KSBaseViewController.h"
+#import "JXCategoryView.h"
+#import "JXPagerView.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
 typedef NS_ENUM(NSInteger, SHAREGROUP_TYPE) {
     SHAREGROUP_TYPE_SUCCESS,
     SHAREGROUP_TYPE_FAIL,
@@ -13,9 +18,12 @@ typedef NS_ENUM(NSInteger, SHAREGROUP_TYPE) {
 
 typedef void(^ShareGroupCallback)(BOOL isSuccess, NSString * _Nonnull descMsg);
 
-NS_ASSUME_NONNULL_BEGIN
 
-@interface KSShareGroupViewController : KSBaseViewController
+@interface KSImageShareViewController : KSBaseViewController<JXCategoryListContentViewDelegate>
+
+@property (nonatomic, strong) JXPagerView *pagerView;
+@property (nonatomic, strong, readonly) JXCategoryTitleView *categoryView;
+@property (nonatomic, strong) NSArray <NSString *> *titles;
 
 @property (nonatomic, assign) UIImage *shareImage;
 

+ 233 - 0
KulexiuForStudent/KulexiuForStudent/Common/KSImageShareViewController.m

@@ -0,0 +1,233 @@
+//
+//  KSImageShareViewController.m
+//  KulexiuForStudent
+//
+//  Created by 王智 on 2022/9/21.
+//
+
+#import "KSImageShareViewController.h"
+#import "ChatAddressHeaderView.h"
+#import "JXCategoryView.h"
+#import "JXPagerListRefreshView.h"
+#import "ChatAddressBodyView.h"
+
+@interface KSImageShareViewController ()<JXPagerViewDelegate, JXPagerMainTableViewGestureDelegate,JXCategoryViewDelegate>
+
+@property (nonatomic, strong) ChatAddressHeaderView *headView;
+
+@property (nonatomic, assign) NSInteger selectedIndex;
+
+@property (nonatomic, strong) NSMutableArray *listViewArray;
+
+@property (nonatomic, copy) ShareGroupCallback callback;
+
+@end
+
+@implementation KSImageShareViewController
+
+- (void)backAction {
+    if (self.callback) {
+        self.callback(NO, @"已取消");
+    }
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
+- (void)shareGroupCallback:(ShareGroupCallback)callback {
+    if (callback) {
+        self.callback = callback;
+    }
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    _titles = @[@"班级",@"老师"];
+    [self allocTitle:@"分享"];
+    [self configUI];
+}
+
+- (void)configUI {
+    [self.scrollView removeFromSuperview];
+    self.view.backgroundColor = HexRGB(0xf6f8f9);
+    [self.view addSubview:self.headView];
+    self.headView.frame = CGRectMake(0, 0, kScreenWidth, 100);
+    MJWeakSelf;
+    [self.headView chatAddressbookAction:^(CHATADDRESSTYPE type, NSString * _Nullable searchKey) {
+        [weakSelf topViewAction:type search:searchKey];
+    }];
+    
+    _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 100, kScreenWidth, 10)];
+    _categoryView.backgroundColor = HexRGB(0xf6f8f9);
+    self.categoryView.titles = self.titles;
+    self.categoryView.delegate = self;
+    self.categoryView.titleFont = [UIFont systemFontOfSize:16.0f];
+    self.categoryView.titleSelectedFont = [UIFont systemFontOfSize:16.0f weight:UIFontWeightMedium];
+    self.categoryView.titleSelectedColor = THEMECOLOR;
+    self.categoryView.titleColor = HexRGB(0x777777);
+    self.categoryView.titleColorGradientEnabled = YES;
+    self.categoryView.hidden = YES;
+    _pagerView = [self preferredPagingView];
+    self.pagerView.frame = CGRectMake(0, 100, kScreenWidth, kScreenHeight - kNaviBarHeight-100 - kTabBarHeight);
+    self.pagerView.listContainerView.categoryNestPagingEnabled = YES;
+    self.pagerView.mainTableView.gestureDelegate = self;
+    self.pagerView.backgroundColor = [UIColor clearColor];
+    self.pagerView.mainTableView.backgroundColor = [UIColor clearColor];
+    [self.view addSubview:self.pagerView];
+    self.categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagerView.listContainerView;
+}
+
+
+
+- (void)topViewAction:(CHATADDRESSTYPE)type search:(NSString *)searchKey {
+    switch (type) {
+        case CHATADDRESSTYPE_PERSON: // 联系人
+        {
+            [self.categoryView selectItemAtIndex:0];
+            self.selectedIndex = 0;
+        }
+            break;
+        case CHATADDRESSTYPE_GROUP: // 群组
+        {
+            [self.categoryView selectItemAtIndex:1];
+            self.selectedIndex = 1;
+        }
+            break;
+        case CHATADDRESSTYPE_SEARCH:  // 搜索
+        {
+            [self searchRequest:searchKey];
+        }
+            break;
+        default:
+            break;
+    }
+}
+
+- (void)searchRequest:(NSString *)searchKey {
+    if (self.listViewArray.count > self.selectedIndex) {
+        ChatAddressBodyView *listView = self.listViewArray[self.selectedIndex];
+        listView.searchKey = searchKey;
+        [listView refreshAndRequestData];
+    }
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
+    if (self.listViewArray.count > self.categoryView.selectedIndex) {
+        id value = self.listViewArray[self.categoryView.selectedIndex];
+        if ([value isKindOfClass:[KSJXBodyView class]]) {
+            KSJXBodyView *listView = (KSJXBodyView *)value;
+            [listView beginFirstRefresh];
+        }
+    }
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+    [super viewDidAppear:animated];
+    self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0);
+}
+
+- (JXPagerView *)preferredPagingView {
+    return [[JXPagerListRefreshView alloc] initWithDelegate:self];
+}
+
+#pragma mark - JXPagerViewDelegate
+
+- (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView {
+    return [UIView new];
+}
+
+- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
+    return CGFLOAT_MIN;
+}
+
+- (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
+    return 10;
+}
+
+- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
+    return self.categoryView;
+}
+
+- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
+    //和categoryView的item数量一致
+    return self.titles.count;
+}
+
+- (id<JXPagerViewListViewDelegate>)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index {
+    ChatAddressBodyView *listView = [[ChatAddressBodyView alloc] init];
+    listView.naviController = self.navigationController;
+    listView.isShareImage = YES;
+    listView.shareImage = self.shareImage;
+    MJWeakSelf;
+    [listView shareCallback:^(BOOL isSuccess, NSString * _Nonnull desc) {
+        if (weakSelf.callback) {
+            weakSelf.callback(isSuccess, desc);
+            [weakSelf.navigationController popViewControllerAnimated:YES];
+        }
+    }];
+    [self.listViewArray addObject:listView];
+    if (index == 0) {
+        listView.selectIndex = 0;
+    }else if (index == 1) {
+        listView.selectIndex = 1;
+    }
+    [listView beginFirstRefresh];
+    return listView;
+}
+
+#pragma mark - JXCategoryViewDelegate
+- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
+    BOOL scrollPersonTable = index == 0;
+    [self.headView scrollPersonTable:scrollPersonTable];
+    self.selectedIndex = index;
+}
+
+#pragma mark - JXPagerMainTableViewGestureDelegate
+
+- (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
+    //禁止categoryView左右滑动的时候,上下和左右都可以滚动
+    if (otherGestureRecognizer == self.categoryView.collectionView.panGestureRecognizer) {
+        return NO;
+    }
+    return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
+}
+
+
+- (NSMutableArray *)listViewArray {
+    if (!_listViewArray) {
+        _listViewArray = [NSMutableArray arrayWithArray:@[@"",@""]];
+    }
+    return _listViewArray;
+}
+
+#pragma mark - JXCategoryListContentViewDelegate
+
+- (UIView *)listView {
+    return self.view;
+}
+- (ChatAddressHeaderView *)headView {
+    if (!_headView) {
+        _headView = [ChatAddressHeaderView shareInstance];
+    }
+    return _headView;
+}
+
+- (void)setSelectedIndex:(NSInteger)selectedIndex {
+    _selectedIndex = selectedIndex;
+    
+    ChatAddressBodyView *listView = self.listViewArray[selectedIndex];
+    NSString *searchKey = listView.searchKey;
+    self.headView.searchField.text = searchKey;
+}
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 0 - 179
KulexiuForStudent/KulexiuForStudent/Common/KSShareGroupViewController.m

@@ -1,179 +0,0 @@
-//
-//  KSShareGroupViewController.m
-//  KulexiuForStudent
-//
-//  Created by 王智 on 2022/6/29.
-//
-
-#import "KSShareGroupViewController.h"
-#import "GroupListModel.h"
-#import "GroupListViewCell.h"
-#import <RongIMKit/RongIMKit.h>
-
-@interface KSShareGroupViewController ()<UITableViewDelegate,UITableViewDataSource>
-
-@property (nonatomic, strong) UITableView *tableView;
-
-@property (nonatomic, copy) ShareGroupCallback callback;
-@end
-
-@implementation KSShareGroupViewController
-
-- (void)viewDidLoad {
-    [super viewDidLoad];
-    // Do any additional setup after loading the view.
-    [self allocTitle:@"分享到群聊"];
-    [self configUI];
-    [self queryGroupList];
-}
-
-- (void)backAction {
-    if (self.callback) {
-        self.callback(NO, @"已取消");
-    }
-    [self.navigationController popViewControllerAnimated:YES];
-}
-
-- (void)configUI {
-    [self.scrollView removeFromSuperview];
-
-    [self.view addSubview:self.tableView];
-    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.mas_equalTo(self.view);
-        make.top.mas_equalTo(self.view);
-        make.bottom.mas_equalTo(self.view.mas_bottom).offset(-iPhoneXSafeBottomMargin);
-    }];
-    [self setPromptString:@"暂无内容" imageName:@"wd_img_zwsj" inView:self.tableView];
-}
-
-- (void)searchRequest:(NSString *)searchKey {
-    [self queryGroupList];
-}
-
-- (void)queryGroupList {
-    [self showhud];
-    [KSNetworkingManager imGroupQueryPage:KS_POST search:nil success:^(NSDictionary * _Nonnull dic) {
-        [self removehub];
-        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
-            NSArray *array = [dic arrayValueForKey:@"data"];
-            for (NSDictionary *parm in array) {
-                GroupListModel *model = [[GroupListModel alloc] initWithDictionary:parm];
-                [self.dataArray addObject:model];
-            }
-        }
-        else {
-            [self MBPShow:MESSAGEKEY];
-        }
-        [self.tableView reloadData];
-        [self changePromptLabelState];
-    } faliure:^(NSError * _Nonnull error) {
-        [self removehub];
-        if (self.networkAvaiable == NO) {
-            [self setPromptString:@"暂无网络" imageName:@"no_networking" inView:self.tableView];
-        }
-        [self.dataArray removeAllObjects];
-        [self.tableView reloadData];
-        [self changePromptLabelState];
-    }];
-
-}
-
-- (void)shareGroupCallback:(ShareGroupCallback)callback {
-    if (callback) {
-        self.callback = callback;
-    }
-}
-
-#pragma mark ----- table data source
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return self.dataArray.count;
-}
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    GroupListModel *model = self.dataArray[indexPath.row];
-    GroupListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GroupListViewCell"];
-    [cell configWithSource:model];
-    return cell;
-}
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    GroupListModel *model = self.dataArray[indexPath.row];
-    if (![NSString isEmptyString:model.groupId]) {
-        [self shareImageToGroup:model.groupId];
-    }
-}
-
-
-- (void)shareImageToGroup:(NSString *)groupId {
-    
-    RCImageMessage *imgMsg = [RCImageMessage messageWithImage:self.shareImage];
-    imgMsg.full = YES;
-    [[RCIMClient sharedRCIMClient] sendMediaMessage:ConversationType_GROUP targetId:groupId content:imgMsg pushContent:nil pushData:nil progress:^(int progress, long messageId) {
-        
-    } success:^(long messageId) {
-        dispatch_main_async_safe(^{
-            if (self.callback) {
-                self.callback(YES, @"发送成功");
-//                [self MBPShow:@"发送成功"];
-            }
-            [self shareCallback];
-        });
-        
-    } error:^(RCErrorCode errorCode, long messageId) {
-        dispatch_main_async_safe(^{
-            if (self.callback) {
-                self.callback(NO, @"发送失败");
-//                [self MBPShow:@"发送失败"];
-            }
-            [self shareCallback];
-        });
-        
-    } cancel:^(long messageId) {
-        dispatch_main_async_safe(^{
-            if (self.callback) {
-                self.callback(NO, @"已取消");
-            }
-            [self shareCallback];
-        });
-    }];
-}
-
-- (void)shareCallback {
-    
-    [self.navigationController popViewControllerAnimated:YES];
-}
-
-- (UITableView *)tableView {
-    if (!_tableView) {
-        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
-        _tableView.backgroundColor = HexRGB(0xf3f4f8);
-        _tableView.showsVerticalScrollIndicator = NO;
-
-        _tableView.dataSource = self;
-        _tableView.delegate = self;
-        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-        _tableView.rowHeight = UITableViewAutomaticDimension;
-        _tableView.rowHeight = 70;
-        
-        UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
-        headView.backgroundColor = HexRGB(0xf3f4f8);
-        _tableView.tableHeaderView = headView;
-        
-        UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
-        bottomView.backgroundColor = HexRGB(0xf3f4f8);
-        _tableView.tableFooterView = bottomView;
-        
-        [_tableView registerNib:[UINib nibWithNibName:@"GroupListViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"GroupListViewCell"];
-    }
-    return _tableView;
-}
-/*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
-}
-*/
-
-@end

+ 2 - 2
KulexiuForStudent/KulexiuForStudent/Common/Tools/UMShare/KSUMShareManager.m

@@ -9,7 +9,7 @@
 #import <UMShare/UMShare.h>
 #import <UShareUI/UShareUI.h>
 #import "TZImageManager.h"
-#import "KSShareGroupViewController.h"
+#import "KSImageShareViewController.h"
 
 @interface KSUMShareManager ()
 
@@ -55,7 +55,7 @@
     [UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {
         if (platformType == UMSocialPlatformType_UserDefine_Begin+1) { // 分享到群组
             if (self.shareType == KSSHARETYPE_IMAGE) {
-                KSShareGroupViewController *shareGroupCtrl = [[KSShareGroupViewController alloc] init];
+                KSImageShareViewController *shareGroupCtrl = [[KSImageShareViewController alloc] init];
                 shareGroupCtrl.shareImage = self.shareImage;
                 MJWeakSelf;
                 [shareGroupCtrl shareGroupCallback:^(BOOL isSuccess, NSString *descMsg) {

+ 3 - 3
KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressBodyView.h

@@ -7,7 +7,7 @@
 
 #import "KSJXBodyView.h"
 
-typedef void(^ShareCallback)(BOOL isSuccess);
+typedef void(^ShareCallback)(BOOL isSuccess, NSString * _Nonnull desc);
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -15,9 +15,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) NSString *searchKey;
 
-@property (nonatomic, assign) BOOL isShareVideo;
+@property (nonatomic, assign) BOOL isShareImage;
 @property (nonatomic, strong) NSString *message;
-@property (nonatomic, strong) NSString *linkUrl;
+@property (nonatomic, strong) UIImage *shareImage;
 
 - (void)refreshAndRequestData;
 

+ 26 - 32
KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressBodyView.m

@@ -286,11 +286,16 @@
     if (self.selectIndex == 0) { // 联系人
         NSArray *filterArray = self.studentArray[indexPath.section];
         FriendListModel *model = filterArray[indexPath.row];
-        [self chatConversationWithTargetId:model.friendId targetName:model.friendNickname isGroup:NO];
+        if (_isShareImage) { // 分享
+            [self sendMessageWithTargetId:model.friendId isGroup:NO];
+        }
+        else { // 聊天
+            [self chatConversationWithTargetId:model.friendId targetName:model.friendNickname isGroup:NO];
+        }
     }
     else { // 群聊
         GroupListModel *model = self.classArray[indexPath.row];
-        if (_isShareVideo) { // 群聊消息
+        if (_isShareImage) { // 群聊消息
             [self sendMessageWithTargetId:model.groupId isGroup:YES];
         }
         else {
@@ -298,44 +303,33 @@
             [self chatConversationWithTargetId:model.groupId targetName:model.name isGroup:YES];
         }
     }
-//    if (self.selectIndex == 0) {
-//        ClassListModel *model = self.classArray[indexPath.row];
-//
-//        if (_isShareVideo) { // 群聊消息
-//            [self sendMessageWithTargetId:model.internalBaseClassIdentifier isGroup:YES];
-//        }
-//        else {
-//            // 点击进入群聊
-//            [self chatConversationWithTargetId:model.internalBaseClassIdentifier targetName:model.name isGroup:YES];
-//        }
-//
-//    }
-//    else {
-//        NSArray *filterArray = self.studentArray[indexPath.section];
-//        FriendListModel *model = filterArray[indexPath.row];
-//        if (_isShareVideo) {
-//            [self sendMessageWithTargetId:model.friendId isGroup:NO];
-//        }
-//        else {
-//            [self chatConversationWithTargetId:model.friendId targetName:model.friendNickname isGroup:NO];
-//        }
-//    }
 }
 
 - (void)sendMessageWithTargetId:(NSString *)targetId isGroup:(BOOL)isGroup {
-    RCTextMessage *textMsg = [RCTextMessage messageWithContent:[NSString stringWithFormat:@"%@\n%@",self.message, self.linkUrl]];
-    textMsg.extra = [NSString stringWithFormat:@"dayaedu?type=video&url=%@", [self.linkUrl ks_base64EncodedString]];
+    
+    RCImageMessage *imgMsg = [RCImageMessage messageWithImage:self.shareImage];
+    imgMsg.full = YES;
     RCConversationType type = isGroup ? ConversationType_GROUP : ConversationType_PRIVATE;
-    [[RCIMClient sharedRCIMClient] sendMessage:type targetId:targetId content:textMsg pushContent:nil pushData:nil success:^(long messageId) {
-        dispatch_async(dispatch_get_main_queue(), ^{
+    [[RCIMClient sharedRCIMClient] sendMediaMessage:type targetId:targetId content:imgMsg pushContent:nil pushData:nil progress:^(int progress, long messageId) {
+        
+    } success:^(long messageId) {
+        dispatch_main_async_safe(^{
             if (self.callback) {
-                self.callback(YES);
+                self.callback(YES, @"发送成功");
             }
         });
-    } error:^(RCErrorCode nErrorCode, long messageId) {
-        dispatch_async(dispatch_get_main_queue(), ^{
+        
+    } error:^(RCErrorCode errorCode, long messageId) {
+        dispatch_main_async_safe(^{
+            if (self.callback) {
+                self.callback(NO, @"发送失败");
+            }
+        });
+        
+    } cancel:^(long messageId) {
+        dispatch_main_async_safe(^{
             if (self.callback) {
-                self.callback(NO);
+                self.callback(NO,@"已取消");
             }
         });
     }];

+ 2 - 2
KulexiuForStudent/KulexiuForStudent/Module/Live/Controller/LiveVideoRoomViewController.m

@@ -2437,10 +2437,10 @@ static int clickPraiseBtnTimes  = 0;
 - (void)showShareUI:(UIImage *)image {
     [KSUMShareManager shareInstanceWithImage:image url:@"" shareTitle:@"" descMessage:@"" shareType:KSSHARETYPE_IMAGE showInView:self callback:^(BOOL isSuccess, NSString * _Nonnull descMessage) {
         if (isSuccess) {
-            [self .shareView hideView];
+            [self.shareView hideView];
         }
         else {
-            
+
         }
         [self MBPShow:descMessage];
     }];

File diff suppressed because it is too large
+ 0 - 0
KulexiuForStudent/KulexiuForStudent/Module/Live/Model/LiveCard.bundle/cardAnimation.json


Some files were not shown because too many files changed in this diff