From 20036904850341d8fe7da8a097535729d7e18365 Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski Date: Tue, 22 Jun 2021 17:01:28 +0200 Subject: [PATCH 01/15] Redesign the navigation panel --- windows/ReactNativeNotes/MainPage.xaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/windows/ReactNativeNotes/MainPage.xaml b/windows/ReactNativeNotes/MainPage.xaml index 272e066..a4f67ef 100644 --- a/windows/ReactNativeNotes/MainPage.xaml +++ b/windows/ReactNativeNotes/MainPage.xaml @@ -10,31 +10,35 @@ Background="Transparent" mc:Ignorable="d"> - - + - + + + + + + - + - + - + - + From b77077136fc1b365d0fcffdd6e65a9a89ee58e0a Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski Date: Tue, 22 Jun 2021 17:31:22 +0200 Subject: [PATCH 02/15] Create one background gradient for NavigationView The NavigationView now has one graident used for background which is kept between the navigation events. For that reason all backgrounds were removed from all other pages in the application so they do not override the main background. --- windows/ReactNativeNotes/CreateNotePage.xaml | 12 +----------- windows/ReactNativeNotes/MainPage.xaml | 12 +++++++++++- windows/ReactNativeNotes/NotesPage.xaml | 12 +----------- windows/ReactNativeNotes/ToDoListPage.xaml | 12 +----------- windows/ReactNativeNotes/UserAccountPage.xaml | 12 +----------- 5 files changed, 15 insertions(+), 45 deletions(-) diff --git a/windows/ReactNativeNotes/CreateNotePage.xaml b/windows/ReactNativeNotes/CreateNotePage.xaml index e85ef86..8f72a33 100644 --- a/windows/ReactNativeNotes/CreateNotePage.xaml +++ b/windows/ReactNativeNotes/CreateNotePage.xaml @@ -7,15 +7,5 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - - - - - - - - - - + diff --git a/windows/ReactNativeNotes/MainPage.xaml b/windows/ReactNativeNotes/MainPage.xaml index a4f67ef..68235f1 100644 --- a/windows/ReactNativeNotes/MainPage.xaml +++ b/windows/ReactNativeNotes/MainPage.xaml @@ -12,12 +12,22 @@ - + + + + + + + + + + + diff --git a/windows/ReactNativeNotes/NotesPage.xaml b/windows/ReactNativeNotes/NotesPage.xaml index 3b6e62e..a10b481 100644 --- a/windows/ReactNativeNotes/NotesPage.xaml +++ b/windows/ReactNativeNotes/NotesPage.xaml @@ -8,15 +8,5 @@ xmlns:react="using:Microsoft.ReactNative" Background="Transparent" mc:Ignorable="d"> - - - - - - - - - - - + diff --git a/windows/ReactNativeNotes/ToDoListPage.xaml b/windows/ReactNativeNotes/ToDoListPage.xaml index 768229c..800baee 100644 --- a/windows/ReactNativeNotes/ToDoListPage.xaml +++ b/windows/ReactNativeNotes/ToDoListPage.xaml @@ -8,15 +8,5 @@ xmlns:react="using:Microsoft.ReactNative" Background="Transparent" NavigationCacheMode="Enabled"> - - - - - - - - - - - + diff --git a/windows/ReactNativeNotes/UserAccountPage.xaml b/windows/ReactNativeNotes/UserAccountPage.xaml index 97e5ac3..f64650b 100644 --- a/windows/ReactNativeNotes/UserAccountPage.xaml +++ b/windows/ReactNativeNotes/UserAccountPage.xaml @@ -8,15 +8,5 @@ xmlns:react="using:Microsoft.ReactNative" Background="Transparent" mc:Ignorable="d"> - - - - - - - - - - - + From 6bc5be9da91228c1a48930cdb73b8c6f0352bcd6 Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski Date: Tue, 22 Jun 2021 17:54:05 +0200 Subject: [PATCH 03/15] Add Callstack.io logo to the lower-right corner --- windows/ReactNativeNotes/MainPage.xaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/windows/ReactNativeNotes/MainPage.xaml b/windows/ReactNativeNotes/MainPage.xaml index 68235f1..fd9d485 100644 --- a/windows/ReactNativeNotes/MainPage.xaml +++ b/windows/ReactNativeNotes/MainPage.xaml @@ -55,6 +55,16 @@ - + + + + + + + + + {Callstack} + + From fc2bc739cf0c4e6c8ae29ff51543903a5a232bbf Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski Date: Tue, 22 Jun 2021 18:08:12 +0200 Subject: [PATCH 04/15] Remove UserAccount page from application The UserAccount will no longer be available in the application as it will not support loggin system nor user customized notes. Once you open the application, it will have all the notes as created by one user. --- windows/ReactNativeNotes/MainPage.xaml | 6 --- .../NativeModules/UserAccount/User.hpp | 41 ------------------- .../ReactNativeNotes/ReactNativeNotes.vcxproj | 16 -------- .../ReactNativeNotes.vcxproj.filters | 2 - .../ReactNativeNotes/ReactPackageProvider.cpp | 1 - windows/ReactNativeNotes/UserAccountPage.cpp | 16 -------- windows/ReactNativeNotes/UserAccountPage.h | 19 --------- windows/ReactNativeNotes/UserAccountPage.idl | 8 ---- windows/ReactNativeNotes/UserAccountPage.xaml | 12 ------ 9 files changed, 121 deletions(-) delete mode 100644 windows/ReactNativeNotes/NativeModules/UserAccount/User.hpp delete mode 100644 windows/ReactNativeNotes/UserAccountPage.cpp delete mode 100644 windows/ReactNativeNotes/UserAccountPage.h delete mode 100644 windows/ReactNativeNotes/UserAccountPage.idl delete mode 100644 windows/ReactNativeNotes/UserAccountPage.xaml diff --git a/windows/ReactNativeNotes/MainPage.xaml b/windows/ReactNativeNotes/MainPage.xaml index fd9d485..a1e01c6 100644 --- a/windows/ReactNativeNotes/MainPage.xaml +++ b/windows/ReactNativeNotes/MainPage.xaml @@ -30,12 +30,6 @@ - - - - - - diff --git a/windows/ReactNativeNotes/NativeModules/UserAccount/User.hpp b/windows/ReactNativeNotes/NativeModules/UserAccount/User.hpp deleted file mode 100644 index cba61b0..0000000 --- a/windows/ReactNativeNotes/NativeModules/UserAccount/User.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "pch.h" -#include "NativeModules.h" - - -namespace ReactNativeNotes -{ - REACT_MODULE( User ); - struct User - { - public: - REACT_METHOD( GetName, L"getName" ); - void GetName( React::ReactPromise result ) noexcept - { - result.Resolve( React::JSValue( name ) ); - } - - REACT_METHOD( SetName, L"setName" ); - void SetName( const std::string& name ) noexcept - { - this->name = name; - } - - REACT_METHOD( GetEmail, L"getEmail" ); - void GetEmail( React::ReactPromise result ) noexcept - { - result.Resolve( React::JSValue( email ) ); - } - - REACT_METHOD( SetEmail, L"setEmail" ); - void SetEmail( const std::string& email ) noexcept - { - this->email = email; - } - - private: - std::string name; - std::string email; - }; -} \ No newline at end of file diff --git a/windows/ReactNativeNotes/ReactNativeNotes.vcxproj b/windows/ReactNativeNotes/ReactNativeNotes.vcxproj index 1a65328..4e541c8 100644 --- a/windows/ReactNativeNotes/ReactNativeNotes.vcxproj +++ b/windows/ReactNativeNotes/ReactNativeNotes.vcxproj @@ -131,7 +131,6 @@ - NoteWidgetDetailsPage.xaml Code @@ -150,10 +149,6 @@ ToDoListPage.xaml Code - - UserAccountPage.xaml - Code - @@ -210,10 +205,6 @@ ToDoListPage.xaml Code - - UserAccountPage.xaml - Code - @@ -243,10 +234,6 @@ ToDoListPage.xaml Code - - UserAccountPage.xaml - Code - @@ -274,9 +261,6 @@ Designer - - Designer - diff --git a/windows/ReactNativeNotes/ReactNativeNotes.vcxproj.filters b/windows/ReactNativeNotes/ReactNativeNotes.vcxproj.filters index 0483814..5f1d6b7 100644 --- a/windows/ReactNativeNotes/ReactNativeNotes.vcxproj.filters +++ b/windows/ReactNativeNotes/ReactNativeNotes.vcxproj.filters @@ -40,7 +40,6 @@ - @@ -86,7 +85,6 @@ - \ No newline at end of file diff --git a/windows/ReactNativeNotes/ReactPackageProvider.cpp b/windows/ReactNativeNotes/ReactPackageProvider.cpp index 24d5ed7..670c928 100644 --- a/windows/ReactNativeNotes/ReactPackageProvider.cpp +++ b/windows/ReactNativeNotes/ReactPackageProvider.cpp @@ -6,7 +6,6 @@ #include "NativeModules/NoteWidgetClickHandler.hpp" #include "NativeModules/Repository/Repository.hpp" #include "NativeModules/UserAccount/FilePicker.hpp" -#include "NativeModules/UserAccount/User.hpp" using namespace winrt::Microsoft::ReactNative; diff --git a/windows/ReactNativeNotes/UserAccountPage.cpp b/windows/ReactNativeNotes/UserAccountPage.cpp deleted file mode 100644 index 23536ae..0000000 --- a/windows/ReactNativeNotes/UserAccountPage.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "pch.h" -#include "UserAccountPage.h" -#include "UserAccountPage.g.cpp" - -#include "App.h" - - -namespace winrt::ReactNativeNotes::implementation -{ - UserAccountPage::UserAccountPage() - { - InitializeComponent(); - auto app = Windows::UI::Xaml::Application::Current().as(); - ReactRootView().ReactNativeHost( app->Host() ); - } -} diff --git a/windows/ReactNativeNotes/UserAccountPage.h b/windows/ReactNativeNotes/UserAccountPage.h deleted file mode 100644 index 2cc2356..0000000 --- a/windows/ReactNativeNotes/UserAccountPage.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "UserAccountPage.g.h" - -namespace winrt::ReactNativeNotes::implementation -{ - class UserAccountPage : public UserAccountPageT - { - public: - UserAccountPage(); - }; -} - -namespace winrt::ReactNativeNotes::factory_implementation -{ - class UserAccountPage : public UserAccountPageT - { - }; -} diff --git a/windows/ReactNativeNotes/UserAccountPage.idl b/windows/ReactNativeNotes/UserAccountPage.idl deleted file mode 100644 index 196446a..0000000 --- a/windows/ReactNativeNotes/UserAccountPage.idl +++ /dev/null @@ -1,8 +0,0 @@ -namespace ReactNativeNotes -{ - [default_interface] - runtimeclass UserAccountPage : Windows.UI.Xaml.Controls.Page - { - UserAccountPage(); - } -} diff --git a/windows/ReactNativeNotes/UserAccountPage.xaml b/windows/ReactNativeNotes/UserAccountPage.xaml deleted file mode 100644 index f64650b..0000000 --- a/windows/ReactNativeNotes/UserAccountPage.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - From abbbb11f58cd6f867c90a08a80ca57c18f7b8ddc Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski Date: Tue, 22 Jun 2021 18:25:42 +0200 Subject: [PATCH 05/15] Fix: incorrect logo --- windows/ReactNativeNotes/MainPage.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/ReactNativeNotes/MainPage.xaml b/windows/ReactNativeNotes/MainPage.xaml index a1e01c6..d1d1269 100644 --- a/windows/ReactNativeNotes/MainPage.xaml +++ b/windows/ReactNativeNotes/MainPage.xaml @@ -57,7 +57,7 @@ - {Callstack} + {callstack} From 0408ce06acbe290e341f7b0d92137d391332c5bc Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski Date: Wed, 23 Jun 2021 10:32:00 +0200 Subject: [PATCH 06/15] Build ARM64 instead of ARM --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 95df341..07f4522 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,12 +72,12 @@ workflows: - build-Application-Configuration-Platform: name: build-Application-Release-ARM configuration: "release" - platform: "ARM" + platform: "ARM64" requires: - install - build-Application-Configuration-Platform: name: build-Application-Debug-ARM configuration: "debug" - platform: "ARM" + platform: "ARM64" requires: - install From c57201ff706d38d79e771767c6edbb95af4c7f98 Mon Sep 17 00:00:00 2001 From: Bartosz Klonowski Date: Wed, 23 Jun 2021 11:51:51 +0200 Subject: [PATCH 07/15] Simplify the Notes FlatList handling The FlatList containing all the notes created in the application were previously being rerendered each time the window's size changed. This has been optimized by handling the whole database fetch procedure in the main notes screen instead of delegating it into each note widget. The current solution is that when NotesScreen page loads the database returns the full set of notes already packed as objects. This is returned as a Promise, which allows to render each note separately and only then fill them with data. --- index.js | 1 - src/NotesMainPanel.js | 14 +- src/UserAccountPanel.js | 159 ------------------ src/Widgets/NoteWidget.js | 30 +--- .../NativeModules/DatabaseHandler.hpp | 6 +- windows/ReactNativeNotes/NotesPage.xaml | 1 + 6 files changed, 10 insertions(+), 201 deletions(-) delete mode 100644 src/UserAccountPanel.js diff --git a/index.js b/index.js index 44dd6a9..3393465 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,6 @@ import {AppRegistry} from 'react-native'; import NotesMainPanel from './src/NotesMainPanel'; -import UserAccountPanel from './src/UserAccountPanel'; import ApplicationSettingsPanel from './src/ApplicationSettingsPanel'; import NoteWidgetDetailsPanel from './src/NoteWidgetDetailsPanel'; import CreateNotePanel from './src/CreateNotePanel'; diff --git a/src/NotesMainPanel.js b/src/NotesMainPanel.js index e8de84f..dd1fa60 100644 --- a/src/NotesMainPanel.js +++ b/src/NotesMainPanel.js @@ -11,7 +11,6 @@ import { FlatList, NativeModules, StyleSheet, - Text, View, } from 'react-native'; import NoteWidget from './Widgets/NoteWidget'; @@ -50,23 +49,18 @@ class NotesMainPanel extends React.Component { Dimensions.removeEventListener("change", this.onChange); }; - createNotesKeys = (numberOfNotes) => { - let allNotesKeys = []; - for(id = 0; id < numberOfNotes; id++) { - const nextObject = {key: id}; - allNotesKeys.push(nextObject); - } - this.setState({notes: allNotesKeys}); + createNotesKeys = (notesIDs) => { + this.setState({notes: notesIDs}); }; getDataFromDatabase = () => { - NativeModules.Database.getNumberOfNotes() + NativeModules.Database.getAllNotesIDs() .then(result => this.createNotesKeys(result)) .catch(error => Alert.alert("ERROR!", `Result: ${error}`)); }; renderNote = notes => { - return + return }; render() { diff --git a/src/UserAccountPanel.js b/src/UserAccountPanel.js deleted file mode 100644 index 3587688..0000000 --- a/src/UserAccountPanel.js +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @format - * @flow strict-local - */ - -import React from 'react'; -import { - AppRegistry, - StyleSheet, - View, - NativeModules, - Alert, - Image, - TextInput, - Button, - Text, -} from 'react-native'; - - -class UserAccountPanel extends React.Component { - constructor(props) { - super(props); - this.state = { - userName: "", - userEmail: "", - isEditing: false, - } - }; - - componentDidMount() { - NativeModules.User.getName() - .then(result => this.setState({userName: result})) - .catch(error => Alert.alert("ERROR!", `${error}`)); - NativeModules.User.getEmail() - .then(result => this.setState({userEmail: result})) - .catch(error => Alert.alert("ERROR!", `${error}`)); - }; - - userNameOnChange = (text) => { - this.setState({userName: text}); - }; - - userEmailOnChange = (text) => { - this.setState({userEmail: text}); - } - - - quitButtonPressed = () => { - if(this.state.isEditing) { - Alert.alert("Are you sure?", "It looks like you still have unsaved changes, which are going to be lost.", - [ - { - text: "No!", - style: "cancel" - }, - { - text: "Yes, quit!", - onPress: () => NativeModules.NoteWidgetClickHandler.goToNotesScreen() - } - ]) - } - else { - NativeModules.NoteWidgetClickHandler.goToNotesScreen(); - } - }; - - saveButtonPressed = () => { - NativeModules.User.setEmail(this.state.userEmail); - NativeModules.User.setName(this.state.userName); - this.setState({isEditing: false}); - } - - editButtonPressed = () => { - this.setState({isEditing: true}); - }; - - - render() { - return ( - - - - - - User's name: - - - User's email: - - - - - -