refactor(mobile): more look and feel work
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m17s
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m17s
This commit is contained in:
@@ -138,18 +138,12 @@ class ZebraScannerModule(
|
||||
fun ensureProfile() {
|
||||
val profileName = "LST_MOBILE"
|
||||
|
||||
// Create profile (safe to call even if it exists)
|
||||
sendCommand(
|
||||
"com.symbol.datawedge.api.CREATE_PROFILE",
|
||||
profileName
|
||||
)
|
||||
|
||||
Thread.sleep(500)
|
||||
// Configure profile
|
||||
val profileConfig = Bundle().apply {
|
||||
putString("PROFILE_NAME", profileName)
|
||||
putString("PROFILE_ENABLED", "true")
|
||||
putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST")
|
||||
|
||||
val barcodeConfig = Bundle().apply {
|
||||
putString("PLUGIN_NAME", "BARCODE")
|
||||
@@ -157,8 +151,19 @@ class ZebraScannerModule(
|
||||
|
||||
val props = Bundle().apply {
|
||||
putString("scanner_input_enabled", "true")
|
||||
|
||||
// Auto-select internal scanner
|
||||
putString("scanner_selection", "auto")
|
||||
putString("trigger_mode", "2") // 2 = HARD trigger only (recommended) wakes scanner up
|
||||
putString("scanner_selection_by_identifier", "AUTO")
|
||||
|
||||
// Hardware trigger behavior
|
||||
putString("hardware_trigger_enabled", "true")
|
||||
putString("trigger_mode", "2") // 2 = HARD trigger
|
||||
|
||||
// Disable Zebra's loud initial decode feedback
|
||||
putString("decode_audio_feedback_uri", "")
|
||||
putString("decode_haptic_feedback", "false")
|
||||
putString("decode_led_feedback", "false")
|
||||
}
|
||||
|
||||
putBundle("PARAM_LIST", props)
|
||||
@@ -172,7 +177,7 @@ class ZebraScannerModule(
|
||||
putString("intent_output_enabled", "true")
|
||||
putString("intent_action", scanAction)
|
||||
putString("intent_delivery", "2") // broadcast
|
||||
putString("intent_use_content_provider", "false") // optional but helps
|
||||
putString("intent_use_content_provider", "false")
|
||||
}
|
||||
|
||||
putBundle("PARAM_LIST", props)
|
||||
@@ -189,16 +194,19 @@ class ZebraScannerModule(
|
||||
putBundle("PARAM_LIST", props)
|
||||
}
|
||||
|
||||
val profileConfig = Bundle().apply {
|
||||
putString("PROFILE_NAME", profileName)
|
||||
putString("PROFILE_ENABLED", "true")
|
||||
putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST")
|
||||
|
||||
putParcelableArrayList(
|
||||
"PLUGIN_CONFIG",
|
||||
arrayListOf(barcodeConfig, intentConfig, keystrokeConfig)
|
||||
)
|
||||
putParcelableArrayList(
|
||||
"PLUGIN_CONFIG",
|
||||
arrayListOf(barcodeConfig, intentConfig, keystrokeConfig)
|
||||
)
|
||||
}
|
||||
|
||||
sendCommand("com.symbol.datawedge.api.SET_CONFIG", profileConfig)
|
||||
|
||||
// Associate with your app
|
||||
val appConfig = Bundle().apply {
|
||||
putString("PACKAGE_NAME", reactContext.packageName)
|
||||
putStringArray("ACTIVITY_LIST", arrayOf("*"))
|
||||
@@ -211,6 +219,12 @@ class ZebraScannerModule(
|
||||
}
|
||||
|
||||
sendCommand("com.symbol.datawedge.api.SET_CONFIG", associateConfig)
|
||||
|
||||
// Runtime nudge: make sure scanner input is enabled for the active profile
|
||||
sendCommand(
|
||||
"com.symbol.datawedge.api.SCANNER_INPUT_PLUGIN",
|
||||
"ENABLE_PLUGIN"
|
||||
)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user