AquaSupport / AQSShareService

A service layer that supports social sharing.
MIT License
0 stars 0 forks source link

Design #1

Open kaiinui opened 9 years ago

kaiinui commented 9 years ago
// AQSSocialService

typedef NS_ENUM(NSUInteger, AQSSocialProvider) {
  AQSSocialProviderFacebook,
  AQSSocial..
};

/// A new service instance.
+ (instancetype)service;

- (void)openAppOrWebWithShareProvider:(AQSSocialProvider)socialProvider;
- (void)performShareForProvider:(AQSSocialProvider)provider withActivityItems:(NSArray *)activityItems success:(void(^)())success failure:(void(^)(BOOL *isSignedIn))failure;
- (UIActivityViewController *)activityViewControllerForProviders:(NSOrderedSet /* <AQSSocialProvider> */ *)providers withActivityItems:(NSArray *)activityItems success:(void(^)(AQSShareProvider *shareProvider))success failure:(void(^)(AQSSocialProvider *shareProvider ,BOOL *isSignedIn))failure;

// for - activityViewControllerForProviders:withActivityItems:success:failure:
- (NSOrderedSet *)defaultProviderSet;

- (NSString *)uiActivityTypeFromAQSSocialProvider:(AQSSocialProvider)socialProvider;
// AQSActivityItem

@property (nonatomic, strong, readonly) NSString *body;
@property (nonatomic, strong, readonly) NSArray /* <UIImage *> */ *images;
@property (nonatomic, strong, readonly) NSURL *URL;

Concern

kaiinui commented 9 years ago

UIAcitvity

PodSpec

pod "AQSShareService"

pod "AQSShareService/Twitter/AnimatedGIF"
pod "AQSShareService/Twitter/DirectMessage" (http://qiita.com/shu223/items/8de1dc6018735ba85063)
pod "AQSShareService/Facebook/AnimatedGIF"

# Messanger Apps
pod "AQSShareService/WhatsApp"
pod "AQSShareService/FacebookMessenger" #with Copy&Paste
pod "AQSShareService/LINE" #jp
pod "AQSShareService/Weixin" #hans-zh, hant-zh
pod "AQSShareService/KakaoTalk" #ko
pod "AQSShareService/Kik" #en

# Photo Sharing Apps
pod "AQSShareService/Instagram"
pod "AQSShareService/Pinterest"

# Bookmark Apps
pod "AQSShareService/Hatena" #jp
pod "AQSShareService/Pocket"
pod "AQSShareService/Instapaper"
pod "AQSShareService/Readability"

# Open in Web
pod "AQSShareService/Action/Safari"
pod "AQSShareService/Action/Chrome"

# Message & Email in Action Category
pod "AQSShareService/Action/Email"
pod "AQSShareService/Action/Message"

# Other Actions
pod "AQSShareService/Action/Copy"
pod "AQSShareService/Action/Custom"

# Others
pod "AQSShareService/OpenIn"

Spec

UIActivityViewController
  1. It does not contain AirDrop at default.
  2. It shows activity indicator before showing.
UIActivity
  1. Every UIActivity does not be shown when the app is not installed.
  2. Twitter will behave like..
    1. Even the user does not signed in on Social.framework, it shows on the list.
    2. If it is signed in on Social.framework, it does post on Social.framework.
    3. If not and Twitter App is installed, go to Twitter App with posting URL Scheme. (twitter://post?message=#{BODY})
    4. If not and Twitter App is not installed, use Web Intent with fallback (try to use Chrome with x-callback)
  3. Facebook will behave like...
    1. Even the user does not signed in on Social.framework, it shows on the list.
    2. If the Facebook app is installed, use Facebook iOS SDK to share (like Aviary)
    3. If the Facebook app is not installed, and signed in on Social.framework, use Social.framework
    4. It not at all, use Web with fallback (try to use Chrome with x-callback)

References

kaiinui commented 9 years ago

参考

kaiinui commented 9 years ago
kaiinui commented 9 years ago
kaiinui commented 9 years ago
[AQSActivityCustom activityType:@"some.type" category:Action performActivityWithActivityItemsBlock:(void(^)(NSArray *activityItems))perform canPerformWithActivityItems:..];
kaiinui commented 9 years ago
// @protocol AQSOAuthActivity

+ (void)setupWithConsumerKey:(NSString *)consumerKey withConsumerSecret:(NSString *)consumerSecret withUserInfo:(NSDictionary *)userInfo;
+ (BOOL)handleOpenURL:(NSURL *)URL;
kaiinui commented 9 years ago
// AQSActivityHistory

@property NSString *activityType;
@property NSArray *activityItems;
@property NSArray /* AQSActivityRecipient */ *recipients;
// @protocol AQSActivityRecipient

- (NSString *)displayName;
- (UIImage *)iconImage;
kaiinui commented 9 years ago
kaiinui commented 9 years ago
kaiinui commented 9 years ago
kaiinui commented 9 years ago

kikinteractive/kik-api-iphone : https://github.com/kikinteractive/kik-api-iphone

kaiinui commented 9 years ago