Skip to content
Commits on Source (233)
......@@ -55,6 +55,9 @@ jobs:
steps:
- checkout
- run:
name: Install sentry cli for fastlane plugin
command: brew install getsentry/tools/sentry-cli
- run:
name: set Ruby version
command: echo "ruby-2.4" > ~/.ruby-version
......@@ -129,6 +132,15 @@ jobs:
only:
- /release-*/
- run:
name: Prepare sentry release
command: fastlane preparesentry
working_directory: ios
- persist_to_workspace:
root: ~/mobile-native/ios
paths:
- version
- run:
name: Upload to Testflight release
command: fastlane testflight
......@@ -138,7 +150,27 @@ jobs:
- /stable-*/
- /release-*/
- test/circle-ci
sentry:
docker:
- image: getsentry/sentry-cli
working_directory: ~/mobile-native
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: Install git
command: |
apk add git
- checkout
- run:
name: Tag sentry release
command: |
version=`cat /tmp/workspace/version`
echo Tagging release with ${version}
ls -a
# release created by fastlane preparesentry
sentry-cli releases set-commits --commit "Minds / Minds Mobile@${CIRCLE_SHA1}" ${version} --log-level=debug
sentry-cli releases finalize ${version}
workflows:
version: 2
node-ios:
......@@ -147,3 +179,6 @@ workflows:
- ios:
requires:
- node
- sentry:
requires:
- ios
module.exports = {
"parser": "babel-eslint",
"plugins": [
"react",
"react-native",
"flowtype"
],
"extends": ["plugin:react-native/all"],
"extends": ["plugin:react-native/all", "plugin:react/recommended"],
"env": {
"react-native/react-native": true
},
"rules": {
"no-unused-vars": [1],
"react/jsx-uses-vars": [2],
"flowtype/boolean-style": [
2,
"boolean"
......
......@@ -31,6 +31,7 @@ emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
esproposal.decorators=ignore
module.system=haste
module.system.haste.use_name_reducers=true
......
#!/bin/sh
if git commit -v --dry-run | grep '!testcode' >/dev/null 2>&1
then
echo "Trying to commit test code."
exit 1
else
exit 0
fi
\ No newline at end of file
......@@ -63,4 +63,6 @@ buck-out/
coverage/
# Sentry secrets
sentry.properties
\ No newline at end of file
sentry.properties
!/.githooks
\ No newline at end of file
......@@ -62,11 +62,7 @@ import feedsStorage from './src/common/services/sql/feeds.storage';
import connectivityService from './src/common/services/connectivity.service';
import sqliteStorageProviderService from './src/common/services/sqlite-storage-provider.service';
import commentStorageService from './src/comments/CommentStorageService';
import { Sentry } from 'react-native-sentry';
Sentry.config('https://d650fc58f2da4dc8ae9d95847bce152d@sentry.io/1538735').install();
import * as Sentry from '@sentry/react-native';
let deepLinkUrl = '';
......@@ -83,8 +79,8 @@ sessionService.onLogin(async () => {
const user = sessionService.getUser();
Sentry.setUserContext({
userID: user.guid
Sentry.configureScope(scope => {
scope.setUser({id: user.guid});
});
logService.info('[App] Getting minds settings and onboarding progress');
......
......@@ -9,13 +9,54 @@ import {
import { onError } from "mobx-react";
import logService from './src/common/services/log.service';
import Sentry from 'react-native-sentry';
import * as Sentry from '@sentry/react-native';
import { isAbort, isNetworkFail } from './src/common/helpers/abortableFetch';
import { isApiError } from './src/common/services/api.service';
// Init Sentry (if not running test)
if (process.env.JEST_WORKER_ID === undefined) {
Sentry.init({
dsn: 'https://d650fc58f2da4dc8ae9d95847bce152d@sentry.io/1538735',
ignoreErrors: [
'Non-Error exception captured with keys: code, domain, localizedDescription', // ignore initial error of sdk
],
beforeSend(event, hint) {
if (hint.originalException) {
// ignore network request failed
if (isNetworkFail(hint.originalException)) {
return null;
}
// ignore aborts
if (isAbort(hint.originalException)) {
return null;
}
// only log api 500 errors
if (isApiError(hint.originalException) && hint.originalException.status < 500) {
return null;
}
}
// for dev only log into the console
if (__DEV__) {
console.log('sentry', event, hint);
return null;
}
return event;
}
});
}
// Log Mobx global errors
onError(error => {
console.log(error);
logService.exception(error);
})
// react-native-exception-handler global handlers
if (!__DEV__) {
/**
* Globar error handlers
......
......@@ -19,8 +19,6 @@ import keychain from './src/keychain/KeychainStore';
import blockchainTransaction from './src/blockchain/transaction-modal/BlockchainTransactionStore';
import blockchainWallet from './src/blockchain/wallet/BlockchainWalletStore';
import blockchainWalletSelector from './src/blockchain/wallet/BlockchainWalletSelectorStore';
import payments from './src/payments/PaymentsStore';
import checkoutModal from './src/payments/checkout/CheckoutModalStore';
import capture from './src/capture/CaptureStore';
import withdraw from './src/wallet/tokens/WithdrawStore';
import hashtag from './src/common/stores/HashtagStore';
......@@ -55,8 +53,6 @@ const stores = {
blockchainWallet: new blockchainWallet(),
blockchainWalletSelector: new blockchainWalletSelector(),
channelSubscribersStore: new channelSubscribersStore(),
payments: new payments(),
checkoutModal: new checkoutModal(),
capture: new capture(),
withdraw: new withdraw(),
hashtag: new hashtag(),
......
......@@ -14,6 +14,7 @@ function load(count) {
edited:"",
guid:code,
mature:false,
time_created: "1522036284",
ownerObj:{
guid: "824853017709780997",
type: "user",
......@@ -36,6 +37,14 @@ function load(count) {
wire_totals: {
tokens: 1000000000000000000
},
_list: {
viewed: {
viewed: new Map([["1019155171608096768",true]]),
addViewed: () => {
return;
}
}
},
getThumbSource: () => {
return {
source:'http://thisisaurl'
......
......@@ -18,6 +18,7 @@ jest.mock('../../../src/newsfeed/NewsfeedService');
import { getSingle } from '../../../src/newsfeed/NewsfeedService';
import entitiesService from '../../../src/common/services/entities.service';
jest.mock('../../../src/common/BaseModel');
jest.mock('../../../src/newsfeed/activity/Activity', () => 'Activity');
jest.mock('../../../src/comments/CommentList', () => 'CommentList');
jest.mock('../../../src/common/components/CenteredLoading', () => 'CenteredLoading');
......
......@@ -17,7 +17,14 @@ exports[`Activity component renders correctly 1`] = `
<Pinned
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -63,6 +70,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -74,7 +82,14 @@ exports[`Activity component renders correctly 1`] = `
<OwnerBlock
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -120,6 +135,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -147,7 +163,14 @@ exports[`Activity component renders correctly 1`] = `
<ActivityActionSheet
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -193,6 +216,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -234,7 +258,7 @@ exports[`Activity component renders correctly 1`] = `
]
}
>
Invalid date
Mar 25, 2018, 20:51
</Text>
</TouchableOpacity>
</OwnerBlock>
......@@ -248,7 +272,14 @@ exports[`Activity component renders correctly 1`] = `
<ExplicitText
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -294,6 +325,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -316,7 +348,14 @@ exports[`Activity component renders correctly 1`] = `
<Translate
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -362,6 +401,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -380,7 +420,14 @@ exports[`Activity component renders correctly 1`] = `
<MediaView
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -426,6 +473,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -450,7 +498,14 @@ exports[`Activity component renders correctly 1`] = `
<Actions
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -496,6 +551,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -513,7 +569,14 @@ exports[`Activity component renders correctly 1`] = `
<ActivityMetrics
entity={
ActivityModel {
"__list": null,
"__list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"allow_comments": true,
"attachment_guid": false,
"blurb": false,
......@@ -559,6 +622,7 @@ exports[`Activity component renders correctly 1`] = `
"thumbs:down:user_guids": undefined,
"thumbs:up:count": undefined,
"thumbs:up:user_guids": undefined,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......
......@@ -70,6 +70,8 @@ exports[`Activity editor component renders correctly 1`] = `
nsfwValue={Array []}
onLocking={[Function]}
onNsfw={[Function]}
onScheduled={[Function]}
timeCreatedValue={2018-03-26T03:51:24.000Z}
/>
</View>
<View
......
......@@ -18,6 +18,14 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
<CommentList
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Object {
"1019155171608096768": true,
},
},
},
"attachment_guid": false,
"blurb": false,
"container_guid": "activityguid0",
......@@ -42,6 +50,7 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"rowKey": "something0",
"shouldBeBlured": [MockFunction],
"thumbnail_src": false,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -54,6 +63,14 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
autoHeight={false}
entity={
Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Object {
"1019155171608096768": true,
},
},
},
"attachment_guid": false,
"blurb": false,
"container_guid": "activityguid0",
......@@ -78,6 +95,7 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"rowKey": "something0",
"shouldBeBlured": [MockFunction],
"thumbnail_src": false,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -91,6 +109,14 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"state": Object {
"params": Object {
"entity": Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"container_guid": "activityguid0",
......@@ -115,6 +141,7 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"rowKey": "something0",
"shouldBeBlured": [MockFunction],
"thumbnail_src": false,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......@@ -134,6 +161,14 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"state": Object {
"params": Object {
"entity": Object {
"_list": Object {
"viewed": Object {
"addViewed": [Function],
"viewed": Map {
"1019155171608096768" => true,
},
},
},
"attachment_guid": false,
"blurb": false,
"container_guid": "activityguid0",
......@@ -158,6 +193,7 @@ exports[`Activity screen component renders correctly with an entity as param 2`]
"rowKey": "something0",
"shouldBeBlured": [MockFunction],
"thumbnail_src": false,
"time_created": "1522036284",
"title": "TITLE",
"type": "activity",
"wire_totals": Object {
......
......@@ -13,7 +13,7 @@ exports[`ForgotPassword component should renders correctly 1`] = `
style={
Array [
Object {
"color": "white",
"color": "#FFFFFF",
},
Object {
"fontSize": 14,
......
......@@ -77,7 +77,7 @@ exports[`ForgotScreen component should renders correctly 1`] = `
style={
Array [
Object {
"color": "white",
"color": "#FFFFFF",
},
Object {
"fontSize": 14,
......
......@@ -342,7 +342,7 @@ exports[`LoginForm component should renders correctly 1`] = `
style={
Array [
Object {
"color": "white",
"color": "#FFFFFF",
},
Object {
"fontWeight": "bold",
......@@ -396,7 +396,7 @@ exports[`LoginForm component should renders correctly 1`] = `
style={
Array [
Object {
"color": "white",
"color": "#FFFFFF",
},
]
}
......@@ -506,7 +506,7 @@ exports[`LoginForm component should renders correctly 1`] = `
"padding": 10,
},
Object {
"color": "white",
"color": "#FFFFFF",
},
]
}
......@@ -634,7 +634,7 @@ exports[`LoginForm component should renders correctly 1`] = `
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#777777",
"borderRadius": 15,
"borderRadius": 20,
"borderWidth": 1,
"margin": 4,
"opacity": 1,
......@@ -671,7 +671,7 @@ exports[`LoginForm component should renders correctly 1`] = `
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius": 15,
"borderRadius": 20,
"borderWidth": 1,
"margin": 4,
"opacity": 1,
......
......@@ -331,7 +331,8 @@ describe('cature poster component', () => {
// should be called only once
expect(capture.post.mock.calls.length).toBe(1);
expect(capture.post.mock.calls[0][0]).toEqual({ nsfw: [], message: "some awesome post", wire_threshold: null});
const entity = capture.post.mock.calls[0][0];
expect(capture.post.mock.calls[0][0]).toEqual({ nsfw: [], message: "some awesome post", wire_threshold: null, "time_created": entity.time_created});
expect(result).toEqual(response)
......@@ -400,12 +401,14 @@ describe('cature poster component', () => {
// should be called only once
expect(capture.post.mock.calls.length).toBe(1);
const entity = capture.post.mock.calls[0][0];
expect(capture.post.mock.calls[0][0]).toEqual({
nsfw: [],
message: "some awesome post",
wire_threshold: null,
facebook: 1,
twitter: 1
twitter: 1,
time_created: entity.time_created
});
done();
......@@ -446,14 +449,15 @@ describe('cature poster component', () => {
// should be called only once
expect(capture.post).toBeCalled();
const entity = capture.post.mock.calls[0][0];
// should send the attachment data
console.log(capture.post.mock.calls);
expect(capture.post.mock.calls[0][0]).toEqual({
nsfw: [],
message: "some awesome post",
wire_threshold: null,
attachment_guid: 1000,
attachment_license: ''}
attachment_license: '',
time_created: entity.time_created}
);
// should return server response
expect(result).toEqual(response)
......
......@@ -16,6 +16,16 @@ jest.mock('../../src/capture/CaptureStore');
jest.mock('../../src/common/components/LicensePicker', () => 'LicensePicker');
jest.mock('../../src/newsfeed/topbar/TagsSubBar', () => 'TagsSubBar');
Date = class extends Date {
constructor(date) {
if (date) {
return super(date);
}
return new Date('2018-09-20T23:00:00Z');
}
}
defaultState = {
mature: false,
......@@ -53,6 +63,7 @@ const testRenderWithValue = (value) => {
onMature={fn}
onShare={fn}
onLocking={fn}
onScheduled={fn}
/>
).toJSON();
expect(preview).toMatchSnapshot();
......@@ -104,7 +115,7 @@ describe('cature poster flags component', () => {
const hashtagStore = new HashtagStore();
store.loadSuggestedTags.mockResolvedValue();
const capturePosterFlag = renderer.create(
let capturePosterFlag = renderer.create(
<CapturePosterFlags
capture={store}
hashtag={hashtagStore}
......@@ -125,6 +136,19 @@ describe('cature poster flags component', () => {
store.attachment.hasAttachment = true;
capturePosterFlag = renderer.create(
<CapturePosterFlags
capture={store}
hashtag={hashtagStore}
matureValue={defaultState.mature}
shareValue={defaultState.share}
lockValue={defaultState.lock}
onMature={fn}
onShare={fn}
onLocking={fn}
/>
);
picker = capturePosterFlag.root.findAllByType('LicensePicker');
// check there is 1 license picker
......
......@@ -3,18 +3,19 @@
exports[`channel actions component should renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#FFF",
"flexDirection": "row",
"height": 40,
"justifyContent": "flex-end",
"paddingLeft": 8,
"width": 40,
}
Array [
Object {
"flexDirection": "row",
"justifyContent": "flex-end",
},
Object {
"marginTop": 10,
},
]
}
>
<View
accessibilityLabel="Wire Button"
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
......@@ -25,12 +26,16 @@ exports[`channel actions component should renders correctly 1`] = `
onStartShouldSetResponder={[Function]}
style={
Object {
"alignContent": "center",
"alignItems": "center",
"alignSelf": "center",
"flex": 1,
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"opacity": 1,
"padding": 4,
}
}
>
......@@ -39,10 +44,17 @@ exports[`channel actions component should renders correctly 1`] = `
style={
Array [
Object {
"color": "rgb(70, 144, 214)",
"fontSize": 40,
"color": undefined,
"fontSize": 18,
},
undefined,
Array [
Object {
"marginLeft": 5,
},
Object {
"color": "#4690D6",
},
],
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
......@@ -54,30 +66,74 @@ exports[`channel actions component should renders correctly 1`] = `
>
</Text>
<Text
style={
Array [
Object {
"color": "#4690D6",
},
Array [
Object {
"marginLeft": 5,
},
Object {
"marginRight": 5,
},
],
]
}
>
Wire
</Text>
</View>
<Text
allowFontScaling={false}
onPress={[Function]}
<View
accessibilityLabel="More"
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Array [
Object {
"color": undefined,
"fontSize": 24,
},
Object {
"color": "#888888",
"paddingLeft": 10,
},
Object {
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
Object {
"alignItems": "center",
"backgroundColor": "white",
"borderColor": "#4690D6",
"borderRadius": 20,
"borderWidth": 1,
"flexDirection": "row",
"justifyContent": "center",
"margin": 4,
"opacity": 1,
"padding": 4,
}
}
>
</Text>
<Text
style={
Array [
Object {
"color": "#4690D6",
},
Array [
Object {
"marginLeft": 5,
},
Object {
"marginRight": 5,
},
],
]
}
>
More
</Text>
</View>
</View>
`;