Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add video support #55

Merged
merged 177 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
82116bc
chore: Update dependencies
Myzel394 Nov 23, 2023
63198c3
feat: Add poc
Myzel394 Nov 25, 2023
0de720c
debug: Add PoC for recurring video
Myzel394 Nov 25, 2023
f6bdd1b
debug: Fix microphone not accessible in background
Myzel394 Nov 25, 2023
d21580b
chore: Improvements
Myzel394 Nov 26, 2023
f033550
feat: Slowly creating workable camera support
Myzel394 Nov 26, 2023
d9e707a
feat: Add VideoRecorderModel
Myzel394 Nov 26, 2023
cb4f76e
chore: Cleanup
Myzel394 Nov 26, 2023
a9b6225
feat: Add internal folder support
Myzel394 Nov 26, 2023
a5a93ce
chore: Use general MediaConverter for concatenation
Myzel394 Nov 26, 2023
f75a1a8
chore: Rename VideoService -> VideoRecorderService
Myzel394 Nov 26, 2023
92d1d65
feat: Added VideoRecorderSettings
Myzel394 Nov 26, 2023
3d17012
fix: Use Unit for completer
Myzel394 Nov 27, 2023
b3bb433
feat: Use VideoBatchesFolder and AudioBatchesFolder
Myzel394 Nov 27, 2023
448108a
feat: Improve settings for video recording
Myzel394 Nov 27, 2023
89baa35
fix: Properly assign batchesFolder
Myzel394 Nov 28, 2023
8c391a7
fix: Improve BatchesFolders; concatenate video files
Myzel394 Nov 28, 2023
1eb7a7d
fix: Remove unused AudioRecorderExporter.kt
Myzel394 Nov 28, 2023
fe9d9d7
debug: current stand trying to make ffmpeg to work
Myzel394 Nov 28, 2023
1be3912
refactor: Improve BatchesFolder concatenation behavior
Myzel394 Nov 29, 2023
0d61838
current stand: trying to improve concatenation of file
Myzel394 Nov 29, 2023
3cee858
fix: Fix ffmpeg
Myzel394 Nov 30, 2023
569794d
feat: Wait for camera to finish completely
Myzel394 Nov 30, 2023
c38be92
feat: Add timeout to camera closing
Myzel394 Nov 30, 2023
79b33ce
refactor: Small improvements for changeState in RecorderService
Myzel394 Nov 30, 2023
c40361a
fix: Add pause method to VideoRecorderService
Myzel394 Nov 30, 2023
65be9a1
chore: Move code for better readability
Myzel394 Nov 30, 2023
5f7c6a9
fix: Close camera correctly
Myzel394 Dec 2, 2023
b987182
fix: Improve AppSettings structure
Myzel394 Dec 2, 2023
d4a5612
chore(ui): Improve structure for settings
Myzel394 Dec 2, 2023
4f265b2
feat(ui): Improve settings UI
Myzel394 Dec 2, 2023
9598cd4
feat: Add VideoRecorderBitrateTile
Myzel394 Dec 2, 2023
e8d7b2b
feat: Add VideoFrameRate
Myzel394 Dec 2, 2023
b6d8bdf
fix: Icon
Myzel394 Dec 2, 2023
b309d58
fix: Rename VideoFrameRate.kt -> VideoRecorderFrameRate.kt
Myzel394 Dec 2, 2023
7cf2e14
fix: Rename VideoFrameRate.kt -> VideoRecorderFrameRate.kt
Myzel394 Dec 2, 2023
e7989e2
feat: Add VideoRecorderQualityTile
Myzel394 Dec 2, 2023
261753a
feat: Add AudioRecordingStart and VideoRecordingStart
Myzel394 Dec 2, 2023
e7e7505
current stand
Myzel394 Dec 2, 2023
817e9d9
feat: Add VideoRecorderPreparationSheet
Myzel394 Dec 3, 2023
40eee79
feat: Adding camera preview functionality
Myzel394 Dec 3, 2023
22876c3
refactor: Rename package AudioRecorder -> RecorderScreen
Myzel394 Dec 4, 2023
7f757f4
feat: Add permission check to camera and audio
Myzel394 Dec 4, 2023
8a3bfca
fix: Improve camera-info.kt and CamerasSelection
Myzel394 Dec 4, 2023
60f53f3
current stand
Myzel394 Dec 4, 2023
add9c8c
feat: Add cameraID and enableAudio pass from UI to VideoRecorderService
Myzel394 Dec 4, 2023
55e00c1
fix: Allow sheet to be closed
Myzel394 Dec 5, 2023
699acb5
fix: Destroy recording after stopping it
Myzel394 Dec 5, 2023
4d2d73d
fix: Uncomment stopRecording on AudioRecorderService
Myzel394 Dec 5, 2023
e116c19
fix: Call onAmplitudeChange on AudioRecorderModel when amplitude changes
Myzel394 Dec 5, 2023
453ee79
fix(ui): Move information down
Myzel394 Dec 6, 2023
536cba8
refactor: Rename RecordingStatus.kt -> AudioRecordingStatus.kt
Myzel394 Dec 6, 2023
515c43d
feat: Add TorchStatus
Myzel394 Dec 6, 2023
0192af5
refactor: Improve RecordingStatuses
Myzel394 Dec 6, 2023
ce50ed1
feat(ui): Add more space to SectionTitle.kt
Myzel394 Dec 6, 2023
3cba338
refactor: Improving Recorder events handling
Myzel394 Dec 6, 2023
d79aaba
fix: Properly cleanup recordings
Myzel394 Dec 9, 2023
df78952
fix: Set state after action to avoid coroutine going out of scope
Myzel394 Dec 13, 2023
d1e4b68
fix: Save audio and video using appropriate file saver
Myzel394 Dec 14, 2023
de30f68
docs: Add docs for services
Myzel394 Dec 14, 2023
3d355df
current stand
Myzel394 Dec 15, 2023
4be2fc5
fix: Fix recorder states
Myzel394 Dec 15, 2023
fa5cd6f
fix: Differentiate between stopping and destroying -> destroy service…
Myzel394 Dec 15, 2023
f772818
fix: Destroy service after stopping it when deleting recording
Myzel394 Dec 15, 2023
5f8abca
feat: Add active camera to VideoRecordingStatus
Myzel394 Dec 15, 2023
ed8ab1d
chore: Update dependencies
Myzel394 Dec 15, 2023
1791c67
feat: Start recording with default params on click and show config on…
Myzel394 Dec 15, 2023
c2a9791
feat: Add save last recording functionality again
Myzel394 Dec 15, 2023
f462d5f
feat: Add Alibi icon next to explanation
Myzel394 Dec 15, 2023
39895bc
feat: Add QuickMaxDurationSelector; closes #57
Myzel394 Dec 15, 2023
101f8d4
fix: Fix sheets coming and leaving
Myzel394 Dec 15, 2023
3aa4caf
fix: Add some spacing
Myzel394 Dec 15, 2023
750f6dc
fix: Use onSurface color
Myzel394 Dec 16, 2023
b6346ef
feat: Add start time info
Myzel394 Dec 16, 2023
096cf56
feat: Add more animations to recording start
Myzel394 Dec 16, 2023
459a0b1
feat: Add permission check
Myzel394 Dec 16, 2023
b5ae6a7
fix: Add missing permissions and optional uses-feature
Myzel394 Dec 16, 2023
a0640d1
fix: Inline variable
Myzel394 Dec 16, 2023
ff8ea3e
feat: Add video recorder starting info
Myzel394 Dec 16, 2023
cda0b7f
fix: Properly reconnect audio on app focus
Myzel394 Dec 16, 2023
ee391a9
fix: Unify spacing of audio and video status
Myzel394 Dec 16, 2023
b1c77fe
fix: Unify spacing of audio and video status
Myzel394 Dec 16, 2023
4f9f65d
fix: Only start recording if recordingstate is idle
Myzel394 Dec 16, 2023
df0bb35
feat: Don't show RecordingControl until recording ready
Myzel394 Dec 16, 2023
76752e9
fix: Properly save recording
Myzel394 Dec 17, 2023
e719c0f
feat: Add some optional delay to RecordingControl
Myzel394 Dec 17, 2023
12311d3
fix: Properly set `isStartingRecording` for video recording
Myzel394 Dec 17, 2023
3cc34fa
fix: Remove unnecessary `runCatching`
Myzel394 Dec 17, 2023
7dfa298
feat: Add LockedApp
Myzel394 Dec 21, 2023
bf84396
current stand
Myzel394 Dec 21, 2023
a73fc6c
feat: Add biometric authentication check
Myzel394 Dec 23, 2023
025a8a3
feat: Add EnableAppLockTile to SettingsScreen
Myzel394 Dec 23, 2023
6661d45
feat: Add AsLockedApp wrapper to require id verification if enabled
Myzel394 Dec 23, 2023
2d22a65
feat: Improve AsLockedApp
Myzel394 Dec 25, 2023
5416fcb
Merge pull request #60 from Myzel394/add-fingerprint
Myzel394 Dec 25, 2023
28864ca
refactor: Improve BatchesFolder
Myzel394 Dec 29, 2023
029d9fe
feat: clean up BatchesFolder on stop;
Myzel394 Dec 29, 2023
06f2e1d
feat: Add custom VideoBatchesFolder support to VideoRecorderModel
Myzel394 Dec 29, 2023
ab10830
refactor: Improve recorder models
Myzel394 Dec 29, 2023
5f1b6dc
fix: Update RecorderEventsHandler to new base models
Myzel394 Dec 29, 2023
76b384f
refactor: Small improvement for taking persistable uri permission
Myzel394 Dec 29, 2023
4126dde
fix: Update AudioRecorderService to new batches folder
Myzel394 Dec 29, 2023
4af8cd7
feat: Add support for custom folder
Myzel394 Dec 29, 2023
1128a67
feat: Add support for custom folder in VideoRecorderService
Myzel394 Dec 29, 2023
4950dc3
refactor: Outsource check into Constants.kt
Myzel394 Dec 29, 2023
8b4c46a
feat: Add hint for old Android version for video recorder custom fold…
Myzel394 Dec 29, 2023
cb9a86b
fix: Unify save button with delete button in RecordingControl
Myzel394 Dec 29, 2023
b116757
fix: Delete cache file after using it
Myzel394 Dec 30, 2023
99085b2
feat: Add media option to SaveFolderTile
Myzel394 Dec 30, 2023
7401454
feat: Add support for media folders to video recording
Myzel394 Dec 30, 2023
35614a7
fix: Make constant name easier to read for end users
Myzel394 Dec 30, 2023
c6dca0f
refactor: Small code improvements, make code more dry
Myzel394 Dec 30, 2023
329b41b
feat: Improve check for existing file query
Myzel394 Dec 30, 2023
7c6e44d
refactor: Outsource into getOrCreateNewMediaFile method
Myzel394 Dec 30, 2023
9d4345c
refactor: Use constants instead of hardcoded values
Myzel394 Dec 30, 2023
ef64879
fix: Improvements
Myzel394 Dec 30, 2023
4681a1d
fix: Fix legacy storage support
Myzel394 Dec 31, 2023
61a63ee
fix: Improve queries
Myzel394 Dec 31, 2023
7c64683
fix: Convert recordingTime to float before calculation to fix progres…
Myzel394 Dec 31, 2023
69b76a7
fix: Delete old files for legacy media storage
Myzel394 Dec 31, 2023
b707681
fix: Avoid unnecessary call if earlierCounter is negative
Myzel394 Dec 31, 2023
cb25c1b
fix: Improve folders
Myzel394 Dec 31, 2023
1187d83
feat: Fix icons, add more mipmaps
Myzel394 Dec 31, 2023
d6ab56f
feat: Add selection sheet for SaveFolderTile
Myzel394 Dec 31, 2023
de72f88
feat: Improve SaveFolderTile selected value and order of selectionsheet
Myzel394 Dec 31, 2023
fa72ee0
feat: Show snackbar on save folder change
Myzel394 Dec 31, 2023
f4334bf
fix: Fix mainly Audio recording and some bugfixes for video recording
Myzel394 Dec 31, 2023
5e3e2a2
feat: Add permission required dialog to SaveFolder; some refactoring
Myzel394 Dec 31, 2023
e8337f2
fix: Fix message info
Myzel394 Dec 31, 2023
b581505
fix: Improve MessageBox colors
Myzel394 Dec 31, 2023
666f0be
feat: Check if external storage permission is granted on old Android …
Myzel394 Dec 31, 2023
2c09245
refactor: Rename onCustomOutputFolderNotAccessible -> onBatchesFolder…
Myzel394 Dec 31, 2023
da34df6
refactor: Use constant SHEET_BOTTOM_OFFSET everywhere
Myzel394 Dec 31, 2023
3a542f3
fix: Sort batches
Myzel394 Dec 31, 2023
32d35c5
chore: cleanup
Myzel394 Dec 31, 2023
47fc65a
fix: typo; happy new years eve
Myzel394 Dec 31, 2023
cf6c653
feat: Show error dialog when batches folder is inaccessible
Myzel394 Dec 31, 2023
d24dd4c
fix: Fix function not being referenced anymore
Myzel394 Dec 31, 2023
29d4e5a
feat: Add doctor; Add check for file saver dialog
Myzel394 Jan 1, 2024
df820e5
fix: Show content faster when no app lock is enabled
Myzel394 Jan 1, 2024
7b9457f
feat: Add onRecordingStart listener
Myzel394 Jan 1, 2024
cba150b
feat: Hide current snackbar on recording start
Myzel394 Jan 1, 2024
9bc6908
fix: Improve Doctor's checkIfFileSaverDialogIsAvailable
Myzel394 Jan 1, 2024
eeaeef0
fix: Fix modal bottom sheet
Myzel394 Jan 1, 2024
b878758
chore: remove empty line
Myzel394 Jan 1, 2024
f35a54c
fix: Fix batches collector
Myzel394 Jan 2, 2024
3f1e00a
refactor: Rename translation strings
Myzel394 Jan 2, 2024
386d3cb
feat: Add progress bar support for video
Myzel394 Jan 3, 2024
fc9e6d7
feat: Add progress info to audio recorder
Myzel394 Jan 4, 2024
b1fc546
feat: Request external storage permission on recording start if not g…
Myzel394 Jan 4, 2024
e8df9fb
fix: Improve save folder
Myzel394 Jan 5, 2024
c6932fd
feat: Add progress bar; Closes #64
Myzel394 Jan 5, 2024
0372b44
chore: remove debug logs
Myzel394 Jan 5, 2024
08a6d55
fix: Fix recording for Android API 30
Myzel394 Jan 5, 2024
298ce13
fix: Fix recorder for Android level 33
Myzel394 Jan 5, 2024
3cbf822
fix: Small improvements
Myzel394 Jan 5, 2024
60ee8d9
refactor: Outsource function into rememberOpenUri
Myzel394 Jan 5, 2024
986bf1d
feat: Add open folder for custom folders in SaveFolderTile
Myzel394 Jan 5, 2024
caeb966
fix: Fix batches folder concatenation
Myzel394 Jan 5, 2024
42f8262
feat: Add explanation to SaveFolderTile.kt for DCIM folder
Myzel394 Jan 5, 2024
300825e
feat: Add explanation to SaveFolderTile.kt for DCIM folder
Myzel394 Jan 5, 2024
e6d31a0
fix: Small improvements
Myzel394 Jan 6, 2024
cfc3572
fix(ui): Unify buttons
Myzel394 Jan 6, 2024
e9eb708
fix: Keep screen on when processing
Myzel394 Jan 6, 2024
f062640
fix: Remove padding so button is visible on smaller devices
Myzel394 Jan 6, 2024
20e79b9
fix: Only show preview message if camera permission granted
Myzel394 Jan 6, 2024
c0b1651
fix: Make recorder start screen more adaptive
Myzel394 Jan 6, 2024
be2a1b9
fix: Make SaveFolderTile.kt scrollable
Myzel394 Jan 6, 2024
e8aa6cc
fix: Make RealtimeAudioVisualizer size more adaptive
Myzel394 Jan 6, 2024
afd114f
fix: Improve AboutScreen
Myzel394 Jan 6, 2024
54a608a
chore(fastlane): Update images
Myzel394 Jan 7, 2024
8a9d7ab
chore(docs): Update README.md images
Myzel394 Jan 7, 2024
e71dabe
fix(fastlane): Convert image to webp
Myzel394 Jan 7, 2024
88ba044
chore: Increase version code
Myzel394 Jan 9, 2024
9202c21
fix: Handle unknown camera lenses
Myzel394 Jan 9, 2024
cfec714
refactor: Small improvement
Myzel394 Jan 9, 2024
dd5344c
fix: Only require FOREGROUND_SERVICE_TYPE_CAMERA when no audio requested
Myzel394 Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# Alibi

<p float="left" align="center">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/01.png" width="24%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/02.png" width="24%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/03.png" width="24%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/04.png" width="24%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/01.webp" width="30%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/02.webp" width="30%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/03.webp" width="30%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/04.webp" width="30%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/05.webp" width="30%" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/06.webp" width="30%" />
</p>

Alibi keeps recording in the background and saves the last 30 minutes at your request.
Expand Down Expand Up @@ -44,14 +46,20 @@ You can donate via:
* Bitcoin Cash: `qr9s64vfqedvurfef9ykf7szchmt0xyvnga452fc8l`
* Ethereum: `0xbb5E631c03C65334d1d9EfBCD926DC1265CC20D7`
* Tether USD: `0xbb5E631c03C65334d1d9EfBCD926DC1265CC20D7`
* Monero: `83dm5wyuckG4aPbuMREHCEgLNwVn5i7963SKBhECaA7Ueb7DKBTy639R3QfMtb3DsFHMp8u6WGiCFgbdRDBBcz5sLduUtm8`
*

Monero: `83dm5wyuckG4aPbuMREHCEgLNwVn5i7963SKBhECaA7Ueb7DKBTy639R3QfMtb3DsFHMp8u6WGiCFgbdRDBBcz5sLduUtm8`

* Zcash: `t1ZfvNpzfdaW6csT9Kc7iJA7LUU3hmNj2sx`
* Litecoin: `LZayhTosZ9ToRvcbeR1gEDgb76Z7ZA2drN`
* Dash: `XcTkni8CVAXBcuc5VwvHmsYftVK4CPLetU`
* Avalanche: `0xbb5E631c03C65334d1d9EfBCD926DC1265CC20D7`
* XRP: `rNpfDm8UwDTumCebchBadjVW2FEPteFgNg`
* Solana: `2h6CB3hz5Vb2nYS1RQiXZ4aWTzc5frBPR7Sp1b4muFqb`
* ADA: `addr1q8vy2vcp6lacaw8lkc29gufuzajaytc5qc0c2mxlmw5lndxcg5esr4lm36u0lds523cnc9m96gh3gpsls4kdlkaflx6qf6qpvc`
*

