Browse Source

处理分享无法弹窗的问题

Steven 1 year ago
parent
commit
54c5f7651f
17 changed files with 178 additions and 160 deletions
  1. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h
  2. 1 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m
  3. 2 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/TXIMLinsenter.m
  4. 30 8
      KulexiuForStudent/KulexiuForStudent/Common/KSImageShareViewController.m
  5. 4 0
      KulexiuForStudent/KulexiuForStudent/Common/Tools/UMShare/KSUMShareManager.m
  6. 1 0
      KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressBodyView.h
  7. 26 27
      KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressBodyView.m
  8. 1 1
      KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressHeaderView.h
  9. 1 1
      KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressHeaderView.m
  10. 22 86
      KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressHeaderView.xib
  11. 1 0
      KulexiuForStudent/KulexiuForStudent/Module/Live/Model/KSEnterLiveroomManager.m
  12. 3 3
      KulexiuForStudent/KulexiuForStudent/Module/Live/Model/LiveModuleService.m
  13. 16 14
      KulexiuForStudent/KulexiuForStudent/Module/Login/Model/UserInfoManager.m
  14. 9 0
      KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/Controller/TXClassroomViewController.m
  15. 46 15
      KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/View/VideoList/TXClassroomVideoListCell.m
  16. 3 0
      KulexiuForStudent/KulexiuForStudent/Module/TXLive/Controller/TXLiveRoomViewController.h
  17. 11 3
      KulexiuForStudent/KulexiuForStudent/Module/TXLive/Controller/TXLiveRoomViewController.m

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h

@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
 #pragma mark -------- CLASS REQUEST
 + (void)classroomRequest:(NSString *)method url:(NSString *)url parms:(NSDictionary *)parms success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 #pragma mark -------- LIVE ROOM
-+ (void)LiveRoomRequest:(NSString *)method url:(NSString *)url parms:(NSDictionary *)parms success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
++ (void)LiveRoomRequest:(NSString *)method url:(NSString *)url parms:(id)parms success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 #pragma mark ----- version
 // api-admin/appVersionInfo/queryByPlatform

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m

@@ -301,7 +301,7 @@
 }
 
 #pragma mark -------- LIVE ROOM
-+ (void)LiveRoomRequest:(NSString *)method url:(NSString *)url parms:(NSDictionary *)parms success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
++ (void)LiveRoomRequest:(NSString *)method url:(NSString *)url parms:(id)parms success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
     if ([method isEqualToString:KS_POST]) {
         [self configRequestMethodJSON];
     }

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/TXIMLinsenter.m

@@ -91,11 +91,13 @@
 - (void)onConnectSuccess {
     NSLog(@"----- tx IM SDK 连接成功");
     self.isIMConnected = YES;
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"TXIMConnected" object:nil];
 }
 
 - (void)onConnectFailed:(int)code err:(NSString *)err {
     NSLog(@"----- tx IM SDK 连接失败 %d 错误信息 %@", code, err);
     self.isIMConnected = NO;
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"networkError" object:nil];
 }
 
 - (void)onKickedOffline {

+ 30 - 8
KulexiuForStudent/KulexiuForStudent/Common/KSImageShareViewController.m

@@ -50,13 +50,13 @@
     [self.scrollView removeFromSuperview];
     self.view.backgroundColor = HexRGB(0xf6f8f9);
     [self.view addSubview:self.headView];
-    self.headView.frame = CGRectMake(0, 0, KPortraitWidth, 100);
+    self.headView.frame = CGRectMake(0, 0, KPortraitWidth, 60);
     MJWeakSelf;
     [self.headView chatAddressbookAction:^(CHATADDRESSTYPE type, NSString * _Nullable searchKey) {
         [weakSelf topViewAction:type search:searchKey];
     }];
     
-    _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 100, KPortraitWidth, 10)];
+    _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 60, KPortraitWidth, 10)];
     _categoryView.backgroundColor = HexRGB(0xf6f8f9);
     self.categoryView.titles = self.titles;
     self.categoryView.delegate = self;
@@ -67,7 +67,7 @@
     self.categoryView.titleColorGradientEnabled = YES;
     self.categoryView.hidden = YES;
     _pagerView = [self preferredPagingView];
