Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

Commit

Permalink
lib folder migration
Browse files Browse the repository at this point in the history
  • Loading branch information
radko93 committed May 16, 2020
1 parent 96645df commit 269f3e5
Show file tree
Hide file tree
Showing 42 changed files with 1,502 additions and 3,013 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
8 changes: 4 additions & 4 deletions ios/Podfile.lock
Expand Up @@ -311,7 +311,7 @@ PODS:
- React
- ReactNativeDarkMode (0.2.2):
- React
- RNCAsyncStorage (1.6.3):
- RNCAsyncStorage (1.10.1):
- React
- RNCMaskedView (0.1.10):
- React
Expand All @@ -321,7 +321,7 @@ PODS:
- React
- RNGestureHandler (1.6.1):
- React
- RNKeychain (4.0.5):
- RNKeychain (6.0.0):
- React
- RNReanimated (1.8.0):
- React
Expand Down Expand Up @@ -548,12 +548,12 @@ SPEC CHECKSUMS:
ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
ReactNativeAlternateIcons: b2a8a729d9d9756ed0652c352694f190407f297f
ReactNativeDarkMode: 0178ffca3b10f6a7c9f49d6f9810232b328fa949
RNCAsyncStorage: 3c304d1adfaea02ec732ac218801cb13897aa8c0
RNCAsyncStorage: 39831e0dc5f547a1fb2669eb9e091d460a9be2be
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNFileViewer: b815b353fdc08552766c6325e5b66ff52bb6b7af
RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df
RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38
RNKeychain: 840f8e6f13be0576202aefcdffd26a4f54bfe7b5
RNKeychain: bf2d7e9a0ae7a073c07770dd2aa6d11c67581733
RNReanimated: 955cf4068714003d2f1a6e2bae3fb1118f359aff
RNScreens: cf198f915f8a2bf163de94ca9f5bfc8d326c3706
RNStoreReview: 62d6afd7c37db711a594bbffca6b0ea3a812b7a8
Expand Down
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -20,7 +20,7 @@
"postinstall": "patch-package"
},
"dependencies": {
"@react-native-community/async-storage": "1.6.3",
"@react-native-community/async-storage": "1.10.1",
"@react-native-community/masked-view": "^0.1.10",
"base-64": "^0.1.0",
"bugsnag-react-native": "^2.23.7",
Expand All @@ -39,7 +39,7 @@
"react-native-flag-secure-android": "standardnotes/react-native-flag-secure-android#3d59055",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "^1.6.1",
"react-native-keychain": "^4.0.1",
"react-native-keychain": "^6.0.0",
"react-native-mail": "standardnotes/react-native-mail#9862c76",
"react-native-reanimated": "^1.8.0",
"react-native-safe-area-context": "^1.0.0",
Expand All @@ -54,7 +54,7 @@
"react-navigation-stack": "^1.10.3",
"regenerator": "^0.14.2",
"sn-textview": "standardnotes/sn-textview#f42f0bf",
"snjs": "standardnotes/snjs#9382050",
"snjs": "standardnotes/snjs#a18da1b",
"standard-notes-rn": "standardnotes/standard-notes-rn"
},
"devDependencies": {
Expand All @@ -65,10 +65,10 @@
"@types/faker": "^4.1.11",
"@types/jest": "^25.2.1",
"@types/lodash": "^4.14.150",
"@types/react-native": "^0.62.7",
"@types/react-native": "^0.62.8",
"@types/react-native-vector-icons": "^6.4.5",
"@typescript-eslint/eslint-plugin": "^2.31.0",
"@typescript-eslint/parser": "^2.31.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"babel-jest": "^26.0.1",
"concurrently": "^5.2.0",
"detox": "^16.5.0",
Expand All @@ -83,7 +83,7 @@
"prettier": "^2.0.5",
"react-test-renderer": "16.11.0",
"replace-in-file": "^6.0.0",
"typescript": "^3.8.3"
"typescript": "^3.9.2"
},
"jest": {
"preset": "react-native"
Expand Down
8 changes: 0 additions & 8 deletions src/App.tsx
Expand Up @@ -9,14 +9,6 @@ import {
import { createAppContainer, NavigationActions } from 'react-navigation';
import { createDrawerNavigator, DrawerActions } from 'react-navigation-drawer';
import { createStackNavigator } from 'react-navigation-stack';
import KeysManager from '@Lib/keysManager';
import ApplicationState from '@Lib/ApplicationState';
import Auth from '@Lib/snjs/authManager';
import ModelManager from '@Lib/snjs/modelManager';
import PrivilegesManager from '@Lib/snjs/privilegesManager';
import MigrationManager from '@Lib/snjs/migrationManager';
import Sync from '@Lib/snjs/syncManager';
import ReviewManager from '@Lib/reviewManager';
import Authenticate from '@Screens/Authentication/Authenticate';
import Compose from '@Screens/Compose';
import {
Expand Down
74 changes: 74 additions & 0 deletions src/lib/AlertService.ts
@@ -0,0 +1,74 @@
import { Alert } from 'react-native';

import { SNAlertService } from 'snjs';

export class AlertService extends SNAlertService {
async alert(
title: string,
text: string,
closeButtonText?: string,
onClose?: () => void
) {
return new Promise(resolve => {
// On iOS, confirm should go first. On Android, cancel should go first.
let buttons = [
{
text: closeButtonText,
onPress: async () => {
if (onClose) {
onClose();
}
resolve();
},
},
];
Alert.alert(title, text, buttons, {
cancelable: true,
});
});
}

async confirm(
text: string,
title: string,
confirmButtonText = 'Confirm',
cancelButtonText = 'Cancel',
onConfirm: () => void,
onCancel: () => void,
_destructive = false
) {
return new Promise((resolve, reject) => {
// On iOS, confirm should go first. On Android, cancel should go first.
let buttons = [
{
text: cancelButtonText,
onPress: async () => {
if (onCancel) {
onCancel();
}
reject();
},
},
{
text: confirmButtonText,
onPress: async () => {
if (onConfirm) {
onConfirm();
}
resolve();
},
},
];
Alert.alert(title, text, buttons, {
cancelable: true,
onDismiss: async () => {
// TODO: check alerts
// if (onDismiss) {
// onDismiss();
// }
reject();
},
});
});
}
}

0 comments on commit 269f3e5

Please sign in to comment.