Alfred sdk integration
This commit is contained in:
2
App.tsx
2
App.tsx
@@ -38,6 +38,7 @@ import {
|
||||
import usePolling from './src/hooks/usePolling';
|
||||
import { MILLISECONDS_IN_A_SECOND } from './RN-UI-LIB/src/utlis/common';
|
||||
import analytics from '@react-native-firebase/analytics';
|
||||
import { blah } from './src/components/utlis/DeviceUtils';
|
||||
|
||||
initSentry();
|
||||
|
||||
@@ -113,6 +114,7 @@ function App() {
|
||||
});
|
||||
|
||||
React.useEffect(() => {
|
||||
blah();
|
||||
askForPermissions();
|
||||
const appStateChange = AppState.addEventListener('change', async (change) => {
|
||||
handleAppStateChange(change);
|
||||
|
||||
@@ -264,6 +264,7 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
|
||||
implementation "com.navi.medici:alfred:navi_v1.0.0-20230908.112959-9"
|
||||
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
|
||||
@@ -14,7 +14,10 @@ import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.navi.alfred.AlfredManager;
|
||||
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.view.View;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
@@ -77,4 +80,9 @@ public class DeviceUtilsModule extends ReactContextBaseJavaModule implements Act
|
||||
promise.reject( err);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void startRecording(View rootView) {
|
||||
AlfredManager.INSTANCE.startRecording(RNContext, rootView, "", "", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.avapp;
|
||||
import com.facebook.react.ReactActivity;
|
||||
import com.facebook.react.ReactActivityDelegate;
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.navi.alfred.AlfredManager;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
@@ -23,7 +25,11 @@ public class MainActivity extends ReactActivity {
|
||||
super.onCreate(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
AlfredManager.INSTANCE.startRecording(getApplicationContext(), getWindow().getDecorView().getRootView(), "", "", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
|
||||
|
||||
@@ -15,6 +15,9 @@ import com.avapp.newarchitecture.MainApplicationReactNativeHost;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import com.microsoft.codepush.react.CodePush;
|
||||
import com.navi.alfred.AlfredConfig;
|
||||
import com.navi.alfred.AlfredManager;
|
||||
|
||||
import android.database.CursorWindow;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -70,8 +73,8 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
||||
|
||||
|
||||
|
||||
AlfredConfig alfredConfig = new AlfredConfig();
|
||||
AlfredManager.INSTANCE.init(alfredConfig, getApplicationContext());
|
||||
|
||||
// https://github.com/rt2zz/redux-persist/issues/284#issuecomment-1011214066
|
||||
try {
|
||||
|
||||
@@ -42,6 +42,20 @@ allprojects {
|
||||
// Android JSC is installed from npm
|
||||
url("$rootDir/../node_modules/jsc-android/dist")
|
||||
}
|
||||
maven {
|
||||
url 'https://nexus.cmd.navi-tech.in/repository/maven-snapshots'
|
||||
credentials {
|
||||
username 'nexus-user'
|
||||
password 'nexus-user'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://nexus.cmd.navi-tech.in/repository/maven-releases'
|
||||
credentials {
|
||||
username 'nexus-user'
|
||||
password 'nexus-user'
|
||||
}
|
||||
}
|
||||
mavenCentral {
|
||||
// We don't want to fetch react-native from Maven Central as there are
|
||||
// older versions over there.
|
||||
|
||||
@@ -7,3 +7,7 @@ export const locationEnabled = (): Promise<boolean> => DeviceUtilsModule.isLocat
|
||||
|
||||
// returns array of all the installed packages.
|
||||
export const getAllInstalledApp = (): Promise<string> => DeviceUtilsModule.getAllInstalledApp();
|
||||
|
||||
export const blah = () => {
|
||||
DeviceUtilsModule.startRecording();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user