<commit_before>import {
  NativeModules,
  Platform
} from 'react-native';

const {
  SitbRCTMediaManager: {
    sourceType,
    mediaType,
    cameraType,
    launchImageLibrary,
    launchCamera
  }
} = NativeModules;


type Options = {
  sourceType: Number,
  mediaType: String,
  allowsEditing: Boolean,
  cameraType: Number
};

const DEFAULT_LIBRARY_OPTIONS = {
  sourceType: sourceType.savedPhotosAlbum,
  mediaType: mediaType.Image,
  allowsEditing: false
};

const DEFAULT_CAMERA_OPTIONS = {
  sourceType: sourceType.camera,
  cameraType: cameraType.back
};

/**
 * @author 田尘殇Sean(<EMAIL>)
 * @date 16/6/29
 */
class MediaBrowser {

  static launchImageLibrary(options:Options = DEFAULT_LIBRARY_OPTIONS):Promise {
    const newOptions = Object.assign({}, DEFAULT_LIBRARY_OPTIONS, options);
    return launchImageLibrary(newOptions);
  }

  static launchCamera(options = DEFAULT_CAMERA_OPTIONS):Promise {
    const newOptions = Object.assign({}, DEFAULT_CAMERA_OPTIONS, options);
    if (Platform.OS === 'android' && newOptions.allowsEditing) {
      return new Promise((resolve, reject)=> {
        launchCamera(newOptions).then(original=> {
          setTimeout(()=> {
            NativeModules.SitbRCTMediaManager.launchEditing(original.path)
              .then(edited => {
                resolve({
                  original,
                  edited
                });
              })
              .catch(err => reject(err));
          }, 1);
        })
          .catch(err=> reject(err));
      });
    }
    return launchCamera(newOptions);
  }

}


export {
  MediaBrowser as default,
  sourceType,
  mediaType
};<commit_msg>导出cameraType<commit_after>import {
  NativeModules,
  Platform
} from 'react-native';

const {
  SitbRCTMediaManager: {
    sourceType,
    mediaType,
    cameraType,
    launchImageLibrary,
    launchCamera
  }
} = NativeModules;


type Options = {
  sourceType: Number,
  mediaType: String,
  allowsEditing: Boolean,
  cameraType: Number
};

const DEFAULT_LIBRARY_OPTIONS = {
  sourceType: sourceType.savedPhotosAlbum,
  mediaType: mediaType.Image,
  allowsEditing: false
};

const DEFAULT_CAMERA_OPTIONS = {
  sourceType: sourceType.camera,
  cameraType: cameraType.back
};

/**
 * @author 田尘殇Sean(<EMAIL>)
 * @date 16/6/29
 */
class MediaBrowser {

  static launchImageLibrary(options:Options = DEFAULT_LIBRARY_OPTIONS):Promise {
    const newOptions = Object.assign({}, DEFAULT_LIBRARY_OPTIONS, options);
    return launchImageLibrary(newOptions);
  }

  static launchCamera(options = DEFAULT_CAMERA_OPTIONS):Promise {
    const newOptions = Object.assign({}, DEFAULT_CAMERA_OPTIONS, options);
    if (Platform.OS === 'android' && newOptions.allowsEditing) {
      return new Promise((resolve, reject)=> {
        launchCamera(newOptions).then(original=> {
          setTimeout(()=> {
            NativeModules.SitbRCTMediaManager.launchEditing(original.path)
              .then(edited => {
                resolve({
                  original,
                  edited
                });
              })
              .catch(err => reject(err));
          }, 1);
        })
          .catch(err=> reject(err));
      });
    }
    return launchCamera(newOptions);
  }

}


export {
  MediaBrowser as default,
  sourceType,
  mediaType,
  cameraType
};
{'fraction_non_alphanumeric': 0.11339582703356517, 'fraction_numerical': 0.003628666465074085, 'mean_word_length': 2.802298850574713, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '178023', 'n_tokens_mistral': 1033, 'n_tokens_neox': 993, 'n_words': 179}