react-native-fbsdk-next
Version:
Facebook SDK support for React Native apps.
82 lines (71 loc) • 1.81 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
/**
* @format
*/
const Profile = _reactNative.NativeModules.FBProfile;
/**
* Represents an immutable Facebook profile
* This class provides a global "currentProfile" instance to more easily add social context to your application.
*/
class FBProfile {
/**
* The user id
*/
/**
* The user's email.
* IMPORTANT: This field will only be populated if your user has granted your application the 'email' permission.
*/
/**
* The user's complete name
*/
/**
* The user's first name
*/
/**
* The user's last name
*/
/**
* The user's middle name
*/
/**
* A URL to the user's profile.
* IMPORTANT: This field will only be populated if your user has granted your application the 'user_link' permission
*/
/**
* A URL to use for fetching a user's profile image.
*/
constructor(profileMap) {
this.firstName = profileMap.firstName;
this.lastName = profileMap.lastName;
this.middleName = profileMap.middleName;
this.linkURL = profileMap.linkURL;
this.imageURL = profileMap.imageURL;
this.userID = profileMap.userID;
if (_reactNative.Platform.OS !== 'android') {
this.email = profileMap.email;
}
this.name = profileMap.name;
Object.freeze(this);
}
/**
* Getter the current logged profile
*/
static getCurrentProfile() {
return new Promise(resolve => {
Profile.getCurrentProfile(profileMap => {
if (profileMap) {
resolve(new FBProfile(profileMap));
} else {
resolve(null);
}
});
});
}
}
var _default = exports.default = FBProfile;
//# sourceMappingURL=FBProfile.js.map
;