mirror of
https://github.com/standardnotes/mobile.git
synced 2026-04-21 22:56:58 -04:00
Merge branch 'johnny243-fix-issue/181'
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import Storage from './sfjs/storageManager'
|
||||
|
||||
const LastExportDateKey = "LastExportDateKey";
|
||||
const LastExportDateKey = 'LastExportDateKey'
|
||||
const DontShowAgainUnsupportedEditorsKey = 'DoNotShowAgainUnsupportedEditorsKey'
|
||||
|
||||
export default class UserPrefsManager {
|
||||
|
||||
static instance = null;
|
||||
static instance = null
|
||||
static get() {
|
||||
if(this.instance == null) {
|
||||
this.instance = new UserPrefsManager();
|
||||
@@ -24,7 +24,7 @@ export default class UserPrefsManager {
|
||||
|
||||
async getLastExportDate() {
|
||||
if(!this.lastExportDate) {
|
||||
var date = await Storage.get().getItem(LastExportDateKey);
|
||||
let date = await Storage.get().getItem(LastExportDateKey);
|
||||
if(date) {
|
||||
this.lastExportDate = new Date(JSON.parse(date));
|
||||
}
|
||||
@@ -32,4 +32,18 @@ export default class UserPrefsManager {
|
||||
|
||||
return this.lastExportDate;
|
||||
}
|
||||
|
||||
async setDontShowAgainEditorsNotSupported() {
|
||||
await Storage.get().setItem(DontShowAgainUnsupportedEditorsKey, JSON.stringify(true));
|
||||
this.dontShowAgainUnsupportedEditors = true;
|
||||
}
|
||||
|
||||
async getDontShowAgainEditorsNotSupported() {
|
||||
if(this.dontShowAgainUnsupportedEditors === null || this.dontShowAgainUnsupportedEditors === undefined) {
|
||||
let dontShowAgain = await Storage.get().getItem(DontShowAgainUnsupportedEditorsKey);
|
||||
this.dontShowAgainUnsupportedEditors = dontShowAgain !== null;
|
||||
}
|
||||
|
||||
return this.dontShowAgainUnsupportedEditors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { WebView } from 'react-native-webview';
|
||||
|
||||
import ComponentManager from '@Lib/componentManager'
|
||||
import ModelManager from '@Lib/sfjs/modelManager'
|
||||
import UserPrefsManager from '@Lib/userPrefsManager'
|
||||
|
||||
import StyleKit from "@Style/StyleKit"
|
||||
import ApplicationState from "@Lib/ApplicationState"
|
||||
@@ -45,7 +46,20 @@ export default class ComponentView extends Component {
|
||||
componentDidMount() {
|
||||
if(Platform.OS == "android" && Platform.Version <= 23) {
|
||||
// postMessage doesn't work on Android <= 6 (API version 23) https://github.com/facebook/react-native/issues/11594
|
||||
Alert.alert('Editors Not Supported', `Web editors require Android 7.0 or greater. Your version does not support web editors. Changes you make may not be properly saved. Please switch to the Plain Editor for the best experience.`, [{text: 'OK'}])
|
||||
UserPrefsManager.get().getDontShowAgainEditorsNotSupported().then((dontShowAgain) => {
|
||||
if(dontShowAgain) {
|
||||
return;
|
||||
}
|
||||
|
||||
Alert.alert(
|
||||
'Editors Not Supported',
|
||||
'Web editors require Android 7.0 or greater. Your version does not support web editors. Changes you make may not be properly saved. Please switch to the Plain Editor for the best experience.',
|
||||
[
|
||||
{text: "Don't show again", onPress: () => UserPrefsManager.get().setDontShowAgainEditorsNotSupported()},
|
||||
{text: 'OK'}
|
||||
]
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user