-
-
Notifications
You must be signed in to change notification settings - Fork 343
(feat) Add Attachments #2463
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
Merged
Merged
(feat) Add Attachments #2463
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
ef71954
(feat) Add Attachments
krystofwoldrich b7afc14
Add attachment header to ios
krystofwoldrich 42c67eb
Add basic attachment support to ios, fix lint
krystofwoldrich ec39b54
Remove propagation of attachments to native sdks
krystofwoldrich c2b06e9
Add attachment processing for android
krystofwoldrich eb2ad99
Add new captureEnvelope bridge draft
krystofwoldrich 15ee4b7
Add capture envelope native implementation
krystofwoldrich 0ff0f1d
Remove getStringBytesLength from bridge
krystofwoldrich 43b3d10
Fix tests
krystofwoldrich d98a589
Fix lint, add vendor buffer desc
krystofwoldrich 5c317cc
Add utf8 tests
krystofwoldrich 57de079
Fix changelog
krystofwoldrich 20ce45c
Remove Buffer
krystofwoldrich 681927a
Add first draft asset attachment example
krystofwoldrich 27e7b92
Add ios attachments example, fix js sample dep on Buffer
krystofwoldrich ed285cc
Fix lint
krystofwoldrich cb91e25
Add simple byte size utf8 check
krystofwoldrich 89893cf
Update CHANGELOG.md
krystofwoldrich d55170d
Refactor sample HomeScreen attachment example
krystofwoldrich 9147cb5
Add buffer license
krystofwoldrich a0a7e1b
Remove options store ignored log
krystofwoldrich 5906a26
Add missing envelope message test and fix breadcrumbs
krystofwoldrich c9fbe21
Merge remote-tracking branch 'origin/main' into krystofwoldrich/attac…
krystofwoldrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions
42
sample/android/app/src/main/java/io/sentry/sample/AssetsModule.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.sentry.sample; | ||
import android.content.Context; | ||
|
||
import com.facebook.react.bridge.Promise; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
import com.facebook.react.bridge.ReactMethod; | ||
import com.facebook.react.bridge.WritableArray; | ||
import com.facebook.react.bridge.WritableNativeArray; | ||
|
||
import java.io.InputStream; | ||
|
||
public class AssetsModule extends ReactContextBaseJavaModule { | ||
|
||
AssetsModule(ReactApplicationContext context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "AssetsModule"; | ||
} | ||
|
||
@ReactMethod | ||
public void getExampleAssetData(Promise promise) { | ||
try { | ||
InputStream stream = this.getReactApplicationContext().getResources().getAssets() | ||
.open("logo_mini.png"); | ||
int size = stream.available(); | ||
byte[] buffer = new byte[size]; | ||
stream.read(buffer); | ||
stream.close(); | ||
WritableArray array = new WritableNativeArray(); | ||
for (int i = 0; i < size; i++) { | ||
array.pushInt(buffer[i]); | ||
} | ||
promise.resolve(array); | ||
} catch (Exception e) { | ||
promise.reject(e); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
sample/android/app/src/main/java/io/sentry/sample/SamplePackage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.sentry.sample; | ||
import com.facebook.react.ReactPackage; | ||
import com.facebook.react.bridge.NativeModule; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.uimanager.ViewManager; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class SamplePackage implements ReactPackage { | ||
|
||
@Override | ||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public List<NativeModule> createNativeModules( | ||
ReactApplicationContext reactContext) { | ||
List<NativeModule> modules = new ArrayList<>(); | ||
|
||
modules.add(new AssetsModule(reactContext)); | ||
|
||
return modules; | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
sample/ios/sample/Images.xcassets/ExampleBinaryData.dataset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"data" : [ | ||
{ | ||
"compression-type" : "none", | ||
"filename" : "logo_mini.png", | ||
"idiom" : "universal", | ||
"universal-type-identifier" : "image\/png" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+1.91 KB
sample/ios/sample/Images.xcassets/ExampleBinaryData.dataset/logo_mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#import <React/RCTBridgeModule.h> | ||
@interface RCTAssetsModule : NSObject <RCTBridgeModule> | ||
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#import "RCTAssetsModule.h" | ||
|
||
@implementation RCTAssetsModule | ||
|
||
RCT_EXPORT_METHOD(getExampleAssetData: (RCTPromiseResolveBlock)resolve | ||
rejecter:(RCTPromiseRejectBlock)reject) | ||
{ | ||
NSDataAsset *data = [[NSDataAsset alloc] initWithName:@"ExampleBinaryData"]; | ||
if (data == nil) { | ||
reject(@"SampleSentryReactNative",@"Failed to load exmaple binary data asset.", nil); | ||
} | ||
|
||
NSMutableArray *array = [NSMutableArray arrayWithCapacity:data.data.length]; | ||
|
||
const char *bytes = [data.data bytes]; | ||
|
||
for (int i = 0; i < [data.data length]; i++) | ||
{ | ||
[array addObject:[[NSNumber alloc] initWithChar:bytes[i]]]; | ||
} | ||
|
||
resolve(array); | ||
} | ||
|
||
RCT_EXPORT_MODULE(AssetsModule); | ||
|
||
@end | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.