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

Suggested: Apply Singleton pattern to EuRxManager #255

Closed
designe opened this issue Sep 13, 2022 Discussed in #254 · 0 comments · Fixed by #256
Closed

Suggested: Apply Singleton pattern to EuRxManager #255

designe opened this issue Sep 13, 2022 Discussed in #254 · 0 comments · Fixed by #256
Assignees
Labels
documentation documentation enhancement enhancement Feature Proposal Anything about happy development! from discussions this issue is made from discussions osca-22 Contribution From Open Source Academy 2022

Comments

@designe
Copy link
Member

designe commented Sep 13, 2022

Discussed in https://github.com/orgs/euphony-io/discussions/254

Originally posted by phj0407 September 13, 2022

AS-IS


While I apply Euphony library for sample app project, I find using one more object can cause malfunciton. I think applying singleton pattern to EuRxManager can prevent potential issue.

TO-DO


Now, EuRxManager have 3 constructor.

public EuRxManager() {
		mOption = EuOption.builder()
				.modeWith(EuOption.ModeType.DEFAULT)
				.encodingWith(EuOption.CodingType.BASE16)
				.modulationWith(EuOption.ModulationType.FSK)
				.build();
	}

	public EuRxManager(RxEngineType engineType) {
		rxEngineType = engineType;
		if(rxEngineType == RxEngineType.EUPHONY_NATIVE_ENGINE)
			nativeCore = EuNativeConnector.getInstance();
		else
			nativeCore = null;
	}

	public EuRxManager(EuOption.ModeType mode) {
		mOption = EuOption.builder()
				.modeWith(mode)
				.build();
	}

I think public EuRxManager(),public EuRxManager(EuOption.ModeType mode) can be combined. And initializing nativeCore can be solved seperately by add new method.



@designe designe added enhancement Feature Proposal Anything about happy development! labels Sep 13, 2022
phj0407 added a commit to phj0407/euphony that referenced this issue Sep 15, 2022
phj0407 added a commit to phj0407/euphony that referenced this issue Sep 15, 2022
@yeonns yeonns linked a pull request Sep 17, 2022 that will close this issue
@designe designe added documentation documentation enhancement from discussions this issue is made from discussions labels Sep 19, 2022
designe pushed a commit that referenced this issue Sep 19, 2022
* feat: apply EuRxManager Singleton (#255)
* test: Update EuRxManagerTest depending on applying EuRxManager singleton
* docs: update 'README.md', 'GETTING_STARTED.md', 'GETTING_STARTED_KR.mc' depending on applying EuRxManager singleton
@designe designe added the osca-22 Contribution From Open Source Academy 2022 label Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation documentation enhancement enhancement Feature Proposal Anything about happy development! from discussions this issue is made from discussions osca-22 Contribution From Open Source Academy 2022
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants