新增快手广告接口调用

This commit is contained in:
huangjian
2021-09-26 16:38:19 +08:00
parent e7103148c8
commit ff13a38093
4 changed files with 57 additions and 2 deletions

View File

@@ -93,7 +93,7 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
UMConfigure.getOaid(this, oaid -> { UMConfigure.getOaid(this, oaid -> {
OaidUtil.setOaid(oaid); OaidUtil.setOaid(oaid);
if (first) ChannelPageModel.get().checkByteDanceAd("0"); if (first) ChannelPageModel.get().checkAd();
}); });
mBinding.tvSkip.setVisibility(View.VISIBLE); mBinding.tvSkip.setVisibility(View.VISIBLE);

View File

@@ -66,6 +66,22 @@ public class ChannelPageModel extends BaseModel implements IChannelPageModel {
.compose(RxHelper.handleSchAndExce()); .compose(RxHelper.handleSchAndExce());
} }
/**
*
*/
@Override
public void checkAd() {
if (BasicConfig.INSTANCE.isKwaiChannel()) {
checkKwaiAd("0");
}
if (BasicConfig.INSTANCE.isByteDanceChannel()) {
checkByteDanceAd("0");
}
}
/** /**
* @param evenType 暂时只有0 * @param evenType 暂时只有0
*/ */
@@ -83,6 +99,23 @@ public class ChannelPageModel extends BaseModel implements IChannelPageModel {
} }
} }
/**
* @param evenType 暂时只有0
*/
@Override
public void checkKwaiAd(String evenType) {
try {
api.checkKwaiAd(evenType,
NetworkUtils.getIPAddress(BasicConfig.INSTANCE.getAppContext()),
System.getProperty("http.agent"))
.compose(RxHelper.handleSchedulers())
.subscribe();
} catch (Exception e) {
e.printStackTrace();
}
}
private interface Api { private interface Api {
/** /**
@@ -106,6 +139,16 @@ public class ChannelPageModel extends BaseModel implements IChannelPageModel {
@Field("evenType") String evenType, @Field("evenType") String evenType,
@Field("ip") String ip, @Field("ip") String ip,
@Field("ua") String ua); @Field("ua") String ua);
/**
* 快手推广接口
*/
@FormUrlEncoded
@POST("/kuaishouAd/activeTrack")
Single<ServiceResult<ChannelPageInfo>> checkKwaiAd(
@Field("evenType") String evenType,
@Field("ip") String ip,
@Field("ua") String ua);
} }
} }

View File

@@ -15,5 +15,9 @@ public interface IChannelPageModel {
Single<InviteUserInfo> checkInviteUserInRoom(String inviteCode); Single<InviteUserInfo> checkInviteUserInRoom(String inviteCode);
void checkAd();
void checkByteDanceAd(String evenType); void checkByteDanceAd(String evenType);
void checkKwaiAd(String evenType);
} }

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.text.TextUtils;
import com.yizhuan.xchat_android_library.utils.cache.CacheClientFactory; import com.yizhuan.xchat_android_library.utils.cache.CacheClientFactory;
import com.yizhuan.xchat_android_library.utils.file.StorageUtils; import com.yizhuan.xchat_android_library.utils.file.StorageUtils;
@@ -84,6 +85,14 @@ public enum BasicConfig {
return channel; return channel;
} }
public boolean isByteDanceChannel() {
return !TextUtils.isEmpty(channel) && channel.contains("toutiao");
}
public boolean isKwaiChannel() {
return !TextUtils.isEmpty(channel) && channel.contains("kuaishou");
}
/** /**
* @return Application context * @return Application context
*/ */
@@ -263,5 +272,4 @@ public enum BasicConfig {
} }
} }