diff --git a/keyBoard/Class/Me/VC/MyVC.m b/keyBoard/Class/Me/VC/MyVC.m index 2984a11..02c4519 100644 --- a/keyBoard/Class/Me/VC/MyVC.m +++ b/keyBoard/Class/Me/VC/MyVC.m @@ -15,6 +15,7 @@ #import "KBFeedBackVC.h" #import "KBMyVM.h" #import "KBConsumptionRecordVC.h" +#import "KBHUD.h" @interface MyVC () @@ -123,6 +124,29 @@ [self.navigationController pushViewController:[KBNoticeVC new] animated:true]; }else if ([itemID isEqualToString:@"2"]){ + // 邀请 + if (!self.viewModel) { + self.viewModel = [[KBMyVM alloc] init]; + } + [KBHUD show]; + [self.viewModel fetchInviteCodeWithCompletion:^(KBInviteCodeModel * _Nullable inviteCode, NSError * _Nullable error) { + dispatch_async(dispatch_get_main_queue(), ^{ + [KBHUD dismiss]; + if (error) { + [KBHUD showInfo:error.localizedDescription ?: KBLocalized(@"Network error")]; + return; + } + + NSString *textToCopy = [NSString stringWithFormat:@"%@?code=%@",inviteCode.h5Link,inviteCode.inviteCode]; + if (textToCopy.length == 0) { + [KBHUD showInfo:KBLocalized(@"Failed")]; + return; + } + + UIPasteboard.generalPasteboard.string = textToCopy; + [KBHUD showInfo:KBLocalized(@"Copy Success")]; + }); + }]; }else if ([itemID isEqualToString:@"3"]){ [self.navigationController pushViewController:[KBFeedBackVC new] animated:true];