android updates and minor flutter 3.19.3 fixes

This commit is contained in:
Dan Ballard 2024-04-04 10:52:53 -07:00
parent 644245d9ce
commit 48152acca1
24 changed files with 77 additions and 122 deletions

View File

@ -208,7 +208,7 @@ clone:
steps:
- name: clone
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.13.4
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.19.3
environment:
buildbot_key_b64:
from_secret: buildbot_key_b64
@ -226,7 +226,7 @@ steps:
- git checkout $Env:DRONE_COMMIT
- name: fetch
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.10.2
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.19.3
commands:
- git describe --tags --abbrev=1 > VERSION
- git log -1 --format=%cd --date=format:'%Y-%m-%d-%H-%M' > COMMIT_DATE
@ -234,7 +234,7 @@ steps:
- .\fetch-libcwtch-go.ps1
- name: build-windows
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.13.4
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.19.3
commands:
- flutter pub get
- $Env:version += type .\VERSION
@ -291,7 +291,7 @@ steps:
- move *.sha512.txt deploy\$Env:builddir
- name: deploy-windows
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.13.4
image: openpriv/flutter-desktop:windows-sdk30-fstable-3.19.3
when:
event: push
status: [ success ]

2
.gitignore vendored
View File

@ -59,7 +59,7 @@ package.
# Compiled Libs
linux/tor
linux/libCwtch.so
android/cwtch/cwtch.aar
android/app/cwtch/cwtch.aar
android/app/src/main/jniLibs/*/libtor.so
*.dylib
integration_test/gherkin_suite_test.g.dart

View File

@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
@ -21,10 +22,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// key.properties MUST have password placeholders filled in (via drone with secrets) and cwtch-upload.jks file must be added (from drone secret)
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
@ -33,7 +30,7 @@ if (keystorePropertiesFile.exists()) {
}
android {
compileSdkVersion 33
compileSdkVersion 34
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@ -54,7 +51,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "im.cwtch.flwtch"
minSdkVersion 19
targetSdkVersion 33
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -93,11 +90,11 @@ flutter {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(':cwtch')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.21" // same as kotlin version in settings.gradle
implementation fileTree( dir: 'cwtch')
implementation files ('cwtch/cwtch.aar')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2"
implementation "com.airbnb.android:lottie:5.2.0"
implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"
implementation "com.android.support.constraint:constraint-layout:2.0.4"

View File

@ -13,7 +13,7 @@
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/NormalTheme"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
@ -47,6 +47,7 @@
</application>
<!--Needed to access Tor socket-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Needed for running in the background -->
@ -58,9 +59,9 @@
Allows app to use ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS -->
<uses-permission-sdk-23 android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- TODO when we support sdk 31
<uses-permission-sdk-23 android:name="android.permission.HIDE_OVERLAY_WINDOWS" />
-->
<!--Needed to check if activity is foregrounded or if messages from the service should be queued-->
<uses-permission android:name="android.permission.GET_TASKS" />

View File

@ -1,6 +1,5 @@
package im.cwtch.flwtch
import SplashView
import android.annotation.TargetApi
import android.content.BroadcastReceiver
import android.content.Context
@ -19,7 +18,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.work.*
import cwtch.Cwtch
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.SplashScreen
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.ErrorLogResult
import io.flutter.plugin.common.MethodCall
@ -32,8 +30,6 @@ import java.util.concurrent.TimeUnit
import kotlinx.coroutines.*
class MainActivity: FlutterActivity() {
override fun provideSplashScreen(): SplashScreen? = SplashView()
// Channel to get app info
private val CHANNEL_APP_INFO = "test.flutter.dev/applicationInfo"

View File

@ -1,15 +0,0 @@
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import im.cwtch.flwtch.R
import io.flutter.embedding.android.SplashScreen
class SplashView : SplashScreen {
override fun createSplashView(context: Context, savedInstanceState: Bundle?): View? =
LayoutInflater.from(context).inflate(R.layout.splash_view, null, false)
override fun transitionToFlutter(onTransitionComplete: Runnable) {
onTransitionComplete.run()
}
}

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<item android:drawable="@color/darkGreyPurple" />
<!-- You can insert your own image assets here -->
<!-- <item>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
android:src="@mipmap/knott" />
</item>
</layer-list>

View File

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<item android:drawable="@color/darkGreyPurple" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
<item android:drawable="@drawable/knott"
android:gravity="center"
/>
</layer-list>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:lottie_autoPlay="true"
app:lottie_rawRes="@raw/cwtch_animated_logo_op"
app:lottie_loop="true"
app:lottie_speed="1.00"
app:lottie_enableMergePathsForKitKatAndAbove="true" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -1,18 +1,3 @@
buildscript {
ext.kotlin_version = '1.8.21'
repositories {
google()
// jCenter() no longer exists... https://blog.gradle.org/jcenter-shutdown
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
@ -28,7 +13,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
//removed due to gradle namespace conflicts that are beyond erinn's mere mortal understanding
//task clean(type: Delete) {
// delete rootProject.buildDir
//}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

View File

@ -1,11 +1,25 @@
include ':app', ':cwtch'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.4.2" apply false
id "org.jetbrains.kotlin.android" version "1.8.21" apply false
}
include ":app"

View File

@ -3,6 +3,6 @@
VERSION=`cat LIBCWTCH-GO.version`
echo $VERSION
curl --fail https://build.openprivacy.ca/files/libCwtch-autobindings-$VERSION/android/cwtch.aar --output android/cwtch/cwtch.aar
curl --fail https://build.openprivacy.ca/files/libCwtch-autobindings-$VERSION/android/cwtch.aar --output android/app/cwtch/cwtch.aar
# FIXME...at some point we need to support different linux architectures...for now rely on existing expectations and rename x64 lib
curl --fail https://build.openprivacy.ca/files/libCwtch-autobindings-$VERSION/linux/libCwtch.x64.so --output linux/libCwtch.so
curl --fail https://build.openprivacy.ca/files/libCwtch-autobindings-$VERSION/linux/libCwtch.x64.so --output linux/libCwtch.so

View File

@ -59,9 +59,7 @@ class CwtchNotifier {
switch (type) {
case "CwtchStarted":
flwtchState.cwtch.getCwtchDir().then((dir) {
globalSettings.themeloader.LoadThemes(dir);
});
if (data["Reload"] == "true" && profileCN.num > 0) {
// don't reload...
@ -310,6 +308,7 @@ class CwtchNotifier {
break;
case "UpdateGlobalSettings":
settings.handleUpdate(jsonDecode(data["Data"]));
appState.settingsLoaded = true;
break;
case "UpdatedProfileAttribute":
if (data["Key"] == "public.profile.name") {

View File

@ -107,6 +107,9 @@ class FlwtchState extends State<Flwtch> with WindowListener {
Future.delayed(const Duration(milliseconds: 100), () {
print("initState delayed: invoking cwtch.Start()");
cwtch.Start();
cwtch.getCwtchDir().then((dir) {
globalSettings.themeloader.LoadThemes(dir);
});
});
print("initState: starting connectivityListener");
if (EnvironmentConfig.TEST_MODE == false) {
@ -185,7 +188,7 @@ class FlwtchState extends State<Flwtch> with WindowListener {
title: 'Cwtch',
showSemanticsDebugger: settings.useSemanticDebugger,
theme: mkThemeData(settings),
home: (!appState.cwtchInit || appState.modalState != ModalState.none) ? SplashView() : ProfileMgrView(),
home: (!appState.loaded) ? SplashView() : ProfileMgrView(),
),
);
},

View File

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:cwtch/config.dart';
import 'package:cwtch/main.dart';
import 'package:flutter/widgets.dart';
enum ModalState { none, storageMigration, shutdown }
@ -17,6 +18,8 @@ class AppState extends ChangeNotifier {
bool _unreadMessagesBelow = false;
bool _disableFilePicker = false;
bool _focus = true;
bool _settingsLoaded = false;
bool _themesLoaded = false;
StreamController<bool> _profilesUnreadNotifyControler = StreamController<bool>();
late Stream<bool> profilesUnreadNotify;
@ -85,6 +88,18 @@ class AppState extends ChangeNotifier {
notifyListeners();
}
set settingsLoaded(bool newVal) {
_settingsLoaded = newVal;
notifyListeners();
}
set themesLoaded(bool newVal) {
_themesLoaded = newVal;
notifyListeners();
}
bool get loaded => cwtchInit && _settingsLoaded && globalSettings.themeloader.themes.length > 0 && modalState == ModalState.none;
bool isLandscape(BuildContext c) => MediaQuery.of(c).size.width > MediaQuery.of(c).size.height;
void notifyProfileUnread() {

View File

@ -31,6 +31,7 @@ class _TorStatusView extends State<TorStatusView> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor,
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.torNetworkStatus),
),