Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ca4188c
fix(build): add compose and dependencies
ryjen Mar 4, 2024
4854568
fix(internetarchive): use xauthn service to simplify InternetArchive
ryjen Mar 5, 2024
c364b75
fix(ia): integrating xauthn and compose flow into space setup
ryjen Mar 5, 2024
d38dceb
fix(fastlane): add versioning plugin and ability to do a manual relea…
ryjen Mar 5, 2024
1a66627
fix(ia): add result handlers, styling, alerts, strings
ryjen Mar 6, 2024
3bc5775
fix(ia): login text field colors
ryjen Mar 6, 2024
3fca8d3
fix(main): ensure settings in adapter is always in line with button
ryjen Mar 6, 2024
0fd870b
Merge branch 'bug/main-adapter-order' into feature/ia-refactor
ryjen Mar 6, 2024
bb2803a
fix(ia): move login logic to use case with testing the connection
ryjen Mar 6, 2024
03eaab0
Merge remote-tracking branch 'oa/feature/fastlane-manual-release' int…
ryjen Mar 6, 2024
119dbe9
fix(ia): add missing dependency definition for login use case
ryjen Mar 6, 2024
bf021c7
fix(ia): add missing dependency for settings screen
ryjen Mar 6, 2024
2d1f0e0
fix(ia): add local source for demo
ryjen Mar 6, 2024
8dd07ad
fix(ia): spinner color
ryjen Mar 6, 2024
a5b228f
fix(ia): implement compose theming
ryjen Mar 7, 2024
c8b85f1
fix(ia): apply ui changes
ryjen Mar 11, 2024
212ab9d
fix(ia): fix uploads and simplify theme
ryjen Mar 12, 2024
5ded1b8
Merge branch 'development' into feature/ia-refactor
ryjen Mar 13, 2024
e541802
fix(ia): revert unnecessary change from development branch merge
ryjen Mar 13, 2024
560b294
fix(ia): grammar
ryjen Mar 13, 2024
ea43f21
fix(ia): add extended icons, update library version, add proguard-rules
ryjen Mar 18, 2024
b9a8608
fix(ia): update state architecture to better resemble ios impl
ryjen Mar 18, 2024
8b85547
fix(ia): add show/hide password toggle
ryjen Mar 18, 2024
464eff6
doc(ia): add comment about password show/hide impl
ryjen Mar 18, 2024
2e66961
fix(ia): make login vertical scrollable for keyboard layout changes
ryjen Mar 18, 2024
07ac6e0
chore(ia): upgrade compiler, and remove legacy ui files
ryjen Mar 25, 2024
a8f3c91
Merge branch 'development' into feature/ia-refactor
ryjen Mar 25, 2024
aeae677
wip(ia): broken upload progress again
ryjen Mar 25, 2024
3486fd1
Merge branch 'development' into feature/ia-refactor
ryjen Mar 25, 2024
b2fbf0d
chore(ia): remove debugging code
ryjen Mar 25, 2024
0f71084
fix(ia): increment version
ryjen Mar 25, 2024
325f691
fix(ia): use alpha for upload progress display
ryjen Mar 26, 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
32 changes: 26 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
applicationId "net.opendasharchive.openarchive"
minSdkVersion 21
targetSdkVersion 34
versionCode 20549
versionName '0.3.1-alpha2'
versionCode 20555
versionName '0.3.3'
archivesBaseName = "Save-$versionName"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -63,18 +63,25 @@ android {

buildFeatures {
viewBinding true
buildConfig true
compose true
}

lint {
abortOnError false
}

composeOptions {
kotlinCompilerExtensionVersion "1.5.10"
}

namespace 'net.opendasharchive.openarchive'
}

dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.21"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.22"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0"

