Skip to content

Commit

Permalink
MOBILEAPPS-2137 (#322)
Browse files Browse the repository at this point in the history
* MOBILEAPPS-2089 (#300)

* disabled favorite feature below 23 version

* json parsed and architecture created for dynamic form

* removed login changes

* removed commented code

* MOBILEAPPS-2091 (#302)

* added single-line text component

* fixed review correction

* MOBILEAPPS-2093 (#303)

* added multi-line-text component

* optimized code and added few params

* added number component (#304)

* Mobileapps 2145 (#305)

* added amount component

* added checks for empty

* added checks for float value

* code optimized

* Mobileapps 2139 (#306)

* added checkbox component

* added string resource

* added datee and time field (#307)

* added dropdown field (#308)

* added radio component field (#309)

* added readonly field (#310)

* ADST-28 (#311)

* added people field

* added people field

* ADST-26 (#312)

* added functional group field

* added ammendments

* set the size of checkbox

* ADST-44 (#313)

* retain data on scroll

* added hyperlink field

* ADST-44 (#314)

* retain data on scroll

* added hyperlink field

* added underline

* ADST-221 (#315)

* added hyperlink ammendments

* added default and custom outcomes

* added string resources

* added string resources

* ADST-35 (#316)

* added hostname check to redirect the URL

* code refactor

* added validation and disbaled buttons state

* Revert "ADST-35 (#316)" (#317)

This reverts commit 84ed440.

* ADST-35 (#318)

* added hostname check to redirect the URL

* code refactor

* added validation and disbaled buttons state

* update scenarios of required data

* ADST-259 (#319)

* added hostname check to redirect the URL

* code refactor

* added validation and disbaled buttons state

* update scenarios of required data

* color theme fixed

* removed space from FAB

* code optimized

* ADST-31 (#320)

* submit collected data to server

* code optimized

* ADST-23 (#321)

* submit collected data to server

* code optimized

* added UI for attachments

* added attach files component

* code optimize

* ADST-261 (#323)

* fixed crash

* optimize error handling

* add more sceanrio to error handling

* ADST-47 (#324)

* fixed crash

* optimize error handling

* add more sceanrio to error handling

* linked search screen

* added folder search screen

* get result from folder search

* ADST-49 (#325)

* fixed crash

* optimize error handling

* add more sceanrio to error handling

* linked search screen

* added folder search screen

* get result from folder search

* code optimized

* code optimized

* view process after creation

* ADST-286 (#326)

* added confirmation dialog if any of the file is not uploaded

* added bottom banner

* string files updated

* added empty files view (#327)

* ADST-286 (#328)

* updated syncing architecture

* added title of view workflow

* handle single or multiple selection

* view data process scenario updated

* fixed save issue

* ADST-326 (#329)

* localisation updated

* selected content show in process

* added taskview feedbacks

* update view color, and update title (#330)

* ADST-386 (#331)

* update folder flow

* able to view the attachments

* ADST-379 (#333)

* fixed multiline issue

* fix date format

* ADST-380 (#332)

* fixed invalid url crash

* code optimsation

* ADST-382 (#334)

* limit file to 10mb for uploading the data

* fixed orientation

* update strings (#335)
  • Loading branch information
aman-alfresco authored May 1, 2024
1 parent eddc7bf commit 6e810b4
Show file tree
Hide file tree
Showing 171 changed files with 6,504 additions and 1,030 deletions.
16 changes: 12 additions & 4 deletions actions/src/main/kotlin/com/alfresco/content/actions/Action.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface Action {
suspend fun executeMulti(context: Context): Pair<ParentEntry, List<Entry>> {
return Pair(entry, entries)
}

fun copy(_entry: ParentEntry): Action
fun copy(_entries: List<Entry>): Action {
return this
Expand All @@ -49,10 +50,15 @@ interface Action {
bus.send(newAction)
} catch (ex: CancellationException) {
// no-op
if (entry is Entry && (entry as Entry).uploadServer == UploadServerType.UPLOAD_TO_TASK &&
ex.message == ERROR_FILE_SIZE_EXCEED
) {
bus.send(Error(context.getString(R.string.error_file_size_exceed)))
when {
entry is Entry && (entry as Entry).uploadServer == UploadServerType.UPLOAD_TO_TASK &&
ex.message == ERROR_FILE_SIZE_EXCEED -> {
bus.send(Error(context.getString(R.string.error_file_size_exceed)))
}
entry is Entry && (entry as Entry).uploadServer == UploadServerType.UPLOAD_TO_PROCESS &&
ex.message == ERROR_FILE_SIZE_EXCEED -> {
bus.send(Error(context.getString(R.string.error_file_size_exceed_10mb)))
}
}
} catch (ex: Exception) {
sendAnalytics(false)
Expand All @@ -69,6 +75,7 @@ interface Action {
bus.send(Error(context.getString(R.string.error_duplicate_folder)))
}
}

else -> bus.send(Error(context.getString(R.string.action_generic_error)))
}
}
Expand Down Expand Up @@ -106,6 +113,7 @@ interface Action {
bus.send(Error(context.getString(R.string.error_duplicate_folder)))
}
}

else -> bus.send(Error(context.getString(R.string.action_generic_error)))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ data class ActionCaptureMedia(
item.description,
item.mimeType,
entry.uploadServer,
observerId = entry.observerID,
)
}
repository.setTotalTransferSize(result.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import android.view.View
import androidx.documentfile.provider.DocumentFile
import com.alfresco.content.ContentPickerFragment
import com.alfresco.content.GetMultipleContents
import com.alfresco.content.GetMultipleContents.Companion.MAX_FILE_SIZE_10
import com.alfresco.content.GetMultipleContents.Companion.MAX_FILE_SIZE_100
import com.alfresco.content.actions.Action.Companion.ERROR_FILE_SIZE_EXCEED
import com.alfresco.content.data.Entry
import com.alfresco.content.data.EventName
Expand All @@ -28,17 +30,18 @@ data class ActionUploadFiles(
private val repository = OfflineRepository()

override suspend fun execute(context: Context): Entry {
val result = ContentPickerFragment.pickItems(context, MIME_TYPES)
val result = ContentPickerFragment.pickItems(context, MIME_TYPES, entry.isMultiple)
if (result.isNotEmpty()) {
when (entry.uploadServer) {
UploadServerType.UPLOAD_TO_TASK, UploadServerType.UPLOAD_TO_PROCESS -> {
result.forEach {
val fileLength = DocumentFile.fromSingleUri(context, it)?.length() ?: 0L
if (GetMultipleContents.isFileSizeExceed(fileLength)) {
if (GetMultipleContents.isFileSizeExceed(fileLength, if (entry.observerID.isNotEmpty()) MAX_FILE_SIZE_10 else MAX_FILE_SIZE_100)) {
throw CancellationException(ERROR_FILE_SIZE_EXCEED)
}
}
}

else -> {}
}
withContext(Dispatchers.IO) {
Expand All @@ -48,6 +51,7 @@ data class ActionUploadFiles(
it,
getParentId(entry),
uploadServerType = entry.uploadServer,
observerId = entry.observerID,
)
}
repository.setTotalTransferSize(result.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ data class ActionUploadMedia(
private val repository = OfflineRepository()

override suspend fun execute(context: Context): Entry {
val result = ContentPickerFragment.pickItems(context, MIME_TYPES)
val result = ContentPickerFragment.pickItems(context, MIME_TYPES, entry.isMultiple)
if (result.isNotEmpty()) {
when (entry.uploadServer) {
UploadServerType.UPLOAD_TO_TASK, UploadServerType.UPLOAD_TO_PROCESS -> {
result.forEach {
val fileLength = DocumentFile.fromSingleUri(context, it)?.length() ?: 0L
if (GetMultipleContents.isFileSizeExceed(fileLength)) {
if (GetMultipleContents.isFileSizeExceed(fileLength, if (entry.observerID.isNotEmpty()) GetMultipleContents.MAX_FILE_SIZE_10 else GetMultipleContents.MAX_FILE_SIZE_100)) {
throw CancellationException(ERROR_FILE_SIZE_EXCEED)
}
}
}

else -> {}
}
withContext(Dispatchers.IO) {
Expand All @@ -45,6 +46,7 @@ data class ActionUploadMedia(
it,
getParentId(entry),
uploadServerType = entry.uploadServer,
observerId = entry.observerID,
)
}
repository.setTotalTransferSize(result.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.alfresco.content.actions

import android.content.Context
import android.os.Bundle
import android.preference.PreferenceManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -17,6 +18,7 @@ import com.airbnb.mvrx.withState
import com.alfresco.content.actions.databinding.SheetActionCreateBinding
import com.alfresco.content.data.AnalyticsManager
import com.alfresco.content.data.Entry
import com.alfresco.content.data.Settings
import com.alfresco.content.data.UploadServerType
import com.alfresco.ui.BottomSheetDialogFragment
import kotlinx.coroutines.GlobalScope
Expand Down Expand Up @@ -73,6 +75,16 @@ class CreateActionsSheet : BottomSheetDialogFragment(), MavericksView {
private val viewModel: ActionCreateViewModel by fragmentViewModel()
private lateinit var binding: SheetActionCreateBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
withState(viewModel) {
val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(requireContext())
val editor = sharedPrefs.edit()
editor.putBoolean(Settings.IS_PROCESS_UPLOAD_KEY, it.parent.observerID.isNotEmpty())
editor.apply()
}
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ProcessDefinitionsSheet : BottomSheetDialogFragment(), MavericksView {

val intent = Intent(
requireActivity(),
Class.forName("com.alfresco.content.browse.processes.ProcessDetailActivity"),
Class.forName("com.alfresco.content.app.activity.ProcessActivity"),
)
intent.putExtra(Mavericks.KEY_ARG, processEntry)
startActivity(intent)
Expand Down
6 changes: 5 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ android {
viewBinding = true
}



compileOptions {
coreLibraryDesugaringEnabled true
}
Expand Down Expand Up @@ -98,7 +100,7 @@ dependencies {
implementation project(':viewer')
implementation project(':shareextension')
implementation project(':move')

implementation project(':process-app')
implementation project(':data')
implementation libs.alfresco.content

Expand All @@ -119,6 +121,8 @@ dependencies {

implementation libs.coil.core
implementation libs.gson
implementation libs.compose.runtime
implementation libs.constraintlayout

coreLibraryDesugaring libs.android.desugar

Expand Down
14 changes: 8 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<application
Expand All @@ -13,10 +14,13 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:useEmbeddedDex="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.Alfresco">
android:theme="@style/Theme.Alfresco"
android:useEmbeddedDex="true">
<activity
android:name=".activity.ProcessActivity"
android:exported="false" />
<activity
android:name=".activity.ExtensionActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize"
Expand Down Expand Up @@ -79,12 +83,10 @@
<activity
android:name=".activity.MoveActivity"
android:windowSoftInputMode="adjustNothing" />

<activity
android:name="com.alfresco.content.app.activity.TaskViewerActivity"
android:name=".activity.TaskViewerActivity"
android:configChanges="orientation|screenSize"
android:exported="false" />

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MoveActivity : AppCompatActivity(), MavericksView {
setContentView(R.layout.activity_move)

if (intent.extras != null) {
entryObj = intent.getParcelableExtra(ENTRY_OBJ_KEY) as Entry?
entryObj = intent.getParcelableExtra(ENTRY_OBJ_KEY) as? Entry?
}

configure()
Expand All @@ -54,7 +54,9 @@ class MoveActivity : AppCompatActivity(), MavericksView {
val graph = navController.navInflater.inflate(R.navigation.nav_move_paths)
graph.setStartDestination(R.id.nav_move)
val bundle = Bundle().apply {
putParcelable(ENTRY_OBJ_KEY, entryObj)
if (entryObj != null) {
putParcelable(ENTRY_OBJ_KEY, entryObj)
}
}
navController.setGraph(graph, bundle)
setupActionToasts()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.alfresco.content.app.activity

import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.NavHostFragment
import com.airbnb.mvrx.MavericksView
import com.alfresco.content.actions.Action
import com.alfresco.content.app.R
import com.alfresco.content.app.databinding.ActivityProcessBinding
import com.alfresco.content.app.widget.ActionBarController
import com.alfresco.content.app.widget.ActionBarLayout
import com.alfresco.content.common.BaseActivity

class ProcessActivity : BaseActivity(), MavericksView {

private lateinit var binding: ActivityProcessBinding
private lateinit var actionBarController: ActionBarController

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityProcessBinding.inflate(layoutInflater)
setContentView(binding.root)

if (!resources.getBoolean(R.bool.isTablet)) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}

configureNav()
setupActionToasts()
}

private fun configureNav() {
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
val navController = navHostFragment.navController
val inflater = navController.navInflater
val graph = inflater.inflate(R.navigation.nav_process_paths)
navController.setGraph(graph, intent.extras)
val actionBarLayout = findViewById<ActionBarLayout>(R.id.toolbar)
actionBarController = ActionBarController(actionBarLayout)
actionBarController.setupActionBar(this, navController)

actionBarLayout.toolbar.setNavigationOnClickListener { onBackPressed() }
}

private fun setupActionToasts() = Action.showActionToasts(
lifecycleScope,
binding.root,
binding.bottomView,
)

override fun invalidate() {
}
}
32 changes: 32 additions & 0 deletions app/src/main/res/layout/activity_process.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<include layout="@layout/layout_toolbar" />

<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:defaultNavHost="true" />

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/white"
android:backgroundTint="?attr/separatorColor" />
<View
android:id="@+id/bottom_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@android:color/white"
android:backgroundTint="?attr/separatorColor"
android:visibility="visible" />

</LinearLayout>
Loading

0 comments on commit 6e810b4

Please sign in to comment.