Skip to content

Commit

Permalink
Merge pull request #87 from yadavshashankr/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
yadavshashankr committed Aug 20, 2023
2 parents bd696cf + 6cbf2cd commit b1305a5
Show file tree
Hide file tree
Showing 42 changed files with 531 additions and 389 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-to-firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
on:
pull_request_target:
branches:
- enter_branch_name
- develop
types:
- closed
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload-to-play-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Android CI
on:
pull_request_target:
branches:
- enter_branch_name
- master
types:
- closed
jobs:
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ plugins {
}

ext{
version_name = "v1.0.6-RC41"
release_notes = 'Changes : 1.Apk name'
version_name = "v1.0.6"
release_notes = 'Migrating Video compressor module'
environment = 'preprod'
app_name = 'MEMEBase'
}
Expand All @@ -20,7 +20,7 @@ android {
applicationId "com.shashank.memebase"
minSdk 29
targetSdk 34
versionCode 8
versionCode 9
versionName project.ext.version_name

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -98,7 +98,7 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.room:room-runtime:2.6.0-alpha02'
implementation 'androidx.room:room-runtime:2.6.0-alpha03'

implementation 'com.google.code.gson:gson:2.9.1'

Expand Down
2 changes: 1 addition & 1 deletion app/distribution/whatsNewDirectory/whatsnew-en-US
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1. Performance and bug fixes.
2. New skin.
2. New skin for video compressor.
4 changes: 2 additions & 2 deletions app/info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"branch_name" : "develop",
"version_name" : "v1.0.6-RC41",
"release_notes" : "Testing file"
"version_name" : "v1.0.6",
"release_notes" : "Migrating Video Compressor module"
}
21 changes: 6 additions & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -12,22 +13,12 @@
android:roundIcon="@drawable/appimage"
android:supportsRtl="true"
android:theme="@style/Theme.Memes" >

<activity
android:name="com.shashank.memebase.meme.ui.CompressedVideoActivity"
android:screenOrientation="portrait"
android:exported="true" />
<activity
android:name="com.shashank.memebase.meme.ui.VideoSelectedActivity"
android:screenOrientation="portrait"
android:exported="true" />
<activity
android:name="com.shashank.memebase.meme.ui.SelectVideoActivity"
android:screenOrientation="portrait"
android:exported="true" />
<activity
android:name="com.shashank.memebase.entry.MainActivity"
android:name="com.shashank.memebase.MainActivity"
android:screenOrientation="portrait"
android:exported="true">
android:exported="true"
tools:ignore="LockedOrientationActivity">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.shashank.memebase.entry
package com.shashank.memebase


import android.Manifest
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
Expand All @@ -14,6 +13,8 @@ import android.view.ViewGroup
import android.view.animation.TranslateAnimation
import android.widget.PopupWindow
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.ConstraintLayout
Expand All @@ -23,20 +24,20 @@ import androidx.core.view.updateLayoutParams
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import com.likethesalad.android.aaper.api.EnsurePermissions
import com.shashank.memebase.BuildConfig
import com.shashank.memebase.R
import com.shashank.memebase.databinding.ActivityEntryBinding
import com.shashank.memebase.entry.data.UserPreferences
import com.shashank.memebase.entry.fragments.LoginFragment
import com.shashank.memebase.entry.viewModels.EntryViewModel
import com.shashank.memebase.globals.Constants
import com.shashank.memebase.meme.fragments.AgendaFragment
import com.shashank.memebase.meme.ui.SelectVideoActivity
import com.shashank.memebase.meme.fragments.MemeFragment
import com.shashank.memebase.video_compressor.ui.SelectVideoFragment
import com.shashank.memebase.video_compressor.ui.VideoSelectedFragment
import com.shashank.memebase.usecases.FragmentInflaterImpl
import com.shashank.memebase.usecases.NetworkStatus
import com.shashank.memebase.usecases.ToolbarHandlerImpl
import com.shashank.memebase.usecases.domain.FragmentInflater
import com.shashank.memebase.usecases.domain.ToolbarHandler
import com.shashank.memebase.utils.Tools
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

Expand All @@ -54,17 +55,28 @@ class MainActivity : AppCompatActivity(), FragmentInflater by FragmentInflaterIm
viewBinding.lifecycleOwner = this

setObservers()

onBackPressedDispatcher.addCallback(this /* lifecycle owner */, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (supportFragmentManager.backStackEntryCount > 0) {
supportFragmentManager.popBackStack()
} else {
finish()
}
}
})
}

private fun setObservers() {

if(userPreferences.isUserLoggedIn()){
startFragment(AgendaFragment.getInstance())
startFragment(MemeFragment.getInstance())
}else{
startFragment(LoginFragment.getInstance())
val fragment = LoginFragment.getInstance()
startFragment(fragment)
viewModel.makeMemeApiCall().observe(this){
if (it?.data != null){
Log.v("SUCCESS", "SUCCESS")
fragment.activateSkip()
}
}
}
Expand All @@ -87,14 +99,16 @@ class MainActivity : AppCompatActivity(), FragmentInflater by FragmentInflaterIm
viewModel.agendaDialogObserver().observe(this) {
when (it) {
getString(R.string.video_compressor) -> startVideoCompressor()
getString(R.string.app_name) -> startFragment(MemeFragment.getInstance())
getString(R.string.about) -> Toast.makeText(this, String.format(getString(R.string.about_msg), BuildConfig.VERSION_NAME), Toast.LENGTH_SHORT).show()
}
}
}

@EnsurePermissions(permissions = [Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE])
private fun startVideoCompressor(){
startActivity(Intent(this, SelectVideoActivity::class.java))
startFragment(SelectVideoFragment.getInstance())
// startActivity(Intent(this, SelectVideoActivity::class.java))
}

