Skip to content

Commit

Permalink
feat: add default settings constanst, remove in app update
Browse files Browse the repository at this point in the history
  • Loading branch information
ayonshafiul committed Jul 10, 2024
1 parent bd24622 commit 261daaa
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 95 deletions.
27 changes: 0 additions & 27 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@ import SplashScreen from 'react-native-splash-screen';
import {ActivityIndicator, Platform} from 'react-native';
import colors from './assets/constants/colors';

import SpInAppUpdates, {
NeedsUpdateResponse,
IAUUpdateKind,
StartUpdateOptions,
} from 'sp-react-native-in-app-updates';

initializeDefaultSettings();

const inAppUpdates = new SpInAppUpdates(
false, // isDebug
);

export default function App() {
const [initialRoute, setInitialRoute] = useState('');

Expand All @@ -43,23 +33,6 @@ export default function App() {
setInitialRoute('Tabs');
}
SplashScreen.hide();

inAppUpdates
.checkNeedsUpdate()
.then(result => {
if (result.shouldUpdate) {
let updateOptions = {};
if (Platform.OS === 'android') {
updateOptions = {
updateType: IAUUpdateKind.FLEXIBLE,
};
}
inAppUpdates.startUpdate(updateOptions);
}
})
.catch(err => {
console.log('🚀 ~ inAppUpdates.checkNeedsUpdate ~ err:', err);
});
}
getFirstTimeSettings();
}, []);
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ android {
applicationId "io.github.ayonshafiul.peyara"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 36
versionName "1.3.6"
versionCode 37
versionName "1.3.7"
}
signingConfigs {
debug {
Expand Down
4 changes: 4 additions & 0 deletions assets/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ export const mediaKeysData = [
label: 'Arrow Right',
},
];

export const DEFAULT_TOUCHPAD_SENSITIVITY = 0.5;
export const DEFAULT_TOUCHPAD_SCROLL_SENSITIVITY = 0.5;
export const DEFAULT_TOUCHPAD_RESPONSE_RATE = 12;
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "peyara-mouse-client",
"version": "1.3.6",
"version": "1.3.7",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down Expand Up @@ -36,8 +36,7 @@
"react-native-swipeable-item": "^2.0.9",
"react-native-switch": "^1.5.1",
"react-native-vector-icons": "^10.0.3",
"socket.io-client": "^4.7.5",
"sp-react-native-in-app-updates": "^1.4.0"
"socket.io-client": "^4.7.5"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
13 changes: 10 additions & 3 deletions screens/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import {
SETTINGS_TOUCHPAD_SENSITIVITY,
SETTINGS_TOUCHPAD_RESPONSE_RATE,
settingsData,
DEFAULT_TOUCHPAD_SENSITIVITY,
DEFAULT_TOUCHPAD_SCROLL_SENSITIVITY,
DEFAULT_TOUCHPAD_RESPONSE_RATE,
} from '../assets/constants/constants';
import Background from '../components/Background';

Expand Down Expand Up @@ -61,9 +64,13 @@ function SwitchCard({item}) {
}

export default function Settings() {
const [touchSens, setTouchSens] = useState(0.75);
const [scrollSens, setScrollSens] = useState(0.35);
const [responseRate, setResponseRate] = useState(16);
const [touchSens, setTouchSens] = useState(DEFAULT_TOUCHPAD_SENSITIVITY);
const [scrollSens, setScrollSens] = useState(
DEFAULT_TOUCHPAD_SCROLL_SENSITIVITY,
);
const [responseRate, setResponseRate] = useState(
DEFAULT_TOUCHPAD_RESPONSE_RATE,
);

useEffect(() => {
(async function getSliderValues() {
Expand Down
13 changes: 10 additions & 3 deletions screens/Touchpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import {
} from '../utils/settings';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import {
DEFAULT_TOUCHPAD_RESPONSE_RATE,
DEFAULT_TOUCHPAD_SCROLL_SENSITIVITY,
DEFAULT_TOUCHPAD_SENSITIVITY,
SERVER_URL_KEY,
SETTINGS_TOUCHPAD_SCROLL_SENSITIVITY,
SETTINGS_TOUCHPAD_SENSITIVITY,
Expand Down Expand Up @@ -122,9 +125,13 @@ export default function Touchpad({navigation, route}) {
useEffect(() => {
(async function setSensitivities() {
if (isFocused) {
tS.current = Number(getValueFor(SETTINGS_TOUCHPAD_SENSITIVITY) ?? 1);
tS.current = Number(
getValueFor(SETTINGS_TOUCHPAD_SENSITIVITY) ??
DEFAULT_TOUCHPAD_SENSITIVITY,
);
sS.current = Number(
getValueFor(SETTINGS_TOUCHPAD_SCROLL_SENSITIVITY) ?? 0.2,
getValueFor(SETTINGS_TOUCHPAD_SCROLL_SENSITIVITY) ??
DEFAULT_TOUCHPAD_SCROLL_SENSITIVITY,
);
const invertedScroll = getInvertedScrollSettings();
const keepAwake = getKeepAwakeSettings();
Expand Down Expand Up @@ -287,7 +294,7 @@ export default function Touchpad({navigation, route}) {
tY.current = 0;
sX.current = 0;
sY.current = 0;
}, Number(responseRate ?? 16));
}, Number(responseRate ?? DEFAULT_TOUCHPAD_RESPONSE_RATE));

const setScroll = coordinates => {
sX.current = coordinates.x;
Expand Down
57 changes: 0 additions & 57 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3045,13 +3045,6 @@ anymatch@^3.0.3:
normalize-path "^3.0.0"
picomatch "^2.0.4"

apisauce@^2.1.1:
version "2.1.6"
resolved "https://registry.yarnpkg.com/apisauce/-/apisauce-2.1.6.tgz#94887f335bf3d735305fc895c8a191c9c2608a7f"
integrity sha512-MdxR391op/FucS2YQRfB/NMRyCnHEPDd4h17LRIuVYi0BpGmMhpxc0shbOpfs5ahABuBEffNCGal5EcsydbBWg==
dependencies:
axios "^0.21.4"

appdirsjs@^1.2.4:
version "1.2.7"
resolved "https://registry.yarnpkg.com/appdirsjs/-/appdirsjs-1.2.7.tgz#50b4b7948a26ba6090d4aede2ae2dc2b051be3b3"
Expand Down Expand Up @@ -3208,13 +3201,6 @@ available-typed-arrays@^1.0.7:
dependencies:
possible-typed-array-names "^1.0.0"

axios@^0.21.4:
version "0.21.4"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575"
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==
dependencies:
follow-redirects "^1.14.0"

babel-core@^7.0.0-bridge.0:
version "7.0.0-bridge.0"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
Expand Down Expand Up @@ -5034,11 +5020,6 @@ flow-parser@^0.206.0:
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.206.0.tgz#f4f794f8026535278393308e01ea72f31000bfef"
integrity sha512-HVzoK3r6Vsg+lKvlIZzaWNBVai+FXTX1wdYhz/wVlH13tb/gOdLXmlTqy6odmTBhT5UoWUbq0k8263Qhr9d88w==

follow-redirects@^1.14.0:
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==

fontfaceobserver@^2.1.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/fontfaceobserver/-/fontfaceobserver-2.3.0.tgz#5fb392116e75d5024b7ec8e4f2ce92106d1488c8"
Expand Down Expand Up @@ -7713,16 +7694,6 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-device-info@10.3.0:
version "10.3.0"
resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-10.3.0.tgz#6bab64d84d3415dd00cc446c73ec5e2e61fddbe7"
integrity sha512-/ziZN1sA1REbJTv5mQZ4tXggcTvSbct+u5kCaze8BmN//lbxcTvWsU6NQd4IihLt89VkbX+14IGc9sVApSxd/w==

react-native-device-info@^0.9.3:
version "0.9.9"
resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-0.9.9.tgz#42490719b8be2b8ffe689f3c74d56884ca05c0d7"
integrity sha512-BsRPImeOSPOioitx2OREwuyGRsXiqhcNMPrIJ79FFWB2kbANZk56VqoSxta/i/RB1v3Xws0YDLLSqz9kEeudcQ==

react-native-device-info@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-11.1.0.tgz#7db5c4e5a179dce761efac155a493aa0956a40ab"
Expand Down Expand Up @@ -7778,14 +7749,6 @@ react-native-screens@^3.29.0:
react-freeze "^1.0.0"
warn-once "^0.1.0"

react-native-siren@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/react-native-siren/-/react-native-siren-0.0.5.tgz#cc32e62eda163d3ae28bb2cb1b342eb859c3bd1c"
integrity sha512-mOzjFpm8ASNI/vnc+uWcj4ogboRrzfzmueCMYavLvyz5QbLyDem2LI9vtsz7t9fxzw2tZzc8XPfRb0IjUJXfZw==
dependencies:
apisauce "^2.1.1"
react-native-device-info "^0.9.3"

react-native-splash-screen@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/react-native-splash-screen/-/react-native-splash-screen-3.3.0.tgz#3af71ed17afe50fee69590a45aec399d071ead02"
Expand Down Expand Up @@ -8202,11 +8165,6 @@ scheduler@^0.23.0:
dependencies:
loose-envify "^1.1.0"

semver@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.2.1.tgz#d997aa36bdbb00b501ae4ac4c7d17e9f7a587ae5"
integrity sha512-aHhm1pD02jXXkyIpq25qBZjr3CQgg8KST8uX0OWXch3xE6jw+1bfbWnCjzMwojsTquroUmKFHNzU6x26mEiRxw==

semver@7.3.2:
version "7.3.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
Expand Down Expand Up @@ -8465,16 +8423,6 @@ source-map@^0.7.3:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656"
integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==

sp-react-native-in-app-updates@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/sp-react-native-in-app-updates/-/sp-react-native-in-app-updates-1.4.0.tgz#60f1fc3bac5dd4f1992c32aa4fd666c2fbab7bc3"
integrity sha512-zhFUjeaPqykDVyYLRXCLLZjDMMfbe4ylOqPEpF3vvzC0V+WB9q07KkYxOm+ETuaZhEXbQADiqJh7uzFOZynmnw==
dependencies:
react-native-device-info "10.3.0"
react-native-siren "0.0.5"
semver "7.2.1"
underscore "1.12.1"

split-on-first@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f"
Expand Down Expand Up @@ -9020,11 +8968,6 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"

underscore@1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.12.1.tgz#7bb8cc9b3d397e201cf8553336d262544ead829e"
integrity sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
Expand Down

0 comments on commit 261daaa

Please sign in to comment.