Widget _buildLogoutBtn(BuildContext context) { return(new CustomButton( padding: EdgeInsets.zero, onPressed: () => { ActionSheetUtils.showModalActionSheet(new ActionSheet( title: "确定退出当前账号吗?", items: new List <ActionSheetItem> { new ActionSheetItem("退出", ActionType.destructive, () => { this.widget.actionModel.logout(); JPushPlugin.deleteJPushAlias(); }), new ActionSheetItem("取消", ActionType.cancel) } )); }, child: new Container( height: 60, decoration: new BoxDecoration( CColors.White ), child: new Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Text( "退出登录", style: CTextStyle.PLargeError ) } ) ) )); }
public static object loginByWechat(string code) { return(new ThunkAction <AppState>((dispatcher, getState) => { return LoginApi.LoginByWechat(code) .Then(loginInfo => { var user = new User { id = loginInfo.userId, fullName = loginInfo.userFullName, avatar = loginInfo.userAvatar, title = loginInfo.title, coverImage = loginInfo.coverImageWithCDN }; var dict = new Dictionary <string, User> { { user.id, user } }; dispatcher.dispatch(new UserMapAction { userMap = dict }); dispatcher.dispatch(new LoginByWechatSuccessAction { loginInfo = loginInfo }); UserInfoManager.saveUserInfo(loginInfo); AnalyticsManager.LoginEvent("wechat"); AnalyticsManager.AnalyticsLogin("wechat", loginInfo.userId); JPushPlugin.setJPushAlias(loginInfo.userId); }); })); }
void OnApplicationFocus(bool hasFocus) { if (Application.isEditor) { return; } if (hasFocus) { using (WindowProvider.of(GlobalContext.context).getScope()) { AnalyticsManager.foucsTime = DateTime.UtcNow.ToString(); } } else { using (WindowProvider.of(GlobalContext.context).getScope()) { JPushPlugin.clearIconBadge(); if (AnalyticsManager.foucsTime.isNotEmpty()) { AnalyticsManager.AnalyticsActiveTime( (DateTime.UtcNow - DateTime.Parse(AnalyticsManager.foucsTime)).Milliseconds); AnalyticsManager.foucsTime = null; } } } }
public static object loginByEmail() { return(new ThunkAction <AppState>((dispatcher, getState) => { var email = getState().loginState.email; var password = getState().loginState.password; return LoginApi.LoginByEmail(email, password) .Then(loginInfo => { var user = new User { id = loginInfo.userId, fullName = loginInfo.userFullName, avatar = loginInfo.userAvatar, title = loginInfo.title, coverImage = loginInfo.coverImageWithCDN }; var dict = new Dictionary <string, User> { { user.id, user } }; dispatcher.dispatch(new UserMapAction { userMap = dict }); dispatcher.dispatch(new LoginByEmailSuccessAction { loginInfo = loginInfo }); dispatcher.dispatch(new MainNavigatorPopAction()); dispatcher.dispatch(new CleanEmailAndPasswordAction()); UserInfoManager.saveUserInfo(loginInfo); AnalyticsManager.LoginEvent("email"); AnalyticsManager.AnalyticsLogin("email", loginInfo.userId); JPushPlugin.setJPushAlias(loginInfo.userId); }); })); }
static void pushPage() { var splash = SplashManager.getSplash(); AnalyticsManager.ClickSplashPage(splash.id, splash.name, splash.url); Router.navigator.pushReplacementNamed(MainNavigatorRoutes.Main); JPushPlugin.openUrl(splash.url); }
protected override void Update() { base.Update(); if (!Application.isEditor) { JPushPlugin.addListener(); } }
public static void clearUserInfo() { if (PlayerPrefs.HasKey(_userInfo)) { PlayerPrefs.DeleteKey(_userInfo); } JPushPlugin.deleteJPushAlias(); }
public static void clearUserInfo() { if (PlayerPrefs.HasKey(key: UserInfoKey)) { PlayerPrefs.DeleteKey(key: UserInfoKey); } JPushPlugin.registerHmsToken(); }
public static object loginByWechat(string code) { return(new ThunkAction <AppState>((dispatcher, getState) => { return LoginApi.LoginByWechat(code: code) .Then(loginInfo => { CustomDialogUtils.hiddenCustomDialog(); var user = new User { id = loginInfo.userId, fullName = loginInfo.userFullName, avatar = loginInfo.userAvatar, title = loginInfo.title, coverImage = loginInfo.coverImageWithCDN }; var dict = new Dictionary <string, User> { { user.id, user } }; dispatcher.dispatch(new UserMapAction { userMap = dict }); dispatcher.dispatch(new LoginByWechatSuccessAction { loginInfo = loginInfo }); dispatcher.dispatch(fetchChannels(1)); dispatcher.dispatch(fetchCreateChannelFilter()); UserInfoManager.saveUserInfo(loginInfo); AnalyticsManager.LoginEvent("wechat"); AnalyticsManager.AnalyticsLogin("wechat", loginInfo.userId); JPushPlugin.setJPushAlias(loginInfo.userId); if (loginInfo.anonymous) { LoginScreen.navigator.pushReplacementNamed(routeName: LoginNavigatorRoutes .WechatBindUnity); } else { dispatcher.dispatch(new MainNavigatorPopAction()); EventBus.publish(sName: EventBusConstant.login_success, new List <object> { loginInfo.userId }); } }) .Catch(error => { CustomDialogUtils.hiddenCustomDialog(); dispatcher.dispatch(new LoginByWechatFailureAction()); }); })); }
public static object loginByEmail() { return(new ThunkAction <AppState>((dispatcher, getState) => { var email = getState().loginState.email; var password = getState().loginState.password; return LoginApi.LoginByEmail(email: email, password: password) .Then(loginInfo => { var user = new User { id = loginInfo.userId, fullName = loginInfo.userFullName, avatar = loginInfo.userAvatar, title = loginInfo.title, coverImage = loginInfo.coverImageWithCDN }; var dict = new Dictionary <string, User> { { user.id, user } }; dispatcher.dispatch(new UserMapAction { userMap = dict }); dispatcher.dispatch(new LoginByEmailSuccessAction { loginInfo = loginInfo }); dispatcher.dispatch(fetchChannels(1)); dispatcher.dispatch(fetchCreateChannelFilter()); dispatcher.dispatch <IPromise>(fetchUserProfile(loginInfo.userId)); dispatcher.dispatch(new CleanEmailAndPasswordAction()); UserInfoManager.saveUserInfo(loginInfo); AnalyticsManager.LoginEvent("email"); AnalyticsManager.AnalyticsLogin("email", loginInfo.userId); JPushPlugin.setJPushAlias(loginInfo.userId); BuglyAgent.SetUserId(loginInfo.userId); EventBus.publish(sName: EventBusConstant.login_success, new List <object> { loginInfo.userId }); dispatcher.dispatch(new MainNavigatorPopAction()); }) .Catch(error => { dispatcher.dispatch(new LoginByEmailFailureAction()); Debuger.LogError(message: error); var customSnackBar = new CustomSnackBar( "登录失败,请重试。" ); customSnackBar.show(); }); })); }
protected override void Update() { base.Update(); JPushPlugin.addListener(); if (VideoPlayerManager.instance.isRotation) { if (Input.deviceOrientation == DeviceOrientation.Portrait && Screen.orientation != ScreenOrientation.Portrait && !VideoPlayerManager.instance.lockPortrait) { VideoPlayerManager.instance.lockLandscape = false; EventBus.publish(EventBusConstant.changeOrientation, new List <object> { ScreenOrientation.Portrait }); } else if (Input.deviceOrientation == DeviceOrientation.LandscapeLeft) { VideoPlayerManager.instance.lockPortrait = false; if (Screen.orientation != ScreenOrientation.LandscapeLeft && !VideoPlayerManager.instance.lockLandscape) { EventBus.publish(EventBusConstant.changeOrientation, new List <object> { ScreenOrientation.LandscapeLeft }); } } else if (Input.deviceOrientation == DeviceOrientation.LandscapeRight) { VideoPlayerManager.instance.lockPortrait = false; if (Screen.orientation != ScreenOrientation.LandscapeRight) { EventBus.publish(EventBusConstant.changeOrientation, new List <object> { ScreenOrientation.LandscapeRight }); } } } }
protected override void Update() { base.Update(); JPushPlugin.addListener(); }
public override Widget build(BuildContext context) { var child = new Container( color: CColors.White, child: new CustomSafeArea( top: false, bottom: false, child: new CustomTabBarConnector( new List <Widget> { new ArticlesScreenConnector(), new EventsScreen(), new MessengerScreenConnector(), new PersonalScreenConnector() }, new List <CustomTabBarItem> { new CustomTabBarItem( 0, Icons.UnityTabIcon, Icons.UnityTabIcon, "首页" ), new CustomTabBarItem( 1, Icons.outline_event, Icons.eventIcon, "活动" ), new CustomTabBarItem( 2, Icons.outline_question_answer, Icons.question_answer, "群聊" ), new CustomTabBarItem( 3, Icons.mood, Icons.mood, "我的" ) }, backgroundColor: CColors.TabBarBg, (fromIndex, toIndex) => { AnalyticsManager.ClickHomeTab(fromIndex: fromIndex, toIndex: toIndex); if (toIndex != 2 || StoreProvider.store.getState().loginState.isLoggedIn) { StatusBarManager.statusBarStyle(toIndex == 3 && UserInfoManager.isLogin()); StoreProvider.store.dispatcher.dispatch(new SwitchTabBarIndexAction { index = toIndex }); JPushPlugin.showPushAlert(toIndex != 2); PreferencesManager.updateTabIndex(toIndex); return(true); } Router.navigator.pushNamed(routeName: MainNavigatorRoutes.Login); return(false); }, initialTabIndex: PreferencesManager.initTabIndex() ) ) ); return(new VersionUpdater( child: child )); }
public override Widget build(BuildContext context) { var child = new Container( color: CColors.White, child: new CustomSafeArea( top: false, bottom: false, child: new CustomTabBarConnector( new List <Widget> { new ArticlesScreenConnector(), new EventsScreenConnector(), new MessengerScreenConnector(), new PersonalScreenConnector() }, new List <CustomTabBarItem> { new CustomTabBarItem( 0, normalIcon: Icons.tab_home_line, selectedIcon: Icons.tab_home_fill, _getSelectedImages("home"), "首页" ), new CustomTabBarItem( 1, normalIcon: Icons.tab_events_line, selectedIcon: Icons.tab_events_fill, _getSelectedImages("event"), "活动" ), new CustomTabBarItem( 2, normalIcon: Icons.tab_messenger_line, selectedIcon: Icons.tab_messenger_fill, _getSelectedImages("messenger"), "群聊" ), new CustomTabBarItem( 3, normalIcon: Icons.tab_mine_line, selectedIcon: Icons.tab_mine_fill, _getSelectedImages("mine"), "我的" ) }, backgroundColor: CColors.TabBarBg, (fromIndex, toIndex) => { AnalyticsManager.ClickHomeTab(fromIndex: fromIndex, toIndex: toIndex); if (toIndex != 2 || UserInfoManager.isLogin()) { var myUserId = UserInfoManager.getUserInfo().userId; if (toIndex == 3 && myUserId.isNotEmpty()) { // mine page StoreProvider.store.dispatcher.dispatch(Actions.fetchUserProfile(userId: myUserId)); } StatusBarManager.statusBarStyle(toIndex == 3 && UserInfoManager.isLogin()); StoreProvider.store.dispatcher.dispatch(new SwitchTabBarIndexAction { index = toIndex }); JPushPlugin.showPushAlert(toIndex != 2); return(true); } Router.navigator.pushNamed(routeName: MainNavigatorRoutes.Login); return(false); } ) ) ); return(new VersionUpdater( child: child )); }