This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,112 @@
// Metro module 13569 (f13570).
import * as _Constants from "../../../Constants";
import { RPCCommands, RPCErrors, InstantInviteSources } from "../../../../../Constants";
import { NativePermissionTypes } from "../../../../native_permissions/NativePermissionConstants";
import { OAuth2Scopes } from "../../../../../_bundle/Module8174";
import { validateOpenInviteDialog } from "../../../helpers/validateOpenInviteDialog";
import RPCError from "../../../RPCError";
import { showInstantInviteActionSheet } from "../../../../instant_invite/native/InstantInviteUtils";
import getCurrentEmbeddedActivityChannel from "../../../helpers/getCurrentEmbeddedActivityChannel";
import NativePermissionUtils from "../../../../native_permissions/NativePermissionUtils";
import ImagePicker from "../../../../image/native/ImagePicker";
import { uploadImageAttachment } from "../../../../activities/EmbeddedActivitiesActionCreators";
import APIError from "../../../../../errors/APIError";
let env9426 = {};
const { RPC_AUTHENTICATED_SCOPE, RPC_LOCAL_SCOPE, RPC_SCOPE_CONFIG } = _Constants;
const r31 = {};
const OPEN_INVITE_DIALOG = RPCCommands.OPEN_INVITE_DIALOG;
const scope = {};
scope[RPC_SCOPE_CONFIG.ANY] = [OAuth2Scopes.RPC, RPC_LOCAL_SCOPE, RPC_AUTHENTICATED_SCOPE];
r31[OPEN_INVITE_DIALOG] = {
scope,
handler: ({ socket: socket2 }) => {
const r15 = validateOpenInviteDialog();
const channel = r15.channel;
if (r15.frame != null) {
throw new RPCError({
errorCode: RPCErrors.UNKNOWN_ERROR
}, "Cannot support frames (yet)");
}
let id = socket2.application.id;
if (id == null) {
id = void 0;
}
showInstantInviteActionSheet(channel, {
source: InstantInviteSources.ACTIVITY_INVITE,
targetApplicationId: id
});
}
};
const INITIATE_IMAGE_UPLOAD = RPCCommands.INITIATE_IMAGE_UPLOAD;
const scope2 = {};
scope2[RPC_SCOPE_CONFIG.ANY] = [OAuth2Scopes.RPC, RPC_LOCAL_SCOPE, RPC_AUTHENTICATED_SCOPE];
r31[INITIATE_IMAGE_UPLOAD] = {
scope: scope2,
handler: async ({ socket }) => {
let r216;
let c27514_0, c27514_1;
L27: {
let env30648;
c27514_1 = void 0;
const r13 = env30648 = {
$parent: env9426
};
c27514_0 = r13;
env30648[0] = void 0;
env30648[1] = void 0;
env30648[2] = void 0;
env30648[3] = void 0;
const id = socket.application.id;
env30648[0] = id;
if (id == null) {
throw new RPCError({
errorCode: RPCErrors.INVALID_COMMAND
}, "No application.");
}
const id2 = getCurrentEmbeddedActivityChannel()?.id;
env30648[1] = id2;
if (id2 == null) {
throw new RPCError({
errorCode: RPCErrors.UNKNOWN_ERROR
}, "Unable to find selected channel");
}
if (await NativePermissionUtils.requestPermission(NativePermissionTypes.PHOTOS).catch(() => {
throw new RPCError({
errorCode: RPCErrors.UNKNOWN_ERROR
}, "Failed requesting photo permissions");
})) {
env30648[2] = (await ImagePicker.launchImageLibraryAsync({
mediaType: "photo",
includeBase64: false,
selectionLimit: 1
})).assets[0];
if (env30648[2] == null) {
throw new RPCError({
errorCode: RPCErrors.UNKNOWN_ERROR
}, "No image selected");
}
env30648[3] = await uploadImageAttachment(env30648[0], env30648[1], {
name: env30648[2].fileName,
type: env30648[2].type,
uri: env30648[2].uri
});
if (env30648[3] != null && env30648[3].url != null) {
if (!(env30648[3] instanceof APIError)) {
r216 = {
image_url: env30648[3].url
};
break L27;
}
}
throw new RPCError({
errorCode: RPCErrors.UNKNOWN_ERROR
}, JSON.stringify(env30648[3]));
}
throw new RPCError({
errorCode: RPCErrors.UNKNOWN_ERROR
}, "Missing photo permissions");
}
return r216;
}
};
export default r31;