diff --git a/app/mobile/__tests__/Access.test.js b/app/mobile/__tests__/Access.test.js
index 5a0d5638..93334d8d 100644
--- a/app/mobile/__tests__/Access.test.js
+++ b/app/mobile/__tests__/Access.test.js
@@ -89,8 +89,6 @@ beforeEach(() => {
React.useContext = mockUseContext;
const mockFetch = jest.fn().mockImplementation((url, options) => {
-console.log(url);
-
return Promise.resolve({
json: () => Promise.resolve({
guid: '123',
diff --git a/app/mobile/ios/Databag.xcodeproj/project.pbxproj b/app/mobile/ios/Databag.xcodeproj/project.pbxproj
index e18215b7..d6343f17 100644
--- a/app/mobile/ios/Databag.xcodeproj/project.pbxproj
+++ b/app/mobile/ios/Databag.xcodeproj/project.pbxproj
@@ -567,7 +567,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -639,7 +639,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
diff --git a/app/mobile/ios/Podfile.lock b/app/mobile/ios/Podfile.lock
index a61bdab9..644bf71c 100644
--- a/app/mobile/ios/Podfile.lock
+++ b/app/mobile/ios/Podfile.lock
@@ -414,6 +414,8 @@ PODS:
- React-jsi (= 0.71.3)
- React-logger (= 0.71.3)
- React-perflogger (= 0.71.3)
+ - RNCClipboard (1.11.1):
+ - React-Core
- RNDeviceInfo (10.4.0):
- React-Core
- RNFBApp (17.2.0):
@@ -496,6 +498,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
+ - "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
- "RNFBMessaging (from `../node_modules/@react-native-firebase/messaging`)"
@@ -592,6 +595,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
+ RNCClipboard:
+ :path: "../node_modules/@react-native-clipboard/clipboard"
RNDeviceInfo:
:path: "../node_modules/react-native-device-info"
RNFBApp:
@@ -656,6 +661,7 @@ SPEC CHECKSUMS:
React-RCTVibration: 5199a180d04873366a83855de55ac33ce60fe4d5
React-runtimeexecutor: 7bf0dafc7b727d93c8cb94eb00a9d3753c446c3e
ReactCommon: 5f9a24e64c1c3e2b719014f07cb2acf628983000
+ RNCClipboard: 2834e1c4af68697089cdd455ee4a4cdd198fa7dd
RNDeviceInfo: 749f2e049dcd79e2e44f134f66b73a06951b5066
RNFBApp: 4f8ea53443d52c7db793234d2398a357fc6cfbf1
RNFBMessaging: c686471358d20d54f716a8b7b7f10f8944c966ec
diff --git a/app/mobile/package.json b/app/mobile/package.json
index ebfaaae3..3e24b9de 100644
--- a/app/mobile/package.json
+++ b/app/mobile/package.json
@@ -10,6 +10,7 @@
"test": "jest"
},
"dependencies": {
+ "@react-native-clipboard/clipboard": "^1.11.1",
"@react-native-firebase/app": "^17.2.0",
"@react-native-firebase/messaging": "^17.2.0",
"@react-navigation/bottom-tabs": "^6.5.5",
diff --git a/app/mobile/src/api/getNodeStatus.js b/app/mobile/src/api/getNodeStatus.js
index 134a7596..9770fc8e 100644
--- a/app/mobile/src/api/getNodeStatus.js
+++ b/app/mobile/src/api/getNodeStatus.js
@@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function getNodeStatus(server) {
- let status = await fetchWithTimeout(`http://${server}/admin/status`, { method: 'GET' });
+ let status = await fetchWithTimeout(`https://${server}/admin/status`, { method: 'GET' });
checkResponse(status);
return await status.json();
}
diff --git a/app/mobile/src/api/setNodeStatus.js b/app/mobile/src/api/setNodeStatus.js
index 01dd2711..a34e653d 100644
--- a/app/mobile/src/api/setNodeStatus.js
+++ b/app/mobile/src/api/setNodeStatus.js
@@ -1,7 +1,7 @@
import { checkResponse, fetchWithTimeout } from './fetchUtil';
export async function setNodeStatus(server, token) {
- let status = await fetchWithTimeout(`http://${server}/admin/status?token=${token}`, { method: 'PUT' });
+ let status = await fetchWithTimeout(`https://${server}/admin/status?token=${token}`, { method: 'PUT' });
checkResponse(status);
}
diff --git a/app/mobile/src/context/useStoreContext.hook.js b/app/mobile/src/context/useStoreContext.hook.js
index 5d3beb27..4e0e1912 100644
--- a/app/mobile/src/context/useStoreContext.hook.js
+++ b/app/mobile/src/context/useStoreContext.hook.js
@@ -1,7 +1,7 @@
import { useEffect, useState, useRef, useContext } from 'react';
import SQLite from "react-native-sqlite-storage";
-const DATABAG_DB = 'db_v_101.db';
+const DATABAG_DB = 'db_v_102.db';
export function useStoreContext() {
const [state, setState] = useState({});
diff --git a/app/mobile/src/dashboard/Dashboard.jsx b/app/mobile/src/dashboard/Dashboard.jsx
index 9a1a2e02..7d891ab5 100644
--- a/app/mobile/src/dashboard/Dashboard.jsx
+++ b/app/mobile/src/dashboard/Dashboard.jsx
@@ -1,11 +1,284 @@
-import { Text } from 'react-native';
+import { TextInput, Alert, Switch, TouchableOpacity, View, Text, Modal, FlatList, KeyboardAvoidingView } from 'react-native';
+import Clipboard from '@react-native-clipboard/clipboard';
+import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
+import AntIcon from 'react-native-vector-icons/AntDesign';
+import MatIcon from 'react-native-vector-icons/MaterialCommunityIcons';
import { styles } from './Dashboard.styled';
+import { useLocation } from 'react-router-dom';
import { useDashboard } from './useDashboard.hook';
+import { Logo } from 'utils/Logo';
export function Dashboard(props) {
- const { state, actions } = useDashboard(config, server, token);
+ const location = useLocation();
+ const { config, server, token } = location.state;
+ const { state, actions } = useDashboard(config, server, token);
- return DASHBOARD;
+ const saveConfig = async () => {
+ try {
+ await actions.saveConfig();
+ actions.hideEditConfig();
+ }
+ catch (err) {
+ console.log(err);
+ Alert.alert(
+ 'Failed to Save Settings',
+ 'Please try again.',
+ );
+ }
+ }
+
+ const addUser = async () => {
+ try {
+ await actions.addUser();
+ }
+ catch (err) {
+ console.log(err);
+ Alert.alert(
+ 'Failed to Generate Access Token',
+ 'Please try again.',
+ );
+ }
+ }
+
+ const accessUser = async (accountId) => {
+ try {
+ await actions.accessUser(accountId);
+ }
+ catch (err) {
+ console.log(err);
+ Alert.alert(
+ 'Failed to Generate Access Token',
+ 'Please try again.',
+ );
+ }
+ }
+
+ const removeUser = (accountId) => {
+ Alert.alert(
+ "Deleting Account",
+ "Confirm?",
+ [
+ { text: "Cancel", onPress: () => {}, },
+ { text: "Delete", onPress: async() => {
+ try {
+ await actions.removeUser(accountId);
+ }
+ catch (err) {
+ console.log(err);
+ Alert.alert(
+ "Failed to Delete Account",
+ "Please try again.",
+ );
+ }
+ }}
+ ]
+ )
+ }
+
+ const enableUser = async (accountId, enabled) => {
+ try {
+ await actions.enableUser(accountId, enabled);
+ }
+ catch (err) {
+ console.log(err);
+ Alert.alert(
+ 'Failed to Update Account',
+ 'Please try again.',
+ );
+ }
+ }
+
+ return (
+
+
+ Accounts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ item.accountId}
+ renderItem={({ item }) => (
+
+
+
+ { item.name }
+ { item.handle }
+
+
+ accessUser(item.accountId)}>
+
+
+ { item.disabled && (
+ enableUser(item.accountId, true)}>
+
+
+ )}
+ { !item.disabled && (
+ enableUser(item.accountId, false)}>
+
+
+ )}
+ removeUser(item.accountId)}>
+
+
+
+
+ )}
+ />
+
+
+
+
+
+
+ Settings:
+
+
+
+
+ Account Key Type:
+
+ actions.setKeyType('RSA2048')}>
+ { state.keyType === 'RSA2048' && (
+
+ )}
+ { state.keyType === 'RSA4096' && (
+
+ )}
+ RSA 2048
+
+ actions.setKeyType('RSA4096')}>
+ { state.keyType === 'RSA2048' && (
+
+ )}
+ { state.keyType === 'RSA4096' && (
+
+ )}
+ RSA 4096
+
+
+
+ actions.setPushSupported(!state.pushSupported)}>
+ Enable Push Notifications:
+
+
+
+ actions.setEnableImage(!state.enableImage)}>
+ Enable Image Queue:
+
+
+ actions.setEnableAudio(!state.enableAudio)}>
+ Enable Audio Queue:
+
+
+ actions.setEnableVideo(!state.enableVideo)}>
+ Enable Video Queue:
+
+
+
+
+
+ Cancel
+
+
+ Save
+
+
+
+
+
+
+
+
+
+
+ Create Account:
+
+
+ Token:
+ Clipboard.setString(state.createToken)}>
+ { state.createToken }
+
+
+
+
+
+ Done
+
+
+
+
+
+
+
+
+
+
+ Access Account:
+
+
+ Token:
+ Clipboard.setString(state.accessToken)}>
+ { state.accessToken }
+
+
+
+
+
+ Done
+
+
+
+
+
+
+
+ )
}
diff --git a/app/mobile/yarn.lock b/app/mobile/yarn.lock
index 41b3a103..6d5830b7 100644
--- a/app/mobile/yarn.lock
+++ b/app/mobile/yarn.lock
@@ -1492,6 +1492,11 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
+"@react-native-clipboard/clipboard@^1.11.1":
+ version "1.11.1"
+ resolved "https://registry.yarnpkg.com/@react-native-clipboard/clipboard/-/clipboard-1.11.1.tgz#d3a9e685ce2383b1e92b89a334896c5575cc103d"
+ integrity sha512-nvSIIHzybVWqYxcJE5hpT17ekxAAg383Ggzw5WrYHtkKX61N1AwaKSNmXs5xHV7pmKSOe/yWjtSwxIzfW51I5Q==
+
"@react-native-community/cli-clean@^10.1.1":
version "10.1.1"
resolved "https://registry.npmjs.org/@react-native-community/cli-clean/-/cli-clean-10.1.1.tgz"