Commit 68b1d15e by ludi

Merge branch 'feature/邀请有奖' of http://git.yabolive.net:88/pidan/FuSiLive into feature/邀请有奖

parents 9300913a 9adafae2
......@@ -229,7 +229,7 @@
}
if (![NSString isNullWithString:serverOpenUrlString]) {
[[FUSAPIDNSManager shareInstance] setOpenUrl:serverBigcdnUrlString];
[[FUSAPIDNSManager shareInstance] setOpenUrl:serverOpenUrlString];
}
if (![NSString isNullWithString:serverImageDownUrlString]) {
......
......@@ -13,12 +13,17 @@
#import "FUSRouter.h"
static const NSString *FUSCidUDKey = @"FUSCidUDKey";
#pragma mark -
#pragma mark - private interfaces
@interface FUSFuSiWebConfig : FUSWebConfig
@end
@interface FUSFuSiAPPConfig : FUSAPPConfig
@property (nonatomic, copy) NSString *privateCid;
@end
@interface FUSFuSiSDKConfig : FUSSDKConfig
......@@ -92,7 +97,20 @@
/// App Cid
- (NSString *)appCid {
return @"iosFusi";
if ([NSString isNullWithString:_privateCid]) {
_privateCid = [[NSUserDefaults standardUserDefaults] objectForKey:FUSCidUDKey];
if ([NSString isNullWithString:_privateCid]) {
_privateCid = @"iosFusi";
}
}
return _privateCid;
}
- (void)setAppCid:(NSString *)appCid {
if ([NSString isNullWithString:_privateCid] == NO) {
[[NSUserDefaults standardUserDefaults] setObject:appCid forKey:FUSCidUDKey];
_privateCid = appCid;
}
}
/// 针对特定接口返回的数据进行不同的解析
......
......@@ -8,6 +8,14 @@
#import "FUSBaseViewController.h"
typedef NS_ENUM(NSInteger, DebugEnv){
DebugEnvProduct = 1, // 正式服生产环境
DebugEnvTest = 2, // 测试服开发环境
DebugEnvPreProduct = 3, // 预生产环境
DebugEnvCustom = 4, // 自定义开发环境
DebugEnvTestView = 5, // 测试控制器
};
@interface FUSDebugEnvViewController : FUSBaseViewController
@end
......@@ -16,14 +16,6 @@
#import "FUSChatPublicDefine.h"
typedef NS_ENUM(NSInteger, DebugEnv){
DebugEnvProduct = 1, // 正式服生产环境
DebugEnvTest = 2, // 测试服开发环境
DebugEnvPreProduct = 3, // 预生产环境
DebugEnvCustom = 4, // 自定义开发环境
DebugEnvTestView = 5, // 测试控制器
};
@interface FUSDebugEnvViewController ()
@property (weak, nonatomic) IBOutlet UILabel *currentEnvLabel;
......
......@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy, readonly) NSString *appPKG;
/// App cid
@property (nonatomic, copy, readonly) NSString *appCid;
@property (nonatomic, copy) NSString *appCid;
/// APP状态
@property (nonatomic, assign) BOOL isBackground;
......
......@@ -191,6 +191,7 @@
E4508BFDD31A448835C4240A /* [CP] Embed Pods Frameworks */,
FB49A0F918199836D41DAF4D /* [CP] Copy Pods Resources */,
BED3D2C32C58DC7A0028E28F /* Embed PlugIns */,
D22E79862D9A863C00A3E6FC /* ShellScript */,
);
buildRules = (
);
......@@ -276,6 +277,23 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
D22E79862D9A863C00A3E6FC /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 12;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"${CONFIGURATION}\" = \"Debug\" ]; then\n # 获取当前Build版本号并自增\n buildNumber=$((CURRENT_PROJECT_VERSION + 1))\n # 更新项目设置中的版本号变量\n /usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"${PROJECT_DIR}/${INFOPLIST_FILE}\"\n # 同步到项目配置文件(确保后续构建使用新值)\n agvtool new-version -all $buildNumber >/dev/null 2>&1\nfi\n";
};
E4508BFDD31A448835C4240A /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......@@ -466,7 +484,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 5;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO;
......@@ -722,7 +740,7 @@
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "FuSiLive/Classes/FusiLive-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
......@@ -734,7 +752,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 5;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO;
......@@ -999,7 +1017,7 @@
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "FuSiLive/Classes/FusiLive-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
......
......@@ -74,7 +74,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<string>5</string>
<key>FacebookAdvertiserIDCollectionEnabled</key>
<true/>
<key>FacebookAppID</key>
......
......@@ -941,6 +941,7 @@
BEDEDC4E2C66076900B4B0B0 /* FUSSingleDailyCheckInView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC3A2C66075400B4B0B0 /* FUSSingleDailyCheckInView.xib */; };
BEF0A6142CF5C4E200C0578D /* FUSSocialBindSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEF0A6132CF5C4E200C0578D /* FUSSocialBindSettingViewController.m */; };
BEF0A6152CF5C4E200C0578D /* FUSSocialBindSettingViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BEF0A6122CF5C4E200C0578D /* FUSSocialBindSettingViewController.h */; };
D22E79852D9A83D600A3E6FC /* FUSAutoBindHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22E79842D9A83D600A3E6FC /* FUSAutoBindHelper.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -1885,6 +1886,7 @@
BEF0A6122CF5C4E200C0578D /* FUSSocialBindSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSSocialBindSettingViewController.h; sourceTree = "<group>"; };
BEF0A6132CF5C4E200C0578D /* FUSSocialBindSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSSocialBindSettingViewController.m; sourceTree = "<group>"; };
C73EF9B6903BB9ABD9479E07 /* Pods-FUSUserCenterModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSUserCenterModule.release.xcconfig"; path = "Target Support Files/Pods-FUSUserCenterModule/Pods-FUSUserCenterModule.release.xcconfig"; sourceTree = "<group>"; };
D22E79842D9A83D600A3E6FC /* FUSAutoBindHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSAutoBindHelper.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -2052,6 +2054,7 @@
00B45E1F2D93A86D00FF138F /* BindAgentVC */ = {
isa = PBXGroup;
children = (
D22E79842D9A83D600A3E6FC /* FUSAutoBindHelper.swift */,
00B45E1C2D93A86D00FF138F /* FUSBindAgentInputCodeViewController.swift */,
00B45E1D2D93A86D00FF138F /* FUSBindAgentSuccessPopView.swift */,
00B45E1E2D93A86D00FF138F /* FUSBindAgentViewController.swift */,
......@@ -4552,6 +4555,7 @@
BE78CB3D2C538D7E00F38855 /* FUSLoginFailReportCell.m in Sources */,
BE78CB572C538D7E00F38855 /* FUSReportViewController.m in Sources */,
BE78CB832C538D7E00F38855 /* FUSMediaRecordPreviewView.m in Sources */,
D22E79852D9A83D600A3E6FC /* FUSAutoBindHelper.swift in Sources */,
BE78CBB32C538D7E00F38855 /* FUSMyZoneTableView.m in Sources */,
00B778672D12DC21003D7F56 /* FUSBackpackMotorCell.swift in Sources */,
BEDEDC3E2C66075400B4B0B0 /* FUSCheckInListModel.m in Sources */,
......
//
// FUSAutoBindHelper.swift
// Common
//
// Created by pierce on 2023/9/12.
//
import UIKit
import FUSFoundation
import FUSCommon
import RxSwift
import RxCocoa
private let FUSAutoBindHelperFirstCallUDKey = "FUSAutoBindHelperFirstCallUDKey"
@objcMembers public class FUSAutoBindHelper: NSObject {
@objc public static var shared = FUSAutoBindHelper()
private var disposeBag = DisposeBag()
var webView:FUSWKWebView?
@objc public func fus_loadAutoBindDatas(_ finishHandler:(()->Void)? = nil) {
var time = UserDefaults.standard.integer(forKey: FUSAutoBindHelperFirstCallUDKey)
if time <= 0 {
time = Int(Date().timeIntervalSince1970)
UserDefaults.standard.setValue(time, forKey: FUSAutoBindHelperFirstCallUDKey)
}
if (FUSConfig.sharedInstanced().appConfigs.appCid != "iosFusi"/// 已经设置过了,就没必要去取了
|| (time - Int(Date().timeIntervalSince1970)) > 7 * 24 * 60 * 60)///如果7天都没设置,也没必要去取了
{
finishHandler?()
return
}
webView?.removeFromSuperview()
webView = FUSWKWebView(frame: .init(x: 0, y: 0, width: 1, height: 1))
webView?.isUserInteractionEnabled = false
webView?.clearCache = false
webView?.backgroundColor = .clear
webView?.alpha = 0.1
if let webView = webView {
UIApplication.shared.keyWindow?.addSubview(webView)
}
var webUrl = "https://events.yabolive.net/fingersCompare.html"
let env = DebugEnv(rawValue: UserDefaults.standard.integer(forKey: CURRENT_DEBUG_ENV))
if env == .test {
webUrl = "https://ceshi.yabolive.tv/fingersCompare.html"
}
webView?.configWebView(withWebUrl: webUrl)
webView?.webEventHelper.webCidEventHandler = { [weak self] dataDict, cid in
guard let self = self else { return }
// 自动绑定回调
if cid == FUSJsWebCidType.typeAutoBind.rawValue {
let cid = (dataDict?["channelId"] as? String) ?? ""
let agentCode = (dataDict?["agentUid"] as? String) ?? ""
let bindType = (dataDict?["bindType"] as? String) ?? ""
// let fingerprintId = (dataDict?["fingerprintId"] as? String) ?? ""
if isValidString(cid) {
FUSConfig.sharedInstanced().appConfigs.appCid = cid
}
if isValidString(agentCode) {
FUSCacheDataShare.shareStore().agentCode = agentCode
}
if isValidString(bindType) {
FUSCacheDataShare.shareStore().bindType = bindType
}
finishHandler?()
self.FUS_cleanAutoBindHelper()
}
}
webView?.loadingStateChangedHandler = { [weak self] isLoading, isSucceed in
guard let self = self else { return }
if isLoading == false && isSucceed == true {
if (FUSConfig.sharedInstanced().appConfigs.appCid != "iosFusi"/// 已经设置过了,就没必要去取了
|| (time - Int(Date().timeIntervalSince1970)) > 7 * 24 * 60 * 60)///如果7天都没设置,也没必要去取了
{
finishHandler?()
return
}
let pastStr = UIPasteboard.general.string ?? ""
let jsString = "useJSClipboard_('\(pastStr)')"
self.webView?.wkWebView.evaluateJavaScript(jsString)
} else if isLoading == false && isSucceed == false {
finishHandler?()
self.FUS_cleanAutoBindHelper()
}
}
}
func FUS_cleanAutoBindHelper() {
self.webView?.removeFromSuperview()
FUSAutoBindHelper.shared = FUSAutoBindHelper()
}
}
......@@ -171,7 +171,8 @@
- (void)viewDidLoad
{
[super viewDidLoad];
[[FUSAutoBindHelper shared] fus_loadAutoBindDatas:^{}];
_isFirstSendVerifyCode = YES;
// 初始化View
......@@ -1124,27 +1125,28 @@
通过OpenInstall 获取邀请码
*/
- (void)getAgentCode {
// 取一键唤醒的数据
if (![NSString isNull:[FUSCacheDataShare shareStore].agentCode]) {
_inviteCodeTextField.text = [FUSCacheDataShare shareStore].agentCode;
_inviteCodeTextField.enabled = NO;
self.inviteCodeTextField.text = [FUSCacheDataShare shareStore].agentCode;
self.inviteCodeTextField.enabled = NO;
// 获取邀请人名字
[self fus_getAgentName];
}
// 取一键唤醒的数据
if (![NSString isNull:[FUSCacheDataShare shareStore].bindType]) {
_bindType = [FUSCacheDataShare shareStore].bindType;
self.bindType = [FUSCacheDataShare shareStore].bindType;
}
// 获取到邀请码
if (![NSString isNull:[FUSCacheDataShare shareStore].agentCode]) {
// 有邀请码不显示
_inviteCodeBgView.hidden = YES;
_inviteCodeBgHeightConstaint.constant = 0;
_inviteCodeTopConstaint.constant = 0;
_registerBtnTopConstraint.constant = -_inviteCodeBgView.height + 18;
_invitePeopleNameLabel.hidden = YES;
self.inviteCodeBgView.hidden = YES;
self.inviteCodeBgHeightConstaint.constant = 0;
self.inviteCodeTopConstaint.constant = 0;
self.registerBtnTopConstraint.constant = -self.inviteCodeBgView.height + 18;
self.invitePeopleNameLabel.hidden = YES;
}else { // 没有邀请码
__weak typeof(self) weakSelf = self;
// 判断设备有没有被注册
......
......@@ -40,6 +40,8 @@
#import "FUSStartPageSplashView.h"
#import <FUSUserCenterModule/FUSUserCenterModule-Swift.h>
#define BG_VIEW_STAYDURATION 5
@interface FUSStartPageViewController () <ASAuthorizationControllerDelegate,ASAuthorizationControllerPresentationContextProviding>
......@@ -1022,6 +1024,7 @@
}
- (void)getAgentBindType {
if (![NSString isNull:[FUSCacheDataShare shareStore].agentCode]) {
self.agentCode = [FUSCacheDataShare shareStore].agentCode;
}
......@@ -1029,7 +1032,6 @@
if (![NSString isNull:[FUSCacheDataShare shareStore].bindType]) {
self.bindType = [FUSCacheDataShare shareStore].bindType;
}
}
// failType: 注册登录方式(0:手机号、2:微信、4:Google、5:twitter、6:facebook、8:line)
......
......@@ -565,6 +565,9 @@
[self checkAppStatus];
[[FUSKeyboardShowHelper sharedInstance] star];
dispatch_async(dispatch_get_main_queue(), ^{
[[FUSAutoBindHelper shared] fus_loadAutoBindDatas:^{}];
});
return YES;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment