uploadFileManager.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. //
  2. // uploadFileManager.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/11/15.
  6. //
  7. #import "uploadFileManager.h"
  8. #import <AssetsLibrary/AssetsLibrary.h>
  9. @implementation uploadFileManager
  10. static uploadFileManager * cur_uploadFileShareInstance = nil;
  11. +(uploadFileManager *)shareInstance;
  12. {
  13. static dispatch_once_t onceToken;
  14. dispatch_once(&onceToken, ^{
  15. cur_uploadFileShareInstance = [[uploadFileManager alloc] init];
  16. });
  17. return cur_uploadFileShareInstance;
  18. }
  19. - (id)init
  20. {
  21. self = [super init];
  22. if (self) {
  23. //[self initManager];
  24. }
  25. return self;
  26. }
  27. #pragma mark 读取数据库数据
  28. - (void)getDataInDatabaseFun:(BOOL)isReGet complete:(custom_complete_Arr)complete
  29. {
  30. if(_databaseArr && _databaseArr.count == 3 && !isReGet){
  31. complete(_databaseArr);
  32. return;
  33. }
  34. _databaseArr = [NSMutableArray new];
  35. KWeakSelf
  36. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
  37. [uploadFileDataModel bg_findAsync:upLoadFile_image_tableName limit:0 orderBy:nil desc:YES complete:^(NSArray * _Nullable array) {
  38. NSMutableArray *failArr = [NSMutableArray new];
  39. NSMutableArray *doneArr = [NSMutableArray new];
  40. NSMutableArray *otherArr = [NSMutableArray new];
  41. for (uploadFileDataModel * curModel in array) {
  42. //图片 和视频 还原
  43. if(curModel.curUploadFileType == uploadFileTypeImage){
  44. NSString*pathStr = [cachesFileManager getFilePathWithName:curModel.filename type:uploadFileTypeImage];
  45. curModel.imageData = [NSData dataWithContentsOfFile:pathStr];
  46. }
  47. else if(curModel.curUploadFileType == uploadFileTypeVideo){
  48. NSString*pathStr = [cachesFileManager getFilePathWithName:curModel.videoFirstImageName type:uploadFileTypeImage];
  49. curModel.imageData = [NSData dataWithContentsOfFile:pathStr];
  50. if(curModel.curUploadStateType != uploadStateDone){
  51. NSString*videoPathStr = [cachesFileManager getFilePathWithName:curModel.filename type:uploadFileTypeVideo];
  52. //curModel.videoData = [NSData dataWithContentsOfFile:videoPathStr];
  53. }
  54. }
  55. if(curModel.curUploadStateType == uploadStateFail){
  56. [failArr addObject:curModel];
  57. }
  58. else if(curModel.curUploadStateType == uploadStateDone){
  59. [doneArr addObject:curModel];
  60. }
  61. else{
  62. [otherArr addObject:curModel];
  63. }
  64. }
  65. [self->_databaseArr addObject:otherArr];
  66. [self->_databaseArr addObject:doneArr];
  67. [self->_databaseArr addObject:failArr];
  68. complete(self->_databaseArr);
  69. }];
  70. });
  71. }
  72. //把TZAssetModel 转成 我们需要上传的model
  73. - (void)handlTZAssetModelToUploadFileDataFunBy:(NSMutableArray*)indexPathsForSelectedItems complete:(custom_complete_Arr)complete
  74. {
  75. if(!indexPathsForSelectedItems && indexPathsForSelectedItems.count == 0){
  76. return;
  77. }
  78. if(!_fileModelDataArr){
  79. _fileModelDataArr = [NSMutableArray new];
  80. }
  81. self.curUploadModelNumbers = indexPathsForSelectedItems.count;
  82. for (TZAssetModel * model in indexPathsForSelectedItems) {
  83. uploadFileDataModel * curModel = [uploadFileDataModel new];
  84. curModel.asset = model.asset;
  85. curModel.localIdentifier = model.asset.localIdentifier;
  86. curModel.imageData = model.imageData;
  87. curModel.videoData = model.videoData;
  88. curModel.filename = [model.asset valueForKey:@"filename"];
  89. curModel.curUploadStateType = uploadStateWait;
  90. if(model.type == TZAssetModelMediaTypeVideo){
  91. curModel.curUploadFileType = uploadFileTypeVideo;
  92. [cachesFileManager getFileNameWithContent:curModel.videoData fileName:curModel.filename type:uploadFileTypeVideo];
  93. //curModel.totalBytes = [model.videoData length];
  94. curModel.totalBytes = model.totalBytes;
  95. curModel.videoData = [NSData new];//视频文件存储到文件后内存清空
  96. NSString *imgName1 = [curModel.filename stringByReplacingOccurrencesOfString:@"." withString:@"_"];
  97. curModel.videoFirstImageName = [[NSString alloc] initWithFormat:@"%@.png",imgName1];
  98. //第一帧图片
  99. [[PHImageManager defaultManager] requestImageDataForAsset:curModel.asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
  100. // 直接得到最终的 NSData 数据
  101. if (imageData) {
  102. curModel.imageData = imageData;
  103. [cachesFileManager getFileNameWithContent:curModel.imageData fileName:curModel.videoFirstImageName type:uploadFileTypeImage];;
  104. }
  105. }];
  106. //真正的视频数据
  107. // PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
  108. // options.version = PHVideoRequestOptionsVersionOriginal;
  109. // [[PHImageManager defaultManager] requestAVAssetForVideo:curModel.asset options:options resultHandler:^(AVAsset *asset, AVAudioMix *audioMix, NSDictionary *info) {
  110. // if ([asset isKindOfClass:[AVURLAsset class]]) {
  111. //
  112. // AVURLAsset* urlAsset = (AVURLAsset*)asset;
  113. // NSData *videoData = [NSData dataWithContentsOfURL:urlAsset.URL];
  114. //
  115. // if (videoData) {
  116. // curModel.videoData = videoData;
  117. // [cachesFileManager getFileNameWithContent:curModel.videoData fileName:curModel.filename type:uploadFileTypeVideo];
  118. // curModel.videoData = nil;
  119. // }
  120. // }
  121. // }];
  122. }
  123. else{
  124. curModel.curUploadFileType = uploadFileTypeImage;
  125. curModel.totalBytes = model.totalBytes;
  126. if(curModel.imageData)
  127. {
  128. [cachesFileManager getFileNameWithContent:curModel.imageData fileName:curModel.filename type:uploadFileTypeImage];
  129. }
  130. else{
  131. [[PHImageManager defaultManager] requestImageDataForAsset:curModel.asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
  132. // 直接得到最终的 NSData 数据
  133. if (imageData) {
  134. curModel.imageData = imageData;
  135. [cachesFileManager getFileNameWithContent:curModel.imageData fileName:curModel.filename type:uploadFileTypeImage];;
  136. }
  137. }];
  138. }
  139. }
  140. //[_fileModelDataArr addObject:curModel];
  141. //保存到数据库
  142. curModel.bg_tableName = upLoadFile_image_tableName;
  143. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
  144. [curModel bg_saveOrUpdateAsync:^(BOOL isSuccess) {
  145. HLog(@"%@ 写入 %@", curModel.filename, isSuccess ? @"成功":@"失败");
  146. }];
  147. });
  148. }
  149. KWeakSelf
  150. [self getDataInDatabaseFun:YES complete:^(NSMutableArray * _Nonnull Arr) {
  151. complete(Arr);
  152. [weakSelf handleUploadFileModelBg_idFun:Arr];
  153. }];
  154. }
  155. #pragma mark 处理当前的model 加上bg_id
  156. - (void)handleUploadFileModelBg_idFun:(NSMutableArray*)totalArr
  157. {
  158. if(!totalArr || totalArr.count != 3){
  159. return;
  160. }
  161. NSMutableArray *curArr = totalArr[0];
  162. //for (int i=0; i<_curUploadModelNumbers; i++)
  163. for (int i=0; i<curArr.count; i++)
  164. {
  165. uploadFileDataModel *bg_mod = curArr[i];
  166. [_fileModelDataArr addObject:bg_mod];
  167. }
  168. // for (int i=0; i<_fileModelDataArr.count; i++) {
  169. // uploadFileDataModel *bg_mod = _fileModelDataArr[i];
  170. //
  171. // for (uploadFileDataModel *data_mod in curArr) {
  172. // if([data_mod.filename isEqualToString:bg_mod.filename]){
  173. // bg_mod.bg_id = data_mod.bg_id;
  174. // //HLog(@"bg_id:%@",data_mod.bg_id);
  175. // break;
  176. // }
  177. // }
  178. // }
  179. [self beginUploadFileFun];
  180. }
  181. - (void)beginUploadFileFun
  182. {
  183. // if(_isUploadIngType && _reUploadIngSelectIndex <= 0){
  184. // return;
  185. // }
  186. _isSuspendType = NO;
  187. _isUploadIngType = YES;
  188. if(_reUploadIngSelectIndex > 0 && _reUploadIngSelectIndex < _fileModelDataArr.count){
  189. _curUploadFileDataModel = _fileModelDataArr[_reUploadIngSelectIndex];
  190. }
  191. else
  192. {
  193. _curUploadFileDataModel = _fileModelDataArr.firstObject;
  194. }
  195. if(!_curUploadFileDataModel){
  196. return;
  197. }
  198. if(_curUploadFileDataModel.curUploadFileType == uploadFileTypeImage){
  199. NSString*pathStr = [cachesFileManager getFilePathWithName:_curUploadFileDataModel.filename type:_curUploadFileDataModel.curUploadFileType];
  200. _curUploadFileDataModel.imageData = [NSData dataWithContentsOfFile:pathStr];
  201. if(_curUploadFileDataModel.imageData && _curUploadFileDataModel.imageData.length >0){
  202. [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileBeginNotification object:_curUploadFileDataModel];
  203. return;
  204. }
  205. }
  206. else{
  207. //NSString*pathStr = [cachesFileManager getFilePathWithName:_curUploadFileDataModel.filename type:uploadFileTypeVideo];
  208. if([cachesFileManager checkFileIsSaveState:_curUploadFileDataModel.filename withType:uploadFileTypeVideo]){
  209. [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileBeginNotification object:_curUploadFileDataModel];
  210. return;
  211. }
  212. }
  213. if(!_curUploadFileDataModel.asset){
  214. NSString *curLocalIdentifier = _curUploadFileDataModel.localIdentifier;
  215. PHFetchResult *fetchResult = [PHAsset fetchAssetsWithLocalIdentifiers:@[curLocalIdentifier] options:nil];
  216. PHAsset *asset = fetchResult.firstObject;
  217. _curUploadFileDataModel.asset = asset;
  218. }
  219. if(!_curUploadFileDataModel.asset){
  220. [self getDataWrongToChangeFailFun];
  221. return;
  222. }
  223. KWeakSelf
  224. if(_curUploadFileDataModel.curUploadFileType == uploadFileTypeImage)
  225. {
  226. if(!_curUploadFileDataModel.imageData || _curUploadFileDataModel.imageData.length == 0){
  227. [[PHImageManager defaultManager] requestImageDataForAsset:_curUploadFileDataModel.asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
  228. // 直接得到最终的 NSData 数据
  229. if (imageData) {
  230. self->_curUploadFileDataModel.imageData = imageData;
  231. [weakSelf afterGetImageDataFun];
  232. }
  233. else{
  234. [weakSelf getDataWrongToChangeFailFun];
  235. }
  236. }];
  237. }
  238. }
  239. else if(_curUploadFileDataModel.curUploadFileType == uploadFileTypeVideo){
  240. //第一帧图片
  241. [[PHImageManager defaultManager] requestImageDataForAsset:_curUploadFileDataModel.asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
  242. // 直接得到最终的 NSData 数据
  243. if (imageData) {
  244. self->_curUploadFileDataModel.imageData = imageData;
  245. [weakSelf afterGetImageDataInVideoFun];
  246. }
  247. }];
  248. //真正的视频数据
  249. PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
  250. options.version = PHVideoRequestOptionsVersionOriginal;
  251. [[PHImageManager defaultManager] requestAVAssetForVideo:_curUploadFileDataModel.asset options:options resultHandler:^(AVAsset *asset, AVAudioMix *audioMix, NSDictionary *info) {
  252. if ([asset isKindOfClass:[AVURLAsset class]]) {
  253. AVURLAsset* urlAsset = (AVURLAsset*)asset;
  254. BOOL isSuc = [cachesFileManager copyVideoItemAtPath:[urlAsset.URL path] fileName:_curUploadFileDataModel.filename error:nil];
  255. //NSData *videoData = [NSData dataWithContentsOfURL:urlAsset.URL];
  256. if (isSuc) {
  257. //self->_curUploadFileDataModel.videoData = videoData;
  258. [weakSelf afterGetVideoDataFun];
  259. }
  260. else{
  261. [weakSelf getDataWrongToChangeFailFun];
  262. }
  263. }
  264. }];
  265. }
  266. }
  267. #pragma mark 获取数据失败 报错
  268. - (void)getDataWrongToChangeFailFun
  269. {
  270. [self changeUploadFileState:uploadStateFail withDidUploadBytes:_curUploadFileDataModel.didUploadBytes withModel:_curUploadFileDataModel complete:^(BOOL isSuccess) {
  271. }];
  272. }
  273. #pragma mark 根据 asset 获取到图片数据
  274. - (void)afterGetImageDataFun
  275. {
  276. [cachesFileManager getFileNameWithContent:_curUploadFileDataModel.imageData fileName:_curUploadFileDataModel.filename type:uploadFileTypeImage];
  277. [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileBeginNotification object:_curUploadFileDataModel];
  278. }
  279. - (void)afterGetImageDataInVideoFun
  280. {
  281. [cachesFileManager getFileNameWithContent:_curUploadFileDataModel.imageData fileName:_curUploadFileDataModel.videoFirstImageName type:uploadFileTypeImage];
  282. }
  283. - (void)afterGetVideoDataFun
  284. {
  285. [cachesFileManager getFileNameWithContent:_curUploadFileDataModel.videoData fileName:_curUploadFileDataModel.filename type:uploadFileTypeVideo];
  286. _curUploadFileDataModel.videoData = nil;
  287. [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileBeginNotification object:_curUploadFileDataModel];
  288. }
  289. //修改文件上传的状态
  290. - (void)changeUploadFileState:(uploadStateType)curUploadStateType withDidUploadBytes:(long)didUpLoadBytes withModel:(uploadFileDataModel*)model complete:(custom_complete_B)complete
  291. {
  292. if(model.bg_id.integerValue == _curUploadFileDataModel.bg_id.integerValue){
  293. _curUploadFileDataModel.curUploadStateType = curUploadStateType;
  294. _curUploadFileDataModel.didUploadBytes = didUpLoadBytes;
  295. }
  296. model.curUploadStateType = curUploadStateType;
  297. model.didUploadBytes = didUpLoadBytes;
  298. if(!_isSuspendType || curUploadStateType == uploadStateSuspend){
  299. [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileRefreshNotification object:model];
  300. }
  301. if(curUploadStateType == uploadStateUploading){
  302. return;
  303. }
  304. //NSNumber * numberUploadState = nil;
  305. NSString* where = nil;
  306. // if(curUploadStateType == uploadStateDone)
  307. // {//只有上传中的才可能是完成的
  308. // numberUploadState = [NSNumber numberWithInt:uploadStateUploading];
  309. // where = [NSString stringWithFormat:@"where %@=%@ and %@=%@ ",bg_sqlKey(@"filename"),bg_sqlValue(_curUploadFileDataModel.filename),bg_sqlKey(@"curUploadStateType"),bg_sqlValue(numberUploadState)];
  310. // }
  311. // else
  312. // {//查找非上传完成的
  313. // numberUploadState = [NSNumber numberWithInt:uploadStateDone];
  314. // where = [NSString stringWithFormat:@"where %@=%@ and %@!=%@ ",bg_sqlKey(@"filename"),bg_sqlValue(_curUploadFileDataModel.filename),bg_sqlKey(@"curUploadStateType"),bg_sqlValue(numberUploadState)];
  315. // }
  316. where = [NSString stringWithFormat:@"where %@=%@ ",bg_sqlKey(@"bg_id"),bg_sqlValue(model.bg_id)];
  317. //HLog(@"ffff:%@",_curUploadFileDataModel.bg_id);
  318. [uploadFileDataModel bg_findAsync:upLoadFile_image_tableName where:where complete:^(NSArray * _Nullable array) {
  319. for (uploadFileDataModel * curModel in array) {
  320. curModel.curUploadStateType = curUploadStateType;
  321. curModel.didUploadBytes = didUpLoadBytes;
  322. if(curUploadStateType == uploadStateDone){
  323. curModel.videoData = [NSData new];
  324. if(curModel.curUploadFileType == uploadFileTypeVideo){
  325. [cachesFileManager removeItemAtPath:curModel.filename type:uploadFileTypeVideo error:nil];
  326. }
  327. }
  328. else if(curUploadStateType == uploadStateFail){
  329. }
  330. [curModel bg_saveOrUpdateAsync:^(BOOL isSuccess) {
  331. HLog(@"%@ 写入 %@", model.filename, isSuccess ? @"成功":@"失败");
  332. }];
  333. }
  334. complete(YES);
  335. }];
  336. }
  337. //暂停上传完成
  338. - (void)suspendUploadFileFun:(BOOL)isSuspendAll
  339. {
  340. // if(isSuspendAll){
  341. //
  342. // }
  343. if(!_fileModelDataArr || !_curUploadFileDataModel){
  344. return;
  345. }
  346. _isSuspendType = YES;
  347. _isUploadIngType = NO;
  348. [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileSuspendNotification object:nil];
  349. NSEnumerator *curArr = [_fileModelDataArr reverseObjectEnumerator];
  350. for (uploadFileDataModel*model in curArr) {
  351. [self changeUploadFileState:uploadStateSuspend withDidUploadBytes:model.didUploadBytes withModel:model complete:^(BOOL isSuccess) {
  352. }];
  353. }
  354. }
  355. //某个文件重新上传
  356. - (void)reUploadFileFunBy:(NSMutableArray*)Arr
  357. {
  358. if(!_fileModelDataArr){
  359. _fileModelDataArr = [NSMutableArray new];
  360. }
  361. _reUploadIngSelectIndex = 0;
  362. for (uploadFileDataModel*addModel in Arr) {
  363. BOOL needAddModel = YES;
  364. //for (uploadFileDataModel*preModel in _fileModelDataArr)
  365. for (int i=0;i< _fileModelDataArr.count;i++)
  366. {
  367. uploadFileDataModel*preModel = _fileModelDataArr[i];
  368. if(addModel.bg_id.integerValue == preModel.bg_id.integerValue
  369. || [addModel.localIdentifier isEqualToString:preModel.localIdentifier])
  370. {
  371. needAddModel = NO;
  372. if(_reUploadIngSelectIndex == 0){
  373. _reUploadIngSelectIndex = i;
  374. if(i==0){
  375. _reUploadIngSelectIndex = -1;
  376. }
  377. }
  378. break;
  379. }
  380. }
  381. if(needAddModel){
  382. [_fileModelDataArr addObject:addModel];
  383. }
  384. }
  385. //[_fileModelDataArr addObjectsFromArray:Arr];
  386. [self beginUploadFileFun];
  387. }
  388. - (void)uploadFileDoneFun
  389. {
  390. long totalSizeByte = _curUploadFileDataModel.totalBytes;
  391. [self changeUploadFileState:uploadStateDone withDidUploadBytes:totalSizeByte withModel:_curUploadFileDataModel complete:^(BOOL isSuccess) {
  392. [self->_fileModelDataArr removeObject:self->_curUploadFileDataModel];
  393. self->_isUploadIngType = NO;
  394. if(self->_fileModelDataArr.count > 0){
  395. [self beginUploadFileFun];
  396. }
  397. }];
  398. }
  399. //文件上传失败
  400. - (void)uploadFileFailFun
  401. {
  402. [self changeUploadFileState:uploadStateFail withDidUploadBytes:_curUploadFileDataModel.didUploadBytes withModel:_curUploadFileDataModel complete:^(BOOL isSuccess) {
  403. [self->_fileModelDataArr removeObject:self->_curUploadFileDataModel];
  404. if(self->_fileModelDataArr.count > 0){
  405. [self beginUploadFileFun];
  406. }
  407. else{
  408. self->_isUploadIngType = NO;
  409. }
  410. }];
  411. mainBlock(^{
  412. [[iToast makeText:NSLocalizedString(@"File_upload_fail",nil)] show];
  413. });
  414. }
  415. //删除本地数据库记录
  416. - (void)deleteUploadFileRecordBy:(NSMutableArray *)delArr complete:(custom_complete_B)complete
  417. {
  418. //逻辑待优化
  419. BOOL isSuc = false;
  420. for (uploadFileDataModel *uploadFileDataMod in delArr) {
  421. NSMutableString* where = [[NSMutableString alloc] initWithString:@"where "];
  422. NSString *curStr = [NSString stringWithFormat:@"%@=%@ ",bg_sqlKey(@"bg_id"),bg_sqlValue(uploadFileDataMod.bg_id)];
  423. [where appendString:curStr];
  424. isSuc = [uploadFileDataModel bg_delete:upLoadFile_image_tableName where:where];
  425. //删除本地图片
  426. if(isSuc){
  427. if(uploadFileDataMod.curUploadFileType == uploadFileTypeVideo){
  428. [cachesFileManager removeItemAtPath:uploadFileDataMod.videoFirstImageName type:uploadFileTypeImage error:nil];
  429. [cachesFileManager removeItemAtPath:uploadFileDataMod.filename type:uploadFileTypeVideo error:nil];
  430. }
  431. else{
  432. [cachesFileManager removeItemAtPath:uploadFileDataMod.filename type:uploadFileTypeImage error:nil];
  433. }
  434. }
  435. }
  436. complete(isSuc);
  437. //继续下一个
  438. if(_fileModelDataArr){
  439. [_fileModelDataArr removeObject:_curUploadFileDataModel];
  440. _isUploadIngType = NO;
  441. if(_fileModelDataArr.count >=1){
  442. [self beginUploadFileFun];
  443. }
  444. }
  445. }
  446. @end