Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropping Objective-C Support (v5.0.0) #230

Merged
merged 69 commits into from
Dec 11, 2023

Conversation

vault087
Copy link

@vault087 vault087 commented Oct 5, 2023

  • Removed Objective-C *.m and *.h files
  • Removed @objc marked code
  • Removed deprecated OMS naming prefixes
  • Removed deprecated Swift compatibility typedefs (typealias ControlState = UIControl.State)
  • Removed Objective-C from Example App and rewrite BaseViewController with Swift code
  • Added separate project for ExampleApp to test SDK with Swift Package Manager
  • Renamed helper package OmiseTestSDK to OmiseUnitTestKit
  • Moved Swift UI helpers files from OmiseSDKUITests directory to separate package OmiseSwiftUIKit
  • Added truemoney_jumpapp to capability.json mockup for unit tests
  • Cleaned up project tree

@vault087 vault087 requested a review from a team as a code owner October 5, 2023 18:27
@vault087 vault087 changed the base branch from develop to feature/MIT-1519-Code-Coverage October 10, 2023 15:33
Comment on lines +53 to +55
} else {
return Locale.current.regionCode
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
return Locale.current.regionCode
}
}
return Locale.current.regionCode

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a copy-pasted Objective-C file rewritten with Swift without much refactoring tho I'd still keep it this way as it's make it more clear to read the code and identify the intention in this specific case.

Comment on lines +29 to +31
} else {
return nil
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
return nil
}
}
return nil

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, if there clear if/else scenario then most of the time this syntax is much faster to read and understand. And then if you would like to add more code there you have less chance place a code in a wrong place. Again in cases like that I prefer to have a clear vision of developer intension. Not always, but here it looks ok to me.

Comment on lines +368 to +372
if let sourceType = SourceTypeValue(value) {
self = .source(sourceType)
} else {
self = .unknown(sourceType: value)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about using ternary operator?

Suggested change
if let sourceType = SourceTypeValue(value) {
self = .source(sourceType)
} else {
self = .unknown(sourceType: value)
}
let sourceType = SourceTypeValue(value)
self = sourceType ? .source(sourceType) : unknown(sourceType: value)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't be done here, swift's if let nonOptionalVarA = optionalVarA { } turns optional to non-optional inside the block and goes to else if it's nil. You example won't be compiled as .source(sourceType) can't be nil here (case unknown(sourceType: String))

self.paymentAmount = Tool.japanPaymentAmount
self.paymentCurrencyCode = Tool.japanPaymentCurrency
self.allowedPaymentMethods = Tool.japanAllowedPaymentMethods
case "SG":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about EN locale? Is it supposed to be same as SG and hence just ommitted?

Copy link
Author

@vault087 vault087 Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a default block for everything else including EN just below:

default:
    self.paymentAmount = Tool.thailandPaymentAmount
    self.paymentCurrencyCode = Tool.thailandPaymentCurrency
    self.allowedPaymentMethods = Tool.thailandAllowedPaymentMethods

@vault087 vault087 merged commit efcd72c into feature/MIT-1519-Code-Coverage Dec 11, 2023
@vault087 vault087 deleted the feature/MIT-1520 branch December 11, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants