setupAppPoliciesAndPages method

Future<void> setupAppPoliciesAndPages(
  1. DrawerModel drawer,
  2. DrawerModel endDrawer
)

Implementation

Future<void> setupAppPoliciesAndPages(
  DrawerModel drawer,
  DrawerModel endDrawer,
) async {
  var privacyPolicy = await ImageTools.uploadPlatformPdf(
      theApp,
      member!.documentID,
      privacyPolicyAssetLocation(),
      privacyID,
      PrivilegeLevelRequiredSimple.noPrivilegeRequiredSimple);
  var termsOfServicePolicy = await ImageTools.uploadPlatformPdf(
      theApp,
      member!.documentID,
      termsOfServiceAssetLocation(),
      termsOfServiceID,
      PrivilegeLevelRequiredSimple.noPrivilegeRequiredSimple);
  var disclaimerPolicy = await ImageTools.uploadPlatformPdf(
      theApp,
      member!.documentID,
      disclaimerAssetLocation(),
      disclaimerID,
      PrivilegeLevelRequiredSimple.noPrivilegeRequiredSimple);

  var privacyPolicyModel = AppPolicyModel(
      documentID: privacyID,
      appId: theApp.documentID,
      name: 'Privacy Policy',
      policy: privacyPolicy);
  await modelrepo
      .appPolicyRepository(appId: theApp.documentID)!
      .add(privacyPolicyModel);
  var termsOfServiceModel = AppPolicyModel(
      documentID: termsOfServiceID,
      appId: theApp.documentID,
      name: 'Terms of Service',
      policy: termsOfServicePolicy);
  await modelrepo
      .appPolicyRepository(appId: theApp.documentID)!
      .add(termsOfServiceModel);
  var disclaimerModel = AppPolicyModel(
      documentID: disclaimerID,
      appId: theApp.documentID,
      name: 'Disclaimer',
      policy: disclaimerPolicy);
  await modelrepo
      .appPolicyRepository(appId: theApp.documentID)!
      .add(disclaimerModel);

  policyPages = [];
  policyPages!.add(await PolicyPage(
    policy: privacyPolicyModel,
    installApp: this,
    homeMenu: homeMenu(),
    drawer: drawer,
    endDrawer: endDrawer,
  ).run());
  policyPages!.add(await PolicyPage(
    policy: termsOfServiceModel,
    installApp: this,
    homeMenu: homeMenu(),
    drawer: drawer,
    endDrawer: endDrawer,
  ).run());
  policyPages!.add(await PolicyPage(
    policy: disclaimerModel,
    installApp: this,
    homeMenu: homeMenu(),
    drawer: drawer,
    endDrawer: endDrawer,
  ).run());
}