public async Task SetSetting(string newValue, SettingType type) { try { Error = (await SettingApi.SetSetting(CurrentProperties.CurrentUser.Token, newValue, type)); } catch (CustomException exc) { OnLoaded(newValue, type); DependencyService.Get <IMessage>().ShortAlert(exc.Message); return; } catch { Error = true; //Error = null; } if (Error) { OnLoaded(newValue, type); DependencyService.Get <IMessage>().LongAlert("Произошла ошибка!"); return; } OnLoaded(newValue, type); return; }
public void OnCreateWithoutBasePath() { configuration = GetClientConfig(); SettingApi settingApiTest = new SettingApi(configuration); Assert.NotNull(settingApiTest); }
public async Task <UseTopStoryResult> SwitchTopStory(String access, Boolean isOn) { var api = new SettingApi(); var result = await api.SwitchTopStory(access, isOn); return(result); }
public async Task <UseTopStoryResult> CheckUseStory(String access, Boolean autoCache = false) { var api = new SettingApi(); var result = await api.CheckUseStory(access, autoCache); return(result); }
public static object fetchReviewUrl() { return(new ThunkAction <AppState>((dispatcher, getState) => { return SettingApi.FetchReviewUrl(Config.platform, Config.store) .Then(url => dispatcher.dispatch(new FetchReviewUrlSuccessAction { url = url })) .Catch(error => { dispatcher.dispatch(new FetchReviewUrlFailureAction()); }); })); }
void _checkNewVersion() { SettingApi.CheckNewVersion(platform: Config.platform, store: Config.store, $"{Config.versionCode}") .Then(versionResponse => { this.url = versionResponse.url; this.isLoading = false; this.setState(() => {}); }) .Catch(error => { this.isLoading = false; this.needFetchAgain = true; this.setState(() => {}); }); }
public void ApiV1SettingBySettingAddGetAndDeleteWithHttpInfoTest() { configuration = GetClientConfig(); SettingApi settingApiTest = new SettingApi(configuration); RepositorySetting repositorySetting = new RepositorySetting("Test Setting Name", "TestSettingValue", 1L); ApiResponse <object> response = settingApiTest.ApiV1SettingPostWithHttpInfo(repositorySetting); Assert.Equal(200, response.StatusCode); ApiResponse <List <RepositorySetting> > responseGet = settingApiTest.ApiV1SettingGetWithHttpInfo(); Assert.Equal(200, responseGet.StatusCode); Assert.Contains(repositorySetting, responseGet.Data); ApiResponse <object> responseDelete = settingApiTest.ApiV1SettingBySettingDeleteWithHttpInfo("Test Setting Name"); Assert.Equal(200, response.StatusCode); }
public void OnCreate() { SettingApi settingApiTest = new SettingApi(this.basePath); Assert.NotNull(settingApiTest); }
public static void checkForUpdates(CheckVersionType type) { if (type == CheckVersionType.setting) { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog(message: "正在检查更新") ); } SettingApi.FetchVersion(Config.platform, Config.store, $"{Config.versionCode}") .Then(versionResponse => { if (type == CheckVersionType.setting) { CustomDialogUtils.hiddenCustomDialog(); } var status = versionResponse["status"]; if (status.ToLower() == "need_update" && versionResponse.ContainsKey("url")) { var changeLog = "发现新版本,立即更新体验吧!"; if (versionResponse.ContainsKey("changeLog")) { if (versionResponse["changeLog"].isNotEmpty()) { changeLog = versionResponse["changeLog"]; } } CustomDialogUtils.showCustomDialog( barrierColor: Color.fromRGBO(0, 0, 0, 0.5f), child: new CustomAlertDialog( "版本更新", changeLog, new List <Widget> { new CustomButton( child: new Text( "稍后再说", style: new TextStyle( height: 1.33f, fontSize: 16, fontFamily: "Roboto-Regular", color: new Color(0xFF959595) ), textAlign: TextAlign.center ), onPressed: _ignoreUpdater ), new CustomButton( child: new Text( "立即更新", style: CTextStyle.PLargeBlue, textAlign: TextAlign.center ), onPressed: () => { _ignoreUpdater(); var url = versionResponse["url"]; Application.OpenURL(url); } ) } ) ); } else { if (type == CheckVersionType.setting) { var customSnackBar = new CustomSnackBar( "当前是最新版本", color: CColors.TextBody ); customSnackBar.show(); } } }) .Catch(error => { if (type == CheckVersionType.setting) { CustomDialogUtils.hiddenCustomDialog(); } }); }
public static void checkForUpdates(CheckVersionType type) { if (type == CheckVersionType.setting) { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog(message: "正在检查更新") ); } SettingApi.CheckNewVersion(platform: Config.platform, store: Config.store, $"{Config.versionCode}") .Then(versionResponse => { if (type == CheckVersionType.setting) { CustomDialogUtils.hiddenCustomDialog(); } var status = versionResponse.status; if (status == "NEED_UPDATE" && versionResponse.url.isNotEmpty()) { if (type == CheckVersionType.initialize && !needNoticeNewVersion() || needForceUpdate()) { return; } markUpdateNoticeTime(); CustomDialogUtils.showCustomDialog( barrierColor: Color.fromRGBO(0, 0, 0, 0.5f), child: new CustomAlertDialog( null, message: versionResponse.changeLog, new List <Widget> { new CustomButton( child: new Center( child: new Text( "稍后再说", style: CTextStyle.PLargeBody5.defaultHeight(), textAlign: TextAlign.center ) ), onPressed: CustomDialogUtils.hiddenCustomDialog ), new CustomButton( child: new Center( child: new Text( "立即更新", style: CTextStyle.PLargeBlue.defaultHeight(), textAlign: TextAlign.center ) ), onPressed: () => { CustomDialogUtils.hiddenCustomDialog(); Application.OpenURL(url: versionResponse.url); } ) }, new Stack( children: new List <Widget> { Image.asset("image/updaterBg"), new Align( alignment: Alignment.bottomCenter, child: new Container(height: 1, color: CColors.White) ) } ) ) ); } else { if (type == CheckVersionType.setting) { var customSnackBar = new CustomSnackBar( "当前是最新版本", color: CColors.TextBody ); customSnackBar.show(); } } }) .Catch(error => { if (type == CheckVersionType.setting) { CustomDialogUtils.hiddenCustomDialog(); } }); }
public static void checkForUpdates(CheckVersionType type) { if (type == CheckVersionType.setting) { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog(message: "正在检查更新") ); } SettingApi.CheckNewVersion(platform: Config.platform, store: Config.store, $"{Config.versionCode}") .Then(versionResponse => { if (type == CheckVersionType.setting) { CustomDialogUtils.hiddenCustomDialog(); } var status = versionResponse.status; if (status == "NEED_UPDATE" && versionResponse.url.isNotEmpty()) { if (type == CheckVersionType.initialize && !needNoticeNewVersion()) { return; } markUpdateNoticeTime(); CustomDialogUtils.showCustomDialog( barrierColor: Color.fromRGBO(0, 0, 0, 0.5f), child: new CustomAlertDialog( "版本更新", message: versionResponse.changeLog, new List <Widget> { new CustomButton( child: new Text( "稍后再说", style: new TextStyle( height: 1.33f, fontSize: 16, fontFamily: "Roboto-Regular", color: new Color(0xFF959595) ), textAlign: TextAlign.center ), onPressed: CustomDialogUtils.hiddenCustomDialog ), new CustomButton( child: new Text( "立即更新", style: CTextStyle.PLargeBlue, textAlign: TextAlign.center ), onPressed: () => { CustomDialogUtils.hiddenCustomDialog(); Application.OpenURL(url: versionResponse.url); } ) } ) ); } else { if (type == CheckVersionType.setting) { var customSnackBar = new CustomSnackBar( "当前是最新版本", color: CColors.TextBody ); customSnackBar.show(); } } }) .Catch(error => { if (type == CheckVersionType.setting) { CustomDialogUtils.hiddenCustomDialog(); } }); }