Skip to content

Commit f924cbc

Browse files
committed
bug fix
1 parent a9d5414 commit f924cbc

File tree

9 files changed

+51
-99
lines changed

9 files changed

+51
-99
lines changed

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ android {
137137
applicationId "com.hamagen"
138138
minSdkVersion rootProject.ext.minSdkVersion
139139
targetSdkVersion rootProject.ext.targetSdkVersion
140-
versionCode 101
141-
versionName '2.2.11'
140+
versionCode 104
141+
versionName '2.2.14'
142142
}
143143

144144
dexOptions {

ios/codeAgainstCorona.xcodeproj/project.pbxproj

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@
292292
ProvisioningStyle = Manual;
293293
};
294294
D52A57BF24203FBB00521B22 = {
295-
ProvisioningStyle = Manual;
295+
DevelopmentTeam = N3P977USJJ;
296+
ProvisioningStyle = Automatic;
296297
};
297298
};
298299
};
@@ -553,12 +554,12 @@
553554
CODE_SIGN_ENTITLEMENTS = "codeAgainstCorona/Code against corona.entitlements";
554555
CODE_SIGN_IDENTITY = "iPhone Developer";
555556
CODE_SIGN_STYLE = Manual;
556-
CURRENT_PROJECT_VERSION = 100;
557+
CURRENT_PROJECT_VERSION = 104;
557558
DEAD_CODE_STRIPPING = NO;
558559
DEVELOPMENT_TEAM = N3P977USJJ;
559560
INFOPLIST_FILE = codeAgainstCorona/Info.plist;
560561
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
561-
MARKETING_VERSION = 2.2.10;
562+
MARKETING_VERSION = 2.2.14;
562563
OTHER_LDFLAGS = (
563564
"$(inherited)",
564565
"-ObjC",
@@ -584,11 +585,11 @@
584585
CODE_SIGN_ENTITLEMENTS = "המגןRelease.entitlements";
585586
CODE_SIGN_IDENTITY = "iPhone Distribution";
586587
CODE_SIGN_STYLE = Manual;
587-
CURRENT_PROJECT_VERSION = 100;
588+
CURRENT_PROJECT_VERSION = 104;
588589
DEVELOPMENT_TEAM = N3P977USJJ;
589590
INFOPLIST_FILE = codeAgainstCorona/Info.plist;
590591
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
591-
MARKETING_VERSION = 2.2.10;
592+
MARKETING_VERSION = 2.2.14;
592593
OTHER_LDFLAGS = (
593594
"$(inherited)",
594595
"-ObjC",
@@ -711,10 +712,10 @@
711712
CLANG_ENABLE_MODULES = YES;
712713
CODE_SIGN_ENTITLEMENTS = "המגן QA.entitlements";
713714
CODE_SIGN_IDENTITY = "Apple Development";
714-
CODE_SIGN_STYLE = Manual;
715-
CURRENT_PROJECT_VERSION = 101;
715+
CODE_SIGN_STYLE = Automatic;
716+
CURRENT_PROJECT_VERSION = 104;
716717
DEAD_CODE_STRIPPING = NO;
717-
DEVELOPMENT_TEAM = "";
718+
DEVELOPMENT_TEAM = N3P977USJJ;
718719
FRAMEWORK_SEARCH_PATHS = (
719720
"$(inherited)",
720721
"$(PROJECT_DIR)/Pods/TSBackgroundFetch/ios/TSBackgroundFetch",
@@ -724,7 +725,7 @@
724725
INFOPLIST_FILE = "codeAgainstCorona/Info-qa.plist";
725726
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
726727
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
727-
MARKETING_VERSION = 2.2.11;
728+
MARKETING_VERSION = 2.2.14;
728729
OTHER_LDFLAGS = (
729730
"$(inherited)",
730731
"-ObjC",
@@ -750,7 +751,7 @@
750751
CODE_SIGN_ENTITLEMENTS = "המגן QA.entitlements";
751752
CODE_SIGN_IDENTITY = "iPhone Distribution";
752753
CODE_SIGN_STYLE = Manual;
753-
CURRENT_PROJECT_VERSION = 101;
754+
CURRENT_PROJECT_VERSION = 104;
754755
DEVELOPMENT_TEAM = N3P977USJJ;
755756
FRAMEWORK_SEARCH_PATHS = (
756757
"$(inherited)",
@@ -761,7 +762,7 @@
761762
INFOPLIST_FILE = "codeAgainstCorona/Info-qa.plist";
762763
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
763764
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
764-
MARKETING_VERSION = 2.2.11;
765+
MARKETING_VERSION = 2.2.14;
765766
OTHER_LDFLAGS = (
766767
"$(inherited)",
767768
"-ObjC",

ios/codeAgainstCorona.xcodeproj/xcshareddata/xcschemes/hamagen-qa.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</Testables>
3232
</TestAction>
3333
<LaunchAction
34-
buildConfiguration = "Release"
34+
buildConfiguration = "Debug"
3535
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3636
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
3737
launchStyle = "0"

src/actions/GeneralActions.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,33 +89,36 @@ export const checkIfBleEnabled = () => async (dispatch: any) => {
8989
let payload: string | null = 'false';
9090
try {
9191
// check if permission changed
92-
if(IS_IOS) {
92+
if (IS_IOS) {
9393
const BTCheckStatus: PermissionStatus = await check(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL);
94+
9495
switch (BTCheckStatus) {
9596
case RESULTS.UNAVAILABLE: {
96-
payload = RESULTS.BLOCKED
97+
payload = RESULTS.BLOCKED;
9798
break;
9899
}
99100
case RESULTS.BLOCKED: {
100-
payload = RESULTS.BLOCKED
101+
payload = RESULTS.BLOCKED;
101102
break;
102103
}
103104
case RESULTS.GRANTED: {
104105
if (ENABLE_BLE_IN_APP) {
105-
payload = await AsyncStorage.getItem(USER_AGREE_TO_BLE);
106+
const res = await AsyncStorage.getItem(USER_AGREE_TO_BLE);
107+
if (res) {
108+
payload = res;
109+
} else {
110+
payload = 'true';
111+
}
106112
}
107113
break;
108114
}
109115
case RESULTS.DENIED: {
110116
// if you can ask permission again change to null to ask again
111-
payload = null
117+
payload = null;
112118
}
113119
}
114-
115-
} else {
116-
if (ENABLE_BLE_IN_APP) {
117-
payload = await AsyncStorage.getItem(USER_AGREE_TO_BLE);
118-
}
120+
} else if (ENABLE_BLE_IN_APP) {
121+
payload = await AsyncStorage.getItem(USER_AGREE_TO_BLE);
119122
}
120123
} catch (error) {
121124
onError({ error });

src/components/Drawer/SettingsDrawerContent.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import {
66
HIT_SLOP,
77

88

9-
10-
11-
12-
139
IS_IOS,
1410
IS_SMALL_SCREEN, PADDING_BOTTOM,
1511
PADDING_TOP,
@@ -25,21 +21,19 @@ interface Props {
2521
}
2622

2723
const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => {
28-
29-
3024
const { locale: { strings: { menu: { battery, bluetooth, settings } }, isRTL }, general: { enableBle, batteryDisabled } } = useSelector<Store, Store>(state => state);
3125

3226
const BLEState = useMemo(() => {
3327
switch (enableBle) {
3428
case 'true':
35-
return true
29+
return true;
3630
case 'false':
3731
case 'blocked':
3832
case null:
3933
default:
40-
return false
34+
return false;
4135
}
42-
}, [enableBle])
36+
}, [enableBle]);
4337

4438
return (
4539
<View style={styles.container}>

src/components/Main/Modals/BluetoothDeniedModal.tsx

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,18 @@
1-
import AsyncStorage from '@react-native-community/async-storage';
21
import { NavigationProp } from '@react-navigation/native';
3-
import React, { useEffect } from 'react';
4-
import { AppState, Linking, StyleSheet, View } from 'react-native';
5-
import { check, PERMISSIONS, PermissionStatus, request, RESULTS } from 'react-native-permissions';
6-
import { useDispatch, useSelector } from 'react-redux';
7-
import { ENABLE_BLE } from '../../../constants/ActionTypes';
8-
import { IS_SMALL_SCREEN, PADDING_BOTTOM, PADDING_TOP, SCREEN_WIDTH, USER_AGREE_TO_BLE, WHITE } from '../../../constants/Constants';
2+
import React from 'react';
3+
import { Linking, StyleSheet, View } from 'react-native';
4+
import { useSelector } from 'react-redux';
5+
import { IS_SMALL_SCREEN, PADDING_BOTTOM, PADDING_TOP, SCREEN_WIDTH, WHITE } from '../../../constants/Constants';
96
import { LocaleReducer, Store } from '../../../types';
107
import { ActionButton, HeaderButton, Icon, Text } from '../../common';
118

129
interface Props {
13-
navigation: NavigationProp<any, 'BluetoothDenied'>
10+
navigation: NavigationProp<any, 'BluetoothDenied'>
1411
}
1512

1613
const BluetoothDeniedModal = ({ navigation }: Props) => {
17-
const dispatch = useDispatch();
1814
const { strings: { BluetoothDenied: { title, description, recommendation, buttonText } } } = useSelector<Store, LocaleReducer>(state => state.locale);
1915

20-
useEffect(() => {
21-
AppState.addEventListener('change', onAppStateChange);
22-
return () => { AppState.removeEventListener('change', onAppStateChange); };
23-
});
24-
25-
const onAppStateChange = async () => {
26-
const BTCheckStatus: PermissionStatus = await check(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL);
27-
switch (BTCheckStatus) {
28-
case RESULTS.UNAVAILABLE:
29-
case RESULTS.BLOCKED: {
30-
dispatch({ type: ENABLE_BLE, payload: 'blocked' });
31-
break;
32-
}
33-
case RESULTS.GRANTED: {
34-
dispatch({ type: ENABLE_BLE, payload: 'true' });
35-
await AsyncStorage.setItem(USER_AGREE_TO_BLE, 'true');
36-
break;
37-
}
38-
case RESULTS.DENIED: {
39-
const BTRequestStatus: PermissionStatus = await request(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL);
40-
switch (BTRequestStatus) {
41-
case RESULTS.DENIED: {
42-
dispatch({ type: ENABLE_BLE, payload: null});
43-
await AsyncStorage.removeItem(USER_AGREE_TO_BLE);
44-
break;
45-
}
46-
case RESULTS.BLOCKED: {
47-
dispatch({ type: ENABLE_BLE, payload: RESULTS.BLOCKED });
48-
await AsyncStorage.removeItem(USER_AGREE_TO_BLE);
49-
break;
50-
}
51-
case RESULTS.GRANTED: {
52-
dispatch({ type: ENABLE_BLE, payload: 'true' });
53-
await AsyncStorage.setItem(USER_AGREE_TO_BLE, 'true');
54-
break;
55-
}
56-
}
57-
}
58-
}
59-
navigation.navigate('ScanHome');
60-
};
6116

6217
return (
6318
<View style={styles.container}>

src/components/Main/ScanHomeHeader.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ const ScanHomeHeader: FunctionComponent<ScanHomeHeaderProps> = ({ isRTL, languag
2828
const showBLEBtn: string = useMemo(() => {
2929
switch (enableBle) {
3030
case 'false':
31-
return 'empty'
31+
return 'empty';
3232
case 'true':
33-
return 'full'
33+
return 'full';
3434
case 'blocked':
3535
case null:
3636
default:
37-
return 'hide'
37+
return 'hide';
3838
}
39-
}, [enableBle])
39+
}, [enableBle]);
4040

4141
useEffect(() => {
42-
init()
42+
init();
4343
}, []);
4444

4545
const init = async () => {
4646
try {
47-
const res = await AsyncStorage.getItem(MENU_DOT_LAST_SEEN)
47+
const res = await AsyncStorage.getItem(MENU_DOT_LAST_SEEN);
4848
if (res) {
4949
if (parseInt(res, 10) < SHOW_DOT_BY_BUILD_NUMBER) {
5050
setShowDot(true);
@@ -54,11 +54,10 @@ const ScanHomeHeader: FunctionComponent<ScanHomeHeaderProps> = ({ isRTL, languag
5454
} else {
5555
setShowDot(true);
5656
}
57-
}
58-
catch {
57+
} catch {
5958
setShowDot(true);
6059
}
61-
}
60+
};
6261

6362
const onShare = async () => {
6463
try {
@@ -92,7 +91,7 @@ const ScanHomeHeader: FunctionComponent<ScanHomeHeaderProps> = ({ isRTL, languag
9291
</View>
9392
<View style={{ flexDirection: isRTL ? 'row-reverse' : 'row' }}>
9493
{showBLEBtn !== 'hide' && (
95-
<TouchableOpacity style={{ marginHorizontal: 20 }} hitSlop={HIT_SLOP} onPress={() => toggleBLEService(showBLEBtn === 'full' ? false : true)}>
94+
<TouchableOpacity style={{ marginHorizontal: 20 }} hitSlop={HIT_SLOP} onPress={() => toggleBLEService(showBLEBtn !== 'full')}>
9695
<Icon source={showBLEBtn === 'full' ? require('../../assets/main/bluetoothOnBtn.png') : require('../../assets/main/bluetoothOffBtn.png')} width={23} />
9796
</TouchableOpacity>
9897
)}

src/components/Main/Settings/BluetoothSettings.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ const BluetoothSettings: FunctionComponent<Props> = ({ navigation }) => {
2121
const switchValue: boolean = useMemo(() => {
2222
switch (enableBle) {
2323
case 'true':
24-
return true
24+
return true;
2525
case 'false':
2626
case 'blocked':
2727
case null:
2828
default:
29-
return false
29+
return false;
3030
}
31-
}, [enableBle])
31+
}, [enableBle]);
3232

3333
return (
3434
<View style={styles.container}>
@@ -70,15 +70,15 @@ const BluetoothSettings: FunctionComponent<Props> = ({ navigation }) => {
7070
onValueChange={() => {
7171
switch (enableBle) {
7272
case 'blocked':
73-
navigation.replace('BluetoothDenied')
73+
navigation.replace('BluetoothDenied');
7474
break;
7575
case null:
7676
navigation.replace('Bluetooth');
7777
break;
7878
case 'true':
7979
case 'false':
8080
default:
81-
toggleBLEService(enableBle === 'true' ? false : true)
81+
toggleBLEService(enableBle !== 'true');
8282
}
8383
}}
8484
/>

src/services/BLEService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const match = async () => new Promise(async (resolve) => {
9797
});
9898

9999
export const toggleBLEService = async (payload: boolean) => {
100-
store().dispatch({ type: ENABLE_BLE_TYPE, payload:payload.toString() });
100+
store().dispatch({ type: ENABLE_BLE_TYPE, payload: payload.toString() });
101101
await AsyncStorage.setItem(USER_AGREE_TO_BLE, payload.toString());
102102
await initBLETracing();
103103
};

0 commit comments

Comments
 (0)