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

2
.gitignore vendored
View File

@ -59,7 +59,7 @@ package.
# Compiled Libs # Compiled Libs
linux/tor linux/tor
linux/libCwtch.so linux/libCwtch.so
android/cwtch/cwtch.aar android/app/cwtch/cwtch.aar
android/app/src/main/jniLibs/*/libtor.so android/app/src/main/jniLibs/*/libtor.so
*.dylib *.dylib
integration_test/gherkin_suite_test.g.dart 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 localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { 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') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = '1' flutterVersionCode = '1'
@ -21,10 +22,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0' 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) // 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 keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties') def keystorePropertiesFile = rootProject.file('key.properties')
@ -33,7 +30,7 @@ if (keystorePropertiesFile.exists()) {
} }
android { android {
compileSdkVersion 33 compileSdkVersion 34
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' 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). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "im.cwtch.flwtch" applicationId "im.cwtch.flwtch"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 33 targetSdkVersion 34
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -93,11 +90,11 @@ flutter {
} }
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.21" // same as kotlin version in settings.gradle
implementation project(':cwtch') 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-core:1.3.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android: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 "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"
implementation "com.android.support.constraint:constraint-layout:2.0.4" implementation "com.android.support.constraint:constraint-layout:2.0.4"

View File

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

View File

@ -1,6 +1,5 @@
package im.cwtch.flwtch package im.cwtch.flwtch
import SplashView
import android.annotation.TargetApi import android.annotation.TargetApi
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
@ -19,7 +18,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.work.* import androidx.work.*
import cwtch.Cwtch import cwtch.Cwtch
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.SplashScreen
import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.ErrorLogResult import io.flutter.plugin.common.ErrorLogResult
import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodCall
@ -32,8 +30,6 @@ import java.util.concurrent.TimeUnit
import kotlinx.coroutines.* import kotlinx.coroutines.*
class MainActivity: FlutterActivity() { class MainActivity: FlutterActivity() {
override fun provideSplashScreen(): SplashScreen? = SplashView()
// Channel to get app info // Channel to get app info
private val CHANNEL_APP_INFO = "test.flutter.dev/applicationInfo" 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"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen --> <!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <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 --> <!-- You can insert your own image assets here -->
<!-- <item> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
android:src="@mipmap/launch_image" /> android:src="@mipmap/knott" />
</item> --> </item>
</layer-list> </layer-list>

View File

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen --> <!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <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 --> <!-- You can insert your own image assets here -->
<!-- <item> <item android:drawable="@drawable/knott"
<bitmap android:gravity="center"
android:gravity="center" />
android:src="@mipmap/launch_image" />
</item> -->
</layer-list> </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 { allprojects {
repositories { repositories {
google() google()
@ -28,7 +13,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
//removed due to gradle namespace conflicts that are beyond erinn's mere mortal understanding tasks.register("clean", Delete) {
//task clean(type: Delete) { delete rootProject.buildDir
// 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") includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
def properties = new Properties()
assert localPropertiesFile.exists() repositories {
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } google()
mavenCentral()
gradlePluginPortal()
}
}
def flutterSdkPath = properties.getProperty("flutter.sdk") plugins {
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" id "dev.flutter.flutter-plugin-loader" version "1.0.0"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 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` VERSION=`cat LIBCWTCH-GO.version`
echo $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 # 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) { switch (type) {
case "CwtchStarted": case "CwtchStarted":
flwtchState.cwtch.getCwtchDir().then((dir) {
globalSettings.themeloader.LoadThemes(dir);
});
if (data["Reload"] == "true" && profileCN.num > 0) { if (data["Reload"] == "true" && profileCN.num > 0) {
// don't reload... // don't reload...
@ -310,6 +308,7 @@ class CwtchNotifier {
break; break;
case "UpdateGlobalSettings": case "UpdateGlobalSettings":
settings.handleUpdate(jsonDecode(data["Data"])); settings.handleUpdate(jsonDecode(data["Data"]));
appState.settingsLoaded = true;
break; break;
case "UpdatedProfileAttribute": case "UpdatedProfileAttribute":
if (data["Key"] == "public.profile.name") { 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), () { Future.delayed(const Duration(milliseconds: 100), () {
print("initState delayed: invoking cwtch.Start()"); print("initState delayed: invoking cwtch.Start()");
cwtch.Start(); cwtch.Start();
cwtch.getCwtchDir().then((dir) {
globalSettings.themeloader.LoadThemes(dir);
});
}); });
print("initState: starting connectivityListener"); print("initState: starting connectivityListener");
if (EnvironmentConfig.TEST_MODE == false) { if (EnvironmentConfig.TEST_MODE == false) {
@ -185,7 +188,7 @@ class FlwtchState extends State<Flwtch> with WindowListener {
title: 'Cwtch', title: 'Cwtch',
showSemanticsDebugger: settings.useSemanticDebugger, showSemanticsDebugger: settings.useSemanticDebugger,
theme: mkThemeData(settings), 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 'dart:async';
import 'package:cwtch/config.dart'; import 'package:cwtch/config.dart';
import 'package:cwtch/main.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
enum ModalState { none, storageMigration, shutdown } enum ModalState { none, storageMigration, shutdown }
@ -17,6 +18,8 @@ class AppState extends ChangeNotifier {
bool _unreadMessagesBelow = false; bool _unreadMessagesBelow = false;
bool _disableFilePicker = false; bool _disableFilePicker = false;
bool _focus = true; bool _focus = true;
bool _settingsLoaded = false;
bool _themesLoaded = false;
StreamController<bool> _profilesUnreadNotifyControler = StreamController<bool>(); StreamController<bool> _profilesUnreadNotifyControler = StreamController<bool>();
late Stream<bool> profilesUnreadNotify; late Stream<bool> profilesUnreadNotify;
@ -85,6 +88,18 @@ class AppState extends ChangeNotifier {
notifyListeners(); 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; bool isLandscape(BuildContext c) => MediaQuery.of(c).size.width > MediaQuery.of(c).size.height;
void notifyProfileUnread() { void notifyProfileUnread() {

View File

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