Skip to content

Commit

Permalink
Merge branch 'Development' into addSearchGame
Browse files Browse the repository at this point in the history
  • Loading branch information
DivyaniPatel96 committed May 2, 2024
2 parents 83f5617 + b9e2a09 commit 02f5dc9
Show file tree
Hide file tree
Showing 20 changed files with 878 additions and 340 deletions.
145 changes: 70 additions & 75 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,32 @@ on:
description: 'Build description'

env:
WORKSPACE: ${{ 'ios/ParentBuddyApp.xcworkspace' }}
SCHEME: ${{ 'ParentBuddyAppDev' }}
CONFIGURATION: ${{ 'Release' }}
ARCHIVE_PATH: ${{ 'ios/build/ParentBuddyApp.xcarchive' }}
EXPORT_PATH_STAGING: ${{ 'ParentBuddyAppDev/' }}
PLIST_PATH_STAGING: ${{'ios/ParentBuddyAppDev-Info.plist' }}
ARTIFACT_NAME: ${{ 'Bebbo.ipa' }}
ARTIFACT_PATH_STAGING: ${{ 'ParentBuddyAppDev/' }}
APP_NAME_STAGING: ${{ 'ParentBuddyAppDev-iOS/ENV_DEV' }}
TESTING_GROUP_STAGING: ${{ 'ENV_DEV' }}
UPLOAD_FILE_STAGING: ${{ 'ParentBuddyAppDev/BebboDev.ipa' }}

WORKSPACE: ${{ 'ios/ParentBuddyApp.xcworkspace' }}
SCHEME: ${{ 'ParentBuddyApp' }}
CONFIGURATION: ${{ 'Release' }}
ARCHIVE_PATH: ${{ 'ios/build/ParentBuddyApp.xcarchive' }}
EXPORT_PATH_STAGING: ${{ 'ParentBuddyAppDev/' }}
PLIST_PATH_STAGING: ${{'ios/ParentBuddyAppDev-Info.plist' }}
ARTIFACT_NAME: ${{ 'Bebbo.ipa' }}
ARTIFACT_PATH_STAGING: ${{ 'ParentBuddyAppDev/' }}
APP_NAME_STAGING: ${{ 'ParentBuddyAppDev-iOS/ENV_DEV' }}
TESTING_GROUP_STAGING: ${{ 'ENV_DEV' }}
UPLOAD_FILE_STAGING: ${{ 'ParentBuddyAppDev/BebboDev.ipa' }}

DEVELOPMENT_CERTIFICATE: ${{ secrets.APPLE_APP_DEVELOPMENT_CERTIFICATE }}
DEVELOPMENT_CERTIFICATE: ${{ secrets.APPLE_APP_DEVELOPMENT_CERTIFICATE }}

CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
DISTRIBUTION_PROFILE_STAGING: ${{ secrets.APPLE_AD-HOC_PROFILE }}
KEY_PWD: ${{ secrets.APPLE_KEY_PWD }}
CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
DISTRIBUTION_PROFILE_STAGING: ${{ secrets.APPLE_AD_HOC_PROFILE }}
KEY_PWD: ${{ secrets.APPLE_KEY_PWD }}

