AppDelegateBase.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. //
  2. // AppDelegateBase.h
  3. // iSales-UWAVER
  4. //
  5. // Created by Ray on 2018/8/9.
  6. // Copyright © 2018 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "config.h"
  10. #ifdef USE_MFI_SCANNER
  11. #import "ScanApiHelper.h"
  12. #endif
  13. #import "config.h"
  14. #import "UIResponder+Router.h"
  15. #import "iSalesDB.h"
  16. #import "SyncControlPanelViewController.h"
  17. #import <CoreBluetooth/CoreBluetooth.h>
  18. #ifdef SCANNER_ORDER
  19. #import "RAUploadManager.h"
  20. #endif
  21. @protocol ScannerEventsFeedback <NSObject>
  22. -(void) onDecodedData:(NSString*) value;
  23. -(void) onErrorInfo:(NSString*) errorInfo;
  24. -(void) onStatusChanged:(NSString*) status;
  25. -(void) onLogUpdate;
  26. -(void) OnUpdateDevicesList;
  27. @end
  28. typedef enum {
  29. CustomerTypeStore = 0,
  30. CustomerTypeCustomer = 1
  31. } CustomerType;
  32. #ifdef USE_BLE_SCANNER
  33. @interface AppDelegateBase : UIResponder<UIApplicationDelegate , NSURLConnectionDataDelegate
  34. ,CBCentralManagerDelegate, CBPeripheralDelegate,NSURLSessionDataDelegate>
  35. #else
  36. #ifdef USE_MFI_SCANNER
  37. @interface AppDelegateBase : UIResponder<UIApplicationDelegate , NSURLConnectionDataDelegate
  38. ,ScanApiHelperDelegate,NSURLSessionDataDelegate>
  39. #else
  40. @interface AppDelegateBase : UIResponder<UIApplicationDelegate , NSURLConnectionDataDelegate
  41. ,NSURLSessionDataDelegate>
  42. #endif
  43. #endif
  44. #ifndef RA_NOTIFICATION
  45. @property (strong,nonatomic)UIViewController* active_controller;
  46. #else
  47. -(void)pushFeedback:(id<ScannerEventsFeedback>)feedback;
  48. -(void)popFeedback:(id<ScannerEventsFeedback>)feedback;
  49. -(void)setFeedback:(id<ScannerEventsFeedback>)feedback;
  50. #endif
  51. //scanner
  52. #define API_START 1
  53. #define API_STOP 3
  54. #define API_INIT 0
  55. #define API_CLOSING 2
  56. #ifdef USE_MFI_SCANNER
  57. @property (strong, nonatomic) ScanApiHelper* ScanApi;
  58. - (void)enableScanner:(bool)enable ;
  59. - (void)test_onDecodedDataResult:(NSString*) value;
  60. #endif
  61. @property (strong, nonatomic) NSTimer* ScanApiConsumer;
  62. @property (nonatomic) BOOL doAppDataConfirmation;
  63. @property (strong, nonatomic) NSString *scanApiVersion;
  64. @property (strong, nonatomic) NSString* log;
  65. @property BOOL softScannerEnabled;
  66. -(void) addlog:(NSString*) newtext;
  67. @property bool enable_ScannerLog;
  68. @property (strong,nonatomic) NSMutableArray* devices;
  69. @property int api_Status;
  70. @property (strong, nonatomic) NSString* Status_Text;
  71. //offline order
  72. -(void) backup_oc;
  73. -(void) restore_oc;
  74. @property (strong,nonatomic)NSMutableDictionary* recent_model;
  75. @property (nonatomic,assign) bool offline_mode;
  76. @property (strong , nonatomic) NSString* contact_id;
  77. @property bool bEnable_Cache;
  78. // Window property - 兼容旧接口,实际从 SceneDelegate 获取
  79. @property (strong, nonatomic) UIWindow *window;
  80. @property (strong,nonatomic) NSString * user_icon;
  81. @property bool bLogin;
  82. @property (nonatomic) long user_type;
  83. @property CustomerType customer_type;
  84. @property (strong , nonatomic) NSString* order_customer_id;
  85. @property (strong,nonatomic)NSDictionary* categoryMenu;
  86. @property (strong,nonatomic)NSMutableDictionary* customerInfo;
  87. @property (strong,nonatomic) NSString* order_code;
  88. @property int order_status;
  89. @property (strong,nonatomic) UIViewController* main_vc;
  90. -(void) Logout;
  91. -(void) SetMode:(NSString*)mode;
  92. @property (strong,nonatomic) NSString* mode;
  93. -(void) SetSo:(NSString*)So;
  94. -(void) switchToPreviousVC;
  95. -(void) closeOrder;
  96. @property long wish_count;
  97. @property long cart_count;
  98. @property long port_count;
  99. @property bool can_show_price;
  100. @property (nonatomic,assign) bool can_see_price;
  101. @property bool can_create_portfolio;
  102. @property bool can_cancel_order;
  103. @property bool can_set_cart_price;
  104. @property bool can_create_order;
  105. @property bool can_delete_order;
  106. @property bool can_submit_order;
  107. @property bool can_set_tearsheet_price;
  108. @property bool can_update_contact_info;
  109. @property bool submit_order_logout;
  110. @property bool save_order_logout;
  111. @property bool alert_sold_in_quantities;
  112. @property(readonly) bool price_hidden;
  113. -(void) set_priceHidden:(bool)price_hidden;
  114. -(void) set_main_button_panel;
  115. -(void) update_count_mark;
  116. // downloader
  117. -(void) check_offline:(NSString*) ver useInternalAddress:(bool)buseinternaladdress parentvc:(UIViewController*) parent;
  118. @property (nonatomic, strong) SyncControlPanelViewController *settingUI;
  119. @property (nonatomic, strong) NSFileHandle *fileHandle;
  120. @property (nonatomic, strong) NSURLConnection *connection;
  121. @property double file_progress;
  122. @property double overall_progress;
  123. @property (strong, nonatomic) NSString* downloadlog;
  124. @property (strong, nonatomic) NSString* vid;
  125. @property bool downloading;
  126. -(void) add_downloadlog:(NSString*) newtext;
  127. @property (strong, nonatomic) NSMutableDictionary* download_task;
  128. @property int current_task;
  129. // printer
  130. @property (strong, nonatomic) NSString * printerURL;
  131. -(void) printPdf:(NSString*) url company:(NSString*)company send_to:(NSString*)send_to soid:(NSString*)soid content:(NSString*)content;
  132. @property (strong, nonatomic) NSMutableDictionary* OrderFilter;
  133. @property (nonatomic,strong) NSMutableDictionary *urgencyDic;
  134. @property (nonatomic,assign) BOOL can_create_backorder;
  135. - (void)checkLogin:(BOOL)reloadCurVC;
  136. @property (strong, nonatomic) NSString* uploadurl;
  137. @property (strong, nonatomic) NSString* address;
  138. @property (strong, nonatomic) NSString* downloadurl;
  139. @property (nonatomic,assign) BOOL compressFile;
  140. #ifdef SCANNER_ORDER
  141. @property (strong, nonatomic) NSDictionary* scan_model;
  142. @property (strong, nonatomic) NSArray* scan_model_key;
  143. @property (strong, nonatomic) NSString *price_group;
  144. @property (strong, nonatomic) NSArray *available_price_group;
  145. #endif
  146. @property (nonatomic,strong) NSDate *forgroundDate;
  147. #ifdef USE_BLE_SCANNER
  148. @property (nonatomic, strong) CBCentralManager *manager;
  149. @property (nonatomic, strong) CBPeripheral *peripheral;
  150. @property (strong ,nonatomic) CBCharacteristic *writeCharacteristic;
  151. @property (strong,nonatomic) NSMutableArray *nDevices;
  152. @property (strong,nonatomic) NSMutableArray *nServices;
  153. @property (strong,nonatomic) NSMutableArray *nCharacteristics;
  154. @property (strong,nonatomic) NSString *strBTLog;
  155. @property bool bAutoConnect;
  156. @property bool cbReady;
  157. @property bool bAppBTOn;
  158. @property bool bBTAuthorize;
  159. @property (strong,nonatomic) NSString *strDeviceName;
  160. @property (strong,nonatomic) NSString *strDeviceUUID;
  161. -(void) scanBLE;
  162. -(void) stopScanBLE;
  163. -(void) disconnectDevice;
  164. -(void)setBLEAutoReconnect:(bool) bAutoReconnect;
  165. -(void) enableBLE:(bool) bEnable;
  166. #endif
  167. #pragma mark newdownload
  168. @property (strong,nonatomic) NSURLSession *session;
  169. @property (strong,nonatomic) NSURLSessionDataTask* curr_task;
  170. -(void)handle_download1:(NSString *)url start:(bool) start type:(NSString*) type taskid:(int)taskidx;
  171. -(void) download_offline:(bool)start checkdiskspace:(bool)checkdiskspace; // 添加这个方法声明
  172. @end