mattermost-mobile/libraries/@mattermost/rnutils/src/NativeRNUtils.ts
Daniel Espino García 5c2153f83b
Add Report a Problem functionality (#8605)
* Add Report a Problem functionality

* update cache pinned SHA version from 4.0.2 to 4.2.0

* Address feedback

* Fix tests

* Fix some issues and update kotlin coroutines version

* Fix delete file for iOS

* Bump 1 more version for coroutines

* Use rxjava instead of kotlin coroutines to avoid security issue

* Move path prefix to avoid test error

* Address feedback

* Address feedback

* Address feedback

* Use mailto on iOS

* Fix tests related to button changes

* Address feedback

* Update icon and fix onboarding buttons

* Fix test

---------

Co-authored-by: Angelos Kyratzakos <angelos.kyratzakos@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-04-24 11:12:55 +02:00

80 lines
2.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {type TurboModule, TurboModuleRegistry} from 'react-native';
import type {Double, Int32, UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes';
export type SplitView = Readonly<{
isSplit: boolean;
isTablet: boolean;
}>
type DatabaseOperationResult = Readonly<{
error?: string | null;
success: boolean;
}>
type Notification = Readonly<{
identifier: string;
payload?: UnsafeObject;
title?: string;
body?: string;
sound?: string;
badge?: Int32;
type?: string;
thread?: string;
channel_id?: string;
root_id?: string;
}>
type Constants = Readonly<{
appGroupIdentifier: string;
appGroupSharedDirectory: Readonly<{
sharedDirectory: string;
databasePath: string;
}>;
}>
export type WindowDimensionsChanged = Readonly<{
width: Double;
height: Double;
}>
type HasRegisteredLoadResponse = {
hasRegisteredLoad: boolean;
}
export interface Spec extends TurboModule {
readonly getConstants: () => Constants;
addListener: (eventType: string) => void;
removeListeners: (count: number) => void;
getRealFilePath: (filePath: string) => Promise<string>;
saveFile: (filePath: string) => Promise<string>;
getWindowDimensions: () => WindowDimensionsChanged;
isRunningInSplitView: () => SplitView;
unlockOrientation: () => void;
lockPortrait: () => void;
getHasRegisteredLoad: () => HasRegisteredLoadResponse;
setHasRegisteredLoad: () => void;
deleteDatabaseDirectory: (databaseName: string, shouldRemoveDirectory: boolean) => DatabaseOperationResult;
renameDatabase: (databaseName: string, newDatabaseName: string) => DatabaseOperationResult;
deleteEntitiesFile: () => boolean;
getDeliveredNotifications(): Promise<Notification[]>;
removeChannelNotifications(serverUrl: string, channelId: string): void;
removeThreadNotifications(serverUrl: string, threadId: string): void;
removeServerNotifications(serverUrl: string): void;
setSoftKeyboardToAdjustResize(): void;
setSoftKeyboardToAdjustNothing(): void;
createZipFile: (paths: string[]) => Promise<string>;
}
export default TurboModuleRegistry.getEnforcing<Spec>('RNUtils');