|
|
@@ -52,6 +52,7 @@ import com.sheep.gamegroup.module.login.ChangePasswordAct;
|
|
|
import com.sheep.gamegroup.module.login.LoginAct;
|
|
|
import com.sheep.gamegroup.module.plugin.model.Plugin;
|
|
|
import com.sheep.gamegroup.module.plugin.util.SheepPluginUtil;
|
|
|
+import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsCheckResq;
|
|
|
import com.sheep.gamegroup.util.share.ShareLinkConfig;
|
|
|
import com.sheep.gamegroup.view.activity.ActApprenticeRedPacket;
|
|
|
import com.sheep.gamegroup.view.activity.ActArticleComment;
|
|
|
@@ -165,6 +166,9 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
|
|
|
+import io.reactivex.Observable;
|
|
|
+import io.reactivex.ObservableEmitter;
|
|
|
+import io.reactivex.ObservableOnSubscribe;
|
|
|
import io.reactivex.ObservableSource;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.functions.Function;
|
|
|
@@ -965,8 +969,8 @@ public class Jump2View {
|
|
|
}
|
|
|
//检查url是否是http开头并添加
|
|
|
if (!url.startsWith("http")) {
|
|
|
- if(url.contains("://")){
|
|
|
- if(tryGotoDeepLink(url)){
|
|
|
+ if (url.contains("://")) {
|
|
|
+ if (tryGotoDeepLink(url)) {
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
@@ -979,8 +983,10 @@ public class Jump2View {
|
|
|
intent.putExtra(IJumpWeb.KEY_NEEDJSINTERACT, true);
|
|
|
context.startActivity(intent);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 尝试通过深度链接跳转应用
|
|
|
+ *
|
|
|
* @param url
|
|
|
*/
|
|
|
public boolean tryGotoDeepLink(String url) {
|
|
|
@@ -998,6 +1004,7 @@ public class Jump2View {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 跳到web页面
|
|
|
*
|
|
|
@@ -1013,8 +1020,8 @@ public class Jump2View {
|
|
|
}
|
|
|
//检查url是否是http开头并添加
|
|
|
if (!url.startsWith("http")) {
|
|
|
- if(url.contains("://")){
|
|
|
- if(tryGotoDeepLink(url)){
|
|
|
+ if (url.contains("://")) {
|
|
|
+ if (tryGotoDeepLink(url)) {
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
@@ -1496,36 +1503,59 @@ public class Jump2View {
|
|
|
if (SysAppUtil.isNewSmallSheep()) {//新版本只显示引导页面,不展示弹窗和开屏广告
|
|
|
return;
|
|
|
}
|
|
|
- CommonUtil.getInstance().callActionWithUserInfo(new Action1<UserEntity>() {
|
|
|
- @Override
|
|
|
- public void call(UserEntity userEntity) {
|
|
|
- if(userEntity.alreadyFinishAllNewTask() && !userEntity.alreadyExchangeCoupon()){//已经完成所有新手任务且没有兑换过优惠券时,显示商城优惠券
|
|
|
- Advertising advertising = new Advertising();
|
|
|
- advertising.setName("兑换商城优惠券,优惠多多");
|
|
|
+ CommonUtil.getInstance().callActionWithUserInfo(userEntity ->
|
|
|
+ Observable.create((ObservableOnSubscribe<Boolean>) emitter -> {
|
|
|
+ if (userEntity.alreadyFinishAllNewTask()) {//已经完成所有新手任务
|
|
|
+ //没有兑换过优惠券时,显示商城优惠券
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getYfShopReceiveCouponsCheck(ReceiveCouponsCheckResq.TYPE_NEW_TASK)
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ emitter.onNext(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ emitter.onNext(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ emitter.onNext(true);
|
|
|
+ }
|
|
|
+ }).subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new AbsObserver<Boolean>() {
|
|
|
+ @Override
|
|
|
+ public void onNext(Boolean showAd) {
|
|
|
+ if (showAd) {//显示开屏广告
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getAdvertising(2)
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(activity) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ Advertising advertising = baseMessage.getData(Advertising.class);
|
|
|
+ ViewUtil.showHalfScreenAd(activity, advertising, container);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ tryShowReservation(activity);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {//显示商城
|
|
|
+ Advertising advertising = new Advertising();
|
|
|
+ advertising.setName("兑换商城优惠券,优惠多多");
|
|
|
// advertising.setDesc("点击兑换商城优惠券,优惠多多");
|
|
|
- advertising.setDisplay_type(Advertising.TYPE_IMG);
|
|
|
- advertising.setDisplay_src(ViewUtil.getNetImgByName("homepage_xinshourw"));
|
|
|
- advertising.setLinkType(IDConstant.JUMP_EXCHANGE_COUPON);
|
|
|
- ViewUtil.showHalfScreenAd(activity, advertising, container);
|
|
|
- } else {
|
|
|
- SheepApp.getInstance().getNetComponent().getApiService().getAdvertising(2)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(activity) {
|
|
|
- @Override
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
- Advertising advertising = baseMessage.getData(Advertising.class);
|
|
|
+ advertising.setDisplay_type(Advertising.TYPE_IMG);
|
|
|
+ advertising.setDisplay_src(ViewUtil.getNetImgByName("homepage_xinshourw"));
|
|
|
+ advertising.setLinkType(IDConstant.JUMP_EXCHANGE_COUPON);
|
|
|
ViewUtil.showHalfScreenAd(activity, advertising, container);
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
- tryShowReservation(activity);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ }
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
public void tryShowReservation(final Activity activity) {
|