mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-19 01:17:31 +00:00
feat: show android version on settings page
This commit is contained in:
parent
2e74f9c45d
commit
d6d1bb359c
8 changed files with 36 additions and 6 deletions
8
android/.idea/deploymentTargetSelector.xml
generated
8
android/.idea/deploymentTargetSelector.xml
generated
|
|
@ -4,6 +4,14 @@
|
|||
<selectionStates>
|
||||
<SelectionState runConfigName="SP">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2024-11-13T18:07:26.343977020Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=/home/johannes/.android/avd/A11_Pixel_6_API_30.avd" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ android {
|
|||
minSdkVersion 24
|
||||
targetSdkVersion 34
|
||||
compileSdk 34
|
||||
versionCode 101001
|
||||
versionCode 100101
|
||||
versionName "10.1.1"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
manifestPlaceholders = [
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class LaunchDecider(private val context: Context) {
|
|||
* If LAUNCH_MODE is set to 1 or 2, it will force the corresponding mode.
|
||||
* The result is saved in SharedPreferences for future launches.
|
||||
*/
|
||||
private fun getLaunchMode(): Int {
|
||||
fun getLaunchMode(): Int {
|
||||
val launchMode = BuildConfig.LAUNCH_MODE.toIntOrNull() ?: 0
|
||||
return when (launchMode) {
|
||||
1 -> MODE_ONLINE
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@ import androidx.core.content.ContextCompat
|
|||
import com.anggrayudi.storage.SimpleStorageHelper
|
||||
import com.anggrayudi.storage.file.*
|
||||
import com.superproductivity.superproductivity.App
|
||||
import com.superproductivity.superproductivity.BuildConfig
|
||||
import com.superproductivity.superproductivity.app.AppLifecycleObserver
|
||||
import com.superproductivity.superproductivity.FullscreenActivity
|
||||
import com.superproductivity.superproductivity.FullscreenActivity.Companion.WINDOW_INTERFACE_PROPERTY
|
||||
import com.superproductivity.superproductivity.R
|
||||
import com.superproductivity.superproductivity.app.LaunchDecider
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import java.io.BufferedOutputStream
|
||||
|
|
@ -59,6 +61,15 @@ class JavaScriptInterface(
|
|||
storageHelper.storage.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
@JavascriptInterface
|
||||
fun getVersion(): String {
|
||||
val versionName = BuildConfig.VERSION_NAME
|
||||
val launchDecider = LaunchDecider(activity)
|
||||
val launchMode = launchDecider.getLaunchMode()
|
||||
return "${versionName}_L$launchMode"
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
@JavascriptInterface
|
||||
fun showToast(toast: String) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { HANDLED_ERROR_PROP_STR, IS_ELECTRON } from '../../app.constants';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import StackTrace from 'stacktrace-js';
|
||||
import pThrottle from 'p-throttle';
|
||||
import newGithubIssueUrl from 'new-github-issue-url';
|
||||
|
|
@ -7,6 +6,7 @@ import { getBeforeLastErrorActionLog } from '../../util/action-logger';
|
|||
import { download } from '../../util/download';
|
||||
import { AppDataComplete } from '../../imex/sync/sync.model';
|
||||
import { privacyExport } from '../../imex/file-imex/privacy-export';
|
||||
import { getAppVersionStr } from '../../util/get-app-version-str';
|
||||
|
||||
let isWasErrorAlertCreated = false;
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ export const createErrorAlert = (
|
|||
|
||||
export const getSimpleMeta = (): string => {
|
||||
const n = window.navigator;
|
||||
return `META: SP${environment.version} ${IS_ELECTRON ? 'Electron' : 'Browser'} – ${
|
||||
return `META: SP${getAppVersionStr()} __ ${IS_ELECTRON ? 'Electron' : 'Browser'} – ${
|
||||
n.language
|
||||
} – ${n.platform} – ${n.userAgent}`;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import { BehaviorSubject, merge, Observable, Subject } from 'rxjs';
|
|||
import { mapTo } from 'rxjs/operators';
|
||||
|
||||
export interface AndroidInterface {
|
||||
getVersion?(): string;
|
||||
|
||||
showToast(s: string): void;
|
||||
|
||||
showNotification(title: string, body: string): void;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ import {
|
|||
} from '../../features/config/global-config.model';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ProjectCfgFormKey } from '../../features/project/project.model';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { T } from '../../t.const';
|
||||
import { versions } from '../../../environments/versions';
|
||||
import { IS_ELECTRON } from '../../app.constants';
|
||||
import { IS_ANDROID_WEB_VIEW } from '../../util/is-android-web-view';
|
||||
import { getAutomaticBackUpFormCfg } from '../../features/config/form-cfgs/automatic-backups-form.const';
|
||||
import { MatButtonToggleChange } from '@angular/material/button-toggle';
|
||||
import { getAppVersionStr } from '../../util/get-app-version-str';
|
||||
|
||||
@Component({
|
||||
selector: 'config-page',
|
||||
|
|
@ -42,7 +42,7 @@ export class ConfigPageComponent implements OnInit, OnDestroy {
|
|||
|
||||
globalCfg?: GlobalConfigState;
|
||||
|
||||
appVersion: string = environment.version;
|
||||
appVersion: string = getAppVersionStr();
|
||||
versions?: any = versions;
|
||||
|
||||
private _subs: Subscription = new Subscription();
|
||||
|
|
|
|||
9
src/app/util/get-app-version-str.ts
Normal file
9
src/app/util/get-app-version-str.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { IS_ANDROID_WEB_VIEW } from './is-android-web-view';
|
||||
import { androidInterface } from '../features/android/android-interface';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
export const getAppVersionStr = (): string => {
|
||||
const b =
|
||||
(IS_ANDROID_WEB_VIEW && androidInterface?.getVersion?.()) || environment.version;
|
||||
return IS_ANDROID_WEB_VIEW ? `${b}A` : b;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue