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

Conversation

deepakmali-dgsl
Copy link
Collaborator

No description provided.

android/build.gradle Outdated Show resolved Hide resolved
@@ -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!=null && activeChild?.taxonomyData?.prematureTaxonomyId!="" && activeChild?.taxonomyData?.prematureTaxonomyId!=undefined? activeChild.plannedTermDate: activeChild.birthDate;
Copy link
Collaborator

@Akhror Akhror Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify this as:
const childBirthDate = activeChild?.taxonomyData?.prematureTaxonomyId ? activeChild.plannedTermDate : activeChild.birthDate;

It applies to similar conditions as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified the condition

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified the condition

@@ -114,7 +114,7 @@ const LoadingScreen = ({ route, navigation }: Props): any => {
const childAgedays = (DateTime.now()).diff((DateTime.fromISO(child.birthDate)), 'days').toObject().days;
if (childAgedays) {
if (childAgedays >= child.taxonomyData.days_to - child.taxonomyData.buffers_days) {
const i = childAge.findIndex((_item: any) => _item.id === child.taxonomyData.id);
const i = childAge.findIndex((_item: any) => _item?.id === child?.taxonomyData?.id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"_item" can be renamed to "item"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -100,7 +100,7 @@ const ChildDevelopment = ({ route, navigation }: any): any => {
const [listLoading, setListLoading] = useState(false);
const [modalVisible1, setModalVisible1] = useState(false);
const flatListRef = useRef<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 != null && activeChild?.taxonomyData?.prematureTaxonomyId != undefined && activeChild?.taxonomyData?.prematureTaxonomyId != "" ? activeChild?.taxonomyData?.prematureTaxonomyId : activeChild?.taxonomyData.id;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified as it was recommended above the review.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified the condition

console.log('Error requesting exact alarm permission:', error);
return false;
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some comments to document the method:


export const requestExactAlarmPermission = async (): Promise<boolean> => {
  try {
    // Request permission from the native module
    const permissionGranted = await ExactAlarmModule.requestExactAlarmPermission();
    
    // Return true if permission is granted, otherwise false
    return permissionGranted;
  } catch (error) {
    console.error('Error requesting exact alarm permission:', error.message || error);    
    // Return false to indicate failure in obtaining permission
    return false;
  }
};

if(childTaxonomyData.prematureTaxonomyId!=null && childTaxonomyData.prematureTaxonomyId!="" && childTaxonomyData.prematureTaxonomyId!=undefined){
childAgeId=childTaxonomyData.prematureTaxonomyId;
if(childTaxonomyData?.prematureTaxonomyId!=null && childTaxonomyData?.prematureTaxonomyId!="" && childTaxonomyData?.prematureTaxonomyId!=undefined){
childAgeId=childTaxonomyData?.prematureTaxonomyId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please simplify the condition.

if(childTaxonomyData.prematureTaxonomyId!=null && childTaxonomyData.prematureTaxonomyId!="" && childTaxonomyData.prematureTaxonomyId!=undefined){
childAgeId=childTaxonomyData.prematureTaxonomyId;
if(childTaxonomyData?.prematureTaxonomyId!=null && childTaxonomyData?.prematureTaxonomyId!="" && childTaxonomyData?.prematureTaxonomyId!=undefined){
childAgeId=childTaxonomyData?.prematureTaxonomyId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please simplify the condition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const childBirthDatePlanned = child?.taxonomyData.prematureTaxonomyId != null && child?.taxonomyData.prematureTaxonomyId != "" && child?.taxonomyData.prematureTaxonomyId != undefined ? child.plannedTermDate : child.birthDate;
const activityTaxonomyId = child?.taxonomyData.prematureTaxonomyId != null && child?.taxonomyData.prematureTaxonomyId != undefined && child?.taxonomyData.prematureTaxonomyId != "" ? child?.taxonomyData.prematureTaxonomyId : child?.taxonomyData.id;
const childBirthDatePlanned = child?.taxonomyData?.prematureTaxonomyId != null && child?.taxonomyData?.prematureTaxonomyId != "" && child?.taxonomyData?.prematureTaxonomyId != undefined ? child.plannedTermDate : child.birthDate;
const activityTaxonomyId = child?.taxonomyData?.prematureTaxonomyId != null && child?.taxonomyData?.prematureTaxonomyId != undefined && child?.taxonomyData?.prematureTaxonomyId != "" ? child?.taxonomyData?.prematureTaxonomyId : child?.taxonomyData.id;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please simplify the condition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -307,14 +307,14 @@ export const getNextChildNotification = (gwperiodid: any, vcperiodid: any, hcper
const childAgeInDays = getCurrentChildAgeInDays(
DateTime.fromJSDate(new Date(child.birthDate)).toMillis(),
);
const childBirthDatePlanned = child?.taxonomyData.prematureTaxonomyId != null && child?.taxonomyData.prematureTaxonomyId != "" && child?.taxonomyData.prematureTaxonomyId != undefined ? child.plannedTermDate : child.birthDate;
const childBirthDatePlanned = child?.taxonomyData?.prematureTaxonomyId != null && child?.taxonomyData?.prematureTaxonomyId != "" && child?.taxonomyData?.prematureTaxonomyId != undefined ? child.plannedTermDate : child.birthDate;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please simplify the condition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

const childAgeInDaysForCD = getCurrentChildAgeInDays(
DateTime.fromJSDate(new Date(childBirthDatePlanned)).toMillis(),
);
const childAgeObj = childAge.sort(
(a: any, b: any) => a.days_from - b.days_from,
);
const activityTaxonomyId = child?.taxonomyData.prematureTaxonomyId != null && child?.taxonomyData.prematureTaxonomyId != undefined && child?.taxonomyData.prematureTaxonomyId != "" ? child?.taxonomyData.prematureTaxonomyId : child?.taxonomyData.id;
const activityTaxonomyId = child?.taxonomyData?.prematureTaxonomyId != null && child?.taxonomyData?.prematureTaxonomyId != undefined && child?.taxonomyData?.prematureTaxonomyId != "" ? child?.taxonomyData?.prematureTaxonomyId : child?.taxonomyData.id;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please simplify the condition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant:

const activityTaxonomyId = child?.taxonomyData?.prematureTaxonomyId 
    ? child.taxonomyData.prematureTaxonomyId : child?.taxonomyData?.id;

const childDaysTo = child?.taxonomyData.prematureTaxonomyId != null && child?.taxonomyData.prematureTaxonomyId != undefined && child?.taxonomyData.prematureTaxonomyId != "" ? prematurechildgwperiod.days_to : childAgeObj[i].days_to;
const childDaysFrom = child?.taxonomyData.prematureTaxonomyId != null && child?.taxonomyData.prematureTaxonomyId != undefined && child?.taxonomyData.prematureTaxonomyId != "" ? prematurechildgwperiod.days_from : childAgeObj[i].days_from;
const childDaysTo = child?.taxonomyData?.prematureTaxonomyId != null && child?.taxonomyData?.prematureTaxonomyId != undefined && child?.taxonomyData?.prematureTaxonomyId != "" ? prematurechildgwperiod.days_to : childAgeObj[i].days_to;
const childDaysFrom = child?.taxonomyData?.prematureTaxonomyId != null && child?.taxonomyData?.prematureTaxonomyId != undefined && child?.taxonomyData?.prematureTaxonomyId != "" ? prematurechildgwperiod.days_from : childAgeObj[i].days_from;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please simplify the condition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant:

const childDaysTo = child?.taxonomyData?.prematureTaxonomyId 
    ? prematurechildgwperiod.days_to : childAgeObj[i].days_to;
const childDaysFrom = child?.taxonomyData?.prematureTaxonomyId 
    ? prematurechildgwperiod.days_from : childAgeObj[i].days_from;

android/build.gradle Outdated Show resolved Hide resolved
@@ -165,7 +165,7 @@ const Activities = ({ route, navigation }: any): any => {
(state: any) =>
state.utilsData.MileStonesData != '' ? JSON.parse(state.utilsData.MileStonesData) : [],
);
const activityTaxonomyId = activeChild?.taxonomyData.prematureTaxonomyId != null && activeChild?.taxonomyData.prematureTaxonomyId != undefined && activeChild?.taxonomyData.prematureTaxonomyId != "" ? activeChild?.taxonomyData.prematureTaxonomyId : activeChild?.taxonomyData.id;
const activityTaxonomyId = activeChild?.taxonomyData?.prematureTaxonomyId != null && activeChild?.taxonomyData?.prematureTaxonomyId != undefined && activeChild?.taxonomyData?.prematureTaxonomyId != "" ? activeChild?.taxonomyData?.prematureTaxonomyId : activeChild?.taxonomyData.id;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version looks more readable.

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

@@ -236,7 +236,7 @@ const Articles = ({ route, navigation }: any): any => {
? JSON.parse(state.childData.childDataSet.activeChild)
: [],
);
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activeChild?.taxonomyData?.id

@deepakmali-dgsl deepakmali-dgsl merged commit 0e584b2 into Development Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants