Skip to content

Commit

Permalink
Mobileapps 1240 (#126)
Browse files Browse the repository at this point in the history
* updated versions

* Update build.yml

update jvm from 1.8 to 11

* removed unused code
  • Loading branch information
aman-alfresco authored Jun 21, 2022
1 parent 45fd143 commit 2d31a42
Show file tree
Hide file tree
Showing 29 changed files with 99 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- uses: actions/cache@v2
name: Cache gradle
Expand Down
9 changes: 0 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ android {
packagingOptions {
pickFirst 'META-INF/auth_release.kotlin_module'
}

splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
universalApk false
}
}
}

project.afterEvaluate {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
android:windowSoftInputMode="adjustNothing" />
<activity android:name=".activity.LoginActivity" />
<activity android:name=".activity.SettingsActivity" />
<activity android:name="com.alfresco.auth.pkce.RedirectUriReceiverActivity">
<activity android:name="com.alfresco.auth.pkce.RedirectUriReceiverActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import androidx.navigation.findNavController
import androidx.preference.PreferenceManager
import com.airbnb.mvrx.InternalMavericksApi
import com.airbnb.mvrx.MavericksView
import com.airbnb.mvrx.withState
import com.alfresco.Logger
Expand All @@ -32,6 +33,7 @@ import kotlinx.coroutines.GlobalScope
*/
class ExtensionActivity : AppCompatActivity(), MavericksView, ActionPermission {

@OptIn(InternalMavericksApi::class)
private val viewModel: MainActivityViewModel by activityViewModel()
private val navController by lazy { findNavController(R.id.nav_host_fragment) }
private lateinit var actionBarController: ActionBarController
Expand Down Expand Up @@ -86,7 +88,7 @@ class ExtensionActivity : AppCompatActivity(), MavericksView, ActionPermission {

private fun configure() = withState(viewModel) {
val graph = navController.navInflater.inflate(R.navigation.nav_share_extension)
graph.startDestination = R.id.nav_extension
graph.setStartDestination(R.id.nav_extension)
navController.graph = graph

actionBarController = ActionBarController(findViewById(R.id.toolbar))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupWithNavController
import com.airbnb.mvrx.InternalMavericksApi
import com.airbnb.mvrx.MavericksView
import com.airbnb.mvrx.withState
import com.alfresco.auth.activity.LoginViewModel
Expand All @@ -30,6 +31,7 @@ import java.lang.ref.WeakReference
*/
class MainActivity : AppCompatActivity(), MavericksView {

@OptIn(InternalMavericksApi::class)
private val viewModel: MainActivityViewModel by activityViewModel()
private val navController by lazy { findNavController(R.id.nav_host_fragment) }
private val bottomNav by lazy { findViewById<BottomNavigationView>(R.id.bottom_nav) }
Expand All @@ -56,7 +58,7 @@ class MainActivity : AppCompatActivity(), MavericksView {

private fun configure() = withState(viewModel) { state ->
val graph = navController.navInflater.inflate(R.navigation.nav_bottom)
graph.startDestination = if (state.isOnline) R.id.nav_recents else R.id.nav_offline
graph.setStartDestination(if (state.isOnline) R.id.nav_recents else R.id.nav_offline)
navController.graph = graph

val appBarConfiguration = AppBarConfiguration(bottomNav.menu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import androidx.navigation.findNavController
import com.airbnb.mvrx.InternalMavericksApi
import com.airbnb.mvrx.MavericksView
import com.airbnb.mvrx.withState
import com.alfresco.auth.activity.LoginViewModel
Expand All @@ -26,6 +27,7 @@ import java.lang.ref.WeakReference
*/
class MoveActivity : AppCompatActivity(), MavericksView {

@OptIn(InternalMavericksApi::class)
private val viewModel: MainActivityViewModel by activityViewModel()
private val navController by lazy { findNavController(R.id.nav_host_fragment) }
private val bottomView by lazy { findViewById<View>(R.id.bottom_view) }
Expand All @@ -50,7 +52,7 @@ class MoveActivity : AppCompatActivity(), MavericksView {

private fun configure() {
val graph = navController.navInflater.inflate(R.navigation.nav_move_paths)
graph.startDestination = R.id.nav_move
graph.setStartDestination(R.id.nav_move)
val bundle = Bundle().apply {
putParcelable(ENTRY_OBJ_KEY, entryObj)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class AccountPreference(context: Context, attrs: AttributeSet?) : Preference(con
private lateinit var signOutButton: MaterialButton
var onSignOutClickListener: View.OnClickListener? = null

override fun onBindViewHolder(holder: PreferenceViewHolder?) {
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
signOutButton = holder?.findViewById(R.id.sign_out_button) as MaterialButton
signOutButton = holder.findViewById(R.id.sign_out_button) as MaterialButton
signOutButton.setOnClickListener(onSignOutClickListener)
}
}
4 changes: 1 addition & 3 deletions app/src/main/res/layout/activity_move.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:navGraph="@navigation/nav_move_paths"
app:defaultNavHost="true" />
android:layout_weight="1" />

<View
android:id="@+id/bottom_view"
Expand Down
8 changes: 3 additions & 5 deletions app/src/main/res/navigation/nav_bottom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@
app:argType="boolean"
android:defaultValue="false"/>

<argument
android:name="moveId"
app:argType="string" />

<deepLink app:uri="alfresco://content/search/folder/{id}/{extension}?title={title}" />
</fragment>

Expand Down Expand Up @@ -105,11 +101,13 @@
app:argType="string" />
<argument
android:name="id"
app:argType="string" />
app:argType="string"
android:defaultValue=""/>
<argument
android:name="title"
app:argType="string"
android:defaultValue=""/>

<deepLink app:uri="alfresco://content/browse/{path}/remote/{id}?title={title}" />
<deepLink app:uri="alfresco://content/browse/{path}/remote?title={title}" />
</fragment>
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/navigation/nav_share_extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@
app:argType="boolean"
android:defaultValue="false"/>

<argument
android:name="moveId"
app:argType="string" />

<deepLink app:uri="alfresco://content/search/folder/{id}/{extension}?title={title}" />
</fragment>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.lifecycle.ViewModelProvider

class BaseViewModelFactory<T>(val creator: () -> T) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return creator() as T
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import androidx.transition.ChangeBounds
import androidx.transition.Fade
import androidx.transition.TransitionManager
import androidx.transition.TransitionSet
import com.airbnb.mvrx.InternalMavericksApi
import com.airbnb.mvrx.withState
import com.alfresco.content.actions.CreateActionsSheet
import com.alfresco.content.actions.MoveResultContract.Companion.MOVE_ID_KEY
Expand Down Expand Up @@ -59,6 +60,7 @@ data class BrowseArgs(
class BrowseFragment : ListFragment<BrowseViewModel, BrowseViewState>() {

private lateinit var args: BrowseArgs
@OptIn(InternalMavericksApi::class)
override val viewModel: BrowseViewModel by fragmentViewModelWithArgs { args }

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.ViewGroup
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import com.airbnb.mvrx.InternalMavericksApi
import com.airbnb.mvrx.withState
import com.alfresco.content.actions.ActionSyncNow
import com.alfresco.content.browse.R
Expand All @@ -21,6 +22,7 @@ import com.google.android.material.floatingactionbutton.ExtendedFloatingActionBu

class OfflineFragment : ListFragment<OfflineViewModel, OfflineViewState>() {

@OptIn(InternalMavericksApi::class)
override val viewModel: OfflineViewModel by fragmentViewModelWithArgs { OfflineBrowseArgs.with(arguments) }
private var fab: ExtendedFloatingActionButton? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.airbnb.epoxy.AsyncEpoxyController
import com.airbnb.mvrx.InternalMavericksApi
import com.airbnb.mvrx.MavericksView
import com.airbnb.mvrx.withState
import com.alfresco.content.browse.R
Expand Down Expand Up @@ -53,6 +54,7 @@ data class TransferFilesArgs(
class TransferFilesFragment : Fragment(), MavericksView {

private lateinit var args: TransferFilesArgs
@OptIn(InternalMavericksApi::class)
private val viewModel: TransferFilesViewModel by fragmentViewModelWithArgs { args }
private lateinit var binding: FragmentTransferFilesListBinding
private val epoxyController: AsyncEpoxyController by lazy { epoxyController() }
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ subprojects {
afterEvaluate {
if(it.hasProperty('android')) {
android {
compileSdkVersion 30
compileSdkVersion 32

defaultConfig {
minSdkVersion 24
targetSdkVersion 30
targetSdkVersion 32
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class CaptureViewModel(
fun updateName(newFileName: String) = withState {
val newList = it.listCapture.map { captureItem ->
if (captureItem == it.visibleItem) {
val updateCapture = captureItem?.copy(name = newFileName)
val updateCapture = captureItem.copy(name = newFileName)
setState { copy(visibleItem = updateCapture) }
updateCapture
} else {
Expand All @@ -148,7 +148,7 @@ class CaptureViewModel(
fun updateDescription(newDescription: String) = withState {
val newList = it.listCapture.map { captureItem ->
if (captureItem == it.visibleItem) {
val updateCapture = captureItem?.copy(description = newDescription)
val updateCapture = captureItem.copy(description = newDescription)
setState { copy(visibleItem = updateCapture) }
updateCapture
} else {
Expand Down
18 changes: 6 additions & 12 deletions data/objectbox-models/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@
{
"id": "7:5452033148610775403",
"name": "modified",
"type": 6,
"flags": 2
"type": 6
},
{
"id": "8:478363957192962053",
"name": "isOffline",
"type": 1,
"flags": 4
"type": 1
},
{
"id": "9:8089499220230382909",
Expand All @@ -64,8 +62,7 @@
{
"id": "11:2931623948301518676",
"name": "isUpload",
"type": 1,
"flags": 4
"type": 1
},
{
"id": "12:7704753326571321060",
Expand All @@ -75,20 +72,17 @@
{
"id": "13:8937782131764470873",
"name": "isExtension",
"type": 1,
"flags": 4
"type": 1
},
{
"id": "14:1311266378212477817",
"name": "totalCount",
"type": 5,
"flags": 4
"type": 5
},
{
"id": "15:3113908618782441744",
"name": "isTotalEntry",
"type": 1,
"flags": 4
"type": 1
}
],
"relations": []
Expand Down
18 changes: 6 additions & 12 deletions data/objectbox-models/default.json.bak
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@
{
"id": "7:5452033148610775403",
"name": "modified",
"type": 6,
"flags": 2
"type": 6
},
{
"id": "8:478363957192962053",
"name": "isOffline",
"type": 1,
"flags": 4
"type": 1
},
{
"id": "9:8089499220230382909",
Expand All @@ -64,8 +62,7 @@
{
"id": "11:2931623948301518676",
"name": "isUpload",
"type": 1,
"flags": 4
"type": 1
},
{
"id": "12:7704753326571321060",
Expand All @@ -75,20 +72,17 @@
{
"id": "13:8937782131764470873",
"name": "isExtension",
"type": 1,
"flags": 4
"type": 1
},
{
"id": "14:1311266378212477817",
"name": "totalCount",
"type": 5,
"flags": 4
"type": 5
},
{
"id": "15:3113908618782441744",
"name": "isTotalEntry",
"type": 1,
"flags": 4
"type": 1
}
],
"relations": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ class LocationData(context: Context) : LiveData<LocationModel>() {
}

private val locationCallback = object : LocationCallback() {
override fun onLocationResult(locationResult: LocationResult?) {
locationResult ?: return
override fun onLocationResult(locationResult: LocationResult) {
for (location in locationResult.locations) {
setLocationData(location)
}
Expand Down
Loading

0 comments on commit 2d31a42

Please sign in to comment.