-    self.pagerView.frame = CGRectMake(0, 100, KPortraitWidth, KPortraitHeight - kNaviBarHeight-100 - kTabBarHeight);
+    self.pagerView.frame = CGRectMake(0, 60, KPortraitWidth, KPortraitHeight - kNaviBarHeight-60 - kTabBarHeight);
     self.pagerView.listContainerView.categoryNestPagingEnabled = YES;
     self.pagerView.mainTableView.gestureDelegate = self;
     self.pagerView.backgroundColor = [UIColor clearColor];
@@ -82,14 +82,14 @@
     switch (type) {
         case CHATADDRESSTYPE_PERSON: // 联系人
         {
-            [self.categoryView selectItemAtIndex:0];
-            self.selectedIndex = 0;
+            [self.categoryView selectItemAtIndex:1];
+            self.selectedIndex = 1;
         }
             break;
         case CHATADDRESSTYPE_GROUP: // 群组
         {
-            [self.categoryView selectItemAtIndex:1];
-            self.selectedIndex = 1;
+            [self.categoryView selectItemAtIndex:0];
+            self.selectedIndex = 0;
         }
             break;
         case CHATADDRESSTYPE_SEARCH:  // 搜索
@@ -159,11 +159,12 @@
     listView.naviController = self.navigationController;
     listView.isShareImage = YES;
     listView.shareImage = self.shareImage;
+    listView.filePath = [self getImagePth];
     MJWeakSelf;
     [listView shareCallback:^(BOOL isSuccess, NSString * _Nonnull desc) {
         if (weakSelf.callback) {
-            weakSelf.callback(isSuccess, desc);
             [weakSelf.navigationController popViewControllerAnimated:YES];
+            weakSelf.callback(isSuccess, desc);
         }
     }];
     [self.listViewArray addObject:listView];
@@ -220,6 +221,27 @@
     NSString *searchKey = listView.searchKey;
     self.headView.searchField.text = searchKey;
 }
+
+- (void)setShareImage:(UIImage *)shareImage {
+    _shareImage = shareImage;
+    [self saveImage];
+}
+
+- (void)saveImage {
+    UIImage * imgsave = self.shareImage;
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
+    
+    NSString *path = [[paths objectAtIndex:0]stringByAppendingPathComponent:
+                          [NSString stringWithFormat:@"shareImage.png"]];
+    [UIImagePNGRepresentation(imgsave) writeToFile:path atomically:YES];
+}
+
+- (NSString *)getImagePth {
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
+    NSString *filePath = [[paths objectAtIndex:0]stringByAppendingPathComponent:
+                          [NSString stringWithFormat:@"shareImage.png"]];
+    return filePath;
+}
 /*
 #pragma mark - Navigation
 

+ 4 - 0
KulexiuForStudent/KulexiuForStudent/Common/Tools/UMShare/KSUMShareManager.m

@@ -158,4 +158,8 @@
     }];
 }
 
+
+- (UIView*)UMSocialParentView:(UIView*)defaultSuperView {
+    return [NSObject getKeyWindow];
+}
 @end

+ 1 - 0
KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressBodyView.h

@@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, assign) BOOL isShareImage;
 @property (nonatomic, strong) NSString *message;
 @property (nonatomic, strong) UIImage *shareImage;
+@property (nonatomic, strong) NSString *filePath;
 
 - (void)refreshAndRequestData;
 

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

@@ -17,6 +17,7 @@
 #import "Reachability.h"
 #import "FriendListModel.h"
 #import "KSChatListSearchView.h"
+#import <ImSDK_Plus/V2TIMManager.h>
 
 @interface ChatAddressBodyView ()<UITableViewDelegate,UITableViewDataSource>
 
@@ -385,33 +386,31 @@
 }
 
 - (void)sendMessageWithTargetId:(NSString *)targetId isGroup:(BOOL)isGroup {
-    
-//    RCImageMessage *imgMsg = [RCImageMessage messageWithImage:self.shareImage];
-//    imgMsg.full = YES;
-//    RCConversationType type = isGroup ? ConversationType_GROUP : ConversationType_PRIVATE;
-//    [[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, @"发送成功");
-//            }
-//        });
-//        
-//    } 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,@"已取消");
-//            }
-//        });
-//    }];
+    V2TIMMessage *message = [[V2TIMManager sharedInstance] createImageMessage:self.filePath];
+    NSString *userId = nil;
+    NSString *groupId = nil;
+    if (isGroup) {
+        groupId = targetId;
+    }
+    else {
+        userId = targetId;
+    }
+    [[V2TIMManager sharedInstance] sendMessage:message receiver:userId groupID:groupId priority:V2TIM_PRIORITY_NORMAL onlineUserOnly:NO offlinePushInfo:nil progress:^(uint32_t progress) {
+        
+    } succ:^{
+        dispatch_main_async_safe(^{
+            if (self.callback) {
+                self.callback(YES, @"分享成功");
+            }
+        });
+    } fail:^(int code, NSString *desc) {
+        dispatch_main_async_safe(^{
+            if (self.callback) {
+                self.callback(NO, @"分享失败");
+            }
+        });
+    }];
+
 }
 
 - (void)chatConversationWithTargetId:(NSString *)targetId targetName:(NSString *)targetName isGroup:(BOOL)isGroup {

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressHeaderView.h

@@ -8,8 +8,8 @@
 #import <UIKit/UIKit.h>
 
 typedef NS_ENUM(NSInteger, CHATADDRESSTYPE) {
-    CHATADDRESSTYPE_PERSON, // 联系人
     CHATADDRESSTYPE_GROUP,  // 群聊
+    CHATADDRESSTYPE_PERSON, // 联系人
     CHATADDRESSTYPE_SEARCH, // 搜索
 };
 

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressHeaderView.m

@@ -28,7 +28,7 @@
     [super awakeFromNib];
     self.searchField.delegate = self;
     self.searchField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入群聊/老师名称" attributes:@{NSForegroundColorAttributeName:HexRGB(0x999999)}];
-    self.isChoosePerson = YES;
+    self.isChoosePerson = NO;
 }
 
 + (instancetype)shareInstance {

+ 22 - 86
KulexiuForStudent/KulexiuForStudent/Module/Chat/View/ChatAddressHeaderView.xib

@@ -1,42 +1,38 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="ChatAddressHeaderView">
-            <rect key="frame" x="0.0" y="0.0" width="467" height="100"/>
+            <rect key="frame" x="0.0" y="0.0" width="467" height="60"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2e1-g7-DgM">
-                    <rect key="frame" x="14" y="17" width="439" height="35"/>
+                    <rect key="frame" x="14" y="12.5" width="439" height="35"/>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UZE-Fv-T2y">
                             <rect key="frame" x="0.0" y="0.0" width="216" height="35"/>
                             <subviews>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="联系人" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uUY-bh-cuO">
-                                    <rect key="frame" x="91.5" y="7.5" width="49" height="20"/>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="群聊" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uUY-bh-cuO">
+                                    <rect key="frame" x="99.5" y="7.5" width="33" height="20"/>
                                     <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
                                     <color key="textColor" red="0.1764705882" green="0.78039215689999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                 </label>
-                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chat_single_selected" translatesAutoresizingMaskIntoConstraints="NO" id="qCn-hj-x7a">
-                                    <rect key="frame" x="75.5" y="11" width="12" height="13"/>
-                                    <constraints>
-                                        <constraint firstAttribute="height" constant="13" id="D7I-Az-zln"/>
-                                        <constraint firstAttribute="width" constant="12" id="F0J-un-Xgc"/>
-                                    </constraints>
+                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chat_group_selected" translatesAutoresizingMaskIntoConstraints="NO" id="qCn-hj-x7a">
+                                    <rect key="frame" x="79.5" y="11" width="16" height="13"/>
                                 </imageView>
                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Eti-67-Uh9">
                                     <rect key="frame" x="0.0" y="0.0" width="216" height="35"/>
                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                     <connections>
-                                        <action selector="personPage:" destination="iN0-l3-epB" eventType="touchUpInside" id="Hu0-Xq-n6Y"/>
+                                        <action selector="groupPage:" destination="iN0-l3-epB" eventType="touchUpInside" id="Ngs-kn-Y7e"/>
                                     </connections>
                                 </button>
                             </subviews>
@@ -60,15 +56,11 @@
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QRY-aK-O1I">
                             <rect key="frame" x="223" y="0.0" width="216" height="35"/>
                             <subviews>
-                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chat_group_unselected" translatesAutoresizingMaskIntoConstraints="NO" id="t6n-tG-oLV">
-                                    <rect key="frame" x="81.5" y="11" width="16" height="13"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="16" id="SMZ-GH-bj0"/>
-                                        <constraint firstAttribute="height" constant="13" id="VIL-hC-iWy"/>
-                                    </constraints>
+                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chat_single_unselected" translatesAutoresizingMaskIntoConstraints="NO" id="t6n-tG-oLV">
+                                    <rect key="frame" x="77.5" y="11" width="12" height="13"/>
                                 </imageView>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="群聊" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8pC-jf-FdV">
-                                    <rect key="frame" x="101.5" y="7.5" width="33" height="20"/>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="联系人" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8pC-jf-FdV">
+                                    <rect key="frame" x="93.5" y="7.5" width="49" height="20"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="16"/>
                                     <nil key="textColor"/>
                                     <nil key="highlightedColor"/>
@@ -77,7 +69,7 @@
                                     <rect key="frame" x="0.0" y="0.0" width="216" height="35"/>
                                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                     <connections>
-                                        <action selector="groupPage:" destination="iN0-l3-epB" eventType="touchUpInside" id="5oe-o8-BlQ"/>
+                                        <action selector="personPage:" destination="iN0-l3-epB" eventType="touchUpInside" id="zEg-89-6iZ"/>
                                     </connections>
                                 </button>
                             </subviews>
@@ -112,83 +104,27 @@
                         <constraint firstItem="QRY-aK-O1I" firstAttribute="leading" secondItem="UZE-Fv-T2y" secondAttribute="trailing" constant="7" id="ys0-jc-kXz"/>
                     </constraints>
                 </view>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="KhN-lD-vcC">
-                    <rect key="frame" x="14" y="64" width="439" height="36"/>
-                    <subviews>
-                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="search_green" translatesAutoresizingMaskIntoConstraints="NO" id="8Ix-cN-Qnc">
-                            <rect key="frame" x="12" y="10.5" width="15" height="15"/>
-                            <constraints>
-                                <constraint firstAttribute="width" constant="15" id="8A1-RN-dZ0"/>
-                                <constraint firstAttribute="height" constant="15" id="Ryq-hL-Hj7"/>
-                            </constraints>
-                        </imageView>
-                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入群聊/老师名称" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ud0-St-B7w">
-                            <rect key="frame" x="38" y="0.0" width="331" height="36"/>
-                            <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
-                            <fontDescription key="fontDescription" type="system" pointSize="13"/>
-                            <textInputTraits key="textInputTraits"/>
-                        </textField>
-                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pVF-V1-s8f">
-                            <rect key="frame" x="379" y="4" width="56" height="28"/>
-                            <color key="backgroundColor" red="0.1764705882" green="0.78039215689999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
-                            <constraints>
-                                <constraint firstAttribute="width" constant="56" id="0Yj-XR-Ors"/>
-                                <constraint firstAttribute="height" constant="28" id="g7h-sH-BIb"/>
-                            </constraints>
-                            <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
-                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                            <state key="normal" title="搜索"/>
-                            <userDefinedRuntimeAttributes>
-                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                                    <real key="value" value="14"/>
-                                </userDefinedRuntimeAttribute>
-                            </userDefinedRuntimeAttributes>
-                        </button>
-                    </subviews>
-                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-                    <constraints>
-                        <constraint firstItem="Ud0-St-B7w" firstAttribute="leading" secondItem="8Ix-cN-Qnc" secondAttribute="trailing" constant="11" id="19I-Qa-Ids"/>
-                        <constraint firstItem="Ud0-St-B7w" firstAttribute="top" secondItem="KhN-lD-vcC" secondAttribute="top" id="4EH-1U-Mbr"/>
-                        <constraint firstAttribute="trailing" secondItem="pVF-V1-s8f" secondAttribute="trailing" constant="4" id="KXH-NN-ULL"/>
-                        <constraint firstItem="8Ix-cN-Qnc" firstAttribute="centerY" secondItem="KhN-lD-vcC" secondAttribute="centerY" id="Rae-R6-bAB"/>
-                        <constraint firstAttribute="bottom" secondItem="Ud0-St-B7w" secondAttribute="bottom" id="U4Q-T0-AP1"/>
-                        <constraint firstAttribute="height" constant="36" id="VNE-zv-tx0"/>
-                        <constraint firstItem="pVF-V1-s8f" firstAttribute="leading" secondItem="Ud0-St-B7w" secondAttribute="trailing" constant="10" id="b2h-HJ-cfT"/>
-                        <constraint firstItem="8Ix-cN-Qnc" firstAttribute="leading" secondItem="KhN-lD-vcC" secondAttribute="leading" constant="12" id="efb-gy-ndo"/>
-                        <constraint firstItem="pVF-V1-s8f" firstAttribute="centerY" secondItem="KhN-lD-vcC" secondAttribute="centerY" id="fLd-LA-27D"/>
-                    </constraints>
-                    <userDefinedRuntimeAttributes>
-                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                            <real key="value" value="17.5"/>
-                        </userDefinedRuntimeAttribute>
-                    </userDefinedRuntimeAttributes>
-                </view>
             </subviews>
             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <constraints>
-                <constraint firstItem="KhN-lD-vcC" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="DsS-0Q-QPz"/>
-                <constraint firstAttribute="trailing" secondItem="KhN-lD-vcC" secondAttribute="trailing" constant="14" id="FdW-8b-IKA"/>
                 <constraint firstAttribute="trailing" secondItem="2e1-g7-DgM" secondAttribute="trailing" constant="14" id="g3J-xi-5KZ"/>
                 <constraint firstItem="2e1-g7-DgM" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="ke3-VT-rre"/>
-                <constraint firstAttribute="bottom" secondItem="KhN-lD-vcC" secondAttribute="bottom" id="mK5-IF-CRR"/>
-                <constraint firstItem="KhN-lD-vcC" firstAttribute="top" secondItem="2e1-g7-DgM" secondAttribute="bottom" constant="12" id="yxy-GA-yem"/>
+                <constraint firstItem="2e1-g7-DgM" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="vf4-GI-MEI"/>
             </constraints>
             <nil key="simulatedTopBarMetrics"/>
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
-                <outlet property="groupImage" destination="t6n-tG-oLV" id="b1a-Om-Htf"/>
-                <outlet property="groupLabel" destination="8pC-jf-FdV" id="6qK-9U-E60"/>
-                <outlet property="searchField" destination="Ud0-St-B7w" id="f2l-rL-HAJ"/>
-                <outlet property="singleImage" destination="qCn-hj-x7a" id="LR4-wD-75G"/>
-                <outlet property="singleLabel" destination="uUY-bh-cuO" id="vw0-2J-0xV"/>
+                <outlet property="groupImage" destination="qCn-hj-x7a" id="S8C-va-RG0"/>
+                <outlet property="groupLabel" destination="uUY-bh-cuO" id="HJe-b8-7yj"/>
+                <outlet property="singleImage" destination="t6n-tG-oLV" id="4KG-0q-xmm"/>
+                <outlet property="singleLabel" destination="8pC-jf-FdV" id="Pup-cR-4hf"/>
             </connections>
-            <point key="canvasLocation" x="170.28985507246378" y="-103.79464285714285"/>
+            <point key="canvasLocation" x="170.28985507246378" y="-113.16964285714285"/>
         </view>
     </objects>
     <resources>
-        <image name="chat_group_unselected" width="16" height="13"/>
-        <image name="chat_single_selected" width="12" height="13"/>
-        <image name="search_green" width="15" height="16"/>
+        <image name="chat_group_selected" width="16" height="13"/>
+        <image name="chat_single_unselected" width="12" height="13"/>
     </resources>
 </document>

+ 1 - 0
KulexiuForStudent/KulexiuForStudent/Module/Live/Model/KSEnterLiveroomManager.m

@@ -41,6 +41,7 @@ static BOOL isRequestRoomMsg  = NO;
     TXLiveRoomViewController *liveVC = [[TXLiveRoomViewController alloc] init];
     liveVC.roomId = [source ks_stringValueForKey:@"roomUid"];
     liveVC.createrId = [source ks_stringValueForKey:@"speakerImUserId"];
+    liveVC.createrUserId = [source ks_stringValueForKey:@"speakerId"];
     liveVC.createrName = [source ks_stringValueForKey:@"speakerName"];
     liveVC.createrAvatal = [source ks_stringValueForKey:@"speakerPic"];
     NSInteger lookCount = [source ks_integerValueForKey:@"lookNum"];

+ 3 - 3
KulexiuForStudent/KulexiuForStudent/Module/Live/Model/LiveModuleService.m

@@ -21,7 +21,7 @@
     NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-student/imLiveBroadcastRoom/queryRoom"];
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     [parm setValue:roomId forKey:@"roomUid"];
-    [parm setValue:UserDefault(IM_USERID) forKey:@"userId"];
+    [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
     [KSNetworkingManager LiveRoomRequest:get url:url parms:parm success:success faliure:faliure];
 }
 
@@ -53,7 +53,7 @@
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     [parm setValue:@"iOS" forKey:@"os"];
     [parm setValue:@"3" forKey:@"status"];
-    [parm setValue:UserDefault(IM_USERID) forKey:@"userid"];
-    [KSNetworkingManager LiveRoomRequest:post url:url parms:parm success:success faliure:faliure];
+    [parm setValue:UserDefault(UIDKey) forKey:@"userid"];
+    [KSNetworkingManager LiveRoomRequest:post url:url parms:@[parm] success:success faliure:faliure];
 }
 @end

+ 16 - 14
KulexiuForStudent/KulexiuForStudent/Module/Login/Model/UserInfoManager.m

@@ -49,22 +49,24 @@
 
 - (void)otherLogin {
     dispatch_main_async_safe(^{
+        UIWindow *window = [NSObject getKeyWindow];
         UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
         
-        if ([vc.presentedViewController isKindOfClass:NSClassFromString(@"TXClassroomViewController")]) {
-            [self checkTokenEnableCallback:^(BOOL enable) {
-                if (enable) {
-                    [[NSNotificationCenter defaultCenter] postNotificationName:@"classroomQuit" object:nil];
-                    NSLog(@"-----classroomQuit");
-                }
-                else {
-                    [[NSNotificationCenter defaultCenter] postNotificationName:@"classroomLogout" object:nil];
-                    NSLog(@"-----classroomLogout");
-                }
-            }];
-        }
-        else if ([vc isKindOfClass:[UITabBarController class]]) {
-            if ([vc.presentedViewController isKindOfClass:NSClassFromString(@"CustomNavViewController")]) {
+        if ([vc isKindOfClass:[UITabBarController class]]) {
+            UITabBarController *tab = (UITabBarController *)window.rootViewController;
+            CustomNavViewController *ctrl = (CustomNavViewController *)tab.selectedViewController;
+            if ([ctrl.visibleViewController isKindOfClass:NSClassFromString(@"TXClassroomViewController")]) {
+                [self checkTokenEnableCallback:^(BOOL enable) {
+                    if (enable) {
+                        [[NSNotificationCenter defaultCenter] postNotificationName:@"classroomQuit" object:nil];
+                    }
+                    else {
+                        [[NSNotificationCenter defaultCenter] postNotificationName:@"classroomLogout" object:nil];
+                    }
+                }];
+                return;
+            }
+            else if ([vc.presentedViewController isKindOfClass:NSClassFromString(@"CustomNavViewController")]) {
                 CustomNavViewController *nav = (CustomNavViewController *)vc.presentedViewController;
                 if ([nav.visibleViewController isKindOfClass:NSClassFromString(@"TXLiveRoomViewController")] || [nav.visibleViewController isKindOfClass:NSClassFromString(@"KSLiveWebViewController")]) {
                     [self checkTokenEnableCallback:^(BOOL enable) {

+ 9 - 0
KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/Controller/TXClassroomViewController.m

@@ -258,6 +258,9 @@
     self.isQuitRoom = YES;
     [[LoginHelper sharedInstance] logout];
     self.cancleAlert = YES;
+    [TRTC_MANAGER leaveRoom:^(NSInteger code) {
+        
+    }];
     [[NSNotificationCenter defaultCenter] postNotificationName:@"backLoginView" object:nil];
 }
 
@@ -266,6 +269,9 @@
         self.isQuitRoom = YES;
         [[LoginHelper sharedInstance] logout];
         self.cancleAlert = YES;
+        [TRTC_MANAGER leaveRoom:^(NSInteger code) {
+            
+        }];
         [[NSNotificationCenter defaultCenter] postNotificationName:@"showOtherLoginAlert" object:nil];
     });
 }
@@ -733,6 +739,9 @@
     }
     [self.view bringSubviewToFront:self.timeView];
     [self.view bringSubviewToFront:self.titleView];
+    if (self.squareOn) {
+        [self.view bringSubviewToFront:self.maskView];
+    }
 }
 
 - (void)refreshWhiteBoardFrame {

+ 46 - 15
KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/View/VideoList/TXClassroomVideoListCell.m

@@ -16,7 +16,7 @@
 @interface TXClassroomVideoListCell ()
 
 @property (nonatomic, strong) UIView *backGroundView;
-@property (nonatomic, strong) UIImageView *closeCameraView;
+@property (nonatomic, strong) UIView *closeCameraView;
 
 @property (nonatomic, strong) UILabel *nameLable;
 @property (nonatomic, strong) UILabel *handUpLabel;
@@ -37,6 +37,10 @@
 
 @property (nonatomic, strong) UIImageView *micImageView;
 
+@property (nonatomic, strong) UIView *layerView;
+
+@property (nonatomic, strong) RoomMember *member;
+
 @end
 
 @implementation TXClassroomVideoListCell
@@ -62,6 +66,7 @@
     [self.contentView addSubview:self.backGroundView];
     [self.contentView addSubview:self.videoView];
     [self.contentView addSubview:self.roleView];
+    [self.contentView addSubview:self.layerView];
     [self.contentView addSubview:self.nameView];
     [self.contentView addSubview:self.handView];
     [self.contentView addSubview:self.WaitLable];
@@ -89,18 +94,12 @@
     }];
     
     // layer view
-    UIView *layerView = [[UIView alloc] init];
-    layerView.backgroundColor = [UIColor clearColor];
-    [self.contentView addSubview:layerView];
-    [layerView mas_makeConstraints:^(MASConstraintMaker *make) {
+    [self.layerView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.right.bottom.mas_equalTo(self.closeCameraView);
         make.height.mas_equalTo(37);
     }];
-    layerView.layer.cornerRadius = 10;
-    layerView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
-    layerView.clipsToBounds = YES;
     CAGradientLayer *layer = [UIView createGradientLayerFromColor:HexRGBAlpha(0x000000, 0.0f) startPoint:CGPointMake(0.5, 0.1) endColor:HexRGBAlpha(0x000000, 0.7f) endPoint:CGPointMake(0.5, 1) bounds:CGRectMake(0, 0, VIDEO_WIDTH, 37)];
-    [layerView.layer addSublayer:layer];
+    [self.layerView.layer addSublayer:layer];
     
     // 添加信号图
     [self.contentView addSubview:self.qualityImage];
@@ -153,9 +152,11 @@
 - (void)setModel:(RoomMember *)member showTeacherPrompt:(BOOL)teacherPrompt {
     [self resetDefaultStyle];
     if (member == nil) {
+        self.member = nil;
         return;
     }
     if (member.userId == nil) {
+        self.member = nil;
         self.nameView.hidden = YES;
         self.videoView.hidden = YES;
         self.handView.hidden = YES;
@@ -164,6 +165,7 @@
         self.roleView.hidden = YES;
     }
     else {
+        self.member = member;
         self.userId = member.userId;
         [self remakeNameLable:member];
 
@@ -204,7 +206,6 @@
         }
         
         [self renderVideo:member];
-
     }
 }
 
@@ -219,6 +220,7 @@
 }
 
 - (void)renderVideo:(RoomMember *)member {
+    self.member = member;
     if(![self canRenderVideo:member]) {
         self.videoView.hidden = YES;
         return;
@@ -326,16 +328,35 @@
     return _backGroundView;
 }
 
-- (UIImageView *)closeCameraView {
+- (UIView *)closeCameraView {
     if (!_closeCameraView) {
-        UIImage *img = [TRTC_MANAGER generalCloseImage];
-        _closeCameraView = [[UIImageView alloc] initWithImage:img];
-        _closeCameraView.backgroundColor = [UIColor clearColor];
-        _closeCameraView.contentMode = UIViewContentModeScaleAspectFill;
+        _closeCameraView = [[UIView alloc] init];
+        _closeCameraView.backgroundColor = HexRGB(0xE9EDF3);
+        UIView *layerView = [[UIView alloc] initWithFrame:CGRectZero];
+        layerView.backgroundColor = HexRGB(0xffffff);
+        layerView.layer.cornerRadius = 21;
+        [_closeCameraView addSubview:layerView];
+        [layerView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.centerX.mas_equalTo(_closeCameraView.mas_centerX);
+            make.centerY.mas_equalTo(_closeCameraView.mas_centerY);
+            make.width.height.mas_equalTo(42);
+        }];
+        UIImageView *imageView = [[UIImageView alloc] init];
+        [imageView sd_setImageWithURL:[NSURL URLWithString:[self.member.url getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
+        imageView.layer.cornerRadius = 20;
+        imageView.clipsToBounds = YES;
+        imageView.contentMode = UIViewContentModeScaleAspectFill;
+        [layerView addSubview:imageView];
+        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.centerX.mas_equalTo(_closeCameraView.mas_centerX);
+            make.centerY.mas_equalTo(_closeCameraView.mas_centerY);
+            make.width.height.mas_equalTo(40);
+        }];
     }
     return _closeCameraView;
 }
 
+
 - (UIView *)videoView {
     if(!_videoView) {
         _videoView = [[UIView alloc] init];
@@ -346,6 +367,16 @@
     return _videoView;
 }
 
+- (UIView *)layerView {
+    if (!_layerView) {
+        _layerView = [[UIView alloc] init];
+        _layerView.backgroundColor = [UIColor clearColor];
+        _layerView.layer.cornerRadius = 10;
+        _layerView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
+        _layerView.clipsToBounds = YES;
+    }
+    return _layerView;
+}
 
 - (UILabel *)nameLable {
     if(!_nameLable) {

+ 3 - 0
KulexiuForStudent/KulexiuForStudent/Module/TXLive/Controller/TXLiveRoomViewController.h

@@ -11,6 +11,9 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface TXLiveRoomViewController : BaseViewController
+
+@property (nonatomic, strong) NSString *createrUserId;
+
 /*!
  加入的房间 ID
  */

