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

fix: bani sortable #120

Merged
merged 24 commits into from
Sep 28, 2022
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
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"rules": {
"import/no-unresolved": "off",
"global-require": 0,
"react/jsx-no-bind":0,
"react/jsx-no-bind": 0,
"prefer-destructuring": ["error", { "object": true, "array": false }],
"react/jsx-filename-extension": [
1,
{
Expand All @@ -20,7 +21,7 @@
"error",
{
"trailingComma": "es5",
"printWidth":100
"printWidth": 100
}
]
},
Expand Down
39 changes: 25 additions & 14 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import { BackHandler, Alert, AppRegistry } from "react-native";
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { BackHandler, Alert, AppRegistry, AppState } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import * as React from "react";
import HomeScreen from "./screens/Home";
import FolderBaniScreen from "./screens/FolderBani";
import SettingsScreen from "./screens/Settings";
Expand All @@ -14,6 +14,7 @@ import ReaderScreen from "./screens/Reader";
import BookmarksScreen from "./screens/Bookmarks";
import createStore from "./config/store";
import FirebaseNotification from "./utils/firebaseNotification";
import NotificationsManager from "./utils/notifications";

const Stack = createNativeStackNavigator();

Expand All @@ -23,6 +24,13 @@ export default class App extends React.Component {
componentDidMount() {
this.notificationHandler();
BackHandler.addEventListener("hardwareBackPress", this.handleBackPress);
// AppStateIOS.addEventListener("change", (state) => console.log("AppStateIOS changed to", state));
AppState.addEventListener("change", (state) => {
if (state === "active") {
const notification = new NotificationsManager();
notification.resetBadgeCount();
}
});
}

componentWillUnmount() {
Expand All @@ -33,32 +41,35 @@ export default class App extends React.Component {
Alert.alert(
"Exit Sundar Gutka",
"Are you sure you want to exit?",
[
{ text: "Cancel" },
{ text: "Exit", onPress: () => BackHandler.exitApp() }
],
[{ text: "Cancel" }, { text: "Exit", onPress: () => BackHandler.exitApp() }],
{ cancelable: true }
);
return true;
};

notificationHandler=()=> {
const firebaseNotifaction = new FirebaseNotification()
notificationHandler = () => {
const firebaseNotifaction = new FirebaseNotification();
firebaseNotifaction.checkPermission();
firebaseNotifaction.backgroundMessageHandler();
firebaseNotifaction.foregroundMessage();
firebaseNotifaction.handleNotification();
}
const notification = new NotificationsManager();
notification.listenReminders();
// notification.listenReminders();
};

render() {
const notification = new NotificationsManager();
notification.resetBadgeCount();
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerShown: false
}}>
headerShown: false,
}}
>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="FolderBani" component={FolderBaniScreen} />
<Stack.Screen name="Settings" component={SettingsScreen} />
Expand All @@ -74,4 +85,4 @@ export default class App extends React.Component {
);
}
}
AppRegistry.registerHeadlessTask('RNFirebaseMessagingService', () => this.notificationHandler);
AppRegistry.registerHeadlessTask("RNFirebaseMessagingService", () => this.notificationHandler);
51 changes: 10 additions & 41 deletions actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,9 @@ export const SET_START_BANI = "SET_START_BANI";
* other constants
*/

export const FONT_SIZES = [
"EXTRA_SMALL",
"SMALL",
"MEDIUM",
"LARGE",
"EXTRA_LARGE",
];
export const FONT_SIZES = ["EXTRA_SMALL", "SMALL", "MEDIUM", "LARGE", "EXTRA_LARGE"];

export const LANGUAGES = [
"DEFAULT",
"en-US",
"es",
"fr",
"it",
"hi",
"pa",
];
export const LANGUAGES = ["DEFAULT", "en-US", "es", "fr", "it", "hi", "pa"];

export const languageNames = [
`${Strings.default}`,
Expand Down Expand Up @@ -92,12 +78,7 @@ export const fontFaceNames = [
`${Strings.gurbani_akhar_think}`,
];

export const TRANSLITERATION_LANGUAGES = [
"ENGLISH",
"HINDI",
"SHAHMUKHI",
"IPA",
];
export const TRANSLITERATION_LANGUAGES = ["ENGLISH", "HINDI", "SHAHMUKHI", "IPA"];

export const transliterationLanguageNames = [
`${Strings.english}`,
Expand All @@ -115,10 +96,7 @@ export const baniLengthNames = [
`${Strings.extra_long}`,
];

export const MANGLACHARAN_POSITIONS = [
"CURRENT_SAROOPS",
"ABOVE_RAAG_HEADINGS",
];
export const MANGLACHARAN_POSITIONS = ["CURRENT_SAROOPS", "ABOVE_RAAG_HEADINGS"];

export const manglacharanPositionNames = [
`${Strings.current_saroops_default}`,
Expand All @@ -132,11 +110,7 @@ export const padchhedSettingNames = [
`${Strings.mast_sabh_mast}`,
];

export const REMINDER_SOUNDS = [
"default",
"wake_up_jap.mp3",
"waheguru_soul.mp3",
];
export const REMINDER_SOUNDS = ["default", "wake_up_jap.mp3", "waheguru_soul.mp3"];

export const reminderSoundNames = [
`${Strings.default}`,
Expand All @@ -146,17 +120,15 @@ export const reminderSoundNames = [

export const VISHRAAM_OPTIONS = ["VISHRAAM_COLORED", "VISHRAAM_GRADIENT"];

export const vishraamOptionNames = [
`${Strings.colored_words}`,
`${Strings.gradient_background}`,
];
export const vishraamOptionNames = [`${Strings.colored_words}`, `${Strings.gradient_background}`];

export const VISHRAAM_SOURCES = ["sttm", "igurbani", "sttm2"];

export const vishraamSourceNames = [
`${Strings.banidb_living_default}`,
`${Strings.iGurbani}`,
`${Strings.sttm2}`,];
`${Strings.sttm2}`,
];

/*
* action creators
Expand Down Expand Up @@ -188,10 +160,7 @@ export function toggleTransliteration(value) {
}

export function setTransliterationLanguage(language) {
AnalyticsManager.getInstance().trackSettingsEvent(
"transliterationLanguage",
language
);
AnalyticsManager.getInstance().trackSettingsEvent("transliterationLanguage", language);
return { type: SET_TRANSLITERATION_LANGUAGE, language };
}

Expand Down Expand Up @@ -282,7 +251,7 @@ export function toggleAutoScroll(value) {
}

export function setAutoScrollSpeed(speed, shabad) {
let shabadSpeed = { [shabad]: speed };
const shabadSpeed = { [shabad]: speed };
return { type: SET_AUTO_SCROLL_SPEED, shabadSpeed };
}

Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:exported="true" android:label="@string/app_name"
<activity android:name=".MainActivity" android:exported="true" android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask" android:windowSoftInputMode="adjustResize">
</activity>

<activity android:name=".SplashActivity" android:theme="@style/SplashTheme" android:label="@string/app_name">
<activity android:name=".SplashActivity" android:exported="true" android:theme="@style/SplashTheme" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "21.4.7075529"
}
repositories {
Expand Down
Loading