NTP-36665 | removed muyltipliers | aman singh
This commit is contained in:
8
App.tsx
8
App.tsx
@@ -38,7 +38,7 @@ import ErrorBoundary from './src/common/ErrorBoundary';
|
||||
import { getPermissionsToRequest } from '@utils/PermissionUtils';
|
||||
import ScreenshotBlocker from './src/components/utlis/ScreenshotBlocker';
|
||||
import { setItem } from './src/components/utlis/storageHelper';
|
||||
import { ENV } from './src/constants/config';
|
||||
import { COSMOS_DIALER_PACKAGE_NAME, ENV } from './src/constants/config';
|
||||
import AuthRouter from './src/screens/auth/AuthRouter';
|
||||
import { type TDocumentObj } from '@screens/caseDetails/interface';
|
||||
import Permissions from './src/screens/permissions/Permissions';
|
||||
@@ -50,6 +50,7 @@ import CodePushLoadingModal, { CodePushLoadingModalRef } from './CodePushModal';
|
||||
import { initSentry } from '@components/utlis/sentry';
|
||||
import { AppStates } from '@interfaces/appStates';
|
||||
import syncSelfCallData from '@services/syncSelfCallData';
|
||||
import { getDefaultCallingApp } from '@components/utlis/callModuleUtils';
|
||||
|
||||
if (!__DEV__) {
|
||||
initSentry();
|
||||
@@ -97,6 +98,9 @@ function App() {
|
||||
|
||||
const askForPermissions = async () => {
|
||||
const permissionsToRequest = await getPermissionsToRequest();
|
||||
const defaultCallingApp = await getDefaultCallingApp() === COSMOS_DIALER_PACKAGE_NAME;
|
||||
|
||||
console.log('Default calling app:', defaultCallingApp);
|
||||
if (Platform.OS === 'android') {
|
||||
PermissionsAndroid.requestMultiple(permissionsToRequest)
|
||||
.then(async (result) => {
|
||||
@@ -107,7 +111,7 @@ function App() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
setPermissions(isAllPermissionsGranted);
|
||||
setPermissions(isAllPermissionsGranted && defaultCallingApp);
|
||||
})
|
||||
.catch((err) => {
|
||||
setPermissions(false);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.avapp.callModule;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -161,6 +162,28 @@ public class CallModule extends ReactContextBaseJavaModule {
|
||||
makeCall(activity, recipient, exotelNumber);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getDefaultCallingApp(Promise promise) {
|
||||
try {
|
||||
TelecomManager telecomManager = (TelecomManager) reactContext.getSystemService(Context.TELECOM_SERVICE);
|
||||
if (telecomManager != null) {
|
||||
String defaultDialer = telecomManager.getDefaultDialerPackage();
|
||||
if (defaultDialer != null) {
|
||||
Log.d(TAG, "Default calling app: " + defaultDialer);
|
||||
promise.resolve(defaultDialer); // Send default dialer package name to JS side
|
||||
} else {
|
||||
Log.d(TAG, "No default calling app found.");
|
||||
promise.resolve(null); // No default dialer app
|
||||
}
|
||||
} else {
|
||||
promise.reject("ERROR", "TelecomManager is not available.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error retrieving default calling app", e);
|
||||
promise.reject("ERROR", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void makeCall(Activity activity, String recipient, String exotelNumber) {
|
||||
Intent intent = new Intent(Intent.ACTION_CALL);
|
||||
intent.setData(Uri.parse("tel:" + pendingRecipient));
|
||||
|
||||
@@ -8,4 +8,5 @@ export const APM_APP_NAME = 'cosmos-app';
|
||||
export const APM_BASE_URL = 'https://dev-longhorn-portal.np.navi-tech.in/apm-events';
|
||||
export const GOOGLE_SSO_CLIENT_ID =
|
||||
'60755663443-40k0fbrbbqv4ci4hrjlbrphab5fj387b.apps.googleusercontent.com';
|
||||
export const MS_CLARITY_PROJECT_ID = '';
|
||||
export const MS_CLARITY_PROJECT_ID = '';
|
||||
export const COSMOS_DIALER_PACKAGE_NAME = 'org.fossify.phone';
|
||||
|
||||
@@ -12,4 +12,5 @@ export const IS_DATA_SYNC_REQUIRED = true;
|
||||
export const DATA_SYNC_TIME_INTERVAL = 2 * MINUTES_IN_AN_HOUR * MILLISECONDS_IN_A_MINUTE; // 2hr
|
||||
export const GOOGLE_SSO_CLIENT_ID =
|
||||
'136591056725-ev8db4hrlud2m23n0o03or3cmmp3a3cq.apps.googleusercontent.com';
|
||||
export const MS_CLARITY_PROJECT_ID = 'n2nsbu7o78';
|
||||
export const MS_CLARITY_PROJECT_ID = 'n2nsbu7o78';
|
||||
export const COSMOS_DIALER_PACKAGE_NAME = 'org.fossify.phone';
|
||||
@@ -13,3 +13,5 @@ export const DATA_SYNC_TIME_INTERVAL = 2 * MINUTES_IN_AN_HOUR * MILLISECONDS_IN_
|
||||
export const GOOGLE_SSO_CLIENT_ID =
|
||||
'60755663443-40k0fbrbbqv4ci4hrjlbrphab5fj387b.apps.googleusercontent.com';
|
||||
export const MS_CLARITY_PROJECT_ID = '';
|
||||
export const COSMOS_DIALER_PACKAGE_NAME = 'org.fossify.phone';
|
||||
|
||||
|
||||
@@ -8,3 +8,7 @@ export const launchCallIntent = (number: string, exotelnumber: string, filePatch
|
||||
export const isDialerAppValidApk = (filePath: string): Promise<boolean> => {
|
||||
return CallModule.isDialerAppValidApkFile(filePath);
|
||||
}
|
||||
|
||||
export const getDefaultCallingApp = (): Promise<string> => {
|
||||
return CallModule.getDefaultCallingApp();
|
||||
}
|
||||
|
||||
@@ -13,3 +13,4 @@ export const DATA_SYNC_TIME_INTERVAL = 2 * MINUTES_IN_AN_HOUR * MILLISECONDS_IN_
|
||||
export const GOOGLE_SSO_CLIENT_ID =
|
||||
'60755663443-40k0fbrbbqv4ci4hrjlbrphab5fj387b.apps.googleusercontent.com';
|
||||
export const MS_CLARITY_PROJECT_ID = '';
|
||||
export const COSMOS_DIALER_PACKAGE_NAME = 'org.fossify.phone';
|
||||
|
||||
Reference in New Issue
Block a user