diff --git a/genAI/.env b/.env similarity index 100% rename from genAI/.env rename to .env diff --git a/.gitignore b/.gitignore index fe70435..f5e96db 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -genAI/venv \ No newline at end of file +venv \ No newline at end of file diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml deleted file mode 100644 index b375693..0000000 --- a/.idea/appInsightsSettings.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b589d56..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml deleted file mode 100644 index b268ef3..0000000 --- a/.idea/deploymentTargetSelector.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 5d3ab35..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index b1077fb..0000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml deleted file mode 100644 index f8051a6..0000000 --- a/.idea/migrations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 0ad17cb..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Generative_AI.png b/Generative_AI.png deleted file mode 100644 index 8786af1..0000000 Binary files a/Generative_AI.png and /dev/null differ diff --git a/README.md b/README.md deleted file mode 100644 index 5b107cf..0000000 --- a/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# Personalized Content Generation for Bank of Baroda Hackathon 2024 - -## Team: Coach_Sahab -"Driving the technology through the leaps of Himalayas" - -## Project Overview -This project aims to solve the problem of personalized content generation for the banking sector, enhancing customer satisfaction and engagement through tailored content. Our solution leverages advanced AI and machine learning models to deliver personalized marketing materials, financial reports, and educational content. - -## Repository -GitHub Link: [SmartBaroda](https://github.com/uphargaur/SmartBaroda) - -## Architecture - -### Overall Architecture -1. **Data Ingestion Layer** - - **Components**: Azure Data Factory, Azure Data Lake Storage - - **Function**: Collects and processes customer data from multiple sources, ensuring data quality and consistency. - -2. **AI Model Layer** - - **Components**: Azure Machine Learning, Azure Kubernetes Service (AKS), Azure Batch - - **Function**: Utilizes AI models to generate personalized content based on customer data analysis. - -3. **Distribution Layer** - - **Components**: Azure API Management, Azure Functions, Azure Logic Apps - - **Function**: Distributes personalized content through appropriate channels (email, SMS, mobile app). - -4. **Feedback Loop** - - **Components**: Azure Application Insights, Power BI - - **Function**: Gathers feedback on content effectiveness to refine and improve personalization algorithms. - -### Backend Architecture -1. **Source Code Management** - - **Tools**: GitHub, Jenkins/GitHub Actions - - **Function**: Version control, continuous integration, and deployment. - -2. **Deployment** - - **Components**: Cloud-based virtual machines, Docker - - **Function**: Hosting the application and running it in containers. - -3. **AI System** - - **Components**: AI models for processing complex queries - - **Function**: Provide advanced functionalities. - -4. **API** - - **Function**: Interfaces for communication between software components, handling client requests. - -5. **Database Management** - - **Components**: MongoDB - - **Function**: Storing and retrieving application data efficiently. - -### Generative AI Architecture -1. **Langchain Agent** - - **Function**: Uses a language model to choose a sequence of actions to take. - -2. **Langchain Tools** - - **Function**: Interfaces that the agent can use to interact with the world. - -3. **OpenAI LLM (Azure)** - - **Components**: OpenAI ChatGPT 3.5/4.0, Langchain Framework - - **Function**: Generative AI for creating personalized content. - -### Frontend Architecture -1. **Retrofit Service** - - **Function**: Simplifies network operations, manages API calls, and converts responses into data models. - -2. **DI Class for Dagger** - - **Function**: Manages dependencies, ensuring clean and reusable components. - -3. **ViewModel** - - **Function**: Manages UI data and business logic. - -4. **Repository** - - **Function**: Provides a single source of truth for data, handles caching and synchronization. - -5. **Activity/Fragment** - - **Function**: Displays data, handles user interactions, and delegates logic to ViewModel. - -## Azure Resources Required -- **Azure Machine Learning**: For the entire machine learning lifecycle. -- **Azure AI Studio & Azure OpenAI**: For advanced language models. -- **Azure Virtual Machines**: For scalable computing power. -- **Azure Kubernetes Service (AKS)**: For managing data processing nodes. -- **Azure Data Lake Storage**: For scalable data storage. -- **Azure Logic Apps**: For workflow automation. -- **Azure Application Insights**: For monitoring and feedback. - -## Methodology -1. **Pilot Testing** -2. **Feedback and Refinement** -3. **Gradual Rollout** -4. **Marketing and Awareness Campaigns** -5. **Customer Support and Training** -6. **Continuous Improvement** - -## Key Differentiators -- **Highly Personalized Content** -- **Real-Time Content Generation** -- **Comprehensive Integration** -- **Data-Driven Insights** -- **Continuous Improvement** - -## Adoption Plan -1. **Pilot Testing** -2. **Feedback and Refinement** -3. **Gradual Rollout** -4. **Marketing and Awareness Campaigns** -5. **Customer Support and Training** -6. **Continuous Improvement** - -## Scalability -- **Cloud Infrastructure** -- **Microservices Architecture** -- **AI Model Deployment** -- **Data Processing Efficiency** -- **Distribution Channels** -- **Continuous Monitoring and Optimization** - -## Security Considerations -- **Data Encryption** -- **Access Control** -- **Compliance Certifications** -- **Network Security** -- **Threat Detection** -- **Data Residency** -- **Audits and Assessments** -- **Disaster Recovery** - -## Contributors -- Yash Kamal Saxena -- Tushar Garg -- Uphar Gaur - -Thank you for considering our project! diff --git a/Screenshot from 2024-07-04 02-30-25.png b/Screenshot from 2024-07-04 02-30-25.png deleted file mode 100644 index e2a9975..0000000 Binary files a/Screenshot from 2024-07-04 02-30-25.png and /dev/null differ diff --git a/genAI/__init__.py b/__init__.py similarity index 100% rename from genAI/__init__.py rename to __init__.py diff --git a/genAI/__pycache__/financialAdvisor.cpython-311.pyc b/__pycache__/financialAdvisor.cpython-311.pyc similarity index 100% rename from genAI/__pycache__/financialAdvisor.cpython-311.pyc rename to __pycache__/financialAdvisor.cpython-311.pyc diff --git a/genAI/__pycache__/loanRecommenderAgent.cpython-311.pyc b/__pycache__/loanRecommenderAgent.cpython-311.pyc similarity index 100% rename from genAI/__pycache__/loanRecommenderAgent.cpython-311.pyc rename to __pycache__/loanRecommenderAgent.cpython-311.pyc diff --git a/genAI/__pycache__/main.cpython-311.pyc b/__pycache__/main.cpython-311.pyc similarity index 100% rename from genAI/__pycache__/main.cpython-311.pyc rename to __pycache__/main.cpython-311.pyc diff --git a/genAI/__pycache__/mongoClient.cpython-311.pyc b/__pycache__/mongoClient.cpython-311.pyc similarity index 100% rename from genAI/__pycache__/mongoClient.cpython-311.pyc rename to __pycache__/mongoClient.cpython-311.pyc diff --git a/genAI/__pycache__/policyRecommenderAgent.cpython-311.pyc b/__pycache__/policyRecommenderAgent.cpython-311.pyc similarity index 100% rename from genAI/__pycache__/policyRecommenderAgent.cpython-311.pyc rename to __pycache__/policyRecommenderAgent.cpython-311.pyc diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index aa724b7..0000000 --- a/android/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store -/build -/captures -.externalNativeBuild -.cxx -local.properties diff --git a/android/app/.gitignore b/android/app/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/android/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle deleted file mode 100644 index 3e45c98..0000000 --- a/android/app/build.gradle +++ /dev/null @@ -1,155 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'kotlin-parcelize' - id 'com.google.gms.google-services' - id 'com.google.firebase.crashlytics' - } - -android { - compileSdk 32 - - defaultConfig { - applicationId "com.example.infuxion_alternate" - minSdk 24 - targetSdk 32 - versionCode 26 - versionName "KYC v1.26" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } - buildFeatures { - viewBinding = true - } -} - -dependencies { - - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'com.google.android.material:material:1.7.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.compose.ui:ui-graphics:1.2.1' -// implementation 'androidx.activity:activity:1.9.0' - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - - implementation 'com.google.android.material:material:1.2.0-alpha01' - implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17' - implementation 'androidx.cardview:cardview:1.0.0' - implementation 'com.google.android.material:material:1.6.1' - - - implementation 'androidx.annotation:annotation:1.2.0' - implementation "androidx.constraintlayout:constraintlayout:2.1.3" - implementation 'com.google.android.gms:play-services-auth:19.0.0' - implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' - implementation 'com.google.firebase:firebase-auth:21.0.8' - - - - implementation 'androidx.cardview:cardview:1.0.0' - - // Feature module Support - implementation 'com.airbnb.android:lottie:4.2.2' - - - implementation 'com.google.android.material:material:1.6.1' - - - - implementation 'com.squareup.retrofit2:retrofit:2.9.0' - implementation 'com.squareup.retrofit2:converter-gson:2.9.0' - implementation 'com.squareup.okhttp3:okhttp:4.2.1' - implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1' - -// Coroutine - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") - implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0' - - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' - - implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - - implementation 'com.google.android.gms:play-services-location:21.0.0' - implementation 'com.google.android.gms:play-services-auth:20.3.0' - - implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0' -// implementation 'com.google.android.gms:play-services-location:17.0.0' - - - // Import the BoM for the Firebase platform - implementation platform('com.google.firebase:firebase-bom:31.1.1') - - // Add the dependencies for the Crashlytics and Analytics libraries - // When using the BoM, you don't specify versions in Firebase library dependencies - - implementation 'com.google.firebase:firebase-crashlytics-ktx' - implementation 'com.google.firebase:firebase-analytics-ktx' - - - - def camerax_version = "1.0.0-beta07" -// CameraX core library using camera2 implementation - implementation "androidx.camera:camera-camera2:$camerax_version" -// CameraX Lifecycle Library - implementation "androidx.camera:camera-lifecycle:$camerax_version" -// CameraX View class - implementation "androidx.camera:camera-view:1.0.0-alpha14" - implementation "androidx.camera:camera-core:1.0.0-alpha12" - implementation 'com.google.mlkit:face-detection:16.1.5' - - implementation 'com.intuit.sdp:sdp-android:1.1.0' //for the margin,padding and layout sizes - implementation 'com.intuit.ssp:ssp-android:1.1.0' // - - - - // gallery picker - - def nav_version = "2.5.3" - - - // Add the dependency for the Firebase Authentication library - // When using the BoM, you don't specify versions in Firebase library dependencies - implementation 'com.google.firebase:firebase-auth-ktx' - - - implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" - implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - - - - //j add - //Biometric (Finger, Pin, Pattern Lock) - implementation 'androidx.biometric:biometric:1.1.0' - - //Image Compress - implementation project(':image_compressor') - - //Glide Image - implementation 'com.github.bumptech.glide:glide:4.15.1' - - implementation 'com.google.mlkit:text-recognition:16.0.0' - -} - - diff --git a/android/app/google-services.json b/android/app/google-services.json deleted file mode 100644 index 81fe821..0000000 --- a/android/app/google-services.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "project_info": { - "project_number": "380280935643", - "project_id": "neosaturn-11e4c", - "storage_bucket": "neosaturn-11e4c.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:380280935643:android:ec85c6b6ba54b7b0b7e8fe", - "android_client_info": { - "package_name": "com.example.infuxion_alternate" - } - }, - "oauth_client": [ - { - "client_id": "380280935643-ihtc7voi12vdfcfb91o5hc4mj952aljr.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.example.infuxion_alternate", - "certificate_hash": "9a9e7584834c71976bbec7ae383a3452b4b7c39a" - } - }, - { - "client_id": "380280935643-gjl97po7r4vfjqa6broh1f1hiotg0u6p.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyDKIGdndJLVKU60ob_J4k5rmYH7UnklJT4" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "380280935643-gjl97po7r4vfjqa6broh1f1hiotg0u6p.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/android/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/android/app/src/androidTest/java/com/example/infuxion_alternate/ExampleInstrumentedTest.kt b/android/app/src/androidTest/java/com/example/infuxion_alternate/ExampleInstrumentedTest.kt deleted file mode 100644 index 3680c90..0000000 --- a/android/app/src/androidTest/java/com/example/infuxion_alternate/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.example.infuxion_alternate - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.example.infuxion_alternate", appContext.packageName) - } -} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 18da71c..0000000 --- a/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/CheckedEligibility.kt b/android/app/src/main/java/com/example/infuxion_alternate/CheckedEligibility.kt deleted file mode 100644 index 2c5ac14..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/CheckedEligibility.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.infuxion_alternate - -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.widget.Button -import com.example.infuxion_alternate.loan.LoanOffers - -class CheckedEligibility : AppCompatActivity() { - - private lateinit var btnNext: Button - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_checked_eligibility) - overridePendingTransition(0, 0) - - btnNext = findViewById(R.id.btnNext) - - btnNext.setOnClickListener(){ - val intent = Intent(this, LoanOffers::class.java) - startActivity(intent) - finish() - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/DashboardFragment.kt b/android/app/src/main/java/com/example/infuxion_alternate/DashboardFragment.kt deleted file mode 100644 index c776530..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/DashboardFragment.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.infuxion_alternate - -import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup - - -class DashboardFragment : Fragment() { - - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - } - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_dashboard, container, false) - } - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/Eligibility.kt b/android/app/src/main/java/com/example/infuxion_alternate/Eligibility.kt deleted file mode 100644 index 6eeccd7..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/Eligibility.kt +++ /dev/null @@ -1,86 +0,0 @@ -package com.example.infuxion_alternate - - -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.os.Handler -import android.text.TextWatcher -import android.view.View -import android.view.Window -import android.view.WindowManager -import android.widget.Button -import android.widget.ProgressBar -import android.widget.TextView -import androidx.core.content.ContextCompat - - - -class Eligibility : AppCompatActivity() { - - - private var progressBar: ProgressBar? = null - private var i = 0 - private var txtView: TextView? = null - lateinit var textview : TextView - lateinit var textProcess : TextView - private val handler = Handler() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_eligibility) - supportActionBar?.hide() - - - //Changing color of status bar - val window: Window = this@Eligibility.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor( this@Eligibility, R.color.white) - - - txtView = findViewById(R.id.text_view) - textProcess = findViewById(R.id.textProcess) - - val progressBar = findViewById(R.id.progress_Bar) as ProgressBar - - i = progressBar.progress - - Thread(Runnable { - // this loop will run until the value of i becomes 99 - while (i < 100) { - i += 1 - // Update the progress bar and display the current value - handler.post(Runnable { - progressBar.progress = i -// // setting current progress to the textview - txtView = findViewById(R.id.text_view) - txtView!!.text = i.toString() + "%" - if (i==30){ - textProcess.text="Congratulations! Your Identity proof is verified! Woah! Took just three seconds!!" - } else if (i==50){ - textProcess.text="Woah! That was blazingly fast! Your criminal record is all clean" - - }else if (i==70){ - textProcess.text="Hmmm. Your credit report seems all fine. Good job!" - - } - else if (i==100){ - textProcess.text="Congrats! You have successfully passed all the levels! That too, just in 100secs!" - - } - }) - try { - Thread.sleep(100) - } catch (e: InterruptedException) { - e.printStackTrace() - } - } - - - val intent = Intent(this, CheckedEligibility::class.java) - startActivity(intent) - }).start() - - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/FaceAnalyzer.kt b/android/app/src/main/java/com/example/infuxion_alternate/FaceAnalyzer.kt deleted file mode 100644 index 4086a58..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/FaceAnalyzer.kt +++ /dev/null @@ -1,219 +0,0 @@ -package com.example.infuxion_alternate - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.media.Image -import android.os.Handler -import android.util.Log -import android.util.Size -import android.widget.ImageView -import android.widget.TextView -import android.widget.Toast -import androidx.camera.core.* -import androidx.lifecycle.Lifecycle -import com.example.infuxion_alternate.utils.CameraActivity -import com.google.android.gms.tasks.OnFailureListener -import com.google.android.gms.tasks.OnSuccessListener -import com.google.mlkit.vision.common.InputImage -import com.google.mlkit.vision.face.Face -import com.google.mlkit.vision.face.FaceDetection -import com.google.mlkit.vision.face.FaceDetectorOptions -import kotlinx.coroutines.* - - -class FaceAnalyzer(context: Context, lifecycle: Lifecycle, private val overlay: Overlay) : ImageAnalysis.Analyzer { - - private val tvStatus:TextView = (context as Activity).findViewById(R.id.tvStatus) - private val tvStep: TextView = (context as Activity).findViewById(R.id.tvStep) - - private val ivStepOne: ImageView = (context as Activity).findViewById(R.id.stepOne) - private val ivStepTwo: ImageView = (context as Activity).findViewById(R.id.stepTwo) - private val ivStepThree: ImageView = (context as Activity).findViewById(R.id.stepThree) -// private val ivStepFour: ImageView = (context as Activity).findViewById(R.id.stepFour) - - - var blinkToastShown = false - var leftToastShown = false - var rightToastShown = false - private var count :Int = 0 - - private var blinkSuccess :Boolean = false - private var inside :Boolean = false - private var headTurnLeftSuccess :Boolean = false - private var headTurnRightSuccess :Boolean = false - - - - - - - - - private val options = FaceDetectorOptions.Builder() - .setPerformanceMode(FaceDetectorOptions.PERFORMANCE_MODE_ACCURATE) - .setLandmarkMode(FaceDetectorOptions.LANDMARK_MODE_ALL) - .setContourMode(FaceDetectorOptions.CONTOUR_MODE_ALL) - .setClassificationMode(FaceDetectorOptions.CLASSIFICATION_MODE_ALL) - .setMinFaceSize(0.15f) - //.enableTracking() //disable when contour is enable https://developers.google.com/ml-kit/vision/face-detection/android - .build() - - private val detector = FaceDetection.getClient(options) - - init { - //add the detector in lifecycle observer to properly close it when it's no longer needed. - lifecycle.addObserver(detector) - } - - override fun analyze(imageProxy: ImageProxy) { - overlay.setPreviewSize(Size(imageProxy.width,imageProxy.height)) - detectFaces(imageProxy) - } - - private val successListener = OnSuccessListener> { faces -> - - - for (face in faces) { - - - - // Step 1 -> Blink Eyes. - - if (!blinkSuccess){ - - - val leftEyeOpenProbability = face.leftEyeOpenProbability - val rightEyeOpenProbability = face.rightEyeOpenProbability - if (rightEyeOpenProbability != null) { - if (leftEyeOpenProbability != null) { - if (leftEyeOpenProbability < 0.5 && rightEyeOpenProbability < 0.5) { - count+=1 - tvStatus.text="Scanning for blinking eyes.." - - if(count ==5){ - - blinkSuccess = true - - if (!blinkToastShown) { - Toast.makeText( - context, "Blinking Test is successful!", - Toast.LENGTH_SHORT - ).show() - - blinkToastShown = true - } - tvStep.text="Turn your head 30 degrees left" - tvStatus.text="Scanning for movement.." - - ivStepOne.setImageResource(R.drawable.ic_successtick) - - } - } - } - } - else{ - tvStatus.text="Unable to detect eyes" - } - } - - //Step 2 -> Turn head left - if( blinkSuccess and !headTurnLeftSuccess) { - if (face.headEulerAngleY <= -30) { - // User has rotated their head 30 degrees to the left - if(!leftToastShown) { - headTurnLeftSuccess = true - Toast.makeText( - context, "Left head movement has been registered!", - Toast.LENGTH_SHORT - ).show() - leftToastShown = true - } - tvStep.text="Turn your head 30 degrees right" - tvStatus.text="Scanning for movement.." - - ivStepTwo.setImageResource(R.drawable.ic_successtick) - val handler = Handler() - val runnable = Runnable { - headTurnLeftSuccess = true - } - handler.postDelayed(runnable, 2000) - } - else{ - tvStatus.text="No movement detected.." - } - } - - //Step 3 -> Turn head right - if( blinkSuccess and headTurnLeftSuccess and !headTurnRightSuccess) { - if (face.headEulerAngleY >= 30) { - // User has rotated their head 30 degrees to the right - if(!rightToastShown) { - headTurnRightSuccess = true - Toast.makeText( - context, "Right head movement has been registered!", - Toast.LENGTH_SHORT - ).show() - rightToastShown = true - } - tvStep.text="Face detection is successful" - tvStatus.text="All steps are successful!" - ivStepThree.setImageResource(R.drawable.ic_successtick) - val handler = Handler() - val runnable = Runnable { - - //j remove - /*val intent = Intent(context, ReviewRegisterDetails::class.java) - context.startActivity(intent)*/ - - // j add - val intent = Intent(context, CameraActivity::class.java) - context.startActivity(intent) - } - handler.postDelayed(runnable, 2000) - - - - - } - else{ - tvStatus.text="No movement detected.." - } - } - } - -// if(faces.size == 1){ -// -// } -// else if(faces.size == 0){ -// -// } -// else{ -// -// } -overlay.setFaces(faces) - } - - private val failureListener = OnFailureListener { e -> - Log.e(TAG, "Face analysis failure.", e) - } - - @SuppressLint("UnsafeExperimentalUsageError", "UnsafeOptInUsageError") - private fun detectFaces(imageProxy: ImageProxy) { - val image = InputImage.fromMediaImage(imageProxy.image as Image, imageProxy.imageInfo.rotationDegrees) - detector.process(image) - .addOnSuccessListener(successListener) - .addOnFailureListener(failureListener) - .addOnCompleteListener{ - imageProxy.close() - } - } - - - - - companion object { - private const val TAG = "FaceAnalyzer" - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/FirebasePhoneAuth.kt b/android/app/src/main/java/com/example/infuxion_alternate/FirebasePhoneAuth.kt deleted file mode 100644 index c4ebfa5..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/FirebasePhoneAuth.kt +++ /dev/null @@ -1,75 +0,0 @@ -package com.example.infuxion_alternate - -import android.content.ContentValues.TAG -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.util.Log -import com.google.firebase.FirebaseException -import com.google.firebase.auth.FirebaseAuth -import com.google.firebase.auth.PhoneAuthCredential -import com.google.firebase.auth.PhoneAuthOptions -import com.google.firebase.auth.PhoneAuthProvider -import com.google.firebase.auth.PhoneAuthProvider.verifyPhoneNumber -import com.google.firebase.auth.ktx.auth -import com.google.firebase.ktx.Firebase -import java.util.concurrent.TimeUnit - -class FirebasePhoneAuth : AppCompatActivity() { - private lateinit var auth: FirebaseAuth - private lateinit var verificationId:String - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_firebase_phone_auth) - - - auth = FirebaseAuth.getInstance() - // Get the user's phone number - val phoneNumber = "+918445214758" - - // Set up the options for the SMS verification - val options = PhoneAuthOptions.newBuilder(auth) - .setPhoneNumber(phoneNumber) // Phone number to verify - .setTimeout(60L, TimeUnit.SECONDS) // Timeout duration - .setActivity(this) // Activity to handle the flow - .setCallbacks(object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() { - - override fun onVerificationCompleted(p0: PhoneAuthCredential) { - // Auto-retrieval or SMS-based verification completed successfully - // Use `credential` to sign in the user - } - - override fun onVerificationFailed(p0: FirebaseException) { - Log.d(TAG, "onVerificationFailed: try again") } - - override fun onCodeSent( - p0: String, - p1: PhoneAuthProvider.ForceResendingToken - ) { - - super.onCodeSent(p0, p1) - verificationId = p0 - // Code sent successfully - // Save the verification ID and token to use later - // ... - } - }).build() - - PhoneAuthProvider.verifyPhoneNumber(options) - - - val credential = PhoneAuthProvider.getCredential(verificationId, "878979") - - auth.signInWithCredential(credential) - .addOnCompleteListener{ - if(it.isSuccessful){ - Log.d(TAG, "sendVerificationCode: complete") - } - else - { - Log.d(TAG, "sendVerificationCode: failed") - - } - } - } - } \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/HistoryFragment.kt b/android/app/src/main/java/com/example/infuxion_alternate/HistoryFragment.kt deleted file mode 100644 index d44aa74..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/HistoryFragment.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.example.infuxion_alternate - -import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup - - - -class HistroyFragment : Fragment() { - - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - } - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_histroy, container, false) - } - - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/HomeActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/HomeActivity.kt deleted file mode 100644 index 55c87de..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/HomeActivity.kt +++ /dev/null @@ -1,127 +0,0 @@ -package com.example.infuxion_alternate - -import android.Manifest -import android.content.pm.PackageManager -import android.location.Location -import android.os.Bundle -import android.view.View -import androidx.core.app.ActivityCompat -import androidx.core.content.ContextCompat -import androidx.lifecycle.lifecycleScope -import androidx.navigation.findNavController -import androidx.navigation.ui.setupWithNavController -import com.example.infuxion_alternate.base.BaseActivity -import com.example.infuxion_alternate.utils.AppConstant.DefaultValue.DEFAULT_LATITUDE -import com.example.infuxion_alternate.utils.AppConstant.DefaultValue.DEFAULT_LONGITUDE -import com.example.infuxion_alternate.utils.LocationFetchUtil -import com.example.infuxion_alternate.utils.MethodMaster.fetchAllContacts -import com.example.infuxion_alternate.utils.MethodMaster.getAllInstalledApps -import com.example.infuxion_alternate.utils.MethodMaster.getAllSmsMessages -import com.example.infuxion_alternate.utils.MethodMaster.getImeiNumber -import com.example.infuxion_alternate.utils.MethodMaster.showToast -import com.example.infuxion_alternate.utils.logD -import com.google.android.material.bottomnavigation.BottomNavigationView -import kotlinx.coroutines.launch - -class HomeActivity : BaseActivity() { - - private val TAG="HomeActivity" - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_home) - - val bottomNav =findViewById(R.id.bottomNavigationView) - val fragmentContainer =findViewById(R.id.mainFragment) - - bottomNav.setupWithNavController(fragmentContainer.findNavController()) - - init() - } - - override fun onClick(p0: View?) { - TODO("Not yet implemented") - } - - override fun init() { -// getContact() -// getFinancialSms() -// getInstallApp() -// getImeiNum() - getLocation() - } - -// private fun getImeiNum(){ -// activity?.let { -// if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { -// lifecycleScope.launch { -// val imei = getImeiNumber(it) -// "$TAG IMEI Number:-${imei}".logD() -// } -// } -// } -// } -// -// private fun getContact() { -// activity?.let { -// if (ContextCompat.checkSelfPermission(it, Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED){ -// lifecycleScope.launch { -// val contactList = fetchAllContacts(it) -// for (contact in contactList) { -// "$TAG Contact Model:-${contact}".logD() -// } -// } -// } -// } -// } -// -// private fun getFinancialSms() { -// activity?.let { -// if (ContextCompat.checkSelfPermission(it, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED) { -// lifecycleScope.launch { -// val smsList = getAllSmsMessages(activity) -// val financialSmsList = filterFinancialMessages(smsList) -// for (sms in financialSmsList) { -// "$TAG SMS Model:-${sms}".logD() -// } -// } -// } -// } -// } -// -// private fun getInstallApp() { -// activity?.let { -// if (ContextCompat.checkSelfPermission(it, Manifest.permission.QUERY_ALL_PACKAGES) == PackageManager.PERMISSION_GRANTED) { -// lifecycleScope.launch { -// val installedApps = getAllInstalledApps(it) -// val financialAppList = filterFinancialApp(installedApps) -// for (app in financialAppList) { -// "$TAG AppName:-${app.first}, PackageName:-${app.second}".logD() -// } -// } -// } -// } -// } - - private fun getLocation(){ - activity?.let { activity -> - locationFetchUtil = LocationFetchUtil(activity, null, shouldRequestPermissions = true, shouldRequestOptimization = true, callbacks = object : LocationFetchUtil.Callbacks { - override fun onSuccess(location: Location) { - val latitude = location.latitude - val longitude = location.longitude - "$TAG, onSuccess, Latitude:- $latitude".logD() - "$TAG, onSuccess, Longitude:- $longitude".logD() - - if (latitude != DEFAULT_LATITUDE && longitude != DEFAULT_LONGITUDE) { - val latLng= "($latitude, $longitude)" - showToast(activity,latLng) - } - } - - override fun onFailed(locationFailedEnum: LocationFetchUtil.LocationFailedEnum, defaultLocation: Location) { - "$TAG, onFailed, enum:- ${locationFailedEnum.name}".logD() - } - }) - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/HomeFragment.kt b/android/app/src/main/java/com/example/infuxion_alternate/HomeFragment.kt deleted file mode 100644 index 1d135b4..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/HomeFragment.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.infuxion_alternate - -import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup - -class HomeFragment : Fragment() { - - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - } - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_home, container, false) - } - - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/LoadingDialog.kt b/android/app/src/main/java/com/example/infuxion_alternate/LoadingDialog.kt deleted file mode 100644 index b65ade5..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/LoadingDialog.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.infuxion_alternate - -import android.app.Activity -import android.app.AlertDialog -import com.example.infuxion_alternate.R - -class LoadingDialog(val mActivity:Activity) { - private lateinit var isDialog: AlertDialog - fun startLoading(){ - - val inflater = mActivity.layoutInflater - val dialogView = inflater.inflate(R.layout.custom_dialog, null) - val builder = AlertDialog.Builder(mActivity) - builder.setView(dialogView) - builder.setCancelable(false) - isDialog = builder.create() - isDialog.show() - } - - fun isDismiss(){ - isDialog.dismiss() - } - -} - - diff --git a/android/app/src/main/java/com/example/infuxion_alternate/LoanFragment.kt b/android/app/src/main/java/com/example/infuxion_alternate/LoanFragment.kt deleted file mode 100644 index 93fd589..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/LoanFragment.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.infuxion_alternate - -import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup - - -class LoanFragment : Fragment() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - } - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_loan, container, false) - } - - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/Overlay.kt b/android/app/src/main/java/com/example/infuxion_alternate/Overlay.kt deleted file mode 100644 index 358ff1e..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/Overlay.kt +++ /dev/null @@ -1,130 +0,0 @@ -package com.example.infuxion_alternate - -import android.content.Context -import android.util.AttributeSet -import android.view.View -import com.google.mlkit.vision.face.Face -import android.content.res.Configuration -import android.graphics.Color -import android.graphics.Canvas -import android.graphics.Paint -import android.hardware.Camera -import android.util.Size -import com.google.mlkit.vision.face.FaceLandmark - - -class Overlay @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : View(context, attrs, defStyleAttr) { - - private var previewWidth: Int = 0 - private var widthScaleFactor = 1.0f - private var previewHeight: Int = 0 - private var heightScaleFactor = 1.0f - - private var faces = emptyArray() - private var orientation = Configuration.ORIENTATION_PORTRAIT - - private val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = Color.YELLOW - style = Paint.Style.STROKE - strokeWidth = 5.0f - } - - private val dotPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = Color.YELLOW - style = Paint.Style.FILL - strokeWidth = 1.0f - } - - override fun onDraw(canvas: Canvas) { - super.onDraw(canvas) - drawOverlay(canvas); - } - - fun setOrientation(orientation: Int) - { - this.orientation = orientation - } - - fun setPreviewSize(size: Size) { - // Need to swap width and height when in portrait, since camera's natural orientation is landscape. - if(orientation == Configuration.ORIENTATION_LANDSCAPE) { - previewWidth = size.width - previewHeight = size.height - } - else - { - previewWidth = size.height - previewHeight = size.width - } - } - - fun setFaces(faceList: List) - { - faces = faceList.toTypedArray() - postInvalidate() - } - - private fun drawOverlay(canvas: Canvas) { - widthScaleFactor = width.toFloat() / previewWidth - heightScaleFactor = height.toFloat() / previewHeight - -// for(face in faces) -// { -//// drawFaceBorder(face, canvas) -//// drawFaceContour(face,canvas) -// //drawFaceLandmark(face,canvas) -// } - } - - private fun drawFaceBorder(face: Face, canvas: Canvas) - { - val bounds = face.boundingBox - val left = translateX(bounds.left.toFloat()) - val top = translateY(bounds.top.toFloat()) - val right = translateX(bounds.right.toFloat()) - val bottom = translateY(bounds.bottom.toFloat()) - - canvas.drawRect(left, top, right, bottom, paint) - } - - //Note: Contours are detected for only the most prominent face in an image. - private fun drawFaceContour(face: Face, canvas: Canvas) - { - val contour = face.allContours - for (faceContour in contour) { - for (point in faceContour.points) { - val px = translateX(point.x) - val py = translateY(point.y) - canvas.drawCircle(px, py, 10.0f, dotPaint) - } - } - } - - private fun drawFaceLandmark(face: Face, canvas: Canvas) - { - val leftEye = face.getLandmark(FaceLandmark.LEFT_EYE) - val rightEye = face.getLandmark(FaceLandmark.RIGHT_EYE) - val leftCheek = face.getLandmark(FaceLandmark.LEFT_CHEEK) - val rightCheek = face.getLandmark(FaceLandmark.RIGHT_CHEEK) - - drawFaceLandmark(leftEye,canvas) - drawFaceLandmark(rightEye,canvas) - drawFaceLandmark(leftCheek,canvas) - drawFaceLandmark(rightCheek,canvas) - } - - private fun drawFaceLandmark(faceLandmark: FaceLandmark?, canvas: Canvas) - { - if(faceLandmark == null) - return - canvas.drawCircle(translateX(faceLandmark.position.x),translateY(faceLandmark.position.y), 10.0f, dotPaint) - } - - private fun translateX(x: Float): Float = x * widthScaleFactor - private fun translateY(y: Float): Float = y * heightScaleFactor - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/PrivacyPolicy.kt b/android/app/src/main/java/com/example/infuxion_alternate/PrivacyPolicy.kt deleted file mode 100644 index 8d5d829..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/PrivacyPolicy.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.infuxion_alternate - -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.view.Window -import android.view.WindowManager -import androidx.core.content.ContextCompat - -class PrivacyPolicy : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_privacy_policy) - - //Changing color of status bar - val window: Window = this@PrivacyPolicy.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor( this@PrivacyPolicy, R.color.white) - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/Sanction.kt b/android/app/src/main/java/com/example/infuxion_alternate/Sanction.kt deleted file mode 100644 index 17c76ef..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/Sanction.kt +++ /dev/null @@ -1,88 +0,0 @@ -package com.example.infuxion_alternate - -import android.content.ContentValues.TAG -import android.content.Intent -import android.os.Bundle -import android.util.Log -import android.view.Window -import android.view.WindowManager -import android.widget.Button -import android.widget.CheckBox -import android.widget.ScrollView -import androidx.appcompat.app.AlertDialog -import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.content.res.AppCompatResources -import androidx.core.content.ContextCompat - - -class Sanction : AppCompatActivity() { - - private lateinit var checkBoxTnc: CheckBox - private lateinit var btnAllowTnc: Button - private lateinit var scrollView: ScrollView - private var isScrolledToBottom = false - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_sanction) - supportActionBar?.hide() - - //Changing color of status bar - val window: Window = this@Sanction.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor(this@Sanction, R.color.white) - - val builder = AlertDialog.Builder(this) - .setTitle("Sanction") - .setMessage("Please read till the bottom of this page before proceeding.") - .setIcon(R.drawable.ic_saturn) - .setPositiveButton("Accept") { _, _ -> - - } - - checkBoxTnc = findViewById(R.id.cbTnc) - btnAllowTnc = findViewById(R.id.btnAllowTnc) - scrollView = findViewById(R.id.svTnc) - - - //VALIDATION - checkBoxTnc.setOnCheckedChangeListener { _, isChecked -> - if (isChecked) { - if (isChecked) { - btnAllowTnc.isEnabled = true - btnAllowTnc.backgroundTintList = - AppCompatResources.getColorStateList(this, R.color.white) - btnAllowTnc?.setTextColor(ContextCompat.getColor(this, R.color.black)) - } else { - btnAllowTnc.isEnabled = false - btnAllowTnc.backgroundTintList = - AppCompatResources.getColorStateList(this, R.color.greybg) - btnAllowTnc?.setTextColor(ContextCompat.getColor(this, R.color.grey)) - - } - - } - - scrollView.viewTreeObserver - .addOnScrollChangedListener { - if (scrollView.getChildAt(0).bottom - <= scrollView.height + scrollView.scrollY - ) { - isScrolledToBottom = true - } - } - - //Showing alert + Switching intent | Tnc => Privacy Policy - btnAllowTnc.setOnClickListener() { - if (btnAllowTnc.isEnabled && isScrolledToBottom) { - val intent = Intent(this, SanctionLoanContract::class.java) - startActivity(intent) - } - if (btnAllowTnc.isEnabled && !isScrolledToBottom) { - builder.show() - } - } - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/SanctionLoanContract.kt b/android/app/src/main/java/com/example/infuxion_alternate/SanctionLoanContract.kt deleted file mode 100644 index 4f918ac..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/SanctionLoanContract.kt +++ /dev/null @@ -1,89 +0,0 @@ -package com.example.infuxion_alternate - -import android.content.ContentValues.TAG -import android.content.Intent -import android.os.Bundle -import android.util.Log -import android.view.Window -import android.view.WindowManager -import android.widget.Button -import android.widget.CheckBox -import android.widget.ScrollView -import androidx.appcompat.app.AlertDialog -import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.content.res.AppCompatResources -import androidx.core.content.ContextCompat - - -class SanctionLoanContract : AppCompatActivity() { - - - private lateinit var checkBoxTnc: CheckBox - private lateinit var btnAllowTnc: Button - private lateinit var scrollView: ScrollView - private var isScrolledToBottom = false - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_sanction_loan_contract) - supportActionBar?.hide() - - //Changing color of status bar - val window: Window = this@SanctionLoanContract.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor(this@SanctionLoanContract, R.color.white) - - val builder = AlertDialog.Builder(this) - .setTitle("Sanction") - .setMessage("Please read till the bottom of this page before proceeding.") - .setIcon(R.drawable.ic_saturn) - .setPositiveButton("Accept") { _, _ -> - - } - - checkBoxTnc = findViewById(R.id.cbTnc) - btnAllowTnc = findViewById(R.id.btnAllowTnc) - scrollView = findViewById(R.id.svTnc) - - - //VALIDATION - checkBoxTnc.setOnCheckedChangeListener { _, isChecked -> - if (isChecked) { - if (isChecked) { - btnAllowTnc.isEnabled = true - btnAllowTnc.backgroundTintList = - AppCompatResources.getColorStateList(this, R.color.white) - btnAllowTnc?.setTextColor(ContextCompat.getColor(this, R.color.black)) - } else { - btnAllowTnc.isEnabled = false - btnAllowTnc.backgroundTintList = - AppCompatResources.getColorStateList(this, R.color.greybg) - btnAllowTnc?.setTextColor(ContextCompat.getColor(this, R.color.grey)) - - } - - } - - scrollView.viewTreeObserver - .addOnScrollChangedListener { - if (scrollView.getChildAt(0).bottom - <= scrollView.height + scrollView.scrollY - ) { - isScrolledToBottom = true - } - } - - //Showing alert + Switching intent | Tnc => Privacy Policy - btnAllowTnc.setOnClickListener() { - if (btnAllowTnc.isEnabled && isScrolledToBottom) { -// val intent = Intent(this, SanctionOtp::class.java) -// startActivity(intent) - } - if (btnAllowTnc.isEnabled && !isScrolledToBottom) { - builder.show() - } - } - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/TextActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/TextActivity.kt deleted file mode 100644 index 916ab46..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/TextActivity.kt +++ /dev/null @@ -1,120 +0,0 @@ -package com.example.infuxion_alternate - -import android.Manifest -import android.annotation.SuppressLint -import android.content.pm.PackageManager -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.util.Log -import android.view.ViewGroup -import android.view.Window -import android.view.WindowManager -import android.widget.Toast -import androidx.camera.core.CameraSelector -import androidx.camera.core.ImageAnalysis -import androidx.camera.core.ImageCapture -import androidx.camera.core.Preview -import androidx.camera.lifecycle.ProcessCameraProvider -import androidx.camera.view.PreviewView -import androidx.core.app.ActivityCompat -import androidx.core.content.ContextCompat - -import java.util.concurrent.Executors - -class TextActivity : AppCompatActivity() { - - private lateinit var viewFinder: PreviewView - private lateinit var overlay: Overlay - private var cameraExecutor = Executors.newSingleThreadExecutor() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_text) - supportActionBar?.hide() - - //Changing color of status bar - val window: Window = this@TextActivity.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor(this@TextActivity, R.color.white) - - viewFinder = findViewById(R.id.viewFinder) - - - if (allPermissionsGranted()) { - startCamera() - } else { - ActivityCompat.requestPermissions( - this, REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS - ) - } - } - - override fun onRequestPermissionsResult( - requestCode: Int, permissions: Array, grantResults: - IntArray - ) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - if (requestCode == REQUEST_CODE_PERMISSIONS) { - if (allPermissionsGranted()) { - startCamera() - } else { - Toast.makeText(this, - "Permissions not granted by the user.", - Toast.LENGTH_SHORT).show() - finish() - } - } - } - - private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all { - ContextCompat.checkSelfPermission(baseContext, it) == PackageManager.PERMISSION_GRANTED - } - - @SuppressLint("UnsafeExperimentalUsageError") - private fun startCamera() - { - val cameraProviderFuture = ProcessCameraProvider.getInstance(this) - - cameraProviderFuture.addListener(Runnable { - // Used to bind the lifecycle of cameras to the lifecycle owner - val cameraProvider: ProcessCameraProvider = cameraProviderFuture.get() - // Select back camera as a default - val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA - // Preview UseCase - val previewUseCase = Preview.Builder() - .build() - .also { - it.setSurfaceProvider(viewFinder.createSurfaceProvider()) - } - - val imageCapture = ImageCapture.Builder().build() - - // ImageAnalysis UseCase - val analysisUseCase = ImageAnalysis.Builder() - .build() - .also { - } - try { - // Unbind use cases before rebinding - cameraProvider.unbindAll() - - cameraProvider.bindToLifecycle(this,cameraSelector,previewUseCase,analysisUseCase) - // Bind use cases to camera - - } catch(exc: Exception) { - Log.e(TAG, "Use case binding failed", exc) - } - - }, ContextCompat.getMainExecutor(this)) - } - - companion object { - private const val TAG = "TextActivity" - private const val REQUEST_CODE_PERMISSIONS = 10 - private val REQUIRED_PERMISSIONS = arrayOf( - Manifest.permission.CAMERA, - ) - } - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/TextAnalyzer.kt b/android/app/src/main/java/com/example/infuxion_alternate/TextAnalyzer.kt deleted file mode 100644 index 1f3c591..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/TextAnalyzer.kt +++ /dev/null @@ -1,39 +0,0 @@ -import android.annotation.SuppressLint -import android.media.Image -import android.util.Log -import androidx.camera.core.ImageAnalysis -import androidx.camera.core.ImageProxy -import com.google.mlkit.vision.common.InputImage -import com.google.mlkit.vision.text.TextRecognition -import com.google.mlkit.vision.text.latin.TextRecognizerOptions - -class TextAnalyzer : ImageAnalysis.Analyzer { - - @SuppressLint("UnsafeOptInUsageError") - override fun analyze(imageProxy: ImageProxy) { - // Convert the image to an InputImage - val image = InputImage.fromMediaImage(imageProxy.image as Image, imageProxy.imageInfo.rotationDegrees) - - - // Pass the image to the ML Kit text recognition API - val recognizer = TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS) - recognizer.process(image) - - - .addOnSuccessListener { visionText -> - val text = visionText.text - Log.d(TAG, "Analyzed text: $text") - } - .addOnFailureListener { e -> - Log.e(TAG, "Text recognition failed", e) - } - .addOnCompleteListener { - // Close the image proxy when processing is complete - imageProxy.close() - } - } - - companion object { - private const val TAG = "TextAnalyzer" - } -} diff --git a/android/app/src/main/java/com/example/infuxion_alternate/Tnc.kt b/android/app/src/main/java/com/example/infuxion_alternate/Tnc.kt deleted file mode 100644 index 3188746..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/Tnc.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.example.infuxion_alternate - -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.view.Window -import android.view.WindowManager -import androidx.core.content.ContextCompat - -class Tnc : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_tnc) - supportActionBar?.hide() - - //Changing color of status bar - val window: Window = this@Tnc.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor( this@Tnc, R.color.white) - - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/Utilities.kt b/android/app/src/main/java/com/example/infuxion_alternate/Utilities.kt deleted file mode 100644 index 5e6f2fb..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/Utilities.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.infuxion_alternate - -import android.util.Log - -object Utilities { - - private var TAG = "Neo Saturn" - - fun logEwithoutstore(description : String){ - Log.e(TAG,""+description) - } - - fun logW(description : String){ - Log.w(TAG,""+description) - } - fun logI(description : String){ - Log.i(TAG,""+description) - } - fun logD(description : String){ - Log.d(TAG,""+description) - } - fun logV(description : String){ - Log.v(TAG,""+description) - } - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/app_lock/PinLockActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/app_lock/PinLockActivity.kt deleted file mode 100644 index 4ea6550..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/app_lock/PinLockActivity.kt +++ /dev/null @@ -1,532 +0,0 @@ -package com.example.infuxion_alternate.app_lock - -import android.Manifest -import android.annotation.SuppressLint -import android.app.Activity -import android.app.AlertDialog -import android.app.Dialog -import android.app.KeyguardManager -import android.content.Context -import android.content.Intent -import android.content.pm.PackageManager -import android.graphics.Color -import android.graphics.drawable.ColorDrawable -import android.hardware.fingerprint.FingerprintManager -import android.os.* -import android.security.keystore.KeyGenParameterSpec -import android.security.keystore.KeyPermanentlyInvalidatedException -import android.security.keystore.KeyProperties -import android.view.View -import android.view.ViewGroup -import android.view.Window -import android.view.WindowManager -import android.view.animation.Animation -import android.view.animation.AnimationUtils -import android.widget.ImageView -import androidx.appcompat.app.AppCompatActivity -import androidx.core.app.ActivityCompat -import androidx.core.content.ContextCompat -import androidx.core.graphics.drawable.DrawableCompat -import com.example.infuxion_alternate.R -import com.example.infuxion_alternate.databinding.ActivityPinLockBinding -import com.example.infuxion_alternate.databinding.DialogBiometricScanningBinding -import com.example.infuxion_alternate.intro.SplashActivity -import com.example.infuxion_alternate.utils.AppConstant -import com.example.infuxion_alternate.utils.FingerprintHandler -import com.example.infuxion_alternate.utils.MethodMaster.biometricIsWorkOrNot -import com.example.infuxion_alternate.utils.MethodMaster.hide -import com.example.infuxion_alternate.utils.MethodMaster.show -import com.example.infuxion_alternate.utils.MethodMaster.showToast -import com.example.infuxion_alternate.utils.TinyDB -import com.example.infuxion_alternate.utils.logD -import java.io.IOException -import java.security.* -import java.security.cert.CertificateException -import javax.crypto.Cipher -import javax.crypto.KeyGenerator -import javax.crypto.NoSuchPaddingException -import javax.crypto.SecretKey - -open class PinLockActivity : AppCompatActivity() { - - private var binding: ActivityPinLockBinding? = null - private var activity:Activity?=null - private var tinyDB: TinyDB?=null - private var stringBuilderPin: StringBuilder = StringBuilder() - private var keyStore: KeyStore? = null - private val keySoreName = "PinLock" - private var cipher: Cipher? = null - private var isCreateNewPin = false - private var isConfirmNewPin = false - private var pinMessage: String? = null - private var currentPin: String? = null - private var isFrom: String? = null - private var dialogBinding: DialogBiometricScanningBinding? = null - private var biometricDialog: Dialog? = null - private val TAG = "PinLockActivity" - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - binding = ActivityPinLockBinding.inflate(layoutInflater) - setContentView(binding?.root) - - val window: Window = this.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor(this, R.color.white) - - activity = this - tinyDB = TinyDB(this) - - getIntentData() - init() - } - - private fun getIntentData() { - intent?.extras?.let { bundle -> - bundle.takeIf { it.containsKey(AppConstant.BundleData.PIN_MESSAGE) }?.let { - pinMessage = it.getString(AppConstant.BundleData.PIN_MESSAGE) - } - bundle.takeIf { it.containsKey(AppConstant.BundleData.CREATE_NEW_PIN) }?.let { - isCreateNewPin = it.getBoolean(AppConstant.BundleData.CREATE_NEW_PIN) - } - bundle.takeIf { it.containsKey(AppConstant.BundleData.IS_FROM) }?.let { - isFrom = it.getString(AppConstant.BundleData.IS_FROM) - } - } - } - - private fun init() { - binding?.apply { - activity?.let { - - textviewPinmessage.text = pinMessage - - if (!isCreateNewPin) { - doBiometricWork() - } - - num1.setOnClickListener { - setToStringBuilder("1") - } - num2.setOnClickListener { - setToStringBuilder("2") - } - num3.setOnClickListener { - setToStringBuilder("3") - } - num4.setOnClickListener { - setToStringBuilder("4") - } - num5.setOnClickListener { - setToStringBuilder("5") - } - num6.setOnClickListener { - setToStringBuilder("6") - } - num7.setOnClickListener { - setToStringBuilder("7") - } - num8.setOnClickListener { - setToStringBuilder("8") - } - num9.setOnClickListener { - setToStringBuilder("9") - } - num0.setOnClickListener { - setToStringBuilder("0") - } - - numBackspace.setOnClickListener { - if (stringBuilderPin.toString().trim { it <= ' ' }.isNotEmpty()) { - stringBuilderPin.setLength(stringBuilderPin.length - 1) - } - - checkCount() - } - } - } - } - - @SuppressLint("InflateParams") - private fun showBioDialog() { - activity?.let { activity -> - val view = layoutInflater.inflate(R.layout.dialog_biometric_scanning, null) - dialogBinding = DialogBiometricScanningBinding.bind(view) - biometricDialog = Dialog(activity) - dialogBinding?.root?.let { - biometricDialog?.let { dialog -> - dialog.setContentView(it) - dialog.setCancelable(false) - dialog.setCanceledOnTouchOutside(false) - } - } - - dialogBinding?.apply { - - if(tinyDB?.getBoolean(AppConstant.Prefs.SHOW_PIN_LOCK) == false){ - skipButton.hide() - } - - makeGrayFingerLogo(dialogLogo) - val alert = AlertDialog.Builder(activity) - val fadeInAnimation = AnimationUtils.loadAnimation(activity, R.anim.fade_in) - dialogLogo.startAnimation(fadeInAnimation) - alert.setCancelable(true) - - skipButton.setOnClickListener { - biometricDialog?.dismiss() - } - - biometricDialog?.setOnCancelListener { biometricDialog?.dismiss() } - - biometricDialog?.window?.apply { - setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) - } - - biometricDialog?.show() - } - } - } - - open fun makeGrayFingerLogo(myImageView: ImageView?) { - activity?.let { activity -> - myImageView?.apply { - DrawableCompat.setTint( - drawable, - ContextCompat.getColor(activity,R.color.color_dadada) - ) - } - } - } - - open fun fingerScanResult(e: String, success: Boolean) { - if (success) { - "$TAG, fingerScanResult, e:-$e, success".logD() - greenSignalFinger() - goToNextScreen() - } else { - "$TAG, fingerScanResult, error , e:-$e, fail".logD() - redAlertToFinger() - } - } - - private fun greenSignalFinger() { - vibrateSmall(true) - makeGreenOrRed(dialogBinding?.dialogLogo, true) - } - - private fun redAlertToFinger() { - vibrateSmall(false) - makeGreenOrRed(dialogBinding?.dialogLogo, false) - } - - @SuppressLint("ResourceAsColor") - open fun makeGreenOrRed(myImageView: ImageView?, b: Boolean) { - activity?.let { activity -> - myImageView?.apply { - if (b) { - DrawableCompat.setTint(drawable, ContextCompat.getColor(activity, android.R.color.holo_green_light)) - } else { - DrawableCompat.setTint(drawable, ContextCompat.getColor(activity, android.R.color.holo_red_light)) - } - } - dialogBinding?.apply { - if (b) { - txtSetUpYourTouchId.visibility = View.INVISIBLE - txtMsgDialogbiometric.visibility = View.INVISIBLE - txtTransferText1.text = getString(R.string.authentication_successful) - } else { - txtSetUpYourTouchId.visibility = View.INVISIBLE - txtMsgDialogbiometric.visibility = View.INVISIBLE - txtTransferText1.text = resources.getString(R.string.authentication_fail) - } - } - } - } - - fun changeModeToCreate(mode: Boolean) { - if (mode) { - binding?.textviewPinmessage?.text = resources.getString(R.string.create_pin) - } else { - binding?.textviewPinmessage?.text = resources.getString(R.string.enter_pin) - } - isCreateNewPin = mode - clearPassword() - } - - private fun enableDisable(b: Boolean) { - binding?.apply { - num0.isEnabled = b - num1.isEnabled = b - num2.isEnabled = b - num3.isEnabled = b - num4.isEnabled = b - num5.isEnabled = b - num6.isEnabled = b - num7.isEnabled = b - num8.isEnabled = b - num9.isEnabled = b - num0.isEnabled = b - } - } - - private fun setToStringBuilder(stringBuilder: String?) { - stringBuilderPin.toString().trim { it <= ' ' }.length - if (stringBuilderPin.toString().trim { it <= ' ' }.length < 4) { - stringBuilderPin.append(stringBuilder) - } - checkCount() - } - - private fun checkCount() { - setDotCount(stringBuilderPin.toString().trim { it <= ' ' }.length) - if (stringBuilderPin.toString().trim { it <= ' ' }.length == 4) { - enableDisable(false) - - if (isConfirmNewPin){ - "$TAG, Confirm New Pin".logD() - if (currentPin == stringBuilderPin.toString().trim { it <= ' ' }) { - "$TAG, Successfully Create New Pin:-${stringBuilderPin.toString().trim { it <= ' ' }}".logD() - tinyDB?.putString(AppConstant.Prefs.PIN_PASSWORD, stringBuilderPin.toString().trim { it <= ' ' }) - setResult(Activity.RESULT_OK) - finish() - }else{ - "$TAG, Confirm Pin Not Match:-${stringBuilderPin.toString().trim { it <= ' ' }}".logD() - showToast(activity, resources.getString(R.string.confirm_pin_not_match)) - vibrateSmall(false) - clearPassword() - } - }else if (isCreateNewPin) { - currentPin = stringBuilderPin.toString().trim { it <= ' ' } - "$TAG, New Pin:-${currentPin}".logD() - - binding?.textviewPinmessage?.text = - resources.getString(R.string.confirm_new_pin) - - isConfirmNewPin = true - clearPassword() - - } else { - if (tinyDB?.getString(AppConstant.Prefs.PIN_PASSWORD) == stringBuilderPin.toString().trim { it <= ' ' }) { - "$TAG, Match Pin:-${stringBuilderPin.toString().trim { it <= ' ' }}".logD() - goToNextScreen() - }else { - "$TAG, Wrong Pin:-${stringBuilderPin.toString().trim { it <= ' ' }}".logD() - showToast(activity, resources.getString(R.string.wrong_password)) - vibrateSmall(false) - clearPassword() - } - } - } else { - enableDisable(true) - } - } - - private fun goToNextScreen(){ - if (isFrom == AppConstant.BundleData.IS_FROM_SPLASH){ - startActivity(Intent(activity,SplashActivity::class.java)) - finish() - }else { - setResult(Activity.RESULT_OK) - finish() - } - } - - override fun onBackPressed() { - if (isCreateNewPin){ - super.onBackPressed() - } - } - - private fun clearPassword() { - stringBuilderPin.setLength(0) - stringBuilderPin = java.lang.StringBuilder() - setDotCount(0) - enableDisable(true) - } - - private fun setDotCount(dotCount: Int) { - binding?.apply { - "$TAG, DotCount:-$dotCount".logD() - when (dotCount) { - 0 -> { - imageviewPincount0.hide() - imageviewPincount1.hide() - imageviewPincount2.hide() - imageviewPincount3.hide() - } - 1 -> { - imageviewPincount0.show() - imageviewPincount1.hide() - imageviewPincount2.hide() - imageviewPincount3.hide() - } - 2 -> { - imageviewPincount0.show() - imageviewPincount1.show() - imageviewPincount2.hide() - imageviewPincount3.hide() - } - 3 -> { - imageviewPincount0.show() - imageviewPincount1.show() - imageviewPincount2.show() - imageviewPincount3.hide() - } - 4 -> { - imageviewPincount0.show() - imageviewPincount1.show() - imageviewPincount2.show() - imageviewPincount3.show() - } - } - } - } - - open fun vibrateSmall(success: Boolean?) { - val shake = AnimationUtils.loadAnimation(this, R.anim.shake) - shake.setAnimationListener(object : Animation.AnimationListener { - override fun onAnimationStart(animation: Animation) {} - override fun onAnimationEnd(animation: Animation) { - changeModeToCreate(isCreateNewPin) - } - - override fun onAnimationRepeat(animation: Animation) {} - }) - if (!success!!) { - dialogBinding?.dialogLogo?.startAnimation(shake) - } - val v = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { - val vibratorManager = - activity?.getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager - vibratorManager.defaultVibrator - } else { - @Suppress("DEPRECATION") - getSystemService(VIBRATOR_SERVICE) as Vibrator - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - v.vibrate(VibrationEffect.createOneShot(100, VibrationEffect.DEFAULT_AMPLITUDE)) - } else { - @Suppress("DEPRECATION") - v.vibrate(100) - } - } - - private fun doBiometricWork() { - biometricIsWorkOrNot(activity) { isWorking: Boolean,hasFingerprintLockAvailable:Boolean, message: String -> - if (isWorking){ - if (hasFingerprintLockAvailable){ - startBiometricScan() - showBioDialog() - }else{ - finish() - } - }else{ - finish() - } - } - } - - private fun startBiometricScan() { - val keyguardManager = getSystemService(KEYGUARD_SERVICE) as KeyguardManager - val fingerprintManager = getSystemService(FINGERPRINT_SERVICE) as FingerprintManager - if (!fingerprintManager.isHardwareDetected) { - println("mnb::fingerprint no HardwareDetected") - } else { - if (ActivityCompat.checkSelfPermission( - this, - Manifest.permission.USE_FINGERPRINT - ) != PackageManager.PERMISSION_GRANTED - ) { - println("mnb::fingerprint no permission") - } else { - if (!fingerprintManager.hasEnrolledFingerprints()) { - println("mnb::fingerprint no registered fingerprint") - } else { - if (!keyguardManager.isKeyguardSecure) { - println("mnb::fingerprint Lock screen security not enabled in Settings") - } else { - generateKey() - if (cipherInit()) { - val cryptoObject: FingerprintManager.CryptoObject? = - cipher?.let { FingerprintManager.CryptoObject(it) } - val helper = FingerprintHandler(activity) - helper.startAuth(fingerprintManager, cryptoObject) - } - } - } - } - } - } - - open fun cipherInit(): Boolean { - try { - cipher = - Cipher.getInstance(KeyProperties.KEY_ALGORITHM_AES + "/" + KeyProperties.BLOCK_MODE_CBC + "/" + KeyProperties.ENCRYPTION_PADDING_PKCS7) - } catch (e: NoSuchAlgorithmException) { - throw java.lang.RuntimeException("Failed to get Cipher", e) - } catch (e: NoSuchPaddingException) { - throw java.lang.RuntimeException("Failed to get Cipher", e) - } - return try { - keyStore?.load(null) - val key = keyStore?.getKey(keySoreName, null) as SecretKey - cipher?.init(Cipher.ENCRYPT_MODE, key) - true - } catch (e: Exception) { - when (e) { - is KeyPermanentlyInvalidatedException -> { - false - } - is KeyStoreException, is CertificateException, is UnrecoverableKeyException, is IOException, is NoSuchAlgorithmException, is InvalidKeyException -> { - throw java.lang.RuntimeException("Failed to init Cipher", e) - } - else -> { - false - } - } - } - } - - private fun generateKey() { - try { - keyStore = KeyStore.getInstance("AndroidKeyStore") - } catch (e: Exception) { - e.printStackTrace() - } - val keyGenerator: KeyGenerator = try { - KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore") - } catch (e: NoSuchAlgorithmException) { - throw RuntimeException("Failed to get KeyGenerator instance", e) - } catch (e: NoSuchProviderException) { - throw RuntimeException("Failed to get KeyGenerator instance", e) - } - try { - keyStore?.load(null) - keyGenerator.init( - KeyGenParameterSpec.Builder( - keySoreName, - KeyProperties.PURPOSE_ENCRYPT or - KeyProperties.PURPOSE_DECRYPT - ) - .setBlockModes(KeyProperties.BLOCK_MODE_CBC) - .setUserAuthenticationRequired(true) - .setEncryptionPaddings( - KeyProperties.ENCRYPTION_PADDING_PKCS7 - ) - .build() - ) - keyGenerator.generateKey() - } catch (e: NoSuchAlgorithmException) { - throw RuntimeException(e) - } catch (e: InvalidAlgorithmParameterException) { - throw RuntimeException(e) - } catch (e: CertificateException) { - throw RuntimeException(e) - } catch (e: IOException) { - throw RuntimeException(e) - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/base/BaseActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/base/BaseActivity.kt deleted file mode 100644 index a26149c..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/base/BaseActivity.kt +++ /dev/null @@ -1,45 +0,0 @@ -package com.example.infuxion_alternate.base - -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import android.view.View -import androidx.appcompat.app.AppCompatActivity -import com.example.infuxion_alternate.LoadingDialog -import com.example.infuxion_alternate.utils.BetterActivityResult -import com.example.infuxion_alternate.utils.LocationFetchUtil -import com.example.infuxion_alternate.utils.TinyDB - -abstract class BaseActivity : AppCompatActivity(), View.OnClickListener{ - - var activity: Activity?=null - var tinyDB: TinyDB?=null - var loader:LoadingDialog?=null - var locationFetchUtil : LocationFetchUtil?=null - val activityLauncher = BetterActivityResult.registerActivityForResult(this) - - protected abstract fun init() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - activity = this - tinyDB = TinyDB(this) - loader = LoadingDialog(this) - - init() - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - locationFetchUtil?.onActivityResult(requestCode, resultCode, data) - } - - override fun onRequestPermissionsResult( - requestCode: Int, - permissions: Array, - grantResults: IntArray - ) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - locationFetchUtil?.onRequestPermissionsResult(requestCode, permissions, grantResults) - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/dass.kt b/android/app/src/main/java/com/example/infuxion_alternate/dass.kt deleted file mode 100644 index e69de29..0000000 diff --git a/android/app/src/main/java/com/example/infuxion_alternate/extras/NoInternetConnection.kt b/android/app/src/main/java/com/example/infuxion_alternate/extras/NoInternetConnection.kt deleted file mode 100644 index daf431f..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/extras/NoInternetConnection.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.infuxion_alternate.extras - -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import com.example.infuxion_alternate.R - -class NoInternetConnection : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_no_internet_connection) - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/interface/AutoReadClickListener.kt b/android/app/src/main/java/com/example/infuxion_alternate/interface/AutoReadClickListener.kt deleted file mode 100644 index b5c06a2..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/interface/AutoReadClickListener.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.infuxion_alternate.`interface` - -interface AutoReadClickListener { - - fun onItemsClick(items:String?) -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/intro/FaceMlActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/intro/FaceMlActivity.kt deleted file mode 100644 index 4eedbff..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/intro/FaceMlActivity.kt +++ /dev/null @@ -1,135 +0,0 @@ -package com.example.infuxion_alternate.intro - -import android.Manifest -import android.annotation.SuppressLint -import android.content.pm.PackageManager -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.util.Log -import android.view.ViewGroup -import android.view.Window -import android.view.WindowManager -import android.widget.Toast -import androidx.camera.core.CameraSelector -import androidx.camera.core.ImageAnalysis -import androidx.camera.core.ImageCapture -import androidx.camera.core.Preview -import androidx.camera.lifecycle.ProcessCameraProvider -import androidx.camera.view.PreviewView -import androidx.core.app.ActivityCompat -import androidx.core.content.ContextCompat -import com.example.infuxion_alternate.FaceAnalyzer -import com.example.infuxion_alternate.Overlay -import com.example.infuxion_alternate.R - -import java.util.concurrent.Executors - -class FaceMlActivity : AppCompatActivity() { - - private lateinit var viewFinder: PreviewView - private lateinit var overlay: Overlay - private var cameraExecutor = Executors.newSingleThreadExecutor() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_face_ml) - supportActionBar?.hide() - - //Changing color of status bar - val window: Window = this@FaceMlActivity.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor(this@FaceMlActivity, R.color.white) - - viewFinder = findViewById(R.id.viewFinder) - - overlay = Overlay(this) - - val layoutOverlay = ViewGroup.LayoutParams( - - ViewGroup.LayoutParams.MATCH_PARENT, - - ViewGroup.LayoutParams.MATCH_PARENT - - ) - - this.addContentView(overlay,layoutOverlay) - - if (allPermissionsGranted()) { - startCamera() - } else { - ActivityCompat.requestPermissions( - this, REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS - ) - } - } - - override fun onRequestPermissionsResult( - requestCode: Int, permissions: Array, grantResults: - IntArray - ) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - if (requestCode == REQUEST_CODE_PERMISSIONS) { - if (allPermissionsGranted()) { - startCamera() - } else { - Toast.makeText(this, - "Permissions not granted by the user.", - Toast.LENGTH_SHORT).show() - finish() - } - } - } - - private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all { - ContextCompat.checkSelfPermission(baseContext, it) == PackageManager.PERMISSION_GRANTED - } - - @SuppressLint("UnsafeExperimentalUsageError") - private fun startCamera() - { - val cameraProviderFuture = ProcessCameraProvider.getInstance(this) - - cameraProviderFuture.addListener(Runnable { - // Used to bind the lifecycle of cameras to the lifecycle owner - val cameraProvider: ProcessCameraProvider = cameraProviderFuture.get() - // Select back camera as a default - val cameraSelector = CameraSelector.DEFAULT_FRONT_CAMERA - // Preview UseCase - val previewUseCase = Preview.Builder() - .build() - .also { - it.setSurfaceProvider(viewFinder.createSurfaceProvider()) - } - - val imageCapture = ImageCapture.Builder().build() - - // ImageAnalysis UseCase - val analysisUseCase = ImageAnalysis.Builder() - .build() - .also { - it.setAnalyzer(cameraExecutor, FaceAnalyzer(this,lifecycle,overlay )) - } - try { - // Unbind use cases before rebinding - cameraProvider.unbindAll() - - cameraProvider.bindToLifecycle(this,cameraSelector,previewUseCase,analysisUseCase) - // Bind use cases to camera - - } catch(exc: Exception) { - Log.e(TAG, "Use case binding failed", exc) - } - - }, ContextCompat.getMainExecutor(this)) - } - - companion object { - private const val TAG = "MainActivity" - private const val REQUEST_CODE_PERMISSIONS = 10 - private val REQUIRED_PERMISSIONS = arrayOf( - Manifest.permission.CAMERA, - ) - } - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/intro/SecurityActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/intro/SecurityActivity.kt deleted file mode 100644 index a337c0a..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/intro/SecurityActivity.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.example.infuxion_alternate.intro - -import android.app.Activity -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import com.example.infuxion_alternate.databinding.ActivitySecurityBinding - -class SecurityActivity : AppCompatActivity() { - - private var binding: ActivitySecurityBinding? = null - private var activity: Activity? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - binding = ActivitySecurityBinding.inflate(layoutInflater) - setContentView(binding?.root) - - - activity = this - overridePendingTransition(0, 0) - - init() - } - - - - private fun init() { - - binding?.apply { - activity?.let { activity-> - processFurther.setOnClickListener { -// startActivity(Intent(activity, AllowPermissions::class.java)) - } - } - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/intro/SplashActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/intro/SplashActivity.kt deleted file mode 100644 index 4eaeec9..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/intro/SplashActivity.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.example.infuxion_alternate.intro -import android.app.Activity -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.os.Handler -import android.os.Looper -import androidx.activity.result.contract.ActivityResultContracts -import com.example.infuxion_alternate.databinding.ActivitySplashBinding -import com.example.infuxion_alternate.utils.AppConstant -import com.example.infuxion_alternate.utils.MethodMaster -import com.example.infuxion_alternate.utils.TinyDB -import com.google.firebase.analytics.FirebaseAnalytics -import com.google.firebase.analytics.ktx.analytics -import com.google.firebase.ktx.Firebase - -class SplashActivity : AppCompatActivity() { - - private var binding: ActivitySplashBinding? = null - private var activity: Activity? = null - - private val sharedPrefFile = "tempPref" - private lateinit var firebaseAnalytics: FirebaseAnalytics - private var tinyDB: TinyDB? = null - - private var resultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> - if (result.resultCode == Activity.RESULT_OK) { - goToNextScreen() - } - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - binding = ActivitySplashBinding.inflate(layoutInflater) - setContentView(binding?.root) - supportActionBar?.hide() - - activity = this - tinyDB = TinyDB(this) - firebaseAnalytics = Firebase.analytics - - init() - } - - private fun init() { - Handler(Looper.getMainLooper()).postDelayed({ - tinyDB?.putBoolean(AppConstant.Prefs.SPLASH_COMPLETE_WATCH,true) - if (MethodMaster.checkLockIsEnable(tinyDB)){ - val intent = Intent(this, FaceMlActivity::class.java) - resultLauncher.launch(intent) - }else{ - goToNextScreen() - } - }, if (tinyDB?.getBoolean(AppConstant.Prefs.SPLASH_COMPLETE_WATCH)==true) 4000 else 6000) - } - - private fun goToNextScreen() { - - - val intent = Intent(this, FaceMlActivity::class.java) - startActivity(intent) - finish() - - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/intro/dashboard/DashbooardActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/intro/dashboard/DashbooardActivity.kt deleted file mode 100644 index 120f42f..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/intro/dashboard/DashbooardActivity.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.infuxion_alternate.intro.dashboard - - -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity -import com.example.infuxion_alternate.R -import com.example.infuxion_alternate.databinding.ActivitySplashBinding -import com.example.infuxion_alternate.utils.TinyDB -import com.google.firebase.analytics.ktx.analytics -import com.google.firebase.ktx.Firebase - -class DashbooardActivity : AppCompatActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_dashbooard) - - } - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/loan/LoanOfferReview.kt b/android/app/src/main/java/com/example/infuxion_alternate/loan/LoanOfferReview.kt deleted file mode 100644 index 7e5cbfb..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/loan/LoanOfferReview.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.example.infuxion_alternate.loan - -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.view.Window -import android.view.WindowManager -import android.widget.Button -import androidx.core.content.ContextCompat -import com.example.infuxion_alternate.R -import com.example.infuxion_alternate.Sanction - -class LoanOfferReview : AppCompatActivity() { - lateinit var btnNext : Button - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_loan_offer_review) - supportActionBar?.hide() - - //Changing color of status bar - val window: Window = this@LoanOfferReview.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor(this@LoanOfferReview, R.color.white) - - //To Sanction - btnNext = findViewById(R.id.btnNext) - btnNext.setOnClickListener() { - var intent = Intent(this, Sanction::class.java) - startActivity(intent) - } - - } -} diff --git a/android/app/src/main/java/com/example/infuxion_alternate/loan/LoanOffers.kt b/android/app/src/main/java/com/example/infuxion_alternate/loan/LoanOffers.kt deleted file mode 100644 index 73764ae..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/loan/LoanOffers.kt +++ /dev/null @@ -1,59 +0,0 @@ -package com.example.infuxion_alternate.loan - -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.view.Window -import android.view.WindowManager -import android.widget.ArrayAdapter -import android.widget.Button -import android.widget.Spinner -import androidx.core.content.ContextCompat -import com.example.infuxion_alternate.R - -class LoanOffers : AppCompatActivity() { - - lateinit var spLoanOffer: Spinner - lateinit var spInterest: Spinner - lateinit var btnNext: Button - - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_loan_offers) - - //Changing color of status bar - val window: Window = this@LoanOffers.window - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) - window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) - window.statusBarColor = ContextCompat.getColor(this@LoanOffers, R.color.white) - - spLoanOffer = findViewById(R.id.spLoanOffer) - val options = listOf("₹3000") -// val loanAm = arrayOf() - val arrayAdapter: ArrayAdapter = - ArrayAdapter(this, R.layout.spinnner_itemlist, options) - - arrayAdapter.setDropDownViewResource(R.layout.spinnner_itemlist) - spLoanOffer.adapter = arrayAdapter - - - spInterest = findViewById(R.id.spInterest) - val loanIn = arrayOf( - "a% for 4W, b% for 4W, and c% for 5W", - "x% for 4W, y% for 4W, and z% for 5W" - ) - val arrAdapter: ArrayAdapter = - ArrayAdapter(this, R.layout.spinnner_itemlist, loanIn) - arrAdapter.setDropDownViewResource(R.layout.spinner_loan_interest_items) - spInterest.adapter = arrAdapter - - btnNext = findViewById(R.id.btnNext) - - //To Loan Review - btnNext.setOnClickListener() { - val intent = Intent(this, LoanOfferReview::class.java) - startActivity(intent) - } - } -} diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/AppModel.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/AppModel.kt deleted file mode 100644 index 72b3901..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/AppModel.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.infuxion_alternate.model - -data class AppModel(val appName: String) \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/ContactModel.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/ContactModel.kt deleted file mode 100644 index 30d954a..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/ContactModel.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.infuxion_alternate.model - -data class ContactModel(/*val id: String, */val name: String, val phone: String) \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/CreateUserRequest.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/CreateUserRequest.kt deleted file mode 100644 index ca7986b..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/CreateUserRequest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.example.infuxion_alternate.model - -data class CreateUserRequest( - var firstName : String? = null, - var middleName : String? = null, - var lastName : String? = null, - var email : String? = null, - var phone : String? = null, - var fatherName : String? = null, - var dob : String? = null, - var location : String? = null, - var imei : String? = null, - var tempId : String? = null, - var gender : String? = null, -) - - diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/CreateUserResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/CreateUserResponse.kt deleted file mode 100644 index 5c3aa82..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/CreateUserResponse.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.example.infuxion_alternate.model - -import java.util.* - -data class CreateUserResponse( - val regId: String?, - val statusId:Int? - -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/ImageRequest.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/ImageRequest.kt deleted file mode 100644 index 8acd189..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/ImageRequest.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.example.infuxion_alternate.model - -import retrofit2.http.Part - -data class ImageRequest( - var img : Part? = null, - -) - - diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/ImageResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/ImageResponse.kt deleted file mode 100644 index d52ab97..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/ImageResponse.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.example.infuxion_alternate.model - -import java.util.* - -data class ImageResponse( - val message:String?, - -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/ImeiRequest.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/ImeiRequest.kt deleted file mode 100644 index 5d74b6d..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/ImeiRequest.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.example.infuxion_alternate.model - -data class ImeiRequest( - val imei: String?, -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/ImeiResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/ImeiResponse.kt deleted file mode 100644 index 3834d1d..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/ImeiResponse.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.example.infuxion_alternate.model - -data class ImeiResponse( - val userId: String?, - val statusId: Int?, - val tempId: String?, - val imei: String?, -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/KycResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/KycResponse.kt deleted file mode 100644 index 4518783..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/KycResponse.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.infuxion_alternate.model - -data class KycResponse(val success: Boolean?,) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/PPRequest.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/PPRequest.kt deleted file mode 100644 index 6b85d9d..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/PPRequest.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.infuxion_alternate.model - -data class PPRequest( - val tempId: String?, - val PP: Boolean?, -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/PPResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/PPResponse.kt deleted file mode 100644 index 430e9c3..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/PPResponse.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.infuxion_alternate.model - -data class PPResponse( - val message: String?, - -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/PanResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/PanResponse.kt deleted file mode 100644 index 29976f3..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/PanResponse.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.example.infuxion_alternate.model - -import java.util.* - -data class PanResponse(val success: Boolean?,) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/PermissionRequest.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/PermissionRequest.kt deleted file mode 100644 index ffdd8e7..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/PermissionRequest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.infuxion_alternate.model - -data class PermissionRequest( - val tempId: String?, - val imei: String?, - val isLocationGranted: Boolean?, - val isContactsGranted: Boolean?, - val isReadSmsGranted: Boolean?, - val isAudioGranted: Boolean?, - val isCameraGranted: Boolean?, - val PP: Boolean?, - val TNC: Boolean?, - val contacts : List?, - val financialSMS: List?, - val financialAppsInstalled: List?, -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/PermissionResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/PermissionResponse.kt deleted file mode 100644 index d31807b..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/PermissionResponse.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.infuxion_alternate.model - -data class PermissionResponse( - val message: String?, - -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/RegEmail.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/RegEmail.kt deleted file mode 100644 index 52f1611..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/RegEmail.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.example.infuxion_alternate.model - -data class RegEmail( - val message: String?, - val statusId:Int?, - val email:String?, - val otp:String? -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/RegEmailBody.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/RegEmailBody.kt deleted file mode 100644 index e90315c..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/RegEmailBody.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.example.infuxion_alternate.model - -data class RegEmailBody ( - val email:String -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/RegPhone.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/RegPhone.kt deleted file mode 100644 index 1546322..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/RegPhone.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.example.infuxion_alternate.model - -data class RegPhone( - val message: String?, - val statusId:Int?, - val phone:String? -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/RegPhoneBody.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/RegPhoneBody.kt deleted file mode 100644 index 22e4588..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/RegPhoneBody.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.example.infuxion_alternate.model - -data class RegPhoneBody ( - val phone:String -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/SmsModel.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/SmsModel.kt deleted file mode 100644 index ca4df63..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/SmsModel.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.infuxion_alternate.model - -data class SmsModel(/*val id:String, val threadId:String, val phoneNumber: String,*/ val body: String /*, val readState: String, val timestamp: String, val type:String*/) \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/TNCRequest.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/TNCRequest.kt deleted file mode 100644 index 709c583..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/TNCRequest.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.infuxion_alternate.model - -data class TNCRequest( - val tempId: String?, - val TNC: Boolean?, -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/model/TNCResponse.kt b/android/app/src/main/java/com/example/infuxion_alternate/model/TNCResponse.kt deleted file mode 100644 index f05fd04..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/model/TNCResponse.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.example.infuxion_alternate.model - -data class TNCResponse( - val message: String?, -) diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/AppConstant.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/AppConstant.kt deleted file mode 100644 index 7d68008..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/AppConstant.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.example.infuxion_alternate.utils - -class AppConstant { - - object DefaultValue { - const val DEFAULT_LATITUDE = 00.000000 - const val DEFAULT_LONGITUDE = 00.000000 - } - - object BundleData { - const val PIN_MESSAGE = "pin_message" - const val CREATE_NEW_PIN = "create_new_pin" - const val IS_FROM = "is_from" - const val IS_FROM_SPLASH = "is_from_splash" - } - - object Prefs { - const val SHOW_PIN_LOCK = "show_pin_lock" - const val PIN_PASSWORD = "pin_password" - const val SPLASH_COMPLETE_WATCH = "splash_complete_watch" - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/BetterActivityResult.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/BetterActivityResult.kt deleted file mode 100644 index c2b0643..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/BetterActivityResult.kt +++ /dev/null @@ -1,77 +0,0 @@ -package com.example.infuxion_alternate.utils - -import androidx.activity.result.ActivityResultCaller -import androidx.activity.result.contract.ActivityResultContract -import androidx.activity.result.ActivityResultLauncher -import kotlin.jvm.JvmOverloads -import android.content.Intent -import androidx.activity.result.ActivityResult -import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult -import androidx.core.app.ActivityOptionsCompat - -class BetterActivityResult private constructor( - caller : ActivityResultCaller, - contract : ActivityResultContract, - var onActivityResult : ((Result) -> Unit)?, -) { - - private val launcher : ActivityResultLauncher = - caller.registerForActivityResult(contract) { onActivityResult?.invoke(it) } - - /** - * Launch activity, same as [ActivityResultLauncher.launch] except that it - * allows a callback - * executed after receiving a result from the target activity. - */ - /** - * Same as [.launch] with last parameter set to `null`. - */ - @JvmOverloads - fun launch( - input : Input, - animation: ActivityOptionsCompat?= null, - onActivityResult : ((Result) -> Unit)? = this.onActivityResult, - ) { - this.onActivityResult = onActivityResult - if (animation != null) - launcher.launch(input,animation) - else - launcher.launch(input) - } - - companion object { - /**1 - * Register activity result using a [ActivityResultContract] and an in-place - * activity result callback like - * the default approach. You can still customise callback using [.launch]. - */ - fun registerForActivityResult( - caller : ActivityResultCaller, - contract : ActivityResultContract, - onActivityResult : ((Result) -> Unit)?, - ) : BetterActivityResult { - return BetterActivityResult(caller, contract, onActivityResult) - } - - /** - * Same as [.registerForActivityResult] except - * the last argument is set to `null`. - */ - fun registerForActivityResult( - caller : ActivityResultCaller, - contract : ActivityResultContract, - ) : BetterActivityResult { - return registerForActivityResult(caller, contract, null) - } - - /** - * Specialised method for launching new activities. - */ - @JvmStatic - fun registerActivityForResult( - caller : ActivityResultCaller, - ) : BetterActivityResult { - return registerForActivityResult(caller, StartActivityForResult()) - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/CameraActivity.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/CameraActivity.kt deleted file mode 100644 index cb75ded..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/CameraActivity.kt +++ /dev/null @@ -1,121 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.app.Activity -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle -import android.os.Handler -import android.os.Looper -import android.util.Log -import android.view.WindowManager -import android.widget.Toast -import androidx.camera.core.* -import androidx.camera.lifecycle.ProcessCameraProvider -import androidx.core.content.ContextCompat -import com.example.infuxion_alternate.intro.dashboard.DashbooardActivity -import com.example.infuxion_alternate.databinding.ActivityCameraBinding -import java.io.File -import java.util.concurrent.Executors - -class CameraActivity : AppCompatActivity() { - - private var binding: ActivityCameraBinding? = null - private var activity: Activity?=null - private var TAG="CameraActivity" - private lateinit var photoFilePath: String - private var imageCapture: ImageCapture? = null - - private var cameraExecutor = Executors.newSingleThreadExecutor() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - binding = ActivityCameraBinding.inflate(layoutInflater) - setContentView(binding?.root) - overridePendingTransition(0, 0) - - window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) - - activity = this - - init() - } - - private fun init() { - binding?.apply { - activity?.let { - cameraExecutor = Executors.newSingleThreadExecutor() - - imgCaptureBtn.setOnClickListener{ - takePhoto() - } - - startCamera() - } - } - } - - private fun startCamera() { - val cameraProviderFuture = ProcessCameraProvider.getInstance(this) - imageCapture = ImageCapture.Builder().setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY).setFlashMode(ImageCapture.FLASH_MODE_AUTO)/*.setTargetResolution(Size(1200, 1600))*/.build() - cameraProviderFuture.addListener({ - val cameraProvider: ProcessCameraProvider = cameraProviderFuture.get() - val cameraSelector = CameraSelector.DEFAULT_FRONT_CAMERA - val previewUseCase = Preview.Builder().build() - .also { - it.setSurfaceProvider(binding?.viewFinder?.createSurfaceProvider()) - } - try { - cameraProvider.unbindAll() - cameraProvider.bindToLifecycle(this,cameraSelector,previewUseCase,imageCapture) - - } catch(exc: Exception) { - Log.e(TAG, "startCamera failed", exc) - } - - }, ContextCompat.getMainExecutor(this)) - } - - private fun takePhoto(){ - imageCapture?.let{ - val fileName = "JPEG_${System.currentTimeMillis()}.jpg" - val file = File(externalMediaDirs[0],fileName) - val outputFileOptions = ImageCapture.OutputFileOptions.Builder(file).build() - it.takePicture( - outputFileOptions, - cameraExecutor, - object : ImageCapture.OnImageSavedCallback { - -// override fun onImageSaved(outputFileResults: ImageCapture.OutputFileResults){ -// Log.i(TAG,"The image has been saved in ${file.toUri()}") -//// runOnUiThread{ -//// Toast.makeText(activity, "Photo Store in :-${file.absolutePath}", Toast.LENGTH_LONG).show() -//// } -// Handler(Looper.getMainLooper()).postDelayed({ -// // todo (Store profile image in API) -// val intent = Intent(activity, ReviewRegisterDetails::class.java) -// startActivity(intent) -// },2000) -// } - - override fun onImageSaved(outputFileResults: ImageCapture.OutputFileResults) { - photoFilePath = file.absolutePath - Log.i(TAG, "The image has been saved in $photoFilePath") - Handler(Looper.getMainLooper()).postDelayed({ - // Store the photoFilePath in a shared preference or pass it to the next activity - val intent = Intent(activity, DashbooardActivity::class.java) - intent.putExtra("photoPath", photoFilePath) - startActivity(intent) - }, 2000) - } - - override fun onError(exception: ImageCaptureException) { - Log.d(TAG, "Error taking photo:$exception") - runOnUiThread { - Toast.makeText(activity, "Error taking photo", Toast.LENGTH_LONG).show() - } - } - - }) - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/CircleImageView.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/CircleImageView.kt deleted file mode 100644 index 41cbf43..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/CircleImageView.kt +++ /dev/null @@ -1,428 +0,0 @@ -package com.example.infuxion_alternate.utils - -import androidx.appcompat.widget.AppCompatImageView -import kotlin.jvm.JvmOverloads -import android.os.Build -import android.annotation.SuppressLint -import android.content.Context -import android.graphics.* -import android.graphics.drawable.Drawable -import androidx.annotation.ColorRes -import androidx.annotation.DrawableRes -import android.graphics.drawable.BitmapDrawable -import android.graphics.drawable.ColorDrawable -import android.net.Uri -import android.util.AttributeSet -import android.view.MotionEvent -import android.view.View -import androidx.annotation.RequiresApi -import android.view.ViewOutlineProvider -import com.example.infuxion_alternate.R -import java.lang.Exception - -class CircleImageView : AppCompatImageView { - private val mDrawableRect = RectF() - private val mBorderRect = RectF() - private val mShaderMatrix = Matrix() - private val mBitmapPaint = Paint() - private val mBorderPaint = Paint() - private val mCircleBackgroundPaint = Paint() - private var mBorderColor = DEFAULT_BORDER_COLOR - private var mBorderWidth = DEFAULT_BORDER_WIDTH - private var mCircleBackgroundColor = DEFAULT_CIRCLE_BACKGROUND_COLOR - private var mImageAlpha = DEFAULT_IMAGE_ALPHA - private var mBitmap: Bitmap? = null - private var mBitmapCanvas: Canvas? = null - private var mDrawableRadius = 0f - private var mBorderRadius = 0f - private var mColorFilter: ColorFilter? = null - private var mInitialized = false - private var mRebuildShader = false - private var mDrawableDirty = false - private var mBorderOverlay = false - private var mDisableCircularTransformation = false - - constructor(context: Context?) : super(context!!) { - init() - } - - @JvmOverloads - constructor(context: Context, attrs: AttributeSet?, defStyle: Int = 0) : super( - context, - attrs, - defStyle - ) { - val a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0) - mBorderWidth = a.getDimensionPixelSize( - R.styleable.CircleImageView_civ_border_width, - DEFAULT_BORDER_WIDTH - ) - mBorderColor = - a.getColor(R.styleable.CircleImageView_civ_border_color, DEFAULT_BORDER_COLOR) - mBorderOverlay = - a.getBoolean(R.styleable.CircleImageView_civ_border_overlay, DEFAULT_BORDER_OVERLAY) - mCircleBackgroundColor = a.getColor( - R.styleable.CircleImageView_civ_circle_background_color, - DEFAULT_CIRCLE_BACKGROUND_COLOR - ) - a.recycle() - init() - } - - private fun init() { - mInitialized = true - super.setScaleType(SCALE_TYPE) - mBitmapPaint.isAntiAlias = true - mBitmapPaint.isDither = true - mBitmapPaint.isFilterBitmap = true - mBitmapPaint.alpha = mImageAlpha - mBitmapPaint.colorFilter = mColorFilter - mBorderPaint.style = Paint.Style.STROKE - mBorderPaint.isAntiAlias = true - mBorderPaint.color = mBorderColor - mBorderPaint.strokeWidth = mBorderWidth.toFloat() - mCircleBackgroundPaint.style = Paint.Style.FILL - mCircleBackgroundPaint.isAntiAlias = true - mCircleBackgroundPaint.color = mCircleBackgroundColor - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - outlineProvider = OutlineProvider() - } - } - - override fun setScaleType(scaleType: ScaleType) { - require(scaleType == SCALE_TYPE) { String.format("ScaleType %s not supported.", scaleType) } - } - - override fun setAdjustViewBounds(adjustViewBounds: Boolean) { - require(!adjustViewBounds) { "adjustViewBounds not supported." } - } - - @SuppressLint("CanvasSize") - override fun onDraw(canvas: Canvas) { - if (mDisableCircularTransformation) { - super.onDraw(canvas) - return - } - if (mCircleBackgroundColor != Color.TRANSPARENT) { - canvas.drawCircle( - mDrawableRect.centerX(), - mDrawableRect.centerY(), - mDrawableRadius, - mCircleBackgroundPaint - ) - } - if (mBitmap != null) { - if (mDrawableDirty && mBitmapCanvas != null) { - mDrawableDirty = false - val drawable = drawable - drawable.setBounds(0, 0, mBitmapCanvas!!.width, mBitmapCanvas!!.height) - drawable.draw(mBitmapCanvas!!) - } - if (mRebuildShader) { - mRebuildShader = false - val bitmapShader = - BitmapShader(mBitmap!!, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP) - bitmapShader.setLocalMatrix(mShaderMatrix) - mBitmapPaint.shader = bitmapShader - } - canvas.drawCircle( - mDrawableRect.centerX(), - mDrawableRect.centerY(), - mDrawableRadius, - mBitmapPaint - ) - } - if (mBorderWidth > 0) { - canvas.drawCircle( - mBorderRect.centerX(), - mBorderRect.centerY(), - mBorderRadius, - mBorderPaint - ) - } - } - - override fun invalidateDrawable(dr: Drawable) { - mDrawableDirty = true - invalidate() - } - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - updateDimensions() - invalidate() - } - - override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) { - super.setPadding(left, top, right, bottom) - updateDimensions() - invalidate() - } - - override fun setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int) { - super.setPaddingRelative(start, top, end, bottom) - updateDimensions() - invalidate() - } - - var borderColor: Int - get() = mBorderColor - set(borderColor) { - if (borderColor == mBorderColor) { - return - } - mBorderColor = borderColor - mBorderPaint.color = borderColor - invalidate() - } - var circleBackgroundColor: Int - get() = mCircleBackgroundColor - set(circleBackgroundColor) { - if (circleBackgroundColor == mCircleBackgroundColor) { - return - } - mCircleBackgroundColor = circleBackgroundColor - mCircleBackgroundPaint.color = circleBackgroundColor - invalidate() - } - - @Deprecated("Use {@link #setCircleBackgroundColor(int)} instead") - fun setCircleBackgroundColorResource(@ColorRes circleBackgroundRes: Int) { - circleBackgroundColor = context.resources.getColor(circleBackgroundRes) - } - - var borderWidth: Int - get() = mBorderWidth - set(borderWidth) { - if (borderWidth == mBorderWidth) { - return - } - mBorderWidth = borderWidth - mBorderPaint.strokeWidth = borderWidth.toFloat() - updateDimensions() - invalidate() - } - var isBorderOverlay: Boolean - get() = mBorderOverlay - set(borderOverlay) { - if (borderOverlay == mBorderOverlay) { - return - } - mBorderOverlay = borderOverlay - updateDimensions() - invalidate() - } - var isDisableCircularTransformation: Boolean - get() = mDisableCircularTransformation - set(disableCircularTransformation) { - if (disableCircularTransformation == mDisableCircularTransformation) { - return - } - mDisableCircularTransformation = disableCircularTransformation - if (disableCircularTransformation) { - mBitmap = null - mBitmapCanvas = null - mBitmapPaint.shader = null - } else { - initializeBitmap() - } - invalidate() - } - - override fun setImageBitmap(bm: Bitmap) { - super.setImageBitmap(bm) - initializeBitmap() - invalidate() - } - - override fun setImageDrawable(drawable: Drawable?) { - super.setImageDrawable(drawable) - initializeBitmap() - invalidate() - } - - override fun setImageResource(@DrawableRes resId: Int) { - super.setImageResource(resId) - initializeBitmap() - invalidate() - } - - override fun setImageURI(uri: Uri?) { - super.setImageURI(uri) - initializeBitmap() - invalidate() - } - - override fun setImageAlpha(alpha: Int) { - var alpha = alpha - alpha = alpha and 0xFF - if (alpha == mImageAlpha) { - return - } - mImageAlpha = alpha - - // This might be called during ImageView construction before - // member initialization has finished on API level >= 16. - if (mInitialized) { - mBitmapPaint.alpha = alpha - invalidate() - } - } - - override fun getImageAlpha(): Int { - return mImageAlpha - } - - override fun setColorFilter(cf: ColorFilter) { - if (cf === mColorFilter) { - return - } - mColorFilter = cf - - // This might be called during ImageView construction before - // member initialization has finished on API level <= 19. - if (mInitialized) { - mBitmapPaint.colorFilter = cf - invalidate() - } - } - - override fun getColorFilter(): ColorFilter { - return mColorFilter!! - } - - private fun getBitmapFromDrawable(drawable: Drawable?): Bitmap? { - if (drawable == null) { - return null - } - return if (drawable is BitmapDrawable) { - drawable.bitmap - } else try { - val bitmap: Bitmap - bitmap = if (drawable is ColorDrawable) { - Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG) - } else { - Bitmap.createBitmap( - drawable.intrinsicWidth, - drawable.intrinsicHeight, - BITMAP_CONFIG - ) - } - val canvas = Canvas(bitmap) - drawable.setBounds(0, 0, canvas.width, canvas.height) - drawable.draw(canvas) - bitmap - } catch (e: Exception) { - e.printStackTrace() - null - } - } - - private fun initializeBitmap() { - mBitmap = getBitmapFromDrawable(drawable) - mBitmapCanvas = if (mBitmap != null && mBitmap!!.isMutable) { - Canvas(mBitmap!!) - } else { - null - } - if (!mInitialized) { - return - } - if (mBitmap != null) { - updateShaderMatrix() - } else { - mBitmapPaint.shader = null - } - } - - private fun updateDimensions() { - mBorderRect.set(calculateBounds()) - mBorderRadius = Math.min( - (mBorderRect.height() - mBorderWidth) / 2.0f, - (mBorderRect.width() - mBorderWidth) / 2.0f - ) - mDrawableRect.set(mBorderRect) - if (!mBorderOverlay && mBorderWidth > 0) { - mDrawableRect.inset(mBorderWidth - 1.0f, mBorderWidth - 1.0f) - } - mDrawableRadius = Math.min(mDrawableRect.height() / 2.0f, mDrawableRect.width() / 2.0f) - updateShaderMatrix() - } - - private fun calculateBounds(): RectF { - val availableWidth = width - paddingLeft - paddingRight - val availableHeight = height - paddingTop - paddingBottom - val sideLength = Math.min(availableWidth, availableHeight) - val left = paddingLeft + (availableWidth - sideLength) / 2f - val top = paddingTop + (availableHeight - sideLength) / 2f - return RectF(left, top, left + sideLength, top + sideLength) - } - - private fun updateShaderMatrix() { - if (mBitmap == null) { - return - } - val scale: Float - var dx = 0f - var dy = 0f - mShaderMatrix.set(null) - val bitmapHeight = mBitmap!!.height - val bitmapWidth = mBitmap!!.width - if (bitmapWidth * mDrawableRect.height() > mDrawableRect.width() * bitmapHeight) { - scale = mDrawableRect.height() / bitmapHeight.toFloat() - dx = (mDrawableRect.width() - bitmapWidth * scale) * 0.5f - } else { - scale = mDrawableRect.width() / bitmapWidth.toFloat() - dy = (mDrawableRect.height() - bitmapHeight * scale) * 0.5f - } - mShaderMatrix.setScale(scale, scale) - mShaderMatrix.postTranslate( - (dx + 0.5f).toInt() + mDrawableRect.left, - (dy + 0.5f).toInt() + mDrawableRect.top - ) - mRebuildShader = true - } - - @SuppressLint("ClickableViewAccessibility") - override fun onTouchEvent(event: MotionEvent): Boolean { - return if (mDisableCircularTransformation) { - super.onTouchEvent(event) - } else inTouchableArea(event.x, event.y) && super.onTouchEvent(event) - } - - private fun inTouchableArea(x: Float, y: Float): Boolean { - return if (mBorderRect.isEmpty) { - true - } else Math.pow( - (x - mBorderRect.centerX()).toDouble(), - 2.0 - ) + Math.pow((y - mBorderRect.centerY()).toDouble(), 2.0) <= Math.pow( - mBorderRadius.toDouble(), - 2.0 - ) - } - - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) - private inner class OutlineProvider : ViewOutlineProvider() { - override fun getOutline(view: View, outline: Outline) { - if (mDisableCircularTransformation) { - BACKGROUND.getOutline(view, outline) - } else { - val bounds = Rect() - mBorderRect.roundOut(bounds) - outline.setRoundRect(bounds, bounds.width() / 2.0f) - } - } - } - - companion object { - private val SCALE_TYPE = ScaleType.CENTER_CROP - private val BITMAP_CONFIG = Bitmap.Config.ARGB_8888 - private const val COLORDRAWABLE_DIMENSION = 2 - private const val DEFAULT_BORDER_WIDTH = 0 - private const val DEFAULT_BORDER_COLOR = Color.BLACK - private const val DEFAULT_CIRCLE_BACKGROUND_COLOR = Color.TRANSPARENT - private const val DEFAULT_IMAGE_ALPHA = 255 - private const val DEFAULT_BORDER_OVERLAY = false - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/Constants.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/Constants.kt deleted file mode 100644 index c1c4b74..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/Constants.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.example.infuxion_alternate.utils -class Constants { - - companion object { - const val baseUrl = "http://infuxion.finance" - } - - -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/FileUtil.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/FileUtil.kt deleted file mode 100644 index dae3a5b..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/FileUtil.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.content.Context -import android.os.Build -import android.os.Environment -import android.util.Log -import com.example.infuxion_alternate.R -import java.io.File - -object FileUtil { - - /** - * compress image path - */ - @JvmStatic - fun getDestinationCompressImageFilePath(context: Context?, file: File): File? { - val compressImageSave: File - val path= context?.resources?.getString(R.string.app_name)+"/" + "CompressImage" + "/" +"Image_" + System.currentTimeMillis() +"."+ file.extension - val parent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) - context?.getExternalFilesDir(Environment.DIRECTORY_PICTURES) - else - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) - - compressImageSave = File(parent, path) - - if (!compressImageSave.exists()) { - if (!compressImageSave.mkdirs()) { - Log.d("DestinationCompressPath", "Failed to create directory") - return null - } - } - - Log.d("DestinationCompressPath", compressImageSave.toString()) - return compressImageSave - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/FingerprintHandler.java b/android/app/src/main/java/com/example/infuxion_alternate/utils/FingerprintHandler.java deleted file mode 100644 index 06b660f..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/FingerprintHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.example.infuxion_alternate.utils; - -import android.Manifest; -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.pm.PackageManager; -import android.hardware.fingerprint.FingerprintManager; -import android.os.CancellationSignal; - -import com.example.infuxion_alternate.app_lock.PinLockActivity; - -import androidx.core.app.ActivityCompat; - -@SuppressLint("NewApi") -public class FingerprintHandler extends FingerprintManager.AuthenticationCallback { - - Context context; - - public FingerprintHandler(Context context) { - this.context = context; - } - - public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) { - CancellationSignal cancellationSignal = new CancellationSignal(); - if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) { - return; - } - manager.authenticate(cryptoObject, cancellationSignal, 0, this, null); - } - - @Override - public void onAuthenticationError(int errMsgId, CharSequence errString) { - this.update("Fingerprint Authentication error\n" + errString, false); - } - - @Override - public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { - this.update("Fingerprint Authentication help\n" + helpString, false); - } - - @Override - public void onAuthenticationFailed() { - this.update("Fingerprint Authentication failed.", false); - } - - @Override - public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) { - this.update("Fingerprint Authentication succeeded.", true); - } - - public void update(String e, Boolean success) { - ((PinLockActivity) context).fingerScanResult(e, success); - } -} diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/LocationUtil.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/LocationUtil.kt deleted file mode 100644 index 6e004a0..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/LocationUtil.kt +++ /dev/null @@ -1,260 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.Manifest -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.content.IntentSender -import android.content.pm.PackageManager -import android.location.* -import android.os.Looper -import androidx.core.app.ActivityCompat -import androidx.core.content.ContextCompat -import androidx.fragment.app.Fragment -import com.example.infuxion_alternate.utils.AppConstant.DefaultValue.DEFAULT_LATITUDE -import com.example.infuxion_alternate.utils.AppConstant.DefaultValue.DEFAULT_LONGITUDE -import com.google.android.gms.common.api.ResolvableApiException -import com.google.android.gms.location.* -import com.google.android.gms.location.LocationRequest -import com.google.android.gms.tasks.Task -import java.lang.ref.WeakReference -import java.util.* - -private var TAG = "LocationUtil" - -data class LatLng(var latitude: Double, var longitude: Double) - -@SuppressLint("MissingPermission") -class LocationFetchUtil( - private val activity: Activity, - private val fragment: Fragment? = null, - private val shouldRequestPermissions: Boolean=false, - private val shouldRequestOptimization: Boolean=false, - private val callbacks: Callbacks -) { - private val nwUtil:NetworkUtil = NetworkUtil - private var activityWeakReference = WeakReference(activity) - private var locationCallback: LocationCallback? = null - private var fusedLocationClient: FusedLocationProviderClient? = null - private val requestCheckSettings = 1111 - private val requestLocation = 1112 - val defaultLocation:Location= Location(LocationManager.NETWORK_PROVIDER).apply { - this.latitude = DEFAULT_LATITUDE - this.longitude = DEFAULT_LONGITUDE - } - - interface Callbacks { - fun onSuccess(location: Location) - fun onFailed(locationFailedEnum: LocationFailedEnum,defaultLocation:Location) - } - - enum class LocationFailedEnum { - DeviceInFlightMode, - LocationPermissionNotGranted, - LocationOptimizationPermissionNotGranted, - HighPrecisionNA_TryAgainPreferablyWithInternet - } - - init { - //try to get last available location, if it matches our precision level - fusedLocationClient = activity.let { LocationServices.getFusedLocationProviderClient(it) } - val task = fusedLocationClient?.lastLocation - - task?.addOnSuccessListener { location: Location? -> - if (location != null) { - callbacks.onSuccess(location) - } else { - onLastLocationFailed() - } - } - task?.addOnFailureListener { - onLastLocationFailed() - } - } - - private fun onLastLocationFailed() { - locationCallback = object : LocationCallback() { - override fun onLocationResult(locationResult: LocationResult) { - locationResult.lastLocation?.let { callbacks.onSuccess(it) } - locationCallback?.let { fusedLocationClient?.removeLocationUpdates(it) } - } - - @SuppressLint("MissingPermission") - override fun onLocationAvailability(locationAvailability: LocationAvailability) { - super.onLocationAvailability(locationAvailability) - if (!locationAvailability.isLocationAvailable) { - callbacks.onFailed(LocationFailedEnum.HighPrecisionNA_TryAgainPreferablyWithInternet,defaultLocation) - locationCallback?.let { fusedLocationClient?.removeLocationUpdates(it) } - } - } - } - - if (activityWeakReference.get() == null) - return - if (nwUtil.isInFlightMode(activity)) - callbacks.onFailed(LocationFailedEnum.DeviceInFlightMode,defaultLocation) - else { - val permissions = ArrayList() - permissions.add(Manifest.permission.ACCESS_FINE_LOCATION) - permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION) - var permissionGranted = true - for (permission in permissions) { - if (ContextCompat.checkSelfPermission( - activityWeakReference.get() as Activity, - permission - ) != PackageManager.PERMISSION_GRANTED - ) { - permissionGranted = false - break - } - } - if (!permissionGranted) { - if (shouldRequestPermissions) { - val permissionsArgs = permissions.toTypedArray() - if (fragment != null) - fragment.requestPermissions( - permissionsArgs, - requestLocation - ) - else - ActivityCompat.requestPermissions( - activityWeakReference.get() as Activity, - permissionsArgs, - requestLocation - ) - } else { - callbacks.onFailed(LocationFailedEnum.LocationPermissionNotGranted,defaultLocation) - } - } else { - getLocation() - } - } - } - - fun onRequestPermissionsResult( - requestCode: Int, - permissions: Array, - grantResults: IntArray - ) { - - if (activityWeakReference.get() == null) { - return - } - - if (requestCode == requestLocation) { - if (grantResults.isEmpty()) { - callbacks.onFailed(LocationFailedEnum.LocationPermissionNotGranted,defaultLocation) - return - } - - var granted = true - for (grantResult in grantResults) { - if (grantResult != PackageManager.PERMISSION_GRANTED) { - granted = false - break - } - } - if (granted) { - getLocation() - } else { - callbacks.onFailed(LocationFailedEnum.LocationPermissionNotGranted,defaultLocation) - } - } - } - - @SuppressLint("MissingPermission") - private fun getLocation() { - - if (activityWeakReference.get() == null) { - return - } - - val locationRequest: LocationRequest = LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY,10000).setMaxUpdates(1).build() - - val task: Task = - (LocationServices.getSettingsClient(activityWeakReference.get() as Activity)) - .checkLocationSettings( - (LocationSettingsRequest.Builder().addLocationRequest( - locationRequest - )).build() - ) - - task.addOnSuccessListener { - locationCallback?.let { - fusedLocationClient?.requestLocationUpdates( - locationRequest, - it, - Looper.myLooper() - ) - } - } - - task.addOnFailureListener { exception -> - if (exception is ResolvableApiException) { - if (activityWeakReference.get() == null) { - return@addOnFailureListener - } - try { - if (shouldRequestOptimization) { - if (fragment != null) - activity.startIntentSenderForResult( - exception.resolution.intentSender, - requestCheckSettings, - null, - 0, - 0, - 0, - null - ) - else - exception.startResolutionForResult( - activityWeakReference.get() as Activity, - requestCheckSettings - ) - } else { - callbacks.onFailed(LocationFailedEnum.LocationOptimizationPermissionNotGranted,defaultLocation) - } - } catch (sendEx: IntentSender.SendIntentException) { - //ignore the error - } - } - } - } - - fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (activityWeakReference.get() == null) { - return - } - - if (requestCode == requestCheckSettings) { - if (resultCode == Activity.RESULT_OK) { - getLocation() - } else { - val locationManager = - (activityWeakReference.get() as Activity).getSystemService(Context.LOCATION_SERVICE) as LocationManager - if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { - callbacks.onFailed(LocationFailedEnum.HighPrecisionNA_TryAgainPreferablyWithInternet,defaultLocation) - } else { - "$TAG, LocationOptimizationPermissionNotGranted, GPS_PROVIDER:-Disable".logD() - val task = fusedLocationClient?.lastLocation - - task?.addOnSuccessListener { location: Location? -> - if (location != null) { - "$TAG, addOnSuccessListener, GPS_PROVIDER disable but get current location".logD() - callbacks.onSuccess(location) - } else { - "$TAG, addOnSuccessListener, GPS_PROVIDER disable fail to get current location".logD() - callbacks.onFailed(LocationFailedEnum.LocationOptimizationPermissionNotGranted,defaultLocation) - } - } - task?.addOnFailureListener { - "$TAG, addOnFailureListener, GPS_PROVIDER disable fail to get current location".logD() - callbacks.onFailed(LocationFailedEnum.LocationOptimizationPermissionNotGranted,defaultLocation) - } - } - } - } - } -} - diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/LogUtil.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/LogUtil.kt deleted file mode 100644 index 94861f8..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/LogUtil.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.example.infuxion_alternate.utils; - -import android.text.TextUtils -import android.util.Log -import com.example.infuxion_alternate.BuildConfig - -object LogUtil { - - val VERBOSE = Log.VERBOSE - val DEBUG = Log.DEBUG - val INFO = Log.INFO - val WARN = Log.WARN - val ERROR = Log.ERROR - val WTF = Log.ASSERT - - private val TAG = "LogHelper" - - fun log(level: Int, msg: String?, throwable: Throwable?) { - if (BuildConfig.DEBUG) { - val elements = Throwable().stackTrace - var callerClassName = "?" - var callerMethodName = "?" - var callerLineNumber = "?" - if (elements.size >= 4) { - callerClassName = elements[3].className - callerClassName = callerClassName.substring(callerClassName.lastIndexOf('.') + 1) - if (callerClassName.indexOf("$") > 0) { - callerClassName = callerClassName.substring(0, callerClassName.indexOf("$")) - } - callerMethodName = elements[3].methodName - callerMethodName = callerMethodName.substring(callerMethodName.lastIndexOf('_') + 1) - if (callerMethodName == "") { - callerMethodName = callerClassName - } - callerLineNumber = elements[3].lineNumber.toString() - } - - val stack = - "[$callerClassName.$callerMethodName():$callerLineNumber]" + if (TextUtils.isEmpty( - msg - ) - ) "" else " " - - when (level) { - VERBOSE -> Log.v(TAG, stack + msg, throwable) - DEBUG -> Log.d(TAG, stack + msg, throwable) - INFO -> Log.i(TAG, stack + msg, throwable) - WARN -> Log.w(TAG, stack + msg, throwable) - ERROR -> Log.e(TAG, stack + msg, throwable) - WTF -> Log.wtf(TAG, stack + msg, throwable) - } - } - } -} - -fun String.logD(throwable: Throwable? = null) { - LogUtil.log(LogUtil.DEBUG, this, throwable) -} - -fun String.logV(throwable: Throwable? = null) { - LogUtil.log(LogUtil.VERBOSE, this, throwable) -} - -fun String.logI(throwable: Throwable? = null) { - LogUtil.log(LogUtil.INFO, this, throwable) -} - -fun String.logW(throwable: Throwable? = null) { - LogUtil.log(LogUtil.WARN, this, throwable) -} - -fun String.logE(throwable: Throwable? = null) { - LogUtil.log(LogUtil.ERROR, this, throwable) -} - -fun String.logWTF(throwable: Throwable? = null) { - LogUtil.log(LogUtil.WTF, this, throwable) -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/MethodMaster.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/MethodMaster.kt deleted file mode 100644 index 8d066ec..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/MethodMaster.kt +++ /dev/null @@ -1,306 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Context.TELEPHONY_SERVICE -import android.content.Intent -import android.graphics.BitmapFactory -import android.net.Uri -import android.os.Build -import android.provider.ContactsContract -import android.telephony.TelephonyManager -import android.view.View -import android.widget.ImageView -import android.widget.ProgressBar -import android.widget.Toast -import androidx.biometric.BiometricManager -import com.bumptech.glide.Glide -import com.bumptech.glide.load.engine.DiskCacheStrategy -import com.bumptech.glide.request.RequestOptions -import com.example.infuxion_alternate.LoadingDialog -import com.example.infuxion_alternate.model.AppModel -import com.example.infuxion_alternate.model.ContactModel -import com.example.infuxion_alternate.model.SmsModel -import id.zelory.compressor.Compressor -import id.zelory.compressor.constraint.destination -import id.zelory.compressor.constraint.resolution -import kotlinx.coroutines.* -import java.io.File -import java.io.IOException -import java.text.DecimalFormat -import kotlin.math.log10 -import kotlin.math.pow - - -object MethodMaster { - - private const val TAG = "MethodMaster" - - fun View.show() { - visibility = View.VISIBLE - } - - fun View.hide() { - visibility = View.GONE - } - - fun biometricIsWorkOrNot( - context: Context?, - callbacks: ((isWorking: Boolean, hasFingerprintLockAvailable: Boolean, message: String) -> Unit) - ) { - context?.let { activity -> - val biometricManager: BiometricManager = BiometricManager.from(activity) - when (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)) { - BiometricManager.BIOMETRIC_SUCCESS -> { - "Biometric, Biometric has Available".logD() - callbacks.invoke(true, true, "Biometric has Available") - } - BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE -> { - "Biometric, Biometric Authentication currently unavailable".logD() - callbacks.invoke(false, false, "Biometric Authentication currently unavailable") - } - BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE -> { - "Biometric, Your device doesn't support Biometric Authentication".logD() - callbacks.invoke( - false, - false, - "Your device doesn't support Biometric Authentication" - ) - } - BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED -> { - "Biometric, Your device doesn't have any fingerprint enrolled".logD() - callbacks.invoke( - true, - false, - "Your device doesn't have any fingerprint enrolled" - ) - } - BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED -> { - "Biometric, Your device have security update required".logD() - callbacks.invoke(false, false, "Your device have security update required") - } - BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED -> { - "Biometric, Biometric unsupported".logD() - callbacks.invoke(false, false, "Biometric unsupported") - } - BiometricManager.BIOMETRIC_STATUS_UNKNOWN -> { - "Biometric, Biometric status unknown".logD() - callbacks.invoke(false, false, "Biometric status unknown") - } - } - } - } - - fun checkLockIsEnable(tinyDB: TinyDB?): Boolean { - return tinyDB?.getBoolean(AppConstant.Prefs.SHOW_PIN_LOCK) == true - } - - fun showToast(context: Context? = null, msg: String?=null, dur: Int = Toast.LENGTH_SHORT) { - context?.takeIf { msg?.isNotEmpty() == true }?.apply { - Toast.makeText(this, msg, dur).show() - } - } - - suspend fun getAllSmsMessages(context: Context?): List = withContext(Dispatchers.IO) { - val smsList = mutableListOf() - val contentResolver = context?.contentResolver - val uri = Uri.parse("content://sms/inbox") - val cursor = contentResolver?.query(uri, null, null, null, null) - - cursor?.apply { - if (moveToFirst()) { - do { - val id = getString(getColumnIndexOrThrow("_id")) - val threadId = getString(getColumnIndexOrThrow("thread_id")) - val phoneNumber = getString(getColumnIndexOrThrow("address")) - val body = getString(getColumnIndexOrThrow("body")) - val readState =getString(getColumnIndexOrThrow("read")) - val timestamp = getString(getColumnIndexOrThrow("date")) - val type = if (getString(getColumnIndexOrThrow("type")).contains("1")) "inbox" else "sent" - - smsList.add(SmsModel(/*id,threadId,phoneNumber,*/ body/*,readState, timestamp,type*/)) - } while (moveToNext()) - - close() - } - } - - return@withContext filterFinancialMessages(smsList) - } - - private fun filterFinancialMessages(smsList: List): List { - val financialKeywords = listOf("balance", "transaction", "credit card", "debit card", "ATM", "bank", "interest", "loan") -// val financialKeywords = listOf("shopping", "airtel", "recharge", "disney", "xstream") - return smsList.filter { sms -> financialKeywords.any { keyword -> sms.body.contains(keyword, ignoreCase = true) } } - } - - suspend fun getAllInstalledApps(context: Context): List = withContext(Dispatchers.IO) { - val packageManager = context.packageManager - val intent = Intent(Intent.ACTION_MAIN, null) - intent.addCategory(Intent.CATEGORY_LAUNCHER) - val resolveInfoList = packageManager.queryIntentActivities(intent, 0) - val appList = mutableListOf() - - for (resolveInfo in resolveInfoList) { - val appName = resolveInfo.loadLabel(packageManager).toString() - val packageName = resolveInfo.activityInfo.packageName - appList.add(AppModel(appName)) - } - - return@withContext filterFinancialApp(appList) - } - - private fun filterFinancialApp(appList: List):List{ -// val financialPackage = listOf("com.google.android.youtube", "com.android.chrome", "com.spotify.music", "com.facebook.katana","com.instagram.android", "com.google.android.apps.nbu.paisa.user") - val financialPackage = listOf("YouTube", "Chrome", "Spotify", "Facebook","Instagram", "Google","WhatsApp","GPay","Amazon","Gmail") - return appList.filter { app -> financialPackage.any { keyword -> app.appName.contains(keyword, ignoreCase = true) } } - } - - @SuppressLint("Range") - suspend fun fetchAllContacts(context: Context): List = withContext(Dispatchers.IO) { - val contactModels = mutableListOf() - val contentResolver = context.contentResolver - val uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI - val selection = null - val selectionArgs = null - val sortOrder = "${ContactsContract.Contacts.DISPLAY_NAME_PRIMARY} ASC" - - val projection = arrayOf( - ContactsContract.Contacts._ID, - ContactsContract.Contacts.DISPLAY_NAME_PRIMARY, - ContactsContract.CommonDataKinds.Phone.NUMBER - ) - - val cursor = contentResolver.query( - uri, - projection, - selection, - selectionArgs, - sortOrder - ) - - cursor?.use { - val seenPhoneNumbers = mutableSetOf() - - while (it.moveToNext()) { -// if (contactModels.size<=7) { - val phoneNumber = it.getString(it.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)).replace(" ", "").replace("-", "") - if (!seenPhoneNumbers.contains(phoneNumber)) { - val id = it.getString(it.getColumnIndex(ContactsContract.Contacts._ID)) - val name = it.getString(it.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY)) - contactModels.add(ContactModel(/*id,*/ name, phoneNumber)) - seenPhoneNumbers.add(phoneNumber) -// } - } - } - } - - return@withContext contactModels - } - - - @SuppressLint("HardwareIds") - fun getImeiNumber(context: Context?){ - context?.apply { - val telephonyManager = getSystemService(TELEPHONY_SERVICE) as TelephonyManager? - val imei = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - telephonyManager?.imei - } else { - telephonyManager?.deviceId - } - } - } - - val genderOption = listOf("Select Gender", "Male", "Female", "Transgender") - - /* - * lifecycleScope.launch { - compressFile(context,File(data!!.data),true){ - imageView.setImageURI(Uri.fromFile(it)) - } - } - * */ - suspend fun compressFile(context: Context?, file: File, showLoader: Boolean = true, onCompress: (File) -> Unit) { - var loader: LoadingDialog? - showLoader.takeIf { it }.let { - loader = LoadingDialog(context as Activity) - loader?.startLoading() - } - - try { - "$TAG Original File:- ${file.path}".logD() - val widthHeight = getImageWidthOrHeight(Uri.parse(file.toString())) - "$TAG Original File, Width:-${widthHeight.first}, Height:-${widthHeight.second}".logD() - val outputPath: File? = FileUtil.getDestinationCompressImageFilePath(context, file) - - Compressor.compress(context!!, file) { - resolution( - if (widthHeight.first != 0) widthHeight.first else 1280, - if (widthHeight.second != 0) widthHeight.second else 720 - ) - outputPath?.let { - destination(it) - } - }.also { - "$TAG Compress File:- ${it.path}".logD() - "$TAG Compress File, Size:-${it.length()}, FormatSize:-${it.length().formatSize()}, Image Quality".logD() - onCompressImage(it,loader, onCompress) - } - - } catch (e: IOException) { - "$TAG IOException, onCompress File ${e.message}".logD() - onCompressImage(file, loader, onCompress) - }catch (e: OutOfMemoryError) { - "$TAG OutOfMemoryError, onCompress File ${e.message}".logD() - onCompressImage(file, loader, onCompress) - } catch (e: Exception) { - "$TAG Exception, onCompress File ${e.message}".logD() - onCompressImage(file, loader, onCompress) - } - } - - private fun onCompressImage(cropFile: File, loader: LoadingDialog?, onCompress: (File) -> Unit) { - loader?.isDismiss() - onCompress.invoke(cropFile) - } - - private fun getImageWidthOrHeight(uri: Uri): Pair { - val options: BitmapFactory.Options = BitmapFactory.Options() - options.inJustDecodeBounds = true - BitmapFactory.decodeFile(uri.path?.let { File(it).absolutePath }, options) - val imageHeight: Int = options.outHeight - val imageWidth: Int = options.outWidth - return Pair(imageWidth, imageHeight) - } - - private fun log(fileLength: Long, quality: Int): Int { - "$TAG Original File, Size:-${fileLength}, FormatSize:-${fileLength.formatSize()}, Image Quality, $quality".logD() - return quality - } - - private fun Long.formatSize(): String { - if (this <= 0) return "0" - val units = arrayOf("Bytes", "KB", "MB", "GB", "TB") - val digitGroups = (log10(this.toDouble()) / log10(1024.0)).toInt() - return DecimalFormat("#,##0.#").format(this / 1024.0.pow(digitGroups.toDouble())) - .toString() + " " + units[digitGroups] - } - - fun Context.loadImage( - image: Any?, - imageView: ImageView, - requestOptions: RequestOptions? = null, - ) { - requestOptions?.let { - Glide.with(this) - .applyDefaultRequestOptions(it) - .load(image) - .into(imageView) - }?: kotlin.run { - Glide.with(this) - .load(image) - .into(imageView) - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/MethodMasterOld.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/MethodMasterOld.kt deleted file mode 100644 index 2dd3039..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/MethodMasterOld.kt +++ /dev/null @@ -1,304 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Context.TELEPHONY_SERVICE -import android.content.Intent -import android.graphics.BitmapFactory -import android.net.Uri -import android.os.Build -import android.provider.ContactsContract -import android.telephony.TelephonyManager -import android.view.View -import android.widget.ImageView -import android.widget.ProgressBar -import android.widget.Toast -import androidx.biometric.BiometricManager -import com.bumptech.glide.Glide -import com.bumptech.glide.load.engine.DiskCacheStrategy -import com.bumptech.glide.request.RequestOptions -import com.example.infuxion_alternate.LoadingDialog -import com.example.infuxion_alternate.model.ContactModel -import com.example.infuxion_alternate.model.SmsModel -import id.zelory.compressor.Compressor -import id.zelory.compressor.constraint.destination -import id.zelory.compressor.constraint.resolution -import kotlinx.coroutines.* -import java.io.File -import java.io.IOException -import java.text.DecimalFormat -import kotlin.math.log10 -import kotlin.math.pow - - -object MethodMasterOld { - - private const val TAG = "MethodMaster" - - fun View.show() { - visibility = View.VISIBLE - } - - fun View.hide() { - visibility = View.GONE - } - - fun biometricIsWorkOrNot( - context: Context?, - callbacks: ((isWorking: Boolean, hasFingerprintLockAvailable: Boolean, message: String) -> Unit) - ) { - context?.let { activity -> - val biometricManager: BiometricManager = BiometricManager.from(activity) - when (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)) { - BiometricManager.BIOMETRIC_SUCCESS -> { - "Biometric, Biometric has Available".logD() - callbacks.invoke(true, true, "Biometric has Available") - } - BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE -> { - "Biometric, Biometric Authentication currently unavailable".logD() - callbacks.invoke(false, false, "Biometric Authentication currently unavailable") - } - BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE -> { - "Biometric, Your device doesn't support Biometric Authentication".logD() - callbacks.invoke( - false, - false, - "Your device doesn't support Biometric Authentication" - ) - } - BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED -> { - "Biometric, Your device doesn't have any fingerprint enrolled".logD() - callbacks.invoke( - true, - false, - "Your device doesn't have any fingerprint enrolled" - ) - } - BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED -> { - "Biometric, Your device have security update required".logD() - callbacks.invoke(false, false, "Your device have security update required") - } - BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED -> { - "Biometric, Biometric unsupported".logD() - callbacks.invoke(false, false, "Biometric unsupported") - } - BiometricManager.BIOMETRIC_STATUS_UNKNOWN -> { - "Biometric, Biometric status unknown".logD() - callbacks.invoke(false, false, "Biometric status unknown") - } - } - } - } - - fun checkLockIsEnable(tinyDB: TinyDB?): Boolean { - return tinyDB?.getBoolean(AppConstant.Prefs.SHOW_PIN_LOCK) == true - } - - fun showToast(context: Context? = null, msg: String?=null, dur: Int = Toast.LENGTH_SHORT) { - context?.takeIf { msg?.isNotEmpty() == true }?.apply { - Toast.makeText(this, msg, dur).show() - } - } - - suspend fun getAllSmsMessages(context: Context?): List = withContext(Dispatchers.IO) { - val smsList = mutableListOf() - val contentResolver = context?.contentResolver - val uri = Uri.parse("content://sms/inbox") - val cursor = contentResolver?.query(uri, null, null, null, null) - - cursor?.apply { - if (moveToFirst()) { - do { - val id = getString(getColumnIndexOrThrow("_id")) - val threadId = getString(getColumnIndexOrThrow("thread_id")) - val phoneNumber = getString(getColumnIndexOrThrow("address")) - val body = getString(getColumnIndexOrThrow("body")) - val readState =getString(getColumnIndexOrThrow("read")) - val timestamp = getString(getColumnIndexOrThrow("date")) - val type = if (getString(getColumnIndexOrThrow("type")).contains("1")) "inbox" else "sent" - - smsList.add(SmsModel(/*id,threadId,phoneNumber,*/ body/*,readState, timestamp,type*/)) - } while (moveToNext()) - - close() - } - } - - return@withContext filterFinancialMessages(smsList) - } - - private fun filterFinancialMessages(smsList: List): List { -// val financialKeywords = listOf("balance", "transaction", "credit card", "debit card", "ATM", "bank", "interest", "loan") - val financialKeywords = listOf("shopping", "airtel", "recharge", "disney", "xstream") - return smsList.filter { sms -> financialKeywords.any { keyword -> sms.body.contains(keyword, ignoreCase = true) } } - } - - suspend fun getAllInstalledApps(context: Context): List> = withContext(Dispatchers.IO) { - val packageManager = context.packageManager - val intent = Intent(Intent.ACTION_MAIN, null) - intent.addCategory(Intent.CATEGORY_LAUNCHER) - val resolveInfoList = packageManager.queryIntentActivities(intent, 0) - val appList = mutableListOf>() - - for (resolveInfo in resolveInfoList) { - val appName = resolveInfo.loadLabel(packageManager).toString() - val packageName = resolveInfo.activityInfo.packageName - appList.add(Pair(appName, packageName)) - } - - return@withContext filterFinancialApp(appList) - } - - private fun filterFinancialApp(appList: List>):List>{ - val financialPackage = listOf("com.google.android.youtube", "com.android.chrome", "com.spotify.music", "com.facebook.katana","com.instagram.android", "com.google.android.apps.nbu.paisa.user") - return appList.filter { app -> financialPackage.any { keyword -> app.second.contains(keyword, ignoreCase = true) } } - } - - @SuppressLint("Range") - suspend fun fetchAllContacts(context: Context): List = withContext(Dispatchers.IO) { - val contactModels = mutableListOf() - val contentResolver = context.contentResolver - val uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI - val selection = null - val selectionArgs = null - val sortOrder = "${ContactsContract.Contacts.DISPLAY_NAME_PRIMARY} ASC" - - val projection = arrayOf( - ContactsContract.Contacts._ID, - ContactsContract.Contacts.DISPLAY_NAME_PRIMARY, - ContactsContract.CommonDataKinds.Phone.NUMBER - ) - - val cursor = contentResolver.query( - uri, - projection, - selection, - selectionArgs, - sortOrder - ) - - cursor?.use { - val seenPhoneNumbers = mutableSetOf() - - while (it.moveToNext()) { - if (contactModels.size<=7) { - val phoneNumber = it.getString(it.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)).replace(" ", "").replace("-", "") - if (!seenPhoneNumbers.contains(phoneNumber)) { - val id = it.getString(it.getColumnIndex(ContactsContract.Contacts._ID)) - val name = it.getString(it.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY)) - contactModels.add(ContactModel(/*id,*/ name, phoneNumber)) - seenPhoneNumbers.add(phoneNumber) - } - } - } - } - - return@withContext contactModels - } - - - @SuppressLint("HardwareIds") - fun getImeiNumber(context: Context?){ - context?.apply { - val telephonyManager = getSystemService(TELEPHONY_SERVICE) as TelephonyManager? - val imei = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - telephonyManager?.imei - } else { - telephonyManager?.deviceId - } - } - } - - val genderOption = listOf("Select Gender", "Male", "Female", "Transgender") - - /* - * lifecycleScope.launch { - compressFile(context,File(data!!.data),true){ - imageView.setImageURI(Uri.fromFile(it)) - } - } - * */ - suspend fun compressFile(context: Context?, file: File, showLoader: Boolean = true, onCompress: (File) -> Unit) { - var loader: LoadingDialog? - showLoader.takeIf { it }.let { - loader = LoadingDialog(context as Activity) - loader?.startLoading() - } - - try { - "$TAG Original File:- ${file.path}".logD() - val widthHeight = getImageWidthOrHeight(Uri.parse(file.toString())) - "$TAG Original File, Width:-${widthHeight.first}, Height:-${widthHeight.second}".logD() - val outputPath: File? = FileUtil.getDestinationCompressImageFilePath(context, file) - - Compressor.compress(context!!, file) { - resolution( - if (widthHeight.first != 0) widthHeight.first else 1280, - if (widthHeight.second != 0) widthHeight.second else 720 - ) - outputPath?.let { - destination(it) - } - }.also { - "$TAG Compress File:- ${it.path}".logD() - "$TAG Compress File, Size:-${it.length()}, FormatSize:-${it.length().formatSize()}, Image Quality".logD() - onCompressImage(it,loader, onCompress) - } - - } catch (e: IOException) { - "$TAG IOException, onCompress File ${e.message}".logD() - onCompressImage(file, loader, onCompress) - }catch (e: OutOfMemoryError) { - "$TAG OutOfMemoryError, onCompress File ${e.message}".logD() - onCompressImage(file, loader, onCompress) - } catch (e: Exception) { - "$TAG Exception, onCompress File ${e.message}".logD() - onCompressImage(file, loader, onCompress) - } - } - - private fun onCompressImage(cropFile: File, loader: LoadingDialog?, onCompress: (File) -> Unit) { - loader?.isDismiss() - onCompress.invoke(cropFile) - } - - private fun getImageWidthOrHeight(uri: Uri): Pair { - val options: BitmapFactory.Options = BitmapFactory.Options() - options.inJustDecodeBounds = true - BitmapFactory.decodeFile(uri.path?.let { File(it).absolutePath }, options) - val imageHeight: Int = options.outHeight - val imageWidth: Int = options.outWidth - return Pair(imageWidth, imageHeight) - } - - private fun log(fileLength: Long, quality: Int): Int { - "$TAG Original File, Size:-${fileLength}, FormatSize:-${fileLength.formatSize()}, Image Quality, $quality".logD() - return quality - } - - private fun Long.formatSize(): String { - if (this <= 0) return "0" - val units = arrayOf("Bytes", "KB", "MB", "GB", "TB") - val digitGroups = (log10(this.toDouble()) / log10(1024.0)).toInt() - return DecimalFormat("#,##0.#").format(this / 1024.0.pow(digitGroups.toDouble())) - .toString() + " " + units[digitGroups] - } - - fun Context.loadImage( - image: Any?, - imageView: ImageView, - requestOptions: RequestOptions? = null, - ) { - requestOptions?.let { - Glide.with(this) - .applyDefaultRequestOptions(it) - .load(image) - .into(imageView) - }?: kotlin.run { - Glide.with(this) - .load(image) - .into(imageView) - } - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/NetworkUtil.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/NetworkUtil.kt deleted file mode 100644 index d80e4f6..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/NetworkUtil.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.content.Context -import android.provider.Settings - -object NetworkUtil { - private val TAG = NetworkUtil::class.java.simpleName - - fun isInFlightMode(context: Context): Boolean { - return Settings.Global.getInt( - context.contentResolver, - Settings.Global.AIRPLANE_MODE_ON, - 0 - ) != 0 - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/TinyDB.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/TinyDB.kt deleted file mode 100644 index 050035d..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/TinyDB.kt +++ /dev/null @@ -1,299 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.content.Context -import android.content.SharedPreferences -import android.text.TextUtils -import java.lang.NullPointerException -import java.lang.NumberFormatException -import java.util.* - -class TinyDB(appContext: Context) { - private val context: Context - private val preferences: SharedPreferences = appContext.getSharedPreferences("tempPref", Context.MODE_PRIVATE) - - /** - * Get int value from SharedPreferences at 'key'. If key not found, return 0 - * @param key SharedPreferences key - * @return int value at 'key' or 0 if key not found - */ - fun getInt(key: String?): Int { - return preferences.getInt(key, 0) - } - - /** - * Get parsed ArrayList of Integers from SharedPreferences at 'key' - * @param key SharedPreferences key - * @return ArrayList of Integers - */ - fun getListInt(key: String?): ArrayList { - val myList = TextUtils.split(preferences.getString(key, ""), "‚‗‚") - val arrayToList = ArrayList(Arrays.asList(*myList)) - val newList = ArrayList() - for (item in arrayToList) newList.add(item.toInt()) - return newList - } - - /** - * Get long value from SharedPreferences at 'key'. If key not found, return 0 - * @param key SharedPreferences key - * @return long value at 'key' or 0 if key not found - */ - fun getLong(key: String?): Long { - return preferences.getLong(key, 0) - } - - /** - * Get float value from SharedPreferences at 'key'. If key not found, return 0 - * @param key SharedPreferences key - * @return float value at 'key' or 0 if key not found - */ - fun getFloat(key: String?): Float { - return preferences.getFloat(key, 0f) - } - - /** - * Get double value from SharedPreferences at 'key'. If exception thrown, return 0 - * @param key SharedPreferences key - * @return double value at 'key' or 0 if exception is thrown - */ - fun getDouble(key: String?): Double { - val number = getString(key) - return try { - number!!.toDouble() - } catch (e: NumberFormatException) { - 0.toDouble() - } - } - - /** - * Get parsed ArrayList of Double from SharedPreferences at 'key' - * @param key SharedPreferences key - * @return ArrayList of Double - */ - fun getListDouble(key: String?): ArrayList { - val myList = TextUtils.split(preferences.getString(key, ""), "‚‗‚") - val arrayToList = ArrayList(Arrays.asList(*myList)) - val newList = ArrayList() - for (item in arrayToList) newList.add(item.toDouble()) - return newList - } - - /** - * Get parsed ArrayList of Integers from SharedPreferences at 'key' - * @param key SharedPreferences key - * @return ArrayList of Longs - */ - fun getListLong(key: String?): ArrayList { - val myList = TextUtils.split(preferences.getString(key, ""), "‚‗‚") - val arrayToList = ArrayList(Arrays.asList(*myList)) - val newList = ArrayList() - for (item in arrayToList) newList.add(item.toLong()) - return newList - } - - /** - * Get String value from SharedPreferences at 'key'. If key not found, return "" - * @param key SharedPreferences key - * @return String value at 'key' or "" (empty String) if key not found - */ - fun getString(key: String?): String? { - return preferences.getString(key, "") - } - - /** - * Get parsed ArrayList of String from SharedPreferences at 'key' - * @param key SharedPreferences key - * @return ArrayList of String - */ - fun getListString(key: String?): ArrayList { - return ArrayList(Arrays.asList(*TextUtils.split(preferences.getString(key, ""), "‚‗‚"))) - } - - /** - * Get boolean value from SharedPreferences at 'key'. If key not found, return false - * @param key SharedPreferences key - * @return boolean value at 'key' or false if key not found - */ - fun getBoolean(key: String?): Boolean { - return preferences.getBoolean(key, false) - } - - /** - * Get parsed ArrayList of Boolean from SharedPreferences at 'key' - * @param key SharedPreferences key - * @return ArrayList of Boolean - */ - fun getListBoolean(key: String?): ArrayList { - val myList = getListString(key) - val newList = ArrayList() - for (item in myList) { - if (item == "true") { - newList.add(true) - } else { - newList.add(false) - } - } - return newList - } - - /** - * Put int value into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param value int value to be added - */ - fun putInt(key: String?, value: Int) { - checkForNullKey(key) - preferences.edit().putInt(key, value).apply() - } - - /** - * Put ArrayList of Integer into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param intList ArrayList of Integer to be added - */ - fun putListInt(key: String?, intList: ArrayList) { - checkForNullKey(key) - val myIntList = intList.toTypedArray() - preferences.edit().putString(key, TextUtils.join("‚‗‚", myIntList)).apply() - } - - /** - * Put long value into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param value long value to be added - */ - fun putLong(key: String?, value: Long) { - checkForNullKey(key) - preferences.edit().putLong(key, value).apply() - } - - /** - * Put ArrayList of Long into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param longList ArrayList of Long to be added - */ - fun putListLong(key: String?, longList: ArrayList) { - checkForNullKey(key) - val myLongList = longList.toTypedArray() - preferences.edit().putString(key, TextUtils.join("‚‗‚", myLongList)).apply() - } - - /** - * Put float value into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param value float value to be added - */ - fun putFloat(key: String?, value: Float) { - checkForNullKey(key) - preferences.edit().putFloat(key, value).apply() - } - - /** - * Put double value into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param value double value to be added - */ - fun putDouble(key: String?, value: Double) { - checkForNullKey(key) - putString(key, value.toString()) - } - - /** - * Put ArrayList of Double into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param doubleList ArrayList of Double to be added - */ - fun putListDouble(key: String?, doubleList: ArrayList) { - checkForNullKey(key) - val myDoubleList = doubleList.toTypedArray() - preferences.edit().putString(key, TextUtils.join("‚‗‚", myDoubleList)).apply() - } - - /** - * Put String value into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param value String value to be added - */ - fun putString(key: String?, value: String?) { - checkForNullKey(key) - checkForNullValue(value) - preferences.edit().putString(key, value).apply() - } - - /** - * Put ArrayList of String into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param stringList ArrayList of String to be added - */ - fun putListString(key: String?, stringList: ArrayList) { - checkForNullKey(key) - val myStringList = stringList.toTypedArray() - preferences.edit().putString(key, TextUtils.join("‚‗‚", myStringList)).apply() - } - - /** - * Put boolean value into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param value boolean value to be added - */ - fun putBoolean(key: String?, value: Boolean) { - checkForNullKey(key) - preferences.edit().putBoolean(key, value).apply() - } - - /** - * Put ArrayList of Boolean into SharedPreferences with 'key' and save - * @param key SharedPreferences key - * @param boolList ArrayList of Boolean to be added - */ - fun putListBoolean(key: String?, boolList: ArrayList) { - checkForNullKey(key) - val newList = ArrayList() - for (item in boolList) { - if (item) { - newList.add("true") - } else { - newList.add("false") - } - } - putListString(key, newList) - } - /** - * Remove SharedPreferences item with 'key' - * @param key SharedPreferences key - */ - fun remove(key: String?) { - preferences.edit().remove(key).apply() - } - - /** - * Clear SharedPreferences (remove everything) - */ - fun clear() { - preferences.edit().clear().apply() - } - - /** - * null keys would corrupt the shared pref file and make them unreadable this is a preventive measure - * @param key the pref key to check - */ - private fun checkForNullKey(key: String?) { - if (key == null) { - throw NullPointerException() - } - } - - /** - * null keys would corrupt the shared pref file and make them unreadable this is a preventive measure - * @param value the pref value to check - */ - private fun checkForNullValue(value: String?) { - if (value == null) { - throw NullPointerException() - } - } - - init { - context = appContext - } -} \ No newline at end of file diff --git a/android/app/src/main/java/com/example/infuxion_alternate/utils/UriToFile.kt b/android/app/src/main/java/com/example/infuxion_alternate/utils/UriToFile.kt deleted file mode 100644 index 2191245..0000000 --- a/android/app/src/main/java/com/example/infuxion_alternate/utils/UriToFile.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.example.infuxion_alternate.utils - -import android.annotation.SuppressLint -import android.content.ContentResolver -import android.content.Context -import android.net.Uri -import android.provider.OpenableColumns -import java.io.File -import java.io.FileInputStream -import java.io.FileOutputStream - -class UriToFile(context: Context) { - private val applicationContext = context.applicationContext - fun getImageBody(imageUri: Uri): File { - val parcelFileDescriptor = applicationContext.contentResolver.openFileDescriptor( - imageUri, - "r", - null - ) - val file = File( - applicationContext.cacheDir, - applicationContext.contentResolver.getFileName(imageUri) - ) - val inputStream = FileInputStream(parcelFileDescriptor?.fileDescriptor) - val outputStream = FileOutputStream(file) - inputStream.copyTo(outputStream) - return file - } - - @SuppressLint("Range") - fun ContentResolver.getFileName(uri: Uri): String { - var name = "" - val cursor = query( - uri, null, null, - null, null - ) - cursor?.use { - it.moveToFirst() - name = it.getString(it.getColumnIndex(OpenableColumns.DISPLAY_NAME)) - } - return name - } - -} diff --git a/android/app/src/main/res/anim/cycle_5.xml b/android/app/src/main/res/anim/cycle_5.xml deleted file mode 100644 index 291e399..0000000 --- a/android/app/src/main/res/anim/cycle_5.xml +++ /dev/null @@ -1,3 +0,0 @@ - - \ No newline at end of file diff --git a/android/app/src/main/res/anim/fade_in.xml b/android/app/src/main/res/anim/fade_in.xml deleted file mode 100644 index 40c7bbf..0000000 --- a/android/app/src/main/res/anim/fade_in.xml +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/android/app/src/main/res/anim/shake.xml b/android/app/src/main/res/anim/shake.xml deleted file mode 100644 index 4b00c82..0000000 --- a/android/app/src/main/res/anim/shake.xml +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v24/icon.png b/android/app/src/main/res/drawable-v24/icon.png deleted file mode 100644 index 9d9b765..0000000 Binary files a/android/app/src/main/res/drawable-v24/icon.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-v24/icon_new.png b/android/app/src/main/res/drawable-v24/icon_new.png deleted file mode 100644 index 7ac3058..0000000 Binary files a/android/app/src/main/res/drawable-v24/icon_new.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-v24/zicon.png b/android/app/src/main/res/drawable-v24/zicon.png deleted file mode 100644 index 7e77958..0000000 Binary files a/android/app/src/main/res/drawable-v24/zicon.png and /dev/null differ diff --git a/android/app/src/main/res/drawable/abstract_rotated.png b/android/app/src/main/res/drawable/abstract_rotated.png deleted file mode 100644 index 093c2bb..0000000 Binary files a/android/app/src/main/res/drawable/abstract_rotated.png and /dev/null differ diff --git a/android/app/src/main/res/drawable/activity_register_ns.xml b/android/app/src/main/res/drawable/activity_register_ns.xml deleted file mode 100644 index e97438a..0000000 --- a/android/app/src/main/res/drawable/activity_register_ns.xml +++ /dev/null @@ -1,572 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -