// Metro module 9057 (f9058). import { Endpoints, RelationshipTypes } from "../../Constants"; import { APIError } from "../../errors/index"; import AlertActionCreators from "../../actions/AlertActionCreators"; import { intl, t } from "../../intl/index.native"; import { HTTP } from "../../_bundle/sendRequest"; import { AccessibilityAnnouncer } from "../../design/shared"; function $mk115400($env) { return () => { AccessibilityAnnouncer.announce(intl.string(t.zRf8cO)); }; } function $mk115401($env) { return () => { AccessibilityAnnouncer.announce(intl.string(t.XMf21q)); }; } let deleteGameRelationship; let env5926 = {}; const showRequestFailedAlert = function showRequestFailedAlert(a0) { let body = new APIError(a0).getAnyErrorMessage(); const r28 = { title: intl.string(t["328j/I"]), body: null }; if (body == null) { body = intl.string(t.fEptJP); } r28.body = body; AlertActionCreators.show(r28); }; deleteGameRelationship = async function deleteGameRelationship(c26354_0) { let c26354_3; let c26354_4 = 0; let c30020_0, c30020_1, c30020_2; L12: { try { c30020_0 = void 0; c30020_1 = void 0; c30020_2 = void 0; c30020_0 = c26354_0.userId; c30020_1 = c26354_0.applicationId; c30020_2 = c26354_0.onSuccess; await void 0; c26354_4 = 1; await HTTP.del({ url: Endpoints.USER_GAME_RELATIONSHIP(c30020_0, c30020_1), oldFormErrors: true, rejectWithError: false }); (0, c30020_2)(); c26354_4 = 0; } catch ($e) { const r29 = $e; let r8 = r29; c26354_3 = r29; if (c26354_4 !== 0) { while (true) { try { const r85 = c26354_3; c26354_4 = 0; (0, showRequestFailedAlert)(r85); break L12; } catch (r82) { r8 = r82; c26354_3 = r82; if (c26354_4 === 0) { break; } } } } throw r8; } } }; const r24 = { removeGameFriend: async function removeGameFriend(c26355_0) { let env30021; const r24 = env5926; let c26355_2 = r24; const r10 = env30021 = { $parent: r24 }; let c26355_1 = r10; env30021[0] = void 0; env30021[1] = void 0; env30021[0] = c26355_0.userId; env30021[1] = c26355_0.applicationId; await void 0; await deleteGameRelationship({ userId: env30021[0], applicationId: env30021[1], onSuccess: $mk115400(env5926) }); }, acceptGameFriendRequest: function acceptGameFriendRequest({ userId, applicationId }) { const FRIEND = RelationshipTypes.FRIEND; const onSuccess2 = () => {}; return HTTP.put({ url: Endpoints.USER_GAME_RELATIONSHIP(userId, applicationId), body: { type: FRIEND }, oldFormErrors: true, rejectWithError: false }).then(() => { AccessibilityAnnouncer.announce(intl.string(t.taJiuc)); }).catch((error) => { let body = new APIError(error).getAnyErrorMessage(); const r29 = { title: intl.string(t["328j/I"]), body: null }; if (body == null) { body = intl.string(t.fEptJP); } r29.body = body; AlertActionCreators.show(r29); return Promise.reject(error); }); }, cancelGameFriendRequest: async function cancelGameFriendRequest(c26356_0) { let env30022; const r24 = env5926; let c26356_2 = r24; const r10 = env30022 = { $parent: r24 }; let c26356_1 = r10; env30022[0] = void 0; env30022[1] = void 0; env30022[0] = c26356_0.userId; env30022[1] = c26356_0.applicationId; await void 0; await deleteGameRelationship({ userId: env30022[0], applicationId: env30022[1], onSuccess: $mk115401(env5926) }); } }; export default r24;