Skip to content

Commit

Permalink
chore: auto backups
Browse files Browse the repository at this point in the history
  • Loading branch information
apotdevin committed Feb 1, 2022
1 parent 7b22975 commit b1a7dba
Show file tree
Hide file tree
Showing 25 changed files with 641 additions and 29 deletions.
3 changes: 3 additions & 0 deletions schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ type Mutation {
removeTwofaSecret(token: String!): Boolean!
sendMessage(maxFee: Float, message: String!, messageType: String, publicKey: String!, tokens: Float): Float!
sendToAddress(address: String!, fee: Float, sendAll: Boolean, target: Float, tokens: Float): ChainAddressSend!
toggleAutoBackups: Boolean!
updateFees(base_fee_tokens: Float, cltv_delta: Float, fee_rate: Float, max_htlc_mtokens: String, min_htlc_mtokens: String, transaction_id: String, transaction_vout: Float): Boolean!
updateMultipleFees(channels: [UpdateRoutingFeesParams!]!): Boolean!
updateTwofaSecret(secret: String!, token: String!): Boolean!
Expand Down Expand Up @@ -661,6 +662,7 @@ type Query {
getAccountingReport(category: String, currency: String, fiat: String, month: String, year: String): String!
getAmbossLoginToken: String!
getAmbossUser: AmbossUser
getBackupState: Boolean!
getBackups: String!
getBaseCanConnect: Boolean!
getBaseNodes: [BaseNode!]!
Expand Down Expand Up @@ -704,6 +706,7 @@ type Query {
getWalletInfo: Wallet!
recoverFunds(backup: String!): Boolean!
signMessage(message: String!): String!
verifyBackup(backup: String!): Boolean!
verifyBackups(backup: String!): Boolean!
verifyMessage(message: String!, signature: String!): String!
}
Expand Down
2 changes: 2 additions & 0 deletions src/client/pages/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { PrivacySettings } from '../../src/views/settings/Privacy';
import { Security } from '../../src/views/settings/Security';
import { NetworkInfo } from '../../src/views/home/networkInfo/NetworkInfo';
import { NotificationSettings } from '../../src/views/settings/Notifications';
import { AmbossSettings } from '../../src/views/settings/Amboss';

export const ButtonRow = styled.div`
width: auto;
Expand All @@ -27,6 +28,7 @@ const SettingsView = () => {
<>
<InterfaceSettings />
<NotificationSettings />
<AmbossSettings />
<Security />
<DashboardSettings />
<PrivacySettings />
Expand Down
21 changes: 20 additions & 1 deletion src/client/src/components/buttons/multiButton/MultiButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import {
multiSelectColor,
colorButtonBorder,
multiButtonColor,
themeColors,
} from '../../../styles/Themes';
import ScaleLoader from 'react-spinners/ScaleLoader';

interface StyledSingleProps {
selected?: boolean;
Expand Down Expand Up @@ -34,6 +36,7 @@ const StyledSingleButton = styled.button<StyledSingleProps>`
`;

interface SingleButtonProps {
disabled?: boolean;
selected?: boolean;
color?: string;
withPadding?: string;
Expand All @@ -42,13 +45,15 @@ interface SingleButtonProps {

export const SingleButton: React.FC<SingleButtonProps> = ({
children,
disabled,
selected,
color,
withPadding,
onClick,
}) => {
return (
<StyledSingleButton
disabled={disabled}
selected={selected}
buttonColor={color}
withPadding={withPadding}
Expand Down Expand Up @@ -79,11 +84,25 @@ const MultiBackground = styled.div<MultiBackProps>`

interface MultiButtonProps {
margin?: string;
loading?: boolean;
width?: string;
}

export const MultiButton: React.FC<MultiButtonProps> = ({
children,
margin,
loading,
width = 'auto',
}) => {
return <MultiBackground margin={margin}>{children}</MultiBackground>;
return (
<MultiBackground margin={margin}>
{loading ? (
<div style={{ width, textAlign: 'center' }}>
<ScaleLoader height={21} color={themeColors.blue3} />
</div>
) : (
children
)}
</MultiBackground>
);
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/client/src/graphql/mutations/toggleAutoBackups.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { gql } from '@apollo/client';

export const TOGGLE_AUTO_BACKUPS = gql`
mutation ToggleAutoBackups {
toggleAutoBackups
}
`;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/client/src/graphql/queries/getBackupState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { gql } from '@apollo/client';

export const GET_BACKUP_STATE = gql`
query GetBackupState {
getBackupState
}
`;
7 changes: 7 additions & 0 deletions src/client/src/graphql/queries/verifyBackup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { gql } from '@apollo/client';

export const VERIFY_BACKUP = gql`
query VerifyBackup($backup: String!) {
verifyBackup(backup: $backup)
}
`;
7 changes: 7 additions & 0 deletions src/client/src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ export type Mutation = {
removeTwofaSecret: Scalars['Boolean'];
sendMessage: Scalars['Float'];
sendToAddress: ChainAddressSend;
toggleAutoBackups: Scalars['Boolean'];
updateFees: Scalars['Boolean'];
updateMultipleFees: Scalars['Boolean'];
updateTwofaSecret: Scalars['Boolean'];
Expand Down Expand Up @@ -916,6 +917,7 @@ export type Query = {
getAccountingReport: Scalars['String'];
getAmbossLoginToken: Scalars['String'];
getAmbossUser?: Maybe<AmbossUser>;
getBackupState: Scalars['Boolean'];
getBackups: Scalars['String'];
getBaseCanConnect: Scalars['Boolean'];
getBaseNodes: Array<BaseNode>;
Expand Down Expand Up @@ -959,6 +961,7 @@ export type Query = {
getWalletInfo: Wallet;
recoverFunds: Scalars['Boolean'];
signMessage: Scalars['String'];
verifyBackup: Scalars['Boolean'];
verifyBackups: Scalars['Boolean'];
verifyMessage: Scalars['String'];
};
Expand Down Expand Up @@ -1032,6 +1035,10 @@ export type QuerySignMessageArgs = {
message: Scalars['String'];
};

export type QueryVerifyBackupArgs = {
backup: Scalars['String'];
};

export type QueryVerifyBackupsArgs = {
backup: Scalars['String'];
};
Expand Down
Loading

0 comments on commit b1a7dba

Please sign in to comment.