<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Emre UYSAL on Medium]]></title>
        <description><![CDATA[Stories by Emre UYSAL on Medium]]></description>
        <link>https://medium.com/@emreuysall?source=rss-244f03b0150------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Zah_CKlxWVvCynu734OsMg.jpeg</url>
            <title>Stories by Emre UYSAL on Medium</title>
            <link>https://medium.com/@emreuysall?source=rss-244f03b0150------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:36:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@emreuysall/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Manage Multiple Content, Actions and States ModalBottomSheetLayout Jetpack Compose]]></title>
            <link>https://medium.com/@emreuysall/manage-multiple-content-actions-and-states-modalbottomsheetlayout-jetpack-compose-ec4140b2a043?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec4140b2a043</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[modalbottomsheet]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[coroutine]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Mon, 20 Feb 2023 22:16:52 GMT</pubDate>
            <atom:updated>2023-02-20T22:16:52.432Z</atom:updated>
            <content:encoded><![CDATA[<p>Multiple Content Management | BackHandler | Disable User Interaction</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*-tv1hxx7QUam31lq_YXy8g.png" /><figcaption>ModalBottomSheetLayout Jetpack Compose</figcaption></figure><h3>Introduction</h3><p><a href="https://developer.android.com/jetpack/compose">Jetpack Compose</a> has many built-in composable and provides native ui development in a fast and robust way on Android OS. There are experimental features confuse developer’s mind, when trying to cover edge cases and providing additional features. Managing multiple content in ModalBottomSheetLayout is one of them. In this article we will create workarounds for common problems in ModalBottomSheetLayout.</p><h3>Common Issues</h3><p>We all know ModalBottomSheetLayout is an experimental composable for now. If you try to use it, you might figure out the difficulties and you might give up. Don’t Worry ! You will handle all of them after reading this article.</p><ul><li>ModalBottomSheetLayout has a content parameter that requires an initial composable and throws exception when you don’t provide it.</li><li>Showing multiple bottom sheets in a ModalBottomSheetLayout content, requires handling custom states, updating contents and actions.</li><li>ModalBottomSheetLayout should be added to root of your screen composable. Otherwise, you will see meaningless things in your screen.</li><li>When you update states or call some functions using coroutines, your states may become corrupted if you don’t restrict user interaction.</li><li>Handling back-press functionality is required because ModalBottomSheetLayout does not hide itself when user clicks back.</li></ul><h3>Solutions-Step by Step</h3><p>Under this title, we will solve the issues step by step that we defined above and we assume that you have a compose project and required dependencies added. Before writing code, please have a look at the image below, which covers some state change cases according to user actions, try to imagine lying structure under solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kx4kLfiEB2IG57r-N1uBmA.png" /></figure><h4>1- Identify User Action</h4><p>BottomSheetAction is an enum class for identifying user interactions and deciding visibility state on screen. Using these actions ModalBottomSheetLayout will show or hide itself automatically according to state changes.</p><pre>// Identify user actions<br>enum class BottomSheetAction {<br>    INITIAL,  // initial case before user action<br>    HIDE,     // user wants to hide bottom sheet<br>    SHOW,     // user wants to show bottom sheet<br>    TIMED     // user wants to see and hide bottom sheet for some time, and disables screen interaction<br>}</pre><h4>2- Categorize Types of Bottom Sheet</h4><p>BottomSheetType is an enum class for controlling content in ModalBottomSheetLayout. Composable contents for bottom sheets will be controlled and categorized by using these types.</p><pre>// Categorize bottom sheets<br>enum class BottomSheetType {<br>    LIST,       // ListBottomSheetContent composable<br>    ERROR,      // ErrorBottomSheetContent composable<br>    REDIRECT,   // RedirectBottomSheetContent composable<br>    INITIAL     // InitialBottomSheetContent composable<br>}</pre><h4>3- Content Data of Each Type</h4><p>BottomSheetContent is a sealed class that contains content data for different types of bottom sheets that we defined above. Each of these content types corresponds to a BottomSheetType. In each state, content data will be provided to bottom sheet by using these data classes.</p><pre>// Content classes and object for each of BottomSheetType<br>sealed class BottomSheetContent {<br><br>    // ERROR type content data<br>    data class ErrorSheetContent(val message: String) : BottomSheetContent()<br><br>    // REDIRECT type content data<br>    data class RedirectSheetContent(val message: String, val redirect: String) : BottomSheetContent()<br><br>    // LIST type content data<br>    data class ListSheetContent(val title: String, val data: List&lt;String&gt;) : BottomSheetContent()<br><br>    // INITAL type content data<br>    object InitialSheetContent : BottomSheetContent()<br>}</pre><h4>4- Hold Current States of Content, Action and Type</h4><p>ModalBottomSheetState is a data class that holds current states for BottomSheetContent, BottomSheetType and BottomSheetAction. All of them initialized to their own INITIAL state.</p><pre>// Contains current states of user action, bottom sheet type and its content<br>// All of the values initialized to INITIAL state<br>data class ModalBottomSheetState(<br>    val bottomSheetContent: BottomSheetContent = BottomSheetContent.InitialSheetContent,<br>    val bottomSheetType: BottomSheetType = BottomSheetType.INITIAL,<br>    val bottomSheetActionType: BottomSheetAction = BottomSheetAction.INITIAL<br>)</pre><h4>5- Update State in ViewModel</h4><p>MainViewModel class is a ViewModel class that contains ModalBottomSheetState as StateFlow and updates it using updateBottomSheetState function. We will update and collect states using this class.</p><pre>// ViewModel class for managing and containing ModalBottomSheetState<br>class MainViewModel : ViewModel() {<br><br>    // Cover ModalBottomSheetState using StateFlow<br>    // Using LiveData in here, is another option<br>    private val _bottomSheetState: MutableStateFlow&lt;ModalBottomSheetState&gt; =<br>        MutableStateFlow(ModalBottomSheetState())<br>    val bottomSheetState: StateFlow&lt;ModalBottomSheetState&gt; = _bottomSheetState.asStateFlow()<br><br>    // updates ModalBottomSheetState using a coroutine<br>    fun updateBottomSheetState(<br>        bottomSheetContent: BottomSheetContent,<br>        bottomSheetType: BottomSheetType,<br>        bottomSheetActionType: BottomSheetAction<br>    ) {<br>        viewModelScope.launch {<br>            _bottomSheetState.update {<br>                it.copy(<br>                    bottomSheetActionType = bottomSheetActionType,<br>                    bottomSheetContent = bottomSheetContent,<br>                    bottomSheetType = bottomSheetType<br>                )<br>            }<br>        }<br>    }<br>}</pre><h4>6- Dummy Data</h4><p>Let’s create dummy data for using in BottomSheetContent classes. Data may obtained from network calls or other resources. Also, other resources may decide the type of bottom sheet.</p><pre>val errorMessage = &quot;An unexpected error !&quot;<br>val successMessage = &quot;Operation Succeed !&quot;<br>val redirectMessage = &quot;Next&quot;<br>val listHeader = &quot;This is a list&quot;<br>val listContent = listOf(<br>    &quot;Compose&quot;,<br>    &quot;Xml&quot;,<br>    &quot;Dialog&quot;,<br>    &quot;Kotlin&quot;,<br>    &quot;inline&quot;,<br>    &quot;in / out&quot;,<br>    &quot;fun&quot;,<br>    &quot;class&quot;,<br>    &quot;enum class&quot;,<br>    &quot;Hello World&quot;<br>)</pre><h4>7- Bottom Sheet Content Composable of Each Type</h4><p>Each bottom sheet content composable corresponds to a BottomSheetType. As we can see, InitialBottomSheetContent composable has a spacer in it because ModalBottomSheetLayout requires an anchored initial content in it, otherwise it throws an exception.</p><pre>// Composable corresponding to LIST BottomSheetType<br>@Composable<br>fun ListBottomSheetContent(title: String, data: List&lt;String&gt;, modifier: Modifier = Modifier) {<br>    Column(<br>        modifier = modifier,<br>        verticalArrangement = Arrangement.spacedBy(20.dp)<br>    ) {<br>        Text(<br>            text = title,<br>            style = TextStyle(fontSize = 16.sp, color = Color.Red),<br>            modifier = Modifier.align(Alignment.CenterHorizontally)<br>        )<br>        LazyColumn(<br>            verticalArrangement = Arrangement.spacedBy(10.dp)<br>        ) {<br>            items(data) {<br>                Text(<br>                    text = it,<br>                    modifier = Modifier.fillMaxWidth(),<br>                    style = TextStyle(fontSize = 14.sp, color = Color.Blue)<br>                )<br>                Divider(color = Color.Gray, thickness = 1.dp)<br>            }<br>        }<br>    }<br>}<br><br>// Composable corresponding to REDIRECT BottomSheetType<br>@Composable<br>fun RedirectBottomSheetContent(message: String, redirect: String, modifier: Modifier = Modifier) {<br>    Row(<br>        modifier = modifier,<br>        verticalAlignment = Alignment.CenterVertically,<br>        horizontalArrangement = Arrangement.SpaceBetween<br>    ) {<br>        Text(<br>            text = message,<br>            style = TextStyle(fontSize = 14.sp, color = Color.Black)<br>        )<br>        Text(<br>            text = redirect,<br>            style = TextStyle(fontSize = 14.sp, color = Color.Black),<br>            textDecoration = TextDecoration.Underline<br>        )<br>    }<br>}<br><br>// Composable corresponding to ERROR BottomSheetType<br>@Composable<br>fun ErrorBottomSheetContent(message: String, modifier: Modifier = Modifier) {<br>    Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) {<br>        Text(<br>            text = message,<br>            modifier = Modifier.fillMaxWidth(),<br>            style = TextStyle(fontSize = 14.sp, color = Color.Black)<br>        )<br>    }<br>}<br><br>// Composable corresponding to INITIAL BottomSheetType<br>@Composable<br>fun InitialBottomSheetContent() {<br>    Spacer(<br>        modifier = Modifier<br>            .width(1.dp)<br>            .height(1.dp)<br>    )<br>}</pre><h4>8- ModalBottomSheetLayout With Multiple Contents</h4><ul><li>Collect bottomSheetState to obtain state changes. At this point we can use <a href="https://developer.android.com/jetpack/compose/state#use-other-types-of-state-in-jetpack-compose">collectAsStateWithLifecycle</a> function to make our flow aware of lifecycle.</li></ul><pre>// collect state changes for your data using viewmodel<br>val uiState by viewModel.bottomSheetState.collectAsState()</pre><ul><li>Define a bottomSheetState value using rememberBottomSheetState function to make configuration on ModalBottomSheetLayout. By using this value, wrap the show and hide functions according to requirements. When configuring bottomSheetState, user interaction for REDIRECT type bottom sheet is disabled and maximum expand state restricted to HalfExpanded in confirmStateChange.</li></ul><pre>/* - create a value that remembers bottom sheet state <br>   - set this configuration to ModalBottomSheetLayout<br>   - in confirmStateChange it disables user interaction for<br>     REDIRECT bottom sheet type and disallows to full expanded format<br>*/<br>val bottomSheetState = rememberModalBottomSheetState(<br>    initialValue = ModalBottomSheetValue.Hidden,<br>    confirmStateChange = {<br>        when (uiState.bottomSheetType) {<br>            BottomSheetType.REDIRECT -&gt; false<br>            else -&gt; it != ModalBottomSheetValue.Expanded<br>        }<br>    },<br>    skipHalfExpanded = false<br>)<br><br>// wrap show function in a coroutine<br>val showBottomSheet: () -&gt; Unit = {<br>    coroutineScope.launch {<br>        bottomSheetState.show()<br>    }<br>}<br><br>// wrap hide function in a coroutine<br>val hideBottomSheet: () -&gt; Unit = {<br>    coroutineScope.launch {<br>        bottomSheetState.hide()<br>    }<br>}<br><br>// wrap show and hide functions and create a delay between them<br>val timedNonCancellableShowHide: (millis: Long) -&gt; Unit = {<br>    coroutineScope.launch {<br>        showBottomSheet()<br>        delay(timeMillis = it)<br>        hideBottomSheet()<br>    }<br>}</pre><ul><li>Add a BackHandler composable function for controlling back-press functionality of Android OS. BackHandler is configured to hide bottom sheet except REDIRECT action type because this type blocks user interaction as we defined above and no need to handle it. Also BackHandler will be enabled when bottomSheetState.isVisible parameter is true.</li></ul><pre>//it will work when bottom sheet is visible<br>//if current format is not REDIRECT it will call hideBottomSheet()<br>BackHandler(bottomSheetState.isVisible) {<br>    if (uiState.bottomSheetType != BottomSheetType.REDIRECT) {<br>        hideBottomSheet()<br>    }<br>}</pre><ul><li>According to BottomSheetAction type, ModalBottomSheetLayout needs to call show or hide function for achieving dynamically controlled system. To provide this functionality, add a side effect named <a href="https://developer.android.com/jetpack/compose/side-effects#launchedeffect">LaunchedEffect</a>, which triggers the content block in it when the BottomSheetAction type changes in state.</li></ul><pre>// calls the content in it when action type changes in state<br>LaunchedEffect(uiState.bottomSheetActionType) {<br>    when (uiState.bottomSheetActionType) {<br>        BottomSheetAction.INITIAL -&gt; {}<br>        BottomSheetAction.HIDE -&gt; hideBottomSheet()<br>        BottomSheetAction.SHOW -&gt; showBottomSheet()<br>        BottomSheetAction.TIMED -&gt; timedNonCancellableShowHide(3000)<br>    }<br>}</pre><ul><li>After user dismiss or hides manually bottom sheet, it should return to initial state, because you may accidentally corrupt content, action and type states, then it may cause an edge case. For fixing this issue, add another side effect named <a href="https://developer.android.com/jetpack/compose/side-effects#snapshotFlow">snapshotFlow</a>, which converts a composable value to a flow.</li></ul><pre>// LaunchedEffect registers snapshotFlow for once<br>// snapShotFlow triggers content in it when currentValue of bottomSheetState changes<br>// if current value becomes hidden, it means user completed process and set bottom sheet to initial states<br>LaunchedEffect(Unit) {<br>    snapshotFlow { bottomSheetState.currentValue }.collect {<br>        if (it == ModalBottomSheetValue.Hidden) {<br>            viewModel.updateBottomSheetState(<br>                bottomSheetActionType = BottomSheetAction.INITIAL,<br>                bottomSheetContent = BottomSheetContent.InitialSheetContent,<br>                bottomSheetType = BottomSheetType.INITIAL<br>            )<br>        }<br>    }<br>}</pre><ul><li>State changes for bottom sheet type and content should be handled in sheetContent parameter of ModalBottomSheetLayout. Check the state changes and show related screen to user with its content. Note that; don’t forget to set sheetState parameter, it provides remembered states and functionalities for ModalBottomSheetLayout.</li></ul><pre>ModalBottomSheetLayout(<br>    sheetContent = {<br>        // check current BottomSheetType <br>        // show user related composable with casting BottomSheetContent to related model<br>        when (uiState.bottomSheetType) {<br>            BottomSheetType.LIST -&gt; {<br>                val content = uiState.bottomSheetContent as BottomSheetContent.ListSheetContent<br>                ListBottomSheetContent(<br>                    title = content.title,<br>                    data = content.data,<br>                    modifier = Modifier<br>                        .height(300.dp)<br>                        .fillMaxWidth()<br>                        .padding(20.dp)<br>                )<br>            }<br>            BottomSheetType.ERROR -&gt; {<br>                val content = uiState.bottomSheetContent as BottomSheetContent.ErrorSheetContent<br>                ErrorBottomSheetContent(<br>                    message = content.message,<br>                    modifier = Modifier<br>                        .height(70.dp)<br>                        .fillMaxWidth()<br>                        .padding(20.dp)<br>                )<br>            }<br>            BottomSheetType.REDIRECT -&gt; {<br>                val content =<br>                    uiState.bottomSheetContent as BottomSheetContent.RedirectSheetContent<br>                RedirectBottomSheetContent(<br>                    message = content.message,<br>                    redirect = content.redirect,<br>                    modifier = Modifier<br>                        .height(70.dp)<br>                        .fillMaxWidth()<br>                        .padding(20.dp)<br>                )<br>            }<br>            BottomSheetType.INITIAL -&gt; InitialBottomSheetContent()<br>        }<br>    },<br>    sheetState = bottomSheetState, // don&#39;t forget to set this parameter<br>    modifier = modifier<br>) {<br>  // your screen content<br>  // for example : Scaffold , Column etc.<br>}</pre><h4>9- Completed Code for MultipleBottomSheetContentScreen</h4><p>Let’s have a look at completed code for MultipleBottomSheetContentScreen composable. We defined BottomSheetContent, BottomSheetType, BottomSheetAction and ViewModel classes above.</p><p>As a last note, for example user can change state by using a button. But, what if he/she clicks multiple times ? Multiple coroutines may launched and states may become corrupted. To prevent this issues use button’s enabled parameter and do not allow user to click it, before it becomes INITIAL state.</p><pre>@OptIn(ExperimentalMaterialApi::class)<br>@Composable<br>fun MultipleBottomSheetContentScreen(<br>    modifier: Modifier = Modifier,<br>    viewModel: MainViewModel = viewModel()<br>) {<br>    val coroutineScope = rememberCoroutineScope()<br><br>    val uiState by viewModel.bottomSheetState.collectAsState()<br><br>    val bottomSheetState = rememberModalBottomSheetState(<br>        initialValue = ModalBottomSheetValue.Hidden,<br>        confirmStateChange = {<br>            when (uiState.bottomSheetType) {<br>                BottomSheetType.REDIRECT -&gt; false<br>                else -&gt; it != ModalBottomSheetValue.Expanded<br>            }<br>        },<br>        skipHalfExpanded = false<br>    )<br><br>    val showBottomSheet: () -&gt; Unit = {<br>        coroutineScope.launch {<br>            bottomSheetState.show()<br>        }<br>    }<br><br>    val hideBottomSheet: () -&gt; Unit = {<br>        coroutineScope.launch {<br>            bottomSheetState.hide()<br>        }<br>    }<br><br>    val timedNonCancellableShowHide: (millis: Long) -&gt; Unit = {<br>        coroutineScope.launch {<br>            showBottomSheet()<br>            delay(timeMillis = it)<br>            hideBottomSheet()<br>        }<br>    }<br><br>    BackHandler(bottomSheetState.isVisible) {<br>        if (uiState.bottomSheetType != BottomSheetType.REDIRECT) {<br>            hideBottomSheet()<br>        }<br>    }<br><br>    LaunchedEffect(uiState.bottomSheetActionType) {<br>        when (uiState.bottomSheetActionType) {<br>            BottomSheetAction.INITIAL -&gt; {}<br>            BottomSheetAction.HIDE -&gt; hideBottomSheet()<br>            BottomSheetAction.SHOW -&gt; showBottomSheet()<br>            BottomSheetAction.TIMED -&gt; timedNonCancellableShowHide(3000)<br>        }<br>    }<br><br>    LaunchedEffect(Unit) {<br>        snapshotFlow { bottomSheetState.currentValue }.collect {<br>            if (it == ModalBottomSheetValue.Hidden) {<br>                viewModel.updateBottomSheetState(<br>                    bottomSheetActionType = BottomSheetAction.INITIAL,<br>                    bottomSheetContent = BottomSheetContent.InitialSheetContent,<br>                    bottomSheetType = BottomSheetType.INITIAL<br>                )<br>            }<br>        }<br>    }<br><br>    ModalBottomSheetLayout(<br>        sheetContent = {<br>            when (uiState.bottomSheetType) {<br>                BottomSheetType.LIST -&gt; {<br>                    val content = uiState.bottomSheetContent as BottomSheetContent.ListSheetContent<br>                    ListBottomSheetContent(<br>                        title = content.title,<br>                        data = content.data,<br>                        modifier = Modifier<br>                            .height(300.dp)<br>                            .fillMaxWidth()<br>                            .padding(20.dp)<br>                    )<br>                }<br>                BottomSheetType.ERROR -&gt; {<br>                    val content = uiState.bottomSheetContent as BottomSheetContent.ErrorSheetContent<br>                    ErrorBottomSheetContent(<br>                        message = content.message,<br>                        modifier = Modifier<br>                            .height(70.dp)<br>                            .fillMaxWidth()<br>                            .padding(20.dp)<br>                    )<br>                }<br>                BottomSheetType.REDIRECT -&gt; {<br>                    val content =<br>                        uiState.bottomSheetContent as BottomSheetContent.RedirectSheetContent<br>                    RedirectBottomSheetContent(<br>                        message = content.message,<br>                        redirect = content.redirect,<br>                        modifier = Modifier<br>                            .height(70.dp)<br>                            .fillMaxWidth()<br>                            .padding(20.dp)<br>                    )<br>                }<br>                BottomSheetType.INITIAL -&gt; InitialBottomSheetContent()<br>            }<br>        },<br>        sheetState = bottomSheetState,<br>        modifier = modifier<br>    ) {<br>        Column(<br>            modifier = Modifier.fillMaxSize(),<br>            verticalArrangement = Arrangement.spacedBy(20.dp)<br>        ) {<br>            Button(<br>                onClick = {<br>                    viewModel.updateBottomSheetState(<br>                        bottomSheetContent = BottomSheetContent.ListSheetContent(<br>                            title = listHeader,<br>                            data = listContent<br>                        ),<br>                        bottomSheetActionType = BottomSheetAction.SHOW,<br>                        bottomSheetType = BottomSheetType.LIST<br>                    )<br>                },<br>                enabled = uiState.bottomSheetActionType == BottomSheetAction.INITIAL<br>            ) {<br>                Text(text = &quot;List Bottom Sheet&quot;)<br>            }<br><br>            Button(<br>                onClick = {<br>                    viewModel.updateBottomSheetState(<br>                        bottomSheetContent = BottomSheetContent.ErrorSheetContent(message = errorMessage),<br>                        bottomSheetActionType = BottomSheetAction.SHOW,<br>                        bottomSheetType = BottomSheetType.ERROR<br>                    )<br>                },<br>                enabled = uiState.bottomSheetActionType == BottomSheetAction.INITIAL<br>            ) {<br>                Text(text = &quot;Error Bottom Sheet&quot;)<br>            }<br><br>            Button(<br>                onClick = {<br>                    viewModel.updateBottomSheetState(<br>                        bottomSheetContent = BottomSheetContent.RedirectSheetContent(<br>                            message = successMessage,<br>                            redirect = redirectMessage<br>                        ),<br>                        bottomSheetActionType = BottomSheetAction.TIMED,<br>                        bottomSheetType = BottomSheetType.REDIRECT<br>                    )<br>                },<br>                enabled = uiState.bottomSheetActionType == BottomSheetAction.INITIAL<br>            ) {<br>                Text(text = &quot;Redirect Non-Cancellable Bottom Sheet&quot;)<br>            }<br>        }<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*_T3PqLbqFw7WEbOqoq_s2Q.gif" /><figcaption>Happy End :)</figcaption></figure><h3>Conclusion</h3><p>In this article, we solved issues about ModalBottomSheetLayout Jetpack Compose. I hope, this article will be a guide for your implementations. Please don’t hesitate to ask your questions in comments section below. Follow me on <a href="https://www.linkedin.com/in/emreuysal34/"><strong>LinkedIn</strong></a> and <a href="https://github.com/uysalemre"><strong>Github</strong></a> for more…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec4140b2a043" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Internet ]]></title>
            <link>https://medium.com/@emreuysall/understanding-internet-bbfc11e03e5b?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbfc11e03e5b</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[internet]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Sun, 25 Dec 2022 22:36:26 GMT</pubDate>
            <atom:updated>2022-12-26T19:10:22.759Z</atom:updated>
            <content:encoded><![CDATA[<p>Technical and Non-Technical | Network | LAN | WAN | Switch | Router</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6o9q9M3mTatigGbiKwwsLg.jpeg" /><figcaption>Internet (a global system of devices) origins date back to the researches of United States Department of Defense in 1960s.</figcaption></figure><p>Everybody knows that Internet provides connection between devices like computers, servers, cameras, phones, cars, machines, tablets etc…</p><p>But wait and think about it, how is it possible ? How do we connect devices and send data to another continent ? How do we set commands remotely to our coffee machine for preparing coffee before arriving home ? We will understand the answers of these questions in this article using technical and non-technical ways…</p><h3>Non-Technical</h3><p>Think about sending a picture to your friend in another continent. You know that it is not possible to connect your device using an infinite cable to your friend’s device every time. But there are many high tech structures lying under lands and seas for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnShFsTTBkdykA0JUi0tAg.png" /><figcaption>Picture 1</figcaption></figure><p>As you see in the Picture 1, A sends data to B and data crosses over countries and oceans. A to B, an algorithm calculates the minimum distance for sending data to its final point and uses some connector devices named routers (think as an intersection on a road) to decide its way and redirects to another router or a device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q8xi5K2eQ8nEUuEWHSxwiA.png" /><figcaption>Picture 2</figcaption></figure><p>Think about connecting devices in the same continent. As we said before, there are many routers which connect devices and also other routers. These structure provides us creating more simpler connection. As you can see in Picture 2, there are 6 PCs (group of connected devices) and if you want to connect each of them, you need to create very complex structure. But if you create a connection between C1, C2 and C3 ,which represents routers, you can simply connect devices as groups. Also, one connection from a router which has connections to other routers can represent your area or continent as a connection point. You can create many scenarios, please write them to the comments section. 🙂</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gE6Aac139uGuQ7zDP7XMRw.png" /><figcaption>Picture 3</figcaption></figure><p>Until now, we connected wide areas such as continents, countries, group of devices etc. Now think about connection in your home, how do you connect devices in your home and transfer data between them ? A switch provides connection between devices in local areas. Switches can provide connection without Internet connection. I can hear you that you’re saying how is it possible without IP (because you know that IP is given dynamically to your device when connected to Internet) ? It is possible because your device has a unique address, named MAC address in its hardware, and a switch provides communication using MAC address as an identifier.</p><p>In conclusion of non-technical part we understand that if you send a data from America to Germany your data will follow this path :</p><ul><li><strong>Your Computer</strong></li><li><strong>Your Switch and Router</strong></li><li><strong>Routers of your continent using cables</strong></li><li><strong>Cables under ocean</strong></li><li><strong>Routers of European continent</strong></li><li><strong>Your Friend’s Router and Switch</strong></li><li><strong>Your Friend’s Computer</strong></li></ul><h3>Technical</h3><h4>Devices 🖨</h4><p><strong>NIC (Newtork Interface Card) :</strong> A built-in hardware component (your laptop has one of these 😀) for devices that enables connection as wired and wireless. This component has a <strong><em>MAC Address</em></strong>.</p><p><strong>Switch : </strong>A device that provides communication between devices in a <strong><em>LAN</em></strong> using <strong><em>MAC Addresses</em></strong>. This is named <strong><em>2nd layer device</em></strong> because of <strong><em>MAC Addresses</em></strong> are attached to a <strong><em>packet</em></strong> in <strong><em>2nd layer (Data Link)</em></strong> of <strong><em>OSI Reference Model</em></strong>.</p><p><strong>Router : </strong>A device that provides communication between <strong><em>LANs</em></strong> in a <strong><em>WAN</em></strong> using IP Adresses. This is named <strong><em>3rd layer device</em></strong> because of <strong><em>IP Addresses</em></strong> are attached to <strong><em>segments</em></strong> in <strong><em>3rd layer (Network)</em></strong> of <strong><em>OSI Reference Model</em></strong>.</p><p><strong>End Device : </strong>A source or destination device in a network. For example a PC, Server, Phone etc…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*i0SFz73GRRhALB7XAW61sA.png" /><figcaption>We will use these icons to represent devices that we explained above</figcaption></figure><h4>Definitions 💭</h4><p><strong>MAC Address : </strong>A<strong> </strong>Unique hardcoded number on your <strong>Network Interface Card (NIC)</strong>.</p><p><strong>LAN :</strong> Local area network, provides communication between computers using <strong><em>Switch</em></strong> and <strong><em>MAC Addresses</em></strong>. (We will explain no panic 🌪)</p><p><strong>WAN : </strong>Wide area network, provides communication between <strong><em>LANs</em></strong> using <strong><em>Routers</em></strong> and <strong><em>IP Addresses</em></strong>.</p><p><strong>OSI Reference Model :<em> </em></strong>Description for universal standards of communication functions of Internet.</p><h4>LAN (Local Area Network) 🧑🏻‍💻 ➡️ 💻</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*BPyoyepCY9bURMhhg7klaw.png" /><figcaption>Local Area Network Example</figcaption></figure><p>A Local Area Network represents connection between devices in the same network using <strong>S<em>witch </em></strong>device. In <strong><em>LAN</em></strong>, devices use their <strong><em>MAC Addresses</em></strong> to establish communication between them. As we noted above, <strong><em>Switch</em></strong> is a 2nd layer device for <strong><em>OSI Reference Model</em></strong> and uses <strong><em>MAC Addresses</em></strong> to send packets.</p><h4>WAN (Wide Area Network) 🧑🏻‍💻 ➡️ 🌐</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uR8PHhq6gj2Vmne5IBG01Q.png" /><figcaption>Wide Area Network Example</figcaption></figure><p>A Wide Area Network represents connection between <strong><em>LANs</em></strong> using a <strong><em>Router </em></strong>device. In <strong><em>WAN</em></strong> devices use their <strong><em>IP Addresses</em></strong> to establish a communication with a device in another <strong><em>LAN</em></strong>. But as we stated above, in <strong><em>LAN </em></strong>devices<strong><em> </em></strong>use<strong><em> MAC Addresses </em></strong>for communication.</p><h4>Basic Structure of Internet 🕷🕸</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*7IUA02ASzvyZGZKhzPipgA.png" /><figcaption>Connected wide area networks</figcaption></figure><p>As we mentioned before and you can see in picture above, Internet is a huge number of connected <strong><em>WANs </em></strong>using<strong><em> Routers</em></strong>. Now we understood the what is main structure lying under <strong><em>Internet</em></strong>.</p><p>After understanding the basics, next step is clarifying communication, connection and data sending standards between devices. So, you need to learn <strong><em>OSI Reference Model</em>.</strong></p><h3>Conclusion</h3><p>In conclusion, we explained the basic working principle of Internet in a technical and non-technical way. There are many principles, algorithms and engineering methodologies lying under Internet structure. If you have any questions please do not hesitate to write in comments section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbfc11e03e5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mostly Used Linux Commands]]></title>
            <link>https://medium.com/databulls/mostly-used-linux-commands-b7d40d8b61b8?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7d40d8b61b8</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[linux-tutorial]]></category>
            <category><![CDATA[databulls]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Mon, 29 Nov 2021 15:29:18 GMT</pubDate>
            <atom:updated>2021-11-29T15:29:18.073Z</atom:updated>
            <content:encoded><![CDATA[<p>Linux | Using Terminal Commands | Bash | Command Line Interface</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*QxLJhfnx-8Lx_FuuXVu5Uw.png" /><figcaption>Do you know “Linux” name comes from the folder that kernel uploaded and given by Ari Lemmke who runs the FTP server ?</figcaption></figure><p>Let’s start with basic information about Linux CLI and work on mostly used commands in daily life.</p><h3>Introduction 📌</h3><p>The <strong>Command Line Interface</strong> (CLI), is a non-graphical, text-based interface on computer system, where the user types in a command and the computer executes it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*k5KFyYoc5W1BY9Getig2uA.png" /><figcaption>cli structure</figcaption></figure><p>Basic Command Syntax : <strong>command [options…] [arguments…]</strong></p><pre>ls -l Documents</pre><ul><li><strong>arguments :</strong> An input that command acts on it. ➡️ <strong>Documents</strong></li><li><strong>options :</strong> A flag or switch that modifies behaviour of command. ➡️ <strong>-l</strong></li></ul><h3>Commands 💻</h3><h4>Displaying current directory</h4><p>Using <strong><em>pwd</em></strong> command you can display your current working directory.</p><pre>pwd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*Gnu2MSpjgebMaP5e6tjeyg.png" /><figcaption>display current directory using pwd</figcaption></figure><h4>Changing Directories</h4><p>Using <strong><em>cd </em></strong>command you can change your current directory. Initial directory of the user is <strong>/home/&lt;username&gt;</strong> in Linux. The root directory is <strong>/ </strong>.</p><pre>cd [PATH]<br><strong><em>examples<br></em></strong>cd Desktop/<br>cd ..<br>cd </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*8EXgnewgpQeTQnTlm6L-BQ.png" /><figcaption>go to Documents using cd command</figcaption></figure><p>In Linux <strong>.</strong> represents the current directory and <strong>..</strong> represents the directory above your current directory. You can go to upper directory using <strong>cd .. </strong>or <strong>y</strong>ou can go to user’s home directory using only <strong>cd</strong> or <strong>cd ~ </strong>command.</p><figure><a href="https://www.linkedin.com/company/data-bulls/?viewAsMember=true"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABzToUpCSJPck-NAKvICJw.jpeg" /></a></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*0M5vqcWFJkvYWQxFPF3WZQ.png" /><figcaption>go to directory above Documents using cd ..</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*L2ldTbuCbwR-OW-f6IwS9g.png" /><figcaption>go user’s home using cd or cd ~</figcaption></figure><h4>Listing Files</h4><p>Using <strong>ls </strong>command you can list the directories and contents. Also <strong>ls </strong>command provides more detailed information about contents and directories using <strong>-l</strong> option.</p><pre>ls [OPTIONS][FILE]<br><strong><em>examples</em></strong><br>ls -l <br>ls -a<br>ls -l Desktop/<br>ls -lSr<br>ls -lr Documents/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*ls07EZVoDlEeXDce-de3CQ.png" /><figcaption>ls<strong> </strong>and ls -l command outputs</figcaption></figure><p>You can see that <strong>-l</strong> option adds additional information to result.</p><pre>Column 1<br>drwx-w-r-x<br>1. symbol : file (-), directory (d), socket (s) etc<br>2,3,4. symbol : users permissions <br>5,6,7. symbol : group permissions<br>8,9,10. symbol: others permissions</pre><pre>Column 2<br>emreuysal<br>shows the user owner</pre><pre>Column 3<br>staff<br>shows the group owner </pre><pre>Column 4 <br>288<br>shows the size</pre><pre>Column 5<br>Nov 28 18:00<br>shows the last modification time </pre><pre>Column 6<br>Desktop<br>shows the name</pre><p>For hidden files and directories you can use <strong>-a</strong> option and hidden files starts with <strong>.</strong> in Linux.</p><p>To sort result according to size you can use <strong>-S </strong>option and if you want to reverse the sort you can use <strong>-r</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*TUWPuVplTfLYbWK9UTdMwQ.png" /><figcaption>sort according to ascending size using ls -lSr command</figcaption></figure><h4>Administrative Access</h4><p>Using <strong>su</strong> and <strong>sudo</strong> commands you can have administrative access on Linux. The difference between <strong>sudo</strong> and <strong>su </strong>is; <strong>sudo</strong> gives administrative access only for the command to be executed.</p><pre>su [OPTIONS]<br>sudo [COMMAND]<br><strong><em>examples</em></strong><br>sudo cat example.txt<br>su -l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*I_Ag8mYHwhCIh0U-Ovmqew.png" /><figcaption>reading a file with sudo command</figcaption></figure><h4>Changing File Permissions and Ownership</h4><p>In linux there are 3 ownerships of permissions; <strong><em>users</em></strong>, <strong><em>groups</em></strong> and <strong><em>others</em></strong>. For each ownership there are <strong><em>read</em></strong>, <strong><em>write</em></strong> and <strong><em>execute</em></strong> permissions.</p><p><strong>r : read ➡️ 4 | w : write ➡️ 2 | e : execute ➡️ 1</strong></p><pre>chmod [PERMISSIONS][FILE]<br>chown [USER][FILE]<br><strong><em>examples</em></strong><br>chmod 777 example.txt<br>chown emreuysal example.txt</pre><p>Using <strong>chmod</strong> command you can change the file permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*2A_-8Qtr4awGLIIifiGj6A.png" /><figcaption>giving read permission for emreuysal user to a file</figcaption></figure><p>Using <strong>chown</strong> command you can change the file ownership.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*300CNMRkW6lYmeK89VU3VQ.png" /><figcaption>change ownership of a file emreuysal to root</figcaption></figure><h4>Viewing Files</h4><p>For viewing file content you can use <strong>cat</strong>, <strong>head</strong> and <strong>tail</strong> commands.</p><pre>cat [FILE]<br>head [OPTIONS][FILE]<br>tail [OPTIONS][FILE]<br><strong><em>examples </em></strong><br>cat example.txt<br>head -n 5 example.txt<br>tail example.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vx3KU6N_8Re0a0QArdWKew.png" /><figcaption>reading a file using head, tail and cat</figcaption></figure><p>To read all content of the file <strong>cat</strong> command is a good choice, but reading some number of the content from the start or end, you can use <strong>head</strong> or <strong>tail</strong> command, also <strong>-n </strong>option with a number allows to increase or decrease the number of the lines to be read.</p><h4>Copying, Moving and Removing Files</h4><p>Copying and moving files in Linux requires 2 parameters. First one is the <strong>source</strong> and the second one is the <strong>destination</strong>.</p><p>Copying a file is provided by <strong>cp</strong> command and moving a file is provided by <strong>mv </strong>command.</p><pre>cp [SOURCE][DESTINATION]<br>mv [SOURCE][DESTINATION]<br>rm [OPTIONS][FILE]<strong><em><br>examples</em></strong><br>cp example.txt Desktop/<br>mv Desktop/example.txt Documents/<br>rm -rf .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mib7e3afZGvAWQuMkd9GzQ.png" /><figcaption>copying and moving file to Documents</figcaption></figure><p>Lets remove file from Documents using <strong>rm</strong> command. Normally <strong>rm</strong> only removes given file but you can delete a directory using <strong>-r </strong>(recursive) option. Be careful when using this command because it does not send files to trash can, it deletes files permanently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Jugfi6QMULERQ9L1jl2SXQ.png" /><figcaption>deleting file using rm command</figcaption></figure><h4>Filtering</h4><p>You can filter data using <strong>grep </strong>command and it supports advanced regex patterns to filter data professionally.</p><pre>grep [OPTIONS,PATTERNS etc.]<br><strong><em>examples</em></strong><br>cat sample.txt | grep &#39;[a-z]&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*TXjQW4V0MkgWxYEvZV5ehQ.png" /><figcaption>filter output of numbers.txt</figcaption></figure><p>The example above simply shows filtering output of cat command. First <strong>grep</strong> command shows the output containing 0 and the second one uses regex pattern that contains number between 0–9. By the way, <strong>| </strong>(pipe) means send output of the command on left hand side to right hand side command.</p><p><strong>Shutdown, Password Update and Change Command Name</strong></p><p>You can shutdown your computer using <strong>shutdown</strong> command but this command requires <strong>root</strong> privilages.</p><pre>shutdown [TIME][MESSAGE]<br><strong><em>examples</em></strong><br>shutdown +1 &quot;bye bye&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*58ORMQZrHXe48d8ydLDSVw.png" /><figcaption>shutdown command for 01:20 with goodbye message</figcaption></figure><p>When you need to update your password or another user password you can use <strong>passwd</strong> command.</p><pre>passwd [OPTIONS][USER]<br><strong><em>examples</em></strong><br>passwd emreuysal</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*tPA9zqaBa-L1iRG7Zw3iKg.png" /><figcaption>password update for emreuysal user</figcaption></figure><p>If you want to use shorter commands you can create shorter names for them using <strong>alias</strong> command.</p><pre>alias [ARGUMENTS]<strong><em><br>examples</em></strong><br>alias myname=&#39;echo &quot;emre&quot;&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*wvmaXyPVFdN09R_Nqh1z1g.png" /><figcaption>alias for ls -l command</figcaption></figure><h3>Summary ⨋</h3><p>In summary, we worked on mostly used Linux commands and tried them. If you want to learn more about Linux and CLI, I strongly recommend registering a Linux Essentials course and follow my articles.</p><h3>References 📖</h3><p>I will share 2 magical commands as a reference. Please try and see the outputs.</p><pre>man [COMMAND]<br>info [COMMAND]<br><strong><em>examples</em></strong><br>man ls<br>info cat</pre><h3>More…</h3><ul><li><a href="https://medium.com/databulls/how-to-avoid-gas-fees-when-selling-art-on-nft-marketplace-f8d115a3a098">How To Avoid Gas Fees When Selling Art on NFT Marketplace?</a></li><li><a href="https://medium.com/databulls/owasp-top-10-application-security-risks-20a035919fe2">OWASP Top 10 Application Security Risks</a></li><li><a href="https://medium.com/databulls/olympic-medal-numbers-predictions-with-time-series-part-3-time-series-forecasting-255e732616d5">Olympic Medal Numbers Predictions with Time Series, Part 3: Time Series Forecasting</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7d40d8b61b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/databulls/mostly-used-linux-commands-b7d40d8b61b8">Mostly Used Linux Commands</a> was originally published in <a href="https://medium.com/databulls">DataBulls</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Şahıs Şirketi Kurarak Yurtdışına Uzaktan Çalışmak]]></title>
            <link>https://medium.com/@emreuysall/%C5%9Fah%C4%B1s-%C5%9Firketi-kurarak-yurtd%C4%B1%C5%9F%C4%B1na-uzaktan-%C3%A7al%C4%B1%C5%9Fmak-50d0889aeae2?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/50d0889aeae2</guid>
            <category><![CDATA[şahıs-şirketi]]></category>
            <category><![CDATA[home-office]]></category>
            <category><![CDATA[evden-çalışmak]]></category>
            <category><![CDATA[uzaktan-çalışmak]]></category>
            <category><![CDATA[remote-working]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Sat, 06 Nov 2021 19:30:19 GMT</pubDate>
            <atom:updated>2021-11-07T10:59:38.734Z</atom:updated>
            <content:encoded><![CDATA[<h4>Şirket Kurulumu | Döviz Kazanmak | Teşvikler | Riskler vb…</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M3RVpIfMIewHYDpZVJXrdA.png" /></figure><p>Merhabalar bu yazımda sizlere pandemi sürecinin başlangıcıyla beraber çok popülerlik kazanan şahıs şirketi kurarak yurtdışına çalışmak hakkında edindiğim bilgilerden bahsedeceğim.</p><h3>Nedir bu uzaktan yurtdışına çalışmak ❓</h3><p>Uzaktan yurtdışına çalışmak, ülkemizde faaliyet göstermeyen bir şirkete (proje kapsamında ya da devamlı personeli gibi olabilir) hizmet vermek ve bunun karşılığında ödeme almaktır.</p><p>Bildiğiniz gibi öncelikle yurtdışına uzaktan çalışabilmek için yurtdışından bir şirketle anlaşmış olmanız gerekiyor (Bu noktada İngilizce önemli bir yer tutuyor). İşi insan kaynakları firmaları, yetenek avcıları, çeşitli kariyer siteleri üzerinden bulabilirsiniz ya da onlar size ulaşabilir.</p><p>Anlaşma olarak 2 tür var; ya o şirketin personeli olursunuz alacağınız brüt ücret yurtdışında vergilendirilir ve hesabınıza yatar ya da bu yazıda ele alacağımız gibi anlaştığınız şirket sizden onlara fatura kesmenizi ister, paranız hesabınıza yatar ve verginizi ülkemizde ödersiniz. Ayrıca ülkeler arası vergi anlaşmaları dolayısıyla ücretin 2 ülkede vergilendirmesi gibi bir durum olmaz.</p><p>Şimdi beraber süreci aşama aşama tamamlayalım.</p><h3>1- İşi Buluyoruz ✍🏻</h3><p>Öncelikle sizinle iletişime geçtiler ya da siz başvuruyu yaptınız. Bu aşama yukarıda belirttiğim gibi çeşitli kaynaklar üzerinden gerçekleşebilir. Onları kolayca araştırarak bulabilirsiniz. Sonra belirli aşamaları geçtikten sonra kabul aldınız ve şirket size sözleşmenizi gönderdi. Tabi bu süreçte en çok test edilen şeylerden biri teknik bilginin yanısıra İngilizce seviyeniz ve yabancı bir takımla anlaşma kültürel olarak uyuşma vb konular olacaktır.</p><h3>2- Şirketi Kuruyoruz 🏢</h3><p>Neden şirket kuruyorum sorusunu sorduğunuzu duyar gibiyim 😅. Sorunun cevabı aslında çok basit, hesabınıza yatan paranın resmi olarak bir karşılığı olmalıdır ve kazancınızın vergisini ödemeniz gerekmektedir.</p><p>Şahıs şirketi kurulum aşamasında bir mali müşavir ile anlaşıp vekaletname ile sizin adınıza süreci takip etmesini istiyorsunuz ve yaklaşık 1 günde tüm işlem tamamlanıyor. Bu noktada cüzi bir miktar masrafınız olacaktır (ücretler değişkenlik gösterebilir). Gerekli belgeler arasında kolayca ulaşılabilen kimlik fotokopisi, kira sözleşmesi, ikametgah vb bulunmaktadır.</p><p>LTD ve AŞ şirketlerine göre şahıs şirketi kurmamızdaki avantaj ve dezavantajlar:</p><ul><li>Cüzi miktarda masrafları olması ve süreçlerin daha hızlı ilerlemesi 👍🏻</li><li>Sermaye gereği yok 👍🏻</li><li>Vergi oranı %40 a kadar değişkenlik gösterir 👎🏻</li><li>Kredi vb işlemlerde daha az önem sahibidir 👎🏻</li></ul><p>Şirket yeri olarak nereyi göstereceğim derseniz, eviniz kendinize aitse kendi evinizi, değilse kira sözleşmesi yaparak (1/5 kadar stopaj bedeli olur) kaldığınız yeri ya da sanal ofis tutarak sanal ofisi gösterebilirsiniz.</p><p>Şahıs şirketi kapanması konusuna gelince, yine açıldığı gibi 1 günde tüm süreç tamamlanıp kapanıyor.</p><h3>3- Avantaj ve Dezavantajları İnceliyoruz <strong><em>✔️ ❌</em></strong></h3><p><strong><em>Avantajlar ✔️</em></strong></p><ul><li>Kazancınıza göre vergi oranlarının belirlenmesi</li><li>Yurtdışına yazılım ihracatına özel teşvikler olması</li><li>29 yaş altı genç girişimci teşvikleri olması</li><li>Gider gösterebilme</li><li>Döviz olarak kazanç elde etme</li></ul><p><strong><em>Dezavantajlar ❌</em></strong></p><ul><li>Sözleşmeniz şirket tarafından aniden iptal edilebilir</li><li>Kazancınız olsada olmasada ödemeleriniz olacaktır</li></ul><p>Avantaj, teşvikler ve dezavantajları biraz detaylandırmak istiyorum. Döviz olarak kazanmanız size ciddi bir avantaj sağlayacaktır ancak Türkiye piyasasında aldığınız rakamları döviz olarak teklif eden şirketler de olacaktır. Giderlerinizi vergi rakamlarını vb hesapladığınızda aynı miktarlarda ücretler ortaya çıkmakta ise bu durum bir risk analizi gerektirmektedir. Yurtdışına yazılım ihracatına özel %50 gelir vergisi teşviği bulunmaktadır ve giderler + %50 teşvik sonrası kalan rakam vergilendirilmektedir. Eğer 29 yaş altındaysanız 3 yıl boyunca gelir vergisinden 75.000₺ muafiyet bulunmaktadır, ayrıca bağkur ödemeniz 1 yıl boyunca devlet tarafından karşılanmaktadır, bu durumda da %50 teşvik + 75.000₺ + giderler sonrası kalan rakam vergilendirilmektedir. Kısacası 29 yaş altındaysanız ve yazılım hizmeti veriyorsanız avantajlar gayet güzel 🤓</p><h3>4- Hesaplama Yapıyor ve Teklifi Değerlendiriyoruz ✖️➕➖➗</h3><p>Avantaj ve dezavantajları konuştuktan sonra bir hesaplama yapalım. Türkiye şartlarında bir şirkette yıllık brüt maaşımız 220.000₺ diyelim ve yurtdışındaki şirketten de 2000$ dolarlık bir teklif aldığımızı varsayalım.</p><p><strong><em>1- Türkiye Şartlarında Bir Şirkette Çalışma Durumu</em></strong></p><p>220.000 / 12 = 18.333₺ brüt aylık ücretiniz olsun</p><p>Ortalamada aylık ele geçen miktar = 12.000₺ olacaktır</p><p><strong><em>2- Şahıs Şirketi ve Yurtdışına Yazılım Hizmeti Verme Durumu</em></strong></p><p>Güncel kur : 9,7₺ olarak alalım.</p><p>2000 * 9,7 = 19.400₺ aylık elde edilecek gelir</p><p>19.400 * 12 = 232.800₺ yıllık elde edilecek gelir</p><p>%50 teşvik düşüldükten sonra 116.400₺ gelir vergisine tabi ücret olacaktır. Ancak eğer gider olarak gösterdiğiniz şeyler varsa (bilgisayar almış olabilirsiniz vb.) bunları da bu rakamdan düşebilirsiniz.</p><p>Gelir vergisini hesapladığımızda da 26.000₺ civarı bir rakam ortaya çıkacaktır ve toplamda yıllık ele kalan yaklaşık 12.000₺ bağkuru düştükten sonra 194.000₺ olacaktır. Aylık olarak yaklaşık 16.000₺ yapmaktadır.</p><p><strong><em>3- Şahıs Şirketi, Yurtdışına Yazılım Hizmeti ve 29 Yaş Altı Durumu</em></strong></p><p>Güncel kur : 9,7₺ olarak alalım.</p><p>2000 * 9,7 = 19.400₺ aylık elde edilecek gelir</p><p>19.400 * 12 = 232.800₺ yıllık elde edilecek gelir</p><p>%50 teşvik düşüldükten sonra ve 29 yaş altına özel 75.000₺ gelir vergisi desteğini ekledikten sonra yaklaşık 41.000₺ vergilendirilecek rakam olarak karşımıza çıkıyor. Ancak eğer gider olarak gösterdiğiniz şeyler varsa (bilgisayar almış olabilirsiniz vb.) bunları da bu rakamdan düşebilirsiniz. Bağkur 1 yıl devlet tarafından karşılandığından onu bu hesaba dahil etmedim.</p><p>Gelir vergisini hesapladığımızda 7000₺ gibi bir rakam karşımıza çıkıyor ve yıllık 225.000₺ aylık ise yaklaşık 18.000₺ olarak ele geçen miktar ortaya çıkıyor.</p><h3>Sonuç</h3><p>Avantajları, dezavantajları, riskleri, kurulum aşamalarını, kazanç farklarını inceledik. Konu hakkındaki güncellemeler, yorumlar ve düzeltmelerinizi yorumlar kısmında belirtebilirsiniz.</p><blockquote>Son olarak bir not : Şirketi kurma aşamasında ve belirtmiş olduğum avantaj dezavantaj durumları, vergi dönemleri, kurulum ücretleri vb gibi detayları mali müşavirler size gerekli danışmanlığı sağlayacağı için onlardan öğrenmeniz, teyit etmeniz daha doğru olacaktır ve size daha net bilgi sağlayacaklardır. Bu yazıdaki bilgiler tamamen kendi araştırmalarımın sonucudur, kesin ve yasal bilgi niteliği taşımamaktadır.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50d0889aeae2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native HMS Nearby Service Plugin | Wifi Share Application]]></title>
            <link>https://medium.com/huawei-developers/react-native-hms-nearby-service-plugin-wifi-share-application-773591b01b3d?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/773591b01b3d</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[application]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Thu, 04 Nov 2021 13:52:26 GMT</pubDate>
            <atom:updated>2021-11-04T13:52:26.180Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*18vmBCFOY4u9BRxluw9_MQ.png" /></figure><h3>Introduction ℹ️</h3><p>React Native HMS Nearby Service Plugin enables the communication between Huawei Nearby Service SDK and React Native platform. It allows apps to easily discover nearby devices and set up communication with them using technologies such as Bluetooth and Wi-Fi.</p><h4>Understanding Nearby Wifi Share 🧘🏻</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*OsDlZ5KyzwBKrRvO9fqhXg.png" /></figure><p>Nearby Wifi Sharing provides establishing wifi connection feature for wifi-unconnected phone, using the wifi-connected phone.</p><p>A simple connection process follows the steps below:</p><ul><li><strong>Sharer</strong> : Starts scanning by using<strong> startWifiShare(SHARE) </strong>function.</li><li><strong>Requester</strong> : Starts broadcasting.</li><li><strong>Sharer</strong> : Founds requester and triggers <strong>WIFI_ON_FOUND</strong> then shares wifi settings using <strong>shareWifiConfig</strong> function.</li><li><strong>Requester</strong> : Fetches authentication code and triggers <strong>WIFI_ON_FETCH_AUTH_CODE</strong>.</li><li><strong>Sharer and Requester</strong> : Completes wifi sharing and triggers <strong>WIFI_ON_RESULT</strong>.</li><li><strong>Sharer and Requester</strong> : Stops wifi sharing functionalities using <strong>stopWifiShare</strong> function.</li></ul><h3>Wifi Share Application 🤝</h3><h4>Application Creation 🏗</h4><p>Create <strong><em>NearbyWifiShare</em></strong> app using the command below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e1e2e2630269f7cbbbb7186065de585/href">https://medium.com/media/8e1e2e2630269f7cbbbb7186065de585/href</a></iframe><p>Download React Native HMS Nearby Service Plugin.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b71c5856e7881611f95f5807b2e05367/href">https://medium.com/media/b71c5856e7881611f95f5807b2e05367/href</a></iframe><h4>Development Process 💻</h4><ul><li><strong>App.js :</strong> Entry point of the wifi sharing application. We will handle sharing wifi functions and events using this screen. Users will be informed using dialogs and able to start and stop wifi sharing.</li><li><strong>Styles.js :</strong> Contains all view styles for this application.</li></ul><p>Let&#39;s continue with creating our main screen <strong><em>App.js 🦾</em></strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a353751a597d1d099feac0ce1c2d127b/href">https://medium.com/media/a353751a597d1d099feac0ce1c2d127b/href</a></iframe><p>In <strong><em>componentDidMount()</em></strong> we registered for events <strong><em>WIFI_ON_FOUND</em></strong>, <strong><em>WIFI_ON_LOST</em></strong>, <strong><em>WIFI_ON_FETCH_AUTH_CODE,</em></strong> and <strong><em>WIFI_ON_RESULT</em></strong> to handle success and error cases for both ends.</p><p><strong>WIFI_ON_FOUND<em> </em>:</strong> We showed a dialog to ask sharer if she/he wants to share wifi configuration using <strong><em>shareWifiConfig() </em></strong>with the requester. Otherwise use <strong><em>stopWifiShare()</em></strong> function to end the process.</p><p><strong>WIFI_ON_LOST</strong> <strong>:</strong> Informed user about connection lost.</p><p><strong>WIFI_ON_FETCH_AUTH_CODE<em> </em>:</strong> Showed requester an information dialog because requester receives an authentication code with this event from the other phone.</p><p><strong>WIFI_ON_RESULT<em> </em>:</strong> Handled process results such as <strong><em>SUCCESS</em></strong>, <strong><em>FAILURE</em></strong>, <strong><em>WIFI_MUST_BE_ENABLED, </em></strong>etc.</p><p>After registering events, we assigned functions to request and share buttons. Request button triggered <strong><em>startWifiShare(SET)</em></strong> function and share button triggered <strong><em>startWifiShare(SHARE)</em></strong> function to start broadcasting or scanning.</p><p>After this step, registered events worked and continued the remaining process as we stated in the information part and event explanations.</p><p>In the end for better resource and memory management, we stopped the process using <strong><em>stopWifiShare()</em></strong> function for both phones to stop scanning and broadcasting.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/870df55e04bc088d1e5cbd66b626d170/href">https://medium.com/media/870df55e04bc088d1e5cbd66b626d170/href</a></iframe><p>For better styling, we created our <strong><em>Styles.js </em></strong>file above.</p><h4>Here is the Magic !!! Let&#39;s Run the App 😎</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3126a0943732fc7dca06f53376a0f91e/href">https://medium.com/media/3126a0943732fc7dca06f53376a0f91e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*Hdgh630M7bah8E5PlnbGzw.png" /></figure><h4>Conclusion📍</h4><p>As a result, we learned about how to use HMS RN Nearby Service Plugin for sharing wifi case by creating an example application. It removed the extra time of sharing passwords, wifi names, etc.</p><h3>References ✍🏻</h3><ul><li><a href="https://github.com/uysalemre/hms-nearby-wifi-share">GitHub - uysalemre/hms-nearby-wifi-share: A React Native Android Application that uses Huawei Mobile Services Nearby Wifi Share feature for sharing wifi between Huawei Devices</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/before-you-start-0000001073756483">Document</a></li><li><a href="https://www.npmjs.com/package/@hmscore/react-native-hms-nearby">@hmscore/react-native-hms-nearby</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=773591b01b3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/react-native-hms-nearby-service-plugin-wifi-share-application-773591b01b3d">React Native HMS Nearby Service Plugin | Wifi Share Application</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Storyly Integration Example Android]]></title>
            <link>https://medium.com/@emreuysall/storyly-integration-example-android-27196366d6a?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/27196366d6a</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[stories]]></category>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[storyly]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 13:25:31 GMT</pubDate>
            <atom:updated>2021-08-20T13:25:31.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*szrjcasqCZPO1TNsQ38G5g.jpeg" /></figure><h4>What is Storyly and why did I use it ?</h4><p>Storyly is an SDK that provides in-app stories to applications. It provides 2 main things that eases developer and company works.</p><ul><li>For developers, easy SDK integration and no redundant code use or creation 👌🏻</li><li>For company, a dashboard that creates stories interactively and creates analytics automatically 👍🏻</li></ul><h4>Features Provided by Storyly 😎</h4><ul><li>Videos up to 15 seconds, Images and GIFs up to 7 seconds</li><li>Video Streaming up to 30 minutes</li><li>Story Groups up to 100</li><li>Emoji reaction bars, polls, multiple choice questions, countdowns, multiple sliders</li><li>Buttons or Swipe Up actions</li></ul><h4>Lets Create a Demo Application ⏳</h4><p>As a first step, simply we need to create an application and add storyly dependency to your app <strong><em>build.gradle</em></strong>. I created an empty activity to show integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4f-FmHT6mPxLgTHMDzxGA.png" /><figcaption>create an application</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1e8525d466d97449885b66610d9659e/href">https://medium.com/media/a1e8525d466d97449885b66610d9659e/href</a></iframe><p>Then we added Storyly dependency to our application. Note that, to integrate Storyly successfully <strong><em>API level</em></strong><em> </em>must be upper than <strong><em>17</em></strong> and<em> </em><strong><em>Java 1.8</em></strong> is <strong><em>required</em></strong>.</p><p>Lets continue with our<strong><em> activity_main.xml</em></strong> file and put <strong><em>StorylyView</em></strong> in it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9df9cae78241f5804889fcfea8ff7e8/href">https://medium.com/media/d9df9cae78241f5804889fcfea8ff7e8/href</a></iframe><p>Now in <strong><em>MainActivity.kt</em></strong> add related storyly functions.</p><ul><li>Initialize storyly using <strong><em>StorylyInit(TOKEN)</em></strong> with token (I used test token in this demo app).</li><li>Register for storyly events using <strong><em>storylyListener.</em></strong></li><li><strong>storylyActionClicked : </strong>for handling button clicks and swipe ups in stories. In this event <strong><em>story.media.actionUrl</em></strong> gives the <strong><em>url</em></strong> that provided by storyly panel. User can use in app navigation (for example open a product detail screen or open browser etc.)</li><li><strong><em>storylyEvent : </em></strong>for tracking events and sending them to analytics and data platforms use .</li><li><strong><em>storylyLoadFailed :</em></strong> storyly triggers this event when it completes network operations but failed when fetching stories. When this happens, user will see empty icons on screen, to solve this hide stories until a successful fetch operation.</li><li><strong><em>storylyLoaded :</em></strong><em> </em>when storyly completes networks operations and shows stories to user successfully.</li><li><strong><em>storylyStoryDismissed :</em></strong> user dismisses story while watching it.</li><li><strong><em>storylyStoryShown :</em></strong> user starts to see stories.</li><li><strong><em>storylyUserInteracted :</em></strong> user interacts with story by giving reaction to interactive components like rating, poll etc.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/552aeca2585b070cf1bd61f3f05e2de4/href">https://medium.com/media/552aeca2585b070cf1bd61f3f05e2de4/href</a></iframe><h4>The Happy End 💁🏻</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WfMhYGXjYELpk4cMlTTGgg.png" /><figcaption>Stories in MainActivity</figcaption></figure><h4>Important Question: Where can I edit or create my stories ⁉️</h4><p>You can use <a href="https://dashboard.storyly.io/login"><strong><em>dashboard</em></strong></a> to create and edit stories. Also this dashboard allows you to group stories and change their visibility. When no stories provided from dashboard storyly automatically changes its visibility to gone in application.</p><h4>More Features</h4><ul><li>Show another<a href="https://integration.storyly.io/android/fragment-overlay.html"> fragment over storyly.</a></li><li>Make <a href="https://integration.storyly.io/android/ui-customizations.html">UI customization</a> according to needs.</li><li>Use <a href="https://integration.storyly.io/android/deep-linking.html">deep linking</a> with stories.</li><li>Use <a href="https://integration.storyly.io/android/monetization-quick-start.html">Google Admob for monetization</a>.</li></ul><h4>Useful Links</h4><p><a href="https://storyly.io/">Bring Superb Stories to Your App</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27196366d6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native HMS Nearby Service Plugin | Chat Application]]></title>
            <link>https://medium.com/huawei-developers/react-native-hms-nearby-service-plugin-chat-application-97c794ef4851?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/97c794ef4851</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[nearby]]></category>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[huawei]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Tue, 16 Mar 2021 07:43:37 GMT</pubDate>
            <atom:updated>2021-03-16T07:43:37.886Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*MSll78U-Rksm5ojGw7RKRg.png" /></figure><h3>Introduction</h3><p>React Native HMS Nearby Service Plugin enables communication between Huawei Nearby Service SDK and React Native platform. It allows apps to easily discover nearby devices and set up communication with them using technologies such as Bluetooth and Wi-Fi.</p><h4>Understanding Nearby Connection</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*irlzifnK6vFAYLSoz3GUlA.png" /></figure><p>Nearby Connection provides connection between devices and allows users to transfer data between devices.</p><p>A simple connection and data transfer process:</p><ul><li><strong>Discoverer : </strong>Starts scanning using <strong><em>startScan().</em></strong></li><li><strong>Broadcaster :</strong> Starts broadcasting using <strong><em>startBroadcasting().</em></strong></li><li><strong>Discoverer :</strong> Finds broadcasting devices using <strong><em>SCAN_ON_FOUND </em></strong>event. After devices found, sends request for connection using <strong><em>requestConnect()</em></strong>.</li><li><strong>Discoverer and Broadcaster : <em>requestConnect()</em></strong> triggers the <strong><em>CONNECT_ON_ESTABLISH </em></strong>on both sides.</li><li><strong>Discoverer and Broadcaster : </strong>Each side can decide accepting or rejecting connection using <strong><em>acceptConnect()</em></strong> or <strong><em>rejectConnect()</em></strong>.</li><li><strong>Discoverer and Broadcaster : <em>rejectConnect() </em></strong>or <strong><em>acceptConnect()</em></strong> triggers the <strong><em>CONNECT_ON_RESULT </em></strong>event.</li><li><strong>Discoverer and Broadcaster : </strong>After a connection successfully established, each side can stop broadcasting using <strong><em>stopBroadCasting()</em></strong> and scanning using<strong><em> stopScan() </em></strong>because continuous scanning or broadcasting consumes to energy and decreases the bandwidth for transmitting data.</li><li><strong>Discoverer and Broadcaster :</strong> After a successful connection each side can transfer data using <strong><em>transferFile()</em></strong>, <strong><em>transferBytes()</em></strong> or <strong><em>transferStream()</em></strong> functions. Transferring process or received data information can be obtained by <strong><em>DATA_ON_RECEIVED </em></strong>and <strong><em>DATA_ON_TRANSFER_UPDATE </em></strong>events.</li></ul><p>Nearby Connection provides different connection topologies according to different use cases.</p><ul><li><strong>MESH </strong>: <strong><em>M-to-N</em></strong> or cluster-shaped connection topology.</li><li><strong>STAR </strong>: <strong><em>1-to-N</em></strong> or star-shaped connection topology.</li><li><strong>P2P </strong>: <strong><em>1-to-1</em></strong> connection topology.</li></ul><h4>Application Creation</h4><p>Create <strong><em>NearbyChat </em></strong>application using command below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a33debfe2bd2b6691c5ca9f3d057df2/href">https://medium.com/media/1a33debfe2bd2b6691c5ca9f3d057df2/href</a></iframe><p>Download React Native HMS Nearby Service Plugin.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b71c5856e7881611f95f5807b2e05367/href">https://medium.com/media/b71c5856e7881611f95f5807b2e05367/href</a></iframe><h3>Development Process</h3><ul><li><strong>App.js :</strong> Entry point of the chat application. We will handle switching between <strong><em>InitialScreen</em></strong> and <strong><em>ChatScreen</em></strong>.<strong><em> </em></strong>Also we will get the required permissions using this component.</li><li><strong>src/InitialScreen.js : </strong>We will handle connection <em>(scanning, broadcasting, requesting, rejecting)</em> process using this component.</li><li><strong>src/ChatScreen.js : </strong>We will handle data transfer operations <em>(message sending and receiving)</em> using this component.</li><li><strong>src/Styles.js :</strong> Contains all view styles for this application.</li></ul><h4>App Screen Creation</h4><p>Lets create our app’s entry point <strong><em>App.js</em></strong>. In this class we requested permissions from user and according to <strong><em>isInitialized </em></strong>state switched between screens. <strong><em>chatEndpointId</em></strong> is a state which we will set in <strong><em>InitialScreen </em></strong>and pass it to <strong><em>ChatScreen</em></strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd0d73a3dafa9de38709a5fd8409e809/href">https://medium.com/media/cd0d73a3dafa9de38709a5fd8409e809/href</a></iframe><h4>Initial Screen Creation</h4><p>Lets create <strong><em>src/InitialScreen.js</em></strong> and add our class named <strong><em>InitialScreen</em></strong>.<strong> </strong>In this component we will handle connection between devices according to given connection process diagram in <strong><em>Understanding Nearby Connection</em></strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56ec2c745a4b4482307f8b65f3cc928a/href">https://medium.com/media/56ec2c745a4b4482307f8b65f3cc928a/href</a></iframe><p>The phone is <strong><em>scanner </em></strong>if it starts scanning or <strong><em>broadcaster </em></strong>if it starts broadcasting. Each role contains its own path to establish connection. Application uses <strong><em>P2P (1-to-1) </em></strong>as a<strong><em> </em></strong>connection topology. When component attached, it registers for events and manages each role according to possible success and failure cases. If a connection result is successful then app switches to <strong><em>ChatScreen </em></strong>using <strong><em>isInitialized </em></strong>state and sets<strong><em> endpointId </em></strong>state.</p><h4>Chat Screen Creation</h4><p>Lets create <strong><em>src/ChatScreen.js</em></strong> and add our class named <strong><em>ChatScreen</em></strong>.<strong> </strong>In this component we will handle data transfer operations between connected devices and disconnection process.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1dddae80e203d223a4d2f45ffce9f02b/href">https://medium.com/media/1dddae80e203d223a4d2f45ffce9f02b/href</a></iframe><p>User writes a message and sends it using send button. <strong><em>transferBytes() </em></strong>function transfers the data to given <strong><em>endpointId</em></strong>. Transferred message obtained from <strong><em>DATA_ON_RECEIVED </em></strong>event. If a user disconnects from chat, triggers <strong><em>CONNECT_ON_DISCONNECTED</em></strong> and app switches to <strong><em>InitialScreen </em></strong>for each user.</p><h4>Style Creation</h4><p>For having an attractive user interface lets change our <strong><em>Styles.js </em></strong>as given below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2240949c011bf063b0736862d6b4ebe/href">https://medium.com/media/a2240949c011bf063b0736862d6b4ebe/href</a></iframe><h4>Here is the Magic !!! Lets Run the App</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/143beb2b404e7b787b546fbc0e42d4ea/href">https://medium.com/media/143beb2b404e7b787b546fbc0e42d4ea/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7S5R5b98uhTmI9IdhozcXQ.png" /></figure><h3>References</h3><ul><li><a href="https://github.com/uysalemre/hms-nearby-chat">uysalemre/hms-nearby-chat</a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/before-you-start-0000001073482303">Document</a></li><li><a href="https://www.npmjs.com/package/@hmscore/react-native-hms-nearby">@hmscore/react-native-hms-nearby</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97c794ef4851" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/react-native-hms-nearby-service-plugin-chat-application-97c794ef4851">React Native HMS Nearby Service Plugin | Chat Application</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native Hms ML Kit | Installation and Example]]></title>
            <link>https://medium.com/huawei-developers/react-native-hms-ml-kit-installation-and-example-242dc83e0941?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/242dc83e0941</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[hms]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[huawei-mobile-service]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Fri, 24 Jul 2020 09:25:42 GMT</pubDate>
            <atom:updated>2021-03-17T20:26:09.870Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Native HMS ML Kit Plugin |Installation and Example</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OvnkUdsTWTY-EWgPJtLEHg.png" /></figure><h3>Introduction</h3><p>This article covers, how to integrate React Native HMS ML Kit Plugin to a React Native application and also shows examples for some use cases.</p><p>React Native HMS ML Kit Plugin supports services listed below</p><ul><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/text-recognition-0000001051006243"><em>Text Related Services</em></a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/text-translation-0000001051086162"><em>Language Related Services</em></a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/image-classification-0000001051086164"><em>Image Related Services</em></a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/face-detection-0000001050726196"><em>Face/Body Related Services</em></a></li><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/text-embed-0000001074013950"><em>Natural Language Processing Languages</em></a></li></ul><h3><strong>Prerequisites</strong></h3><ul><li>Make sure <strong><em>HMS Core APK</em></strong> exists on your device.</li><li>Create your <strong><em>agconnect-services.json</em></strong> file using App Gallery and put it under <strong><em>android/app/</em></strong> directory.</li><li>Make sure your app’s <strong><em>minSdkVersion </em></strong>is <strong><em>19 </em></strong>or higher.</li><li>Open <strong><em>build.gradle</em></strong> file under <strong><em>project-directory/android </em></strong>and change it as given below.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2a316b8ad73e28906e9e0048538cc9b/href">https://medium.com/media/b2a316b8ad73e28906e9e0048538cc9b/href</a></iframe><ul><li>Open <strong><em>build.gradle</em></strong> file under <strong><em>project-directory/android/app</em></strong> and change it as given below.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d9a91ab3a3603f2089c531af126db9f/href">https://medium.com/media/7d9a91ab3a3603f2089c531af126db9f/href</a></iframe><ul><li>Now we can download the plugin.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9fc016ad0e8b0f94406134a1d6b547b5/href">https://medium.com/media/9fc016ad0e8b0f94406134a1d6b547b5/href</a></iframe><h3>Finding Text Language In an Image</h3><p>The answer of “What is the language of this text in the image ?” resides in HMS ML Kit Plugin. We need to use <strong><em>HMSTextRecognition </em></strong>and <strong><em>HMSLanguageDetection</em></strong> modules to find this answer. <strong><em>HMSTextRecognition </em></strong>module will detect the text in image, then <strong><em>HMSLanguageDetection </em></strong>will detect the language used in this text.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9efb09ad47b42c2bd04d6a95c4eedb8c/href">https://medium.com/media/9efb09ad47b42c2bd04d6a95c4eedb8c/href</a></iframe><h4>Here is the Magic !!! Lets Run the App</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3126a0943732fc7dca06f53376a0f91e/href">https://medium.com/media/3126a0943732fc7dca06f53376a0f91e/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-5zSrQwTDhh7YRcm8QjLEg.png" /></figure><h3><strong>Conclusion</strong></h3><p>In this article, we integrated React Native HMS ML Kit Plugin to our application and created a language detector application which finds language of a text in an image.</p><p>You can ask questions on the comments section.</p><p>Thank you.</p><p><strong>References</strong></p><ul><li><a href="https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/introduction-0000001050726178">Document</a></li><li><a href="https://www.npmjs.com/package/@hmscore/react-native-hms-ml">@hmscore/react-native-hms-ml</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=242dc83e0941" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/react-native-hms-ml-kit-installation-and-example-242dc83e0941">React Native Hms ML Kit | Installation and Example</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nested Fragment Management and Bottom Navigation Android]]></title>
            <link>https://medium.com/@emreuysall/nested-fragment-management-and-bottom-navigation-android-5493eceea890?source=rss-244f03b0150------2</link>
            <guid isPermaLink="false">https://medium.com/p/5493eceea890</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[navigation]]></category>
            <category><![CDATA[bottomnavigationview]]></category>
            <category><![CDATA[fragmentmanager]]></category>
            <category><![CDATA[fragments]]></category>
            <dc:creator><![CDATA[Emre UYSAL]]></dc:creator>
            <pubDate>Mon, 04 May 2020 22:01:39 GMT</pubDate>
            <atom:updated>2021-11-11T19:13:19.560Z</atom:updated>
            <content:encoded><![CDATA[<h3>Nested Fragment Management with BottomNavigationView</h3><h4>Nested Fragments | Fragment Management | Android Library</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*aA9SBVgI60GA8CknCbSPfQ.png" /></figure><p>In this article, I will introduce you <strong><em>FragmentManager</em></strong> library and how to manage your nested fragments with <strong><em>BottomNavigationView</em></strong> using this library easily.</p><h3>Introduction to FragmentManager</h3><p><strong><em>FragmentManager</em></strong> is a library which removes complexity of management nested fragments with <strong><em>BottomNavigationView</em></strong> and provides easier control on your page flows and states.</p><h4><strong><em>Why did I create this library ❓</em></strong></h4><p>We know that before <strong><em>Jetpack Navigation</em></strong>, fragments’ management and using was really confusing and time taking for a developer. There were many functions you need to handle such as <strong><em>hiding</em></strong>, <strong><em>pushing</em></strong>, <strong><em>adding</em></strong> and <strong><em>removing</em></strong>. So, I created this library for one of my projects before <strong><em>Jetpack Navigation</em></strong> released. Now, it is an old approach for fragment management now but, who knows, you may want to use it 🤓.</p><h4>Let’s Do Some Integration 🔧</h4><p>Add the jitpack repository in your root <strong><em>build.gradle</em></strong> and<strong><em> settings.gradle </em></strong>file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecfcf3c34ed8906b9685282b4a7976b2/href">https://medium.com/media/ecfcf3c34ed8906b9685282b4a7976b2/href</a></iframe><p>Add the library dependency to your app <strong><em>build.gradle</em></strong> file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50598456e58fefa4ab94ceb211a8f608/href">https://medium.com/media/50598456e58fefa4ab94ceb211a8f608/href</a></iframe><p>Now you are ready to use it 🕶</p><blockquote>Note that <strong><em>minSdkVersion is 19</em></strong> and <strong><em>targetSdkVersion is 29 </em></strong>for this library.</blockquote><h3>Example Application and Use Cases 🧳</h3><h4>UI Design</h4><p>Lets start with our <strong><em>activity_main.xml </em></strong>file and for fragments add the <strong><em>FrameLayout</em></strong> and for bottom navigation add the <strong><em>BottomNavigationView</em></strong> as you see in the code below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/769daf0ff57dc0e29143a03a6d7190e3/href">https://medium.com/media/769daf0ff57dc0e29143a03a6d7190e3/href</a></iframe><p>In bottom navigation, we need a menu named <strong><em>bottom_nav_menu. </em></strong>So let’s create it under <strong><em>res &gt; menu &gt; bottom_nav_menu.xml</em></strong>. You can configure titles and icons as you want, so I will pass the steps for them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4212917bfc3dddeffe8fb1d2c50f1185/href">https://medium.com/media/4212917bfc3dddeffe8fb1d2c50f1185/href</a></iframe><p>Let&#39;s continue with our fragment design. I will create a single layout file and I will use it for all of my fragments. You can seperately use your fragments. In this file, i will display the current fragment name on screen and I will show <strong><em>GO DEEPER</em></strong>, <strong><em>GO BACK</em></strong> and <strong><em>END TOUR </em></strong>buttons to showing nested actions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f255c6b1aa68336ca5a23fc5ec8d18c0/href">https://medium.com/media/f255c6b1aa68336ca5a23fc5ec8d18c0/href</a></iframe><p>Now we are done with layouts. Until here, our app will look like the screenshot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*wc-sgU8IDcAhuo7pwVi3Kw.png" /><figcaption>UI Design Result</figcaption></figure><h4>Library Logic, Activity and Fragments</h4><p>The FragmentManager library provides 2 classes for usage named <strong><em>StateManager</em></strong> and <strong><em>StateManagerBuilder</em></strong>.</p><p><strong><em>StateManagerBuilder : </em></strong>A builder class that takes <strong><em>unique id</em></strong> for each bottom navigation paths (for ex : home list&gt; home detail fragments) with <strong><em>supportFragmentManager</em></strong> and the <strong><em>viewGroup</em></strong> <strong><em>id</em></strong> (in our case : we used FrameLayout).</p><p><strong><em>StateManager : </em></strong>A singleton class that manages the navigation operations using the functions below.</p><ul><li><strong><em>showOnNavigationClick(id : Int, fragment : Fragment) : </em></strong>This function shows the next fragment on screen for given id (holder) and pushes it to stack. <strong><em>(Use for Bottom Navigation Clicks)</em></strong></li><li><strong><em>showFragment(id : Int, fragment : Fragment) : </em></strong>This function shows the next fragment on screen for given id (holder) and pushes it to stack. <strong><em>(Use for Normal Redirects)</em></strong></li><li><strong><em>fragmentOnBackPressed(id : Int) : </em></strong>This function shows the latest fragment before the fragment on screen and pops it from the stack.</li><li><strong><em>removeAllFragmentStream(id:Int, nextToShow: Fragment) : </em></strong>This function removes all fragments in the stack for given id and shows the give next fragment and adds it to stack for given id.</li><li><strong><em>removeAll() : </em></strong>This function clears all stacks and sets instance to null.</li></ul><p>According to informations above, now we are ready to construct our <strong><em>MainActivity.kt</em></strong> file. As an initial step, I created an instance for <strong><em>StateManager</em></strong> using <strong><em>StateManagerBuilder</em></strong>. After that I used <strong><em>showOnNavigationClick </em></strong>function to navigate nested fragments using bottom navigation’s <strong><em>setOnItemClickListener </em></strong>event.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff2ffc95c7c730941d1f63754f4f7dcf/href">https://medium.com/media/ff2ffc95c7c730941d1f63754f4f7dcf/href</a></iframe><p>After completing <strong><em>MainActivity </em></strong>we need to create our <strong><em>Fragments</em></strong>. I named my fragment classes as <strong><em>HomeFirstFragment -&gt; HomeSecondFragment</em></strong> to understand the code better. In this file :</p><ul><li><strong><em>For First Fragments :</em></strong> User can use <strong><em>GO DEEP</em></strong> button to see next fragment (<strong><em>showFragment</em></strong> function)</li><li><strong><em>For Second Fragments :</em></strong> User can use <strong><em>GO DEEP</em></strong> button to see next fragment (<strong><em>showFragment</em></strong> function) and can use <strong><em>GO BACK</em></strong> button to see latest fragment before the fragment on screen (<strong><em>fragmentOnBackPressed</em></strong> function).</li><li><strong><em>For Third Fragments :</em></strong> User can use <strong><em>END TOUR</em></strong> button to end nested flow and starts from given destination(<strong><em>removeAllFragmentStream</em></strong> function) or can use <strong><em>GO BACK</em></strong> to see latest fragment before the fragment on screen (<strong><em>fragmentOnBackPressed</em></strong> function).</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/060c9cc8b6b64bb7181b4b3dc5d2380e/href">https://medium.com/media/060c9cc8b6b64bb7181b4b3dc5d2380e/href</a></iframe><h3>Result Video</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*AUVVegPmkRrsYhC9dt2RQQ.gif" /><figcaption>Watch the GIF carefully starts with HomeFirstFragment 1 title😎</figcaption></figure><h3>References</h3><p><a href="https://github.com/uysalemre/Fragment-Manager">GitHub - uysalemre/Fragment-Manager: Instagram like Fragment Manager Library for Android, Manages Nested Fragments with BottomNavigationView</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5493eceea890" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>