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

Commit

Permalink
Integration sn-rn helper, quit app for keychain iOS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Oct 10, 2019
1 parent f620507 commit 335375d
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -25,3 +25,6 @@
[submodule "vendor/react-native-alternate-icons"]
path = vendor/react-native-alternate-icons
url = git@github.com:mobitar/react-native-alternate-icons.git
[submodule "vendor/standard-notes-rn"]
path = vendor/standard-notes-rn
url = git@github.com:standardnotes/standard-notes-rn.git
1 change: 1 addition & 0 deletions android/app/build.gradle
Expand Up @@ -99,6 +99,7 @@ dependencies {
implementation project(':bugsnag-react-native')
implementation project(':RNMail')
implementation project(':SNTextView')
implementation project(':standard-notes-rn')
implementation project(':react-native-keychain')
implementation project(':react-native-vector-icons')
implementation project(':react-native-aes-crypto')
Expand Down
Expand Up @@ -30,4 +30,4 @@ protected ReactRootView createRootView() {
public void invokeDefaultOnBackPressed() {
moveTaskToBack(true);
}
}
}
Expand Up @@ -31,6 +31,7 @@
import com.hieuvp.fingerprint.ReactNativeFingerprintScannerPackage;
import com.kristiansorens.flagsecure.FlagSecurePackage;
import com.bugsnag.BugsnagReactNative;
import org.standardnotes.SNReactNative.SNReactNativePackage;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -60,7 +61,8 @@ protected List<ReactPackage> getPackages() {
new RNMail(),
new ReactNativeFingerprintScannerPackage(),
new SNTextViewPackage(),
new FlagSecurePackage()
new FlagSecurePackage(),
new SNReactNativePackage()
);
}

Expand Down
3 changes: 3 additions & 0 deletions android/settings.gradle
Expand Up @@ -20,6 +20,9 @@ project(':react-native-gesture-handler').projectDir = new File(rootProject.proje
include ':SNTextView'
project(':SNTextView').projectDir = new File(rootProject.projectDir, '../vendor/sn-textview/android')

include ':standard-notes-rn'
project(':standard-notes-rn').projectDir = new File(rootProject.projectDir, '../vendor/standard-notes-rn/android')

include ':bugsnag-react-native'
project(':bugsnag-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/bugsnag-react-native/android')

Expand Down
30 changes: 30 additions & 0 deletions ios/StandardNotes.xcodeproj/project.pbxproj
Expand Up @@ -56,6 +56,7 @@
CD399CE321E181C7006106AE /* Red.png in Resources */ = {isa = PBXBuildFile; fileRef = CD399CE021E181C6006106AE /* Red.png */; };
CD399CE421E181C7006106AE /* Red@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = CD399CE121E181C7006106AE /* Red@3x.png */; };
CD399CE521E181C7006106AE /* Red@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = CD399CE221E181C7006106AE /* Red@2x.png */; };
CD534871234FD44900FCD828 /* libSNReactNative.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CD534870234FD43200FCD828 /* libSNReactNative.a */; };
CD743C792342ACC700535CC9 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; };
CD743CCE2342AD3F00535CC9 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; };
CDB58A201F6C5193009EF868 /* libRNMail.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CDB58A161F6C5179009EF868 /* libRNMail.a */; };
Expand Down Expand Up @@ -311,6 +312,13 @@
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNStoreReview;
};
CD53486F234FD43200FCD828 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = CD534835234FD43200FCD828 /* SNReactNative.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 15209BEF1D250F63000D0F44;
remoteInfo = SNReactNative;
};
CD5AEDE322825CB8002439FB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = EC178A0479CE4154896293C3 /* RNCWebView.xcodeproj */;
Expand Down Expand Up @@ -532,6 +540,7 @@
CD399CE021E181C6006106AE /* Red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Red.png; sourceTree = "<group>"; };
CD399CE121E181C7006106AE /* Red@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Red@3x.png"; sourceTree = "<group>"; };
CD399CE221E181C7006106AE /* Red@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Red@2x.png"; sourceTree = "<group>"; };
CD534835234FD43200FCD828 /* SNReactNative.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SNReactNative.xcodeproj; path = "../vendor/standard-notes-rn/ios/SNReactNative.xcodeproj"; sourceTree = "<group>"; };
CDB58A041F6C516B009EF868 /* RCTAes.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAes.xcodeproj; path = "../vendor/react-native-aes/ios/RCTAes.xcodeproj"; sourceTree = "<group>"; };
CDB58A0A1F6C5174009EF868 /* ReactNativeFingerprintScanner.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeFingerprintScanner.xcodeproj; path = "../vendor/react-native-fingerprint-scanner/ios/ReactNativeFingerprintScanner.xcodeproj"; sourceTree = "<group>"; };
CDB58A101F6C5178009EF868 /* RNMail.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNMail.xcodeproj; path = "../vendor/react-native-mail/RNMail.xcodeproj"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -560,6 +569,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CD534871234FD44900FCD828 /* libSNReactNative.a in Frameworks */,
ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */,
CD399CD021E16BD6006106AE /* libReactNativeAlternateIcons.a in Frameworks */,
CD17667C1F795DC100165C83 /* libSNTextView.a in Frameworks */,
Expand Down Expand Up @@ -781,6 +791,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
CD534835234FD43200FCD828 /* SNReactNative.xcodeproj */,
CD399C9921E16BCC006106AE /* ReactNativeAlternateIcons.xcodeproj */,
CD17664C1F795AE500165C83 /* SNTextView.xcodeproj */,
CDB58A101F6C5178009EF868 /* RNMail.xcodeproj */,
Expand Down Expand Up @@ -888,6 +899,14 @@
name = Products;
sourceTree = "<group>";
};
CD534836234FD43200FCD828 /* Products */ = {
isa = PBXGroup;
children = (
CD534870234FD43200FCD828 /* libSNReactNative.a */,
);
name = Products;
sourceTree = "<group>";
};
CD5AEDE022825CB8002439FB /* Products */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1223,6 +1242,10 @@
ProductGroup = CDB58A641F6C5294009EF868 /* Products */;
ProjectRef = 54ED130E749A46A3B15B27F2 /* RNVectorIcons.xcodeproj */;
},
{
ProductGroup = CD534836234FD43200FCD828 /* Products */;
ProjectRef = CD534835234FD43200FCD828 /* SNReactNative.xcodeproj */;
},
{
ProductGroup = CD17664D1F795AE500165C83 /* Products */;
ProjectRef = CD17664C1F795AE500165C83 /* SNTextView.xcodeproj */;
Expand Down Expand Up @@ -1470,6 +1493,13 @@
remoteRef = CD4D91841F7BE11800080678 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
CD534870234FD43200FCD828 /* libSNReactNative.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libSNReactNative.a;
remoteRef = CD53486F234FD43200FCD828 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
CD5AEDE422825CB8002439FB /* libRNCWebView.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down
1 change: 1 addition & 0 deletions src/App.js
Expand Up @@ -179,6 +179,7 @@ export default class App extends Component {
await KeysManager.get().loadInitialData();

let ready = () => {
KeysManager.get().markApplicationAsRan();
ApplicationState.get().receiveApplicationStartEvent();
this.setState({ready: true});
}
Expand Down
13 changes: 7 additions & 6 deletions src/lib/keysManager.js
Expand Up @@ -7,6 +7,7 @@ import ModelManager from './sfjs/modelManager'
import Storage from './sfjs/storageManager'
import AlertManager from "@SFJS/alertManager"
import Keychain from "./keychain"
import SNReactNative from 'standard-notes-rn';

let OfflineParamsKey = "pc_params";
let BiometricsPrefs = "biometrics_prefs";
Expand Down Expand Up @@ -130,8 +131,6 @@ export default class KeysManager {
}
})
]).then(async () => {
await this.markApplicationAsRan();

// We only want to run migrations in unlocked app state. If account keys are present, run now,
// otherwise wait until offline keys have been set so that account keys are decrypted.
if(!this.encryptedAccountKeys) {
Expand Down Expand Up @@ -165,16 +164,18 @@ export default class KeysManager {

return AlertManager.get().confirm({
title: "Previous Installation",
text: `We've detected a previous installation of Standard Notes based on your keychain data. Would you like to wipe all data from previous installation? (If you're seeing this message in error, it might mean we're having issues loading your local database. Please restart the app and try again.)`,
confirmButtonText: "Delete Data",
cancelButtonText: "Keep Data",
text: `We've detected a previous installation of Standard Notes based on your keychain data. You must wipe all data from previous installation to continue.\n\nIf you're seeing this message in error, it might mean we're having issues loading your local database. Please restart the app and try again.`,
confirmButtonText: "Delete Local Data",
cancelButtonText: "Quit App",
onConfirm: async () => {
await Storage.get().clear();
await Keychain.clearKeys()
this.parseKeychainValue(null);
this.accountAuthParams = null;
this.user = null;
await this.markApplicationAsRan();
},
onCancel: () => {
SNReactNative.exitApp();
}
})
}
Expand Down
1 change: 1 addition & 0 deletions vendor/standard-notes-rn
Submodule standard-notes-rn added at 7dab35

0 comments on commit 335375d

Please sign in to comment.