This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
36 support file uploads for submissions #151
Open
JonasWanke
wants to merge
41
commits into
dev
Choose a base branch
from
36-support-file-uploads-for-submissions
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
8d79df4
refactor(homework): cleanup tab handling
JonasWanke cabbe7b
feat(main): read configs of tabs
JonasWanke 9299b02
feat(main): merge nested configs
JonasWanke c04a4b1
fix(file): remove old files, directories
JonasWanke 62e8021
fix(file): cache text color in BreadcrumbsView
JonasWanke eb5c406
feat(file): support uploads
JonasWanke 1f5bd76
ui(main): always center FAB; minor refactoring
JonasWanke eb843d8
ui(homework): rename overview tab to assignment
JonasWanke 25e0a9c
build: update dependencies
JonasWanke 0c082a2
ui(homework/submission): add attachment UI
JonasWanke 0ff5bae
refactor(file): cleanup upload code; add more error messages
JonasWanke f567e7a
fix(main): fix refresh in nested fragments
JonasWanke b62ab7f
feat(homework/submission): add attachment bottom sheet
JonasWanke fc5e87f
refactor(homework): cleanup
JonasWanke fd74184
feat(homework/attachment): support taking photo as attachment
JonasWanke a2dcc67
fix(base): fix permission requests
JonasWanke a0efd35
ui(main): enable FAB animation
JonasWanke d22fdfa
fix(file): use real file ID
JonasWanke b38425d
feat(homework/submission): show attachments
JonasWanke d82a35d
feat(homework/attachment): add to submission
JonasWanke 2743f85
refactor(homework/attachment); add file from ViewModel
JonasWanke 2dd47bd
fix(file): filenames w/ URI-encoded entities
JonasWanke abcec54
fix: use correct thread for dialogs
JonasWanke 2a3ec92
feat(homework/attachment): give teacher permission to view attachments
JonasWanke 4a4ee6b
build: update build tools
JonasWanke 9e7e5f1
feat(homework/submission): check for edit permission
JonasWanke 818d2a4
feat(main): sync all tabs on first visibility
JonasWanke 303206d
ui(homework): fix clipping issue
JonasWanke 3c8a584
feat(homework/attachment): include seconds in photo file name
JonasWanke bde4c8a
feat(homework/attachment): add i18n; disable drawings
JonasWanke 897cc7a
feat(base): add BaseViewModel to close realm instances
JonasWanke 7a399ab
feat(main): show sheet for received files
JonasWanke c78b29b
ui: fix spacings
JonasWanke 726e293
fix: fix string res escaping
JonasWanke a1ce6ca
revert(main): remove receive file intent
JonasWanke f8bf6f2
ui(main): fix homework icon in drawer
JonasWanke af4a463
fix(file): use correct text size in breadcrumbs
JonasWanke abf7363
Merge branch 'dev' into 36-support-file-uploads-for-submissions
JonasWanke 7e2c64c
fix(file): show course name in breadcrumbs after nav
JonasWanke 2fd446a
fix(main): slide BottomAppBar back into view after tab change
JonasWanke 4d81852
refactor: fix lint errors
JonasWanke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package org.schulcloud.mobile.config | ||
|
||
import org.schulcloud.mobile.BuildConfig | ||
|
||
object Config { | ||
val HEADER_AUTH = "Authorization" | ||
val HEADER_AUTH_VALUE_PREFIX = "Bearer " | ||
|
||
val REALM_SCHEMA_VERSION = 1L | ||
|
||
const val FILE_PROVIDER = "${BuildConfig.APPLICATION_ID}.fileprovider" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
app/src/main/java/org/schulcloud/mobile/controllers/base/BaseFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
package org.schulcloud.mobile.controllers.base | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
|
||
abstract class BaseFragment : Fragment() { | ||
val baseActivity: BaseActivity? get() = activity as? BaseActivity | ||
|
||
suspend fun requestPermission(permission: String): Boolean = baseActivity?.requestPermission(permission) ?: false | ||
abstract class BaseFragment : Fragment(), ContextAware { | ||
override val baseActivity: BaseActivity? get() = activity as? BaseActivity | ||
override val currentContext: Context get() = context!! | ||
|
||
override suspend fun requestPermission(permission: String): Boolean { | ||
return baseActivity?.requestPermission(permission) ?: false | ||
} | ||
|
||
override suspend fun startActivityForResult(intent: Intent, options: Bundle?): StartActivityResult { | ||
return baseActivity?.startActivityForResult(intent, options) ?: StartActivityResult.error() | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/org/schulcloud/mobile/controllers/base/BaseSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.schulcloud.mobile.controllers.base | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.fragment.app.FragmentManager | ||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment | ||
|
||
|
||
abstract class BaseSheet : BottomSheetDialogFragment(), ContextAware { | ||
override val baseActivity: BaseActivity? get() = activity as? BaseActivity | ||
override val currentContext: Context get() = context!! | ||
|
||
override suspend fun requestPermission(permission: String): Boolean { | ||
return baseActivity?.requestPermission(permission) ?: false | ||
} | ||
|
||
override suspend fun startActivityForResult(intent: Intent, options: Bundle?): StartActivityResult { | ||
return baseActivity?.startActivityForResult(intent, options) ?: StartActivityResult.error() | ||
} | ||
|
||
|
||
fun show(manager: FragmentManager?) = super.show(manager, tag) | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/org/schulcloud/mobile/controllers/base/ContextAware.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.schulcloud.mobile.controllers.base | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
|
||
interface ContextAware { | ||
|
||
val baseActivity: BaseActivity? | ||
val currentContext: Context | ||
|
||
suspend fun requestPermission(permission: String): Boolean | ||
suspend fun startActivityForResult(intent: Intent, options: Bundle? = null): StartActivityResult | ||
|
||
} | ||
|
||
data class StartActivityResult( | ||
val success: Boolean, | ||
val data: Intent? | ||
) { | ||
companion object { | ||
fun success(data: Intent?): StartActivityResult = StartActivityResult(true, data) | ||
fun error(): StartActivityResult = StartActivityResult(false, null) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as off-topic.
Sorry, something went wrong.