ADA: `addr1q8vy2vcp6lacaw8lkc29gufuzajaytc5qc0c2mxlmw5lndxcg5esr4lm36u0lds523cnc9m96gh3gpsls4kdlkaflx6qf6qpvc`

* Dogecoin: `DUA4j7mVoc7Rvezu8YgeRKwxNuMzKeDoxD`
* Tron: `THWVLGhne5wDsGjd1CNenHDKQGzvGzrzLb`
* Polkadot: `1642iaR6AoKyM6qnnMHkfCRfRqRKJ2wC6Cm3UEWEFEz6EtZR`
Expand Down
39 changes: 28 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ android {
applicationId "app.myzel394.alibi"
minSdk 24
targetSdk 34
versionCode 7
versionName "0.3.0"
versionCode 8
versionName "0.4.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -79,6 +79,7 @@ android {
buildFeatures {
compose true
buildConfig = true
viewBinding = true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.1'
Expand All @@ -94,15 +95,18 @@ dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.7.2'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation 'androidx.activity:activity-ktx:1.8.2'
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
implementation "androidx.compose.material:material-icons-extended:1.5.1"
implementation 'androidx.compose.material3:material3:1.1.2'
implementation "androidx.compose.material:material-icons-extended:1.5.4"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'androidx.lifecycle:lifecycle-service:2.6.2'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand All @@ -111,24 +115,37 @@ dependencies {
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'

implementation "androidx.navigation:navigation-compose:2.7.2"
implementation "androidx.navigation:navigation-compose:2.7.6"

implementation 'com.google.dagger:hilt-android:2.46.1'
implementation 'com.google.dagger:hilt-android:2.48'
annotationProcessor 'com.google.dagger:hilt-compiler:2.46.1'
implementation "androidx.hilt:hilt-navigation-compose:1.0.0"
implementation "androidx.hilt:hilt-navigation-compose:1.1.0"

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

implementation 'com.arthenica:ffmpeg-kit-min-gpl:5.1'
implementation 'com.arthenica:ffmpeg-kit-full-gpl:5.1'

implementation "androidx.datastore:datastore-preferences:1.0.0"

implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'

implementation 'com.maxkeppeler.sheets-compose-dialogs:core:1.2.0'
implementation 'com.maxkeppeler.sheets-compose-dialogs:duration:1.2.0'
implementation 'com.maxkeppeler.sheets-compose-dialogs:list:1.2.0'
implementation 'com.maxkeppeler.sheets-compose-dialogs:input:1.2.0'

implementation 'androidx.activity:activity-ktx:1.8.0'
def camerax_version = "1.3.1"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation "androidx.camera:camera-video:${camerax_version}"

implementation "androidx.camera:camera-view:${camerax_version}"
implementation "androidx.camera:camera-extensions:${camerax_version}"


implementation "com.valentinilk.shimmer:compose-shimmer:1.2.0"

implementation "androidx.biometric:biometric-ktx:1.2.0-alpha05"
}
29 changes: 28 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,39 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-feature
android:name="android.hardware.microphone"
android:required="false" />

<uses-feature
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- Required for Bluetooth microphones -->
<uses-permission
android:name="android.permission.MODIFY_AUDIO_SETTINGS"
android:maxSdkVersion="30" />

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />

<uses-permission android:name="android.permission.USE_BIOMETRIC" />

<!-- Starting with Android 29, apps don't need to request the READ_EXTERNAL_STORAGE permission
for files in their own MediaStore -->
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />

<application
android:name=".UpdateSettingsApp"
android:allowBackup="true"
Expand All @@ -23,6 +45,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Alibi"
android:hardwareAccelerated="true"
tools:targetApi="31">
<activity
android:name=".MainActivity"
Expand All @@ -43,9 +66,13 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>

<service
android:name=".services.AudioRecorderService"
android:foregroundServiceType="microphone" />
<service
android:name=".services.VideoRecorderService"
android:foregroundServiceType="camera|microphone" />

<!-- Change locale for Android <= 12 -->
<service
Expand Down
44 changes: 19 additions & 25 deletions app/src/main/java/app/myzel394/alibi/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ package app.myzel394.alibi

import android.content.Context
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.platform.LocalContext
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.ui.Modifier
import androidx.core.view.WindowCompat
import androidx.datastore.dataStore
import app.myzel394.alibi.db.AppSettings
import app.myzel394.alibi.db.AppSettingsSerializer
import app.myzel394.alibi.ui.AsLockedApp
import app.myzel394.alibi.ui.LockedAppHandlers
import app.myzel394.alibi.ui.Navigation
import app.myzel394.alibi.ui.SUPPORTS_DARK_MODE_NATIVELY
import app.myzel394.alibi.ui.theme.AlibiTheme

const val SETTINGS_FILE = "settings.json"
Expand All @@ -30,27 +30,21 @@ class MainActivity : AppCompatActivity() {
WindowCompat.setDecorFitsSystemWindows(window, false)

setContent {
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

LaunchedEffect(settings.theme) {
if (!SUPPORTS_DARK_MODE_NATIVELY) {
val currentValue = AppCompatDelegate.getDefaultNightMode()

if (settings.theme == AppSettings.Theme.LIGHT && currentValue != AppCompatDelegate.MODE_NIGHT_NO) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
} else if (settings.theme == AppSettings.Theme.DARK && currentValue != AppCompatDelegate.MODE_NIGHT_YES) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
AlibiTheme {
LockedAppHandlers()

Box(
modifier = Modifier
.fillMaxSize()
.background(
MaterialTheme.colorScheme.background
)
) {
AsLockedApp {
Navigation()
}
}
}

AlibiTheme {
Navigation()
}
}
}
}
Loading