diff --git a/.drone.yml b/.drone.yml index 528c38f8..d71da022 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ clone: steps: - name: clone - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 environment: buildbot_key_b64: from_secret: buildbot_key_b64 @@ -24,7 +24,7 @@ steps: - git checkout $DRONE_COMMIT - name: fetch - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 volumes: - name: deps path: /root/.pub-cache @@ -47,7 +47,7 @@ steps: # #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting - name: build-linux - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 volumes: - name: deps path: /root/.pub-cache @@ -77,7 +77,7 @@ steps: - name: linux-ui-tests - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 volumes: - name: deps path: /root/.pub-cache @@ -86,7 +86,7 @@ steps: - ./run-tests-headless.sh "01_general|01_tor|02_global_settings|04_profile_mgmt" - name: test-build-android - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 when: event: pull_request volumes: @@ -96,7 +96,7 @@ steps: - flutter build apk --debug - name: build-android - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 when: event: push environment: @@ -120,7 +120,7 @@ steps: #- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android - name: widget-tests - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 volumes: - name: deps path: /root/.pub-cache @@ -130,7 +130,7 @@ steps: - genhtml coverage/lcov.info -o coverage/html - name: upload-nightlies - image: openpriv/flutter-desktop:linux-fstable-3.13.4 + image: openpriv/flutter-desktop:linux-fstable-3.19.3 environment: GOGS_ACCOUNT_TOKEN: from_secret: gogs_account_token @@ -142,9 +142,6 @@ steps: event: push status: [ success ] commands: - # TODO When we update Flutter Container to 3.19 migrate these calls... - - apt update - - apt install -y jq openssh-client ca-certificates curl - ./upload-releases.sh deploy/cwtch-`cat VERSION`.apk application/vnd.android.package-archive cwtch-`cat VERSION`.apk - name: deploy-buildfiles @@ -211,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 @@ -229,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 @@ -237,12 +234,12 @@ 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 - $Env:commitdate += type .\COMMIT_DATE - - $Env:releasedir = "build\\windows\\runner\\Release\\" + - $Env:releasedir = "build\\windows\\x64\\runner\\Release\\" - flutter build windows --dart-define BUILD_VER=$Env:version --dart-define BUILD_DATE=$Env:commitdate - copy windows\libCwtch.dll $Env:releasedir # flutter hasn't worked out it's packaging of required dll's so we have to resort to this manual nonsense @@ -269,7 +266,7 @@ steps: commands: - $Env:version += type .\VERSION - $Env:commitdate += type .\COMMIT_DATE - - $Env:releasedir = "build\\windows\\runner\\Release\\" + - $Env:releasedir = "build\\windows\\x64\\runner\\Release\\" - $Env:zip = 'cwtch-' + $Env:version + '.zip' - $Env:zipsha = $Env:zip + '.sha512.txt' - $Env:buildname = 'flwtch-' + $Env:commitdate + '-' + $Env:version @@ -294,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 ] @@ -366,6 +363,7 @@ steps: commands: - export PATH=$PATH:/Users/drone/bin/flutter/bin - export PATH=$GEM_HOME/ruby/2.6.0/bin:$PATH + - flutter doctor - flutter build macos --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat COMMIT_DATE` - export PATH=$PATH:/opt/homebrew/bin/ #create-dmg - macos/package-release.sh diff --git a/.gitignore b/.gitignore index 48117da2..65babc31 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ test_home .pub-cache/ .pub/ /build/ +./lib/gen/ # Web related lib/generated_plugin_registrant.dart @@ -58,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 diff --git a/android/app/build.gradle b/android/app/build.gradle index 2c4c8b1d..896cb4b5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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" diff --git a/android/cwtch/build.gradle b/android/app/cwtch/build.gradle similarity index 100% rename from android/cwtch/build.gradle rename to android/app/cwtch/build.gradle diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a7f8e23c..223271b2 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ + @@ -58,9 +59,9 @@ Allows app to use ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS --> - + diff --git a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt index 5fc51764..68964baf 100644 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt +++ b/android/app/src/main/kotlin/im/cwtch/flwtch/MainActivity.kt @@ -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" diff --git a/android/app/src/main/kotlin/im/cwtch/flwtch/SplashView.kt b/android/app/src/main/kotlin/im/cwtch/flwtch/SplashView.kt deleted file mode 100644 index 82f4726a..00000000 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/SplashView.kt +++ /dev/null @@ -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() - } -} \ No newline at end of file diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml index f74085f3..c6ce3f9c 100644 --- a/android/app/src/main/res/drawable-v21/launch_background.xml +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -1,12 +1,12 @@ - + - + android:src="@mipmap/knott" /> + diff --git a/android/app/src/main/res/drawable/knott.xml b/android/app/src/main/res/drawable/knott.xml new file mode 100644 index 00000000..a7eb243b --- /dev/null +++ b/android/app/src/main/res/drawable/knott.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml index 304732f8..c62dd18a 100644 --- a/android/app/src/main/res/drawable/launch_background.xml +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -1,12 +1,10 @@ - + - + diff --git a/android/app/src/main/res/layout/splash_view.xml b/android/app/src/main/res/layout/splash_view.xml deleted file mode 100644 index 8794c810..00000000 --- a/android/app/src/main/res/layout/splash_view.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..4732f3cd --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/src/main/res/raw/cwtch_animated_logo_op.json b/android/app/src/main/res/raw/cwtch_animated_logo_op.json deleted file mode 100644 index 84c07d87..00000000 --- a/android/app/src/main/res/raw/cwtch_animated_logo_op.json +++ /dev/null @@ -1 +0,0 @@ -{"v":"4.8.0","meta":{"g":"LottieFiles AE 3.1.1","a":"","k":"","d":"","tc":""},"fr":29.9700012207031,"ip":0,"op":100.000004073084,"w":1000,"h":1000,"nm":"Comp 1","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":0,"nm":"hart","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":270,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":58.0000023623884,"op":208.000008472014,"st":58.0000023623884,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"hart","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":180,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":43.0000017514259,"op":193.000007861051,"st":43.0000017514259,"bm":0},{"ddd":0,"ind":3,"ty":0,"nm":"hart","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":90,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":28.0000011404634,"op":178.000007250089,"st":28.0000011404634,"bm":0},{"ddd":0,"ind":4,"ty":0,"nm":"hart","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":13.0000005295009,"op":163.000006639126,"st":13.0000005295009,"bm":0}]},{"id":"comp_1","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[517,337.5,0],"ix":2},"a":{"a":0,"k":[81.5,48.5,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":0,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[-161.75,0.001],[-161.75,96.551],[-38.785,96.602],[0.965,0.001],[-49.452,0.001]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":2.728,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[-23.107,0],[-23.107,96.551],[101.679,96.616],[139.608,0],[89.191,0]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":3.183,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[-18.486,0],[-18.486,96.551],[106.686,96.613],[170.894,0.365],[106.453,0]],"c":true}]},{"t":5.00000020365417,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[0,0],[0,96.55],[126.715,96.601],[199.465,97.751],[175.5,0]],"c":true}]}],"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-5.2,-1.8],[-2.1,-2],[-2,-5.4],[0.4,-3.3],[2.2,-5.1],[0,0],[23,23],[20.2,-4.1],[2,-1.2],[0,0],[-5.4,-6.9],[0,0],[-8.6,5.3],[-3.8,0.5]],"o":[[5,1.8],[5.9,5.9],[2,5.5],[-0.5,4.4],[0,0],[16.4,-30.3],[-13.2,-13.2],[-14,2.8],[0,0],[3.1,6],[0,0],[4.3,-4.1],[5.2,-3.2],[6.9,-1.1]],"v":[[34.743,-23.825],[45.143,-17.025],[56.842,-0.325],[58.242,12.975],[54.042,27.275],[71.042,44.275],[61.342,-33.125],[11.042,-46.825],[-15.857,-36.525],[-81.357,28.875],[-68.558,48.275],[-18.357,-1.825],[3.243,-19.225],[16.742,-24.825]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[81.357,48.275],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150.000006109625,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[479,385.5,0],"ix":2},"a":{"a":0,"k":[83.5,93.5,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":5,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[133.25,102.75],[103.75,118.98],[171.5,100.656],[166.583,186.406],[194.833,112.75],[160.315,85]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":7,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[74.028,57.083],[94.389,125.23],[105.028,192.517],[166.583,186.406],[182.277,62.639],[140.537,47.222]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":9,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[7.778,16.833],[-2.111,-3.02],[-8.722,190.017],[166.583,186.406],[182.277,62.639],[140.537,47.222]],"c":true}]},{"t":11.0000004480392,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[93.028,-1.667],[-2.111,-3.02],[-8.722,190.017],[166.583,186.406],[182.277,62.639],[140.537,47.222]],"c":true}]}],"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[13.2,-13.2],[-19.1,-32.4],[-7.1,-8.5],[-29.7,-23.6],[-13.6,13.6],[-5.1,5.9],[0,0],[6.3,-6.3],[11.7,-9.9],[0,0],[0,0],[12.3,15.1],[3.9,8.1],[0.3,5.6],[-2.1,5.2],[-5.5,5.5],[-5,1.8],[-6.9,-1.3],[0,0],[-4,-2.3],[0,0],[9.9,2]],"o":[[-24.2,24.2],[4.6,7.8],[16.3,19.5],[19.4,-15.4],[6.3,-6.3],[0,0],[-5,5.9],[-9,9],[0,0],[0,0],[-21.5,-18.1],[-7.8,-9.6],[-3.4,-7],[-0.2,-2.7],[2.1,-5],[2.1,-2.1],[5.2,-1.9],[0,0],[3,0.6],[0,0],[-4.8,-2.4],[-20.2,-4.2]],"v":[[-63.208,-78.097],[-70.508,3.703],[-52.809,28.303],[16.392,93.203],[66.191,49.403],[83.292,31.103],[67.092,14.903],[50.092,33.303],[18.892,61.703],[16.392,63.803],[13.892,61.703],[-37.008,11.603],[-54.708,-15.097],[-60.309,-34.097],[-58.309,-46.197],[-47.008,-61.897],[-36.609,-68.697],[-18.609,-69.597],[-18.508,-69.597],[-8.109,-65.297],[10.092,-83.497],[-12.909,-91.697]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[83.291,93.203],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":5.00000020365417,"op":155.000006313279,"st":5.00000020365417,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[554.5,376,0],"ix":2},"a":{"a":0,"k":[50,48,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"a","pt":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":11,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[0,0],[0,95.1],[0,95.1],[0,0]],"c":true}]},{"t":16.0000006516934,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[0,0],[0,95.1],[99.2,95.1],[99.2,0]],"c":true}]}],"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[3.7,-3.5],[0,0],[-6,3.9]],"o":[[-7.1,4.8],[0,0],[6.4,-5.2],[0,0]],"v":[[-31.9,-47.55],[-49.6,-32.95],[30.9,47.55],[49.6,33.95]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[49.6,47.55],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":11.0000004480392,"op":161.000006557664,"st":11.0000004480392,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"harts","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[500,500,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":80,"s":[100,100,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":82,"s":[110,110,100]},{"t":90.0000036657751,"s":[0,0,100]}],"ix":6}},"ao":0,"w":1000,"h":1000,"ip":0,"op":100.000004073084,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"OUTLINE","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500.436,500.35,0],"ix":2},"a":{"a":0,"k":[243,243,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":0,"s":[0,0,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":10,"s":[118,118,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":13,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":80,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":82,"s":[110,110,100]},{"t":90.0000036657751,"s":[0,0,100]}],"ix":6,"x":"var $bm_rt;\n$bm_rt = transform.scale;"}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.7,6.3],[-1.8,8.7],[20.9,20.9],[23.8,0],[7.7,-2],[1.4,10.9],[16.7,16.8],[22.9,0],[6.8,-1.4],[6.2,-2.6],[8.7,1.8],[6.5,0],[16.3,-16.2],[1.9,-20.9],[-2.7,-10.3],[7.5,0],[19.7,-19.7],[-6.2,-30.8],[-2.6,-6.2],[1.8,-8.7],[-20.9,-20.9],[-23.8,0],[-7.7,2],[-1.4,-10.9],[-16.7,-16.8],[-22.9,0],[-6.8,1.4],[-6.2,2.7],[-8.7,-1.8],[-6.6,0],[-16.3,16.2],[-1.9,20.9],[2.7,10.3],[-7.5,0],[-19.7,19.7],[6.3,30.8]],"o":[[2.6,-6.3],[6.3,-30.8],[-19.7,-19.7],[-7.5,0],[2.9,-11.3],[-2.5,-19.8],[-16.2,-16.3],[-6.6,0],[-8.7,1.8],[-6.3,-2.6],[-6.9,-1.4],[-22.9,0],[-17.6,17.6],[-0.9,9.9],[-7.7,-2],[-23.8,0],[-20.9,20.9],[1.8,8.7],[-2.6,6.3],[-6.2,30.8],[19.7,19.7],[7.5,0],[-2.9,11.3],[2.5,19.8],[16.2,16.2],[6.6,0],[8.7,-1.8],[6.3,2.6],[6.9,1.4],[22.9,0],[17.6,-17.6],[0.9,-9.9],[7.7,2],[23.8,0],[20.9,-20.9],[-1.7,-8.8]],"v":[[233.38,-0.05],[240.48,-22.75],[217.78,-102.85],[152.28,-132.55],[129.48,-129.55],[131.78,-162.75],[102.78,-217.85],[42.98,-242.65],[22.78,-240.55],[0.08,-233.45],[-22.72,-240.55],[-42.92,-242.65],[-102.82,-217.85],[-132.22,-159.75],[-129.52,-129.55],[-152.32,-132.55],[-217.82,-102.85],[-240.52,-22.75],[-233.42,-0.05],[-240.52,22.75],[-217.82,102.85],[-152.32,132.55],[-129.52,129.55],[-131.82,162.75],[-102.82,217.85],[-43.02,242.65],[-22.82,240.55],[-0.12,233.45],[22.58,240.55],[42.88,242.65],[102.78,217.85],[132.18,159.75],[129.48,129.55],[152.28,132.55],[217.78,102.85],[240.48,22.75]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.141176470588,0.141176470588,0.145098039216,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[242.564,242.65],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":100.000004073084,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/android/app/src/main/res/values-v26/styles.xml b/android/app/src/main/res/values-v26/styles.xml new file mode 100644 index 00000000..4332e406 --- /dev/null +++ b/android/app/src/main/res/values-v26/styles.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..600064c7 --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + #281831 + #00ff00 + @color/darkGreyPurple + diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values/styles.xml similarity index 74% rename from android/app/src/main/res/values-night/styles.xml rename to android/app/src/main/res/values/styles.xml index 449a9f93..8869be16 100644 --- a/android/app/src/main/res/values-night/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,18 +1,23 @@ - - + + + + + - - + \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index cd6c32c0..bc157bd1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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 +} diff --git a/android/settings.gradle b/android/settings.gradle index f847febc..cf00f3cb 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -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" diff --git a/fetch-libcwtch-go.sh b/fetch-libcwtch-go.sh index d934214e..35295a7b 100755 --- a/fetch-libcwtch-go.sh +++ b/fetch-libcwtch-go.sh @@ -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 \ No newline at end of file +curl --fail https://build.openprivacy.ca/files/libCwtch-autobindings-$VERSION/linux/libCwtch.x64.so --output linux/libCwtch.so diff --git a/lib/controllers/open_link_modal.dart b/lib/controllers/open_link_modal.dart index 10d81697..d0baacf3 100644 --- a/lib/controllers/open_link_modal.dart +++ b/lib/controllers/open_link_modal.dart @@ -37,7 +37,7 @@ void modalOpenLink(BuildContext ctx, LinkableElement link) { final snackBar = SnackBar( content: Text( AppLocalizations.of(bcontext)!.copiedToClipboardNotification, - style: Provider.of(bcontext).scaleFonts(defaultTextButtonStyle), + style: Provider.of(bcontext, listen: false).scaleFonts(defaultTextButtonStyle), ), ); diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index d0a153fe..65e67921 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -3,7 +3,6 @@ import 'package:cwtch/cwtch/cwtch.dart'; import 'package:cwtch/main.dart'; import 'package:cwtch/models/appstate.dart'; import 'package:cwtch/models/contact.dart'; -import 'package:cwtch/models/message.dart'; import 'package:cwtch/models/profilelist.dart'; import 'package:cwtch/models/remoteserver.dart'; import 'package:cwtch/models/servers.dart'; @@ -59,6 +58,9 @@ class CwtchNotifier { // EnvironmentConfig.debugLog("NewEvent $type $data"); switch (type) { case "CwtchStarted": + + + if (data["Reload"] == "true" && profileCN.num > 0) { // don't reload... // unless we have loaded no profiles...then there isnt a risk and this @@ -306,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") { diff --git a/lib/l10n/custom_material_delegate.dart b/lib/l10n/custom_material_delegate.dart index 59041c9c..963749f6 100644 --- a/lib/l10n/custom_material_delegate.dart +++ b/lib/l10n/custom_material_delegate.dart @@ -648,4 +648,20 @@ class MaterialLocalizationLu extends MaterialLocalizations { @override // TODO: implement scanTextButtonLabel String get scanTextButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement lookUpButtonLabel + String get lookUpButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement menuDismissLabel + String get menuDismissLabel => throw UnimplementedError(); + + @override + // TODO: implement searchWebButtonLabel + String get searchWebButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement shareButtonLabel + String get shareButtonLabel => throw UnimplementedError(); } diff --git a/lib/main.dart b/lib/main.dart index d73071ab..63abded5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -103,10 +103,10 @@ class FlwtchState extends State with WindowListener { new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, newDesktopNotificationsManager(_notificationSelectConvo), globalAppState, globalServersList, this); cwtch = CwtchFfi(cwtchNotifier); } - print("initState: invoking cwtch.Start()"); // Cwtch.start can take time, we don't want it blocking first splash screen draw, so postpone a smidge to let splash render - - cwtch.Start().then((vale) { + Future.delayed(const Duration(milliseconds: 100), () { + print("initState delayed: invoking cwtch.Start()"); + cwtch.Start(); cwtch.getCwtchDir().then((dir) { globalSettings.themeloader.LoadThemes(dir); }); @@ -188,7 +188,7 @@ class FlwtchState extends State with WindowListener { title: 'Cwtch', showSemanticsDebugger: settings.useSemanticDebugger, theme: mkThemeData(settings), - home: (!appState.cwtchInit || appState.modalState != ModalState.none) ? SplashView() : ProfileMgrView(), + home: (!appState.loaded) ? SplashView() : ProfileMgrView(), ), ); }, diff --git a/lib/models/appstate.dart b/lib/models/appstate.dart index 45bc8709..bd5e9a14 100644 --- a/lib/models/appstate.dart +++ b/lib/models/appstate.dart @@ -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 _profilesUnreadNotifyControler = StreamController(); late Stream 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() { diff --git a/lib/models/message_draft.dart b/lib/models/message_draft.dart index 1a1188db..bd483e73 100644 --- a/lib/models/message_draft.dart +++ b/lib/models/message_draft.dart @@ -49,6 +49,8 @@ class MessageDraft extends ChangeNotifier { void clearDraft() { this._quotedReference = null; this.ctrlCompose.clear(); + this.ctrlCompose.clearComposing(); + this.ctrlCompose.text = ""; this._inviteHandle = null; notifyListeners(); } diff --git a/lib/themes/opaque.dart b/lib/themes/opaque.dart index 3cccbc2a..a8d39fdb 100644 --- a/lib/themes/opaque.dart +++ b/lib/themes/opaque.dart @@ -15,7 +15,11 @@ const mode_dark = "dark"; final TextStyle defaultSmallTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.normal, fontSize: 10); final TextStyle defaultMessageTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.w400, fontSize: 13, fontFamilyFallback: [Platform.isWindows ? 'Segoe UI Emoji' : "Noto Color Emoji"]); -final TextStyle defaultFormLabelTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.bold, fontSize: 20); +final TextStyle defaultFormLabelTextStyle = TextStyle( + fontFamily: "Inter", + fontWeight: FontWeight.bold, + fontSize: 20, +); final TextStyle defaultTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.w500, fontSize: 12); final TextStyle defaultTextButtonStyle = defaultTextStyle.copyWith(fontWeight: FontWeight.bold); final TextStyle defaultDropDownMenuItemTextStyle = TextStyle(fontFamily: "Inter", fontWeight: FontWeight.bold, fontSize: 16); @@ -186,6 +190,12 @@ ThemeData mkThemeData(Settings opaque) { color: opaque.current().toolbarIconColor, ), cardColor: opaque.current().backgroundMainColor, + bottomSheetTheme: BottomSheetThemeData( + backgroundColor: opaque.current().backgroundPaneColor, + constraints: const BoxConstraints( + maxWidth: double.infinity, + ), + ), appBarTheme: AppBarTheme( systemOverlayStyle: SystemUiOverlayStyle( // Status bar color @@ -202,7 +212,8 @@ ThemeData mkThemeData(Settings opaque) { actionsIconTheme: IconThemeData( color: opaque.current().mainTextColor, )), - + listTileTheme: ListTileThemeData(titleTextStyle: defaultFormLabelTextStyle, subtitleTextStyle: defaultMessageTextStyle), + iconButtonTheme: IconButtonThemeData(style: ButtonStyle(textStyle: MaterialStateProperty.all(defaultFormLabelTextStyle))), //bottomNavigationBarTheme: BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed, backgroundColor: opaque.current().backgroundHilightElementColor), // Can't determine current use textButtonTheme: TextButtonThemeData( style: ButtonStyle( @@ -231,12 +242,12 @@ ThemeData mkThemeData(Settings opaque) { ), scrollbarTheme: ScrollbarThemeData(thumbVisibility: MaterialStateProperty.all(false), thumbColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor)), tabBarTheme: TabBarTheme( - labelColor: opaque.current().mainTextColor, - unselectedLabelColor: opaque.current().mainTextColor, - indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor)), - labelStyle: opaque.scaleFonts(defaultTextButtonStyle), - unselectedLabelStyle: opaque.scaleFonts(defaultTextStyle), - ), + labelColor: opaque.current().mainTextColor, + unselectedLabelColor: opaque.current().mainTextColor, + indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor)), + labelStyle: opaque.scaleFonts(defaultTextButtonStyle), + unselectedLabelStyle: opaque.scaleFonts(defaultTextStyle), + tabAlignment: TabAlignment.center), dialogTheme: DialogTheme( backgroundColor: opaque.current().backgroundPaneColor, titleTextStyle: TextStyle(fontFamily: "Inter", fontWeight: FontWeight.bold, color: opaque.current().mainTextColor), diff --git a/lib/third_party/connectivity_plus/connectivity_plus/pubspec.lock b/lib/third_party/connectivity_plus/connectivity_plus/pubspec.lock new file mode 100644 index 00000000..6810418d --- /dev/null +++ b/lib/third_party/connectivity_plus/connectivity_plus/pubspec.lock @@ -0,0 +1,673 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + url: "https://pub.dev" + source: hosted + version: "67.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + url: "https://pub.dev" + source: hosted + version: "6.4.1" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" + url: "https://pub.dev" + source: hosted + version: "2.4.8" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e + url: "https://pub.dev" + source: hosted + version: "8.9.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + connectivity_plus_platform_interface: + dependency: "direct main" + description: + path: "../connectivity_plus_platform_interface" + relative: true + source: path + version: "1.2.4" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + coverage: + dependency: transitive + description: + name: coverage + sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + url: "https://pub.dev" + source: hosted + version: "1.7.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" + url: "https://pub.dev" + source: hosted + version: "2.3.6" + dbus: + dependency: "direct dev" + description: + name: dbus + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" + url: "https://pub.dev" + source: hosted + version: "0.7.10" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: "direct main" + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + meta: + dependency: "direct main" + description: + name: meta + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + mime: + dependency: transitive + description: + name: mime + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + mockito: + dependency: "direct dev" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + plugin_platform_interface: + dependency: "direct dev" + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: "direct dev" + description: + name: test + sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f + url: "https://pub.dev" + source: hosted + version: "1.24.9" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + test_core: + dependency: transitive + description: + name: test_core + sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a + url: "https://pub.dev" + source: hosted + version: "0.5.9" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2" + url: "https://pub.dev" + source: hosted + version: "2.4.4" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.7.0" diff --git a/lib/third_party/connectivity_plus/connectivity_plus/pubspec.yaml b/lib/third_party/connectivity_plus/connectivity_plus/pubspec.yaml index 980638be..d1770f0f 100644 --- a/lib/third_party/connectivity_plus/connectivity_plus/pubspec.yaml +++ b/lib/third_party/connectivity_plus/connectivity_plus/pubspec.yaml @@ -34,6 +34,7 @@ dependencies: js: ^0.6.3 meta: ^1.8.0 + cwtch: any dev_dependencies: flutter_test: sdk: flutter diff --git a/lib/third_party/linkify/flutter_linkify.dart b/lib/third_party/linkify/flutter_linkify.dart index 210b634b..06a64090 100644 --- a/lib/third_party/linkify/flutter_linkify.dart +++ b/lib/third_party/linkify/flutter_linkify.dart @@ -126,7 +126,7 @@ class SelectableLinkify extends StatelessWidget { /// Called when the user changes the selection of text (including the cursor location). final SelectionChangedCallback? onSelectionChanged; - final BoxConstraints constraints; + final BoxConstraints? constraints; const SelectableLinkify({ Key? key, @@ -161,7 +161,7 @@ class SelectableLinkify extends StatelessWidget { this.cursorHeight, this.selectionControls, this.onSelectionChanged, - required this.constraints, + this.constraints, }) : super(key: key); @override @@ -235,7 +235,7 @@ TextSpan buildTextSpan( LinkCallback? onOpen, required BuildContext context, bool useMouseRegion = false, - required BoxConstraints constraints, + BoxConstraints? constraints, }) { // Ok, so the problem here is that Flutter really wants to optimize this function // out of the rebuild process. This is fine when the screen gets smaller because @@ -247,7 +247,7 @@ TextSpan buildTextSpan( // (I tried a few other things, including the docs-sanctioned MediaQuery.sizeOf(context) - which promises a rebuild // but Flutter is pretty good at optimizing "useless" checks out) String inlineText = "\u0020"; - if (constraints.maxWidth % 2 == 0) { + if (constraints != null && constraints.maxWidth % 2 == 0) { inlineText = "\u00A0"; } elements.add(TextElement(inlineText)); diff --git a/lib/views/addeditprofileview.dart b/lib/views/addeditprofileview.dart index 1103e149..6e015302 100644 --- a/lib/views/addeditprofileview.dart +++ b/lib/views/addeditprofileview.dart @@ -92,8 +92,8 @@ class _AddEditProfileViewState extends State { child: Form( key: _formKey, child: Container( - margin: EdgeInsets.all(30), - padding: EdgeInsets.all(20), + color: theme.theme.backgroundPaneColor, + padding: EdgeInsets.all(50), child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ Visibility( visible: Provider.of(context).onion.isNotEmpty, diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index eeb2e3ff..14b5b6fa 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -69,9 +69,6 @@ void selectConversation(BuildContext context, int handle, int? messageIndex) { // triggers update in Double/TripleColumnView Provider.of(context, listen: false).hoveredIndex = -1; Provider.of(context, listen: false).selectedConversation = handle; - if (index != null) { - Provider.of(context, listen: false).initialScrollIndex = unread; - } // if in singlepane mode, push to the stack var isLandscape = Provider.of(context, listen: false).isLandscape(context); @@ -124,6 +121,7 @@ class _ContactsViewState extends State { return ScaffoldMessenger( key: scaffoldKey, child: Scaffold( + backgroundColor: Provider.of(context).theme.backgroundMainColor, endDrawerEnableOpenDragGesture: false, drawerEnableOpenDragGesture: false, appBar: AppBar( diff --git a/lib/views/doublecolview.dart b/lib/views/doublecolview.dart index 2b3d458a..def92c33 100644 --- a/lib/views/doublecolview.dart +++ b/lib/views/doublecolview.dart @@ -35,6 +35,7 @@ class _DoubleColumnViewState extends State { color: Provider.of(context).theme.backgroundMainColor, child: Card( margin: EdgeInsets.all(0.0), + color: Provider.of(context).theme.backgroundMainColor, shape: new RoundedRectangleBorder(side: new BorderSide(color: Provider.of(context).theme.defaultButtonColor, width: 4.0), borderRadius: BorderRadius.circular(4.0)), child: Center(child: Text(AppLocalizations.of(context)!.addContactFirst)))) : //dev diff --git a/lib/views/globalsettingsaboutview.dart b/lib/views/globalsettingsaboutview.dart index 1240399e..bdf69104 100644 --- a/lib/views/globalsettingsaboutview.dart +++ b/lib/views/globalsettingsaboutview.dart @@ -31,90 +31,89 @@ class _GlobalSettingsAboutViewState extends State { child: SingleChildScrollView( clipBehavior: Clip.antiAlias, controller: settingsListScrollController, - padding: EdgeInsets.symmetric(vertical: 0, horizontal: 20), child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: viewportConstraints.maxHeight, - ), - child: Column(children: [ - AboutListTile( - icon: appIcon, - applicationIcon: Padding(padding: EdgeInsets.all(5), child: Icon(CwtchIcons.cwtch_knott)), - applicationName: "Cwtch UI", - applicationLegalese: '\u{a9} 2021-2023 Open Privacy Research Society', - aboutBoxChildren: [ - Padding( - padding: EdgeInsets.fromLTRB(24.0 + 10.0 + (appIcon.size ?? 24.0), 16.0, 0.0, 0.0), - // About has 24 padding (ln 389) and there appears to be another 10 of padding in the widget - child: SelectableText(AppLocalizations.of(context)!.versionBuilddate.replaceAll("%1", EnvironmentConfig.BUILD_VER).replaceAll("%2", EnvironmentConfig.BUILD_DATE)), - ) - ]), - SwitchListTile( - // TODO: Translate, Remove, OR Hide Prior to Release - title: Text(AppLocalizations.of(context)!.settingsExperimentsShowPerformanceTitle), - subtitle: Text(AppLocalizations.of(context)!.settingsExperimentsShowPerformanceDescription), - value: settings.profileMode, - onChanged: (bool value) { - setState(() { - if (value) { - settings.profileMode = value; - } else { - settings.profileMode = value; - } - }); - }, - activeTrackColor: settings.theme.defaultButtonActiveColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.bar_chart, color: settings.current().mainTextColor), - ), - Visibility( - visible: EnvironmentConfig.BUILD_VER == dev_version && !Platform.isAndroid, - child: SwitchListTile( - title: Text("Show Semantic Debugger"), - subtitle: Text("Show Accessibility Debugging View"), - value: settings.useSemanticDebugger, + constraints: BoxConstraints(minHeight: viewportConstraints.maxHeight, maxWidth: viewportConstraints.maxWidth), + child: Container( + color: settings.theme.backgroundPaneColor, + child: Column(children: [ + AboutListTile( + icon: appIcon, + applicationIcon: Padding(padding: EdgeInsets.all(5), child: Icon(CwtchIcons.cwtch_knott)), + applicationName: "Cwtch UI", + applicationLegalese: '\u{a9} 2021-2023 Open Privacy Research Society', + aboutBoxChildren: [ + Padding( + padding: EdgeInsets.fromLTRB(24.0 + 10.0 + (appIcon.size ?? 24.0), 16.0, 0.0, 0.0), + // About has 24 padding (ln 389) and there appears to be another 10 of padding in the widget + child: SelectableText(AppLocalizations.of(context)!.versionBuilddate.replaceAll("%1", EnvironmentConfig.BUILD_VER).replaceAll("%2", EnvironmentConfig.BUILD_DATE)), + ) + ]), + SwitchListTile( + // TODO: Translate, Remove, OR Hide Prior to Release + title: Text(AppLocalizations.of(context)!.settingsExperimentsShowPerformanceTitle), + subtitle: Text(AppLocalizations.of(context)!.settingsExperimentsShowPerformanceDescription), + value: settings.profileMode, onChanged: (bool value) { - if (value) { - settings.useSemanticDebugger = value; - } else { - settings.useSemanticDebugger = value; - } - saveSettings(context); + setState(() { + if (value) { + settings.profileMode = value; + } else { + settings.profileMode = value; + } + }); }, activeTrackColor: settings.theme.defaultButtonActiveColor, inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.settings_accessibility, color: settings.current().mainTextColor), - )), - Visibility( - visible: EnvironmentConfig.BUILD_VER == dev_version && !Platform.isAndroid, - child: FutureBuilder( - future: EnvironmentConfig.BUILD_VER != dev_version || Platform.isAndroid ? null : Provider.of(context).cwtch.GetDebugInfo(), - builder: (context, snapshot) { - if (snapshot.hasData) { - return Column( - children: [ - Text("libCwtch Debug Info: " + snapshot.data.toString()), - Text("Message Cache Size (Mb): " + (Provider.of(context).profs.cacheMemUsage() / (1024 * 1024)).toString()) - ], - ); - } else { - return Container(); - } - }, - ), - ), - Visibility( - visible: EnvironmentConfig.BUILD_VER == dev_version, - child: FutureBuilder( - future: Provider.of(context).cwtch.PlatformChannelInfo(), + secondary: Icon(Icons.bar_chart, color: settings.current().mainTextColor), + ), + Visibility( + visible: EnvironmentConfig.BUILD_VER == dev_version && !Platform.isAndroid, + child: SwitchListTile( + title: Text("Show Semantic Debugger"), + subtitle: Text("Show Accessibility Debugging View"), + value: settings.useSemanticDebugger, + onChanged: (bool value) { + if (value) { + settings.useSemanticDebugger = value; + } else { + settings.useSemanticDebugger = value; + } + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.settings_accessibility, color: settings.current().mainTextColor), + )), + Visibility( + visible: EnvironmentConfig.BUILD_VER == dev_version && !Platform.isAndroid, + child: FutureBuilder( + future: EnvironmentConfig.BUILD_VER != dev_version || Platform.isAndroid ? null : Provider.of(context).cwtch.GetDebugInfo(), builder: (context, snapshot) { if (snapshot.hasData) { - HashMap data = snapshot.data as HashMap; - return getPlatformInfo(settings, data); + return Column( + children: [ + Text("libCwtch Debug Info: " + snapshot.data.toString()), + Text("Message Cache Size (Mb): " + (Provider.of(context).profs.cacheMemUsage() / (1024 * 1024)).toString()) + ], + ); + } else { + return Container(); } - return Container(); - })) - ])))); + }, + ), + ), + Visibility( + visible: EnvironmentConfig.BUILD_VER == dev_version, + child: FutureBuilder( + future: Provider.of(context).cwtch.PlatformChannelInfo(), + builder: (context, snapshot) { + if (snapshot.hasData) { + HashMap data = snapshot.data as HashMap; + return getPlatformInfo(settings, data); + } + return Container(); + })) + ]))))); }); }); } @@ -138,9 +137,6 @@ class _GlobalSettingsAboutViewState extends State { // TODO: deprecated ? /// Construct a version string from Package Info String constructVersionString(PackageInfo pinfo) { - if (pinfo == null) { - return ""; - } return pinfo.version + "." + pinfo.buildNumber; } } diff --git a/lib/views/globalsettingsappearanceview.dart b/lib/views/globalsettingsappearanceview.dart index f3dfc336..7a710363 100644 --- a/lib/views/globalsettingsappearanceview.dart +++ b/lib/views/globalsettingsappearanceview.dart @@ -34,218 +34,218 @@ class _GlobalSettingsAppearanceViewState extends State(context).locale.toString(), - onChanged: (String? newValue) { - setState(() { - EnvironmentConfig.debugLog("setting language: $newValue"); - settings.switchLocaleByCode(newValue!); - saveSettings(context); - }); - }, - items: AppLocalizations.supportedLocales.map>((Locale value) { - return DropdownMenuItem( - value: value.toString(), - child: Text( - key: Key("dropdownLanguage" + value.languageCode), - getLanguageFull(context, value.languageCode, value.countryCode), - style: settings.scaleFonts(defaultDropDownMenuItemTextStyle), - overflow: TextOverflow.ellipsis, - ), - ); - }).toList()))), - SwitchListTile( - title: Text(AppLocalizations.of(context)!.settingTheme), - value: settings.current().mode == mode_light, - onChanged: (bool value) { - if (value) { - settings.setTheme(settings.theme.theme, mode_light); - } else { - settings.setTheme(settings.theme.theme, mode_dark); - } - -// Save Settings... - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor), - ), - ListTile( - title: Text(AppLocalizations.of(context)!.themeColorLabel), - trailing: Container( - width: MediaQuery.of(context).size.width / 4, - child: DropdownButton( - key: Key("DropdownTheme"), - isExpanded: true, - value: Provider.of(context).themeId, - onChanged: (String? newValue) { - setState(() { - settings.setTheme(newValue!, settings.theme.mode); - saveSettings(context); - }); - }, - items: settings.themeloader.themes.keys.map>((String themeId) { - return DropdownMenuItem( - value: themeId, - child: Text(getThemeName(context, settings, themeId), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), //"ddi_$themeId", key: Key("ddi_$themeId")), - ); - }).toList())), - leading: Icon(Icons.palette, color: settings.current().mainTextColor), - ), - Visibility( - // TODO: Android support needs gomobile support for reading / writing themes, and ideally importing from a .zip or .tar.gz - visible: !Platform.isAndroid, - child: ListTile( - leading: Icon(Icons.palette, color: Provider.of(context).theme.messageFromMeTextColor), - title: Text(AppLocalizations.of(context)!.settingsImportThemeTitle), - subtitle: Text(AppLocalizations.of(context)!.settingsImportThemeDescription), - //AppLocalizations.of( - //context)! - //.fileSharingSettingsDownloadFolderDescription, + constraints: BoxConstraints(minHeight: viewportConstraints.maxHeight, maxWidth: viewportConstraints.maxWidth), + child: Container( + color: settings.theme.backgroundPaneColor, + child: Column(children: [ + ListTile( + title: Text(AppLocalizations.of(context)!.settingLanguage), + leading: Icon(CwtchIcons.change_language, color: settings.current().mainTextColor), trailing: Container( width: MediaQuery.of(context).size.width / 4, - child: ElevatedButton.icon( - label: Text(AppLocalizations.of(context)!.settingsImportThemeButton), - onPressed: Provider.of(context).disableFilePicker - ? null - : () async { - if (Platform.isAndroid) { - return; - } - var selectedDirectory = await showSelectDirectoryPicker(context); - if (selectedDirectory != null) { - selectedDirectory += path.separator; - final customThemeDir = path.join(await Provider.of(context, listen: false).cwtch.getCwtchDir(), custom_themes_subdir); - importThemeCheck(context, settings, customThemeDir, selectedDirectory); - } else { - // User canceled the picker - } - }, - //onChanged: widget.onSave, - icon: Icon(Icons.folder), - //tooltip: widget.tooltip, - )))), - SwitchListTile( - title: Text(AppLocalizations.of(context)!.settingsThemeImages), - subtitle: Text(AppLocalizations.of(context)!.settingsThemeImagesDescription), - value: settings.themeImages, - onChanged: (bool value) { - settings.themeImages = value; // Save Settings... - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.image, color: settings.current().mainTextColor), - ), - ListTile( - title: Text(AppLocalizations.of(context)!.settingUIColumnPortrait), - leading: Icon(Icons.table_chart, color: settings.current().mainTextColor), - trailing: Container( - width: MediaQuery.of(context).size.width / 4, - child: DropdownButton( - isExpanded: true, - value: settings.uiColumnModePortrait.toString(), - onChanged: (String? newValue) { - settings.uiColumnModePortrait = Settings.uiColumnModeFromString(newValue!); - saveSettings(context); - }, - items: Settings.uiColumnModeOptions(false).map>((DualpaneMode value) { - return DropdownMenuItem( - value: value.toString(), - child: Text(Settings.uiColumnModeToString(value, context), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), - ); - }).toList()))), - ListTile( - title: Text( - AppLocalizations.of(context)!.settingUIColumnLandscape, - textWidthBasis: TextWidthBasis.longestLine, - softWrap: true, + child: DropdownButton( + key: Key("languagelist"), + isExpanded: true, + value: Provider.of(context).locale.toString(), + onChanged: (String? newValue) { + setState(() { + EnvironmentConfig.debugLog("setting language: $newValue"); + settings.switchLocaleByCode(newValue!); + saveSettings(context); + }); + }, + items: AppLocalizations.supportedLocales.map>((Locale value) { + return DropdownMenuItem( + value: value.toString(), + child: Text( + key: Key("dropdownLanguage" + value.languageCode), + getLanguageFull(context, value.languageCode, value.countryCode), + style: settings.scaleFonts(defaultDropDownMenuItemTextStyle), + overflow: TextOverflow.ellipsis, + ), + ); + }).toList()))), + SwitchListTile( + title: Text(AppLocalizations.of(context)!.settingTheme), + value: settings.current().mode == mode_light, + onChanged: (bool value) { + if (value) { + settings.setTheme(settings.theme.theme, mode_light); + } else { + settings.setTheme(settings.theme.theme, mode_dark); + } + +// Save Settings... + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor), ), - leading: Icon(Icons.stay_primary_landscape, color: settings.current().mainTextColor), - trailing: Container( - width: MediaQuery.of(context).size.width / 4, - child: Container( + ListTile( + title: Text(AppLocalizations.of(context)!.themeColorLabel), + trailing: Container( + width: MediaQuery.of(context).size.width / 4, + child: DropdownButton( + key: Key("DropdownTheme"), + isExpanded: true, + value: Provider.of(context).themeId, + onChanged: (String? newValue) { + setState(() { + settings.setTheme(newValue!, settings.theme.mode); + saveSettings(context); + }); + }, + items: settings.themeloader.themes.keys.map>((String themeId) { + return DropdownMenuItem( + value: themeId, + child: + Text(getThemeName(context, settings, themeId), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), //"ddi_$themeId", key: Key("ddi_$themeId")), + ); + }).toList())), + leading: Icon(Icons.palette, color: settings.current().mainTextColor), + ), + Visibility( + // TODO: Android support needs gomobile support for reading / writing themes, and ideally importing from a .zip or .tar.gz + visible: !Platform.isAndroid, + child: ListTile( + leading: Icon(Icons.palette, color: Provider.of(context).theme.messageFromMeTextColor), + title: Text(AppLocalizations.of(context)!.settingsImportThemeTitle), + subtitle: Text(AppLocalizations.of(context)!.settingsImportThemeDescription), + //AppLocalizations.of( + //context)! + //.fileSharingSettingsDownloadFolderDescription, + trailing: Container( + width: MediaQuery.of(context).size.width / 4, + child: ElevatedButton.icon( + label: Text(AppLocalizations.of(context)!.settingsImportThemeButton), + onPressed: Provider.of(context).disableFilePicker + ? null + : () async { + if (Platform.isAndroid) { + return; + } + var selectedDirectory = await showSelectDirectoryPicker(context); + if (selectedDirectory != null) { + selectedDirectory += path.separator; + final customThemeDir = path.join(await Provider.of(context, listen: false).cwtch.getCwtchDir(), custom_themes_subdir); + importThemeCheck(context, settings, customThemeDir, selectedDirectory); + } else { + // User canceled the picker + } + }, + //onChanged: widget.onSave, + icon: Icon(Icons.folder), + //tooltip: widget.tooltip, + )))), + SwitchListTile( + title: Text(AppLocalizations.of(context)!.settingsThemeImages), + subtitle: Text(AppLocalizations.of(context)!.settingsThemeImagesDescription), + value: settings.themeImages, + onChanged: (bool value) { + settings.themeImages = value; // Save Settings... + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.image, color: settings.current().mainTextColor), + ), + ListTile( + title: Text(AppLocalizations.of(context)!.settingUIColumnPortrait), + leading: Icon(Icons.table_chart, color: settings.current().mainTextColor), + trailing: Container( width: MediaQuery.of(context).size.width / 4, child: DropdownButton( isExpanded: true, - value: settings.uiColumnModeLandscape.toString(), + value: settings.uiColumnModePortrait.toString(), onChanged: (String? newValue) { - settings.uiColumnModeLandscape = Settings.uiColumnModeFromString(newValue!); + settings.uiColumnModePortrait = Settings.uiColumnModeFromString(newValue!); saveSettings(context); }, - items: Settings.uiColumnModeOptions(true).map>((DualpaneMode value) { + items: Settings.uiColumnModeOptions(false).map>((DualpaneMode value) { return DropdownMenuItem( value: value.toString(), - child: Text(Settings.uiColumnModeToString(value, context), overflow: TextOverflow.ellipsis, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), + child: Text(Settings.uiColumnModeToString(value, context), style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), ); - }).toList())))), - ListTile( - title: Text(AppLocalizations.of(context)!.defaultScalingText), - subtitle: Text(AppLocalizations.of(context)!.fontScalingDescription), - trailing: Container( - width: MediaQuery.of(context).size.width / 4, - child: Slider( - onChanged: (double value) { - settings.fontScaling = value; + }).toList()))), + ListTile( + title: Text( + AppLocalizations.of(context)!.settingUIColumnLandscape, + textWidthBasis: TextWidthBasis.longestLine, + softWrap: true, + ), + leading: Icon(Icons.stay_primary_landscape, color: settings.current().mainTextColor), + trailing: Container( + width: MediaQuery.of(context).size.width / 4, + child: Container( + width: MediaQuery.of(context).size.width / 4, + child: DropdownButton( + isExpanded: true, + value: settings.uiColumnModeLandscape.toString(), + onChanged: (String? newValue) { + settings.uiColumnModeLandscape = Settings.uiColumnModeFromString(newValue!); + saveSettings(context); + }, + items: Settings.uiColumnModeOptions(true).map>((DualpaneMode value) { + return DropdownMenuItem( + value: value.toString(), + child: Text(Settings.uiColumnModeToString(value, context), overflow: TextOverflow.ellipsis, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), + ); + }).toList())))), + ListTile( + title: Text(AppLocalizations.of(context)!.defaultScalingText), + subtitle: Text(AppLocalizations.of(context)!.fontScalingDescription), + trailing: Container( + width: MediaQuery.of(context).size.width / 4, + child: Slider( + onChanged: (double value) { + settings.fontScaling = value; // Save Settings... - saveSettings(context); - EnvironmentConfig.debugLog("Font Scaling: $value"); - }, - min: 0.5, - divisions: 12, - max: 2.0, - label: '${settings.fontScaling * 100}%', - activeColor: settings.current().defaultButtonColor, - thumbColor: settings.current().mainTextColor, - overlayColor: MaterialStateProperty.all(settings.current().mainTextColor), - inactiveColor: settings.theme.defaultButtonDisabledColor, - value: settings.fontScaling)), - leading: Icon(Icons.format_size, color: settings.current().mainTextColor), - ), - SwitchListTile( - title: Text(AppLocalizations.of(context)!.streamerModeLabel), - subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode), - value: settings.streamerMode, - onChanged: (bool value) { - settings.setStreamerMode(value); + saveSettings(context); + EnvironmentConfig.debugLog("Font Scaling: $value"); + }, + min: 0.5, + divisions: 12, + max: 2.0, + label: '${settings.fontScaling * 100}%', + activeColor: settings.current().defaultButtonColor, + thumbColor: settings.current().mainTextColor, + overlayColor: MaterialStateProperty.all(settings.current().mainTextColor), + inactiveColor: settings.theme.defaultButtonDisabledColor, + value: settings.fontScaling)), + leading: Icon(Icons.format_size, color: settings.current().mainTextColor), + ), + SwitchListTile( + title: Text(AppLocalizations.of(context)!.streamerModeLabel), + subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode), + value: settings.streamerMode, + onChanged: (bool value) { + settings.setStreamerMode(value); // Save Settings... - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(CwtchIcons.streamer_bunnymask, color: settings.current().mainTextColor), - ), - SwitchListTile( - title: Text(AppLocalizations.of(context)!.formattingExperiment), - subtitle: Text(AppLocalizations.of(context)!.messageFormattingDescription), - value: settings.isExperimentEnabled(FormattingExperiment), - onChanged: (bool value) { - if (value) { - settings.enableExperiment(FormattingExperiment); - } else { - settings.disableExperiment(FormattingExperiment); - } - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonActiveColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.text_fields, color: settings.current().mainTextColor), - ), - ])))); + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.streamer_bunnymask, color: settings.current().mainTextColor), + ), + SwitchListTile( + title: Text(AppLocalizations.of(context)!.formattingExperiment), + subtitle: Text(AppLocalizations.of(context)!.messageFormattingDescription), + value: settings.isExperimentEnabled(FormattingExperiment), + onChanged: (bool value) { + if (value) { + settings.enableExperiment(FormattingExperiment); + } else { + settings.disableExperiment(FormattingExperiment); + } + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.text_fields, color: settings.current().mainTextColor), + ), + ]))))); }); }); } diff --git a/lib/views/globalsettingsbehaviourview.dart b/lib/views/globalsettingsbehaviourview.dart index 0a35c541..26c1ff1d 100644 --- a/lib/views/globalsettingsbehaviourview.dart +++ b/lib/views/globalsettingsbehaviourview.dart @@ -69,108 +69,108 @@ class _GlobalSettingsBehaviourViewState extends State>((NotificationPolicy value) { - return DropdownMenuItem( - value: value, - child: Text(Settings.notificationPolicyToString(value, context), overflow: TextOverflow.ellipsis, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), - ); - }).toList())), - leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor), - ), - ListTile( - title: Text(AppLocalizations.of(context)!.notificationContentSettingLabel), - subtitle: Text(AppLocalizations.of(context)!.notificationContentSettingDescription), - trailing: Container( - width: MediaQuery.of(context).size.width / 4, - child: DropdownButton( - isExpanded: true, - value: settings.notificationContent, - onChanged: (NotificationContent? newValue) { - settings.notificationContent = newValue!; - saveSettings(context); - }, - items: NotificationContent.values.map>((NotificationContent value) { - return DropdownMenuItem( - value: value, - child: Text(Settings.notificationContentToString(value, context), overflow: TextOverflow.ellipsis, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), - ); - }).toList())), - leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor), - ), - SwitchListTile( - title: Text(AppLocalizations.of(context)!.blockUnknownLabel), - subtitle: Text(AppLocalizations.of(context)!.descriptionBlockUnknownConnections), - value: settings.blockUnknownConnections, - onChanged: (bool value) { - if (value) { - settings.forbidUnknownConnections(); - } else { - settings.allowUnknownConnections(); - } + constraints: BoxConstraints(minHeight: viewportConstraints.maxHeight, maxWidth: viewportConstraints.maxWidth), + child: Container( + color: settings.theme.backgroundPaneColor, + child: Column(children: [ + Visibility( + visible: Platform.isAndroid, + child: SwitchListTile( + title: Text(AppLocalizations.of(context)!.settingAndroidPowerExemption), + subtitle: Text(AppLocalizations.of(context)!.settingAndroidPowerExemptionDescription), + value: powerExempt, + onChanged: (bool value) { + if (value) { + requestBatteryExemption(); + } else { + // We can't ask for it to be turned off, show an informational popup + showBatteryDialog(context); + } + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.power, color: settings.current().mainTextColor), + ), + ), + ListTile( + title: Text(AppLocalizations.of(context)!.notificationPolicySettingLabel), + subtitle: Text(AppLocalizations.of(context)!.notificationPolicySettingDescription), + trailing: Container( + width: MediaQuery.of(context).size.width / 4, + child: DropdownButton( + isExpanded: true, + value: settings.notificationPolicy, + onChanged: (NotificationPolicy? newValue) { + settings.notificationPolicy = newValue!; + saveSettings(context); + }, + items: NotificationPolicy.values.map>((NotificationPolicy value) { + return DropdownMenuItem( + value: value, + child: Text(Settings.notificationPolicyToString(value, context), overflow: TextOverflow.ellipsis, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), + ); + }).toList())), + leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor), + ), + ListTile( + title: Text(AppLocalizations.of(context)!.notificationContentSettingLabel), + subtitle: Text(AppLocalizations.of(context)!.notificationContentSettingDescription), + trailing: Container( + width: MediaQuery.of(context).size.width / 4, + child: DropdownButton( + isExpanded: true, + value: settings.notificationContent, + onChanged: (NotificationContent? newValue) { + settings.notificationContent = newValue!; + saveSettings(context); + }, + items: NotificationContent.values.map>((NotificationContent value) { + return DropdownMenuItem( + value: value, + child: + Text(Settings.notificationContentToString(value, context), overflow: TextOverflow.ellipsis, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), + ); + }).toList())), + leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor), + ), + SwitchListTile( + title: Text(AppLocalizations.of(context)!.blockUnknownLabel), + subtitle: Text(AppLocalizations.of(context)!.descriptionBlockUnknownConnections), + value: settings.blockUnknownConnections, + onChanged: (bool value) { + if (value) { + settings.forbidUnknownConnections(); + } else { + settings.allowUnknownConnections(); + } - // Save Settings... - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(CwtchIcons.block_unknown, color: settings.current().mainTextColor), - ), - SwitchListTile( - title: Text(AppLocalizations.of(context)!.defaultPreserveHistorySetting), - subtitle: Text(AppLocalizations.of(context)!.preserveHistorySettingDescription), - value: settings.preserveHistoryByDefault, - onChanged: (bool value) { - if (value) { - settings.setPreserveHistoryDefault(); - } else { - settings.setDeleteHistoryDefault(); - } + // Save Settings... + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.block_unknown, color: settings.current().mainTextColor), + ), + SwitchListTile( + title: Text(AppLocalizations.of(context)!.defaultPreserveHistorySetting), + subtitle: Text(AppLocalizations.of(context)!.preserveHistorySettingDescription), + value: settings.preserveHistoryByDefault, + onChanged: (bool value) { + if (value) { + settings.setPreserveHistoryDefault(); + } else { + settings.setDeleteHistoryDefault(); + } - // Save Settings... - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(CwtchIcons.peer_history, color: settings.current().mainTextColor), - ), - ])))); + // Save Settings... + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.peer_history, color: settings.current().mainTextColor), + ), + ]))))); }); }); } diff --git a/lib/views/globalsettingsexperimentsview.dart b/lib/views/globalsettingsexperimentsview.dart index bc064167..258ecc0b 100644 --- a/lib/views/globalsettingsexperimentsview.dart +++ b/lib/views/globalsettingsexperimentsview.dart @@ -30,213 +30,210 @@ class _GlobalSettingsExperimentsViewState extends State(context, listen: false).cwtch.IsServersCompiled() - ? Text(AppLocalizations.of(context)!.settingServersDescription) - : Text("This version of Cwtch has been compiled without support for the server hosting experiment."), - value: Provider.of(context, listen: false).cwtch.IsServersCompiled() && settings.isExperimentEnabled(ServerManagementExperiment), - onChanged: Provider.of(context, listen: false).cwtch.IsServersCompiled() - ? (bool value) { - Provider.of(context, listen: false).clear(); - if (value) { - settings.enableExperiment(ServerManagementExperiment); - } else { - settings.disableExperiment(ServerManagementExperiment); - } - // Save Settings... - saveSettings(context); - } - : null, + constraints: BoxConstraints(minHeight: viewportConstraints.maxHeight, maxWidth: viewportConstraints.maxWidth), + child: Container( + color: settings.theme.backgroundPaneColor, + child: Column(children: [ + SwitchListTile( + title: Text(AppLocalizations.of(context)!.experimentsEnabled), + subtitle: Text(AppLocalizations.of(context)!.descriptionExperiments), + value: settings.experimentsEnabled, + onChanged: (bool value) { + if (value) { + settings.enableExperiments(); + } else { + settings.disableExperiments(); + } + // Save Settings... + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.enable_experiments, color: settings.current().mainTextColor), + ), + Visibility( + visible: settings.experimentsEnabled, + child: Column( + children: [ + SwitchListTile( + title: Text(AppLocalizations.of(context)!.enableGroups), + subtitle: Text(AppLocalizations.of(context)!.descriptionExperimentsGroups), + value: settings.isExperimentEnabled(TapirGroupsExperiment), + onChanged: (bool value) { + if (value) { + settings.enableExperiment(TapirGroupsExperiment); + } else { + settings.disableExperiment(TapirGroupsExperiment); + } + // Save Settings... + saveSettings(context); + }, activeTrackColor: settings.theme.defaultButtonColor, inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - inactiveThumbColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(CwtchIcons.dns_24px), - )), - SwitchListTile( - title: Text(AppLocalizations.of(context)!.settingFileSharing), - subtitle: Text(AppLocalizations.of(context)!.descriptionFileSharing), - value: settings.isExperimentEnabled(FileSharingExperiment), - onChanged: (bool value) { - if (value) { - if (checkDownloadDirectory(context, settings)) { - settings.enableExperiment(FileSharingExperiment); - } else { - settings.enableExperiment(FileSharingExperiment); - settings.disableExperiment(ImagePreviewsExperiment); - } - } else { - settings.disableExperiment(FileSharingExperiment); - settings.disableExperiment(ImagePreviewsExperiment); - } - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(CwtchIcons.attached_file_3, color: settings.current().mainTextColor), - ), - Visibility( - visible: settings.isExperimentEnabled(FileSharingExperiment), - child: Column(children: [ + secondary: Icon(CwtchIcons.enable_groups, color: settings.current().mainTextColor), + ), + Visibility( + visible: !Platform.isAndroid && !Platform.isIOS, + child: SwitchListTile( + title: Text(AppLocalizations.of(context)!.settingServers), + subtitle: Provider.of(context, listen: false).cwtch.IsServersCompiled() + ? Text(AppLocalizations.of(context)!.settingServersDescription) + : Text("This version of Cwtch has been compiled without support for the server hosting experiment."), + value: Provider.of(context, listen: false).cwtch.IsServersCompiled() && settings.isExperimentEnabled(ServerManagementExperiment), + onChanged: Provider.of(context, listen: false).cwtch.IsServersCompiled() + ? (bool value) { + Provider.of(context, listen: false).clear(); + if (value) { + settings.enableExperiment(ServerManagementExperiment); + } else { + settings.disableExperiment(ServerManagementExperiment); + } + // Save Settings... + saveSettings(context); + } + : null, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.dns_24px), + )), SwitchListTile( - title: Text(AppLocalizations.of(context)!.settingImagePreviews), - subtitle: Text(AppLocalizations.of(context)!.settingImagePreviewsDescription), - value: settings.isExperimentEnabled(ImagePreviewsExperiment), + title: Text(AppLocalizations.of(context)!.settingFileSharing), + subtitle: Text(AppLocalizations.of(context)!.descriptionFileSharing), + value: settings.isExperimentEnabled(FileSharingExperiment), onChanged: (bool value) { if (value) { if (checkDownloadDirectory(context, settings)) { - settings.enableExperiment(ImagePreviewsExperiment); + settings.enableExperiment(FileSharingExperiment); } else { + settings.enableExperiment(FileSharingExperiment); settings.disableExperiment(ImagePreviewsExperiment); } } else { + settings.disableExperiment(FileSharingExperiment); settings.disableExperiment(ImagePreviewsExperiment); } saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor, + activeTrackColor: settings.theme.defaultButtonColor, inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.photo, color: settings.current().mainTextColor), + secondary: Icon(CwtchIcons.attached_file_3, color: settings.current().mainTextColor), ), Visibility( - visible: settings.isExperimentEnabled(ImagePreviewsExperiment) && !Platform.isAndroid, + visible: settings.isExperimentEnabled(FileSharingExperiment), + child: Column(children: [ + SwitchListTile( + title: Text(AppLocalizations.of(context)!.settingImagePreviews), + subtitle: Text(AppLocalizations.of(context)!.settingImagePreviewsDescription), + value: settings.isExperimentEnabled(ImagePreviewsExperiment), + onChanged: (bool value) { + if (value) { + if (checkDownloadDirectory(context, settings)) { + settings.enableExperiment(ImagePreviewsExperiment); + } else { + settings.disableExperiment(ImagePreviewsExperiment); + } + } else { + settings.disableExperiment(ImagePreviewsExperiment); + } + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.photo, color: settings.current().mainTextColor), + ), + Visibility( + visible: settings.isExperimentEnabled(ImagePreviewsExperiment) && !Platform.isAndroid, + child: CwtchFolderPicker( + testKey: Key("DownloadFolderPicker"), + label: AppLocalizations.of(context)!.settingDownloadFolder, + initialValue: settings.downloadPath, + textStyle: settings.scaleFonts(defaultDropDownMenuItemTextStyle), + description: AppLocalizations.of(context)!.fileSharingSettingsDownloadFolderDescription, + tooltip: AppLocalizations.of(context)!.fileSharingSettingsDownloadFolderTooltip, + onSave: (newVal) { + settings.downloadPath = newVal; + saveSettings(context); + }, + ), + ), + ]), + ), + Visibility( + visible: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported(), + child: SwitchListTile( + title: Text(AppLocalizations.of(context)!.blodeuweddExperimentEnable), + subtitle: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() + ? Text(AppLocalizations.of(context)!.blodeuweddDescription) + : Text(AppLocalizations.of(context)!.blodeuweddNotSupported), + value: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment), + onChanged: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() + ? (bool value) { + if (value) { + settings.enableExperiment(BlodeuweddExperiment); + } else { + settings.disableExperiment(BlodeuweddExperiment); + } + saveSettings(context); + } + : null, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.assistant, color: settings.current().mainTextColor), + )), + Visibility( + visible: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment), child: CwtchFolderPicker( testKey: Key("DownloadFolderPicker"), label: AppLocalizations.of(context)!.settingDownloadFolder, - initialValue: settings.downloadPath, - textStyle: settings.scaleFonts(defaultDropDownMenuItemTextStyle), - description: AppLocalizations.of(context)!.fileSharingSettingsDownloadFolderDescription, - tooltip: AppLocalizations.of(context)!.fileSharingSettingsDownloadFolderTooltip, + initialValue: settings.blodeuweddPath, + description: AppLocalizations.of(context)!.blodeuweddPath, + tooltip: AppLocalizations.of(context)!.blodeuweddPath, onSave: (newVal) { - settings.downloadPath = newVal; + settings.blodeuweddPath = newVal; saveSettings(context); }, ), ), - ]), - ), - Visibility( - visible: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported(), - child: SwitchListTile( - title: Text(AppLocalizations.of(context)!.blodeuweddExperimentEnable), - subtitle: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() - ? Text(AppLocalizations.of(context)!.blodeuweddDescription) - : Text(AppLocalizations.of(context)!.blodeuweddNotSupported), - value: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment), - onChanged: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() - ? (bool value) { - if (value) { - settings.enableExperiment(BlodeuweddExperiment); - } else { - settings.disableExperiment(BlodeuweddExperiment); - } - saveSettings(context); - } - : null, - activeTrackColor: settings.theme.defaultButtonColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - inactiveThumbColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.assistant, color: settings.current().mainTextColor), - )), - Visibility( - visible: Provider.of(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment), - child: CwtchFolderPicker( - testKey: Key("DownloadFolderPicker"), - label: AppLocalizations.of(context)!.settingDownloadFolder, - initialValue: settings.blodeuweddPath, - description: AppLocalizations.of(context)!.blodeuweddPath, - tooltip: AppLocalizations.of(context)!.blodeuweddPath, - onSave: (newVal) { - settings.blodeuweddPath = newVal; - saveSettings(context); - }, - ), - ), - ], - )), - Visibility( - visible: settings.experimentsEnabled, - child: SwitchListTile( - title: Text(AppLocalizations.of(context)!.enableExperimentClickableLinks), - subtitle: Text(AppLocalizations.of(context)!.experimentClickableLinksDescription), - value: settings.isExperimentEnabled(ClickableLinksExperiment), - onChanged: (bool value) { - if (value) { - settings.enableExperiment(ClickableLinksExperiment); - } else { - settings.disableExperiment(ClickableLinksExperiment); - } - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonActiveColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.link, color: settings.current().mainTextColor), - )), - Visibility( - visible: settings.experimentsEnabled, - child: SwitchListTile( - title: Text(AppLocalizations.of(context)!.enableExperimentQRCode), - subtitle: Text(AppLocalizations.of(context)!.experimentQRCodeDescription), - value: settings.isExperimentEnabled(QRCodeExperiment), - onChanged: (bool value) { - if (value) { - settings.enableExperiment(QRCodeExperiment); - } else { - settings.disableExperiment(QRCodeExperiment); - } - saveSettings(context); - }, - activeTrackColor: settings.theme.defaultButtonActiveColor, - inactiveTrackColor: settings.theme.defaultButtonDisabledColor, - secondary: Icon(Icons.qr_code, color: settings.current().mainTextColor), - )), - ])))); + ], + )), + Visibility( + visible: settings.experimentsEnabled, + child: SwitchListTile( + title: Text(AppLocalizations.of(context)!.enableExperimentClickableLinks), + subtitle: Text(AppLocalizations.of(context)!.experimentClickableLinksDescription), + value: settings.isExperimentEnabled(ClickableLinksExperiment), + onChanged: (bool value) { + if (value) { + settings.enableExperiment(ClickableLinksExperiment); + } else { + settings.disableExperiment(ClickableLinksExperiment); + } + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.link, color: settings.current().mainTextColor), + )), + Visibility( + visible: settings.experimentsEnabled, + child: SwitchListTile( + title: Text(AppLocalizations.of(context)!.enableExperimentQRCode), + subtitle: Text(AppLocalizations.of(context)!.experimentQRCodeDescription), + value: settings.isExperimentEnabled(QRCodeExperiment), + onChanged: (bool value) { + if (value) { + settings.enableExperiment(QRCodeExperiment); + } else { + settings.disableExperiment(QRCodeExperiment); + } + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.qr_code, color: settings.current().mainTextColor), + )), + ]))))); }); }); } diff --git a/lib/views/groupsettingsview.dart b/lib/views/groupsettingsview.dart index eec1c8ff..07772c49 100644 --- a/lib/views/groupsettingsview.dart +++ b/lib/views/groupsettingsview.dart @@ -71,8 +71,8 @@ class _GroupSettingsViewState extends State { minHeight: viewportConstraints.maxHeight, ), child: Container( - margin: EdgeInsets.all(10), - padding: EdgeInsets.all(2), + color: settings.theme.backgroundPaneColor, + padding: EdgeInsets.all(12), child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ // Nickname Save Button Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 7ac67ce3..c4e5fdef 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -90,7 +90,7 @@ class _MessageViewState extends State { Widget build(BuildContext context) { // After leaving a conversation the selected conversation is set to null... if (Provider.of(context, listen: false).profileOnion == "") { - return Card(child: Center(child: Text(AppLocalizations.of(context)!.addContactFirst))); + return Container(color: Provider.of(context).theme.backgroundMainColor, child: Center(child: Text(AppLocalizations.of(context)!.addContactFirst))); } var showMessageFormattingPreview = Provider.of(context).isExperimentEnabled(FormattingExperiment); @@ -177,8 +177,8 @@ class _MessageViewState extends State { onPressed: _pushContactSettings)); var appState = Provider.of(context); - return WillPopScope( - onWillPop: _onWillPop, + return PopScope( + onPopInvoked: _onWillPop, child: Scaffold( backgroundColor: Provider.of(context).theme.backgroundMainColor, floatingActionButton: showDown @@ -266,7 +266,7 @@ class _MessageViewState extends State { )); } - Future _onWillPop() async { + Future _onWillPop(popd) async { Provider.of(context, listen: false).unreadMessages = 0; var previouslySelected = Provider.of(context, listen: false).selectedConversation; @@ -434,6 +434,7 @@ class _MessageViewState extends State { Provider.of(context, listen: false).cwtch.SetConversationAttribute(profileOnion, identifier, LastMessageSeenTimeKey, DateTime.now().toIso8601String()); focusNode.requestFocus(); + Provider.of(context, listen: false).messageDraft.clearDraft(); } Widget senderInviteChrome(String chrome, String targetName) { @@ -487,7 +488,7 @@ class _MessageViewState extends State { backgroundColor: Provider.of(context).theme.messageFromOtherBackgroundColor), textAlign: TextAlign.left, textWidthBasis: TextWidthBasis.longestLine, - constraints: BoxConstraints.expand(), + constraints: null, )); var showMessageFormattingPreview = Provider.of(context).isExperimentEnabled(FormattingExperiment); @@ -631,9 +632,9 @@ class _MessageViewState extends State { var textField = Container( decoration: BoxDecoration(border: Border(top: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor))), - child: RawKeyboardListener( + child: KeyboardListener( focusNode: FocusNode(), - onKey: handleKeyPress, + onKeyEvent: handleKeyPress, child: Padding( padding: EdgeInsets.all(8), child: TextFormField( @@ -806,21 +807,21 @@ class _MessageViewState extends State { children = [invite, composeBox]; } - return Container(color: Provider.of(context).theme.backgroundMainColor, child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: children)); + return Container( + color: Provider.of(context).theme.backgroundMainColor, child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: children)); } // Send the message if enter is pressed without the shift key... - void handleKeyPress(RawKeyEvent event) { - var data = event.data; - if (event is RawKeyUpEvent) { - if ((data.logicalKey == LogicalKeyboardKey.enter && !event.isShiftPressed) || data.logicalKey == LogicalKeyboardKey.numpadEnter && !event.isShiftPressed) { - // Don't send when inserting a new line that is not at the end of the message - if (Provider.of(context, listen: false).messageDraft.ctrlCompose.selection.baseOffset != - Provider.of(context, listen: false).messageDraft.ctrlCompose.text.length) { - return; - } - _sendMessage(); + void handleKeyPress(KeyEvent event) { + var key = event.logicalKey; + if ((event.logicalKey == LogicalKeyboardKey.enter && !HardwareKeyboard.instance.isShiftPressed) || event.logicalKey == LogicalKeyboardKey.numpadEnter && HardwareKeyboard.instance.isShiftPressed) { + // Don't send when inserting a new line that is not at the end of the message + if (Provider.of(context, listen: false).messageDraft.ctrlCompose.selection.baseOffset != + Provider.of(context, listen: false).messageDraft.ctrlCompose.text.length) { + return; } + _sendMessage(); + Provider.of(context, listen: false).messageDraft.clearDraft(); } } diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index ce9154c3..23863ee8 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -105,8 +105,8 @@ class _PeerSettingsViewState extends State { minHeight: viewportConstraints.maxHeight, ), child: Container( - margin: EdgeInsets.all(10), - padding: EdgeInsets.all(2), + color: settings.theme.backgroundPaneColor, + padding: EdgeInsets.all(12), child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ ProfileImage( diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index cc5b430e..8302a65d 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -380,6 +380,7 @@ class _ProfileMgrViewState extends State { final divided = ListTile.divideTiles( context: context, + color: Provider.of(context).theme.backgroundPaneColor, tiles: widgetTiles, ).toList(); diff --git a/lib/views/splashView.dart b/lib/views/splashView.dart index 1078bc8e..9e3eb24d 100644 --- a/lib/views/splashView.dart +++ b/lib/views/splashView.dart @@ -7,6 +7,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../main.dart'; import '../settings.dart'; +import '../themes/cwtch.dart'; class SplashView extends StatefulWidget { @override @@ -26,6 +27,7 @@ class _SplashViewState extends State { return Consumer( builder: (context, appState, child) => Scaffold( + backgroundColor: darkGreyPurple, // Cwtch Dark Background key: Key("SplashView"), body: Center( child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -55,7 +57,7 @@ class _SplashViewState extends State { ? AppLocalizations.of(context)!.storageMigrationModalMessage : AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage style: defaultTextButtonStyle.copyWith( - fontSize: 16.0, color: appState.appError == "" ? Provider.of(context).theme.mainTextColor : Provider.of(context).theme.textfieldErrorColor))), + fontSize: 16.0, fontFamily: "Inter", color: appState.appError == "" ? whiteishPurple : hotPink))), Visibility( visible: appState.modalState == ModalState.storageMigration || appState.modalState == ModalState.shutdown, child: LinearProgressIndicator( diff --git a/lib/views/torstatusview.dart b/lib/views/torstatusview.dart index beb2c601..c09117a9 100644 --- a/lib/views/torstatusview.dart +++ b/lib/views/torstatusview.dart @@ -31,6 +31,7 @@ class _TorStatusView extends State { @override Widget build(BuildContext context) { return Scaffold( + backgroundColor: Provider.of(context).theme.backgroundMainColor, appBar: AppBar( title: Text(AppLocalizations.of(context)!.torNetworkStatus), ), diff --git a/lib/widgets/contactrow.dart b/lib/widgets/contactrow.dart index 1a67ed90..1f118c2a 100644 --- a/lib/widgets/contactrow.dart +++ b/lib/widgets/contactrow.dart @@ -7,7 +7,6 @@ import 'package:cwtch/models/profile.dart'; import 'package:cwtch/models/redaction.dart'; import 'package:cwtch/themes/opaque.dart'; import 'package:cwtch/views/contactsview.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/widgets/profileimage.dart'; import 'package:provider/provider.dart'; @@ -65,7 +64,8 @@ class _ContactRowState extends State { splashFactory: InkSplash.splashFactory, child: Ink( color: selected ? Provider.of(context).theme.backgroundHilightElementColor : Colors.transparent, - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ + child: Container( + child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( padding: const EdgeInsets.all(6.0), //border size child: ProfileImage( @@ -202,7 +202,7 @@ class _ContactRowState extends State { Provider.of(context, listen: false).resort(); }, )) - ])), + ]))), onTap: () { setState(() { selectConversation(context, contact.identifier, widget.messageIndex); diff --git a/lib/widgets/profilerow.dart b/lib/widgets/profilerow.dart index bbe65359..be5aa1c2 100644 --- a/lib/widgets/profilerow.dart +++ b/lib/widgets/profilerow.dart @@ -23,6 +23,7 @@ class _ProfileRowState extends State { var profile = Provider.of(context); return Card( clipBehavior: Clip.antiAlias, + color: Colors.transparent, margin: EdgeInsets.all(0.0), child: InkWell( child: Row( @@ -44,7 +45,7 @@ class _ProfileRowState extends State { mainAxisSize: MainAxisSize.min, children: [ Container( - height: 18.0 * Provider.of(context).fontScaling + 10.0, + height: 18.0 * Provider.of(context).fontScaling + 18.0, clipBehavior: Clip.hardEdge, decoration: BoxDecoration(), padding: EdgeInsets.all(5.0), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 656d31e1..651dd124 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -16,7 +16,7 @@ import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) - FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index dd995ef1..394f78ed 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -10,7 +10,7 @@ PODS: - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS - - ReachabilitySwift (5.0.0) + - ReachabilitySwift (5.2.1) - screen_retriever (0.0.1): - FlutterMacOS - url_launcher_macos (0.0.1): @@ -55,10 +55,10 @@ SPEC CHECKSUMS: flutter_local_notifications: 3805ca215b2fb7f397d78b66db91f6a747af52e4 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce - path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8 - ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + ReachabilitySwift: 5ae15e16814b5f9ef568963fb2c87aeb49158c66 screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38 - url_launcher_macos: 5335912b679c073563f29d89d33d10d459f95451 + url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 189068fc..84c61310 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -201,8 +201,9 @@ 33CC10E52044A3C60003C045 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -394,9 +395,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -421,11 +424,14 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEAD_CODE_STRIPPING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = Cwtch; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -436,6 +442,9 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Manual; + DEAD_CODE_STRIPPING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Profile; @@ -468,9 +477,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -521,9 +532,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -548,11 +561,14 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEAD_CODE_STRIPPING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = Cwtch; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -569,11 +585,14 @@ CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEAD_CODE_STRIPPING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = Cwtch; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -584,6 +603,9 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Manual; + DEAD_CODE_STRIPPING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -592,6 +614,9 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; + DEAD_CODE_STRIPPING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 11487c24..ed4bb74b 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ =3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" diff --git a/pubspec.yaml b/pubspec.yaml index d4effff6..8e836e4d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,6 +28,7 @@ dependencies: #intl_translation: any flutter_localizations: sdk: flutter + intl: any # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -40,7 +41,7 @@ dependencies: glob: any scrollable_positioned_list: 0.3.8 - file_picker: 5.2.11 + file_picker: 5.3.4 url_launcher: ^6.0.18 window_manager: ^0.3.2 yaml: ^3.1.2 @@ -56,10 +57,11 @@ dependencies: path: lib/third_party/connectivity_plus/connectivity_plus # misc plugins qr_flutter: ^4.0.0 - + path: any dev_dependencies: msix: ^3.12.2 build_runner: any + path: any flutter_gherkin: #path: ./flutter_gherkin git: @@ -72,8 +74,7 @@ dev_dependencies: #flutter_lokalise: # project_id: "737094205fceda35c50aa2.60364948" # api_token: "0407300fe4aa1edf1c1818e56234589e74c83c59" # Read only api Token from Dan - - + gherkin: any flutter_intl: enabled: true diff --git a/test/buttontextfield01.png b/test/buttontextfield01.png index 89e5e50c..36113d48 100644 Binary files a/test/buttontextfield01.png and b/test/buttontextfield01.png differ diff --git a/test/profileimage_init.png b/test/profileimage_init.png index 03d875fe..a6a5314e 100644 Binary files a/test/profileimage_init.png and b/test/profileimage_init.png differ diff --git a/test/textfield_basic.png b/test/textfield_basic.png index 311e38d0..36b41b4d 100644 Binary files a/test/textfield_basic.png and b/test/textfield_basic.png differ diff --git a/test/textfield_form_42.png b/test/textfield_form_42.png index 3682c4dc..acea733b 100644 Binary files a/test/textfield_form_42.png and b/test/textfield_form_42.png differ diff --git a/test/textfield_form_alpha.png b/test/textfield_form_alpha.png index fb7bb79a..9ee79c8e 100644 Binary files a/test/textfield_form_alpha.png and b/test/textfield_form_alpha.png differ diff --git a/test/textfield_form_final.png b/test/textfield_form_final.png index 22cabad3..d47ffaa7 100644 Binary files a/test/textfield_form_final.png and b/test/textfield_form_final.png differ diff --git a/test/textfield_form_init.png b/test/textfield_form_init.png index 9a5fc65c..859b7a25 100644 Binary files a/test/textfield_form_init.png and b/test/textfield_form_init.png differ diff --git a/test/textfield_init.png b/test/textfield_init.png index ef33a065..2fb64253 100644 Binary files a/test/textfield_init.png and b/test/textfield_init.png differ diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt index b02c5485..86edc67b 100644 --- a/windows/flutter/CMakeLists.txt +++ b/windows/flutter/CMakeLists.txt @@ -9,6 +9,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -91,7 +96,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS