minor fixes

This commit is contained in:
ammarahm-ed
2020-02-02 14:24:24 +05:00
parent 10956cddad
commit 884aa56d08
12 changed files with 14268 additions and 13905 deletions

View File

@@ -15,12 +15,14 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,36 @@ package com.notes;
import com.facebook.react.ReactActivity;
import android.view.KeyEvent;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import android.content.Intent;
import android.content.res.Configuration;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import android.os.Bundle;
import com.facebook.react.ReactFragmentActivity;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactApplicationContext;
import android.view.WindowManager;
import android.os.Build;
import android.provider.Settings;
import android.net.Uri;
import android.widget.Toast;
import android.app.Activity;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.bridge.Arguments;
import android.database.Cursor;
import android.provider.MediaStore;
import androidx.annotation.Nullable;
public class MainActivity extends ReactActivity {
/**
@@ -17,8 +47,12 @@ public class MainActivity extends ReactActivity {
return super.onKeyUp(keyCode, event);
}
@Override
protected String getMainComponentName() {
return "Notes";
}
}

View File

@@ -12,6 +12,7 @@
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
2241ADEB42028CF0AD5587E2 /* libPods-Notes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 654E157423E6A5D9008A3451 /* libPods-Notes.a */; };
2AC5332F791F4AC973615596 /* libPods-Notes-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 36FE4CF96F141D64B0A0C1FF /* libPods-Notes-tvOS.a */; };
2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
@@ -24,6 +25,7 @@
653FA3DC23D5DD1B004DA60B /* NotoSerif-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 653FA3D923D5DD1B004DA60B /* NotoSerif-Regular.ttf */; };
656D9DFF23D49A4600C49628 /* Web.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 656D9DFE23D49A4600C49628 /* Web.bundle */; };
773523A6669C9373D8945A06 /* libPods-Notes-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 177E12D91F5B0732079F75AB /* libPods-Notes-tvOSTests.a */; };
CE84FC9EAE5373A65AB003DE /* libPods-Notes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 654E158023E6AD1E008A3451 /* libPods-Notes.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -77,6 +79,12 @@
653FA3D723D5DD1B004DA60B /* NotoSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "NotoSans-Regular.ttf"; path = "../../../../../html/Web.bundle/site/fonts/Noto_Sans/NotoSans-Regular.ttf"; sourceTree = "<group>"; };
653FA3D823D5DD1B004DA60B /* NotoSerif-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "NotoSerif-Bold.ttf"; path = "../../../../../html/Web.bundle/site/fonts/Noto_Serif/NotoSerif-Bold.ttf"; sourceTree = "<group>"; };
653FA3D923D5DD1B004DA60B /* NotoSerif-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "NotoSerif-Regular.ttf"; path = "../../../../../html/Web.bundle/site/fonts/Noto_Serif/NotoSerif-Regular.ttf"; sourceTree = "<group>"; };
654E157223E69FBE008A3451 /* libReactNativeShareExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReactNativeShareExtension.a; sourceTree = BUILT_PRODUCTS_DIR; };
654E157423E6A5D9008A3451 /* libPods-Notes.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-Notes.a"; sourceTree = BUILT_PRODUCTS_DIR; };
654E157623E6A655008A3451 /* libReactNativeShareExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReactNativeShareExtension.a; sourceTree = BUILT_PRODUCTS_DIR; };
654E157E23E6AD17008A3451 /* libReactNativeShareExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReactNativeShareExtension.a; sourceTree = BUILT_PRODUCTS_DIR; };
654E158023E6AD1E008A3451 /* libPods-Notes.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-Notes.a"; sourceTree = BUILT_PRODUCTS_DIR; };
654E158C23E6AEE6008A3451 /* libReact-Core.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-Core.a"; sourceTree = BUILT_PRODUCTS_DIR; };
656D9DFE23D49A4600C49628 /* Web.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Web.bundle; path = ../html/Web.bundle; sourceTree = "<group>"; };
6FB6DE7AD66669BE4A951A9E /* Pods-Notes-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Notes-tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-Notes-tvOSTests/Pods-Notes-tvOSTests.debug.xcconfig"; sourceTree = "<group>"; };
87D2DFC238DED597B12E218E /* Pods-Notes-tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Notes-tvOSTests.release.xcconfig"; path = "Target Support Files/Pods-Notes-tvOSTests/Pods-Notes-tvOSTests.release.xcconfig"; sourceTree = "<group>"; };
@@ -104,6 +112,8 @@
buildActionMask = 2147483647;
files = (
58062BBC8B02A59BE1E73AED /* libPods-Notes.a in Frameworks */,
2241ADEB42028CF0AD5587E2 /* libPods-Notes.a in Frameworks */,
CE84FC9EAE5373A65AB003DE /* libPods-Notes.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -161,6 +171,12 @@
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
isa = PBXGroup;
children = (
654E158C23E6AEE6008A3451 /* libReact-Core.a */,
654E158023E6AD1E008A3451 /* libPods-Notes.a */,
654E157E23E6AD17008A3451 /* libReactNativeShareExtension.a */,
654E157623E6A655008A3451 /* libReactNativeShareExtension.a */,
654E157423E6A5D9008A3451 /* libPods-Notes.a */,
654E157223E69FBE008A3451 /* libReactNativeShareExtension.a */,
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
ED2971642150620600B7C4FE /* JavaScriptCore.framework */,
FF962EEB8D0C9B17231DA150 /* libPods-Notes.a */,
@@ -724,7 +740,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "../node_modules/react-native-fast-storage/ios";
INFOPLIST_FILE = Notes/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
@@ -745,7 +760,6 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "../node_modules/react-native-fast-storage/ios";
INFOPLIST_FILE = Notes/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Latest</string>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@@ -233,6 +233,8 @@ PODS:
- React
- RNScreens (1.0.0-alpha.23):
- React
- RNShare (3.0.0):
- React
- RNVectorIcons (6.6.0):
- React
- Yoga (1.14.0)
@@ -272,6 +274,7 @@ DEPENDENCIES:
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNShare (from `../node_modules/react-native-share`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
@@ -343,6 +346,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-reanimated"
RNScreens:
:path: "../node_modules/react-native-screens"
RNShare:
:path: "../node_modules/react-native-share"
RNVectorIcons:
:path: "../node_modules/react-native-vector-icons"
Yoga:
@@ -382,6 +387,7 @@ SPEC CHECKSUMS:
RNGestureHandler: a4ddde1ffc6e590c8127b8b7eabfdade45475c74
RNReanimated: b2ab0b693dddd2339bd2f300e770f6302d2e960c
RNScreens: f28b48b8345f2f5f39ed6195518291515032a788
RNShare: 0e19ddb0bf338b62702ce1d9e001ee14effa68a8
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b

View File

@@ -98,7 +98,7 @@ const getDpi = pd => {
const correction = (size, multiplier) => {
let dSize = getDeviceSize();
console.log(getDeviceSize());
if (dSize > 4 && dSize <= 5.3 && pixelDensity <= 3) {
return size * 0.87;
} else if (dSize > 5.5 && dSize < 6.5 && pixelDensity <= 3) {
@@ -118,7 +118,6 @@ const correction = (size, multiplier) => {
export const normalize = size => {
let pd = pixelDensity;
console.log(pd);
if (pd === 1 || pd < 1) {
return correction(size, 0.75);

View File

@@ -110,12 +110,14 @@ export default class ActionSheet extends Component {
let diff;
if (height > this.customComponentHeight) {
diff = height - this.customComponentHeight;
this._scrollTo(this.prevScroll + diff);
//this._scrollTo(this.prevScroll + diff + 15);
this.customComponentHeight = height;
} else {
diff = this.customComponentHeight - height;
this._scrollTo(this.prevScroll - diff);
// this._scrollTo(this.prevScroll - diff - 7);
this.customComponentHeight = height;
}
return;
@@ -244,8 +246,7 @@ export default class ActionSheet extends Component {
style={{
width: '100%',
}}
enabled={Platform.OS === 'ios' ? true : false}
behavior="position">
behavior={Platform.OS === 'ios' ? 'padding' : null}>
<ScrollView
bounces={false}
ref={ref => (this.scrollViewRef = ref)}

View File

@@ -73,13 +73,11 @@ export const ActionSheetComponent = ({
let tagToAdd = null;
let backPressCount = 0;
const _onSubmit = () => {
if (!tagToAdd || tagToAdd === '#') return;
const _onSubmit = async () => {
if (!tagToAdd || tagToAdd === '') return;
let tag = tagToAdd;
if (tag[0] !== '#') {
tag = '#' + tag;
}
if (tag.includes(' ')) {
tag = tag.replace(' ', '_');
}
@@ -92,22 +90,18 @@ export const ActionSheetComponent = ({
}
tagsInputRef.setNativeProps({
text: '#',
text: '',
});
db.addNote({
await db.addNote({
dateCreated: note.dateCreated,
content: note.content,
title: note.title,
tags: oldProps.tags,
});
setNote({...db.getNote(note.dateCreated)});
tagToAdd = '';
setTimeout(() => {
//tagsInputRef.focus();
}, 300);
};
const _onKeyPress = event => {
const _onKeyPress = async event => {
if (event.nativeEvent.key === 'Backspace') {
if (backPressCount === 0 && !tagToAdd) {
backPressCount = 1;
@@ -119,14 +113,12 @@ export const ActionSheetComponent = ({
let tagInputValue = note.tags[note.tags.length - 1];
let oldProps = {...note};
if (oldProps.tags.length === 1) return;
if (oldProps.tags.length === 0) return;
oldProps.tags.splice(oldProps.tags.length - 1);
db.addNote({
await db.addNote({
dateCreated: note.dateCreated,
content: note.content,
title: note.title,
tags: oldProps.tags,
});
setNote({...db.getNote(note.dateCreated)});
@@ -136,7 +128,7 @@ export const ActionSheetComponent = ({
});
setTimeout(() => {
tagsInputRef.focus();
//tagsInputRef.focus();
}, 300);
}
}
@@ -166,7 +158,6 @@ export const ActionSheetComponent = ({
dispatch({type: ACTIONS.PINNED});
dispatch({type: ACTIONS.FAVORITES});
}
console.log(toAdd);
setNote({...toAdd});
};
@@ -308,14 +299,12 @@ export const ActionSheetComponent = ({
const _renderTag = tag => (
<TouchableOpacity
key={tag}
onPress={() => {
onPress={async () => {
let oldProps = {...note};
oldProps.tags.splice(oldProps.tags.indexOf(tag), 1);
db.addNote({
await db.addNote({
dateCreated: note.dateCreated,
content: note.content,
title: note.title,
tags: oldProps.tags,
});
localRefresh(item.type);

View File

@@ -40,8 +40,10 @@ export const reducer = (state, action) => {
};
}
case ACTIONS.TAGS: {
let tagList = db.getTags();
return {
...state,
tags: [...tagList],
};
}
case ACTIONS.FAVORITES: {

View File

@@ -172,6 +172,9 @@ const Editor = ({navigation, noMenu}) => {
if (timestamp !== dateCreated) {
timestamp = dateCreated;
note = db.getNote(timestamp);
if (DDS.isTab) {
dispatch({
type: ACTIONS.CURRENT_EDITING_NOTE,
@@ -259,7 +262,7 @@ const Editor = ({navigation, noMenu}) => {
timestamp = note.dateCreated;
content = note.content;
saveCounter = 0;
console.log('here');
if (title !== null || title === '') {
post(
JSON.stringify({
@@ -271,10 +274,13 @@ const Editor = ({navigation, noMenu}) => {
post('focusTitle');
post('clear');
}
if (note.content.text === '' || note.content.delta === null) {
if (note.content.text === '' && note.content.delta === null) {
post('clear');
} else {
} else if (note.content.delta) {
post(JSON.stringify(note.content.delta));
} else {
console.log('herrree');
post(JSON.stringify({type: 'text', value: note.content.text}));
}
};
@@ -392,7 +398,6 @@ const Editor = ({navigation, noMenu}) => {
height: 50,
justifyContent: 'center',
alignItems: 'flex-end',
paddingRight: 12,
zIndex: 800,
}}>
@@ -431,8 +436,8 @@ const Editor = ({navigation, noMenu}) => {
Platform.OS === 'ios'
? {uri: sourceUri}
: {
uri: 'file:///android_asset/texteditor.html',
baseUrl: 'file:///android_asset/',
uri: 'http://192.168.10.12:8080/texteditor.html',
baseUrl: 'http://192.168.10.12:8080/',
}
}
style={{

View File

@@ -1,17 +1,21 @@
import React, {useEffect, useState} from 'react';
import {View, Text, Dimensions, SafeAreaView, FlatList} from 'react-native';
import {SIZE, pv, WEIGHT} from '../../common/common';
import React, {useEffect} from 'react';
import {Dimensions, FlatList, SafeAreaView, Text, View} from 'react-native';
import {pv, SIZE, WEIGHT} from '../../common/common';
import {Header} from '../../components/header';
import {useAppContext} from '../../provider/useAppContext';
import {TagsPlaceHolder} from '../../components/ListPlaceholders';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {db} from '../../../App';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
export const Tags = ({navigation}) => {
const [state, dispatch] = useTracked();
const {colors} = state;
const {colors, tags} = state;
useEffect(() => {
dispatch({type: ACTIONS.TAGS});
}, []);
return (
<SafeAreaView
@@ -21,7 +25,13 @@ export const Tags = ({navigation}) => {
}}>
<Header canGoBack={false} heading="Tags" menu={true} />
<View style={{width: '90%', alignSelf: 'center', height: '100%'}}>
<View
style={{
width: '100%',
alignSelf: 'center',
height: '100%',
paddingHorizontal: 12,
}}>
<FlatList
style={{
height: '100%',
@@ -29,7 +39,7 @@ export const Tags = ({navigation}) => {
contentContainerStyle={{
height: '100%',
}}
data={[]}
data={tags}
ListEmptyComponent={
<View
style={{
@@ -64,10 +74,10 @@ export const Tags = ({navigation}) => {
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
margin: 5,
margin: 0,
paddingVertical: pv,
borderBottomWidth: 1.5,
borderBottomColor: colors.navbg,
borderBottomColor: colors.nav,
}}>
<Text
style={{
@@ -81,15 +91,14 @@ export const Tags = ({navigation}) => {
}}>
#
</Text>
{item.slice(1)}
{item.title}
{'\n'}
<Text
style={{
fontSize: SIZE.xs,
color: colors.icon,
}}>
10 notes
{item.count} note
</Text>
</Text>
</View>