Skip to content

Commit

Permalink
Merge pull request #265 from rootstrap/feat/force-update
Browse files Browse the repository at this point in the history
Feat/force update
  • Loading branch information
JUNIOR140889 committed May 16, 2024
2 parents 352b1c5 + bb5b931 commit 84e4324
Show file tree
Hide file tree
Showing 23 changed files with 580 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
API_URL=
BASE_URL=
APP_STORE_URL=
PLAY_STORE_URL=
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ None
npx pod-install
```

### Connection to firebase

#### IOS

1. Create a new app in firebase with the Bundle Identifier of the schema that you will run
2. Download a `GoogleService-Info.plist`
3. Run `xed -b ios` to open Xcode
3. Add the `GoogleService-Info.plist` to the project folder
4. Run `pod install` inside the `./ios` folder

#### Android

1. Create a new app in firebase with the package with the suffix of the flavor you will run
2. Download the `google-services.json` and move it to the `./android/app` directory

## Continuous Integration

The repo includes configuration for using GitHub Actions to run unit tests and code analysis: `.github/workflows/test.yml`. This can be adapted as needed for specifics of each project. Both CodeClimate and Sonarqube integrations are included in the workflow and their required environment settings should be retrieved from the repo Secrets.
Expand Down
28 changes: 28 additions & 0 deletions __mocks__/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock';

jest.mock('react-native-device-info', () => mockRNDeviceInfo);

jest.mock('react-native-bootsplash', () => ({
hide: jest.fn().mockResolvedValueOnce(),
useHideAnimation: jest.fn(({ animate }) => {
Expand All @@ -20,3 +24,27 @@ jest.mock('common/AnimatedSplash', () =>
);

jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');

jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter');

jest.mock('@react-native-firebase/remote-config', () => ({
__esModule: true,
default: () => ({
setDefaults: jest.fn().mockImplementation(() => Promise.resolve()),
fetch: jest.fn().mockImplementation(() => Promise.resolve()),
fetchAndActivate: jest.fn().mockImplementation(() => Promise.resolve()),
}),
}));

jest.mock('i18next', () => ({
t: (stringKey, options) => {
const enFile = jest.requireActual('../src/localization/resources/en.json');
return stringKey.split('.').reduce((result, key) => result[key], enFile);
},
use: () => ({
language: 'en',
changeLanguage: jest.fn(),
init: jest.fn(),
}),
dir: jest.fn().mockReturnValue('ltr'),
}));
14 changes: 14 additions & 0 deletions __tests__/features/force-update-modal/force-update-modal.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import 'react-native';

import { render } from '@testing-library/react-native';

import { ForceUpdateModal } from '../../../src/features/force-update-modal/force-update-modal';

describe('force-update', () => {
it('renders correctly', () => {
const modal = render(<ForceUpdateModal />);

expect(modal).toBeTruthy();
});
});
1 change: 1 addition & 0 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: 'com.google.gms.google-services'
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

Expand Down
67 changes: 67 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"project_info": {
"project_number": "333015382550",
"project_id": "force-update-test-aae87",
"storage_bucket": "force-update-test-aae87.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:333015382550:android:dc159faf9b60b35c4d9337",
"android_client_info": {
"package_name": "com.reactnativebase"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAR89MZuomztR1dneLOnvSypc46P_U7OE0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:333015382550:android:5a8990ed31ad7ce54d9337",
"android_client_info": {
"package_name": "com.reactnativebase.dev"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAR89MZuomztR1dneLOnvSypc46P_U7OE0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:333015382550:android:793fcb397d01eb374d9337",
"android_client_info": {
"package_name": "com.universe.innovations.development"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAR89MZuomztR1dneLOnvSypc46P_U7OE0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildscript {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
classpath 'com.google.gms:google-services:4.4.1'
}
}

Expand Down
7 changes: 7 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ project 'ReactNativeBase',
target 'ReactNativeBase' do

config = use_native_modules!

pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseABTesting', :modular_headers => true
pod 'FirebaseInstallations', :modular_headers => true

use_react_native!(
:path => config[:reactNativePath],
Expand Down

0 comments on commit 84e4324

Please sign in to comment.