Skip to content

Commit

Permalink
Merge pull request #1439 from flexn-io/fix/androidManifest_generating
Browse files Browse the repository at this point in the history
Rename MainActivity files, add test cases to set plugins, and fix to copy build folders
  • Loading branch information
pavjacko committed Mar 15, 2024
2 parents 268eec1 + fbc09db commit f9d335d
Show file tree
Hide file tree
Showing 12 changed files with 190 additions and 18 deletions.
3 changes: 1 addition & 2 deletions packages/app-harness/appConfigs/base/renative.json
Expand Up @@ -31,8 +31,7 @@
"{{resolvePackage(react-native-vector-icons)}}/Fonts"
],
"excludedPlugins": [
"@react-native-firebase/app",
"react-native-photo-editor"
"@react-native-firebase/app"
]
},
"platforms": {
Expand Down
6 changes: 4 additions & 2 deletions packages/app-harness/package.json
Expand Up @@ -53,10 +53,12 @@
"react-native-gesture-handler": "2.14.1",
"react-native-orientation-locker": "1.5.0",
"react-native-permissions": "4.1.4",
"react-native-photo-editor": "1.0.13",
"react-native-photo-editor": "github:AppGyver/react-native-photo-editor#v0.1.2",
"react-native-splash-screen": "3.3.0",
"react-native-tvos": "0.73.1-3",
"react-native-web": "0.19.9"
"react-native-web": "0.19.9",
"react-native-fs": "2.20.0",
"rn-fetch-blob": "0.12.0"
},
"devDependencies": {
"@flexn/assets-renative-outline": "0.3.3",
Expand Down
33 changes: 29 additions & 4 deletions packages/app-harness/renative.json
Expand Up @@ -47,6 +47,7 @@
"forceLinking": true
}
},
"rn-fetch-blob": { "tvos": { "disabled": true }, "version": "0.12.0" },
"react-native-carplay": {
"ios": {
"templateXcode": {
Expand Down Expand Up @@ -113,8 +114,7 @@
"tag": "activity",
"android:name": "com.ahmedadeltito.photoeditor.PhotoEditorActivity",
"children": []
},
{ "tag": "activity", "android:name": "com.yalantis.ucrop.UCropActivity" }
}
]
}
]
Expand All @@ -132,10 +132,29 @@
"podName": "iOSPhotoEditor",
"git": "https://github.com/prscX/photo-editor",
"commit": "4924e9ec984d25d03644e58aa148282642171de9",
"buildType": "dynamic"
"buildType": "dynamic",
"templateXcode": {
"Podfile": {
"header": ["plugin 'cocoapods-user-defined-build-types'", "enable_user_defined_build_types!"]
},
"project_pbxproj": {
"resourceFiles": [
"Resources/arrow1.png",
"Resources/arrow2.png",
"Resources/arrow3.png",
"Resources/arrow4.png",
"Resources/arrow5.png"
],
"sourceFiles": ["RNPhotoEditor/RNPhotoEditor.m"],
"headerFiles": ["RNPhotoEditor/RNPhotoEditor.h"]
}
}
},
"tvos": {
"disabled": true
},
"pluginDependencies": null,
"version": "1.0.13"
"version": "github:AppGyver/react-native-photo-editor#v0.1.2"
},
"react-native-permissions": {
"ios": {
Expand Down Expand Up @@ -214,6 +233,12 @@
},
"NSContactsUsageDescription": {
"desc": "Contacts usage description"
},
"NSPhotoLibraryAddUsageDescription": {
"desc": "Application needs permission to write photos..."
},
"NSPhotoLibraryUsageDescription": {
"desc": "iOS 10 needs permission to write photos..."
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion packages/app-harness/src/app/index.tsx
Expand Up @@ -13,6 +13,7 @@ import { TestCase } from '../components/TestCase';
import config from '../../package.json';
import { LoggerProvider, useLoggerContext } from '../context';
import { NotificationCallback } from '../components/types';
import { PhotoEditorButton } from '../components/PhotoEditor';

const App = () => (
<LoggerProvider>
Expand All @@ -39,7 +40,7 @@ const AppContent = () => {
const handleRequestPermissions = async () => {
try {
const permission = await requestPermissions();
logDebug('Permissions:', permission);
logDebug(`Permissions: ${permission}`);
} catch (error) {
logDebug(`${error}`);
}
Expand Down Expand Up @@ -104,6 +105,9 @@ const AppContent = () => {
<TestCase id={6} title="Splash Screen">
<Button onPress={() => SplashScreen.show()} title="Show SplashScreen" />
</TestCase>
<TestCase id={7} title="PhotoEditor">
<PhotoEditorButton />
</TestCase>
</ScrollView>
</View>
<ScrollView
Expand Down
40 changes: 40 additions & 0 deletions packages/app-harness/src/components/PhotoEditor/index.mobile.tsx
@@ -0,0 +1,40 @@
import React, { useEffect } from 'react';
import { Button, Image } from 'react-native';
import { RNPhotoEditor } from 'react-native-photo-editor';
import RNFS from 'react-native-fs';
import RNFetchBlob from 'rn-fetch-blob';
import { useLoggerContext } from '../../context';
import { ICON_LOGO } from '../../config';

export const PhotoEditorButton = () => {
const { logDebug } = useLoggerContext();
const photoPath = RNFS.DocumentDirectoryPath + ICON_LOGO;
useEffect(() => {
const fetchAndMovePhoto = async () => {
const binaryFile = Image.resolveAssetSource(ICON_LOGO);
try {
const resp = await RNFetchBlob.config({ fileCache: true }).fetch('GET', binaryFile.uri);
if (await RNFS.exists(photoPath)) {
await RNFS.unlink(photoPath);
}
await RNFS.moveFile(resp.path(), photoPath);
logDebug('FILE WRITTEN!');
} catch (error) {
logDebug(`${error}`);
}
};
fetchAndMovePhoto();
}, []);
const handlePhotoEditor = () => {
RNPhotoEditor.Edit({
path: photoPath,
onDone: () => {
logDebug('on done');
},
onCancel: () => {
logDebug('on cancel');
},
});
};
return <Button onPress={handlePhotoEditor} title="Show PhotoEditor" />;
};
13 changes: 13 additions & 0 deletions packages/app-harness/src/components/PhotoEditor/index.tsx
@@ -0,0 +1,13 @@
import React from 'react';
import { useLoggerContext } from '../../context';
import { Button } from 'react-native';

export const PhotoEditorButton = () => {
const { logDebug } = useLoggerContext();

const handlePhotoEditor = () => {
logDebug('PhotoEditor not supported on this platform');
};

return <Button onPress={handlePhotoEditor} title="Show PhotoEditor" />;
};
11 changes: 6 additions & 5 deletions packages/core/src/plugins/index.ts
Expand Up @@ -905,12 +905,13 @@ export const copyTemplatePluginsSync = (c: RnvContext) => {

// FOLDER MERGES FROM SCOPED PLUGIN TEMPLATES
Object.keys(c.paths.rnv.pluginTemplates.dirs).forEach((pathKey) => {
if (pathKey !== 'rnv') {
const pluginTemplatePath = c.paths.rnv.pluginTemplates.dirs[pathKey];
// TODO: required for external rnv scoped templates to take effect. need to test full implications
// if (pathKey !== 'rnv') {
const pluginTemplatePath = c.paths.rnv.pluginTemplates.dirs[pathKey];

const sourcePath4sec = getAppConfigBuildsFolder(path.join(pluginTemplatePath, key));
copyFolderContentsRecursiveSync(sourcePath4sec, destPath, true, undefined, false, objectInject);
}
const sourcePath4sec = getAppConfigBuildsFolder(path.join(pluginTemplatePath, key));
copyFolderContentsRecursiveSync(sourcePath4sec, destPath, true, undefined, false, objectInject);
// }
});
});
};
Expand Down
11 changes: 11 additions & 0 deletions packages/engine-rn-tvos/templates/platforms/androidtv/build.gradle
Expand Up @@ -11,6 +11,17 @@ buildscript {
ndkVersion = '{{NDK_VERSION}}'
kotlinVersion = '{{INJECT_KOTLIN_VERSION}}'
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}

repositories {
google()
mavenCentral()
Expand Down
11 changes: 11 additions & 0 deletions packages/engine-rn-tvos/templates/platforms/firetv/build.gradle
Expand Up @@ -11,6 +11,17 @@ buildscript {
ndkVersion = '{{NDK_VERSION}}'
kotlinVersion = '{{INJECT_KOTLIN_VERSION}}'
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}

repositories {
google()
mavenCentral()
Expand Down
11 changes: 11 additions & 0 deletions packages/engine-rn/templates/platforms/android/build.gradle
Expand Up @@ -11,9 +11,20 @@ buildscript {
ndkVersion = '{{NDK_VERSION}}'
kotlinVersion = '{{INJECT_KOTLIN_VERSION}}'
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
repositories {
google()
mavenCentral()
maven { url = uri("https://www.jitpack.io" ) }
}
dependencies {
classpath("com.android.tools.build:gradle")
Expand Down
11 changes: 11 additions & 0 deletions packages/engine-rn/templates/platforms/androidwear/build.gradle
Expand Up @@ -11,6 +11,17 @@ buildscript {
ndkVersion = '{{NDK_VERSION}}'
kotlinVersion = '{{INJECT_KOTLIN_VERSION}}'
}

subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
repositories {
google()
mavenCentral()
Expand Down
52 changes: 48 additions & 4 deletions yarn.lock
Expand Up @@ -7096,6 +7096,11 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==

base-64@0.1.0, base-64@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb"
integrity sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==

base64-js@^1.1.2, base64-js@^1.3.1, base64-js@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
Expand Down Expand Up @@ -11249,6 +11254,18 @@ glob@10.3.10, glob@^10.2.2, glob@^10.3.10, glob@^10.3.3, glob@^10.3.7:
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
path-scurry "^1.10.1"

glob@7.0.6:
version "7.0.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.6.tgz#211bafaf49e525b8cd93260d14ab136152b3f57a"
integrity sha512-f8c0rE8JiCxpa52kWPAOa3ZaYEnzofDzCQLCn3Vdk0Z5OVLq3BsRFJI4S4ykpeVW6QMGBUkMeUpoEgWnMTnw5Q==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.2"
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@7.1.4:
version "7.1.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
Expand Down Expand Up @@ -16797,6 +16814,11 @@ pluralize@8.0.0, pluralize@^8.0.0:
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==

pod-installer@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/pod-installer/-/pod-installer-0.0.0.tgz#363290ec9f2eb7a88bc3e1f229793efdcc7c81c6"
integrity sha512-5GFFvaXwESMx0QoopeJqFZzi4xOqI86Lh65WqWAVuZNorUio4/ZBRx7AQBfwnBwOeGA/JjXHP+nHZmSKWGoG1g==

popper.js@^1.14.4:
version "1.16.1"
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1.tgz#2a223cb3dc7b6213d740e40372be40de43e65b1b"
Expand Down Expand Up @@ -17924,6 +17946,14 @@ react-native-carplay@2.3.0:
dependencies:
traverse "^0.6.6"

react-native-fs@2.20.0:
version "2.20.0"
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.20.0.tgz#05a9362b473bfc0910772c0acbb73a78dbc810f6"
integrity sha512-VkTBzs7fIDUiy/XajOSNk0XazFE9l+QlMAce7lGuebZcag5CnjszB+u4BdqzwaQOdcYb5wsJIsqq4kxInIRpJQ==
dependencies:
base-64 "^0.1.0"
utf8 "^3.0.0"

react-native-gesture-handler@2.14.1:
version "2.14.1"
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.14.1.tgz#930640231024b7921435ab476aa501dd4a6b2e01"
Expand All @@ -17945,10 +17975,11 @@ react-native-permissions@4.1.4:
resolved "https://registry.yarnpkg.com/react-native-permissions/-/react-native-permissions-4.1.4.tgz#7e105470acea7fc1748bb36915095fd3304cd9da"
integrity sha512-el6u90VZNFDEtmHpSheirwRhGvs6M5rSZcoqIqB128IPO00f2c1q+PP4kEaM1u19Q0ldQ+R+S7C/l8Zrduy6JQ==

react-native-photo-editor@1.0.13:
version "1.0.13"
resolved "https://registry.yarnpkg.com/react-native-photo-editor/-/react-native-photo-editor-1.0.13.tgz#292d2f1a87bb3fb9b75000683f05664f360bdf6b"
integrity sha512-SWrnatVC4H73cEN+6rVlc0M5cGS20K6EwL8u2CmlBlLNEwH6OfayMgOCwpKJdmN2GPZKJ2JraQru8Ga7JL4zaw==
"react-native-photo-editor@github:AppGyver/react-native-photo-editor#v0.1.2":
version "0.1.1"
resolved "https://codeload.github.com/AppGyver/react-native-photo-editor/tar.gz/ed05b06d13df9945433bf84366b3e4f01787c0ae"
dependencies:
pod-installer "0.0.0"

react-native-splash-screen@3.3.0:
version "3.3.0"
Expand Down Expand Up @@ -18738,6 +18769,14 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^3.0.0"
inherits "^2.0.1"

rn-fetch-blob@0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/rn-fetch-blob/-/rn-fetch-blob-0.12.0.tgz#ec610d2f9b3f1065556b58ab9c106eeb256f3cba"
integrity sha512-+QnR7AsJ14zqpVVUbzbtAjq0iI8c9tCg49tIoKO2ezjzRunN7YL6zFSFSWZm6d+mE/l9r+OeDM3jmb2tBb2WbA==
dependencies:
base-64 "0.1.0"
glob "7.0.6"

roarr@^2.15.3:
version "2.15.4"
resolved "https://registry.yarnpkg.com/roarr/-/roarr-2.15.4.tgz#f5fe795b7b838ccfe35dc608e0282b9eba2e7afd"
Expand Down Expand Up @@ -21065,6 +21104,11 @@ utf8-byte-length@^1.0.1:
resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz#f45f150c4c66eee968186505ab93fcbb8ad6bf61"
integrity sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==

utf8@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1"
integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==

util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand Down

0 comments on commit f9d335d

Please sign in to comment.