Skip to content

Decouple RTC POC follow-ups #490

Description

@dlqqq

Follow ups to initial proof-of-concept here: #489

  • Test the behavior of what happens if RTC lab extensions enabled but RTC server extensions disabled. Should RTC packages automatically disable their lab extensions if their corresponding server extensions are not enabled? I think so.

  • Check what we should do about !!drive v.s. collaborative checks since they may be different based on previous point. Some areas of the code still are gated behind !!drive. Can we remove all of them now that lab extension is compatible without the drive?

function loadSetting(setting: ISettingRegistry.ISettings): void {
  const previousDirectory = widgetConfig.config.defaultDirectory;
  const currentDirectory = setting.get('defaultDirectory').composite as string;

  // (1) delete the old default directory if it's empty and changed
  if (drive && previousDirectory && previousDirectory !== currentDirectory) {
    app.serviceManager.contents.get(previousDirectory).then(contentModel => {
      if (contentModel.content.length === 0) {
        app.serviceManager.contents.delete(previousDirectory).catch(() => {});
      }
    });
  }

  // (2) create the new default directory if it doesn't exist
  let directoryCreation: Promise<Contents.IModel | null> = Promise.resolve(null);
  if (drive && currentDirectory && previousDirectory !== currentDirectory) {
    directoryCreation = app.serviceManager.contents
      .get(currentDirectory, { content: false })
      .catch(async () => { /* newUntitled('directory') + rename to currentDirectory */ });
  }

  // config is always updated, regardless of `drive`
  directoryCreation.then(() => {
    widgetConfig.config = { /* ...settings..., defaultDirectory: currentDirectory */ };
  });
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions