@@ -755,24 +755,7 @@ export namespace NATIVE {
755755 }
756756 }
757757 }
758-
759758 }
760- // export function setLogLevel(level: number) {
761- // switch (level) {
762- // case 1:
763- // io.sentry.Sentry.setLevel(null);
764- // break;
765- // case 2:
766- // io.sentry.Sentry.setLevel(io.sentry.SentryLevel.ERROR);
767- // break;
768- // case 3:
769- // io.sentry.Sentry.setLevel(io.sentry.SentryLevel.DEBUG);
770- // break;
771- // case 4:
772- // io.sentry.Sentry.setLevel(io.sentry.SentryLevel.INFO);
773- // break;
774- // }
775- // }
776759
777760 export function fetchNativeSdkInfo ( ) {
778761 return null ;
@@ -805,196 +788,8 @@ export namespace NATIVE {
805788 }
806789 export async function fetchNativeDeviceContexts ( ) {
807790 return { } ;
808- // return new Promise((resolve) => {
809- // const nEvent = new io.sentry.SentryEvent();
810-
811- // const params = {};
812- // const it = nEvent.getContexts().entrySet().iterator();
813- // let value, pair, key;
814- // while (it.hasNext()) {
815- // pair = it.next();
816- // value = pair.getValue();
817- // key = pair.getKey();
818- // params[key] = getJSHashMap(value);
819- // }
820- // resolve(params);
821- // });
822791 }
823792
824- // export function captureUserFeedback(feedback: UserFeedback) {
825- // if (!enableNative) {
826- // return;
827- // }
828- // const userFeedback = new io.sentry.UserFeedback(new io.sentry.protocol.SentryId(feedback.eventId));
829- // if (feedback.comments) {
830- // userFeedback.setComments(feedback.comments);
831- // }
832- // if (feedback.email) {
833- // userFeedback.setEmail(feedback.email);
834- // }
835- // if (feedback.name) {
836- // userFeedback.setName(feedback.name);
837- // }
838- // io.sentry.Sentry.captureUserFeedback(userFeedback);
839- // }
840-
841-
842- // export function setUser(user: User | null, otherUserKeys) {
843- // if (!enableNative) {
844- // return;
845- // }
846- // io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
847- // run(scope) {
848- // if (user == null && otherUserKeys == null) {
849- // scope.setUser(null);
850- // } else {
851- // const userInstance = new io.sentry.protocol.User();
852-
853- // if (user) {
854- // if (user.email) {
855- // userInstance.setEmail(user.email);
856- // }
857-
858- // if (user.id) {
859- // userInstance.setId(user.id);
860- // }
861-
862- // if (user.username) {
863- // userInstance.setUsername(user.username);
864- // }
865-
866- // if (user.ip_address) {
867- // userInstance.setIpAddress(user.ip_address);
868- // }
869- // }
870-
871- // if (otherUserKeys ) {
872- // userInstance.setOthers(getNativeHashMap(otherUserKeys));
873- // }
874- // scope.setUser(userInstance);
875- // }
876- // }
877- // }));
878-
879- // }
880- // export function setTag(key: string, value: string) {
881- // if (!enableNative) {
882- // return;
883- // }
884- // io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
885- // run(scope) {
886- // scope.setTag(key, value);
887- // }
888- // }));
889- // }
890-
891- // export function setExtra(key: string, extra: string) {
892- // if (!enableNative) {
893- // return;
894- // }
895- // io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
896- // run(scope) {
897- // scope.setExtra(key, extra);
898- // }
899- // }));
900- // }
901-
902- // export function withScope(callback: (scope: Scope) => void) {
903- // io.sentry.Sentry.withScope(new io.sentry.ScopeCallback({
904- // run(nscope) {
905- // // nscope is ignored
906- // console.log('native withScope', nscope);
907- // callback(nscope as any);
908- // }
909- // }));
910- // }
911-
912- // export function addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number) {
913- // if (!enableNative) {
914- // return;
915- // }
916- // io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
917- // run(scope) {
918- // try {
919- // console.log('addBreadcrumb', breadcrumb, scope);
920-
921- // const breadcrumbInstance = new io.sentry.Breadcrumb();
922-
923- // if (breadcrumb.message) {
924- // breadcrumbInstance.setMessage(breadcrumb.message);
925- // }
926-
927- // if (breadcrumb.type) {
928- // breadcrumbInstance.setType(breadcrumb.type);
929- // }
930-
931- // if (breadcrumb.category) {
932- // breadcrumbInstance.setCategory(breadcrumb.category);
933- // }
934-
935- // if (breadcrumb.level) {
936- // breadcrumbInstance.setLevel(eventLevel(breadcrumb.level));
937- // }
938-
939- // if (breadcrumb.data) {
940- // Object.keys(breadcrumb.data).forEach(key => {
941- // breadcrumbInstance.setData(key, breadcrumb.data[key]);
942- // });
943- // }
944-
945- // scope.addBreadcrumb(breadcrumbInstance);
946- // } catch (error) {
947- // console.error('addBreadcrumb', error, error.stack);
948-
949- // }
950- // }
951- // }));
952- // }
953- // export function addAttachment(attachment: Attachment) {
954- // if (!enableNative) {
955- // return;
956- // }
957- // io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
958- // run(scope) {
959- // console.log('addAttachment', attachment, scope);
960- // try {
961- // if (attachment.data) {
962- // if (typeof attachment.data === 'string') {
963- // attachment.data = new TextEncoder().encode(attachment.data);
964- // }
965- // const bytes = pointsFromBuffer(attachment.data, true, false);
966- // console.log('addAttachment', typeof attachment.data, attachment.data.length, bytes, bytes.length);
967- // scope.addAttachment(new io.sentry.Attachment(bytes, attachment.filename));
968- // } else {
969- // scope.addAttachment(new io.sentry.Attachment(attachment.filename));
970- // }
971- // } catch (error) {
972- // console.error('addAttachment', error, error.stack);
973- // }
974- // }
975- // }));
976- // }
977- // export function clearBreadcrumbs() {
978- // if (!enableNative) {
979- // return;
980- // }
981- // io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
982- // run(scope) {
983- // scope.clearBreadcrumbs();
984- // }
985- // }));
986- // }
987- // export function setContext(key: string, context: { [key: string]: any } | null) {
988- // if (!enableNative) {
989- // return;
990- // }
991- // io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
992- // run(scope) {
993- // scope.setContexts(key, getNativeHashMap(context));
994- // }
995- // }));
996- // }
997-
998793 export function captureScreenshot ( fileName = 'screenshot' ) {
999794 const activity = Application . android . foregroundActivity || Application . android . startActivity ;
1000795 const raw = io . sentry . android . core . internal . util . ScreenshotUtils . takeScreenshot ( activity , logger , buildInfo ) ;
0 commit comments