Skip to content

Commit

Permalink
Merge branch 'feature/MZFayeClient' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	Podfile.lock
	Yep/Yep-Bridging-Header.h
  • Loading branch information
kevinzhow committed Feb 1, 2016
2 parents 2638f90 + 4799bb0 commit 9e7913a
Show file tree
Hide file tree
Showing 9 changed files with 997 additions and 45 deletions.
4 changes: 3 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def pods
pod 'Kingfisher'
pod 'TPKeyboardAvoiding', '~> 1.2'
pod 'pop'
pod 'MZFayeClient', :path => '../CatchLib-iOS/MZFayeClient/'
# pod 'MZFayeClient', :path => '../CatchLib-iOS/MZFayeClient/'
pod 'Base64'
pod 'SocketRocket'
pod 'RealmSwift'
pod 'MonkeyKing', '0.0.2'
pod 'JPush'
Expand Down
44 changes: 17 additions & 27 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
PODS:
- 1PasswordExtension (1.7)
- Alamofire (3.1.5)
- APAddressBook/Core (0.2.3)
- APAddressBook/Swift (0.2.3):
- Alamofire (3.1.4)
- APAddressBook/Core (0.2.2)
- APAddressBook/Swift (0.2.2):
- APAddressBook/Core
- Appsee (2.1.5)
- Base64 (1.0.1)
- Crashlytics (3.6.0):
- Fabric (~> 1.6.3)
- Crashlytics (3.5.0):
- Fabric (~> 1.6.0)
- DeviceGuru (1.3.3)
- Fabric (1.6.4)
- Fabric (1.6.2)
- FXBlurView (1.6.4)
- JPush (2.1.0)
- JPush-iOS-SDK (1.8.8)
- Kanna (1.0.3)
- KeyboardMan (0.5.2)
- Kingfisher (1.9.2)
- Kingfisher (1.9.1)
- MonkeyKing (0.0.2)
- MZFayeClient (1.0.1):
- Base64 (~> 1.0.1)
- SocketRocket (~> 0.4)
- Navi (0.3.9)
- pop (1.0.8)
- Proposer (0.7.1)
Expand All @@ -35,44 +31,38 @@ DEPENDENCIES:
- 1PasswordExtension (~> 1.5)
- Alamofire
- APAddressBook/Swift
- Appsee
- Base64
- Crashlytics
- DeviceGuru
- Fabric
- FXBlurView
- JPush
- JPush-iOS-SDK
- Kanna
- KeyboardMan
- Kingfisher
- MonkeyKing (= 0.0.2)
- MZFayeClient (from `../CatchLib-iOS/MZFayeClient/`)
- Navi
- pop
- Proposer
- RealmSwift
- Ruler
- SocketRocket
- TPKeyboardAvoiding (~> 1.2)

EXTERNAL SOURCES:
MZFayeClient:
:path: "../CatchLib-iOS/MZFayeClient/"