fun setFabLocation(shiftRight : Boolean){
Expand Down Expand Up @@ -125,7 +139,7 @@ class MainActivity : AppCompatActivity(), FragmentInflater by FragmentInflaterIm

private fun animate(isAvailable: Boolean) {
val textField = viewBinding.layoutOnlineMode.tvOnlineMode
textField.isVisible = true
textField.isVisible = !isAvailable
val endToStartAnimation = TranslateAnimation(500f, 0f, 0f, 0f)
endToStartAnimation.duration = Constants.AnimationProperties.DURATION
textField.startAnimation(endToStartAnimation)
Expand Down Expand Up @@ -157,7 +171,7 @@ class MainActivity : AppCompatActivity(), FragmentInflater by FragmentInflaterIm
val halfScreenWidth: Int
val calculatedWidth: Int

if(agenda == Constants.AgendaDialog.AGENDA_PRE_TIMERS || agenda == Constants.AgendaDialog.AGENDA_MEMES_MODULES){
if(agenda == Constants.AgendaDialog.AGENDA_PRE_TIMERS || agenda == Constants.AgendaDialog.AGENDA_MEMES_MODULES || agenda == Constants.AgendaDialog.AGENDA_COMPRESSOR_MODULES){
calculatedWidth = viewBinding.fab.x.toInt() - resources.getDimension(com.intuit.sdp.R.dimen._150sdp).toInt()
calculatedHeight = viewBinding.fab.y.toInt() - resources.getDimension(com.intuit.sdp.R.dimen._90sdp).toInt()
halfScreenWidth = resources.displayMetrics.widthPixels / 2 + 60
Expand All @@ -172,12 +186,30 @@ class MainActivity : AppCompatActivity(), FragmentInflater by FragmentInflaterIm
popUpActionWindow.update(calculatedWidth, calculatedHeight, halfScreenWidth, ViewGroup.LayoutParams.WRAP_CONTENT)
}

val videoFetcher = registerForActivityResult(ActivityResultContracts.GetContent()) {
if (it == null) return@registerForActivityResult
val fileDescriptor = applicationContext.contentResolver.openAssetFileDescriptor(it, "r")
val fileSize = fileDescriptor!!.length /1000

if (fileSize in 10001..49999){
Constants.VideoProperties.uri = it
startFragment(VideoSelectedFragment.getInstance())
}else{
Tools.longToast(this, resources.getString(R.string.sizeSpec))
}

}

override fun onClick(view: View?) {
if(view == viewBinding.fab && viewBinding.fab.tag == "fab"){
startFragment(LoginFragment.getInstance())
}
if(view == viewBinding.fab && viewBinding.fab.tag == "agendaDialog"){
if(view == viewBinding.fab && viewBinding.fab.tag == "compressorDialog"){
showAgendaPopUp(Constants.AgendaDialog.AGENDA_COMPRESSOR_MODULES)
}
if(view == viewBinding.fab && viewBinding.fab.tag == "memeDialog"){
showAgendaPopUp(Constants.AgendaDialog.AGENDA_MEMES_MODULES)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ import android.view.View
import android.view.View.OnClickListener
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.viewModels
import androidx.transition.Slide
import com.shashank.memebase.*
import com.shashank.memebase.databinding.LayoutLoginBinding
import com.shashank.memebase.entry.MainActivity
import com.shashank.memebase.MainActivity
import com.shashank.memebase.entry.viewModels.LoginViewModel
import com.shashank.memebase.entry.models.AuthenticationRequest
import com.shashank.memebase.meme.fragments.AgendaFragment
import com.shashank.memebase.meme.fragments.MemeFragment
import com.shashank.memebase.usecases.domain.FragmentInflater
import com.shashank.memebase.usecases.FragmentInflaterImpl
import com.shashank.memebase.usecases.NetworkStatus
Expand Down Expand Up @@ -51,6 +52,7 @@ class LoginFragment : Fragment(), FragmentInflater by FragmentInflaterImpl(), Te

viewBinding.btnLogin.setOnClickListener(this)
viewBinding.tvRegister.setOnClickListener(this)
viewBinding.tvSkip.setOnClickListener(this)
}

private fun setToolbarAndFab() {
Expand Down Expand Up @@ -142,21 +144,29 @@ class LoginFragment : Fragment(), FragmentInflater by FragmentInflaterImpl(), Te

viewModel.loginObserver.observe(viewLifecycleOwner){
if(it){
val parentActivity = (activity as MainActivity)
parentActivity.startFragment(AgendaFragment.getInstance())
openMemeFragment()
}else{
Toast.makeText(activity, "Invalid credentials", Toast.LENGTH_SHORT).show()
}
}
}

private fun openMemeFragment(){
val parentActivity = (activity as MainActivity)
parentActivity.startFragment(MemeFragment.getInstance())
}

private fun openRegistrationFragment() {
setFragmentManager(activity?.supportFragmentManager as FragmentManager)
val parentActivity = requireActivity() as MainActivity
parentActivity.startFragment(RegistrationFragment.getInstance())
removeFragment(this)
}

fun activateSkip(){
viewBinding.tvSkip.isVisible = true
}

override fun onResume() {
super.onResume()
setFieldValidations(this)
Expand All @@ -172,6 +182,8 @@ class LoginFragment : Fragment(), FragmentInflater by FragmentInflaterImpl(), Te
viewBinding.tvRegister -> openRegistrationFragment()

viewBinding.btnLogin -> startLogin()

viewBinding.tvSkip -> openMemeFragment()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.fragment.app.viewModels
import androidx.transition.Slide
import com.shashank.memebase.*
import com.shashank.memebase.databinding.LayoutRegistrationBinding
import com.shashank.memebase.entry.MainActivity
import com.shashank.memebase.MainActivity
import com.shashank.memebase.entry.viewModels.RegisterViewModel
import com.shashank.memebase.entry.models.RegisterRequest
import com.shashank.memebase.usecases.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.shashank.memebase.agenda.dialogs.domain.PopUpTaskyListDialog
import com.shashank.memebase.globals.Constants
import com.shashank.memebase.meme.domain.PopUpTaskyListDialog
import com.shashank.memebase.meme.memesModels.MemeModel
import com.shashank.memebase.meme.repositories.NetworkRepository
import com.shashank.memebase.usecases.NetworkStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.shashank.memebase.entry.domain.EmailPatternValidator
import com.shashank.memebase.entry.domain.usecases.PasswordPatternValidation
import com.shashank.memebase.entry.models.AuthenticationRequest
import com.shashank.memebase.entry.data.UserPreferences
import com.shashank.memebase.entry.utils.SecuredPreference
import com.shashank.memebase.usecases.NetworkStatus
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
Expand All @@ -17,8 +16,7 @@ class LoginViewModel @Inject constructor(
private val emailValidator: EmailPatternValidator,
private val passwordPatternValidation: PasswordPatternValidation,
networkStatus: LiveData<NetworkStatus>,
private val userPreferences: UserPreferences,
private val securedPreference: SecuredPreference
private val userPreferences: UserPreferences
): ViewModel() {

private val mutableEmail = MutableLiveData(false)
Expand All @@ -35,9 +33,6 @@ class LoginViewModel @Inject constructor(
private val mutableLogin = MutableLiveData<Boolean>()
val loginObserver : LiveData<Boolean> = mutableLogin

// private val coroutineExceptionHandler = CoroutineExceptionHandler{ _, throwable ->
// throwable.printStackTrace()
// }


fun onEmailChange(email : String) {
Expand All @@ -55,15 +50,5 @@ class LoginViewModel @Inject constructor(
fun login(authenticationModel: AuthenticationRequest){

mutableLogin.postValue(userPreferences.verifyUserCredentials(authenticationModel.email, authenticationModel.password))

// viewModelScope.launch(Dispatchers.IO + coroutineExceptionHandler) {
// val authenticatedUser = entryRepository.doLogin(authenticationModel)
// if(authenticatedUser != null){
// userPreferences.saveAuthenticatedUser(authenticatedUser)
// securedPreference.setAccessToken(authenticatedUser.token)
// authenticatedUser.token = null
// mutableLogin.postValue(true)
// }
// }
}
}
Loading

0 comments on commit b1305a5

Please sign in to comment.