Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check soft request status. #7

Open
github-actions bot opened this issue Jan 3, 2022 · 0 comments
Open

check soft request status. #7

github-actions bot opened this issue Jan 3, 2022 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Jan 3, 2022

check soft request status.

// Tracking.log([permissions] ${k} permissions are ${current});

if (current === "denied" || current === "limited") {

// Tracking.setUserProperty(userPropertyKey, "false");

return reject(MAP_RESULTS[current]);

} else if (current === "granted") {

// Tracking.setUserProperty(userPropertyKey, "true");

return resolve("authorized");

}

if (response === "granted") {

// Tracking.setUserProperty(userPropertyKey, "true");

return resolve("authorized");

} else {

// Tracking.setUserProperty(userPropertyKey, "false");

return reject(MAP_RESULTS[response]);

}

});

// // TODO check soft request status.

// import {Tracking} from "./Tracking";
// import capitalize from "lodash/capitalize";
import {Platform} from "react-native";
// import Permissions from "react-native-permissions";
import {PermissionKind, PermissionStatus} from "./Common";

export async function requestPermissions(kind: PermissionKind): Promise<PermissionStatus> {
  return new Promise(async (resolve, reject) => {
    return "denied";
  });
  // const userPropertyKey = `PermissionsFor${capitalize(kind)}`;

  //   let k = kind;
  //   let options: any = undefined;
  //   if (kind === "locationAlways") {
  //     k = "location";
  //     options = { type: "always" };
  //   }
  //   if (Platform.OS === "android" && k === "notification") {
  //     return;
  //   }

  //   // TODO check soft request status.

  //   const current = await Permissions.check(MAP[k] as any);
  //   // Tracking.log(`[permissions] ${k} permissions are ${current}`);
  //   if (current === "denied" || current === "limited") {
  //     // Tracking.setUserProperty(userPropertyKey, "false");
  //     return reject(MAP_RESULTS[current]);
  //   } else if (current === "granted") {
  //     // Tracking.setUserProperty(userPropertyKey, "true");
  //     return resolve("authorized");
  //   }

  //   const response = await Permissions.request(MAP[k] as any, options);
  //   if (response === "granted") {
  //     // Tracking.setUserProperty(userPropertyKey, "true");
  //     return resolve("authorized");
  //   } else {
  //     // Tracking.setUserProperty(userPropertyKey, "false");
  //     return reject(MAP_RESULTS[response]);
  //   }
  // });
}

c14c07455f510dfb84a07cd79048d504a884a011

@github-actions github-actions bot added the todo label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants