123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- //
- // MSYOUPAIViewModel.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/2.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "MSYOUPAIViewModel.h"
- @interface MSYOUPAIViewModel ()
- /// 前往个人主页
- @property (nonatomic, strong, readwrite) RACSubject *gotoPersonalPageSubject;
- @end
- @implementation MSYOUPAIViewModel
- - (void)ym_initialize{
- [super ym_initialize];
-
- @weakify(self)
- [[self.gotoPersonalPageSubject takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id _Nullable value) {
- @strongify(self)
- if ([value intValue] != 0) {
- YMPersonalPageViewModel *personalPageVM = [[YMPersonalPageViewModel alloc]initWithParams:@{
- ParamsId:@([value intValue])
- }];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_PERSONAL_PAGE) withUserInfo:@{
- RouterViewModel:personalPageVM
- } completion:nil];
- }
- }];
- }
- /// 当前用户Id
- - (NSInteger)currentUserId{
- NSInteger userId = [[OCUserDefaults objectForKey:kUSER_ID] intValue];
- return userId;
- }
- - (BOOL)isFemaleGender{
- BOOL isFemaleGender = [OCUserDefaults boolForKey:kIS_FEMALE_GENDER];
- if (isFemaleGender) {
- return YES;
- } else {
- return NO;
- }
- }
- - (BOOL)isNeedGoddessCertified{
-
- BOOL isGoddessCertified = [OCUserDefaults boolForKey:kIS_GODDESS_CERTIFIED];
- if ([self isFemaleGender] && !isGoddessCertified) {
- YMTipsPopupView *customView = [[YMTipsPopupView alloc]init];
- customView.titleText = @"真人认证";
- customView.cancelTitle = @"暂不认证";
- customView.confirmTitle = @"去认证";
- [customView configutationWithTips:stringFormat(@"%@提倡真实交友,通过【真人认证】后才可以心动交友哦~",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]) TipsAlignment:NSTextAlignmentLeft IsHideTitle:NO IsHideSingleButton:YES];
- YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:nil popStyle:YMPopupStyleFade dismissStyle:YMDismissStyleFade];
- popupView.priority = 999;
- popupView.cornerRadius = adapt(10);
- popupView.rectCorners = UIRectCornerAllCorners;
- popupView.positionStyle = YMPositionStyleCenter;
- popupView.isHideBg = NO;
- popupView.bgAlpha = 0.3;
- @weakify(popupView)
- customView.buttonBlock = ^(BOOL isConfirm) {
- @strongify(popupView)
- if (isConfirm) {
- YMGoddessCertifiedProtocolViewModel *goddessCertifiedProtocolVM = [[YMGoddessCertifiedProtocolViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_GODDESS_CERTIFIED_PROTOCOL) withUserInfo:@{
- RouterViewModel:goddessCertifiedProtocolVM
- } completion:nil];
- }
- [popupView dismissWithStyle:YMDismissStyleFade duration:2.0];
- };
- [popupView pop];
- return YES;
- }else{
- return NO;
- }
- }
- - (BOOL)isNeedPurchaseMember{
- BOOL isVIP = [OCUserDefaults boolForKey:kIS_VIP];
- if (!isVIP) {
- YMMemberCenterViewModel *memberCenterVM = [[YMMemberCenterViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_MEMBER_CENTER) withUserInfo:@{
- RouterViewModel:memberCenterVM
- } completion:nil];
- return YES;
- }else{
- return NO;
- }
- }
- - (RACSubject *)gotoPersonalPageSubject{
- if (!_gotoPersonalPageSubject) {
- _gotoPersonalPageSubject = [RACSubject subject];
- }
- return _gotoPersonalPageSubject;
- }
- @end
|