EXPORT_PATH_PROD: ${{ 'prod/' }}
PLIST_PATH_PROD: ${{'ios/ParentBuddyApp/Info.plist' }}
ARTIFACT_PATH_PROD: ${{ 'prod/' }}
APP_NAME_PROD: ${{ 'ParentBuddyApp-iOS/ENV_PROD' }}
TESTING_GROUP_PROD: ${{ 'ENV_PROD' }}
UPLOAD_FILE_PROD: ${{ 'prod/Bebbo.ipa' }}
DISTRIBUTION_CERTIFICATE: ${{ secrets.APPLE_APP_DISTRIBUTION_CERTIFICATE }}
DISTRIBUTION_PROFILE_PROD: ${{secrets.APPLE_DISTRIBUTION_PROFILE }}
# EXPORT_PATH_PROD: ${{ 'prod/' }}
# PLIST_PATH_PROD: ${{'ios/ParentBuddyApp/Info.plist' }}
# ARTIFACT_PATH_PROD: ${{ 'prod/' }}
# APP_NAME_PROD: ${{ 'ParentBuddyApp-iOS/ENV_PROD' }}
# TESTING_GROUP_PROD: ${{ 'ENV_PROD' }}
# UPLOAD_FILE_PROD: ${{ 'prod/Bebbo.ipa' }}
# DISTRIBUTION_CERTIFICATE: ${{ secrets.APPLE_APP_DISTRIBUTION_CERTIFICATE }}
# DISTRIBUTION_PROFILE_PROD: ${{secrets.APPLE_DISTRIBUTION_PROFILE }}


jobs:
Expand All @@ -53,7 +52,7 @@ jobs:

- uses: actions/setup-node@master
with:
node-version: '16.14.0'
node-version: '21.2.0'

- name: Install dependencies
run: npm install
Expand All @@ -68,22 +67,20 @@ jobs:
echo projectNumber=${{ secrets.PROJECTNUMBER }} >> .env
echo clientIdKey=${{ secrets.CLIENTIDKEY }} >> .env
cat .env
- name: Create google service Dev file
run: cat /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Development/GoogleService-Info.plist | base64

- name: Putting data google service Dev file
env:
DATA: ${{ secrets.GOOGLE_SERVICES_PLIST_DEV }}
run: echo $DATA > /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Development/GoogleService-Info.plist

- name: Create google service prod file
run: cat /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Production/GoogleService-Info.plist | base64

- name: Putting data google service prod file
env:
DATA: ${{ secrets.GOOGLE_SERVICES_PLIST_PROD }}
run: echo $DATA > /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Production/GoogleService-Info.plist
run: |
touch /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Development/GoogleService-Info.plist
echo -n $DATA | base64 -d > /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Development/GoogleService-Info.plist
# - name: Putting data google service prod file
# env:
# DATA: ${{ secrets.GOOGLE_SERVICES_PLIST_PROD }}
# run: |
# touch /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Production/GoogleService-Info.plist
# echo -n $DATA | base64 -d > /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Production/GoogleService-Info.plist

- name: Install pod dependencies
run: |
Expand All @@ -92,31 +89,33 @@ jobs:
- name: Signing & Provisioning
run: |
# create variables
CERT_PATH=$RUNNER_TEMP/dist_certificate.p12
DEV_CERT_PATH=$RUNNER_TEMP/dev_certificate.p12
PP_PATH_PROD=$RUNNER_TEMP/dist_pp.mobileprovision
PP_PATH_STAGING=$RUNNER_TEMP/dist_pp_adc.mobileprovision
KCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# CERT_PATH=$RUNNER_TEMP/dist_certificate.p12
# PP_PATH_PROD=$RUNNER_TEMP/dist_pp.mobileprovision
# import certificate and provisioning profile from secrets
echo -n "$DISTRIBUTION_CERTIFICATE" | base64 --decode --output $CERT_PATH
echo -n "$DISTRIBUTION_PROFILE_PROD" | base64 --decode --output $PP_PATH_PROD
#echo -n "$DEVELOPMENT_CERTIFICATE" | base64 --decode --output $DEV_CERT_PATH
#echo -n "$DISTRIBUTION_PROFILE_STAGING" | base64 --decode --output $PP_PATH_STAGING
#echo -n "$DISTRIBUTION_CERTIFICATE" | base64 --decode --output $CERT_PATH
#echo -n "$DISTRIBUTION_PROFILE_PROD" | base64 --decode --output $PP_PATH_PROD
echo -n "$DEVELOPMENT_CERTIFICATE" | base64 --decode --output "$DEV_CERT_PATH"
echo -n "$DISTRIBUTION_PROFILE_STAGING" | base64 --decode --output "$PP_PATH_STAGING"


