This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlin.coroutines.* | |
import kotlinx.coroutines.* | |
import platform.darwin.* | |
internal actual val dispatcher: CoroutineDispatcher = NsQueueDispatcher(dispatch_get_main_queue()) | |
internal class NsQueueDispatcher(private val dispatchQueue: dispatch_queue_t) : CoroutineDispatcher() { | |
override fun dispatch(context: CoroutineContext, block: Runnable) { | |
dispatch_async(dispatchQueue) { | |
block.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sixthsolution.rekab.sharednetwork | |
import io.ktor.client.HttpClient | |
import io.ktor.client.features.ExpectSuccess | |
import io.ktor.client.features.json.JsonFeature | |
import io.ktor.client.features.json.serializer.KotlinxSerializer | |
import io.ktor.client.request.get | |
import io.ktor.http.URLProtocol | |
import kotlinx.coroutines.* | |
import kotlinx.serialization.Serializable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'kotlin-multiplatform' | |
apply plugin: 'kotlinx-serialization' | |
kotlin { | |
sourceSets { | |
commonMain { | |
dependencies { | |
implementation 'org.jetbrains.kotlin:kotlin-stdlib' | |
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version" | |
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.Collator; | |
import java.util.Locale; | |
/** | |
* This class contains 2 methods for searching in arabic strings by ignoring Diacritic | |
* <p> | |
* {@link #searchInStringWordByWord(String, String, int)} is super fast but limited to search by word (witch in many | |
* case id what you need) | |
* <p> | |
* {@link #searchInStringLetterByLetter(String, String, int)} is slow but it can search anything from a letter to many |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DiscoveryClient discoveryClient = | |
new DiscoveryClient(Constants.DISCOVERY_RESOURCE_URL, dependencyResolver); | |
try { | |
ListenableFuture<List<ServiceInfo>> services = discoveryClient.getServices().read(); | |
Futures.addCallback(services, new FutureCallback<List<ServiceInfo>>() { | |
@Override | |
public void onSuccess(List<ServiceInfo> serviceInfos) { | |
mServices = serviceInfos; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getAuthenticationContext().acquireToken( | |
mContextActivity, | |
Constants.SCOPES.split(" "), | |
null, | |
Constants.CLIENT_ID, | |
Constants.REDIRECT_URI, | |
PromptBehavior.Auto, | |
new AuthenticationCallback<AuthenticationResult>() { | |
@Override | |
public void onSuccess(final AuthenticationResult authenticationResult) { |
NewerOlder