diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 4752cd0d7..da5fbc07e 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -25,6 +25,8 @@ public class IMLoginManager extends BaseCacheManager { private final static String KEY_USER_INFO = "keyUserInfo"; private static IMLoginManager manager; private IMLoginModel userInfo; + private final static String isNewUserGif = "isNewUserGif"; + private final static String isNewUserOne = "isNewUserOne"; //根据用户信息 @@ -37,20 +39,20 @@ public class IMLoginManager extends BaseCacheManager { } //新用戶是否送了禮物 public boolean isNewUserGif(){ - return getBoolean("isNewUserGif",false); + return getBoolean(isNewUserGif,false); } //新用戶是否送了禮物 public void setNewUserGif(boolean t){ - put("isNewUserGif",t); + put(isNewUserGif,t); } // 是否新用户第一次進直播間 public boolean isisNewUserOne(){ - return getBoolean("isNewUserOne",false); + return getBoolean(isNewUserOne,false); } //新用戶是否送了禮物 public void setisNewUserOne(boolean t){ - put("isNewUserOne",t); + put(isNewUserOne,t); } @@ -127,6 +129,8 @@ public class IMLoginManager extends BaseCacheManager { //删除用户登录信息 deleteByKey(KEY_USER_INFO); + deleteByKey(isNewUserGif); + deleteByKey(isNewUserOne); //用户对象置空 userInfo = null; manager = null; diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 22ba52537..2c1511aff 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -191,6 +191,8 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void main() { + + liveImDeletUtil = new LiveImDeletUtil(); if (getIntent().getIntExtra("isry", 0) == 1) { isRy = true; @@ -479,6 +481,8 @@ public class LiveAudienceActivity extends LiveActivity { mChatLevel = obj.getIntValue("speak_limit"); mDanMuLevel = obj.getIntValue("barrage_limit"); + EventBus.getDefault().post("close_login"); + EventBus.getDefault().post("oneUesrOver"); //进入直播间 AdjustEvent adjustEvent1 = new AdjustEvent("hiepcu"); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index f4c6544e5..e80ddd232 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -508,12 +508,12 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On public void onClick(View v) { int i = v.getId(); if (i == R.id.btn_send || i == R.id.btn_send_lian) { - if (ToolsButton.isFastDoubleClick() && mLiveGiftBean.getSwf().contains("svga")) { -// Log.e("tag","停"); + if(ToolsButton.isFastDoubleClick() && mLiveGiftBean.getTag()!=null&&mCount.equals("1")){ + ToastUtil.show("手速太快了"); + } else if (ToolsButton.isFastDoubleClick() && mLiveGiftBean.getSwf().contains("svga")) { ToastUtil.show("手速太快了"); } else { -// Log.e("tag","送"); - sendGift(); + sendGift(); } } else if (i == R.id.btn_choose) { showGiftCount(); diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java index d551a016f..7cd02634f 100644 --- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java @@ -620,7 +620,16 @@ public class LiveHttpUtil { .execute(callback); } - + /** + * 獲取新手任務 + * @param callback + */ + public static void getFrontTask(String Token,String uid,HttpCallback callback) { + HttpClient.getInstance().get("User.getFrontTask", "User.getFrontTask") + .params("token", Token) + .params("uid", uid) + .execute(callback); + } /** * 完成新手任務 diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java index 8ea38a215..9f36a6372 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -294,7 +294,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { mBannerList1.add(bannerBean); - LiveHttpUtil.getFrontTask(new HttpCallback() { + LiveHttpUtil.getFrontTask(IMLoginManager.get(mContext).getUserInfo().getToken(),""+IMLoginManager.get(mContext).getUserInfo().getId(),new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { JSONObject old_obj = JSON.parseObject(info[0]); diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index bf1e90f12..68362dd4b 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -85,8 +85,13 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.socket.SocketRyClient; import com.yunbao.main.R; import com.yunbao.main.dialog.LoginTipsDialog; +import com.yunbao.main.event.RegSuccessEvent; import com.yunbao.main.http.MainHttpUtil; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; + import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; @@ -97,28 +102,6 @@ import io.rong.message.TextMessage; import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; -//import com.facebook.AccessToken; -//import com.facebook.CallbackManager; -//import com.facebook.FacebookCallback; -//import com.facebook.FacebookException; -//import com.facebook.FacebookSdk; -//import com.facebook.Profile; -//import com.facebook.login.LoginManager; -//import com.facebook.login.LoginResult; - -//import com.linecorp.linesdk.LoginDelegate; -//import com.linecorp.linesdk.LoginListener; -//import com.linecorp.linesdk.Scope; -//import com.linecorp.linesdk.auth.LineAuthenticationParams; -//import com.linecorp.linesdk.auth.LineLoginApi; -//import com.linecorp.linesdk.auth.LineLoginResult; -//import com.linecorp.linesdk.widget.LoginButton; -//import com.google.android.gms.auth.api.signin.GoogleSignIn; -//import com.google.android.gms.auth.api.signin.GoogleSignInAccount; -//import com.google.android.gms.auth.api.signin.GoogleSignInClient; -//import com.google.android.gms.auth.api.signin.GoogleSignInOptions; -//import com.google.android.gms.common.api.ApiException; -//import com.google.android.gms.tasks.Task; /** * 入口 @@ -141,6 +124,13 @@ public class EntryActivity extends AppCompatActivity { private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer; private String kefuUrl = ""; + @Subscribe(threadMode = ThreadMode.MAIN) + public void close(String str) { + if ("close_login".equals(str)) { + this.finish(); + } + } + /** * 设置透明状态栏 */ @@ -180,6 +170,7 @@ public class EntryActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_entry); + Get_hash_key(); activity = this; Contexts = this; @@ -229,6 +220,8 @@ public class EntryActivity extends AppCompatActivity { } }); + EventBus.getDefault().register(this); + getPromoCode(); getUuidDevice(); AdjustEvent adjustEvent2 = new AdjustEvent("tyqsyf"); @@ -298,7 +291,6 @@ public class EntryActivity extends AppCompatActivity { ToastUtil.show(getResources().getString(R.string.user_login_outtime)); } }); -// requestPermission(); googleLoginSet(); twitterLoginSet(); @@ -466,6 +458,8 @@ public class EntryActivity extends AppCompatActivity { @SuppressLint("NewApi") @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { + Log.i("ttts1", requestCode + "a " + resultCode); + if (requestCode == 1001) {//line登录 LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data); Log.i("ttts", result.getResponseCode() + ""); @@ -532,13 +526,14 @@ public class EntryActivity extends AppCompatActivity { } } - @SuppressLint("SetTextI18n") private void updateUI() { boolean enableButtons = AccessToken.getCurrentAccessToken() != null; + ToastUtil.show(enableButtons+""); Profile profile = Profile.getCurrentProfile(); if (enableButtons && profile != null) { + ToastUtil.show(profile.getId()+""); LoginData data = new LoginData(); - data.setAvatar(profile.getProfilePictureUri(150, 150).toString()); +// data.setAvatar(profile.getProfilePictureUri(150, 150).toString()); data.setNickName(profile.getName()); data.setOpenID(AccessToken.getCurrentAccessToken().getUserId()); data.setType("facebook"); @@ -644,12 +639,13 @@ public class EntryActivity extends AppCompatActivity { mFirstLogin = obj.getIntValue("first_login") == 1; mShowInvite = obj.getIntValue("isagent") == 1; CommonAppConfig.getInstance().setLoginInfo(uid, token, true); - getBaseUserInfo(); //设置登录信息 IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class); IMLoginManager.get(activity).setupLoginUser(model); //融云连接服务器 RongcloudIMManager.connectIM(activity); + getBaseUserInfo(); + } else { Contexts.startActivity(new Intent(Contexts, BindUserActivity.class).putExtra("uid", uid).putExtra("token", token)); } @@ -669,7 +665,7 @@ public class EntryActivity extends AppCompatActivity { if (mFirstLogin) { //绑定广告渠道用户 AdjustEvent adjustEvent = new AdjustEvent("s1or0t"); - adjustEvent.addCallbackParameter("userid", "bar"); + adjustEvent.addCallbackParameter("userid", CommonAppConfig.getInstance().getUid()); Adjust.trackEvent(adjustEvent); //完成第三方登录 diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java index 6cd959c82..6f6cd545a 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -83,15 +83,22 @@ public class LoginActivity extends AbsActivity { static String phoneNum; static String pwd; private static Context Contexts; - static Activity activity; + Activity activity; @Override protected int getLayoutId() { return R.layout.activity_login; } + @Subscribe(threadMode = ThreadMode.MAIN) + public void onRegSuccessEvent(RegSuccessEvent e) { + if (!isFinishing()){ + finish(); + } + } @Override protected void main() { + EventBus.getDefault().register(this); mRoot = findViewById(R.id.root); Contexts = this; activity = this; @@ -148,7 +155,6 @@ public class LoginActivity extends AbsActivity { if (!otherLoginType) { findViewById(R.id.other_login_tip).setVisibility(View.INVISIBLE); } - EventBus.getDefault().register(this); getUuidDevice(); getPromoCode(); @@ -276,16 +282,13 @@ public class LoginActivity extends AbsActivity { mFirstLogin = obj.getIntValue("first_login") == 1; mShowInvite = obj.getIntValue("isagent") == 1; CommonAppConfig.getInstance().setLoginInfo(uid, token, true); - getBaseUserInfo(); - mFirebaseAnalytics.logEvent("FS_createdRole", null); - logger.logEvent("FB_createdRole"); //设置登录信息 IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class); IMLoginManager.get(activity).setupLoginUser(model); - //融云连接服务器 - RongcloudIMManager.connectIM(activity); - //友盟统计登录 -// MobclickAgent.onProfileSignIn(mLoginType, uid); + + getBaseUserInfo(); + mFirebaseAnalytics.logEvent("FS_createdRole", null); + logger.logEvent("FB_createdRole"); } else { ToastUtil.show(msg); @@ -299,12 +302,13 @@ public class LoginActivity extends AbsActivity { MainHttpUtil.getBaseInfo(new CommonCallback() { @Override public void callback(UserBean bean) { + //融云连接服务器 + RongcloudIMManager.connectIM(activity); //完成手机号密码登录 AdjustEvent adjustEvent1 = new AdjustEvent("4ncwlv"); mFirebaseAnalytics.logEvent("FS_login", null); logger.logEvent("FB_login"); Adjust.trackEvent(adjustEvent1); - ToastUtil.show(mFirstLogin+""); HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") .params("uid", CommonAppConfig.getInstance().getUid()) .params("token", CommonAppConfig.getInstance().getToken()) @@ -316,13 +320,10 @@ public class LoginActivity extends AbsActivity { MainActivity.forward(LoginActivity.this, false); gotoLive(obj.getString("anchor_id")); IMLoginManager.get(mContext).setisNewUserOne(true); - EntryActivity.activity.finish(); - activity.finish(); } else { MainActivity.forward(LoginActivity.this, false); - EntryActivity.activity.finish(); - activity.finish(); } + } }); @@ -330,6 +331,13 @@ public class LoginActivity extends AbsActivity { }); } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void close(String str) { + if ("close_login".equals(str)) { + this.finish(); + } + } /** * 三方登录 */ @@ -363,10 +371,7 @@ public class LoginActivity extends AbsActivity { mUuidDevice = DeviceUtils.getUniqueDeviceId(); } - @Subscribe(threadMode = ThreadMode.MAIN) - public void onRegSuccessEvent(RegSuccessEvent e) { - finish(); - } + @Override protected void onDestroy() { @@ -379,9 +384,7 @@ public class LoginActivity extends AbsActivity { CommonHttpUtil.cancel(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID); MainHttpUtil.cancel(MainHttpConsts.LOGIN_BY_THIRD); MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO); -// if (mLoginUtil != null) { -// mLoginUtil.release(); -// } + super.onDestroy(); } } diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 40cb68570..bd29d8fe4 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -243,7 +243,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Override protected void main() { - ConversationIMListManager.get(this); //谷歌支付 GoogleBillingUtil.setIsAutoAcknowledgePurchase(true);//设置自动确认购买 @@ -354,7 +353,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene mFristLoad = true; ConfigBean configBean = CommonAppConfig.getInstance().getConfig(); mUrlCsd = configBean.getCustomerServerUrl(); - getD(); init(); initTXIM(); mViewPager.setCurrentItem(0); @@ -744,7 +742,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //显示顶部商城tab时,显示底部tabGroup @Subscribe(threadMode = ThreadMode.MAIN) public void onViewPagerScroll(String str) { - if ("DownAnimaiton".equals(str)) { + if ("oneUesrOver".equals(str)) { + if(IMLoginManager.get(mContext).isisNewUserOne()==false) { + getD(); + } } } diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index bc221dc1c..c6e2ba7f4 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -276,11 +276,11 @@ public class RegisterActivity extends AbsActivity { } private void changeEnable() { - String phone = mEditPhone.getText().toString(); - String code = mEditCode.getText().toString(); - String pwd1 = mEditPwd1.getText().toString(); - String pwd2 = mEditPwd2.getText().toString(); - mBtnRegister.setEnabled(!TextUtils.isEmpty(phone) && !TextUtils.isEmpty(code) && !TextUtils.isEmpty(pwd1) && !TextUtils.isEmpty(pwd2)); +// String phone = mEditPhone.getText().toString(); +// String code = mEditCode.getText().toString(); +// String pwd1 = mEditPwd1.getText().toString(); +// String pwd2 = mEditPwd2.getText().toString(); +// mBtnRegister.setEnabled(!TextUtils.isEmpty(phone) && !TextUtils.isEmpty(code) && !TextUtils.isEmpty(pwd1) && !TextUtils.isEmpty(pwd2)); } private void showCountryCode() { @@ -307,6 +307,7 @@ public class RegisterActivity extends AbsActivity { mFirebaseAnalytics.logEvent("FS_phone_getcode", null); logger.logEvent("FB_phone_getcode"); } else if (i == R.id.btn_register) { + register(); AdjustEvent adjustEvent1 = new AdjustEvent("wrajax"); Adjust.trackEvent(adjustEvent1); @@ -314,7 +315,6 @@ public class RegisterActivity extends AbsActivity { mFirebaseAnalytics.logEvent("FS_phone_clickregister", null); logger.logEvent("FB_phone_clickregister"); - register(); } else if (i == R.id.btn_tip2) { WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1); } else if (i == R.id.btn_tip3) { @@ -485,16 +485,16 @@ public class RegisterActivity extends AbsActivity { JSONObject obj = JSON.parseObject(info[0]); String uid = obj.getString("id"); String token = obj.getString("token"); - mFirstLogin = obj.getIntValue("isreg") == 1; + mFirstLogin = obj.getIntValue("first_login") == 1; mShowInvite = obj.getIntValue("isagent") == 1; CommonAppConfig.getInstance().setLoginInfo(uid, token, true); - - getBaseUserInfo(); //设置登录信息 IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class); IMLoginManager.get(activity).setupLoginUser(model); //融云连接服务器 RongcloudIMManager.connectIM(activity); + getBaseUserInfo(); + } else { ToastUtil.show(msg); @@ -522,6 +522,10 @@ public class RegisterActivity extends AbsActivity { } if (bean != null) { if (mFirstLogin) { + //绑定广告渠道用户 + AdjustEvent adjustEvent = new AdjustEvent("s1or0t"); + adjustEvent.addCallbackParameter("userid", CommonAppConfig.getInstance().getUid()); + Adjust.trackEvent(adjustEvent); HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") .params("uid", CommonAppConfig.getInstance().getUid()) .params("token", CommonAppConfig.getInstance().getToken()) diff --git a/main/src/main/res/layout/activity_register.xml b/main/src/main/res/layout/activity_register.xml index 9cfe5f57b..fa2fc5da6 100644 --- a/main/src/main/res/layout/activity_register.xml +++ b/main/src/main/res/layout/activity_register.xml @@ -244,10 +244,12 @@ android:layout_marginRight="30dp" android:background="@drawable/border_fdbe40" android:gravity="center" + android:clickable="true" android:onClick="registerClick" android:text="註冊並登錄" android:textColor="@color/white" - android:textSize="16sp" /> + android:textSize="16sp" + android:focusable="true" />