Skip to content

Commit

Permalink
Merge pull request #22 from bugfender/feature/update-ios-native-version
Browse files Browse the repository at this point in the history
Update iOS dependency and react-native library version
  • Loading branch information
joselufo authored Oct 4, 2021
2 parents 8bee9b4 + 4ed04b2 commit cdaaa35
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 76 deletions.
4 changes: 2 additions & 2 deletions RNBugfender.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Pod::Spec.new do |s|
s.author = package['author']
s.homepage = package['homepage']

s.platform = :ios, "9.0"
s.platform = :ios, "10.0"
s.requires_arc = true
s.static_framework = true

s.source = { :git => "https://github.com/bugfender/BugfenderSDK-iOS", :tag => "master" }
s.source_files = 'ios/*.{h,m}'

s.dependency 'React'
s.dependency 'BugfenderSDK', '~> 1.9'
s.dependency 'BugfenderSDK', '~> 1.10.3'

end
188 changes: 115 additions & 73 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -1,98 +1,140 @@
import React, { Component } from 'react';
import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Button
Button,
} from 'react-native';
import Bugfender from '@bugfender/rn-bugfender';

export default class AppComponent extends Component {
constructor(props) {
super(props);
Bugfender.init ("YOUR_BUGFENDER_APP_KEY_HERE");

// Add a "bugfenderKey.json" containing { "bugfenderKey : "YOUR_APP_KEY" }
// Or delete this line and hardcode your key in Bugfender.init("YOUR_APP_KEY")
var key = require('./bugfenderKey.json').bugfenderKey;

// Optional method. Use it to override the device name and avoid sending personal data like "iPhone of John Doe"
Bugfender.overrideDeviceName('Anonymous Phone');

// Optional method. Use it only if you have a custom instance of Bugfender
// Bugfender.setBaseUrl("https://bugfender.custom-company.com")

Bugfender.init(key);

Bugfender.enableCrashReporting();
}

render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to RN Bugfender Example!
</Text>
<Text style={styles.instructions}>
This application sends directly logs to the server if you push "Send Logs" button
</Text>
<Text style={styles.instructions}>
Pressing "Generate JS Crash" the application will crash due to a JavaScript error and the crash information will be sent to the server.
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
<View style={styles.button}>
<Button
onPress={this._onPressButton}
title="Send logs"
/>
</View>
<View style={styles.button}>
<Button
onPress={this._generateError}
title="Generate JS crash"
/>
</View>
</View>
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to RN Bugfender Example!
</Text>
<Text style={styles.instructions}>
This application sends directly logs to the server if you push "Send Logs" button.
</Text>
<Text style={styles.instructions}>
Pressing "Generate JS Crash" the application will crash due to a JavaScript error and the crash information
will be sent to the server. This won't work on debug builds as LogBox will capture the error.
</Text>
<Text style={styles.instructions}>
Pressing "Show Native User Feedback" a native screen for sending feedback will be shown.
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
<View style={styles.button}>
<Button
onPress={this._onPressButton}
title="Send logs"
/>
</View>
<View style={styles.button}>
<Button
onPress={this._generateError}
title="Generate JS crash"
/>
</View>
<View style={styles.button}>
<Button
onPress={this._onPressShowUserFeedback}
title="Show Native User Feedback"
/>
</View>
</View>
);
}

_generateError = () => {
var test;
test.color; //This will generate a TypeError: undefined that will be sent to Bugfender
}
// Force crash
var date = new Date(); //Current Date
var hours = date.getHours(); //Current Hours
var min = date.getMinutes(); //Current Minutes
var sec = date.getSeconds(); //Current Seconds
throw new Error('Force crash' + 'Time: ' + hours + ':' + min + ':' + sec);
};

