-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Background** Now we check updates only in start app **Changes** * Self updater now suspend and don't depend from Activity and on result send action * Method for support manual check self update yes/no * VersionVM for check update, state dialog/progress * Remove FDroid self update * Activate Debug Options by 10 click on card, check updated – click on text “Check Updates” * Can not run Check updates if we're now running (with progress state) * Fix GitHub download release * Notification on error(if we manual check), on start **Test plan** Have Installed GitHub or Debug build Go to Options -> Check Updates -> wait for loading info --------- Co-authored-by: Nikita Kulikov <[email protected]>
- Loading branch information
1 parent
1a4a9fc
commit 927b05b
Showing
42 changed files
with
1,839 additions
and
251 deletions.
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 |
---|---|---|
|
@@ -3,7 +3,6 @@ package com.flipperdevices.buildlogic | |
enum class SourceInstall { | ||
GITHUB, | ||
GOOGLE_PLAY, | ||
FDROID, | ||
UNKNOWN, | ||
DEBUG | ||
} |
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
75 changes: 75 additions & 0 deletions
75
...ices/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateError.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,75 @@ | ||
package com.flipperdevices.inappnotification.impl.composable.type | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.flipperdevices.core.ui.theme.FlipperThemeInternal | ||
import com.flipperdevices.core.ui.theme.LocalTypography | ||
import com.flipperdevices.inappnotification.impl.R | ||
|
||
@Composable | ||
internal fun ComposableInAppNotificationSelfUpdateError() { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(12.dp), | ||
horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Image( | ||
modifier = Modifier.size(24.dp), | ||
painter = painterResource(id = R.drawable.pic_update_error), | ||
contentDescription = stringResource(R.string.error_update_title), | ||
) | ||
Column { | ||
Text( | ||
text = stringResource(R.string.error_update_title), | ||
style = LocalTypography.current.subtitleB12 | ||
) | ||
Text( | ||
text = stringResource(R.string.error_update_desc), | ||
style = LocalTypography.current.subtitleR12 | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview( | ||
fontScale = 2.0f | ||
) | ||
@Composable | ||
private fun ComposableInAppNotificationSelfUpdateErrorPreviewX2Font() { | ||
FlipperThemeInternal { | ||
ComposableInAppNotificationSelfUpdateError() | ||
} | ||
} | ||
|
||
@Preview( | ||
fontScale = 1.5f | ||
) | ||
@Composable | ||
private fun ComposableInAppNotificationSelfUpdateErrorPreviewX15Font() { | ||
FlipperThemeInternal { | ||
ComposableInAppNotificationSelfUpdateError() | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun ComposableInAppNotificationSelfUpdateErrorPreview() { | ||
FlipperThemeInternal { | ||
ComposableInAppNotificationSelfUpdateError() | ||
} | ||
} |
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
75 changes: 75 additions & 0 deletions
75
...es/inappnotification/impl/composable/type/ComposableInAppNotificationSelfUpdateStarted.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,75 @@ | ||
package com.flipperdevices.inappnotification.impl.composable.type | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.flipperdevices.core.ui.theme.FlipperThemeInternal | ||
import com.flipperdevices.core.ui.theme.LocalTypography | ||
import com.flipperdevices.inappnotification.impl.R | ||
|
||
@Composable | ||
internal fun ComposableInAppNotificationSelfUpdateStarted() { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(12.dp), | ||
horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Image( | ||
modifier = Modifier.size(24.dp), | ||
painter = painterResource(id = R.drawable.pic_update_started), | ||
contentDescription = stringResource(R.string.started_update_title), | ||
) | ||
Column { | ||
Text( | ||
text = stringResource(R.string.started_update_title), | ||
style = LocalTypography.current.subtitleB12 | ||
) | ||
Text( | ||
text = stringResource(R.string.started_update_desc), | ||
style = LocalTypography.current.subtitleR12 | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview( | ||
fontScale = 2.0f | ||
) | ||
@Composable | ||
private fun ComposableInAppNotificationSelfUpdateStartedPreviewX2Font() { | ||
FlipperThemeInternal { | ||
ComposableInAppNotificationSelfUpdateStarted() | ||
} | ||
} | ||
|
||
@Preview( | ||
fontScale = 1.5f | ||
) | ||
@Composable | ||
private fun ComposableInAppNotificationSelfUpdateStartedPreviewX15Font() { | ||
FlipperThemeInternal { | ||
ComposableInAppNotificationSelfUpdateStarted() | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun ComposableInAppNotificationSelfUpdateStartedPreview() { | ||
FlipperThemeInternal { | ||
ComposableInAppNotificationSelfUpdateStarted() | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
components/inappnotification/impl/src/main/res/drawable/pic_update_error.xml
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,19 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<group> | ||
<clip-path | ||
android:pathData="M0,0h24v24h-24z"/> | ||
<path | ||
android:pathData="M11.999,23.331C18.259,23.331 23.333,18.257 23.333,11.997C23.333,5.738 18.259,0.664 11.999,0.664C5.74,0.664 0.666,5.738 0.666,11.997C0.666,18.257 5.74,23.331 11.999,23.331Z" | ||
android:fillColor="#F63F3F"/> | ||
<path | ||
android:pathData="M12.002,17.302m-1.336,0a1.336,1.336 0,1 1,2.671 0a1.336,1.336 0,1 1,-2.671 0" | ||
android:fillColor="#ffffff"/> | ||
<path | ||
android:pathData="M12.002,5.331L12.002,5.331A1.336,1.336 0,0 1,13.337 6.667L13.337,12.932A1.336,1.336 0,0 1,12.002 14.268L12.002,14.268A1.336,1.336 0,0 1,10.666 12.932L10.666,6.667A1.336,1.336 0,0 1,12.002 5.331z" | ||
android:fillColor="#ffffff"/> | ||
</group> | ||
</vector> |
17 changes: 17 additions & 0 deletions
17
components/inappnotification/impl/src/main/res/drawable/pic_update_started.xml
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,17 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M3.182,4.204C4.773,2.632 7.59,1 11.046,1C14.493,1 17.25,2.564 18.849,4.143C20.124,5.403 21.44,7.441 21.911,9.96L21.905,9.922C22.384,9.449 23.161,9.449 23.64,9.922C24.12,10.396 24.12,11.163 23.64,11.637L21.733,13.978C21.291,14.415 20.587,14.454 20.098,14.068L17.81,11.626C17.281,11.208 17.195,10.445 17.618,9.922C18.042,9.4 18.814,9.315 19.344,9.733C18.891,8.072 17.984,6.718 17.113,5.857C15.894,4.653 13.736,3.424 11.046,3.424C8.366,3.424 6.145,4.706 4.918,5.918C3.699,7.122 2.455,9.253 2.455,11.909C2.455,14.556 3.752,16.749 4.979,17.961C6.199,19.165 8.356,20.394 11.046,20.394C11.724,20.394 12.274,20.937 12.274,21.606C12.274,22.275 11.724,22.818 11.046,22.818C7.599,22.818 4.843,21.254 3.244,19.675C1.653,18.104 -0,15.323 -0,11.909C-0,8.505 1.583,5.783 3.182,4.204ZM19.344,9.733C19.412,9.983 19.469,10.24 19.515,10.503L19.344,9.733ZM21.971,10.314C21.953,10.195 21.933,10.077 21.911,9.96L21.971,10.314Z" | ||
android:fillColor="#589DFF" | ||
android:fillType="evenOdd"/> | ||
<path | ||
android:pathData="M15,9L10.188,15L8,12.273" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="2" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#589DFF" | ||
android:strokeLineCap="round"/> | ||
</vector> |
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
9 changes: 7 additions & 2 deletions
9
...ents/selfupdater/api/src/main/kotlin/com/flipperdevices/selfupdater/api/SelfUpdaterApi.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,14 @@ | ||
package com.flipperdevices.selfupdater.api | ||
|
||
import android.app.Activity | ||
import com.flipperdevices.selfupdater.models.SelfUpdateResult | ||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
interface SelfUpdaterApi { | ||
fun startCheckUpdateAsync(activity: Activity) | ||
suspend fun startCheckUpdate(manual: Boolean = false): SelfUpdateResult | ||
|
||
fun getInProgressState(): StateFlow<Boolean> | ||
|
||
fun getInstallSourceName(): String | ||
|
||
fun isSelfUpdateCanManualCheck(): Boolean | ||
} |
11 changes: 11 additions & 0 deletions
11
...elfupdater/api/src/main/kotlin/com/flipperdevices/selfupdater/api/SelfUpdaterSourceApi.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,11 @@ | ||
package com.flipperdevices.selfupdater.api | ||
|
||
import com.flipperdevices.selfupdater.models.SelfUpdateResult | ||
|
||
interface SelfUpdaterSourceApi { | ||
suspend fun checkUpdate(manual: Boolean): SelfUpdateResult | ||
|
||
fun getInstallSourceName(): String | ||
|
||
fun isSelfUpdateCanManualCheck(): Boolean | ||
} |
Oops, something went wrong.