From 58da905ade15526bce270f520d31ba0e834b012a Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Thu, 11 Dec 2025 17:36:16 +0800 Subject: [PATCH] 1 --- keyBoard/Class/Home/VM/KBHomeVM.m | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/keyBoard/Class/Home/VM/KBHomeVM.m b/keyBoard/Class/Home/VM/KBHomeVM.m index ae20ef0..5fad69b 100644 --- a/keyBoard/Class/Home/VM/KBHomeVM.m +++ b/keyBoard/Class/Home/VM/KBHomeVM.m @@ -12,10 +12,12 @@ #import "KBHUD.h" #import "KBBizCode.h" #import "KBAPI.h" +#import "KBMyVM.h" @interface KBHomeVM () @property (nonatomic, copy, readwrite, nullable) NSArray *rankList; @property (nonatomic, copy, readwrite, nullable) NSArray *tagList; +@property (nonatomic, strong) KBMyVM *myVM; @end @implementation KBHomeVM @@ -208,10 +210,28 @@ // } // }]; [[KBNetworkManager shared] POST:API_CHARACTER_ADD_USER_CHARACTER jsonBody:params headers:nil autoShowBusinessError:false completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) { + if (!error) { + [self refreshUserCharacterCacheForKeyboard]; + } if (completion) { completion(error == nil, error); } }]; } +- (void)refreshUserCharacterCacheForKeyboard { + [self.myVM fetchCharacterListByUserWithCompletion:^(NSArray * _Nonnull characterArray, NSError * _Nullable error) { + if (error) { + NSLog(@"[KBHomeVM] refresh user characters failed: %@", error); + } + }]; +} + +- (KBMyVM *)myVM { + if (!_myVM) { + _myVM = [[KBMyVM alloc] init]; + } + return _myVM; +} + @end