diff --git a/ZYChat-EaseMob/ZYChat.xcodeproj/project.pbxproj b/ZYChat-EaseMob/ZYChat.xcodeproj/project.pbxproj index aba1019..bcab8d8 100644 --- a/ZYChat-EaseMob/ZYChat.xcodeproj/project.pbxproj +++ b/ZYChat-EaseMob/ZYChat.xcodeproj/project.pbxproj @@ -941,6 +941,13 @@ E485DEEE1CE8A153004DB104 /* flower@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E485DEED1CE8A153004DB104 /* flower@2x.png */; }; E485DEF41CE8AC9D004DB104 /* GJGCMessageExtendSendFlowerModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E485DEF31CE8AC9D004DB104 /* GJGCMessageExtendSendFlowerModel.m */; }; E485DEF71CE8B43C004DB104 /* GJGCChatFriendSendFlowerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E485DEF61CE8B43C004DB104 /* GJGCChatFriendSendFlowerCell.m */; }; + E4BDFBEC1E059D7C0061E029 /* ZYThemeUitil.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BDFBEB1E059D7C0061E029 /* ZYThemeUitil.m */; }; + E4BDFBEF1E05A0D00061E029 /* UITableView+Theme.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BDFBEE1E05A0D00061E029 /* UITableView+Theme.m */; }; + E4BDFC041E05A5E60061E029 /* default in Resources */ = {isa = PBXBuildFile; fileRef = E4BDFC031E05A5E60061E029 /* default */; }; + E4BDFC2F1E05D8950061E029 /* GJGCMusicSharePlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BDFC2E1E05D8950061E029 /* GJGCMusicSharePlayer.m */; }; + E4BDFC3B1E05E9540061E029 /* GJGCMusicPlayerBar.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BDFC3A1E05E9540061E029 /* GJGCMusicPlayerBar.m */; }; + E4BDFC411E05FFB80061E029 /* GJGCMusicPlayingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BDFC401E05FFB80061E029 /* GJGCMusicPlayingViewController.m */; }; + E4BDFC431E06481A0061E029 /* default.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E4BDFC421E06481A0061E029 /* default.jpg */; }; E4CB35311D21FF3600B15E30 /* GJGCChatSystemNotiReciever.m in Sources */ = {isa = PBXBuildFile; fileRef = E4CB35301D21FF3600B15E30 /* GJGCChatSystemNotiReciever.m */; }; E4F930281C79FF040038278A /* outer1@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E4F930271C79FF040038278A /* outer1@2x.png */; }; E4F9302A1C79FF0A0038278A /* outer2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E4F930291C79FF0A0038278A /* outer2@2x.png */; }; @@ -2027,6 +2034,18 @@ E485DEF31CE8AC9D004DB104 /* GJGCMessageExtendSendFlowerModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GJGCMessageExtendSendFlowerModel.m; sourceTree = ""; }; E485DEF51CE8B43C004DB104 /* GJGCChatFriendSendFlowerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GJGCChatFriendSendFlowerCell.h; sourceTree = ""; }; E485DEF61CE8B43C004DB104 /* GJGCChatFriendSendFlowerCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GJGCChatFriendSendFlowerCell.m; sourceTree = ""; }; + E4BDFBEA1E059D7C0061E029 /* ZYThemeUitil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYThemeUitil.h; sourceTree = ""; }; + E4BDFBEB1E059D7C0061E029 /* ZYThemeUitil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZYThemeUitil.m; sourceTree = ""; }; + E4BDFBED1E05A0D00061E029 /* UITableView+Theme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+Theme.h"; sourceTree = ""; }; + E4BDFBEE1E05A0D00061E029 /* UITableView+Theme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+Theme.m"; sourceTree = ""; }; + E4BDFC031E05A5E60061E029 /* default */ = {isa = PBXFileReference; lastKnownFileType = folder; path = default; sourceTree = ""; }; + E4BDFC2D1E05D8950061E029 /* GJGCMusicSharePlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GJGCMusicSharePlayer.h; sourceTree = ""; }; + E4BDFC2E1E05D8950061E029 /* GJGCMusicSharePlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GJGCMusicSharePlayer.m; sourceTree = ""; }; + E4BDFC391E05E9540061E029 /* GJGCMusicPlayerBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GJGCMusicPlayerBar.h; sourceTree = ""; }; + E4BDFC3A1E05E9540061E029 /* GJGCMusicPlayerBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GJGCMusicPlayerBar.m; sourceTree = ""; }; + E4BDFC3F1E05FFB80061E029 /* GJGCMusicPlayingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GJGCMusicPlayingViewController.h; sourceTree = ""; }; + E4BDFC401E05FFB80061E029 /* GJGCMusicPlayingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GJGCMusicPlayingViewController.m; sourceTree = ""; }; + E4BDFC421E06481A0061E029 /* default.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = default.jpg; sourceTree = ""; }; E4CB352F1D21FF3600B15E30 /* GJGCChatSystemNotiReciever.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GJGCChatSystemNotiReciever.h; sourceTree = ""; }; E4CB35301D21FF3600B15E30 /* GJGCChatSystemNotiReciever.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GJGCChatSystemNotiReciever.m; sourceTree = ""; }; E4F930271C79FF040038278A /* outer1@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "outer1@2x.png"; sourceTree = ""; }; @@ -2257,6 +2276,7 @@ 365F02DE1B5019D0005161D6 /* ZYChat */ = { isa = PBXGroup; children = ( + E4BDFBE91E059D640061E029 /* Theme */, C41173BB1D6D7B0D0037CD8F /* Call */, E4FE163E1D58D170008D47E4 /* Contacts */, C81DC6AF1C06EA1700348326 /* AppWall */, @@ -3335,6 +3355,8 @@ 365F089F1B50E082005161D6 /* Resource */ = { isa = PBXGroup; children = ( + E4BDFC421E06481A0061E029 /* default.jpg */, + E4BDFC031E05A5E60061E029 /* default */, E42C0D2C1D5A2502007F8278 /* title-icon-个人资料@2x.png */, E42C0D2D1D5A2502007F8278 /* title-icon-个人资料@3x.png */, E42C0D271D59A148007F8278 /* buddy_header_bg.png */, @@ -3931,6 +3953,12 @@ C8E50F6B1C05647400AFA10F /* GJGCMusicSearchResultListViewController.m */, C8E50F6D1C05648800AFA10F /* GJGCMusicSearchResultListDataManager.h */, C8E50F6E1C05648800AFA10F /* GJGCMusicSearchResultListDataManager.m */, + E4BDFC2D1E05D8950061E029 /* GJGCMusicSharePlayer.h */, + E4BDFC2E1E05D8950061E029 /* GJGCMusicSharePlayer.m */, + E4BDFC391E05E9540061E029 /* GJGCMusicPlayerBar.h */, + E4BDFC3A1E05E9540061E029 /* GJGCMusicPlayerBar.m */, + E4BDFC3F1E05FFB80061E029 /* GJGCMusicPlayingViewController.h */, + E4BDFC401E05FFB80061E029 /* GJGCMusicPlayingViewController.m */, ); path = MusicShare; sourceTree = ""; @@ -4148,6 +4176,17 @@ path = AudioWave; sourceTree = ""; }; + E4BDFBE91E059D640061E029 /* Theme */ = { + isa = PBXGroup; + children = ( + E4BDFBEA1E059D7C0061E029 /* ZYThemeUitil.h */, + E4BDFBEB1E059D7C0061E029 /* ZYThemeUitil.m */, + E4BDFBED1E05A0D00061E029 /* UITableView+Theme.h */, + E4BDFBEE1E05A0D00061E029 /* UITableView+Theme.m */, + ); + path = Theme; + sourceTree = ""; + }; E4F930261C79FEC20038278A /* Video */ = { isa = PBXGroup; children = ( @@ -4437,6 +4476,7 @@ TargetAttributes = { 365F02DB1B5019D0005161D6 = { CreatedOnToolsVersion = 6.1; + DevelopmentTeam = QA7LB7LLDU; }; 365F02EE1B5019D0005161D6 = { CreatedOnToolsVersion = 6.1; @@ -4558,6 +4598,7 @@ E4FEB43E1C01963600E4A153 /* 标签-bg-等级@2x.png in Resources */, 365F05AA1B501A5D005161D6 /* 025[疑问]@2x.png in Resources */, E4FEB4A11C060E5800E4A153 /* music@2x.png in Resources */, + E4BDFC431E06481A0061E029 /* default.jpg in Resources */, E4FEB4821C020EED00E4A153 /* square@3x.png in Resources */, E4FEB4881C020F0600E4A153 /* msg@2x.png in Resources */, C81DC6AC1C06AFF700348326 /* pause@2x.png in Resources */, @@ -4597,6 +4638,7 @@ 365F06D81B501A5D005161D6 /* 聊天键盘切换-btn-圆-点击@3x.png in Resources */, 365F060A1B501A5D005161D6 /* 073[米饭]@2x.png in Resources */, 365F06881B501A5D005161D6 /* 笑死了.gif in Resources */, + E4BDFC041E05A5E60061E029 /* default in Resources */, E4567A701D10CF4100940163 /* WechatShortVideo_close.png in Resources */, E4F9302A1C79FF0A0038278A /* outer2@2x.png in Resources */, 365F057C1B501A5D005161D6 /* 003[大哭]@2x.png in Resources */, @@ -5031,6 +5073,7 @@ C81702DF1BFF470E00FAE520 /* GJGCPublicGroupListViewController.m in Sources */, C81702CC1BFF3DC100FAE520 /* BTActionSheetTimePicker.m in Sources */, C8F3B9C71BF0ABF30057AF5B /* ZYDatabaseColunmCondition.m in Sources */, + E4BDFBEC1E059D7C0061E029 /* ZYThemeUitil.m in Sources */, C8E50E461C02B84200AFA10F /* ZWCollectionViewCell.m in Sources */, 365F04511B501A43005161D6 /* GJCFStringUitil.m in Sources */, C81702CA1BFF3DC100FAE520 /* BTActionSheetNameAndDetailCell.m in Sources */, @@ -5139,6 +5182,7 @@ E4567A6D1D10CF4100940163 /* CALayer+AddUIColor.m in Sources */, 365F03ED1B501A43005161D6 /* GJCFFileDownloadTask.m in Sources */, 365F05721B501A5D005161D6 /* GJGCChatInputTextView.m in Sources */, + E4BDFC3B1E05E9540061E029 /* GJGCMusicPlayerBar.m in Sources */, 365F04391B501A43005161D6 /* GJCFCoreTextRun.m in Sources */, E4567A691D10CF4100940163 /* SCVideoConfiguration.m in Sources */, 365F08021B50B138005161D6 /* GJGCChatSystemNotiBaseCell.m in Sources */, @@ -5277,6 +5321,7 @@ E4FEB4681C01F78100E4A153 /* GJGCMyHomePageViewController.m in Sources */, 365F08061B50B138005161D6 /* GJGCChatSystemNotiConstans.m in Sources */, 365F08401B50B138005161D6 /* GJGCGIFLoadManager.m in Sources */, + E4BDFC2F1E05D8950061E029 /* GJGCMusicSharePlayer.m in Sources */, E4FEB41B1C017B1400E4A153 /* GJGCInformationPhotoBox.m in Sources */, C8E50E661C02C44E00AFA10F /* WJItemsControlView.m in Sources */, 365F03FF1B501A43005161D6 /* GJCFAssetsPickerStyle.m in Sources */, @@ -5348,6 +5393,7 @@ 365F07EC1B50B138005161D6 /* GJGCChatFriendMiniMessageCell.m in Sources */, 365F083E1B50B138005161D6 /* GJGCChatFriendViewController.m in Sources */, 365F055E1B501A5D005161D6 /* GJGCChatInputExpandEmojiPanelMenuBarDataSourceItem.m in Sources */, + E4BDFBEF1E05A0D00061E029 /* UITableView+Theme.m in Sources */, 365F03E71B501A43005161D6 /* VoiceConverter.mm in Sources */, C81702AC1BFF3D1D00FAE520 /* GJGCCreateGroupInputTextCell.m in Sources */, E4FEB4231C017B1400E4A153 /* GJGCInformationBaseViewController.m in Sources */, @@ -5396,6 +5442,7 @@ 365F04091B501A43005161D6 /* GJCFAssetsPickerAlbumsCell.m in Sources */, C8DC4A021BEC79DA00F2D161 /* ZYNetWorkManager.m in Sources */, C8D1B1B31BFC552300201421 /* GJGCRecentChatStyle.m in Sources */, + E4BDFC411E05FFB80061E029 /* GJGCMusicPlayingViewController.m in Sources */, C8F3B9D41BF0B5050057AF5B /* FMDatabase.m in Sources */, 365F07D21B50B138005161D6 /* GJGCChatBaseConstans.m in Sources */, ); @@ -5692,6 +5739,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = QA7LB7LLDU; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -5734,6 +5782,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = QA7LB7LLDU; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/ZYChat-EaseMob/ZYChat/AppDelegate.m b/ZYChat-EaseMob/ZYChat/AppDelegate.m index 0efd7d1..8285aec 100644 --- a/ZYChat-EaseMob/ZYChat/AppDelegate.m +++ b/ZYChat-EaseMob/ZYChat/AppDelegate.m @@ -14,6 +14,7 @@ #import "BTTabBarRootController.h" #import "GJGCChatSystemNotiReciever.h" #import "GJGCCallDataManager.h" +#import "ZYThemeUitil.h" #define EaseMobAppKey @"zyprosoft#zychat" @@ -30,11 +31,11 @@ - (void)logOutAction if (!self.loginNav) { HALoginViewController *loginVC = [[HALoginViewController alloc]init]; - loginVC.title = @"iOS码农之家"; + loginVC.title = @"王者荣耀-约战"; self.loginNav = [[UINavigationController alloc]initWithRootViewController:loginVC]; - UIImage *navigationBarBack = GJCFQuickImageByColorWithSize([GJGCCommonFontColorStyle mainThemeColor], CGSizeMake(GJCFSystemScreenWidth * GJCFScreenScale, 64.f * GJCFScreenScale)); + UIImage *navigationBarBack = ZYThemeImage(kThemeHomeNavBar); [self.loginNav.navigationBar setBackgroundImage:navigationBarBack forBarMetrics:UIBarMetricsDefault]; } if (self.window.rootViewController) { @@ -50,6 +51,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( NSLog(@"%@",GJCFAppCacheDirectory); + [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO]; + //注册环信 EMOptions *options = [EMOptions optionsWithAppkey:EaseMobAppKey]; options.apnsCertName = @"zychat_apns"; @@ -60,8 +63,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( loginVC.title = @"iOS码农之家"; self.loginNav = [[UINavigationController alloc]initWithRootViewController:loginVC]; - - UIImage *navigationBarBack = GJCFQuickImageByColorWithSize([GJGCCommonFontColorStyle mainThemeColor], CGSizeMake(GJCFSystemScreenWidth * GJCFScreenScale, 64.f * GJCFScreenScale)); + UIImage *navigationBarBack = ZYThemeImage(kThemeHomeNavBar); [self.loginNav.navigationBar setBackgroundImage:navigationBarBack forBarMetrics:UIBarMetricsDefault]; self.window.rootViewController = self.loginNav; diff --git a/ZYChat-EaseMob/ZYChat/Base.lproj/LaunchScreen.xib b/ZYChat-EaseMob/ZYChat/Base.lproj/LaunchScreen.xib index a3ee7e7..94b4047 100644 --- a/ZYChat-EaseMob/ZYChat/Base.lproj/LaunchScreen.xib +++ b/ZYChat-EaseMob/ZYChat/Base.lproj/LaunchScreen.xib @@ -1,41 +1,27 @@ - + - - + + - + - - + + + - - - - - - - - - - + + + + + diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/buddy_header_arrow.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/buddy_header_arrow.png index 5bd9927..0532e04 100644 Binary files a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/buddy_header_arrow.png and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/buddy_header_arrow.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default.jpg b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default.jpg new file mode 100644 index 0000000..0cf2e82 Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default.jpg differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/assist.jpg b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/assist.jpg new file mode 100644 index 0000000..3cb037e Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/assist.jpg differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/chat_list_bg@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/chat_list_bg@2x.png new file mode 100644 index 0000000..5d6f2af Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/chat_list_bg@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_list@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_list@2x.png new file mode 100644 index 0000000..f0243a9 Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_list@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_nav@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_nav@2x.png new file mode 100644 index 0000000..ce07880 Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_nav@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_tab@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_tab@2x.png new file mode 100644 index 0000000..bcf1eea Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/home_tab@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_home@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_home@2x.png new file mode 100644 index 0000000..f7eb680 Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_home@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_msg_normal@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_msg_normal@2x.png new file mode 100644 index 0000000..b9bd5eb Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_msg_normal@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_msg_selected@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_msg_selected@2x.png new file mode 100644 index 0000000..e5745ad Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_msg_selected@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_square@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_square@2x.png new file mode 100644 index 0000000..db550fa Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/icon_square@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_list@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_list@2x.png new file mode 100644 index 0000000..9149207 Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_list@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_nav@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_nav@2x.png new file mode 100644 index 0000000..ce07880 Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_nav@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_tab@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_tab@2x.png new file mode 100644 index 0000000..bcf1eea Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/recent_tab@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_list@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_list@2x.png new file mode 100644 index 0000000..95a127c Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_list@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_nav@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_nav@2x.png new file mode 100644 index 0000000..ce07880 Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_nav@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_tab@2x.png b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_tab@2x.png new file mode 100644 index 0000000..bcf1eea Binary files /dev/null and b/ZYChat-EaseMob/ZYChat/ChatDetail/Resource/default/square_tab@2x.png differ diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendCellStyle.m b/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendCellStyle.m index 8b84e78..5fafb46 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendCellStyle.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendCellStyle.m @@ -66,7 +66,7 @@ + (NSAttributedString *)formateGroupChatSenderName:(NSString *)senderName return nil; } GJCFCoreTextAttributedStringStyle *stringStyle = [[GJCFCoreTextAttributedStringStyle alloc]init]; - stringStyle.foregroundColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColor]; + stringStyle.foregroundColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColorWhite]; stringStyle.font = [GJGCCommonFontColorStyle baseAndTitleAssociateTextFont]; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:senderName attributes:[stringStyle attributedDictionary]]; @@ -182,7 +182,7 @@ + (GJCFCoreTextAttributedStringStyle *)nameLabelStyle { GJCFCoreTextAttributedStringStyle *stringStyle = [[GJCFCoreTextAttributedStringStyle alloc]init]; stringStyle.font = [GJGCCommonFontColorStyle detailBigTitleFont]; - stringStyle.foregroundColor = [GJGCCommonFontColorStyle detailBigTitleColor]; + stringStyle.foregroundColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColorWhite]; return stringStyle; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendContentModel.h b/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendContentModel.h index cdc896a..b628a23 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendContentModel.h +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/ChatCell/GJGCChatFriendContentModel.h @@ -149,6 +149,8 @@ @property (nonatomic,strong)NSString *musicSongId; +@property (nonatomic,strong)NSString *musicSongImgUrl; + @property (nonatomic,assign)BOOL isMusicPlaying; #pragma mark - 短视频消息 diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatSystemNotiCellStyle.m b/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatSystemNotiCellStyle.m index 71cbff1..5e563e3 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatSystemNotiCellStyle.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/UITableViewCell/SystemNoti/GJGCChatSystemNotiCellStyle.m @@ -285,7 +285,7 @@ + (NSAttributedString *)formateActiveDescription:(NSString *)description + (GJCFCoreTextAttributedStringStyle *)timeLabelStyle { GJCFCoreTextAttributedStringStyle *stringStyle = [[GJCFCoreTextAttributedStringStyle alloc]init]; - stringStyle.foregroundColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColor]; + stringStyle.foregroundColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColorWhite]; stringStyle.font = [GJGCCommonFontColorStyle baseAndTitleAssociateTextFont]; return stringStyle; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.h b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.h index 45cf647..267f2e2 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.h +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.h @@ -12,6 +12,8 @@ + (NSDictionary *)parseContent:(NSString *)string; ++ (NSDictionary *)parseRecentContent:(NSString *)string; + + (void)parseEmoji:(NSMutableString *)originString withEmojiTempString:(NSMutableString *)tempString withResultArray:(NSMutableArray *)resultArray; @end diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.m b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.m index 6802bda..1f88523 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCChatContentEmojiParser.m @@ -34,6 +34,29 @@ + (NSDictionary *)parseContent:(NSString *)string return parseContentDict; } ++ (NSDictionary *)parseRecentContent:(NSString *)string +{ + if (GJCFStringIsNull(string)) { + return nil; + } + + /* 表情 */ + NSMutableArray *emojiArray = [NSMutableArray array]; + [GJGCChatContentEmojiParser parseEmoji:[NSMutableString stringWithString:string] withEmojiTempString:nil withResultArray:emojiArray]; + + /* 电话 */ + NSArray *phoneNumberArray = [self searchPhoneNumberFromString:string]; + + /* 超链接 */ + NSArray *linkArray = [self searchUrlLinkFromString:string]; + + NSDictionary *parseContentDict = [GJGCChatContentEmojiParser setupWithString:string withPhoneNumbers:phoneNumberArray withLinkArray:linkArray andEmojis:emojiArray foregroundColor:[UIColor whiteColor]]; + + GJCFNSCacheSet(string, parseContentDict); + + return parseContentDict; +} + + (NSString *)replaceNumberString:(NSInteger)numberStringLength { @@ -160,6 +183,11 @@ + (NSArray *)searchPhoneNumberFromString:(NSString *)sourceString } + (NSDictionary *)setupWithString:(NSString *)string withPhoneNumbers:(NSArray *)phoneNumberArray withLinkArray:(NSArray *)linkArray andEmojis:(NSArray *)emojiArray +{ + return [GJGCChatContentEmojiParser setupWithString:string withPhoneNumbers:phoneNumberArray withLinkArray:linkArray andEmojis:emojiArray foregroundColor:[UIColor blackColor]]; +} + ++ (NSDictionary *)setupWithString:(NSString *)string withPhoneNumbers:(NSArray *)phoneNumberArray withLinkArray:(NSArray *)linkArray andEmojis:(NSArray *)emojiArray foregroundColor:(UIColor *)color { NSArray *emojiNameArray = [NSArray arrayWithContentsOfFile:GJCFMainBundlePath(@"emoji.plist")]; NSMutableDictionary *emojiDict = [NSMutableDictionary dictionary]; @@ -177,7 +205,7 @@ + (NSDictionary *)setupWithString:(NSString *)string withPhoneNumbers:(NSArray * } GJCFCoreTextAttributedStringStyle *stringStyle = [[GJCFCoreTextAttributedStringStyle alloc]init]; - stringStyle.foregroundColor = [GJGCCommonFontColorStyle detailBigTitleColor]; + stringStyle.foregroundColor = color; stringStyle.font = [UIFont systemFontOfSize:16]; GJCFCoreTextParagraphStyle *paragrpahStyle = [[GJCFCoreTextParagraphStyle alloc]init]; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.h b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.h index 98f5444..16f4d69 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.h +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.h @@ -30,12 +30,16 @@ + (UIColor *)listTitleAndDetailTextColor; ++ (UIColor *)listTitleAndDetailTextColorWhite; + #pragma mark - 基本字号 标题下的辅助文字 + (UIFont *)baseAndTitleAssociateTextFont; + (UIColor *)baseAndTitleAssociateTextColor; ++ (UIColor *)baseAndTitleAssociateTextColorWhite; + #pragma mark - 主题色彩 辅助色彩 页面底色 + (UIColor *)mainThemeColor; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.m b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.m index 3e93408..adbf32f 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCCommonFontColorStyle.m @@ -51,6 +51,11 @@ + (UIColor *)listTitleAndDetailTextColor return [GJGCCommonFontColorStyle detailBigTitleColor]; } ++ (UIColor *)listTitleAndDetailTextColorWhite +{ + return [UIColor whiteColor]; +} + #pragma mark - 基本字号 标题下的辅助文字 + (UIFont *)baseAndTitleAssociateTextFont @@ -63,6 +68,11 @@ + (UIColor *)baseAndTitleAssociateTextColor return GJCFQuickRGBColor(153, 153, 153); } ++ (UIColor *)baseAndTitleAssociateTextColorWhite +{ + return [self listTitleAndDetailTextColorWhite]; +} + #pragma mark - 主题色彩 辅助色彩 页面底色 + (UIColor *)mainThemeColor diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCRefreshHeaderView.m b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCRefreshHeaderView.m index 9f7d62a..4651a06 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCRefreshHeaderView.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/View/GJGCRefreshHeaderView.m @@ -84,7 +84,7 @@ - (void)setupSubViews self.arrowImgView.frame = CGRectMake(floorf((REFRESH_HEAD_HEIGHT - 27)/2), floorf((REFRESH_HEAD_HEIGHT - 44)/2), 27, 44); //设置活动指示 - self.activeView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; + self.activeView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; //self.activeView.frame = CGRectMake(floorf((REFRESH_HEAD_HEIGHT -20)/2+60), floorf((REFRESH_HEAD_HEIGHT-20)/2-7), 20, 20); self.activeView.frame = CGRectMake(floorf((REFRESH_HEAD_HEIGHT -20)/2+60+40), floorf((REFRESH_HEAD_HEIGHT-20)/2-7)+10, 20, 20); self.activeView.hidesWhenStopped = YES; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCBaseViewController.m b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCBaseViewController.m index e81b4c8..dfdae6e 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCBaseViewController.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCBaseViewController.m @@ -30,7 +30,7 @@ @implementation GJGCBaseViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - + /* 初始化加载特效 */ [self createStatusHUDWithView:self.view]; self.statusHUD.gjcf_height = self.statusHUD.gjcf_height - self.contentOriginY; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailDataSourceManager.m b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailDataSourceManager.m index 55bbafc..0f8f527 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailDataSourceManager.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailDataSourceManager.m @@ -15,6 +15,7 @@ #import "GJGCMessageExtendMusicShareModel.h" #import "GJGCMessageExtendSendFlowerModel.h" #import "GJGCMessageExtendMiniMessageModel.h" +#import "GJGCMusicSharePlayer.h" NSString * GJGCChatForwardMessageDidSendNoti = @"GJGCChatForwardMessageDidSendNoti"; @@ -788,6 +789,15 @@ - (GJGCChatFriendContentType)formateChatFriendContent:(GJGCChatFriendContentMode chatContentModel.musicSongName = musicContent.title; chatContentModel.musicSongUrl = musicContent.songUrl; chatContentModel.musicSongAuthor = musicContent.author; + chatContentModel.musicSongImgUrl = musicContent.songImgUrl; + + //是不是正在播放的音乐 + if([GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying){ + if ([chatContentModel.localMsgId isEqualToString:[GJGCMusicSharePlayer sharePlayer].musicMsgId]) { + chatContentModel.isPlayingAudio = YES; + } + } + } break; case GJGCChatFriendContentTypeWebPage: diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.h b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.h index 98e0386..2ea380d 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.h +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.h @@ -16,8 +16,9 @@ #import "GJGCRefreshHeaderView.h" #import "GJGCRefreshFooterView.h" #import "GJGCBaseViewController.h" +#import "GJGCMusicPlayerBar.h" -@interface GJGCChatDetailViewController : GJGCBaseViewController +@interface GJGCChatDetailViewController : GJGCBaseViewController @property (nonatomic,strong)GJGCRefreshHeaderView *refreshHeadView; @@ -33,6 +34,8 @@ @property (nonatomic,readonly)GJGCChatFriendTalkModel *taklInfo; +@property (nonatomic,strong)GJGCMusicPlayerBar *musicBar; + - (instancetype)initWithTalkInfo:(GJGCChatFriendTalkModel *)talkModel; /** @@ -72,6 +75,12 @@ - (void)stopPlayCurrentAudio; +- (void)setupMusicBar; + +#pragma mark - scroll event + +- (void)dispatchScrollViewDidEndDecelerating; + #pragma mark - 收起输入键盘 - (void)reserveChatInputPanelState; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.m b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.m index 5ce09be..a215e01 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Base/GJGCChatDetailViewController.m @@ -11,6 +11,8 @@ #import "GJGCChatBaseCellDelegate.h" #import "GJGCChatFriendBaseCell.h" #import "GJGCParticleEffectLayer.h" +#import "GJGCMusicSharePlayer.h" +#import "ZYThemeUitil.h" @interface GJGCChatDetailViewController ()< GJGCRefreshHeaderViewDelegate @@ -111,7 +113,14 @@ - (void)didReceiveMemoryWarning { #pragma mark - 初始化设置 - (void)initSubViews { - self.view.backgroundColor = [GJGCCommonFontColorStyle mainBackgroundColor]; + //背景图 + UIImageView *backImageView = [[UIImageView alloc]initWithFrame:self.view.bounds]; + backImageView.image = ZYThemeImage(kThemeChatLisgBg); + UIImageView *maskView = [[UIImageView alloc]initWithFrame:backImageView.bounds]; + backImageView.gjcf_height = backImageView.image.size.height; + maskView.backgroundColor = [UIColor colorWithRed:97/255.f green:60/255.f blue:140/255.f alpha:0.6]; + [backImageView addSubview:maskView]; + [self.view insertSubview:backImageView atIndex:0]; CGFloat originY = GJCFSystemNavigationBarHeight + GJCFSystemOriginYDelta; @@ -123,6 +132,7 @@ - (void)initSubViews self.chatListTable.separatorStyle = UITableViewCellSeparatorStyleNone; self.chatListTable.frame = (CGRect){0,0,GJCFSystemScreenWidth,GJCFSystemScreenHeight - originY - 50}; [self.view addSubview:self.chatListTable]; + self.chatListTable.backgroundColor = [UIColor clearColor]; /* 滚动到最底部 */ if (self.dataSourceManager.totalCount > 0) { @@ -460,6 +470,26 @@ - (void)stopPlayCurrentAudio } +- (void)setupMusicBar +{ + if ([[GJGCMusicSharePlayer sharePlayer].audioPlayer isPlaying]) { + if (!self.musicBar) { + self.musicBar = [GJGCMusicPlayerBar currentMusicBar]; + self.musicBar.delegate = self; + self.musicBar.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.65]; + [self.view addSubview:self.musicBar]; + }else{ + self.musicBar.alpha = 1; + [self.view bringSubviewToFront:self.musicBar]; + [self.musicBar startMove]; + } + }else{ + if (self.musicBar) { + self.musicBar.alpha = 0; + } + } +} + #pragma mark - 暂停Gif动画 - (void)makeVisiableGifCellPause @@ -547,6 +577,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView [self.refreshHeadView scrollViewDidScroll:scrollView]; } } + [self dispatchScrollViewDidEndDecelerating]; } - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate @@ -561,6 +592,11 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL } } +- (void)dispatchScrollViewDidEndDecelerating +{ + +} + #pragma mark - GJCFFileDownloadManager config - (void)configFileDownloadManager { @@ -816,6 +852,8 @@ - (void)highSpeedUpdateFlushWithIndex:(NSInteger)index { if (index >= 0 && index < self.dataSourceManager.totalCount) { + NSLog(@"high speed load index!:%ld",index); + NSIndexPath *reloadPath = [NSIndexPath indexPathForRow:index inSection:0]; /* 鉴定是否可见 */ @@ -831,6 +869,8 @@ - (void)highSpeedUpdateFlushWithIndex:(NSInteger)index [chatCell setSendStatus:contentModel.sendStatus]; } + }else{ + NSLog(@"high speed load out index!:%ld",index); } } diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Friend/GJGCChatFriendViewController.m b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Friend/GJGCChatFriendViewController.m index dab9b73..d4c792d 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Friend/GJGCChatFriendViewController.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/Friend/GJGCChatFriendViewController.m @@ -35,6 +35,8 @@ #import "AppDelegate.h" #import "GJGCVoiceCallViewController.h" #import "GJGCVideoCallViewController.h" +#import "GJGCMusicSharePlayer.h" +#import "GJGCMusicPlayingViewController.h" #define GJGCActionSheetCallPhoneNumberTag 132134 @@ -52,8 +54,6 @@ @interface GJGCChatFriendViewController ()< WechatShortVideoDelegate,EMCallManagerDelegate > -@property (nonatomic,strong)GJCFAudioPlayer *audioPlayer; - @property (nonatomic,strong)NSString *playingAudioMsgId; @property (nonatomic,assign)NSInteger lastPlayedAudioMsgIndex; @@ -62,6 +62,7 @@ @interface GJGCChatFriendViewController ()< @property (nonatomic,strong)UILabel *sendLimitTipLabel; + /* * 拨打电话webview */ @@ -77,9 +78,11 @@ - (void)viewDidLoad { [self setRightButtonWithStateImage:@"title-icon-个人资料" stateHighlightedImage:nil stateDisabledImage:nil titleName:nil]; - /* 语音播放工具 */ - self.audioPlayer = [[GJCFAudioPlayer alloc]init]; - self.audioPlayer.delegate = self; + [self setupMusicBar]; + + if ([GJGCMusicSharePlayer sharePlayer].musicMsgId.length > 0 && [[GJGCMusicSharePlayer sharePlayer].musicChatId isEqualToString:self.taklInfo.conversation.conversationId]) { + self.playingAudioMsgId = [GJGCMusicSharePlayer sharePlayer].musicMsgId; + } [self setStrNavTitle:self.dataSourceManager.title]; @@ -94,7 +97,7 @@ - (void)viewDidLoad { } } - + /* 观察录音工具开始录音 */ NSString *formateNoti = [GJGCChatInputConst panelNoti:GJGCChatInputPanelBeginRecordNoti formateWithIdentifier:self.inputPanel.panelIndentifier]; [GJCFNotificationCenter addObserver:self selector:@selector(observeChatInputPanelBeginRecord:) name:formateNoti object:nil]; @@ -109,28 +112,38 @@ -(void)dealloc{ } #pragma mark - 应用程序事件 + - (void)observeApplicationResignActive:(NSNotification *)noti { [self stopPlayCurrentAudio]; } -- (void)viewDidDisappear:(BOOL)animated +- (void)viewWillDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; - - if (!self.presentingViewController && !self.presentedViewController) { - if (self.audioPlayer.isPlaying) { - [self stopPlayCurrentAudio]; - } - } + [super viewWillDisappear:animated]; + [[GJGCMusicSharePlayer sharePlayer] shouldStopPlay]; + [[GJGCMusicSharePlayer sharePlayer] removePlayObserver:self]; + [[GJGCMusicSharePlayer sharePlayer] removePlayObserver:self.musicBar]; [self.inputPanel removeKeyboardObserve]; } +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + [[GJGCMusicSharePlayer sharePlayer] addPlayObserver:self.musicBar]; + [[GJGCMusicSharePlayer sharePlayer] addPlayObserver:self]; +} + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self.inputPanel startKeyboardObserve]; + + if ([GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying) { + [self.musicBar startMove]; + } } - (void)rightButtonPressed:(id)sender @@ -189,6 +202,10 @@ - (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didFinishPlayAudio:(GJCFAudioMo [self stopPlayCurrentAudio]; + if (self.musicBar) { + [self.musicBar removeFromSuperview]; + } + [self checkNextAudioMsgToPlay]; }); @@ -266,7 +283,7 @@ - (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didOccusError:(NSError *)error - (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didUpdateSoundMouter:(CGFloat)soundMouter { /* 操作过快屏蔽 */ - if (!self.playingAudioMsgId) { + if (self.playingAudioMsgId.length == 0) { return; } @@ -338,7 +355,7 @@ - (void)audioMessageCellDidTap:(GJGCChatBaseCell *)tapedCell // 如果点击的是自己,那么停止了就不往下走了。如果 GJGCChatContentBaseModel *contentModel = [self.dataSourceManager contentModelAtIndex:indexPath.row]; - if ( self.playingAudioMsgId && [self.playingAudioMsgId isEqualToString:contentModel.localMsgId] && self.audioPlayer.isPlaying) { + if ( self.playingAudioMsgId && [self.playingAudioMsgId isEqualToString:contentModel.localMsgId] && [GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying) { [self stopPlayCurrentAudio]; @@ -431,6 +448,8 @@ - (void)chatCellDidTapOnMusicShare:(GJGCChatBaseCell *)tapedCell NSIndexPath *tapIndexPath = [self.chatListTable indexPathForCell:tapedCell]; GJGCChatFriendContentModel *contentModel = (GJGCChatFriendContentModel *)[self.dataSourceManager contentModelAtIndex:tapIndexPath.row]; + [self stopPlayCurrentAudio]; + GJGCMusicPlayViewController *musicVC = [[GJGCMusicPlayViewController alloc]initWithSongId:contentModel.musicSongId]; [self.navigationController pushViewController:musicVC animated:YES]; } @@ -605,12 +624,28 @@ - (void)startPlayCurrentAudio NSIndexPath *playingIndexPath = [NSIndexPath indexPathForRow:playingIndex inSection:0]; if (GJCFFileIsExist(localStorePath)) { - [self.audioPlayer playAudioFile:contentModel.audioModel]; + //播放歌曲 + [GJGCMusicSharePlayer sharePlayer].musicSongName = contentModel.musicSongName; + [GJGCMusicSharePlayer sharePlayer].musicSongUrl = contentModel.musicSongUrl; + [GJGCMusicSharePlayer sharePlayer].musicSongAuthor = contentModel.musicSongAuthor; + [GJGCMusicSharePlayer sharePlayer].musicSongId = contentModel.musicSongId; + [GJGCMusicSharePlayer sharePlayer].musicSongImgUrl = contentModel.musicSongImgUrl; + if (contentModel.contentType == GJGCChatFriendContentTypeMusicShare) { + [GJGCMusicSharePlayer sharePlayer].musicMsgId = contentModel.localMsgId; + [GJGCMusicSharePlayer sharePlayer].musicChatId = self.taklInfo.conversation.conversationId; + }else{ + [GJGCMusicSharePlayer sharePlayer].musicMsgId = nil; + [GJGCMusicSharePlayer sharePlayer].musicChatId = nil; + } + + [[GJGCMusicSharePlayer sharePlayer].audioPlayer playAudioFile:contentModel.audioModel]; contentModel.isPlayingAudio = YES; contentModel.isRead = YES; self.isLastPlayedMyAudio = contentModel.isFromSelf; [self.dataSourceManager updateContentModelValuesNotEffectRowHeight:contentModel atIndex:playingIndex]; + [self setupMusicBar];//音乐播放条 + //音乐和语音区分 switch (contentModel.contentType) { case GJGCChatFriendContentTypeAudio: @@ -663,8 +698,8 @@ - (void)startPlayCurrentAudio - (void)stopPlayCurrentAudio { - if (self.audioPlayer.isPlaying) { - [self.audioPlayer stop]; + if ([GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying) { + [[GJGCMusicSharePlayer sharePlayer].audioPlayer stop]; } if (self.playingAudioMsgId) { @@ -1577,7 +1612,7 @@ - (void)downloadFileCompletionForMessage:(EMMessage *)message successState:(BOOL NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0]; - [self.audioPlayer playAudioFile:contentModel.audioModel]; + [[GJGCMusicSharePlayer sharePlayer].audioPlayer playAudioFile:contentModel.audioModel]; contentModel.isPlayingAudio = YES; contentModel.isRead = YES; self.isLastPlayedMyAudio = contentModel.isFromSelf; @@ -1731,4 +1766,40 @@ - (void)openTheVideo } } +#pragma mark - MusicBarDelegate + +- (void)didTappedMusicPlayerBar +{ + GJGCMusicPlayingViewController *musicPlay = [[GJGCMusicPlayingViewController alloc]init]; + [self.navigationController pushViewController:musicPlay animated:YES]; +} + +#pragma mark - Scroll event + +- (void)dispatchScrollViewDidEndDecelerating +{ + if ([GJGCMusicSharePlayer sharePlayer].musicMsgId.length > 0) { + + NSInteger playingIndex = [self.dataSourceManager getContentModelIndexByLocalMsgId:self.playingAudioMsgId]; + + NSIndexPath *playingIndexPath = [NSIndexPath indexPathForRow:playingIndex inSection:0]; + + NSArray *visiableCellIndexs = [self.chatListTable indexPathsForVisibleRows]; + + if ([visiableCellIndexs containsObject:playingIndexPath]) { + [UIView animateWithDuration:0.26 animations:^{ + self.musicBar.alpha = 0; + }]; + }else{ + [UIView animateWithDuration:0.26 animations:^{ + self.musicBar.alpha = 1; + }]; + } + }else{ + [UIView animateWithDuration:0.26 animations:^{ + self.musicBar.alpha = 0; + }]; + } +} + @end diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.h b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.h index 0a7da12..0ff78e6 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.h +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.h @@ -60,6 +60,7 @@ extern const NSString *kGJGCMessageExtendExchangeGifPackageVersion; extern const NSString *kGJGCMessageExtendMusicUrl; extern const NSString *kGJGCMessageExtendMusicSongAuthor; extern const NSString *kGJGCMessageExtendMusicSongId; +extern const NSString *kGJGCMessageExtendMusicSongImageUrl; diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.m b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.m index 069945f..a3c2bff 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendConst.m @@ -59,6 +59,8 @@ const NSString *kGJGCMessageExtendMusicUrl = @"music_url"; const NSString *kGJGCMessageExtendMusicSongAuthor = @"song_author"; const NSString *kGJGCMessageExtendMusicSongId = @"song_id"; +const NSString *kGJGCMessageExtendMusicSongImageUrl = @"song_img_url"; + @implementation GJGCMessageExtendConst diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.h b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.h index 1458a06..a374597 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.h +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.h @@ -24,4 +24,6 @@ @property (nonatomic,strong)NSString *songUrl; +@property (nonatomic,strong)NSString *songImgUrl; + @end diff --git a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.m b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.m index 92cb19d..3313cae 100644 --- a/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.m +++ b/ZYChat-EaseMob/ZYChat/ChatDetail/ViewController/MessageExtend/GJGCMessageExtendMusicShareModel.m @@ -26,6 +26,8 @@ + (JSONKeyMapper *)keyMapper kGJGCMessageExtendMusicSongId : @"songId", + kGJGCMessageExtendMusicSongImageUrl :@"songImgUrl", + }]; } diff --git a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsBaseCell.m b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsBaseCell.m index dd2d96f..8810c4d 100644 --- a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsBaseCell.m +++ b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsBaseCell.m @@ -19,6 +19,8 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor clearColor]; + self.bottomLine = [[UIImageView alloc]init]; self.bottomLine.gjcf_height = 0.5f; self.bottomLine.backgroundColor = [GJGCCommonFontColorStyle mainSeprateLineColor]; diff --git a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsHeaderView.m b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsHeaderView.m index f9e583a..8b4e2be 100644 --- a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsHeaderView.m +++ b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsHeaderView.m @@ -23,16 +23,18 @@ - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { + self.backgroundColor = [UIColor colorWithRed:97/255.f green:60/255.f blue:140/255.f alpha:0.8]; + //头视图 按钮 UIButton *headerBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.headerBtn = headerBtn; - [self.headerBtn setTitleColor:[UIColor blackColor] forState:0]; + [self.headerBtn setTitleColor:[UIColor whiteColor] forState:0]; [self.headerBtn setImage:[UIImage imageNamed:@"buddy_header_arrow"] forState:0]; self.headerBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; self.headerBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0); self.headerBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0); - [self.headerBtn setBackgroundImage:[UIImage imageNamed:@"buddy_header_bg"] forState:0]; - [self.headerBtn setBackgroundImage:[UIImage imageNamed:@"buddy_header_bg_highlighted"] forState:1]; +// [self.headerBtn setBackgroundImage:[UIImage imageNamed:@"buddy_header_bg"] forState:0]; +// [self.headerBtn setBackgroundImage:[UIImage imageNamed:@"buddy_header_bg_highlighted"] forState:1]; self.headerBtn.imageView.contentMode = UIViewContentModeCenter; self.headerBtn.imageView.clipsToBounds = NO; [self.headerBtn addTarget:self action:@selector(headerBtnClick:) forControlEvents:UIControlEventTouchUpInside]; @@ -42,7 +44,7 @@ - (instancetype)initWithFrame:(CGRect)frame self.countOnline = countOnline; self.countOnline.textAlignment = NSTextAlignmentRight; self.countOnline.font = [UIFont systemFontOfSize:14.0]; - self.countOnline.textColor = [UIColor grayColor]; + self.countOnline.textColor = [UIColor whiteColor]; [self addSubview:countOnline]; } diff --git a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsUserCell.m b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsUserCell.m index 5402cb4..6983ad0 100644 --- a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsUserCell.m +++ b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsUserCell.m @@ -30,14 +30,14 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr self.nameLabel = [[UILabel alloc]init]; self.nameLabel.frame = CGRectMake(50, 7, 100, 25); - self.nameLabel.textColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColor]; + self.nameLabel.textColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColorWhite]; self.nameLabel.font = [GJGCCommonFontColorStyle listTitleAndDetailTextFont]; [self.contentView addSubview:self.nameLabel]; self.descpLabel = [[UILabel alloc]init]; self.descpLabel.frame = CGRectMake(50, 7, 100, 25); self.descpLabel.font = [GJGCCommonFontColorStyle baseAndTitleAssociateTextFont]; - self.descpLabel.textColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColor]; + self.descpLabel.textColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColorWhite]; [self.contentView addSubview:self.descpLabel]; } @@ -57,6 +57,7 @@ - (void)setContentModel:(GJGCContactsContentModel *)contentModel self.descpLabel.frame = self.nameLabel.frame; self.descpLabel.gjcf_top = self.nameLabel.gjcf_bottom + 4.f; self.descpLabel.text = contentModel.summary; + self.bottomLine.gjcf_left = self.descpLabel.gjcf_left; } - (void)downloadImageWithConententModel:(GJGCContactsContentModel *)contentModel diff --git a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsViewController.m b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsViewController.m index f744003..75d1587 100644 --- a/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsViewController.m +++ b/ZYChat-EaseMob/ZYChat/Contacts/GJGCContactsViewController.m @@ -28,7 +28,7 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - self.title = @"我的联系人"; + [self setStrNavTitle:@"联系人"]; self.dataManager = [[GJGCContactsDataManager alloc]init]; self.dataManager.delegate = self; @@ -40,6 +40,7 @@ - (void)viewDidLoad { self.tableView.gjcf_width = GJCFSystemScreenWidth; self.tableView.gjcf_height = GJCFSystemScreenHeight - 64.f - 49; [self.view addSubview:self.tableView]; + [self.tableView setResourceType:ZYResourceTypeHome]; [self.dataManager requireContactsList]; diff --git a/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Model/GJCFAudioModel.h b/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Model/GJCFAudioModel.h index 4c550b8..f75f6f5 100644 --- a/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Model/GJCFAudioModel.h +++ b/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Model/GJCFAudioModel.h @@ -89,6 +89,9 @@ /* 指定不从链接中生成缓存文件名,按照这个指定的文件名来缓存 */ @property (nonatomic,strong)NSString *specialCacheFileName; +//音频相关的图片路径 +@property (nonatomic,strong)NSString *imgUrl; + /* 删除临时编码文件 */ - (void)deleteTempEncodeFile; diff --git a/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.h b/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.h index cbe9867..dd7a587 100644 --- a/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.h +++ b/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.h @@ -17,10 +17,14 @@ @property (nonatomic,weak)id delegate; +@property (nonatomic,assign)CGFloat progress; + - (GJCFAudioModel *)getCurrentPlayingAudioFile; - (void)playAudioFile:(GJCFAudioModel *)audioFile; +- (void)playAudioFile:(GJCFAudioModel *)audioFile startTime:(NSTimeInterval)sTime; + - (void)playAtDuration:(NSTimeInterval)duration; - (void)play; @@ -29,6 +33,8 @@ - (void)pause; +- (NSTimeInterval)playProgressTime; + - (NSTimeInterval)getLocalWavFileDuration:(NSString *)audioPath; - (NSInteger)currentPlayAudioFileDuration; diff --git a/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.m b/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.m index bee26ab..ea38977 100644 --- a/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.m +++ b/ZYChat-EaseMob/ZYChat/Dependcy/GJCFAudioManager/Play/GJCFAudioPlayer.m @@ -32,6 +32,11 @@ - (void)dealloc } - (void)createPlayer +{ + [self createPlayerAtStartTime:0]; +} + +- (void)createPlayerAtStartTime:(NSTimeInterval)time { /* 阻止重复快速重复播放 */ if (self.audioPlayer.isPlaying) { @@ -89,6 +94,7 @@ - (void)createPlayer AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil]; + BOOL isPrepare = [self.audioPlayer prepareToPlay]; if (!isPrepare) { @@ -99,7 +105,11 @@ - (void)createPlayer return; } - _isPlaying = [self.audioPlayer play]; + if (time > 0) { + _isPlaying = [self.audioPlayer playAtTime:time]; + }else{ + _isPlaying = [self.audioPlayer play]; + } /* 获取当前播放文件得时间总长度 */ self.currentPlayAudioDuration = [self getLocalWavFileDuration:self.currentPlayAudioFile.localStorePath]; @@ -139,6 +149,26 @@ - (void)playAudioFile:(GJCFAudioModel *)audioFile [self createPlayer]; } +- (void)playAudioFile:(GJCFAudioModel *)audioFile startTime:(NSTimeInterval)sTime +{ + /* 阻止重复快速重复播放 */ + if (self.audioPlayer.isPlaying) { + NSError *faildError = [NSError errorWithDomain:@"gjcf.AudioManager.com" code:-235 userInfo:@{@"msg": @"GJCFAuidoPlayer正在播放失败"}]; + if (self.delegate && [self.delegate respondsToSelector:@selector(audioPlayer:didOccusError:)]) { + [self.delegate audioPlayer:self didOccusError:faildError]; + } + return; + } + + if (self.currentPlayAudioFile) { + self.currentPlayAudioFile = nil; + } + + self.currentPlayAudioFile = audioFile; + + [self createPlayerAtStartTime:sTime]; +} + - (void)playAtDuration:(NSTimeInterval)duration { if (!self.audioPlayer) { @@ -232,15 +262,20 @@ - (void)pause _isPlaying = NO; } +- (NSTimeInterval)playProgressTime +{ + return self.audioPlayer.currentTime; +} + #pragma mark - 更新播放进度 - (void)updatePlayingProgress:(NSTimer *)timer { - CGFloat progress = self.audioPlayer.currentTime/self.audioPlayer.duration; + self.progress = self.audioPlayer.currentTime/self.audioPlayer.duration; /* 播放进度百分比 */ if (self.delegate && [self.delegate respondsToSelector:@selector(audioPlayer:playingProgress:)]) { - [self.delegate audioPlayer:self playingProgress:progress]; + [self.delegate audioPlayer:self playingProgress:self.progress]; } /* 播放进度 */ @@ -252,7 +287,7 @@ - (void)updatePlayingProgress:(NSTimer *)timer [self updateSoundMouter:timer]; /* 0.9进度就应该停止了,因为1.0在完成方法更新 */ - if (progress >= 0.9f || !self.audioPlayer.isPlaying) { + if (self.progress >= 0.9f || !self.audioPlayer.isPlaying) { [timer invalidate]; } diff --git a/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.h b/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.h index 26410f9..138f500 100755 --- a/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.h +++ b/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.h @@ -12,5 +12,6 @@ // 是否支持右滑返回 @property (nonatomic, assign) BOOL canDragBack; +@property (nonatomic, assign) ZYResourceType type; @end diff --git a/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.m b/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.m index ed5cb5f..8771805 100755 --- a/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.m +++ b/ZYChat-EaseMob/ZYChat/Dependcy/ZYNavigationController/ZYNavigationController.m @@ -46,6 +46,27 @@ - (void)viewDidLoad { } +#pragma mark - theme + +- (void)setType:(ZYResourceType)type +{ + NSString *imgName = nil; + switch (type) { + case ZYResourceTypeRecent: + imgName = kThemeRecentNavBar; + break; + case ZYResourceTypeSquare: + imgName = kThemeSquareNavBar; + break; + case ZYResourceTypeHome: + imgName = kThemeHomeNavBar; + break; + default: + break; + } + [self.navigationBar setBackgroundImage:ZYThemeImage(imgName) forBarMetrics:UIBarMetricsDefault]; +} + - (NSMutableArray *)screenShotList { if (!_screenShotList) { diff --git a/ZYChat-EaseMob/ZYChat/Info.plist b/ZYChat-EaseMob/ZYChat/Info.plist index 34e65b5..64ae56a 100644 --- a/ZYChat-EaseMob/ZYChat/Info.plist +++ b/ZYChat-EaseMob/ZYChat/Info.plist @@ -41,5 +41,7 @@ UIInterfaceOrientationPortrait + UIViewControllerBasedStatusBarAppearance + diff --git a/ZYChat-EaseMob/ZYChat/Login/HALoginViewController.m b/ZYChat-EaseMob/ZYChat/Login/HALoginViewController.m index 46d6630..76c2aac 100644 --- a/ZYChat-EaseMob/ZYChat/Login/HALoginViewController.m +++ b/ZYChat-EaseMob/ZYChat/Login/HALoginViewController.m @@ -41,7 +41,12 @@ @implementation HALoginViewController - (void)viewDidLoad { [super viewDidLoad]; - self.view.backgroundColor = [GJGCCommonFontColorStyle mainBackgroundColor]; + UIImageView *backView = [[UIImageView alloc]initWithFrame:self.view.bounds]; + backView.image = [UIImage imageWithContentsOfFile:GJCFMainBundlePath(@"default.jpg")]; + [self.view addSubview:backView]; + UIImageView *maskView = [[UIImageView alloc]initWithFrame:backView.bounds]; + maskView.backgroundColor = [UIColor colorWithRed:97/255.f green:60/255.f blue:140/255.f alpha:0.6]; + [backView addSubview:maskView]; UIImageView* imgLogin = [[UIImageView alloc] initWithFrame:CGRectMake(mainSize.width / 2 - 211*0.6 / 2, 34, 211*0.6, 109*0.6)]; imgLogin.image = [UIImage imageNamed:@"owl-login"]; @@ -150,7 +155,7 @@ - (void)viewWillAppear:(BOOL)animated if (GJCFSystemiPhone4) { [self.navigationController.navigationBar setHidden:YES]; }else{ - [self setStrNavTitle:@"iOS码农聊天室"]; + [self setStrNavTitle:@"王者荣耀-约战"]; } } diff --git a/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.h b/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.h index f8c7722..ac38587 100644 --- a/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.h +++ b/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.h @@ -40,6 +40,10 @@ @property (nonatomic,weak)id delegate; +@property (nonatomic,strong)UIImageView *backgroundView; + +@property (nonatomic,assign)ZYResourceType type; + - (instancetype)initWithFrame:(CGRect)frame withDataSource:(id)aDelegate; @end diff --git a/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.m b/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.m index 18eb956..7fc7c25 100644 --- a/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.m +++ b/ZYChat-EaseMob/ZYChat/MainTab/BTCustomTabBar.m @@ -16,7 +16,6 @@ @interface BTCustomTabBar () @property (nonatomic,strong)UILabel *redTipLabel; - @end @implementation BTCustomTabBar @@ -39,6 +38,11 @@ - (instancetype)initWithFrame:(CGRect)frame withDataSource:(id @@ -41,6 +42,8 @@ @interface GJGCMusicPlayViewController () @property (nonatomic,strong)NSString *currentSongAuthor; +@property (nonatomic,strong)NSString *currentSongImgUrl; + @property (nonatomic,strong)UIActivityIndicatorView *downloadIndicator; @property (nonatomic,strong)UIButton *forwardButton; @@ -62,7 +65,7 @@ - (instancetype)initWithSongId:(NSString *)songId - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - + self.view.backgroundColor = [GJGCCommonFontColorStyle mainBackgroundColor]; if (!self.songList) { @@ -172,10 +175,6 @@ - (void)viewWillDisappear:(BOOL)animated - (void)forwardAction { - if (self.songList.count == 0) { - return; - } - GJGCRecentChatForwardContentModel *forwardContentModel = [[GJGCRecentChatForwardContentModel alloc]init]; forwardContentModel.title = self.nameLabel.text; if (GJCFStringIsNull(self.currentSongAuthor)) { @@ -184,6 +183,7 @@ - (void)forwardAction forwardContentModel.sumary = self.currentSongAuthor; forwardContentModel.webUrl = self.currentSongMp3Url; forwardContentModel.songId = self.songList[self.currentIndex]; + forwardContentModel.imageUrl = self.currentSongImgUrl; forwardContentModel.contentType = GJGCChatFriendContentTypeMusicShare; GJGCRecentContactListViewController *recentList = [[GJGCRecentContactListViewController alloc]initWithForwardContent:forwardContentModel]; @@ -272,6 +272,7 @@ - (void)setupSearchTitleView self.searchBar.gjcf_height = 36.f; self.searchBar.placeholder = @"搜索歌曲"; self.searchBar.delegate = self; + self.searchBar.tintColor = [UIColor whiteColor]; self.searchBar.searchBarStyle = UISearchBarIconResultsList; self.navigationItem.titleView = self.searchBar; @@ -404,6 +405,7 @@ - (void)setupPlayInfo:(NSDictionary *)songInfo NSDictionary *songDict = [songInfo[@"songs"] firstObject][@"album"]; self.currentSongMp3Url = [songInfo[@"songs"] firstObject][@"mp3Url"]; self.currentSongAuthor = [songDict[@"artists"]firstObject][@"name"]; + self.currentSongImgUrl = songDict[@"blurPicUrl"]; if (GJCFStringIsNull(self.currentSongMp3Url)) { BTToast(@"没有音乐播放地址"); [self.downloadIndicator stopAnimating]; @@ -418,6 +420,9 @@ - (void)setupPlayInfo:(NSDictionary *)songInfo self.nameLabel.gjcf_centerX = self.albumImageView.gjcf_centerX; self.nameLabel.gjcf_bottom = self.albumImageView.gjcf_top - 6.f; + if ([GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying) { + [[GJGCMusicSharePlayer sharePlayer].audioPlayer stop]; + } //播放音乐 [[GJCFAudioManager shareManager] playRemoteMusicByUrl:self.currentSongMp3Url withCacheFileName:songId]; diff --git a/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayerBar.h b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayerBar.h new file mode 100644 index 0000000..68535ea --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayerBar.h @@ -0,0 +1,27 @@ +// +// GJGCMusicPlayerBar.h +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import +#import "GJCFAudioPlayer.h" +#import "GJGCMusicSharePlayer.h" + +@protocol GJGCMusicPlayerBarDelegate + +- (void)didTappedMusicPlayerBar; + +@end + +@interface GJGCMusicPlayerBar : UIView + +@property (nonatomic,weak)id delegate; + ++ (GJGCMusicPlayerBar *)currentMusicBar; + +- (void)startMove; + +@end diff --git a/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayerBar.m b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayerBar.m new file mode 100644 index 0000000..fb9dbf5 --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayerBar.m @@ -0,0 +1,125 @@ +// +// GJGCMusicPlayerBar.m +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import "GJGCMusicPlayerBar.h" + +@interface GJGCMusicPlayerBar () + +@property (nonatomic,strong)UIButton *playButton; + +@property (nonatomic,strong)UILabel *titleLabel; + +@end + +@implementation GJGCMusicPlayerBar + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + + self.backgroundColor = [UIColor colorWithRed:97/255.f green:60/255.f blue:140/255.f alpha:0.8]; + + self.gjcf_height = 54.f; + self.playButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.playButton.gjcf_size = (CGSize){36,36}; + [self.playButton setBackgroundImage:[UIImage imageNamed:@"player_btn_play_normal"] forState:UIControlStateNormal]; + [self.playButton setBackgroundImage:[UIImage imageNamed:@"player_btn_pause_normal"] forState:UIControlStateSelected]; + [self addSubview:self.playButton]; + [self.playButton addTarget:self action:@selector(stopAction) forControlEvents: + UIControlEventTouchUpInside]; + self.playButton.selected = YES; + self.playButton.gjcf_left = 18.f; + self.playButton.gjcf_centerY = self.gjcf_height/2; + + self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.playButton.gjcf_right + 13.f, 4,GJCFSystemScreenWidth - 36- 2*13, 44)]; + NSString *songName = [GJGCMusicSharePlayer sharePlayer].musicSongName; + self.titleLabel.textColor = GJCFQuickHexColor(@"31c27c"); + self.titleLabel.font = [UIFont systemFontOfSize:17.f]; + self.titleLabel.text = songName; + [self.titleLabel sizeToFit]; + self.titleLabel.gjcf_centerY = self.gjcf_height/2; + self.titleLabel.gjcf_left = self.playButton.gjcf_right + 23.f; + [self addSubview:self.titleLabel]; + + UIImageView *bottomLine = [[UIImageView alloc]init]; + bottomLine.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.3]; + bottomLine.gjcf_height = 0.5f; + bottomLine.gjcf_width = GJCFSystemScreenWidth; + bottomLine.gjcf_bottom = self.gjcf_height; + [self addSubview:bottomLine]; + + [self startMove]; + + [[GJGCMusicSharePlayer sharePlayer]addPlayObserver:self]; + + UITapGestureRecognizer *tapR = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapOnSelf)]; + [self addGestureRecognizer:tapR]; + } + return self; +} + +- (void)startMove +{ + CAKeyframeAnimation *pAnimation = [CAKeyframeAnimation animation]; + pAnimation.keyPath = @"transform.translation.x"; + [pAnimation setValues:@[[NSNumber numberWithFloat:0.f],[NSNumber numberWithFloat:GJCFSystemScreenWidth-self.titleLabel.gjcf_left]]]; + pAnimation.duration = 20.f; + [pAnimation setRepeatCount:NSIntegerMax]; + [self.titleLabel.layer addAnimation:pAnimation forKey:@"moveX"]; + +} + +- (void)tapOnSelf +{ + if (self.delegate && [self.delegate respondsToSelector:@selector(didTappedMusicPlayerBar)]) { + [self.delegate didTappedMusicPlayerBar]; + } +} + +- (void)dealloc +{ + [[GJGCMusicSharePlayer sharePlayer] removePlayObserver:self]; +} + +- (void)stopAction +{ + self.playButton.selected = !self.playButton.isSelected; + if ([GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying) { + [self.titleLabel.layer removeAnimationForKey:@"moveX"]; + [[GJGCMusicSharePlayer sharePlayer].audioPlayer stop]; + }else{ + [self startMove]; + [[GJGCMusicSharePlayer sharePlayer].audioPlayer play]; + } +} + +#pragma mark - GJCFAudioPlayer Delegate +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didFinishPlayAudio:(GJCFAudioModel *)audioFile +{ + self.playButton.selected = !self.playButton.isSelected; + [self.titleLabel.layer removeAnimationForKey:@"moveX"]; +} + +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didOccusError:(NSError *)error +{ + self.playButton.selected = !self.playButton.isSelected; + [self.titleLabel.layer removeAnimationForKey:@"moveX"]; +} +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didUpdateSoundMouter:(CGFloat)soundMouter +{ + +} + ++ (GJGCMusicPlayerBar *)currentMusicBar +{ + GJGCMusicPlayerBar *bar = [[GJGCMusicPlayerBar alloc]initWithFrame:CGRectMake(0, 0, GJCFSystemScreenWidth, 44)]; + return bar; +} + + +@end diff --git a/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayingViewController.h b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayingViewController.h new file mode 100644 index 0000000..620f5d9 --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayingViewController.h @@ -0,0 +1,16 @@ +// +// GJGCMusicPlayerViewController.h +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import "GJGCBaseViewController.h" +#import "GJGCChatFriendContentModel.h" + +@interface GJGCMusicPlayingViewController : GJGCBaseViewController + +- (instancetype)initWithMusicContent:(GJGCChatFriendContentModel*)contentModel; + +@end diff --git a/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayingViewController.m b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayingViewController.m new file mode 100644 index 0000000..8e5f274 --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicPlayingViewController.m @@ -0,0 +1,272 @@ +// +// GJGCMusicPlayerViewController.m +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import "GJGCMusicPlayingViewController.h" +#import "GJGCMusicSearchResultListViewController.h" +#import "ZYDataCenter.h" +#import "UIImage+BlurredFrame.h" +#import "UIImage+ImageEffects.h" +#import "GJGCRecentContactListViewController.h" +#import "GJGCMusicSharePlayer.h" + +@interface GJGCMusicPlayingViewController () + +@property (nonatomic,strong)UIImageView *backImageview; + +@property (nonatomic,strong)UIImageView *albumImageView; + +@property (nonatomic,strong)UIButton *playButton; + +@property (nonatomic,strong)UIButton *preButton; + +@property (nonatomic,strong)UIButton *nextButton; + +@property (nonatomic,strong)UILabel *nameLabel; + +@property (nonatomic,strong)UILabel *durationLabel; + +@property (nonatomic,strong)NSMutableArray *songList; + +@property (nonatomic,assign)NSInteger currentIndex; + +@property (nonatomic,strong)UISlider *slider; + +@property (nonatomic,strong)NSString *currentSongMp3Url; + +@property (nonatomic,strong)NSString *currentSongAuthor; + +@property (nonatomic,strong)NSString *currentSongImgUrl; + +@property (nonatomic,strong)NSString *currentSongId; + +@property (nonatomic,strong)UIActivityIndicatorView *downloadIndicator; + +@property (nonatomic,strong)UIButton *forwardButton; + +@end + +@implementation GJGCMusicPlayingViewController + +- (instancetype)initWithMusicContent:(GJGCChatFriendContentModel*)contentModel +{ + if (self = [super init]) { + + self.currentSongAuthor = contentModel.musicSongAuthor; + self.currentSongMp3Url = contentModel.musicSongUrl; + self.currentSongImgUrl = contentModel.musicSongImgUrl; + self.currentSongId = contentModel.musicSongId; + + [self.albumImageView sd_setImageWithURL:[NSURL URLWithString:self.currentSongImgUrl]]; + GJCFWeakSelf weakSelf = self; + [self.backImageview sd_setImageWithURL:[NSURL URLWithString:self.currentSongImgUrl]placeholderImage:[UIImage imageNamed:@"poster_bg.jpg"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { + + [weakSelf setupBlurryImage:image]; + + }]; + + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + + [self setStrNavTitle:@"正在播放"]; + + self.view.backgroundColor = [GJGCCommonFontColorStyle mainBackgroundColor]; + + self.backImageview = [[UIImageView alloc]init]; + self.backImageview.gjcf_width = GJCFSystemScreenWidth; + self.backImageview.gjcf_height = GJCFSystemScreenHeight - self.contentOriginY; + self.backImageview.contentMode = UIViewContentModeScaleAspectFill; + UIImage *bgImage = [UIImage imageNamed:@"poster_bg.jpg"]; + self.backImageview.image = [bgImage applyTintEffectWithColor:[UIColor colorWithWhite:0.1 alpha:0.5] atFrame:CGRectMake(0, 0,bgImage.size.width,bgImage.size.height)]; + [self.view addSubview:self.backImageview]; + + self.nameLabel = [[UILabel alloc]init]; + self.nameLabel.font = [UIFont boldSystemFontOfSize:20.f]; + self.nameLabel.textAlignment = NSTextAlignmentCenter; + self.nameLabel.textColor = [UIColor whiteColor]; + [self.view addSubview:self.nameLabel]; + self.nameLabel.text = @"没有可播放歌曲"; + [self.nameLabel sizeToFit]; + + self.albumImageView = [[UIImageView alloc]init]; + self.albumImageView.gjcf_size = CGSizeMake(GJCFSystemScreenWidth - 2*70, GJCFSystemScreenWidth - 2*70); + [self.view addSubview:self.albumImageView]; + self.albumImageView.contentMode = UIViewContentModeScaleAspectFit; + self.albumImageView.gjcf_centerY = (GJCFSystemScreenHeight - self.contentOriginY)/2 - 50; + self.albumImageView.gjcf_centerX = GJCFSystemScreenWidth/2; + self.albumImageView.image = [UIImage imageNamed:@"poster_bg_small.jpg"]; + self.albumImageView.layer.cornerRadius = 6.f; + self.albumImageView.layer.masksToBounds = YES; + self.nameLabel.gjcf_centerX = self.albumImageView.gjcf_centerX; + self.nameLabel.gjcf_bottom = self.albumImageView.gjcf_top - 20.f; + + self.slider = [[UISlider alloc]init]; + self.slider.gjcf_width = self.albumImageView.gjcf_width; + self.slider.gjcf_height = 1.5f; + [self.slider setThumbImage:[UIImage imageNamed:@"player_slider_playback_thumb"] forState:UIControlStateNormal]; + self.slider.tintColor = GJCFQuickHexColor(@"31c27c"); + [self.view addSubview:self.slider]; + [self.slider setMinimumValue:0.f]; + [self.slider setMaximumValue:1.f]; + [self.slider addTarget:self action:@selector(slideValueChanged:) forControlEvents:UIControlEventValueChanged]; + self.slider.gjcf_top = self.albumImageView.gjcf_bottom + 20.f; + self.slider.gjcf_centerX = self.albumImageView.gjcf_centerX; + + self.playButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.playButton.gjcf_size = (CGSize){45,45}; + [self.playButton setBackgroundImage:[UIImage imageNamed:@"player_btn_play_normal"] forState:UIControlStateNormal]; + [self.playButton setBackgroundImage:[UIImage imageNamed:@"player_btn_pause_normal"] forState:UIControlStateSelected]; + [self.view addSubview:self.playButton]; + [self.playButton addTarget:self action:@selector(playAction) forControlEvents:UIControlEventTouchUpInside]; + self.playButton.gjcf_top = self.slider.gjcf_bottom + 20.f; + self.playButton.gjcf_centerX = GJCFSystemScreenWidth/2; + + self.downloadIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + self.downloadIndicator.gjcf_size = CGSizeMake(30, 30); + [self.playButton addSubview:self.downloadIndicator]; + self.downloadIndicator.hidden = YES; + self.downloadIndicator.gjcf_centerX = self.playButton.gjcf_width/2; + self.downloadIndicator.gjcf_centerY = self.playButton.gjcf_height/2; + + self.preButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.preButton.gjcf_size = (CGSize){45,45}; + [self.preButton setBackgroundImage:[UIImage imageNamed:@"player_btn_pre_normal"] forState:UIControlStateNormal]; + [self.preButton setBackgroundImage:[UIImage imageNamed:@"player_btn_pre_highlight"] forState:UIControlStateHighlighted]; + [self.view addSubview:self.preButton]; + self.preButton.gjcf_centerY = self.playButton.gjcf_centerY; + self.preButton.gjcf_right = self.playButton.gjcf_left - 30.f; + self.preButton.hidden = YES; + + self.nextButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.nextButton.gjcf_size = (CGSize){45,45}; + [self.nextButton setBackgroundImage:[UIImage imageNamed:@"player_btn_next_normal"] forState:UIControlStateNormal]; + [self.nextButton setBackgroundImage:[UIImage imageNamed:@"player_btn_next_normal"] forState:UIControlStateSelected]; + [self.view addSubview:self.nextButton]; + self.nextButton.gjcf_centerY = self.playButton.gjcf_centerY; + self.nextButton.gjcf_left= self.playButton.gjcf_right + 30.f; + self.nextButton.hidden = YES; + + self.forwardButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.forwardButton.gjcf_width = 40.f; + self.forwardButton.gjcf_height = 20.f; + [self.forwardButton setTitleColor:GJCFQuickHexColor(@"31c27c") forState:UIControlStateNormal]; + [self.forwardButton setTitle:@"转发" forState:UIControlStateNormal]; + self.forwardButton.gjcf_right = GJCFSystemScreenWidth - 40.f; + self.forwardButton.gjcf_top = 30.f; + [self.forwardButton addTarget:self action:@selector(forwardAction) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:self.forwardButton]; + + self.nameLabel.text = [GJGCMusicSharePlayer sharePlayer].musicSongName; + + [[GJGCMusicSharePlayer sharePlayer] addPlayObserver:self]; +} + +- (void)dealloc +{ +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + [[GJGCMusicSharePlayer sharePlayer] removePlayObserver:self]; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + [[GJGCMusicSharePlayer sharePlayer] addPlayObserver:self]; + [self setupForPlayingMusic]; +} + +- (void)forwardAction +{ + GJGCRecentChatForwardContentModel *forwardContentModel = [[GJGCRecentChatForwardContentModel alloc]init]; + forwardContentModel.title = self.nameLabel.text; + if (GJCFStringIsNull(self.currentSongAuthor)) { + self.currentSongAuthor = @"佚名"; + } + forwardContentModel.sumary = self.currentSongAuthor; + forwardContentModel.webUrl = self.currentSongMp3Url; + forwardContentModel.songId = self.currentSongId; + forwardContentModel.contentType = GJGCChatFriendContentTypeMusicShare; + forwardContentModel.imageUrl = self.currentSongImgUrl; + + GJGCRecentContactListViewController *recentList = [[GJGCRecentContactListViewController alloc]initWithForwardContent:forwardContentModel]; + + UINavigationController *recentNav = [[UINavigationController alloc]initWithRootViewController:recentList]; + + UIImage *navigationBarBack = GJCFQuickImageByColorWithSize([GJGCCommonFontColorStyle mainThemeColor], CGSizeMake(GJCFSystemScreenWidth * GJCFScreenScale, 64.f * GJCFScreenScale)); + [recentNav.navigationBar setBackgroundImage:navigationBarBack forBarMetrics:UIBarMetricsDefault]; + + [self.navigationController presentViewController:recentNav animated:YES completion:nil]; +} + +- (void)playAction +{ + if (GJCFStringIsNull(self.currentSongMp3Url)) { + BTToast(@"没有音乐播放地址"); + return; + } + + self.playButton.selected = !self.playButton.isSelected; + + if (self.playButton.isSelected) { + [[GJGCMusicSharePlayer sharePlayer].audioPlayer stop]; + }else{ + [[GJGCMusicSharePlayer sharePlayer].audioPlayer play]; + } +} + +- (void)setupForPlayingMusic +{ + if ([GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying) { + self.slider.value = [GJGCMusicSharePlayer sharePlayer].audioPlayer.progress; + self.currentSongAuthor = [GJGCMusicSharePlayer sharePlayer].musicSongAuthor; + self.currentSongMp3Url = [GJGCMusicSharePlayer sharePlayer].musicSongUrl; + self.currentSongImgUrl = [GJGCMusicSharePlayer sharePlayer].musicSongImgUrl; + + [self.albumImageView sd_setImageWithURL:[NSURL URLWithString:self.currentSongImgUrl]]; + GJCFWeakSelf weakSelf = self; + [self.backImageview sd_setImageWithURL:[NSURL URLWithString:self.currentSongImgUrl]placeholderImage:[UIImage imageNamed:@"poster_bg.jpg"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { + + [weakSelf setupBlurryImage:image]; + + }]; + self.playButton.selected = [GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying; + } +} + +- (void)setupBlurryImage:(UIImage *)theImage +{ + CGRect frame = CGRectMake(0, 0, theImage.size.width, theImage.size.height); + UIImage *blurryImage = [theImage applyTintEffectWithColor:[UIColor colorWithWhite:0.1 alpha:0.5] atFrame:frame]; + + self.backImageview.image = blurryImage; +} +#pragma mark - GJCFAudioPlayer Delegate +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didFinishPlayAudio:(GJCFAudioModel *)audioFile +{ + +} + +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didOccusError:(NSError *)error +{ + +} + +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didUpdateSoundMouter:(CGFloat)soundMouter +{ + self.slider.value = audioPlay.progress; +} + + +@end diff --git a/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicSharePlayer.h b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicSharePlayer.h new file mode 100644 index 0000000..ea54f10 --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicSharePlayer.h @@ -0,0 +1,46 @@ +// +// GJGCMusicSharePlayer.h +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import +#import "GJCFAudioPlayer.h" + +@interface GJGCMusicSharePlayer : NSObject + +@property (nonatomic,strong)GJCFAudioPlayer *audioPlayer; + +@property (nonatomic,strong)NSMutableArray *observers; + +#pragma mark - 扩展音乐分享消息 + +@property (nonatomic,copy)NSString *musicSongName; + +@property (nonatomic,copy)NSString *musicSongAuthor; + +@property (nonatomic,copy)NSString *musicSongUrl; + +@property (nonatomic,copy)NSString *musicSongId; + +@property (nonatomic,copy)NSString *musicSongImgUrl; + +@property (nonatomic,copy)NSString *musicMsgId; + +@property (nonatomic,copy)NSString *musicChatId; + +@property (nonatomic,assign)BOOL isPlayingMusic; + ++ (GJGCMusicSharePlayer *)sharePlayer; + +- (void)shouldStopPlay; + +- (void)addPlayObserver:(id)observer; + +- (void)removePlayObserver:(id)observer; + +- (void)signOut; + +@end diff --git a/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicSharePlayer.m b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicSharePlayer.m new file mode 100644 index 0000000..c32000f --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/MusicShare/GJGCMusicSharePlayer.m @@ -0,0 +1,115 @@ +// +// GJGCMusicSharePlayer.m +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import "GJGCMusicSharePlayer.h" +#import "GJCFAudioPlayer.h" + +@interface GJGCMusicSharePlayer () + + +@end + +@implementation GJGCMusicSharePlayer + ++ (GJGCMusicSharePlayer *)sharePlayer +{ + static GJGCMusicSharePlayer *_sharePlayer = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _sharePlayer = [[self alloc]init]; + }); + return _sharePlayer; +} + +- (instancetype)init +{ + if (self = [super init]) { + + /* 语音播放工具 */ + self.audioPlayer = [[GJCFAudioPlayer alloc]init]; + self.audioPlayer.delegate = self; + + self.observers = [[NSMutableArray alloc]init]; + } + return self; +} + +- (void)shouldStopPlay +{ + if (self.musicMsgId.length == 0) { + [self.audioPlayer stop]; + } +} + +- (void)addPlayObserver:(id)observer +{ + if(![observer conformsToProtocol:@protocol(GJCFAudioPlayerDelegate)]){ + return; + } + [self.observers addObject:observer]; +} + +- (void)removePlayObserver:(id)observer +{ + [self.observers removeObject:observer]; +} + +#pragma mark - GJCFAudioPlayer Delegate +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didFinishPlayAudio:(GJCFAudioModel *)audioFile +{ + self.musicChatId = nil; + self.musicMsgId = nil; + + dispatch_async(dispatch_get_main_queue(), ^{ + + for (id observer in self.observers) { + if ([observer respondsToSelector:@selector(audioPlayer:didFinishPlayAudio:)]) { + [observer audioPlayer:audioPlay didFinishPlayAudio:audioFile]; + } + } + + }); +} + +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didOccusError:(NSError *)error +{ + NSLog(@"play error:%@",error); + self.musicChatId = nil; + self.musicMsgId = nil; + + dispatch_async(dispatch_get_main_queue(), ^{ + + [self.audioPlayer stop]; + + for (id observer in self.observers) { + + if ([observer respondsToSelector:@selector(audioPlayer:didOccusError:)]) { + [observer audioPlayer:audioPlay didOccusError:error]; + } + } + + }); + +} +- (void)audioPlayer:(GJCFAudioPlayer *)audioPlay didUpdateSoundMouter:(CGFloat)soundMouter +{ + for (id observer in self.observers) { + + if ([observer respondsToSelector:@selector(audioPlayer:didOccusError:)]) { + [observer audioPlayer:audioPlay didUpdateSoundMouter:soundMouter]; + } + } +} + +- (void)signOut +{ + [self.audioPlayer stop]; + [self.observers removeAllObjects]; +} + +@end diff --git a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatCell.m b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatCell.m index 4f68291..7439a8b 100644 --- a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatCell.m +++ b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatCell.m @@ -32,6 +32,8 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor clearColor]; + self.headView = [[GJGCCommonHeadView alloc]init]; self.headView.gjcf_size = CGSizeMake(55, 55); self.headView.gjcf_left = 13.f; @@ -76,6 +78,19 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr return self; } +- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated +{ + [super setHighlighted:highlighted animated:animated]; + + UIColor *contentStateColor = nil; + if (highlighted) { + contentStateColor = [UIColor colorWithRed:97/255.f green:60/255.f blue:140/255.f alpha:0.6]; + }else{ + contentStateColor = [UIColor clearColor]; + } + self.contentView.backgroundColor = contentStateColor; +} + - (void)setContentModel:(GJGCRecentChatModel *)contentModel { if (!contentModel) { @@ -109,13 +124,13 @@ - (void)setContentModel:(GJGCRecentChatModel *)contentModel NSDictionary *parseDict = GJCFNSCacheGetValue(contentModel.content); if (!parseDict) { - parseDict = [GJGCChatContentEmojiParser parseContent:contentModel.content]; + parseDict = [GJGCChatContentEmojiParser parseRecentContent:contentModel.content]; } NSAttributedString *attributedString = [parseDict objectForKey:@"contentString"]; self.contentLabel.contentAttributedString = attributedString; self.bottomLine.gjcf_bottom = self.contentLabel.gjcf_bottom + self.headView.gjcf_top; - + self.bottomLine.gjcf_left = self.headView.gjcf_right + self.headView.gjcf_left; NSLog(@"self.bottomLine.bottom:%lf",self.bottomLine.gjcf_bottom); } diff --git a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatDataManager.m b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatDataManager.m index 3bd90ae..de5d907 100644 --- a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatDataManager.m +++ b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatDataManager.m @@ -266,7 +266,7 @@ - (void)updateConversationList:(NSArray *)conversationList NSString *displayContent = [self displayContentFromMessageBody:conversation.latestMessage]; chatModel.content = [NSString stringWithFormat:@"%@:%@",userInfo.nickName,displayContent]; chatModel.time = [GJGCRecentChatStyle formateTime:conversation.latestMessage.timestamp/1000]; - [GJGCChatFriendCellStyle formateSimpleTextMessage:chatModel.content]; + [GJGCRecentChatStyle formateContent:chatModel.content]; chatModel.isGroupChat = YES; chatModel.unReadCount = conversation.unreadMessagesCount; diff --git a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.h b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.h index c5e27d2..75c677c 100644 --- a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.h +++ b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.h @@ -14,6 +14,6 @@ + (NSAttributedString *)formateTime:(long long)time; -+ (NSAttributedString *)formateContent:(NSString *)content; ++ (void)formateContent:(NSString *)content; @end diff --git a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.m b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.m index 1747f92..b0b0760 100644 --- a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.m +++ b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatStyle.m @@ -8,13 +8,14 @@ #import "GJGCRecentChatStyle.h" #import "GJGCChatSystemNotiCellStyle.h" +#import "GJGCChatContentEmojiParser.h" @implementation GJGCRecentChatStyle + (NSAttributedString *)formateName:(NSString *)name { GJCFCoreTextAttributedStringStyle *stringStyle = [[GJCFCoreTextAttributedStringStyle alloc]init]; - stringStyle.foregroundColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColor]; + stringStyle.foregroundColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColorWhite]; stringStyle.font = [UIFont boldSystemFontOfSize:16]; return [[NSAttributedString alloc]initWithString:name attributes:[stringStyle attributedDictionary]]; @@ -75,13 +76,12 @@ + (NSAttributedString*)formateTime:(long long)time return [GJGCChatSystemNotiCellStyle formateTime:string]; } -+ (NSAttributedString *)formateContent:(NSString *)content ++ (void)formateContent:(NSString *)messageText { - GJCFCoreTextAttributedStringStyle *stringStyle = [[GJCFCoreTextAttributedStringStyle alloc]init]; - stringStyle.foregroundColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColor]; - stringStyle.font = [GJGCCommonFontColorStyle baseAndTitleAssociateTextFont]; + if (GJCFStringIsNull(messageText)) { + } - return [[NSAttributedString alloc]initWithString:content attributes:[stringStyle attributedDictionary]]; + [GJGCChatContentEmojiParser parseRecentContent:messageText]; } diff --git a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatViewController.m b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatViewController.m index 2691074..d7c54ce 100644 --- a/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatViewController.m +++ b/ZYChat-EaseMob/ZYChat/RecentChat/GJGCRecentChatViewController.m @@ -14,8 +14,12 @@ #import "GJGCRecentChatTitleView.h" #import "GJGCChatSystemNotiReciever.h" #import "GJGCChatSystemNotiViewController.h" +#import "GJGCMusicPlayerBar.h" +#import "GJGCMusicPlayingViewController.h" -@interface GJGCRecentChatViewController () +#define kMusicPlayingBarTag 99994499 + +@interface GJGCRecentChatViewController () @property (nonatomic,strong)GJGCRecentChatDataManager *dataManager; @@ -31,8 +35,6 @@ @implementation GJGCRecentChatViewController - (void)viewDidLoad { [super viewDidLoad]; - - self.dataManager = [[GJGCRecentChatDataManager alloc]init]; self.dataManager.delegate = self; @@ -46,6 +48,7 @@ - (void)viewDidLoad { self.listTable.dataSource = self; self.listTable.separatorStyle = UITableViewCellSeparatorStyleNone; [self.view addSubview:self.listTable]; + [self.listTable setResourceType:ZYResourceTypeRecent]; [self.dataManager performSelector:@selector(loadRecentConversations) withObject:nil afterDelay:2.0]; } @@ -61,6 +64,42 @@ - (void)viewWillAppear:(BOOL)animated //重新刷新一下会话 [self.dataManager loadRecentConversations]; + + //是不是在播放音乐 + [self setupMusicPlayBar]; +} + +#pragma mark - setupMusicPlayBar + +- (void)setupMusicPlayBar +{ + if ([GJGCMusicSharePlayer sharePlayer].audioPlayer.isPlaying) { + NSLog(@"obsers:%@",[GJGCMusicSharePlayer sharePlayer].observers.debugDescription); + if ([self.listTable viewWithTag:kMusicPlayingBarTag] == nil) { + GJGCMusicPlayerBar *bar = [GJGCMusicPlayerBar currentMusicBar]; + bar.tag = kMusicPlayingBarTag; + bar.delegate = self; + bar.gjcf_top = - 54.f; + [self.listTable addSubview:bar]; + [self.listTable setContentInset:UIEdgeInsetsMake(54, 0, 0, 0)]; + }else{ + GJGCMusicPlayerBar *bar = (GJGCMusicPlayerBar *)[self.listTable viewWithTag:kMusicPlayingBarTag]; + [bar startMove]; + } + [self.listTable setContentOffset:CGPointMake(0,-54)]; + }else{ + [[self.listTable viewWithTag:kMusicPlayingBarTag] removeFromSuperview]; + [self.listTable setContentInset:UIEdgeInsetsMake(0, 0, 0, 0)]; + [self.listTable setContentOffset:CGPointMake(0,0)]; + } + +} + + +- (void)didTappedMusicPlayerBar +{ + GJGCMusicPlayingViewController *musicPlay = [[GJGCMusicPlayingViewController alloc]init]; + [self.navigationController pushViewController:musicPlay animated:YES]; } #pragma mark - tableViewDelegate diff --git a/ZYChat-EaseMob/ZYChat/Service/UserCenter/ZYUserCenter.m b/ZYChat-EaseMob/ZYChat/Service/UserCenter/ZYUserCenter.m index d9f89b9..0a01875 100644 --- a/ZYChat-EaseMob/ZYChat/Service/UserCenter/ZYUserCenter.m +++ b/ZYChat-EaseMob/ZYChat/Service/UserCenter/ZYUserCenter.m @@ -218,7 +218,7 @@ - (void)loginEaseMobWithMobile:(NSString *)mobile password:(NSString *)password self.innerLoginUser = [[ZYUserModel alloc]init]; self.innerLoginUser.name = mobile; NSString *timeString = GJCFStringCurrentTimeStamp; - self.innerLoginUser.nickname = [NSString stringWithFormat:@"至尊宝%@",[timeString substringFromIndex:timeString.length-4]]; + self.innerLoginUser.nickname = [NSString stringWithFormat:@"剑仙李白-%@",[timeString substringFromIndex:timeString.length-4]]; self.innerLoginUser.headThumb = @"http://imgsrc.baidu.com/forum/pic/item/9d82d158ccbf6c81f34d2e53bc3eb13533fa4016.jpg"; self.innerLoginUser.sex = @"0"; } diff --git a/ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/PersonInformation/GJGCMyHomePageViewController.m b/ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/PersonInformation/GJGCMyHomePageViewController.m index c26811a..0b0284e 100644 --- a/ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/PersonInformation/GJGCMyHomePageViewController.m +++ b/ZYChat-EaseMob/ZYChat/Square/GroupCommonUI/PersonInformation/GJGCMyHomePageViewController.m @@ -14,6 +14,7 @@ #import "GJGCMutilTextInputViewController.h" #import "WallPaperViewController.h" #import "AppDelegate.h" +#import "GJGCMusicSharePlayer.h" @interface GJGCMyHomePageViewController () @@ -39,6 +40,8 @@ - (void)rightButtonPressed:(UIButton *)sender AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; [appDelegate logOutAction]; + [[GJGCMusicSharePlayer sharePlayer] signOut]; + } withFaild:^(NSError *error) { BTToastError(error); diff --git a/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoBaseListBaseCell.m b/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoBaseListBaseCell.m index fbe5125..fda7ca2 100644 --- a/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoBaseListBaseCell.m +++ b/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoBaseListBaseCell.m @@ -19,6 +19,8 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor colorWithRed:97/255.f green:60/255.f blue:140/255.f alpha:0.6]; + self.bottomLine = [[UIImageView alloc]init]; self.bottomLine.gjcf_width = GJCFSystemScreenWidth; self.bottomLine.gjcf_height = 0.5f; diff --git a/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoRoleContentCell.m b/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoRoleContentCell.m index 8ad50e7..fa82e08 100644 --- a/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoRoleContentCell.m +++ b/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/Cells/GJGCInfoRoleContentCell.m @@ -28,17 +28,17 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr self.titleLabel = [[UILabel alloc]init]; self.titleLabel.font = [UIFont boldSystemFontOfSize:16.f]; - self.titleLabel.textColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColor]; + self.titleLabel.textColor = [GJGCCommonFontColorStyle listTitleAndDetailTextColorWhite]; [self.contentView addSubview:self.titleLabel]; self.timeLabel = [[UILabel alloc]init]; - self.timeLabel.textColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColor]; + self.timeLabel.textColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColorWhite]; self.timeLabel.font = [GJGCCommonFontColorStyle baseAndTitleAssociateTextFont]; [self.contentView addSubview:self.timeLabel]; self.descLabel = [[UILabel alloc]init]; self.descLabel.font = [GJGCCommonFontColorStyle listTitleAndDetailTextFont]; - self.descLabel.textColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColor]; + self.descLabel.textColor = [GJGCCommonFontColorStyle baseAndTitleAssociateTextColorWhite]; [self.contentView addSubview:self.descLabel]; } diff --git a/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/GJGCInfoBaseListViewController.m b/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/GJGCInfoBaseListViewController.m index 644cefb..f25cfe7 100644 --- a/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/GJGCInfoBaseListViewController.m +++ b/ZYChat-EaseMob/ZYChat/Square/InfoBaseList/GJGCInfoBaseListViewController.m @@ -44,6 +44,7 @@ - (void)viewDidLoad { self.listTable.separatorStyle = UITableViewCellSeparatorStyleNone; self.listTable.dataSource = self; self.listTable.delegate = self; + self.listTable.backgroundColor = [UIColor clearColor]; [self.view addSubview:self.listTable]; //refresh Header diff --git a/ZYChat-EaseMob/ZYChat/Square/PublicGroup/GJGCPublicGroupListViewController.m b/ZYChat-EaseMob/ZYChat/Square/PublicGroup/GJGCPublicGroupListViewController.m index 70d2265..8100355 100644 --- a/ZYChat-EaseMob/ZYChat/Square/PublicGroup/GJGCPublicGroupListViewController.m +++ b/ZYChat-EaseMob/ZYChat/Square/PublicGroup/GJGCPublicGroupListViewController.m @@ -20,6 +20,8 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. + [self.listTable setResourceType:ZYResourceTypeSquare]; + [self setStrNavTitle:@"广场"]; [self setRightButtonWithTitle:@"创建群组"]; diff --git a/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentChatForwardContentModel.h b/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentChatForwardContentModel.h index 9af543d..28d28d0 100644 --- a/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentChatForwardContentModel.h +++ b/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentChatForwardContentModel.h @@ -22,4 +22,6 @@ @property (nonatomic,strong)NSString *songId; +@property (nonatomic,strong)NSString *imageUrl; + @end diff --git a/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentContactListViewController.m b/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentContactListViewController.m index ce905a7..009c103 100644 --- a/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentContactListViewController.m +++ b/ZYChat-EaseMob/ZYChat/Square/RecentContactList/GJGCRecentContactListViewController.m @@ -164,6 +164,7 @@ - (void)sendMessageContentWithConversation:(GJGCInfoBaseListContentModel *)conte musicModel.songUrl = self.theContent.webUrl; musicModel.songId = self.theContent.songId; musicModel.author = self.theContent.sumary; + musicModel.songImgUrl = self.theContent.imageUrl; musicModel.displayText = self.theContent.title; extendInfo.chatFriendContentType = self.theContent.contentType; diff --git a/ZYChat-EaseMob/ZYChat/Theme/UITableView+Theme.h b/ZYChat-EaseMob/ZYChat/Theme/UITableView+Theme.h new file mode 100644 index 0000000..f179359 --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/Theme/UITableView+Theme.h @@ -0,0 +1,13 @@ +// +// UITableView+Theme.h +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import + +@interface UITableView (Theme) +- (void)setResourceType:(ZYResourceType)type; +@end diff --git a/ZYChat-EaseMob/ZYChat/Theme/UITableView+Theme.m b/ZYChat-EaseMob/ZYChat/Theme/UITableView+Theme.m new file mode 100644 index 0000000..6b6c395 --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/Theme/UITableView+Theme.m @@ -0,0 +1,38 @@ +// +// UITableView+Theme.m +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import "UITableView+Theme.h" + +@implementation UITableView (Theme) +- (void)setResourceType:(ZYResourceType)type +{ + NSString *imgName = nil; + switch (type) { + case ZYResourceTypeRecent: + imgName = kThemeRecentListBg; + break; + case ZYResourceTypeSquare: + imgName = kThemeSquareListBg; + break; + case ZYResourceTypeHome: + imgName = kThemeHomeListBg; + break; + case ZYResourceTypeChat: + imgName = kThemeChatLisgBg; + break; + default: + break; + } + UIImageView *backImageView = [[UIImageView alloc]initWithFrame:self.bounds]; + backImageView.image = ZYThemeImage(imgName); + UIImageView *maskView = [[UIImageView alloc]initWithFrame:backImageView.bounds]; + maskView.backgroundColor = [UIColor colorWithRed:97/255.f green:60/255.f blue:140/255.f alpha:0.6]; + [backImageView addSubview:maskView]; + self.backgroundView = backImageView; +} +@end diff --git a/ZYChat-EaseMob/ZYChat/Theme/ZYThemeUitil.h b/ZYChat-EaseMob/ZYChat/Theme/ZYThemeUitil.h new file mode 100644 index 0000000..f75cd13 --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/Theme/ZYThemeUitil.h @@ -0,0 +1,42 @@ +// +// ZYThemeUitil.h +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import + +#pragma mark - ThemeIconName + +#define kThemeRecentNavBar @"recent_nav" +#define kThemeRecentTabBar @"recent_tab" +#define kThemeRecentListBg @"recent_list" + +#define kThemeSquareNavBar @"square_nav" +#define kThemeSquareTabBar @"square_tab" +#define kThemeSquareListBg @"square_list" + +#define kThemeHomeNavBar @"home_nav" +#define kThemeHomeTabBar @"home_tab" +#define kThemeHomeListBg @"home_list" + +#define kThemeChatLisgBg @"chat_list_bg" + +#define ZYThemeImage(imgName) [ZYThemeUitil themeImage:imgName] + +typedef NS_ENUM(NSUInteger, ZYResourceType) { + ZYResourceTypeRecent, + ZYResourceTypeSquare, + ZYResourceTypeHome, + ZYResourceTypeChat, +}; + +@interface ZYThemeUitil : NSObject + ++ (void)setThemeFolder:(NSString *)folderName; ++ (UIImage *)themeImage:(NSString *)imageName; + + +@end diff --git a/ZYChat-EaseMob/ZYChat/Theme/ZYThemeUitil.m b/ZYChat-EaseMob/ZYChat/Theme/ZYThemeUitil.m new file mode 100644 index 0000000..2b2d36f --- /dev/null +++ b/ZYChat-EaseMob/ZYChat/Theme/ZYThemeUitil.m @@ -0,0 +1,37 @@ +// +// ZYThemeUitil.m +// ZYChat +// +// Created by ZYVincent on 16/12/18. +// Copyright © 2016年 ZYProSoft. All rights reserved. +// + +#import "ZYThemeUitil.h" + +static NSString *_themeFolderName = @"default"; + +@implementation ZYThemeUitil + ++ (void)setThemeFolder:(NSString *)folderName +{ + if (folderName.length == 0) { + return; + } + _themeFolderName = folderName; +} ++ (UIImage *)themeImage:(NSString *)imageName +{ + NSString *themePath = [[GJCFMainBundle bundlePath]stringByAppendingPathComponent:_themeFolderName]; + NSString *imgName = nil; + if ([GJCFSystemUitil screenBounds].size.height > 667) { + imgName = [NSString stringWithFormat:@"%@@2x",imageName]; + }else{ + imgName = [NSString stringWithFormat:@"%@@2x",imageName]; + } + NSString *imgPath = [[themePath stringByAppendingPathComponent:imgName] stringByAppendingPathExtension:@"png"]; + + UIImage *theImage = [UIImage imageWithContentsOfFile:imgPath]; + return theImage; +} + +@end diff --git a/ZYChat-EaseMob/ZYChat/ZYChat-PrefixHeader.pch b/ZYChat-EaseMob/ZYChat/ZYChat-PrefixHeader.pch index b28b2b2..006253e 100644 --- a/ZYChat-EaseMob/ZYChat/ZYChat-PrefixHeader.pch +++ b/ZYChat-EaseMob/ZYChat/ZYChat-PrefixHeader.pch @@ -16,6 +16,9 @@ #import +#import "ZYThemeUitil.h" +#import "UITableView+Theme.h" + #import "NSDictionary+Json.h" #import "NSString+Json.h"