Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade sdk 33 to 34 ,schedule alarm permission fix and app submit to store #995

Merged
merged 6 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,12 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
pickFirst 'lib/x86/libfbjni.so'
pickFirst 'lib/x86_64/libfbjni.so'
pickFirst 'lib/armeabi-v7a/libfbjni.so'
pickFirst 'lib/arm64-v8a/libfbjni.so'
pickFirst 'lib/armeabi-v7a/libfbjni.so'
pickFirst 'lib/arm64-v8a/libfbjni.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libjscexecutor.so'
pickFirst 'lib/*/libfbjni.so'
pickFirst 'lib/*/libc++_shared.so'
pickFirst 'lib/*/libjscexecutor.so'
pickFirst 'lib/*/libjsc.so'
}

splits {
abi {
reset()
Expand Down Expand Up @@ -174,8 +167,8 @@ android {
applicationId 'org.unicef.ecar.bebbo'
targetSdkVersion rootProject.ext.targetSdkVersion
resValue "string", "build_config_package", "com.myapp"
versionCode 20
versionName "2.1.1"
versionCode 29
versionName "2.2.2"
signingConfig signingConfigs.release
}
prodstaging {
Expand Down Expand Up @@ -227,13 +220,13 @@ dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
// Firebase libraries (using the Firebase BoM for consistency - see https://firebase.google.com/docs/android/learn-more#bom)
implementation platform("com.google.firebase:firebase-bom:29.0.3")
implementation platform('com.google.firebase:firebase-bom:32.2.0') // or the latest BOM version
implementation "com.google.firebase:firebase-perf"
implementation "com.google.firebase:firebase-crashlytics"
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation project(':react-native-lottie-splash-screen')
implementation 'com.google.android.gms:play-services-base:18.2.0'
// Android support library
// Android support library
implementation 'com.android.support:support-core-utils:28.0.0'
// Multi Dex Support: https://developer.android.com/studio/build/multidex#mdex-gradle
implementation 'com.android.support:multidex:1.0.3'
Expand All @@ -260,7 +253,7 @@ task copyDownloadableDepsToLibs(type: Copy) {
into 'libs'
}
project.ext.vectoricons = [
iconFontNames: [ 'fontello.ttf' ] // Name of the font files you want to copy
iconFontNames: [ 'fontello.ttf' ] // Name of the font files you want to copy
]

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
Expand Down
2 changes: 1 addition & 1 deletion android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:
# Add any project specific keep options here:
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.unicef.ecar.bebbo;

import android.app.AlarmManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import androidx.annotation.NonNull;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Promise;

public class ExactAlarmModule extends ReactContextBaseJavaModule {

private final ReactApplicationContext reactContext;

ExactAlarmModule(ReactApplicationContext context) {
super(context);
this.reactContext = context;
}

@NonNull
@Override
public String getName() {
return "ExactAlarmModule";
}

@ReactMethod
public void requestExactAlarmPermission(Promise promise) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU || Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
AlarmManager alarmManager = (AlarmManager) reactContext.getSystemService(Context.ALARM_SERVICE);
if (alarmManager.canScheduleExactAlarms()) {
promise.resolve(true); // Permission already granted
} else {
// Redirect user to system settings to enable SCHEDULE_EXACT_ALARM permission
Intent intent = new Intent(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
reactContext.startActivity(intent); // Open settings to request permission
promise.resolve(false); // Redirecting user to enable the permission
}
} else {
promise.resolve(true); // Permission not needed for versions below Android 12
}
} catch (Exception e) {
promise.reject("ERROR", e.getMessage()); // Handle exception if permission check fails
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.unicef.ecar.bebbo;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ExactAlarmPackage implements ReactPackage {

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new ExactAlarmModule(reactContext));
return modules;
ansariDataamanulla marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new ExactAlarmPackage());
return packages;
}

Expand Down
22 changes: 11 additions & 11 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
buildToolsVersion = "34.0.0"
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34

// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
// We use NDK 25 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "25.2.9519653"
androidXCore = "1.0.2"
multiDexEnabled = true
googlePlayServicesVersion = "17.0.0"
kotlinVersion = '1.6.10'
googlePlayServicesVersion = "18.2.0"
kotlinVersion = '1.8.20'
}
repositories {
google()
Expand All @@ -21,8 +21,8 @@ buildscript {
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("com.google.gms:google-services:4.3.4")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
classpath("com.google.gms:google-services:4.3.5")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.1")
classpath("com.google.firebase:perf-plugin:1.4.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -33,7 +33,7 @@ allprojects {
configurations.all {
resolutionStrategy {
// versions used by 0.67
force "com.facebook.soloader:soloader:0.10.4"
force "com.facebook.soloader:soloader:0.10.5"
// Manually set the react-native version to resolve this upstream issue: https://github.com/facebook/react-native/issues/35210
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
Expand All @@ -45,7 +45,7 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
Expand Down
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ org.gradle.parallel=true
org.gradle.configureondemand=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.182.0
# android.enableR8=true
# android.enableR8.fullMode=true

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
Expand Down
1 change: 1 addition & 0 deletions app/assets/translations/appConstants/bebbo/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const ru = {
childSetupdobLabel: "Когда предполагаемая дата рождения ребенка?",
childSetupdobSelector: "Введите дату рождения/предполагаемую дату родов",
childSetupdueLabel: "Какая была предполагаемая дата рождения ребенка?",
addAnotherChildSetupDobLabel: "Когда день рождения ребенка?",
childSetupdueSelector: "Введите первоначально предполагаемый срок",
childSetupprematureLabel: "Ребенок родился недоношенным",
childSetupprematureMessage: "Ребенок, родившийся до 37-й недели срока, считается недоношенным.",
Expand Down
6 changes: 6 additions & 0 deletions app/assets/translations/appOfflineData/apiConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export const allApisObject = (isDatetimeReq: any, dateTimeObj: any): any => {
postdata: {},
saveinDB: false,
},
{
apiEndpoint: appConfig.articles,
method: 'get',
postdata: {},
saveinDB: true,
},
{
apiEndpoint: appConfig.countryGroups,
method: 'get',
Expand Down
4 changes: 2 additions & 2 deletions app/components/CountryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Radio, { RadioActive, RadioCountryItem, RadioItemText } from './shared/ra
const CountryItem = ({ item, currentItem, setCountry }: any): any => {

const isActive = item && currentItem && item.CountryID === currentItem.CountryID;
console.log(`isActive: ${isActive}`);
console.log('current item', currentItem)
// console.log(`isActive: ${isActive}`);
// console.log('current item', currentItem)
// console.log('selected item', item, isActive)
return (
<>
Expand Down
4 changes: 3 additions & 1 deletion app/components/FavActivities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const FavActivities = (): any => {
state.childData.childDataSet.favoritegames
);
const [favGamesToShow, setfavGamesToShow] = useState([]);
const activityTaxonomyId = activeChild?.taxonomyData.prematureTaxonomyId != null && activeChild?.taxonomyData.prematureTaxonomyId != undefined && activeChild?.taxonomyData.prematureTaxonomyId != "" ? activeChild?.taxonomyData.prematureTaxonomyId : activeChild?.taxonomyData.id;

const activityTaxonomyId = activeChild?.taxonomyData?.prematureTaxonomyId ?? activeChild?.taxonomyData?.id;

const ActivitiesData = ActivitiesDataall.filter((x: any) => x.child_age.includes(activityTaxonomyId));
const goToActivityDetail = (item: any): any => {
navigation.navigate('DetailsScreen',
Expand Down
1 change: 1 addition & 0 deletions app/components/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const VideoPlayer = (props: any):any => {
cc_lang_pref: "us",
controls: true,
}}
webViewStyle={{opacity: 0.99}}
/>
</View>
</>
Expand Down
2 changes: 1 addition & 1 deletion app/components/growth/ChartHeightForAge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ChartHeightForAge = (props: any): any => {
const lastMeasurements = sortedMeasurements[sortedMeasurements.length - 1];
const item: any = getInterpretationHeightForAge(
standardDeviation,
activeChild?.taxonomyData.prematureTaxonomyId!=null && activeChild?.taxonomyData.prematureTaxonomyId!="" && activeChild?.taxonomyData.prematureTaxonomyId!=undefined? activeChild.plannedTermDate:childBirthDate,
activeChild?.taxonomyData?.prematureTaxonomyId ? activeChild.plannedTermDate : childBirthDate,
childTaxonomyData,
lastMeasurements,
);
Expand Down
10 changes: 5 additions & 5 deletions app/components/growth/GrowthChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const victoryStyles: VictoryStyles = {
const GrowthChart = (props: any):any => {
const {activeChild, chartType, bgObj,windowWidth,windowHeight} = props;
const {t} = useTranslation();
const childBirthDate =activeChild?.taxonomyData.prematureTaxonomyId!=null && activeChild?.taxonomyData.prematureTaxonomyId!="" && activeChild?.taxonomyData.prematureTaxonomyId!=undefined? activeChild.plannedTermDate: activeChild.birthDate;
const childBirthDate = activeChild?.taxonomyData?.prematureTaxonomyId ? activeChild.plannedTermDate : activeChild.birthDate;
const labelX = props.chartType == chartTypes.WeightForHeight ? t('growthScreencmText'):t('month') ;
const labelY = props.chartType == chartTypes.WeightForHeight ? t('growthScreenkgText') : t('growthScreencmText');
const [deviceOrientation, setDeviceOrientation] = useState(
Expand Down Expand Up @@ -266,7 +266,7 @@ useEffect(() => {
const selectedDataIndex = pressedProps.index;
return [
{
eventKey: 'all',
eventKey: selectedDataIndex,
target: 'labels',
mutation: (props: any):any => {
let activeState: boolean | null = true;
Expand All @@ -279,7 +279,7 @@ useEffect(() => {
},
},
{
eventKey: 'all',
eventKey: selectedDataIndex,
target: 'data',
mutation: (props: any):any => {
const stroke = props.style && props.style.stroke;
Expand All @@ -306,7 +306,7 @@ useEffect(() => {
const selectedDataIndex = pressedProps.index;
return [
{
eventKey: 'all',
eventKey: selectedDataIndex,
target: 'labels',
mutation: (props: any):any => {
return props.index === selectedDataIndex
Expand All @@ -315,7 +315,7 @@ useEffect(() => {
},
},
{
eventKey: 'all',
eventKey: selectedDataIndex,
target: 'data',
mutation: (props: any):any => {
return props.index === selectedDataIndex
Expand Down
2 changes: 1 addition & 1 deletion app/components/homeScreen/ChildInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const PinnedChildDevData = useAppSelector(
state.utilsData.VideoArticlesData != '' ?JSON.parse(state.utilsData.VideoArticlesData):[],
);
const [selectedPinnedArticleData,setSelectedPinnedArticleData] = useState<any>();
const activityTaxonomyId = activeChild?.taxonomyData.prematureTaxonomyId != null && activeChild?.taxonomyData.prematureTaxonomyId != undefined && activeChild?.taxonomyData.prematureTaxonomyId != "" ? activeChild?.taxonomyData.prematureTaxonomyId : activeChild?.taxonomyData.id;
const activityTaxonomyId = activeChild?.taxonomyData?.prematureTaxonomyId ?? activeChild?.taxonomyData?.id;
useEffect(() => {
getAllConfigData(dispatch);
},[]);
Expand Down
16 changes: 8 additions & 8 deletions app/components/homeScreen/DailyHomeNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const DailyHomeNotification = ():any => {
// Set next daily message
if(currentMessageIndex>-1 && records[currentMessageIndex + 1]){
const newNotification = {
messageId: records[currentMessageIndex + 1].id,
messageText: records[currentMessageIndex + 1].title,
messageId: records[currentMessageIndex + 1]?.id,
messageText: records[currentMessageIndex + 1]?.title,
day: currentDate.day,
month: currentDate.month,
year: currentDate.year,
Expand All @@ -57,8 +57,8 @@ const DailyHomeNotification = ():any => {
}
else{
const firstNotification = {
messageId: records.length>0 ? records[0].id : '',
messageText: records.length>0? records[0].title : '',
messageId: records.length>0 ? records[0]?.id : '',
messageText: records.length>0? records[0]?.title : '',
day: currentDate.day,
month: currentDate.month,
year: currentDate.year,
Expand All @@ -74,8 +74,8 @@ const DailyHomeNotification = ():any => {
} else {
//DAILY MESSAGE VARIABLE WAS NEVER SET
const firstNotification = {
messageId: records.length>0 ? records[0].id : '',
messageText: records.length>0? records[0].title : '',
messageId: records.length>0 ? records[0]?.id : '',
messageText: records.length>0? records[0]?.title : '',
day: currentDate.day,
month: currentDate.month,
year: currentDate.year,
Expand All @@ -86,8 +86,8 @@ const DailyHomeNotification = ():any => {
}else{
if (records.length > 0) {
const firstNotification = {
messageId: records ? records[0].id : '',
messageText: records ? records[0].title : '',
messageId: records ? records[0]?.id : '',
messageText: records ? records[0]?.title : '',
day: currentDate.day,
month: currentDate.month,
year: currentDate.year,
Expand Down
Loading