Skip to content

Commit f4aa9ef

Browse files
authored
Merge pull request #84 from jiloysss/master
Merge
2 parents 0586a48 + 4987853 commit f4aa9ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3282
-1452
lines changed

android/app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ android {
177177
}
178178

179179
dependencies {
180+
compile project(':react-native-nfc-manager')
181+
compile project(':react-native-key-event')
180182
compile project(':react-native-localization')
181183
compile project(':react-native-background-job')
182184
compile project(':react-native-bluetooth-status')

android/app/src/main/AndroidManifest.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
<uses-permission android:name="android.permission.BLUETOOTH"/>
1010
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
1111
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12-
12+
<uses-permission android:name="android.permission.NFC" />
13+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
1314
<application
1415
android:name=".MainApplication"
1516
android:label="@string/app_name"
@@ -21,15 +22,29 @@
2122
android:label="@string/app_name"
2223
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
2324
android:windowSoftInputMode="adjustResize"
24-
android:screenOrientation="landscape">
25+
android:screenOrientation="landscape"
26+
android:launchMode="singleTask">
27+
2528
<intent-filter>
2629
<action android:name="android.intent.action.MAIN" />
2730
<category android:name="android.intent.category.LAUNCHER" />
2831
</intent-filter>
32+
33+
<intent-filter>
34+
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
35+
<category android:name="android.intent.category.DEFAULT"/>
36+
</intent-filter>
37+
38+
<intent-filter>
39+
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
40+
</intent-filter>
41+
42+
<meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="@xml/nfc_tech_filter" />
2943
</activity>
3044
<meta-data
3145
android:name="com.google.android.geo.API_KEY"
3246
android:value="AIzaSyC1F5BFOEvWeBv67pvGWzjMCFItmi851yg"/>
47+
3348
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
3449
</application>
3550

android/app/src/main/java/com/tailpos/MainActivity.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.tailpos;
22

33
import android.os.Bundle;
4-
4+
import android.view.KeyEvent; // <--- import
5+
import net.kangyufei.KeyEventModule; // <--- import
56
import org.devio.rn.splashscreen.SplashScreen;
67
import com.facebook.react.ReactActivity;
78

@@ -22,4 +23,20 @@ protected void onCreate(Bundle savedInstanceState) {
2223
super.onCreate(savedInstanceState);
2324
}
2425

26+
@Override // <--- Add this method if you want to react to keyDown
27+
public boolean onKeyDown(int keyCode, KeyEvent event) {
28+
29+
KeyEventModule.getInstance().onKeyDownEvent(keyCode, event);
30+
super.onKeyDown(keyCode, event);
31+
return true;
32+
}
33+
34+
@Override // <--- Add this method if you want to react to keyUp
35+
public boolean onKeyUp(int keyCode, KeyEvent event) {
36+
KeyEventModule.getInstance().onKeyUpEvent(keyCode, event);
37+
38+
super.onKeyUp(keyCode, event);
39+
return true;
40+
}
41+
2542
}

