PDRCoreAppInfo.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. //
  2. // PDR_Application.h
  3. // Pandora
  4. //
  5. // Created by Mac Pro on 12-12-22.
  6. // Copyright 2012 __MyCompanyName__. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "H5CoreOverrideResourceOptions.h"
  10. #import "PDRCoreDefs.h"
  11. #import <UIKit/UIKit.h>
  12. #import "PDRToolSystemEx.h"
  13. typedef NS_ENUM(NSInteger, PDRCoreAppPopGesture) {
  14. PDRCoreAppPopGestureNone = 0,
  15. PDRCoreAppPopGestureClose,
  16. PDRCoreAppPopGestureHide,
  17. PDRCoreAppPopGestureSkip,
  18. PDRCoreAppPopGestureAppBack
  19. };
  20. typedef NS_ENUM(NSInteger, PDRCoreAppFrameHistoryBack) {
  21. PDRCoreAppFrameHistoryBackNone = 0,
  22. PDRCoreAppFrameHistoryBackPopGesture,
  23. PDRCoreAppFrameHistoryBackBackButton,
  24. PDRCoreAppFrameHistoryBackAll
  25. };
  26. @interface PDRCoreAppUserAgentInfo : NSObject
  27. @property(nonatomic, strong)NSString *value;
  28. @property(nonatomic, assign)BOOL concatenate;
  29. @end
  30. @interface PDRCoreAppAuthorInfo : NSObject
  31. @property(nonatomic, strong)NSString *email;
  32. @property(nonatomic, strong)NSString *href;
  33. @property(nonatomic, strong)NSString *content;
  34. @end
  35. @interface PDRCoreAppLicenseInfo : NSObject
  36. @property(nonatomic, strong)NSString *href;
  37. @property(nonatomic, strong)NSString *content;
  38. @end
  39. typedef NS_ENUM(int, PDRCoreWebviewCrashAction) {
  40. PDRCoreWebviewCrashActionRestart = 1,
  41. PDRCoreWebviewCrashActionReload,
  42. PDRCoreWebviewCrashActionNone
  43. };
  44. @interface PDRCoreWebviewKernel : NSObject
  45. @property(nonatomic, strong)NSString *name;
  46. @property(nonatomic, assign)PDRCoreWebviewCrashAction crashAction;
  47. + (NSString*)getKernelWithName:(NSString*)name;
  48. - (PDRCoreWebviewCrashAction)getCrashActionWithString:(NSString*)action;
  49. @end
  50. typedef NS_ENUM(NSInteger, PDRCoreWebviewMode) {
  51. PDRCoreWebviewModeChild = 0,//child表示作为launchwebview的子窗口
  52. PDRCoreWebviewModeFront, //front表示与launchwebview平级并在其前显示
  53. PDRCoreWebviewModeBehind, //behind表示与launchwebview平级并在其后显示
  54. PDRCoreWebviewModeParent // parent表示作为launchwebview的父窗口
  55. };
  56. typedef NS_ENUM(NSInteger, H5CoreAppSafeareaValue) {
  57. H5CoreAppSafeareaValueNone = 1,
  58. H5CoreAppSafeareaValueAuto
  59. };
  60. @interface H5CoreAppSafearea :NSObject
  61. @property(nonatomic, strong)UIColor *backgroundColor;
  62. @property(nonatomic, assign)H5CoreAppSafeareaValue top;
  63. @property(nonatomic, assign)H5CoreAppSafeareaValue bottom;
  64. @property(nonatomic, assign)H5CoreAppSafeareaValue left;
  65. @property(nonatomic, assign)H5CoreAppSafeareaValue right;
  66. +(instancetype)safeareaWithJson:(NSDictionary*)json;
  67. @end
  68. @interface PDRCoreWebviewConfig : NSObject
  69. @property(nonatomic, strong)NSString *launch_path;
  70. @property(nonatomic, strong)NSString *uid;
  71. @property(nonatomic, assign)PDRCoreWebviewMode mode;
  72. @property(nonatomic, assign)BOOL injection;
  73. @property(nonatomic, strong)NSDictionary *overrideurl;
  74. @property(nonatomic, strong)NSDictionary *additionHeads;
  75. @property(nonatomic, strong)H5CoreOverrideResourceOptions *overrideResource;
  76. @property(nonatomic, strong)NSDictionary* styles;
  77. @end
  78. typedef NS_ENUM(NSInteger, PDRCoreAppSplashscreenTarget) {
  79. PDRCoreAppSplashscreenTargetDefalut = 0,
  80. PDRCoreAppSplashscreenTargetSecond,
  81. PDRCoreAppSplashscreenTargetCustorm
  82. };
  83. typedef NS_ENUM(NSInteger, H5CoreUniappControlMode) {
  84. H5CoreUniappControlModeWebview = 1,
  85. H5CoreUniappControlModeWeex
  86. };
  87. typedef NS_ENUM(NSInteger, H5CoreUniappControlRenderer) {
  88. H5CoreUniappControlRendererAuto = 1,
  89. H5CoreUniappControlRendererNative
  90. };
  91. typedef NS_ENUM(NSInteger, H5NVueJsframework) {
  92. H5NVueJsframeworkUniapp = 1,
  93. H5NVueJsframeworkWeex
  94. };
  95. @interface H5CoreAppUniAppInfo :NSObject
  96. @property(nonatomic, assign)H5CoreUniappControlMode mode;
  97. @property(nonatomic, assign)H5NVueJsframework jsframework;
  98. @property(nonatomic, assign)H5CoreUniappControlRenderer renderer;
  99. @property(nonatomic, strong)NSString *flexDirection;
  100. @property(nonatomic, assign)BOOL forceUniApp;
  101. @end
  102. @interface PDRCoreAppCongfigParse : NSObject {
  103. @private
  104. // 应用权限目录
  105. NSMutableDictionary *_permission;
  106. }
  107. @property(nonatomic, strong)NSDictionary *permission;
  108. // 应用的主页面
  109. @property(nonatomic, strong)NSString *appID;
  110. @property(nonatomic, strong)NSString *appIDInMainifesh;
  111. @property(nonatomic, assign)BOOL copyToReadWriteDir;
  112. @property(nonatomic, strong)NSString *name;
  113. @property(nonatomic, strong)NSString *version;
  114. @property(nonatomic, assign)BOOL fullScreen;
  115. @property(nonatomic, assign)BOOL allowsInlineMediaPlayback;
  116. @property(nonatomic, assign)BOOL showSplashscreen;
  117. @property(nonatomic, assign)BOOL autoClose;
  118. @property(nonatomic, assign)BOOL autoclose_w2a;
  119. @property(nonatomic, assign)BOOL splashShowWaiting;
  120. @property(nonatomic, assign)PDRCoreAppSplashscreenTarget splashTarget;
  121. @property(nonatomic, strong)NSString *splashWebviewTarget;
  122. @property(nonatomic, assign)NSUInteger delay;
  123. @property(nonatomic, assign)NSUInteger delay_w2a;
  124. @property(nonatomic, copy)NSString *contentSrc;
  125. @property(nonatomic, copy)NSString *description;
  126. @property(nonatomic, strong)PDRCoreAppAuthorInfo *author;
  127. @property(nonatomic, strong)PDRCoreAppLicenseInfo *license;
  128. @property(nonatomic, strong)NSArray *adsInfo;
  129. @property(nonatomic, strong)NSString* paid;
  130. @property(nonatomic, strong)PDRCoreAppUserAgentInfo *userAgent;
  131. @property(nonatomic, strong)NSString *adaptationSrc;
  132. @property(nonatomic, copy)NSString *errorHtmlPath;
  133. @property(nonatomic, assign)BOOL showErrorPage;
  134. @property(nonatomic, assign)PDRCoreAppPopGesture popGesture;
  135. @property(nonatomic, assign)BOOL isStreamCompetent;
  136. @property(nonatomic, strong)NSDictionary *authorityValue;
  137. @property(nonatomic, assign)BOOL isPostException;
  138. @property(nonatomic, assign)BOOL isShowInputAssistBar;
  139. @property(nonatomic, assign)BOOL bW2AShowLaunchError;
  140. @property(nonatomic, assign)BOOL isPostJSException;
  141. @property(nonatomic, assign)BOOL isEncrypt;
  142. @property(nonatomic, assign)PDRCoreAppSSLActive defSSLActive;
  143. @property(nonatomic, strong)NSArray* appWhitelist;
  144. @property(nonatomic, strong)NSArray* schemeWhitelist;
  145. @property(nonatomic, strong)PDRCoreWebviewKernel *kernel;
  146. @property(nonatomic, strong)NSString *launch_path_w2a;
  147. @property(nonatomic, strong)PDRCoreWebviewConfig *secondWebviewConfig;
  148. @property(nonatomic, strong)PDRCoreWebviewConfig *launchwebviewWebviewConfig;
  149. @property(nonatomic, copy)NSString *configPath; //配置文件全路径
  150. @property(nonatomic, strong)H5CoreAppSafearea *safearea;
  151. @property(nonatomic, strong)NSDictionary *splashAds;
  152. @property(nonatomic, strong)NSString* arguments;
  153. @property(nonatomic, strong)NSArray *orientation;
  154. @property(nonatomic, assign)UIStatusBarStyle statusBarStyle;
  155. @property(nonatomic, strong)UIColor *statusBarColor;
  156. @property(nonatomic, assign)PDRCoreStatusBarMode statusBarMode;
  157. @property(nonatomic, strong)H5CoreAppUniAppInfo *uniInfo;
  158. @property(nonatomic, strong)NSDictionary *tabBarStyle;
  159. - (int) load;
  160. - (int) loadWithConfig:(NSString*)fullPath;
  161. - (BOOL)lessThanPermission:(NSDictionary*)permission moreModes:(NSArray**)output;
  162. - (BOOL)wap2appManefestIsChange:(PDRCoreAppCongfigParse*)oldManifest;
  163. @end
  164. @interface PDRCoreAppInfo : PDRCoreAppCongfigParse {
  165. @private
  166. }
  167. @property(nonatomic, strong)NSString *indexPage;
  168. @property(nonatomic, strong)NSString *wwwPath;
  169. @property(nonatomic, strong)NSString *documentPath;
  170. @property(nonatomic, strong)NSString *tmpPath;
  171. @property(nonatomic, strong)NSString *logPath;
  172. @property(nonatomic, strong)NSString *dataPath;
  173. @property(nonatomic, strong)NSString *adaptationJS;
  174. - (void)changeExecutableRootPath:(NSString *)executableRootPath;
  175. - (void)setPathsWithExecutableRootPath:(NSString *)executableRootPath
  176. workPath:(NSString *)wwwRootPath
  177. workPath:(NSString *)workRootPath
  178. docuPath:(NSString *)documentPath
  179. constantPath:(NSString *)constantPath;
  180. - (void)loadAdaptationJS;
  181. - (void)webviewDefaultSetting;
  182. - (void)registerForKVO;
  183. - (void)unregisterFromKVO;
  184. @end