SPEC CHECKSUMS:
1PasswordExtension: a22573ad528dd63bd79c1f3b3813b17c2f86b91b
Alamofire: 5f730ba29fd113b7ddd71c1e65d0c630acf5d7b0
APAddressBook: 2a91bf05999548bea210ec9d1a68073f4dc8bfce
Appsee: 77f144701aa1a53d854d319a46667561849e8cf5
Alamofire: fbc829692f351fa1d8a31dd75fd7f7f56fea31fb
APAddressBook: 26473a739b8b9c9535c98ec66bf78015b4081dab
Base64: 4924bf3ca6fa559a5161ef717291bd450eb7bd1a
Crashlytics: e4e8d02914f2608fbc7bf42b1a7af838b0db67a2
Crashlytics: fabfd45d0e8b8dc936c682b97e302b9a49a1c827
DeviceGuru: 49c6178d77693f8459ace21cecaf4d1d26297d08
Fabric: ed41fd62173c6bdea24ab02c9d7707161eabb750
Fabric: e8296d4a1abb3c5eed770cc86b311c862f51d340
FXBlurView: db786c2561cb49a09ae98407f52460096ab8a44f
JPush: 92cb879829f0d81ab17b2c9ad009fdb88c6cf6e5
JPush-iOS-SDK: d4c097d8abbdd0837e24d44b41aacf64a6feddfd
Kanna: 10c7f20762846e808ec5716e4191427bd71bf1c2
KeyboardMan: b081c254c5c0adc794a49b4e97a86cb4ac917a66
Kingfisher: 7b6df0fa9d211807152c32c46494f9bc08f0e07b
Kingfisher: 98fedd5d44d982b331fc7303f9f6144b7d8ba289
MonkeyKing: 9be24307843a80f4cd3eca66adc12c67aefb83bb
MZFayeClient: 65e7ef67e61fbe7a7a8b196130541c9f06bcb5d8
Navi: 24f5c81aeb46b89d27168ec1d459581230ae2675
pop: bb773ae2c791ca2629de13b347e7a8b450fa6a57
Proposer: e9759ad71a6702fd94315a0bff1f8c116edf6f07
Expand Down
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
#Yep

技能社交,科技面基
A community where genius meet

因为 Swift 和 Objc 的项目需要一些 Hack 才能一起工作.
https://soyep.com


##1.JPushSDK

这个是超级大坑
基本上需要你把 Pod 装一下 JPushSDK 然后再把它的 .a 文件放进去项目里面。

##2.Faye

MZFayeClient 需要直接 Hack 下他的 Pod 里的源文件,解决找不到 SRWebSocket.h 的问题。

