-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
- fix article issue
- add null condition for id
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified the condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified the condition
app/screens/LoadingScreen.tsx
Outdated
@@ -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); |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified the condition
app/services/exactAlarmService.ts
Outdated
console.log('Error requesting exact alarm permission:', error); | ||
return false; | ||
} | ||
}; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/services/notificationService.ts
Outdated
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
app/services/notificationService.ts
Outdated
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
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/app/src/main/java/org/unicef/ecar/bebbo/ExactAlarmModule.java
Outdated
Show resolved
Hide resolved
android/app/src/main/java/org/unicef/ecar/bebbo/ExactAlarmModule.java
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activeChild?.taxonomyData?.id
No description provided.