Skip to content

Commit

Permalink
Add RequestStatus_DONE (#15370)
Browse files Browse the repository at this point in the history
* Add RequestStatus_DONE

* remove requests outside of chat

* no send button if request done
  • Loading branch information
patrickxb committed Jan 8, 2019
1 parent dfb7f17 commit 45c1244
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 122 deletions.
3 changes: 3 additions & 0 deletions go/protocol/stellar1/common.go

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

3 changes: 2 additions & 1 deletion protocol/avdl/stellar1/common.avdl
Expand Up @@ -40,7 +40,8 @@ protocol common {

enum RequestStatus {
OK_0,
CANCELED_1
CANCELED_1,
DONE_2
}

enum PaymentStrategy {
Expand Down
1 change: 0 additions & 1 deletion protocol/bin/enabled-calls.json
Expand Up @@ -194,7 +194,6 @@
"stellar.1.local.getPaymentDetailsLocal": {"promise": true},
"stellar.1.local.getPaymentsLocal": {"promise": true},
"stellar.1.local.getPendingPaymentsLocal": {"promise": true},
"stellar.1.local.getRequestDetailsLocal": {"promise": true},
"stellar.1.local.getSendAssetChoicesLocal": {"promise": true},
"stellar.1.local.getWalletAccountLocal": {"promise": true},
"stellar.1.local.getWalletAccountSecretKeyLocal": {"promise": true},
Expand Down
3 changes: 2 additions & 1 deletion protocol/json/stellar1/common.json

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

8 changes: 0 additions & 8 deletions shared/actions/json/wallets.json
Expand Up @@ -194,10 +194,6 @@
"accountID": "Types.AccountID",
"code": "Types.CurrencyCode"
},
"loadRequestDetail": {
"_description": "Load a request's details",
"requestID": "StellarRPCTypes.KeybaseRequestID"
},
"requestPayment": {
"_description": "Request payment"
},
Expand Down Expand Up @@ -232,10 +228,6 @@
"oldestUnread": "Types.PaymentID",
"payments": "Array<Types.PaymentResult>"
},
"requestDetailReceived": {
"_description": "Store a request's details",
"request": "StellarRPCTypes.RequestDetailsLocal"
},
"reviewedPaymentReceived": {
"_description": "Update our store with the results of reviewing a built payment",
"bid": "string",
Expand Down
16 changes: 0 additions & 16 deletions shared/actions/wallets-gen.js

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

10 changes: 0 additions & 10 deletions shared/actions/wallets.js
Expand Up @@ -536,11 +536,6 @@ const loadDisplayCurrencyForAccounts = (state, action) =>
// load the display currency of each wallet, now that we have the IDs
action.payload.accounts.map(account => WalletsGen.createLoadDisplayCurrency({accountID: account.accountID}))

const loadRequestDetail = (state, action) =>
RPCStellarTypes.localGetRequestDetailsLocalRpcPromise({reqID: action.payload.requestID})
.then(request => WalletsGen.createRequestDetailReceived({request}))
.catch(err => logger.error(`Error loading request detail: ${err.message}`))

const cancelPayment = (state, action) => {
const {paymentID, showAccount} = action.payload
const pid = Types.paymentIDToString(paymentID)
Expand Down Expand Up @@ -918,11 +913,6 @@ function* walletsSaga(): Saga.SagaGenerator<any, any> {
WalletsGen.exitFailedPayment,
exitFailedPayment
)

yield* Saga.chainAction<WalletsGen.LoadRequestDetailPayload>(
WalletsGen.loadRequestDetail,
loadRequestDetail
)
yield* Saga.chainAction<WalletsGen.CancelRequestPayload>(WalletsGen.cancelRequest, cancelRequest)
yield* Saga.chainAction<WalletsGen.CancelPaymentPayload>(WalletsGen.cancelPayment, cancelPayment)

Expand Down
Expand Up @@ -100,7 +100,7 @@ const mapStateToProps = (state, ownProps: OwnProps) => {
// waiting for service to load it
return loadingProps
}
const {amountDescription, asset, canceled} = requestInfo
const {amountDescription, asset, canceled, done} = requestInfo
return {
_paymentID: null,
action: asset === 'currency' ? 'requested Lumens worth' : 'requested',
Expand All @@ -116,7 +116,9 @@ const mapStateToProps = (state, ownProps: OwnProps) => {
memo: message.note.stringValue(),
pending: false,
sendButtonLabel:
youAreSender || canceled ? '' : `Send${requestInfo.asset === 'currency' ? ' Lumens worth ' : ' '}`,
youAreSender || canceled || done
? ''
: `Send${requestInfo.asset === 'currency' ? ' Lumens worth ' : ' '}`,
}
}
default:
Expand Down
2 changes: 2 additions & 0 deletions shared/constants/chat2/message.js
Expand Up @@ -221,6 +221,7 @@ export const makeChatRequestInfo: I.RecordFactory<MessageTypes._ChatRequestInfo>
asset: 'native',
canceled: false,
currencyCode: '',
done: false,
type: 'requestInfo',
})

Expand Down Expand Up @@ -366,6 +367,7 @@ export const uiRequestInfoToChatRequestInfo = (
asset,
canceled: r.status === RPCStellarTypes.commonRequestStatus.canceled,
currencyCode,
done: r.status === RPCStellarTypes.commonRequestStatus.done,
})
}

Expand Down
1 change: 1 addition & 0 deletions shared/constants/types/chat2/message.js
Expand Up @@ -170,6 +170,7 @@ export type _ChatRequestInfo = {
asset: WalletTypes.Asset,
canceled: boolean,
currencyCode: string, // set if asset === 'currency'
done: boolean,
type: 'requestInfo',
}
export type ChatRequestInfo = I.RecordOf<_ChatRequestInfo>
Expand Down
2 changes: 1 addition & 1 deletion shared/constants/types/rpc-stellar-gen.js

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

0 comments on commit 45c1244

Please sign in to comment.