```objective-c
//MZFayeClient.h
#import <SocketRocket/SRWebSocket.h>
```
![](http://blog.zhowkev.in/content/images/2016/02/image.png)
28 changes: 28 additions & 0 deletions Yep.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@
848806B11B789A2D000C5424 /* EditSkillCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 848806AF1B789A2D000C5424 /* EditSkillCell.xib */; };
848806B61B7B4F53000C5424 /* ShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848806B51B7B4F53000C5424 /* ShowViewController.swift */; };
84C959891B731FD20017D3ED /* ChatBaseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C959881B731FD20017D3ED /* ChatBaseCell.swift */; };
92E0FFE71C5F38E400226B96 /* MZFayeClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E0FFE41C5F38E400226B96 /* MZFayeClient.m */; };
92E0FFE81C5F38E400226B96 /* MZFayeMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E0FFE61C5F38E400226B96 /* MZFayeMessage.m */; };
B00500D7E943DDD27CF9C562 /* Pods_Yep.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3146F0F60F2A38BC6E0FA66 /* Pods_Yep.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -737,6 +739,10 @@
848806B51B7B4F53000C5424 /* ShowViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ShowViewController.swift; path = ViewControllers/Show/ShowViewController.swift; sourceTree = "<group>"; };
84C959881B731FD20017D3ED /* ChatBaseCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatBaseCell.swift; path = Views/Cells/ChatBaseCell/ChatBaseCell.swift; sourceTree = "<group>"; };
88C96122C478C4D134F634F6 /* Pods-Yep.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Yep.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Yep/Pods-Yep.debug.xcconfig"; sourceTree = "<group>"; };
92E0FFE31C5F38E400226B96 /* MZFayeClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MZFayeClient.h; sourceTree = "<group>"; };
92E0FFE41C5F38E400226B96 /* MZFayeClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MZFayeClient.m; sourceTree = "<group>"; };
92E0FFE51C5F38E400226B96 /* MZFayeMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MZFayeMessage.h; sourceTree = "<group>"; };
92E0FFE61C5F38E400226B96 /* MZFayeMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MZFayeMessage.m; sourceTree = "<group>"; };
C3146F0F60F2A38BC6E0FA66 /* Pods_Yep.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Yep.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -839,6 +845,7 @@
848806B21B7B0230000C5424 /* Yep.entitlements */,
0A8F54B01AB67D11004AD60E /* AppDelegate.swift */,
0AD7EA581AC3EAF300617758 /* Yep-Bridging-Header.h */,
92E0FFE11C5F38E400226B96 /* Vendors */,
50AFBF4F1BB3A5A1007D19DA /* Sounds */,
50E114F51ABBF9D100F13000 /* Realm */,
502AE53B1AB871C5005BD199 /* Helpers */,
Expand Down Expand Up @@ -2379,6 +2386,25 @@
name = ChatBase;
sourceTree = "<group>";
};
92E0FFE11C5F38E400226B96 /* Vendors */ = {
isa = PBXGroup;
children = (
92E0FFE21C5F38E400226B96 /* MZFayeClient */,
);
path = Vendors;
sourceTree = "<group>";
};
92E0FFE21C5F38E400226B96 /* MZFayeClient */ = {
isa = PBXGroup;
children = (
92E0FFE31C5F38E400226B96 /* MZFayeClient.h */,
92E0FFE41C5F38E400226B96 /* MZFayeClient.m */,
92E0FFE51C5F38E400226B96 /* MZFayeMessage.h */,
92E0FFE61C5F38E400226B96 /* MZFayeMessage.m */,
);
path = MZFayeClient;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -2714,6 +2740,7 @@
502AE51B1AB70DDB005BD199 /* WelcomeViewController.swift in Sources */,
50894D071AEDFDA2000981AF /* EditProfileMoreInfoCell.swift in Sources */,
502C24831C1034000074A1BA /* UIImageView+Yep.swift in Sources */,
92E0FFE71C5F38E400226B96 /* MZFayeClient.m in Sources */,
5080EB1C1B93F43A006F3C2D /* PodsHelpYepViewController.swift in Sources */,
0A1CAC731AFA526200826B45 /* SkillHomeSectionButton.swift in Sources */,
50E392BC1C22752C00C0CECB /* FeedNormalImagesCell.swift in Sources */,
Expand Down Expand Up @@ -2752,6 +2779,7 @@
50AFBF5F1BB4F332007D19DA /* FeedsViewController.swift in Sources */,
50EB8CBF1AE89ED8001AC1EE /* ChatLeftVideoCell.swift in Sources */,
502AE5331AB86020005BD199 /* RegisterVerifyMobileViewController.swift in Sources */,
92E0FFE81C5F38E400226B96 /* MZFayeMessage.m in Sources */,
5064F6541B0B0E160089FAD4 /* AddFriendSearchCell.swift in Sources */,
504CBA3D1B3D04B800663A90 /* ChatTextView.swift in Sources */,
0A1CAC6E1AFA42D400826B45 /* SkillHomeViewController.swift in Sources */,
Expand Down
151 changes: 151 additions & 0 deletions Yep/Vendors/MZFayeClient/MZFayeClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
//
// MZFayeClient.h
// MZFayeClient
//
// Created by Michał Zaborowski on 12.12.2013.
// Copyright (c) 2013 Michał Zaborowski. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>
#import <SocketRocket/SRWebSocket.h>
#import "MZFayeMessage.h"

@class MZFayeClient;

extern NSString *const MZFayeClientBayeuxChannelHandshake;
extern NSString *const MZFayeClientBayeuxChannelConnect;
extern NSString *const MZFayeClientBayeuxChannelDisconnect;
extern NSString *const MZFayeClientBayeuxChannelSubscribe;
extern NSString *const MZFayeClientBayeuxChannelUnsubscribe;

extern NSString *const MZFayeClientWebSocketErrorDomain;

extern NSTimeInterval const MZFayeClientDefaultRetryInterval;
extern NSInteger const MZFayeClientDefaultMaximumAttempts;

typedef void(^MZFayeClientSubscriptionHandler)(NSDictionary *message);

typedef void(^MZFayeClientPrivateHandler)(MZFayeMessage *message);

@protocol MZFayeClientDelegate <NSObject>
@optional

- (void)fayeClient:(MZFayeClient *)client didConnectToURL:(NSURL *)url;
- (void)fayeClient:(MZFayeClient *)client didDisconnectWithError:(NSError *)error;
- (void)fayeClient:(MZFayeClient *)client didUnsubscribeFromChannel:(NSString *)channel;
- (void)fayeClient:(MZFayeClient *)client didSubscribeToChannel:(NSString *)channel;
- (void)fayeClient:(MZFayeClient *)client didFailWithError:(NSError *)error;
- (void)fayeClient:(MZFayeClient *)client didFailDeserializeMessage:(NSDictionary *)message
withError:(NSError *)error;
- (void)fayeClient:(MZFayeClient *)client didReceiveMessage:(NSDictionary *)messageData fromChannel:(NSString *)channel;

@end

@interface MZFayeClient : NSObject <SRWebSocketDelegate>

/**
* WebSocket client
*/
@property (nonatomic, readonly, strong) SRWebSocket *webSocket;

/**
* The URL for the faye server
*/
@property (nonatomic, readonly, strong) NSURL *url;

/**
* Uniquely identifies a client to the Bayeux server.
*/
@property (nonatomic, readonly, strong) NSString *clientId;

/**
* The number of sent messages
*/
@property (nonatomic, readonly) NSInteger sentMessageCount;

/**
* Returns whether the faye client is connected to server
*/
@property (nonatomic, readonly, assign, getter = isConnected) BOOL connected;

/**
* The channels the client wishes to subscribe
*/
@property (nonatomic, readonly) NSSet *subscriptions;

@property (nonatomic, readonly) NSSet *pendingSubscriptions;
@property (nonatomic, readonly) NSSet *openSubscriptions;

/**
* Returns list of extensions per channel.
* The contents of ext may be arbitrary values that allow extensions to be negotiated
* and implemented between server and client implementations.
*/
@property (nonatomic, readonly) NSDictionary *extensions;

/**
* Returns whether the faye client should auto retry connection
* By default, this is YES
*/
@property (nonatomic, assign) BOOL shouldRetryConnection;

/**
* How often should retry connection
*/
@property (nonatomic, assign) NSTimeInterval retryInterval;

/**
* Actual retry connection attempt number
*/
@property (nonatomic, assign) NSInteger retryAttempt;

/**
* Maximum retry connection attments
*/
@property (nonatomic, assign) NSInteger maximumRetryAttempts;

/**
* The object that acts as the delegate of the receiving faye client events.
*/
@property (nonatomic, weak) id <MZFayeClientDelegate> delegate;

- (instancetype)init;
+ (instancetype)client;

- (instancetype)initWithURL:(NSURL *)url;
+ (instancetype)clientWithURL:(NSURL *)url;

- (void)setExtension:(NSDictionary *)extension forChannel:(NSString *)channel;
- (void)removeExtensionForChannel:(NSString *)channel;

- (void)sendMessage:(NSDictionary *)message toChannel:(NSString *)channel;
- (void)sendMessage:(NSDictionary *)message toChannel:(NSString *)channel usingExtension:(NSDictionary *)extension;
- (void)sendMessage:(NSDictionary *)message toChannel:(NSString *)channel usingExtension:(NSDictionary *)extension usingBlock:(MZFayeClientPrivateHandler)subscriptionHandler;

- (void)subscribeToChannel:(NSString *)channel;
- (void)subscribeToChannel:(NSString *)channel usingBlock:(MZFayeClientSubscriptionHandler)subscriptionHandler;
- (void)unsubscribeFromChannel:(NSString *)channel;

- (BOOL)connectToURL:(NSURL *)url;
- (BOOL)connect;

- (void)disconnect;

@end
Loading

0 comments on commit 9e7913a

Please sign in to comment.