# create temporary keychain
security create-keychain -p "$KEY_PWD" $KCHAIN_PATH
security set-keychain-settings -lut 21600 $KCHAIN_PATH
security unlock-keychain -p "$KEY_PWD" $KCHAIN_PATH
security create-keychain -p "$KEY_PWD" "$KCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KCHAIN_PATH"
security unlock-keychain -p "$KEY_PWD" "$KCHAIN_PATH"
# import certificate to keychain
security import $CERT_PATH -P "$CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KCHAIN_PATH
security list-keychain -d user -s $KCHAIN_PATH
security import $DEV_CERT_PATH -P "$CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEY_PWD" $KCHAIN_PATH
security list-keychain -d user -s "$KCHAIN_PATH"
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH_PROD ~/Library/MobileDevice/Provisioning\ Profiles
# cp $PP_PATH_STAGING ~/Library/MobileDevice/Provisioning\ Profiles

cp $PP_PATH_STAGING ~/Library/MobileDevice/Provisioning\ Profiles
# cp $PP_PATH_PROD ~/Library/MobileDevice/Provisioning\ Profiles
- name: Select Xcode
run: sudo xcode-select -switch /Applications/Xcode_15.3.app

Expand All @@ -127,38 +126,34 @@ jobs:
run: |
mkdir -p build && mkdir -p staging && mkdir -p prod
# xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
# archive -archivePath "$ARCHIVE_PATH" -allowProvisioningUpdates
# PROVISIONING_STYLE="Manual" \
# PROVISIONING_PROFILE="$DISTRIBUTION_PROFILE_PROD" \
# CODE_SIGN_STYLE="Manual" \
# CODE_SIGN_IDENTITY="$DISTRIBUTION_CERTIFICATE"

- name: Build Archive
run: |
xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
archive -archivePath "$ARCHIVE_PATH" -allowProvisioningUpdates
PROVISIONING_STYLE="Manual" \
PROVISIONING_PROFILE="$DISTRIBUTION_PROFILE_PROD" \
CODE_SIGN_STYLE="Manual" \
CODE_SIGN_IDENTITY="$DISTRIBUTION_CERTIFICATE"
# xcodebuild -workspace $WORKPLACE -scheme $SCHEME -configuration $CONFIGURATION \
# archive -archivePath $ARCHIVE_PATH -allowProvisioningUpdates
# PROVISIONING_STYLE="Manual" \
# PROVISIONING_PROFILE={$DISTRIBUTION_PROFILE_STAGING} \
# CODE_SIGN_STYLE="Manual" \
# CODE_SIGN_IDENTITY={$DISTRIBUTION_CERTIFICATE} \
archive -archivePath "$ARCHIVE_PATH" -allowProvisioningUpdates PROVISIONING_STYLE="Manual" \
PROVISIONING_PROFILE="$DISTRIBUTION_PROFILE_STAGING" \
CODE_SIGN_STYLE="Manual" CODE_SIGN_IDENTITY="$DEVELOPMENT_CERTIFICATE"
# - name: Export STAGING
# run: |
# xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH_STAGING . -exportOptionsPlist $PLIST_PATH_STAGING \

- name: Export PROD
- name: Export STAGING
run: |
xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH_PROD . -exportOptionsPlist $PLIST_PATH_PROD \
xcodebuild -exportArchive -archivePath "$ARCHIVE_PATH" -exportPath "$EXPORT_PATH_STAGING" . -exportOptionsPlist "$PLIST_PATH_STAGING"
# - name: Export PROD
# run: |
# xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH_PROD . -exportOptionsPlist $PLIST_PATH_PROD \

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Bebbo.ipa
path: ${{ env.ARTIFACT_PATH_PROD }}
# ${{ env.ARTIFACT_PATH_STAGING }}

path: ${{ env.ARTIFACT_PATH_STAGING }}

