Skip to content

Commit 878c8fe

Browse files
committed
fix: 适配A15的机型,更新token编译
解决方案:NA 影响范围:all 关联工单:NA 更新版本:NA
1 parent d46ddd4 commit 878c8fe

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

android/src/main/java/com/printerimin/PrinterIminModule.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,20 @@ public PrinterIminModule(ReactApplicationContext reactContext) {
8686
super(reactContext);
8787
this.reactContext = reactContext;
8888
// List<String> modelList = Arrays.asList(modelArry);
89-
if (Build.MODEL.contains("W27_Pro") || Build.MODEL.contains("I23D") || Build.MODEL.contains("I23M") || Build.MODEL.contains("I24D") || Build.MODEL.contains("I24T") || Build.MODEL.contains("I24M")) {
90-
//初始化 2.0 的 SDK。
91-
PrinterHelper.getInstance().initPrinterService(reactContext);
92-
sdkVersion = "2.0.0";
93-
}
89+
// if (Build.MODEL.contains("W27_Pro") || Build.MODEL.contains("I23D") || Build.MODEL.contains("I23M") || Build.MODEL.contains("I24D") || Build.MODEL.contains("I24T") || Build.MODEL.contains("I24M")) {
90+
// //初始化 2.0 的 SDK。
91+
// PrinterHelper.getInstance().initPrinterService(reactContext);
92+
// sdkVersion = "2.0.0";
93+
// }
9494
// if (modelList.contains(Build.MODEL)) {
9595
// //初始化 2.0 的 SDK。
9696
// PrinterHelper.getInstance().initPrinterService(reactContext);
9797
// sdkVersion = "2.0.0";
9898
// }
99+
if (isAndroid15()) {
100+
PrinterHelper.getInstance().initPrinterService(reactContext);
101+
sdkVersion = "2.0.0";
102+
}
99103
else {
100104
//初始化 1.0 SDK
101105

@@ -2049,4 +2053,13 @@ public Map<String, Object> getConstants() {
20492053
return constants;
20502054
}
20512055

2056+
public static boolean isAndroid15() {
2057+
// 假设Android 15的API级别是34(实际数字将在Android 15发布时确定)
2058+
final int ANDROID_15_API_LEVEL = 32;
2059+
// 获取当前设备的API级别
2060+
int currentApiLevel = Build.VERSION.SDK_INT;
2061+
// 判断是否是Android 15
2062+
return currentApiLevel >= ANDROID_15_API_LEVEL;
2063+
}
2064+
20522065
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-printer-imin",
3-
"version": "0.10.4",
3+
"version": "0.10.5",
44
"description": "Native Module For iMin Printer SDK Plugin",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
@@ -161,5 +161,8 @@
161161
}
162162
]
163163
]
164+
},
165+
"dependencies": {
166+
"react-native-device-info": "^14.0.4"
164167
}
165168
}

0 commit comments

Comments
 (0)