implementation "androidx.core:core-ktx:1.12.0"
implementation "androidx.appcompat:appcompat:1.6.1"
Expand All @@ -87,6 +94,18 @@ dependencies {
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation "androidx.work:work-runtime-ktx:2.9.0"

implementation "androidx.compose.ui:ui:1.6.4"
implementation "androidx.compose.material3:material3:1.2.1"
implementation 'androidx.compose.foundation:foundation:1.6.4'
implementation "androidx.compose.ui:ui-tooling-preview:1.6.4"
implementation "androidx.activity:activity-compose:1.8.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0"

implementation "io.insert-koin:koin-core:3.5.3"
implementation "io.insert-koin:koin-android:3.5.3"
implementation "io.insert-koin:koin-androidx-compose:3.5.3"

implementation "com.github.satyan:sugar:1.5"

implementation "com.google.code.gson:gson:2.10"
Expand All @@ -95,8 +114,9 @@ dependencies {

// adding web dav support: https://github.com/thegrizzlylabs/sardine-android'
implementation "com.github.guardianproject:sardine-android:89f7eae512"

implementation "com.google.android.material:material:1.11.0"
implementation "androidx.compose.material:material-icons-extended:1.6.4"

implementation "com.github.bumptech.glide:glide:4.16.0"
annotationProcessor "com.github.bumptech.glide:compiler:4.16.0"
Expand All @@ -113,7 +133,7 @@ dependencies {
implementation "info.guardianproject.netcipher:netcipher:2.2.0-alpha"

//from here: https://github.com/guardianproject/proofmode
implementation ("org.proofmode:android-libproofmode:1.0.26") {
implementation("org.proofmode:android-libproofmode:1.0.26") {

transitive = false

Expand Down
10 changes: 9 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@
-dontwarn javax.annotation.**
-dontwarn org.conscrypt.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

-assumenosideeffects class androidx.compose.material.icons.extended.{
!Visibility,
!VisibilityOff,
**
} {
<methods>;
}
18 changes: 3 additions & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,14 @@
</intent-filter>
</activity>

<activity
android:name=".services.internetarchive.IaScrapeActivity"
android:exported="false"
android:label="@string/title_activity_login"
android:parentActivityName=".features.onboarding.SpaceSetupActivity"
android:taskAffinity="">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="net.opendasharchive.openarchive.features.onboarding.SpaceSetupActivity" />
</activity>

<activity
android:name=".services.webdav.WebDavActivity"
android:label="@string/title_activity_login"
android:taskAffinity="" />
<activity
android:name=".services.internetarchive.InternetArchiveActivity"

<activity android:name=".features.internetarchive.presentation.InternetArchiveActivity"
android:label="@string/title_activity_login"
android:taskAffinity="" />

<activity
android:name=".services.dropbox.DropboxActivity" />

Expand Down Expand Up @@ -226,7 +214,7 @@

<meta-data
android:name="VERSION"
android:value="35" />
android:value="36" />

<provider
android:name="androidx.core.content.FileProvider"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/assets/sugar_upgrades/35.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE SPACE add META_DATA TEXT;
11 changes: 10 additions & 1 deletion app/src/main/java/net/opendasharchive/openarchive/SaveApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import com.facebook.imagepipeline.core.ImagePipelineConfig
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig
import com.orm.SugarApp
import info.guardianproject.netcipher.proxy.OrbotHelper
import net.opendasharchive.openarchive.core.di.coreModule
import net.opendasharchive.openarchive.core.di.featuresModule
import net.opendasharchive.openarchive.util.Prefs
import net.opendasharchive.openarchive.util.Theme
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
import timber.log.Timber

class SaveApp : SugarApp() {
Expand All @@ -19,6 +23,11 @@ class SaveApp : SugarApp() {
override fun onCreate() {
super.onCreate()

startKoin {
androidContext(this@SaveApp)
modules(coreModule, featuresModule)
}

val config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(SimpleProgressiveJpegConfig())
.setResizeAndRotateEnabledForNetwork(true)
Expand Down Expand Up @@ -50,4 +59,4 @@ class SaveApp : SugarApp() {

oh.init()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.opendasharchive.openarchive.core.di

import org.koin.dsl.module

val coreModule = module {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package net.opendasharchive.openarchive.core.di

import net.opendasharchive.openarchive.features.internetarchive.internetArchiveModule
import org.koin.dsl.module

val featuresModule = module {
includes(internetArchiveModule)
// TODO: have some registry of feature modules
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.opendasharchive.openarchive.core.infrastructure.client

import kotlinx.coroutines.suspendCancellableCoroutine
import okhttp3.Call
import okhttp3.Callback
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import java.io.IOException
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException

suspend fun <T> OkHttpClient.enqueueResult(
request: Request,
onResume: (Response) -> T
) = suspendCancellableCoroutine { continuation ->
newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
continuation.resumeWithException(e)
}

override fun onResponse(call: Call, response: Response) {
continuation.resume(onResume(response))
}
})

continuation.invokeOnCancellation {
dispatcher.cancelAll()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.opendasharchive.openarchive.core.presentation

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import net.opendasharchive.openarchive.core.state.StateDispatcher
import net.opendasharchive.openarchive.core.state.StoreObserver
import net.opendasharchive.openarchive.core.state.Stateful
import net.opendasharchive.openarchive.core.state.Store

abstract class StatefulViewModel<State, Action>(
initialState: State,
) : ViewModel(), Store<Action>, Stateful<State> {

private val dispatcher =
StateDispatcher(viewModelScope, initialState, ::reduce, ::effects)

private val observer = StoreObserver<Action>()

override val state = dispatcher.state
override val actions = observer.actions

abstract fun reduce(state: State, action: Action): State

abstract suspend fun effects(state: State, action: Action)

override fun dispatch(action: Action) = dispatcher.dispatch(action)

override suspend fun notify(action: Action) = observer.notify(action)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package net.opendasharchive.openarchive.core.presentation.components

import androidx.compose.foundation.layout.RowScope
import androidx.compose.material3.Button
import androidx.compose.runtime.Composable

@Composable
fun PrimaryButton(onClick: () -> Unit, content: @Composable RowScope.() -> Unit) =
Button(onClick = onClick, content = content)
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package net.opendasharchive.openarchive.core.presentation.theme

import androidx.compose.material3.ColorScheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color

private val c23_nav_drawer_night = Color(0xff101010)
private val c23_darker_grey = Color(0xff212021)
private val c23_dark_grey = Color(0xff333333)
private val c23_medium_grey = Color(0xff696666)
private val c23_grey = Color(0xff9f9f9f)
private val c23_grey_50 = Color(0xff777979)
private val c23_light_grey = Color(0xffe3e3e4)
private val c23_teal_100 = Color(0xff00ffeb) // h=175,3 s=100 v=100 -->
private val c23_teal_90 = Color(0xff00e7d5) // v=90.6 -->
private val c23_teal_80 = Color(0xff00cebe) // v=80.6 -->
private val c23_teal = Color(0xff00b4a6) // v=70.6 -->
private val c23_teal_60 = Color(0xff009b8f) // v=60.6 -->
private val c23_teal_50 = Color(0xff008177) // v=50.6 -->
private val c23_teal_40 = Color(0xff00685f) // v=40.6 -->
private val c23_teal_30 = Color(0xff004e48) // v=30.6 -->
private val c23_teal_20 = Color(0xff003530) // v=20.6 -->
private val c23_teal_10 = Color(0xff001b19) // v=10.6 -->
private val c23_powder_blue = Color(0xffaae6e1)

@Immutable
data class ColorTheme(
val material: ColorScheme,
val primaryDark: Color = c23_teal_40,
val primaryBright: Color = c23_powder_blue,

val disabledContainer: Color = c23_teal_20,
val onDisabledContainer: Color = c23_light_grey,
)

private val LightColorScheme = ColorTheme(
material = lightColorScheme(

primary = c23_teal,
onPrimary = Color.Black,
primaryContainer = c23_teal,
onPrimaryContainer = Color.Black,

secondary = c23_teal,
onSecondary = Color.Black,
secondaryContainer = c23_teal_90,
onSecondaryContainer = Color.Black,

tertiary = c23_powder_blue,
onTertiary = Color.Black,
tertiaryContainer = c23_powder_blue,
onTertiaryContainer = Color.Black,

error = Color.Red,
onError = Color.Black,
errorContainer = Color.Red,
onErrorContainer = Color.Black,

background = Color.White,
onBackground = Color.Black,

surface = c23_light_grey,
onSurface = Color.Black,
surfaceVariant = c23_grey,
onSurfaceVariant = c23_darker_grey,

outline = Color.Black,
inverseOnSurface = Color.White,
inverseSurface = c23_dark_grey,
inversePrimary = Color.Black,
surfaceTint = c23_teal,
outlineVariant = c23_darker_grey,
scrim = c23_light_grey,
surfaceBright = c23_light_grey,
surfaceContainer = Color.White,
surfaceDim = c23_light_grey
),
)

private val DarkColorScheme = ColorTheme(
material = darkColorScheme(
primary = c23_teal,
onPrimary = Color.Black,
primaryContainer = c23_teal,
onPrimaryContainer = Color.White,

secondary = c23_teal,
onSecondary = Color.Black,
secondaryContainer = c23_teal_20,
onSecondaryContainer = Color.White,

tertiary = c23_powder_blue,
onTertiary = Color.Black,
tertiaryContainer = c23_powder_blue,
onTertiaryContainer = Color.Black,

error = Color.Red,
onError = Color.Black,
errorContainer = Color.Red,
onErrorContainer = Color.Black,

background = Color.Black,
onBackground = Color.White,

surface = c23_darker_grey,
onSurface = Color.White,
surfaceVariant = c23_dark_grey,
onSurfaceVariant = c23_light_grey,

outline = Color.White,
inverseSurface = c23_light_grey,
inverseOnSurface = Color.Black,
inversePrimary = Color.White,
surfaceTint = c23_teal,
outlineVariant = c23_light_grey,
scrim = c23_light_grey,
surfaceBright = c23_grey,
surfaceContainer = c23_medium_grey,
surfaceDim = c23_dark_grey
),
)

fun getThemeColors(isDarkTheme: Boolean) = if (isDarkTheme) DarkColorScheme else LightColorScheme

val LocalColors = staticCompositionLocalOf { LightColorScheme }

Loading