From 954b4a4af0874ad6058bfd17c8145a5fa456b289 Mon Sep 17 00:00:00 2001 From: Muhammed Rahif Date: Wed, 5 Apr 2023 09:27:04 +0530 Subject: [PATCH 1/8] fix(capacitor): splash screen should be removed after loading the content --- android/app/capacitor.build.gradle | 1 + android/capacitor.settings.gradle | 3 +++ android/gradlew | 0 capacitor.config.ts | 3 +-- git-conventional-commits.yaml | 1 + ios/App/Podfile | 5 +++++ package.json | 1 + src/App.tsx | 5 +++++ yarn.lock | 5 +++++ 9 files changed, 22 insertions(+), 2 deletions(-) mode change 100644 => 100755 android/gradlew diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index 06a5be4..ca1c63f 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -12,6 +12,7 @@ dependencies { implementation project(':capacitor-app') implementation project(':capacitor-haptics') implementation project(':capacitor-keyboard') + implementation project(':capacitor-splash-screen') implementation project(':capacitor-status-bar') } diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle index bd35873..fd6199e 100644 --- a/android/capacitor.settings.gradle +++ b/android/capacitor.settings.gradle @@ -11,5 +11,8 @@ project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/ include ':capacitor-keyboard' project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android') +include ':capacitor-splash-screen' +project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android') + include ':capacitor-status-bar' project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android') diff --git a/android/gradlew b/android/gradlew old mode 100644 new mode 100755 diff --git a/capacitor.config.ts b/capacitor.config.ts index 22a1e8d..6a89d3f 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -7,9 +7,8 @@ const config: CapacitorConfig = { bundledWebRuntime: false, plugins: { SplashScreen: { - launchShowDuration: 3000, + launchShowDuration: 7000, launchAutoHide: true, - launchFadeOutDuration: 1000, }, }, }; diff --git a/git-conventional-commits.yaml b/git-conventional-commits.yaml index caa900f..a681a45 100644 --- a/git-conventional-commits.yaml +++ b/git-conventional-commits.yaml @@ -46,6 +46,7 @@ convention: 'ionic', 'readme', 'contributing', + 'capacitor', ] releaseTagGlobPattern: v[0-9]*.[0-9]*.[0-9]* changelog: diff --git a/ios/App/Podfile b/ios/App/Podfile index affb695..f12f18b 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -11,6 +11,11 @@ install! 'cocoapods', :disable_input_output_paths => true def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' + pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' + pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics' + pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard' + pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' + pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar' end target 'App' do diff --git a/package.json b/package.json index a32ddab..9d1130d 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@capacitor/haptics": "4.1.0", "@capacitor/ios": "4.7.3", "@capacitor/keyboard": "4.1.1", + "@capacitor/splash-screen": "^4.2.0", "@capacitor/status-bar": "4.1.1", "@ionic/react": "^7.0.0", "@ionic/react-router": "^7.0.0", diff --git a/src/App.tsx b/src/App.tsx index 1a8aa9f..1e2a00c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -21,6 +21,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; // import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { useAtomValue } from 'jotai/react'; import { settingsAtom } from 'stores/settings'; +import { SplashScreen } from '@capacitor/splash-screen'; /* Core CSS required for Ionic components to work properly */ import '@ionic/react/css/core.css'; @@ -97,6 +98,10 @@ const App: React.FC = () => { : document.body.classList.remove('dark'); }, [settings.general.theme]); + useEffect(() => { + setTimeout(async () => await SplashScreen.hide(), 500); + }, []); + return ( {/* */} diff --git a/yarn.lock b/yarn.lock index 187b157..7357088 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1042,6 +1042,11 @@ resolved "https://registry.yarnpkg.com/@capacitor/keyboard/-/keyboard-4.1.1.tgz#36e33d0e6a82ff2a67c17f67fd7cbb756c69706a" integrity sha512-fdC7u2TeG4BqwC0LnPnhOdya31C4QKdhk/8pc5lxI9X5jyYAetMCN1kEkKa7KREw4DdzXotJt27B9BXxAza6og== +"@capacitor/splash-screen@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@capacitor/splash-screen/-/splash-screen-4.2.0.tgz#027b545c03d2bebe039fb43ee46e2a48e8424f3a" + integrity sha512-XtGqM7J/yVEl/tKksKa7l1B6IDzhq4JJkadRuT8ohf/N7fD/1z45+id/4twM2Vnsxazh1fur2gq8rma7HaXMEw== + "@capacitor/status-bar@4.1.1": version "4.1.1" resolved "https://registry.yarnpkg.com/@capacitor/status-bar/-/status-bar-4.1.1.tgz#5b9a1acbe5efb30158e35be7a5ef7ffaaadaf804" From 45b44b75c2f4fb99572382aeef68deb9b3964116 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 5 Apr 2023 04:29:12 +0000 Subject: [PATCH 2/8] chore(release): 1.3.1-beta.1 [skip ci] ## [1.3.1-beta.1](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.0...v1.3.1-beta.1) (2023-04-05) ### Bug Fixes * **capacitor:** splash screen should be removed after loading the content ([954b4a4](https://github.com/Muhammed-Rahif/Islam/commit/954b4a4af0874ad6058bfd17c8145a5fa456b289)) --- CHANGELOG.md | 7 +++++++ android/app/build.gradle | 2 +- ios/App/App.xcodeproj/project.pbxproj | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 350f4c7..7ad43b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.3.1-beta.1](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.0...v1.3.1-beta.1) (2023-04-05) + + +### Bug Fixes + +* **capacitor:** splash screen should be removed after loading the content ([954b4a4](https://github.com/Muhammed-Rahif/Islam/commit/954b4a4af0874ad6058bfd17c8145a5fa456b289)) + # [1.3.0](https://github.com/Muhammed-Rahif/Islam/compare/v1.2.2...v1.3.0) (2023-04-04) diff --git a/android/app/build.gradle b/android/app/build.gradle index 2979236..4d6c88c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -7,7 +7,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "v1.3.0" + versionName "v1.3.1-beta.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index c22fb29..261dec8 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -350,7 +350,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = v1.3.0; + MARKETING_VERSION = v1.3.1-beta.1; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = tech.rahif.islam; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -370,7 +370,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = v1.3.0; + MARKETING_VERSION = v1.3.1-beta.1; PRODUCT_BUNDLE_IDENTIFIER = tech.rahif.islam; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; diff --git a/package.json b/package.json index 9d1130d..64dbdee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Islam", - "version": "v1.3.0", + "version": "v1.3.1-beta.1", "private": true, "dependencies": { "@capacitor/android": "4.7.3", From 7120d1f33ebf87e3639626094722eb55abcae504 Mon Sep 17 00:00:00 2001 From: Sibil Rahman Date: Wed, 5 Apr 2023 15:54:00 +0530 Subject: [PATCH 3/8] Update AndroidManifest.xml --- android/app/src/main/AndroidManifest.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 64d98c5..3832157 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,6 +10,11 @@ + + From 476bde58bf15da077fec3cc875abc5e5797bfb1a Mon Sep 17 00:00:00 2001 From: Muhammed Rahif Date: Wed, 5 Apr 2023 22:50:51 +0530 Subject: [PATCH 4/8] test(quran): add test cases for view quran scroll to top fab --- src/tests/ViewChapter.spec.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/ViewChapter.spec.ts b/src/tests/ViewChapter.spec.ts index 8ca3b27..e89ea6f 100644 --- a/src/tests/ViewChapter.spec.ts +++ b/src/tests/ViewChapter.spec.ts @@ -99,3 +99,26 @@ test('on Surah 1 (al-Fatihah), "prev chapter" btn should disabled', async ({ await expect(nextBtn).not.toHaveAttribute('disabled', ''); await expect(prevBtn).toHaveAttribute('disabled', ''); }); + +test('should scroll to top fab button scroll to top', async ({ page }) => { + await page.goto('http://localhost:8100/quran'); + await page.getByRole('heading', { name: 'Al-Baqarah' }).click(); + await page.getByText('Click here or Scroll down to load more').click(); + await page.getByText('Click here or Scroll down to load more').click(); + await page.getByText('Click here or Scroll down to load more').click(); + await page.getByText('Click here or Scroll down to load more').click(); + await page.locator('ion-fab').getByRole('button').click({ force: true }); + await page + .getByRole('button', { name: 'scroll-to-top-btn' }) + .click({ force: true }); + + // wait page to scroll to smoothly to top + await delay(1000); + + // reading segment button is in the top of the page + const readingSegBtn = page + .locator('ion-segment-button') + .filter({ hasText: 'Reading' }); + + await expect(readingSegBtn).toBeInViewport(); +}); From dd55814bfe36407f48744a11cd2d26f0ef293660 Mon Sep 17 00:00:00 2001 From: Muhammed Rahif Date: Wed, 5 Apr 2023 22:57:17 +0530 Subject: [PATCH 5/8] fix: only support portrait mode for android --- android/app/src/main/AndroidManifest.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 3832157..c5968d1 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ - + @@ -10,11 +10,6 @@ - - From 1d1ebe6203ddce8d77d24a4ee28fc73ef07ce423 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 5 Apr 2023 17:36:37 +0000 Subject: [PATCH 6/8] chore(release): 1.3.1-beta.2 [skip ci] ## [1.3.1-beta.2](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.1-beta.1...v1.3.1-beta.2) (2023-04-05) ### Bug Fixes * only support portrait mode for android ([dd55814](https://github.com/Muhammed-Rahif/Islam/commit/dd55814bfe36407f48744a11cd2d26f0ef293660)) --- CHANGELOG.md | 7 +++++++ android/app/build.gradle | 2 +- ios/App/App.xcodeproj/project.pbxproj | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ad43b8..6d90165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.3.1-beta.2](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.1-beta.1...v1.3.1-beta.2) (2023-04-05) + + +### Bug Fixes + +* only support portrait mode for android ([dd55814](https://github.com/Muhammed-Rahif/Islam/commit/dd55814bfe36407f48744a11cd2d26f0ef293660)) + ## [1.3.1-beta.1](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.0...v1.3.1-beta.1) (2023-04-05) diff --git a/android/app/build.gradle b/android/app/build.gradle index 4d6c88c..3512afe 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -7,7 +7,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "v1.3.1-beta.1" + versionName "v1.3.1-beta.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 261dec8..45f440d 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -350,7 +350,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = v1.3.1-beta.1; + MARKETING_VERSION = v1.3.1-beta.2; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = tech.rahif.islam; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -370,7 +370,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = v1.3.1-beta.1; + MARKETING_VERSION = v1.3.1-beta.2; PRODUCT_BUNDLE_IDENTIFIER = tech.rahif.islam; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; diff --git a/package.json b/package.json index 64dbdee..d8c9aba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Islam", - "version": "v1.3.1-beta.1", + "version": "v1.3.1-beta.2", "private": true, "dependencies": { "@capacitor/android": "4.7.3", From 37dcfa021caba3f00a2f3f436ebf0d8f608974c7 Mon Sep 17 00:00:00 2001 From: Muhammed Rahif Date: Fri, 7 Apr 2023 17:35:52 +0530 Subject: [PATCH 7/8] fix(api): display network error issues --- src/components/DisplayError.tsx | 28 ++++++++++++++++++ src/features/list-chapters/api/useAllJuzs.ts | 2 -- .../list-chapters/api/useChapersList.ts | 2 -- .../list-chapters/components/ChaptersList.tsx | 20 +++---------- .../list-chapters/components/SortedByJuz.tsx | 3 +- src/features/settings/api/useTranslations.ts | 2 -- src/features/view-chapter/api/useChapter.ts | 3 +- .../view-chapter/api/useChapterVerses.ts | 1 - .../view-chapter/api/useVersesUthmani.ts | 1 - .../components/ReadingContent.tsx | 11 ++----- .../components/TranslationContent.tsx | 18 ++---------- src/screens/ViewChapter.tsx | 29 ++++++++++++++----- 12 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 src/components/DisplayError.tsx diff --git a/src/components/DisplayError.tsx b/src/components/DisplayError.tsx new file mode 100644 index 0000000..990a1b5 --- /dev/null +++ b/src/components/DisplayError.tsx @@ -0,0 +1,28 @@ +import { IonIcon, IonText, IonToast } from '@ionic/react'; +import { alertCircle, alertCircleOutline } from 'ionicons/icons'; +import React from 'react'; + +type Props = { + error: Error | any; +}; + +function DisplayError({ error }: Props) { + return ( + <> + +
+ + +

