ShareSDK.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // ShareSDK.h
  3. // ShareSDK
  4. //
  5. // Created by 冯 鸿杰 on 15/2/5.
  6. // Copyright (c) 2015年 掌淘科技. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "NSMutableDictionary+SSDKInit.h"
  10. #import "NSMutableDictionary+SSDKShare.h"
  11. #import "SSDKTypeDefine.h"
  12. #import "SSDKUserQueryConditional.h"
  13. #import "SSDKContentEntity.h"
  14. #import "SSDKUser.h"
  15. #import "SSDKCredential.h"
  16. #import "SSDKAuthViewStyle.h"
  17. /**
  18. * ShareSDK APIs
  19. */
  20. @interface ShareSDK : NSObject
  21. #pragma mark - 初始化
  22. /**
  23. * 初始化ShareSDK应用
  24. *
  25. * @param appKey ShareSDK应用标识,可在http://mob.com中登录并创建App后获得。
  26. * @param activePlatforms 使用的分享平台集合,如:@[@(SSDKPlatformTypeSinaWeibo), @(SSDKPlatformTypeTencentWeibo)];
  27. * @param connectHandler 导入回调处理,当某个平台的功能需要依赖原平台提供的SDK支持时,需要在此方法中对原平台SDK进行导入操作。具体的导入方式可以参考ShareSDKConnector.framework中所提供的方法。
  28. * @param configurationHandler 配置回调处理,在此方法中根据设置的platformType来填充应用配置信息
  29. */
  30. + (void)registerApp:(NSString *)appKey
  31. activePlatforms:(NSArray *)activePlatforms
  32. onImport:(SSDKImportHandler)importHandler
  33. onConfiguration:(SSDKConfigurationHandler)configurationHandler;
  34. #pragma mark - 授权
  35. /**
  36. * 分享平台授权
  37. *
  38. * @param platformType 平台类型
  39. * @param @param settings 授权设置,目前只接受SSDKAuthSettingKeyScopes属性设置,如新浪微博关注官方微博:@{SSDKAuthSettingKeyScopes : @[@"follow_app_official_microblog"]},类似“follow_app_official_microblog”这些字段是各个社交平台提供的。
  40. * @param stateChangeHandler 授权状态变更回调处理
  41. */
  42. + (void)authorize:(SSDKPlatformType)platformType
  43. settings:(NSDictionary *)settings
  44. onStateChanged:(SSDKAuthorizeStateChangedHandler)stateChangedHandler;
  45. /**
  46. * 判断分享平台是否授权
  47. *
  48. * @param platformType 平台类型
  49. * @return YES 表示已授权,NO 表示尚未授权
  50. */
  51. + (BOOL)hasAuthorized:(SSDKPlatformType)platformTypem;
  52. /**
  53. * 取消分享平台授权
  54. *
  55. * @param platformType 平台类型
  56. */
  57. + (void)cancelAuthorize:(SSDKPlatformType)platformType;
  58. #pragma mark - 用户
  59. /**
  60. * 获取授权用户信息
  61. *
  62. * @param platformType 平台类型
  63. * @param stateChangeHandler 状态变更回调处理
  64. */
  65. + (void)getUserInfo:(SSDKPlatformType)platformType
  66. onStateChanged:(SSDKGetUserStateChangedHandler)stateChangedHandler;
  67. /**
  68. * 获取用户信息
  69. *
  70. * @param platformType 平台类型
  71. * @param conditional 查询条件,如果为nil则获取当前授权用户信息
  72. * @param stateChangeHandler 状态变更回调处理
  73. */
  74. + (void)getUserInfo:(SSDKPlatformType)platformType
  75. conditional:(SSDKUserQueryConditional *)conditional
  76. onStateChanged:(SSDKGetUserStateChangedHandler)stateChangedHandler;
  77. #pragma mark - 分享
  78. /**
  79. * 分享内容
  80. *
  81. * @param platformType 平台类型
  82. * @param parameters 分享参数
  83. * @param stateChangeHandler 状态变更回调处理
  84. */
  85. + (void)share:(SSDKPlatformType)platformType
  86. parameters:(NSMutableDictionary *)parameters
  87. onStateChanged:(SSDKShareStateChangedHandler)stateChangedHandler;
  88. @end