_onPressButton() {
Bugfender.d("REACT", "Im being called from React!");

Bugfender.d ("Bugfender", "Log without break lines in the middle of the message");
Bugfender.d ("Bugfender", "Log with break lines \n\n in the middle of the message");
Bugfender.d (null, "Log with tag as null");
Bugfender.d ("Bugfender", "Normal log");
Bugfender.d ("Bugfender", null);
Bugfender.d (null, null);

Bugfender.e ("Bugfender", "Log with break lines \n\n in the middle of the message");
Bugfender.e (null, "Log with tag as null");
Bugfender.e ("Bugfender", "Normal log");
Bugfender.e ("Bugfender", null);
Bugfender.e (null, null);

Bugfender.w ("Bugfender", "Log with break lines \n\n in the middle of the message");
Bugfender.w (null, "Log with tag as null");
Bugfender.w ("Bugfender", "Normal log");
Bugfender.w ("Bugfender", null);
Bugfender.w (null, null);

Bugfender.log (1001, "method", "file", Bugfender.LogLevel.DEBUG, "tag", "Sending low level log.");
Bugfender.log (1001, "method", "file", Bugfender.LogLevel.ERROR, "tag", "Sending low level log.");
Bugfender.log (1001, "method", "file", Bugfender.LogLevel.WARNING, "tag", "Sending low level log.");

Bugfender.setDeviceString ("device.key.string", "fake.string.value");
Bugfender.setDeviceBoolean ("device.key.boolean", true);
Bugfender.setDeviceFloat ("device.key.float", 101);
Bugfender.setDeviceInteger ("device.key.integer", 102);

Bugfender.sendIssue ("Issue One", "Issue Message One").then(url => console.log(url));
Bugfender.sendIssue ("Issue Two", "Issue Message Two").then(url => console.log(url));
Bugfender.sendIssue ("Issue Three", "Issue Message Three").then(url => console.log(url));

Bugfender.sendUserFeedback ("User feedback", "User feedback message");

Bugfender.getDeviceUrl ().then(url => console.log(url));

Bugfender.getSessionUrl ().then(url => console.log(url));
Bugfender.d('REACT', 'Im being called from React!');

Bugfender.d('Bugfender', 'Log without break lines in the middle of the message');
Bugfender.d('Bugfender', 'Log with break lines \n\n in the middle of the message');
Bugfender.d(null, 'Log with tag as null');
Bugfender.d('Bugfender', 'Normal log');
Bugfender.d('Bugfender', null);
Bugfender.d(null, null);

Bugfender.e('Bugfender', 'Log with break lines \n\n in the middle of the message');
Bugfender.e(null, 'Log with tag as null');
Bugfender.e('Bugfender', 'Normal log');
Bugfender.e('Bugfender', null);
Bugfender.e(null, null);

Bugfender.w('Bugfender', 'Log with break lines \n\n in the middle of the message');
Bugfender.w(null, 'Log with tag as null');
Bugfender.w('Bugfender', 'Normal log');
Bugfender.w('Bugfender', null);
Bugfender.w(null, null);

Bugfender.log(1001, 'method', 'file', Bugfender.LogLevel.DEBUG, 'tag', 'Sending low level log.');
Bugfender.log(1001, 'method', 'file', Bugfender.LogLevel.ERROR, 'tag', 'Sending low level log.');
Bugfender.log(1001, 'method', 'file', Bugfender.LogLevel.WARNING, 'tag', 'Sending low level log.');

Bugfender.setDeviceString('device.key.string', 'fake.string.value');
Bugfender.setDeviceBoolean('device.key.boolean', true);
Bugfender.setDeviceFloat('device.key.float', 101);
Bugfender.setDeviceInteger('device.key.integer', 102);

Bugfender.sendIssue('Issue One', 'Issue Message One').then(url => console.log(url));
Bugfender.sendIssue('Issue Two', 'Issue Message Two').then(url => console.log(url));
Bugfender.sendIssue('Issue Three', 'Issue Message Three').then(url => console.log(url));

Bugfender.sendCrash('Crash title', 'Crash text').then(url => console.log(url));

Bugfender.sendUserFeedback('User feedback', 'User feedback message').then(url => console.log(url));

Bugfender.getDeviceUrl().then(url => console.log(url));

Bugfender.getSessionUrl().then(url => console.log(url));
}

_onPressShowUserFeedback() {
Bugfender.showUserFeedback(
'Feedback',
'Please send us your feedback',
'This is the reason',
'This is the full message',
'Send',
'Cancel',
).then(url => {
console.log('RN: feedback sent with url:', url);
}).catch(error => {
console.log('RN: feedback not sent');
});
}
}

Expand All @@ -115,7 +157,7 @@ const styles = StyleSheet.create({
},
button: {
marginBottom: 5,
}
},
});

AppRegistry.registerComponent('App', () => AppComponent);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bugfender/rn-bugfender",
"version": "1.1.4",
"version": "1.1.5",
"description": "React Native bindings for Bugfender SDK",
"main": "bugfender.js",
"directories": {
Expand Down

0 comments on commit cdaaa35

Please sign in to comment.