# name: ${{ env.ARTIFACT_NAME }}
# path: |
Expand All @@ -169,6 +164,6 @@ jobs:
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/dist_pp.mobileprovision
# rm ~/Library/MobileDevice/Provisioning\ Profiles/dist_pp_adc.mobileprovision
rm ~/Library/MobileDevice/Provisioning\ Profiles/dist_pp_adc.mobileprovision
# rm ~/Library/MobileDevice/Provisioning\ Profiles/dist_pp.mobileprovision

59 changes: 30 additions & 29 deletions app/assets/translations/appOfflineData/getDataToStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { basicPagesData, taxonomydata, articledata, dailyHomeNotificationdata, s

export const getDataToStore = async (languageCode: string, dispatch: any, SchemaToUse: ObjectSchema, SchemaEntity: any, jsonData: any, setAllHardcodedData: any, sortBy?: any, currentChildData?: any): Promise<any> => {
// return new Promise((resolve) => {
let dataToStore: any;
//let dataToStore: any;
let offlineData: any;
if (SchemaToUse.name == StandardDevWeightForHeightSchema.name) {
offlineData = jsonData[languageCode] ? jsonData[languageCode][0].weight_for_height : undefined;
Expand All @@ -43,35 +43,36 @@ export const getDataToStore = async (languageCode: string, dispatch: any, Schema
}
}
const databaseData2 = await dataRealmCommon.getData<typeof SchemaEntity>(SchemaToUse, sortBy);
if (SchemaToUse.name == ArticleEntitySchema.name) {
if (currentChildData && currentChildData != "") {
let filterQuery = '';
if (currentChildData.taxonomyData && currentChildData.taxonomyData.id) {
filterQuery += '(child_age == ' + currentChildData.taxonomyData.id + ' || ';
}
if (filterQuery != '') {
filterQuery += 'child_age == 0)';
// if (SchemaToUse.name == ArticleEntitySchema.name) {
// if (currentChildData && currentChildData != "") {
// let filterQuery = '';
// if (currentChildData.taxonomyData && currentChildData.taxonomyData.id) {
// filterQuery += '(child_age == ' + currentChildData.taxonomyData.id + ' || ';
// }
// if (filterQuery != '') {
// filterQuery += 'child_age == 0)';

}
else {
filterQuery += 'child_age == 0';
}
if (currentChildData.parent_gender != "" && currentChildData.parent_gender != 0 && currentChildData.parent_gender != "0") {
filterQuery += '&& (parent_gender==' + parseInt(currentChildData.parent_gender) + ' || parent_gender == ' + bothParentGender + ' || parent_gender == ' + String(bothParentGender) + ' || parent_gender == 0)';
}
if (currentChildData.gender != "" && currentChildData.gender != 0 && currentChildData.gender != "0") {
filterQuery += '&& (child_gender==' + parseInt(currentChildData.gender) + ' || child_gender == ' + bothChildGender + ' || child_gender == ' + String(bothChildGender) + ' || child_gender == 0)';
}
// title CONTAINS 'Pe' && summary CONTAINS 'Ac' && body CONTAINS 'About'
const databaseData = await dataRealmCommon.getFilteredData<typeof SchemaEntity>(SchemaToUse, filterQuery);
dataToStore = databaseData;
} else {
dataToStore = databaseData2;
}
}
else {
dataToStore = databaseData2;
}
// }
// else {
// filterQuery += 'child_age == 0';
// }
// if (currentChildData.parent_gender != "" && currentChildData.parent_gender != 0 && currentChildData.parent_gender != "0") {
// filterQuery += '&& (parent_gender==' + parseInt(currentChildData.parent_gender) + ' || parent_gender == ' + bothParentGender + ' || parent_gender == ' + String(bothParentGender) + ' || parent_gender == 0)';
// }
// if (currentChildData.gender != "" && currentChildData.gender != 0 && currentChildData.gender != "0") {
// filterQuery += '&& (child_gender==' + parseInt(currentChildData.gender) + ' || child_gender == ' + bothChildGender + ' || child_gender == ' + String(bothChildGender) + ' || child_gender == 0)';
// }
// // title CONTAINS 'Pe' && summary CONTAINS 'Ac' && body CONTAINS 'About'
// const databaseData = await dataRealmCommon.getFilteredData<typeof SchemaEntity>(SchemaToUse, filterQuery);
// dataToStore = databaseData;
// } else {
// dataToStore = databaseData2;
// }
// }
// else {
// dataToStore = databaseData2;
// }
const dataToStore = databaseData2;
if (dataToStore?.length > 0) {
dispatch(setAllHardcodedData(dataToStore))
return dataToStore;
Expand Down
4 changes: 4 additions & 0 deletions app/components/shared/RelatedArticles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,15 @@ const RelatedArticles = (props: RelatedArticlesProps): any => {
async function fetchData(): Promise<any> {
if (relartlength > 0) {
let relatedData: any = [];
console.log('From screen', fromScreen)
console.log('Related articles is', relatedArticles)
if (fromScreen == "ChildgrowthTab") {
const filterQuery = JSON.parse(JSON.stringify(relatedArticles)).map((x: any) => `id = '${x}'`).join(' OR ');
relatedData = await dataRealmCommon.getFilteredData<ArticleEntity>(ArticleEntitySchema, filterQuery);
} else {
console.log('In artcile data from database',articleData.length,articleDataold.length)
relatedData = articleData.filter((x: any) => JSON.parse(JSON.stringify(relatedArticles)).includes(x.id));
console.log('relatedData data from database',relatedData)
}
relartlength = relatedData.length;
if (relartlength < maxRelatedArticleSize && fromScreen != "ChildgrowthTab") {
Expand Down
3 changes: 2 additions & 1 deletion app/database/config/dataDbConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const dataRealmConfig: Realm.Configuration = {
HealthCheckUpsSchema,
SurveysSchema,
ActivitiesEntitySchema,
ArticleActivityViewSchema,
StandardDevWeightForHeightSchema,
StandDevObj,
StandardDevHeightForAgeSchema,
Expand All @@ -46,7 +47,7 @@ export const dataRealmConfig: Realm.Configuration = {
SearchHistorySchema,
ActivitySearchHistorySchema
],
schemaVersion: 9,
schemaVersion: 10,
onMigration: (oldRealm, newRealm) => {
if (oldRealm.schemaVersion < 1) {
// const oldObjects = oldRealm.objects('VariableEntity');
Expand Down
1 change: 1 addition & 0 deletions app/database/schema/ActivitiesSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ export const ActivitiesEntitySchema: ObjectSchema = {
related_milestone: { type: 'list', objectType: 'int', },
mandatory: { type: 'int' },
embedded_images: { type: 'list', objectType: 'string', optional: true },

}
};
19 changes: 19 additions & 0 deletions app/database/schema/ArticleActivityViewSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ObjectSchema } from "realm";

export type ViewDetailsEntity = {
id: number;
type: string;
isViewed: boolean;
viewCount: number;
};
export const ArticleActivityViewSchema: ObjectSchema = {
name: 'ArticleActivityView',
properties: {
id: { type: 'int' },
type: { type: 'string' },
isViewed: { type: 'bool', optional: false },
viewCount: { type: 'int', default: 0 }
},
primaryKey: 'id'
};

2 changes: 1 addition & 1 deletion app/database/schema/ArticleSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ export const ArticleEntitySchema: ObjectSchema = {
licensed: { type: 'int' },
premature: { type: 'int' },
mandatory: { type: 'int' },
embedded_images: { type: 'list', objectType: 'string', optional: true },
embedded_images: { type: 'list', objectType: 'string', optional: true }
}
};
Loading

0 comments on commit 02f5dc9

Please sign in to comment.