+ 11 - 3
KulexiuForStudent/KulexiuForStudent/Module/TXLive/Controller/TXLiveRoomViewController.m

@@ -158,6 +158,8 @@ typedef NS_ENUM(NSInteger, MICSTATUS) {
 
 @property (nonatomic, strong) LiveRoomConfirmAlert *closeAlert;
 
+@property (nonatomic, assign) BOOL isConnectedFailed;
+
 @end
 
 //  用于记录点赞消息连续点击的次数
@@ -332,10 +334,16 @@ static int clickPraiseBtnTimes  = 0;
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveGroupMessage:)  name:OnReceiveTXLiveGroupNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveGroupCountMessage:)  name:OnReceiveTXLiveGroupCountNotification object:nil];
-    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkTips) name:@"networkError" object:nil];
+}
+
+- (void)networkTips {
+    [self MBPShow:@"直播已断开,请检查您的网络"];
+    self.isConnectedFailed = YES;
 }
 
 - (void)IMConnetedCallback {
+    self.isConnectedFailed = NO;
     dispatch_main_async_safe(^{
         // IM 连接成功回调
         if (self.hasSendWelcomeMessage) { // 如果已经发送了进入消息
@@ -2086,10 +2094,10 @@ static int clickPraiseBtnTimes  = 0;
     }
     NSString *url = @"";
     if ([NSString isEmptyString:tabs]) {
-        url = [NSString stringWithFormat:@"%@%@%@", WEBHOST,@"/#/teacherHome?teacherId=",self.createrId];
+        url = [NSString stringWithFormat:@"%@%@%@", WEBHOST,@"/#/teacherHome?teacherId=",self.createrUserId];
     }
     else {
-        url = [NSString stringWithFormat:@"%@%@%@&tabs=%@", WEBHOST,@"/#/teacherHome?teacherId=",self.createrId,tabs];
+        url = [NSString stringWithFormat:@"%@%@%@&tabs=%@", WEBHOST,@"/#/teacherHome?teacherId=",self.createrUserId,tabs];
     }
     KSLiveWebViewController *ctrl = [[KSLiveWebViewController alloc] init];
     ctrl.url = url;