android/app/src/main/java/com/tailpos/MainApplication.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import com.solinor.bluetoothstatus.RNBluetoothManagerPackage;
66
import com.facebook.react.ReactApplication;
7+
import community.revteltech.nfc.NfcManagerPackage;
8+
import net.kangyufei.KeyEventPackage;
79
import com.babisoft.ReactNativeLocalization.ReactNativeLocalizationPackage;
810
import com.pilloxa.backgroundjob.BackgroundJobPackage;
911
import com.learnium.RNDeviceInfo.RNDeviceInfo;
@@ -37,6 +39,8 @@ protected List<ReactPackage> getPackages() {
3739
return Arrays.<ReactPackage>asList(
3840
new RNBluetoothManagerPackage(),
3941
new MainReactPackage(),
42+
new NfcManagerPackage(),
43+
new KeyEventPackage(),
4044
new ReactNativeLocalizationPackage(),
4145
new BackgroundJobPackage(),
4246
new RNDeviceInfo(),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
2+
<tech-list>
3+
<tech>android.nfc.tech.IsoDep</tech>
4+
</tech-list>
5+
<tech-list>
6+
<tech>android.nfc.tech.NfcA</tech>
7+
</tech-list>
8+
<tech-list>
9+
<tech>android.nfc.tech.NfcB</tech>
10+
</tech-list>
11+
<tech-list>
12+
<tech>android.nfc.tech.NfcF</tech>
13+
</tech-list>
14+
<tech-list>
15+
<tech>android.nfc.tech.NfcV</tech>
16+
</tech-list>
17+
<tech-list>
18+
<tech>android.nfc.tech.Ndef</tech>
19+
</tech-list>
20+
<tech-list>
21+
<tech>android.nfc.tech.NdefFormatable</tech>
22+
</tech-list>
23+
<tech-list>
24+
<tech>android.nfc.tech.MifareClassic</tech>
25+
</tech-list>
26+
<tech-list>
27+
<tech>android.nfc.tech.MifareUltralight</tech>
28+
</tech-list>
29+
</resources>

android/settings.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
rootProject.name = 'TailPOS'
2+
include ':react-native-nfc-manager'
3+
project(':react-native-nfc-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-nfc-manager/android')
4+
include ':react-native-key-event'
5+
project(':react-native-key-event').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-key-event/android')
26
include ':react-native-localization'
37
project(':react-native-localization').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localization/android')
48
include ':react-native-background-job'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
2+
<tech-list>
3+
<tech>android.nfc.tech.IsoDep</tech>
4+
</tech-list>
5+
<tech-list>
6+
<tech>android.nfc.tech.NfcA</tech>
7+
</tech-list>
8+
<tech-list>
9+
<tech>android.nfc.tech.NfcB</tech>
10+
</tech-list>
11+
<tech-list>
12+
<tech>android.nfc.tech.NfcF</tech>
13+
</tech-list>
14+
<tech-list>
15+
<tech>android.nfc.tech.NfcV</tech>
16+
</tech-list>
17+
<tech-list>
18+
<tech>android.nfc.tech.Ndef</tech>
19+
</tech-list>
20+
<tech-list>
21+
<tech>android.nfc.tech.NdefFormatable</tech>
22+
</tech-list>
23+
<tech-list>
24+
<tech>android.nfc.tech.MifareClassic</tech>
25+
</tech-list>
26+
<tech-list>
27+
<tech>android.nfc.tech.MifareUltralight</tech>
28+
</tech-list>
29+
</resources>

changes/nfc-manager-build.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
def safeExtGet(prop, fallback) {
2+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
3+
}
4+
5+
buildscript {
6+
repositories {
7+
jcenter()
8+
}
9+
10+
dependencies {
11+
classpath 'com.android.tools.build:gradle:1.5.0'
12+
}
13+
}
14+
apply plugin: 'com.android.library'
15+
16+
android {
17+
compileSdkVersion safeExtGet('compileSdkVersion', 27)
18+
buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3')
19+
20+
defaultConfig {
21+
minSdkVersion safeExtGet('minSdkVersion', 16)
22+
//noinspection OldTargetApi
23+
targetSdkVersion safeExtGet('targetSdkVersion', 27)
24+
}
25+
lintOptions {
26+
abortOnError false
27+
}
28+
}
29+
30+
repositories {
31+
mavenCentral()
32+
maven {
33+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
34+
url "$rootDir/../node_modules/react-native/android"
35+
}
36+
}
37+
38+
39+
dependencies {
40+
compile 'com.facebook.react:react-native:+'
41+
42+
}

ios/TailPOS.xcodeproj/project.pbxproj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
43FFBF74D0094DD8866DD727 /* libRNBluetoothManager.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 114C3F4566DC4AAFBF009FFF /* libRNBluetoothManager.a */; };
6767
51F0F7BBE5C142D4B8521808 /* libRNBackgroundJob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 030627CBACC14D929C0207BD /* libRNBackgroundJob.a */; };
6868
520D4F11F21A4CEEB05724EB /* libReactNativeLocalization.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A5548395195745ED8AFFDEBB /* libReactNativeLocalization.a */; };
69+
6BEB5BDCB20043EA80E560C6 /* libNfcManager.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D806BF8811F4260B10899D2 /* libNfcManager.a */; };
6970
/* End PBXBuildFile section */
7071

