Skip to content

Commit

Permalink
Merge branch 'ONE-3134_fix_android_camera_format' into 'main'
Browse files Browse the repository at this point in the history
ONE-3134 upgrade camera lib

See merge request procivis/one/one-react-native-components!127
  • Loading branch information
procivisAG committed Aug 14, 2024
2 parents 06d76b6 + eadc6b4 commit 6216503
Show file tree
Hide file tree
Showing 30 changed files with 2,294 additions and 1,243 deletions.
49 changes: 30 additions & 19 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: node:16-alpine
image: node:18.16.0-alpine

variables:
YARN_CACHE_FOLDER: './.yarn/cache'
Expand All @@ -16,25 +16,36 @@ stages:
- publish
- deploy

.yarn-cache: &yarn-cache
.build-cache: &build-cache
key:
files:
- yarn.lock
- package.json
paths:
- node_modules/
- lib/
- ${YARN_CACHE_FOLDER}
policy: pull

.install-node-modules: &install-node-modules
- >
if [ -d ./node_modules ] && [ "$(ls -A ./node_modules)" ]; then
echo "node_modules exists and seems valid, not re-installing deps."
else
echo "node_modules does not exist or is not valid, re-installing deps."
apk add --update --no-cache --virtual .build-deps alpine-sdk libc6-compat gcompat bash
npm config set -- @procivis:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/
npm config set -- //${CI_SERVER_HOST}/:_authToken ${CI_JOB_TOKEN}
npm config set -- //${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken ${CI_JOB_TOKEN}
yarn global add node-gyp @mapbox/node-pre-gyp
yarn install --frozen-lockfile --network-concurrency 1
fi
.modules_setup:
cache:
<<: *yarn-cache
<<: *build-cache
before_script:
- apk add --update --no-cache --virtual .build-deps alpine-sdk libc6-compat gcompat bash
- npm config set -- @procivis:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/
- npm config set -- //${CI_SERVER_HOST}/:_authToken ${CI_JOB_TOKEN}
- npm config set -- //${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken ${CI_JOB_TOKEN}
- yarn global add node-gyp @mapbox/node-pre-gyp
- yarn install --frozen-lockfile --network-concurrency 1
- *install-node-modules

.only_tag:
rules:
Expand Down Expand Up @@ -66,14 +77,13 @@ stages:
--namespace $K8S_NAMESPACE
- kubectl rollout restart $K8S_TYPE $HELM_APP_NAME-$HELM_PATH --namespace=$K8S_NAMESPACE


build_deps:
stage: prepare
extends: .modules_setup
script:
- ''
cache:
policy: pull-push
policy: push

lint:
stage: test
Expand All @@ -98,6 +108,7 @@ test:

build:storybook:
stage: build
image: node:16-alpine
needs: [build_deps]
extends:
- .modules_setup
Expand All @@ -111,16 +122,16 @@ build:storybook:
publish:storybook:
stage: publish
image: docker:20
needs: [ build:storybook ]
dependencies: [ build:storybook ]
needs: [build:storybook]
dependencies: [build:storybook]
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE/storybook:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
IMAGE_TAG: $CI_REGISTRY_IMAGE/storybook:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
services:
- docker:20-dind
- docker:20-dind
script:
- docker build -t $IMAGE_TAG -f ./docker/Dockerfile .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $IMAGE_TAG
- docker build -t $IMAGE_TAG -f ./docker/Dockerfile .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $IMAGE_TAG
extends:
- .only_main

Expand All @@ -137,7 +148,7 @@ publish:npm:

deploy:storybook:
stage: deploy
needs: [ publish:storybook ]
needs: [publish:storybook]
extends:
- .deploy_k8s
- .only_main
Expand Down
2 changes: 1 addition & 1 deletion .ondevice/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const getStories = () => {
require("../src/buttons/button.stories.tsx"),
require("../src/buttons/ghost-button.stories.tsx"),
require("../src/buttons/scan-button.stories.tsx"),
require("../src/camera/qr-code-scanner.stories.tsx"),
require("../src/control/checkbox.stories.tsx"),
require("../src/control/switch.stories.tsx"),
require("../src/credential/card/credential-card.stories.tsx"),
Expand All @@ -51,6 +50,7 @@ const getStories = () => {
require("../src/loader/loading-result.stories.tsx"),
require("../src/pin/pin-code-screen.stories.tsx"),
require("../src/screens/image-preview-screen.stories.tsx"),
require("../src/screens/qr-code-scanner-screen.stories.tsx"),
require("../src/searchbar/search-bar.stories.tsx"),
require("../src/text/typography.stories.tsx"),
];
Expand Down
60 changes: 6 additions & 54 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

import com.android.build.OutputFile
Expand All @@ -13,8 +14,8 @@ react {
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
// codegenDir = file("../node_modules/react-native-codegen")
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")

Expand Down Expand Up @@ -52,14 +53,6 @@ react {
// hermesFlags = ["-O", "-output-source-map"]
}

/**
* Set this to true to create four separate APKs instead of one,
* one for each native architecture. This is useful if you don't
* use App Bundles (https://developer.android.com/guide/app-bundle/)
* and want to have separate APKs to upload to the Play Store.
*/
def enableSeparateBuildPerCPUArchitecture = false

/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
Expand All @@ -78,20 +71,11 @@ def enableProguardInReleaseBuilds = false
*/
def jscFlavor = 'org.webkit:android-jsc:+'

/**
* Private function to get the list of Native Architectures you want to build.
* This reads the value from reactNativeArchitectures in your gradle.properties
* file and works together with the --active-arch-only flag of react-native run-android.
*/
def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

android {
ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace "com.storybook"
defaultConfig {
Expand All @@ -102,14 +86,6 @@ android {
versionName "1.0"
}

splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include (*reactNativeArchitectures())
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
Expand All @@ -130,37 +106,13 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}

}
}
}

dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("com.facebook.react:flipper-integration")

implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
Expand Down
6 changes: 1 addition & 5 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
</application>
tools:ignore="GoogleAppIndexingWarning" />
</manifest>
75 changes: 0 additions & 75 deletions android/app/src/debug/java/com/storybook/ReactNativeFlipper.java

This file was deleted.

3 changes: 1 addition & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.storybook">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
Expand Down
35 changes: 0 additions & 35 deletions android/app/src/main/java/com/storybook/MainActivity.java

This file was deleted.

22 changes: 22 additions & 0 deletions android/app/src/main/java/com/storybook/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.storybook

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

class MainActivity : ReactActivity() {

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "storybook"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}
Loading

0 comments on commit 6216503

Please sign in to comment.