{error ? (error as any).message : error}

+
+
+ + ); +} + +export default DisplayError; diff --git a/src/features/list-chapters/api/useAllJuzs.ts b/src/features/list-chapters/api/useAllJuzs.ts index 66fab96..0b37fac 100644 --- a/src/features/list-chapters/api/useAllJuzs.ts +++ b/src/features/list-chapters/api/useAllJuzs.ts @@ -13,10 +13,8 @@ function useAllJuzs() { ); return data; }, - enabled: true, staleTime: Infinity, cacheTime: Infinity, - retry: true, structuralSharing: false, notifyOnChangeProps: ['data'], }); diff --git a/src/features/list-chapters/api/useChapersList.ts b/src/features/list-chapters/api/useChapersList.ts index 98f8bf1..adc3ebd 100644 --- a/src/features/list-chapters/api/useChapersList.ts +++ b/src/features/list-chapters/api/useChapersList.ts @@ -13,10 +13,8 @@ function useChapersList() { return data; }, - enabled: true, staleTime: Infinity, cacheTime: Infinity, - retry: true, structuralSharing: false, notifyOnChangeProps: ['data', 'error', 'isLoading'], }); diff --git a/src/features/list-chapters/components/ChaptersList.tsx b/src/features/list-chapters/components/ChaptersList.tsx index 7428322..dc59042 100644 --- a/src/features/list-chapters/components/ChaptersList.tsx +++ b/src/features/list-chapters/components/ChaptersList.tsx @@ -1,17 +1,12 @@ -import { - IonItemGroup, - IonSpinner, - IonToast, - useIonViewDidEnter, -} from '@ionic/react'; -import React, { useEffect, useMemo, useRef, useState } from 'react'; +import { IonItemGroup, IonSpinner, useIonViewDidEnter } from '@ionic/react'; +import React, { useMemo, useRef, useState } from 'react'; import { ChapterSortBy } from '../types/Chapter'; import { useChapersList } from '../api/useChapersList'; -import { alertCircle } from 'ionicons/icons'; import { useAllJuzs } from '../api/useAllJuzs'; import { ChapterItem } from './ChapterItem'; import { SortedByJuz } from './SortedByJuz'; import { FixedSizeList as List } from 'react-window'; +import DisplayError from 'components/DisplayError'; interface ChapetersListProps { sortBy: ChapterSortBy; @@ -67,14 +62,7 @@ const ChaptersList: React.FC = ({ return (
{/* when error appears */} - {error ? ( - - ) : null} + {error ? : null} {/* when api is loading */} {isLoading && ( diff --git a/src/features/list-chapters/components/SortedByJuz.tsx b/src/features/list-chapters/components/SortedByJuz.tsx index e6ffa2f..6f5404f 100644 --- a/src/features/list-chapters/components/SortedByJuz.tsx +++ b/src/features/list-chapters/components/SortedByJuz.tsx @@ -28,7 +28,7 @@ const SortedByJuz: React.FC = ({ juzs, chapters }) => { // juz chapters cout like [2, 1, 3, 1, 4, 2, 2, 5] const juzChaptersCount = useMemo( - () => juzChaptersGroup?.map((juzChapters) => juzChapters.length), + () => juzChaptersGroup?.map((juzChapters) => juzChapters.length) ?? [], [juzChaptersGroup] ); @@ -58,7 +58,6 @@ const SortedByJuz: React.FC = ({ juzs, chapters }) => { versesCount={chapter.verses_count} id={chapter.id} translatedName={chapter.translated_name.name} - index={indx} key={chapter.id} /> ); diff --git a/src/features/settings/api/useTranslations.ts b/src/features/settings/api/useTranslations.ts index a3c75fa..d35b3fd 100644 --- a/src/features/settings/api/useTranslations.ts +++ b/src/features/settings/api/useTranslations.ts @@ -12,10 +12,8 @@ function useTranslations() { await quranApiInstance.get('/resources/translations'); return data; }, - enabled: true, staleTime: Infinity, cacheTime: Infinity, - retry: true, structuralSharing: false, notifyOnChangeProps: ['data'], }); diff --git a/src/features/view-chapter/api/useChapter.ts b/src/features/view-chapter/api/useChapter.ts index 4fe652c..0438278 100644 --- a/src/features/view-chapter/api/useChapter.ts +++ b/src/features/view-chapter/api/useChapter.ts @@ -19,9 +19,8 @@ function useChapter({ chapterId }: Props) { enabled: Boolean(chapterId), staleTime: Infinity, cacheTime: Infinity, - retry: true, structuralSharing: false, - notifyOnChangeProps: ['data', 'isLoading'], + notifyOnChangeProps: ['data', 'isLoading', 'error'], }); } diff --git a/src/features/view-chapter/api/useChapterVerses.ts b/src/features/view-chapter/api/useChapterVerses.ts index d04235c..8ed2c3c 100644 --- a/src/features/view-chapter/api/useChapterVerses.ts +++ b/src/features/view-chapter/api/useChapterVerses.ts @@ -35,7 +35,6 @@ function useChapterVerses({ enabled: Boolean(chapterId), cacheTime: Infinity, staleTime: Infinity, - retry: true, structuralSharing: false, notifyOnChangeProps: [ 'data', diff --git a/src/features/view-chapter/api/useVersesUthmani.ts b/src/features/view-chapter/api/useVersesUthmani.ts index ed1b017..cf411af 100644 --- a/src/features/view-chapter/api/useVersesUthmani.ts +++ b/src/features/view-chapter/api/useVersesUthmani.ts @@ -31,7 +31,6 @@ function useVersesUthmani({ chapterId, pages }: Props) { enabled: Boolean(chapterId), cacheTime: Infinity, staleTime: Infinity, - retry: true, structuralSharing: false, notifyOnChangeProps: [ 'data', diff --git a/src/features/view-chapter/components/ReadingContent.tsx b/src/features/view-chapter/components/ReadingContent.tsx index 78999f5..a134e1e 100644 --- a/src/features/view-chapter/components/ReadingContent.tsx +++ b/src/features/view-chapter/components/ReadingContent.tsx @@ -2,7 +2,6 @@ import { IonInfiniteScroll, IonInfiniteScrollContent, IonSpinner, - IonToast, useIonToast, } from '@ionic/react'; import { alertCircle } from 'ionicons/icons'; @@ -11,6 +10,7 @@ import { useVersesUthmani } from '../api/useVersesUthmani'; import { BismiVerse } from './BismiVerse'; import { useMemo } from 'react'; import { InlinedVerses } from './InlinedVerses'; +import DisplayError from 'components/DisplayError'; type Props = { pages: { @@ -51,14 +51,7 @@ const ReadingContent: React.FC = ({ bismiPre, pages }) => { return (
{/* when error appears */} - {error ? ( - - ) : null} + {error ? : null} {/* when api is loading */} {isLoading && ( diff --git a/src/features/view-chapter/components/TranslationContent.tsx b/src/features/view-chapter/components/TranslationContent.tsx index 73b24f0..57b6b9b 100644 --- a/src/features/view-chapter/components/TranslationContent.tsx +++ b/src/features/view-chapter/components/TranslationContent.tsx @@ -1,22 +1,17 @@ import { IonInfiniteScroll, IonInfiniteScrollContent, - IonItem, IonSpinner, - IonText, - IonToast, useIonToast, } from '@ionic/react'; import { alertCircle } from 'ionicons/icons'; -import { useAtom, useAtomValue } from 'jotai/react'; +import { useAtomValue } from 'jotai/react'; import { useParams } from 'react-router-dom'; -import { quranLastReadAtom } from 'stores/quranLastRead'; import { settingsAtom } from 'stores/settings'; -import { numToArabic, removeHtmlTags } from 'utils/string'; import { useChapterVerses } from '../api/useChapterVerses'; -import { Fragment } from 'react'; import { TranslationVerseItem } from './TranslationVerseItem'; import { BismiVerse } from './BismiVerse'; +import DisplayError from 'components/DisplayError'; type Props = { bismiPre?: boolean; @@ -42,14 +37,7 @@ const TranslationContent: React.FC = ({ bismiPre }) => { return (
{/* when error appears */} - {error ? ( - - ) : null} + {error ? : null} {/* when api is loading */} {isLoading && ( diff --git a/src/screens/ViewChapter.tsx b/src/screens/ViewChapter.tsx index de85b32..c3a797d 100644 --- a/src/screens/ViewChapter.tsx +++ b/src/screens/ViewChapter.tsx @@ -9,15 +9,14 @@ import { IonIcon, IonLabel, IonPage, - IonPopover, IonSegment, IonSegmentButton, + IonSpinner, IonTitle, IonToolbar, useIonRouter, - useIonViewDidEnter, } from '@ionic/react'; -import { createRef, useCallback, useMemo, useState } from 'react'; +import { createRef, useMemo, useState } from 'react'; import { useParams } from 'react-router-dom'; import { useChapter } from 'features/view-chapter'; import { ReadingContent } from 'features/view-chapter'; @@ -28,15 +27,19 @@ import { arrowUpOutline, swapHorizontal, } from 'ionicons/icons'; +import DisplayError from 'components/DisplayError'; const ViewChapter: React.FC = () => { const contentRef = createRef(); - const [isScrollEnding, setIsScrollEnding] = useState(false); const { chapterNo } = useParams<{ chapterNo: string; }>(); - const { isLoading: isChapterLoading, data: chapterData } = useChapter({ + const { + isLoading: isChapterLoading, + data: chapterData, + error: chapterDataError, + } = useChapter({ chapterId: parseInt(chapterNo), }); @@ -65,9 +68,9 @@ const ViewChapter: React.FC = () => { - {isChapterLoading - ? `Surah No. ${chapterNo}` - : `${chapterNo}. ${chapterData?.chapter.name_simple}`} + {chapterData?.chapter.name_simple + ? `${chapterNo}. ${chapterData?.chapter.name_simple}` + : `Surah No. ${chapterNo}`} @@ -85,6 +88,16 @@ const ViewChapter: React.FC = () => { + {/* when error appears */} + {chapterDataError ? : null} + + {/* when api is loading */} + {isChapterLoading && ( +
+ +
+ )} + {type === 'translation' ? ( ) : ( From ed1b2037ad62f84a08f9ecd6536d65b9bcc8de70 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 7 Apr 2023 12:22:51 +0000 Subject: [PATCH 8/8] chore(release): 1.3.1-beta.3 [skip ci] ## [1.3.1-beta.3](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.1-beta.2...v1.3.1-beta.3) (2023-04-07) ### Bug Fixes * **api:** display network error issues ([37dcfa0](https://github.com/Muhammed-Rahif/Islam/commit/37dcfa021caba3f00a2f3f436ebf0d8f608974c7)) --- CHANGELOG.md | 7 +++++++ android/app/build.gradle | 2 +- ios/App/App.xcodeproj/project.pbxproj | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d90165..dab1678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.3.1-beta.3](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.1-beta.2...v1.3.1-beta.3) (2023-04-07) + + +### Bug Fixes + +* **api:** display network error issues ([37dcfa0](https://github.com/Muhammed-Rahif/Islam/commit/37dcfa021caba3f00a2f3f436ebf0d8f608974c7)) + ## [1.3.1-beta.2](https://github.com/Muhammed-Rahif/Islam/compare/v1.3.1-beta.1...v1.3.1-beta.2) (2023-04-05) diff --git a/android/app/build.gradle b/android/app/build.gradle index 3512afe..026d997 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -7,7 +7,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "v1.3.1-beta.2" + versionName "v1.3.1-beta.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 45f440d..46d7801 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -350,7 +350,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = v1.3.1-beta.2; + MARKETING_VERSION = v1.3.1-beta.3; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = tech.rahif.islam; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -370,7 +370,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = v1.3.1-beta.2; + MARKETING_VERSION = v1.3.1-beta.3; PRODUCT_BUNDLE_IDENTIFIER = tech.rahif.islam; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; diff --git a/package.json b/package.json index d8c9aba..313e666 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Islam", - "version": "v1.3.1-beta.2", + "version": "v1.3.1-beta.3", "private": true, "dependencies": { "@capacitor/android": "4.7.3",