Skip to content

Commit

Permalink
Migrate Nyxo to Github
Browse files Browse the repository at this point in the history
  • Loading branch information
plahteenlahti committed Aug 22, 2020
0 parents commit abf7d7f
Show file tree
Hide file tree
Showing 591 changed files with 59,264 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module.exports = {
parser: '@typescript-eslint/parser',
env: {
browser: true,
es6: true,
jest: true,
node: true,
'react-native/react-native': true
},
extends: [
'plugin:react/recommended',
'airbnb',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'prettier'
],
plugins: ['react', 'react-native', '@typescript-eslint', 'prettier'],
ignorePatterns: ['node_modules/'],
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
rules: {
semi: [2, 'never'],
'comma-dangle': 'off',
'max-len': ['error', { ignoreComments: true, code: 120, ignoreStrings: true }],
'prettier/prettier': ['error'],
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'no-use-before-define': 'off',
'import/no-extraneous-dependencies': 'off', // FIXME: exclude test files
'react/prop-types': 'off',
'react/jsx-filename-extension': 'off',
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'react-native/no-unused-styles': 'error',
'react-native/split-platform-components': 'error',
'react/jsx-closing-bracket-location': 'after-props',
'react-native/no-inline-styles': 'error',
'react-native/no-color-literals': 'error',
'react/jsx-closing-bracket-location': 'off',
'react/require-default-props': 'off',
'react-native/no-raw-text': 'off', // This does not currently work with styled components
'react-native/no-single-element-style-arrays': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',

'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
'react/jsx-wrap-multilines': ['error', { declaration: false, assignment: false }]
},
settings: {
'import/resolver': {
'babel-module': {}
},
react: {
version: 'detect'
}
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
128 changes: 128 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
ios/builds/
ios/build/
ios/Vendor
ios/Pods
ios/sentry.properties
ios/Intercom.framework
ios/fastlane/
ios/GoogleService-Info
ios/AppCenter-Config.plist

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
android/app/src/main/res/raw/
raw
android/keystores/
android/app/src/main/res
android/fastlane
android/app/src/main/assets/
android/app/src/main/resources/
android/app/client_secret.json
android/fastlane/


# fastlane specific
fastlane/report.xml


# deliver temporary files
fastlane/Preview.html

# snapshot generated screenshots
fastlane/screenshots

# scan temporary files
fastlane/test_output

# Fastlane builds
builds/*

# node.js
#
node_modules/
.jest/
npm-debug.log
yarn-error.log
coverage

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle

# CocoaPods
ios/Pods/

#amplify
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/mock-data
amplify/backend/amplify-meta.json
amplify/backend/awscloudformation
amplify/team-provider-info.json
build/
dist/
aws-exports.js
awsconfiguration.json
amplifyconfiguration.json
amplify-gradle-config.json
amplifyxc.config
amplify/backend

.secrets
.env
sentry.properties
android/.project
android/debug.keystore
android/.settings/org.eclipse.buildship.core.prefs
ios/Nyxo/GoogleService-Info.plist
android/app/google-services.json
android/app/.settings/org.eclipse.jdt.core.prefs
android/app/.settings/org.eclipse.buildship.core.prefs
ios/Nyxo/AppCenter-Config.plist
rnuc.xcconfig
android/app/.project
18 changes: 18 additions & 0 deletions .graphqlconfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
projects:
nyxoDev:
schemaPath: amplify/backend/api/nyxoDev/build/schema.graphql
includes:
- src/graphql/**/*.ts
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: typescript
generatedFileName: src/API.ts
docsFilePath: src/graphql
region: eu-central-1
apiId: null
maxDepth: 2
extensions:
amplify:
version: 3
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
trailingComma: 'none',
tabWidth: 2,
singleQuote: true,
printWidth: 80,
semi: false,
jsxBracketSameLine: true
}
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Nyxo App

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

##

## Getting started

_Clone repository_

```shell
git clone
cd nyxo-app
yarn
```

### Setting up enviroment variables

Nyxo configurations keys are placed in config.ts file, which then references the requirement enviroment variables from local `.env`file.

## Troubleshooting

#### main.jsbundle missing

Run command `react-native bundle --entry-file index.js --platform ios --dev=false --bundle-output ios/main.jsbundle --assets-dest ios` for iOS
Run command `react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/` for Android

## When you get a weird Xcode error about undefined symbols

If you see something like this:

`Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_RCTReconnectingWebSocket", referenced from: objc-class-ref in libReact.a(RCTPackagerConnection.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)`

Delete your Derived data

## Resetting bundlers etc.

1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
7 changes: 7 additions & 0 deletions __mocks__/@react-native-community/push-notification-ios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
jest.mock('@react-native-community/push-notification-ios', () => ({
configure: jest.fn(),
onRegister: jest.fn(),
onNotification: jest.fn(),
addEventListener: jest.fn(),
requestPermissions: jest.fn()
}))
5 changes: 5 additions & 0 deletions __mocks__/@sentry/react-native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jest.mock('@sentry/react-native', () => ({
setTagsContext: jest.fn(),
setExtraContext: jest.fn(),
captureBreadcrumb: jest.fn()
}))
6 changes: 6 additions & 0 deletions __mocks__/appcenter-analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jest.mock('appcenter-analytics', () => ({
trackEvent: jest.fn(),
removeEventListener: jest.fn(),
requestPermissions: jest.fn(),
configure: jest.fn()
}))
6 changes: 6 additions & 0 deletions __mocks__/appcenter-push.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jest.mock('appcenter-push', () => ({
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
requestPermissions: jest.fn(),
configure: jest.fn()
}))
5 changes: 5 additions & 0 deletions __mocks__/aws-amplify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const Auth = {
currentSession: jest.fn(() => Promise.resolve()),
signIn: jest.fn(() => Promise.resolve()),
signOut: jest.fn(() => Promise.resolve())
}
17 changes: 17 additions & 0 deletions __mocks__/chroma-js.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// jest.mock('chroma-js', () => ({
// default: () => {},
// }));

// jest.mock('chroma-js', () => ({
// addEventListener: jest.fn(),
// removeEventListener: jest.fn(),
// requestPermissions: jest.fn(),
// default: jest.fn(),
// hex: jest.fn(),
// alpha: jest.fn(),
// }));

// @ts-ignore
const chroma = require('chroma-js').default

module.exports = chroma
17 changes: 17 additions & 0 deletions __mocks__/i18n-js.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// jest.mock('i18n-js', () => ({
// I18n: {
// locale: {},
// fallbacks: true,
// translations: {},
// currentLocale: () => {},
// },
// }));

// jest.mock('i18n-js', () => ({
// currentLocale: jest.fn(() => 'en'),
// }));

const I18n = require('i18n-js')

jest.genMockFromModule('i18n-js')
module.exports = I18n
5 changes: 5 additions & 0 deletions __mocks__/moment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const moment = jest.requireActual('moment')

export default (timestamp: string | 0 = 0) => {
return moment(timestamp)
}
5 changes: 5 additions & 0 deletions __mocks__/prop-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jest.mock('prop-types', () => ({
PropTypes: {
node: {}
}
}))
6 changes: 6 additions & 0 deletions __mocks__/react-native-app-auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jest.mock('react-native-app-auth', () => ({
authorize: jest.fn(),
register: jest.fn(),
revoke: jest.fn(),
refresh: jest.fn()
}))
8 changes: 8 additions & 0 deletions __mocks__/react-native-code-push.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const codePush = {
InstallMode: { ON_NEXT_RESTART: 'ON_APP_RESTART' },
CheckFrequency: { ON_APP_RESUME: 'ON_APP_RESUME' }
}

const cb = (_: any) => (app: any) => app
Object.assign(cb, codePush)
export default cb
28 changes: 28 additions & 0 deletions __mocks__/react-native-firebase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const firebase = {
messaging: jest.fn(() => ({
hasPermission: jest.fn(() => Promise.resolve(true)),
subscribeToTopic: jest.fn(),
unsubscribeFromTopic: jest.fn(),
requestPermission: jest.fn(() => Promise.resolve(true)),
getToken: jest.fn(() => Promise.resolve('myMockToken')),
onTokenRefresh: jest.fn(() => Promise.resolve('myMockToken'))
})),
notifications: jest.fn(() => ({
onNotification: jest.fn(),
onNotificationDisplayed: jest.fn(),
android: {
createChannel: jest.fn()
}
}))
}

firebase.notifications.Android = {
Channel: jest.fn(() => ({
setDescription: jest.fn()
})),
Importance: {
Max: {}
}
}

export default firebase
Loading

0 comments on commit abf7d7f

Please sign in to comment.