7172
/* Begin PBXContainerItemProxy section */
@@ -413,6 +414,8 @@
413414
030627CBACC14D929C0207BD /* libRNBackgroundJob.a */ = {isa = PBXFileReference; name = "libRNBackgroundJob.a"; path = "libRNBackgroundJob.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
414415
D5BF8BC30E324943AB843FEB /* ReactNativeLocalization.xcodeproj */ = {isa = PBXFileReference; name = "ReactNativeLocalization.xcodeproj"; path = "../node_modules/react-native-localization/ReactNativeLocalization.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
415416
A5548395195745ED8AFFDEBB /* libReactNativeLocalization.a */ = {isa = PBXFileReference; name = "libReactNativeLocalization.a"; path = "libReactNativeLocalization.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
417+
2C27E3CBAD07414F89BF7DAE /* NfcManager.xcodeproj */ = {isa = PBXFileReference; name = "NfcManager.xcodeproj"; path = "../node_modules/react-native-nfc-manager/ios/NfcManager.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
418+
2D806BF8811F4260B10899D2 /* libNfcManager.a */ = {isa = PBXFileReference; name = "libNfcManager.a"; path = "libNfcManager.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
416419
/* End PBXFileReference section */
417420

418421
/* Begin PBXFrameworksBuildPhase section */
@@ -455,6 +458,7 @@
455458
43FFBF74D0094DD8866DD727 /* libRNBluetoothManager.a in Frameworks */,
456459
51F0F7BBE5C142D4B8521808 /* libRNBackgroundJob.a in Frameworks */,
457460
520D4F11F21A4CEEB05724EB /* libReactNativeLocalization.a in Frameworks */,
461+
6BEB5BDCB20043EA80E560C6 /* libNfcManager.a in Frameworks */,
458462
);
459463
runOnlyForDeploymentPostprocessing = 0;
460464
};
@@ -657,6 +661,7 @@
657661
0FC20227933C497CB2330EEF /* RNBluetoothManager.xcodeproj */,
658662
2140AF7DBD7F486D8BC7E6D1 /* RNBackgroundJob.xcodeproj */,
659663
D5BF8BC30E324943AB843FEB /* ReactNativeLocalization.xcodeproj */,
664+
2C27E3CBAD07414F89BF7DAE /* NfcManager.xcodeproj */,
660665
);
661666
name = Libraries;
662667
sourceTree = "<group>";
@@ -1320,6 +1325,7 @@
13201325
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TailPOS.app/TailPOS";
13211326
LIBRARY_SEARCH_PATHS = (
13221327
"$(inherited)",
1328+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13231329
);
13241330
HEADER_SEARCH_PATHS = (
13251331
"$(inherited)",
@@ -1336,6 +1342,7 @@
13361342
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
13371343
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
13381344
"$(SRCROOT)/../node_modules/react-native-localization",
1345+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
13391346
);
13401347
};
13411348
name = Debug;
@@ -1356,6 +1363,7 @@
13561363
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TailPOS.app/TailPOS";
13571364
LIBRARY_SEARCH_PATHS = (
13581365
"$(inherited)",
1366+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
13591367
);
13601368
HEADER_SEARCH_PATHS = (
13611369
"$(inherited)",
@@ -1372,6 +1380,7 @@
13721380
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
13731381
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
13741382
"$(SRCROOT)/../node_modules/react-native-localization",
1383+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
13751384
);
13761385
};
13771386
name = Release;
@@ -1406,6 +1415,7 @@
14061415
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
14071416
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
14081417
"$(SRCROOT)/../node_modules/react-native-localization",
1418+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
14091419
);
14101420
};
14111421
name = Debug;
@@ -1439,6 +1449,7 @@
14391449
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
14401450
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
14411451
"$(SRCROOT)/../node_modules/react-native-localization",
1452+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
14421453
);
14431454
};
14441455
name = Release;
@@ -1468,6 +1479,7 @@
14681479
TVOS_DEPLOYMENT_TARGET = 9.2;
14691480
LIBRARY_SEARCH_PATHS = (
14701481
"$(inherited)",
1482+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
14711483
);
14721484
HEADER_SEARCH_PATHS = (
14731485
"$(inherited)",
@@ -1484,6 +1496,7 @@
14841496
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
14851497
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
14861498
"$(SRCROOT)/../node_modules/react-native-localization",
1499+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
14871500
);
14881501
};
14891502
name = Debug;
@@ -1513,6 +1526,7 @@
15131526
TVOS_DEPLOYMENT_TARGET = 9.2;
15141527
LIBRARY_SEARCH_PATHS = (
15151528
"$(inherited)",
1529+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15161530
);
15171531
HEADER_SEARCH_PATHS = (
15181532
"$(inherited)",
@@ -1529,6 +1543,7 @@
15291543
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
15301544
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
15311545
"$(SRCROOT)/../node_modules/react-native-localization",
1546+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
15321547
);
15331548
};
15341549
name = Release;
@@ -1557,6 +1572,7 @@
15571572
TVOS_DEPLOYMENT_TARGET = 10.1;
15581573
LIBRARY_SEARCH_PATHS = (
15591574
"$(inherited)",
1575+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
15601576
);
15611577
HEADER_SEARCH_PATHS = (
15621578
"$(inherited)",
@@ -1573,6 +1589,7 @@
15731589
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
15741590
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
15751591
"$(SRCROOT)/../node_modules/react-native-localization",
1592+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
15761593
);
15771594
};
15781595
name = Debug;
@@ -1601,6 +1618,7 @@
16011618
TVOS_DEPLOYMENT_TARGET = 10.1;
16021619
LIBRARY_SEARCH_PATHS = (
16031620
"$(inherited)",
1621+
"\"$(SRCROOT)/$(TARGET_NAME)\"",
16041622
);
16051623
HEADER_SEARCH_PATHS = (
16061624
"$(inherited)",
@@ -1617,6 +1635,7 @@
16171635
"$(SRCROOT)/../node_modules/react-native-bluetooth-status/ios",
16181636
"$(SRCROOT)/../node_modules/react-native-background-job/ios",
16191637
"$(SRCROOT)/../node_modules/react-native-localization",
1638+
"$(SRCROOT)/../node_modules/react-native-nfc-manager/ios",
16201639
);
16211640
};
16221641
name = Release;

0 commit comments

Comments
 (0)