Skip to content

Instantly share code, notes, and snippets.

View AliAzaz's full-sized avatar
🇵🇰
Passion to help others 😊

Ali Azaz Alam AliAzaz

🇵🇰
Passion to help others 😊
View GitHub Profile
@AliAzaz
AliAzaz / FieldLevelJsonParsingProfiler.kt
Created June 22, 2025 16:46 — forked from krayong/FieldLevelJsonParsingProfiler.kt
Field-Level JSON Parsing Profiler for Retrofit
import android.content.ContentValues
import android.content.Context
import android.os.Build
import android.os.Environment
import android.provider.MediaStore
import com.google.gson.JsonArray
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.google.gson.internal.Streams
@AliAzaz
AliAzaz / FieldLevelJsonParsingProfiler.kt
Created June 22, 2025 16:46 — forked from krayong/FieldLevelJsonParsingProfiler.kt
Field-Level JSON Parsing Profiler for Retrofit
import android.content.ContentValues
import android.content.Context
import android.os.Build
import android.os.Environment
import android.provider.MediaStore
import com.google.gson.JsonArray
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.google.gson.internal.Streams
@AliAzaz
AliAzaz / agent loop
Created April 10, 2025 14:39 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@AliAzaz
AliAzaz / ExportZipFile.kt
Created March 11, 2025 12:02
Export zip file in android working in KMP environment.
actual suspend fun exportZipFile(
platformContext: PlatformContext,
allExportResponse: AllExportResponse
) =
withContext(Dispatchers.IO) {
val zipBytes = createZipFromExportResponse(allExportResponse)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
saveToDownloadsScopedStorage(platformContext.context, allExportResponse.fileName, zipBytes)
} else {
@AliAzaz
AliAzaz / voyager.kt
Created January 27, 2025 07:52
Voyager Backpressed dispatcher in jetpack compose.
/*Copied this code from @akardas16:
* https://github.com/adrielcafe/voyager/issues/360#issuecomment-2010514347*/
@Composable
fun BackPressHandler(
backPressedDispatcher: OnBackPressedDispatcher? =
LocalOnBackPressedDispatcherOwner.current?.onBackPressedDispatcher,
onBackPressed: () -> Unit
) {
val currentOnBackPressed by rememberUpdatedState(newValue = onBackPressed)
@AliAzaz
AliAzaz / build.gradle.kts
Created October 21, 2024 21:08
Add XCFramework support in Kotlin Multiplatform (KMP)
kotlin {
// iOS Targets
val iosArm64 = iosArm64()
val iosX64 = iosX64()
val iosSimulatorArm64 = iosSimulatorArm64()
// macOS Targets
val macosX64 = macosX64()
val macosArm64 = macosArm64()
@AliAzaz
AliAzaz / build.gradle.kts
Created October 21, 2024 21:02
Gradle task for adding Maven support in Kotlin Multiplatform (KMP)
plugins{
id("maven-publish")
}
// Publishing Maven -- start
publishing {
publications {
create<MavenPublication>("customAndroidMavenRelease") {
groupId = "com.aliazaz.testkmplibrary"
artifactId = "sharedLibrary"
@AliAzaz
AliAzaz / build.gradle.kts
Last active October 21, 2024 21:10
Gradle task for generating FatAar in Kotlin Multiplatform (KMP)
tasks.register<Jar>("publishBundleFatAar") {
group = "publish-arr"
description = "Publish bundle fat jar for android"
archiveBaseName.set("${project.name}-fat")
archiveExtension.set("aar")
val releaseAarFile = tasks.getByName("bundleReleaseAar").outputs.files.singleFile
// Include the contents of the release AAR
@AliAzaz
AliAzaz / QrCodeGenerator.kt
Created July 31, 2024 09:02
Generate QRCode of the text provided in the function.
import com.google.zxing.BarcodeFormat
import com.google.zxing.MultiFormatWriter
import com.google.zxing.WriterException
import com.google.zxing.common.BitMatrix
@Throws(WriterException::class)
fun textToImageEncode(context: Context, QRcodeWidth: Int, Value: String?): Bitmap? {
val bitMatrix: BitMatrix
try {
bitMatrix = MultiFormatWriter().encode(
@AliAzaz
AliAzaz / CoroutineDispatcherHelper.kt
Last active April 4, 2024 08:33
Coroutine Dispatcher in a HILT injection Environment
class CoroutineDispatcherHelper : IDispatcher {
override fun dispatcherIO(): CoroutineDispatcher = Dispatchers.IO
override fun dispatcherMain(): CoroutineDispatcher = Dispatchers.Main
override fun dispatcherDefault(): CoroutineDispatcher = Dispatchers.Default
}