…lines 1–246 unchanged (246 lines)
247 beforeSync = async () => {
248 if (!ConfigService.getItem("defaultSyncOption")) {
249 toast.error(this.props.t("Please add data source in the setting"));
250 this.setState({ isSync: false });
251 return false;
252 }
253 if (
254 ConfigService.getReaderConfig("isEnableKoodoSync") === "yes" &&
255 this.props.userInfo &&
256 this.props.userInfo.default_sync_option &&
257 this.props.userInfo.default_sync_option !== this.props.defaultSyncOption
258 ) {
259 toast.error(
260 this.props.t(
261 "The default sync options in the local and cloud are inconsistent, please set the local default sync option to "
262 ) +
263 this.props.t(
264 driveList.find(
265 (item) => item.value === this.props.userInfo.default_sync_option
266 )?.label || ""
267 ),
268 {
269 duration: 4000,
270 }
271 );
272 this.setState({ isSync: false });
273 return false;
274 }
275 let config = await getCloudConfig(
276 ConfigService.getItem("defaultSyncOption") || ""
277 );
278 if (Object.keys(config).length === 0) {
279 toast.error(this.props.t("Cannot get sync config"));
280 this.setState({ isSync: false });
…lines 281–299 unchanged (19 lines)
300 ConfigService.removeItem("defaultSyncOption");
301 this.props.handleFetchDefaultSyncOption();
302 }
303 if (ConfigService.getReaderConfig("isEnableKoodoSync") === "yes") {
304 await updateUserConfig({
305 is_enable_koodo_sync: "no",
306 default_sync_option:
307 ConfigService.getItem("defaultSyncOption") === "google",
308 });
309 setTimeout(() => {
310 updateUserConfig({
311 is_enable_koodo_sync: "yes",
312 });
313 }, 1000);
…lines 314–674 unchanged (361 lines)