Browse Source

【代码优化】解决钱包、名片未选择二维码点击绑定崩溃问题

master
公司电脑 1 year ago
parent
commit
d0f133d21b
  1. BIN
      FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate
  2. 45
      FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  3. 2
      FireBoltt/FB_Modules/FB_Bluetooth/JLBluetooth/JL_RunSDK.h
  4. 37
      FireBoltt/FB_Modules/FB_Bluetooth/JLBluetooth/JL_RunSDK.m
  5. 11
      FireBoltt/FB_Modules/FB_Device/Controller/UpdataQRCodeImgViewControllers.swift

BIN
FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate generated

Binary file not shown.

45
FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@ -124,6 +124,51 @@ @@ -124,6 +124,51 @@
endingLineNumber = "13"
offsetFromSymbolStart = "144">
</Location>
<Location
uuid = "2606C474-3C07-44B7-9566-F88837835AE5 - 505b34cd7c13c27a"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "FireBoltt.HealthStepCell.fb_titleLabel.getter : __C.UILabel"
moduleName = "FireBoltt"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/ecell/FireBoltt_ios/FireBoltt/FB_Modules/FB_Health/View/HealthStepCell.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "13"
endingLineNumber = "13"
offsetFromSymbolStart = "152">
</Location>
<Location
uuid = "2606C474-3C07-44B7-9566-F88837835AE5 - 423a503f08182e4e"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "FireBoltt.HealthStepCell.fb_titleLabel.setter : __C.UILabel"
moduleName = "FireBoltt"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/ecell/FireBoltt_ios/FireBoltt/FB_Modules/FB_Health/View/HealthStepCell.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "13"
endingLineNumber = "13"
offsetFromSymbolStart = "0">
</Location>
<Location
uuid = "2606C474-3C07-44B7-9566-F88837835AE5 - 2da237d6f492a114"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "FireBoltt.HealthStepCell.fb_titleLabel.modify : __C.UILabel with unmangled suffix &quot;.resume.0&quot;"
moduleName = "FireBoltt"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/ecell/FireBoltt_ios/%3Ccompiler-generated%3E"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "0"
endingLineNumber = "0"
offsetFromSymbolStart = "20">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>

2
FireBoltt/FB_Modules/FB_Bluetooth/JLBluetooth/JL_RunSDK.h

@ -63,6 +63,8 @@ typedef void(^GET_DEVICE_CALLBACK)(BOOL needForcedUpgrade); @@ -63,6 +63,8 @@ typedef void(^GET_DEVICE_CALLBACK)(BOOL needForcedUpgrade);
-(void)loadRootFiles;
- (BOOL) checkIfImage:(UIImage *)someImage;
@end
NS_ASSUME_NONNULL_END

37
FireBoltt/FB_Modules/FB_Bluetooth/JLBluetooth/JL_RunSDK.m

@ -451,4 +451,41 @@ static int otaTimeout= 0; @@ -451,4 +451,41 @@ static int otaTimeout= 0;
}
- (BOOL) checkIfImage:(UIImage *)someImage {
CGImageRef image = someImage.CGImage;
size_t width = CGImageGetWidth(image);
size_t height = CGImageGetHeight(image);
GLubyte * imageData = malloc(width * height * 4);
int bytesPerPixel = 4;
int bytesPerRow = bytesPerPixel * width;
int bitsPerComponent = 8;
CGContextRef imageContext =
CGBitmapContextCreate(
imageData, width, height, bitsPerComponent, bytesPerRow, CGImageGetColorSpace(image),
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big
);
CGContextSetBlendMode(imageContext, kCGBlendModeCopy);
CGContextDrawImage(imageContext, CGRectMake(0, 0, width, height), image);
CGContextRelease(imageContext);
int byteIndex = 0;
BOOL imageExist = NO;
for ( ; byteIndex < width*height*4; byteIndex += 4) {
CGFloat red = ((GLubyte *)imageData)[byteIndex]/255.0f;
CGFloat green = ((GLubyte *)imageData)[byteIndex + 1]/255.0f;
CGFloat blue = ((GLubyte *)imageData)[byteIndex + 2]/255.0f;
CGFloat alpha = ((GLubyte *)imageData)[byteIndex + 3]/255.0f;
if( red != 1 || green != 1 || blue != 1 || alpha != 1 ){
imageExist = YES;
break;
}
}
free(imageData);
return imageExist;
}
@end

11
FireBoltt/FB_Modules/FB_Device/Controller/UpdataQRCodeImgViewControllers.swift

@ -104,10 +104,13 @@ class UpdataQRCodeImgViewControllers: ViewController { @@ -104,10 +104,13 @@ class UpdataQRCodeImgViewControllers: ViewController {
@objc func bindingTouch(){
print("绑定")
let str: String = String(stringLiteral:self.recognitionQRCode(qrCodeImage: self.seleceImg)!)
if (str.lengthOfBytes(using: String.Encoding.utf16) > 0) {
SVProgressHUD.show()
BluetoothService.shared.qrCodePushWithBleCmdType(payImgStr: self.seleceImg, type: self.paytype)
if JL_RunSDK.sharedInstance().checkIfImage(self.seleceImg)
{
let str: String = String(stringLiteral:self.recognitionQRCode(qrCodeImage: self.seleceImg)!)
if (str.lengthOfBytes(using: String.Encoding.utf16) > 0) {
SVProgressHUD.show()
BluetoothService.shared.qrCodePushWithBleCmdType(payImgStr: self.seleceImg, type: self.paytype)
}
}
}

Loading…
Cancel
Save