Merge branch 'trunk' of git.openprivacy.ca:flutter/flutter_app into sendinvites
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
erinn 2021-05-10 21:38:59 -07:00
commit c7c809fa43
15 changed files with 88 additions and 24 deletions

View File

@ -60,18 +60,28 @@ steps:
- name: build-android
image: cirrusci/flutter:dev
when:
event: push
environment:
upload_jks_file_b64:
from_secret: upload_jks_file_b64
upload_jks_pass:
from_secret: upload_jks_pass
volumes:
- name: deps
path: /root/.pub-cache
commands:
- echo $upload_jks_file_b64 > upload-keystore.jks.b64
- base64 -i --decode upload-keystore.jks.b64 > android/app/upload-keystore.jks
- sed -i "s/%jks-password%/$upload_jks_pass/g" android/key.properties
- flutter build appbundle
# cant do debug for final release, this is just a stop gap
- flutter build apk --debug
- flutter build apk
# or build apk --split-per-abi ?
- mkdir deploy/android
- cp build/app/outputs/bundle/release/app-release.aab deploy/android
# - cp build/app/outputs/apk/release/app-release.apk deploy/android
- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android
- cp build/app/outputs/apk/release/app-release.apk deploy/android
#- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android
- name: widget-tests
image: cirrusci/flutter:dev
@ -166,26 +176,31 @@ clone:
steps:
- name: clone
environment:
buildbot_key_b64:
from_secret: buildbot_key_b64
commands:
- # force by pass of ssh host key check, less secure
#- ssh-keyscan -H git.openprivacy.ca >> ~/.ssh/known_hosts
- echo $DRONE_UI_USERNAME
- echo $Env:DRONE_UI_USERNAME
- echo %userprofile%
- dir
- git clone gogs@git.openprivacy.ca:flutter/flutter_app.git .
#- # force by pass of ssh host key check, less secure
#- ssh-keyscan -H git.openprivacy.ca >> ..\known_hosts
- echo $Env:buildbot_key_b64 > ..\id_rsa.b64
- certutil -decode ..\id_rsa.b64 ..\id_rsa
- git init
# -o UserKnownHostsFile=../known_hosts
- git config core.sshCommand 'ssh -o StrictHostKeyChecking=no -i ../id_rsa'
- git remote add origin gogs@git.openprivacy.ca:flutter/flutter_app.git
- git pull origin trunk
- git fetch --tags
- git checkout $DRONE_COMMIT
- name: fetch
commands:
- git fetch --tags
- powershell -command "git describe --tags > VERSION"
- powershell -command "Get-Date -Format 'yyyy-MM-dd-HH-mm' >.\BUILDDATE"
- git describe --tags > VERSION
- powershell -command "Get-Date -Format 'yyyy-MM-dd-HH-mm'" > BUILDDATE
- .\fetch-libcwtch-go.ps1
- name: build-windows
commands:
- flutter pub get
- flutter build windows
- C:\src\flutter\bin\flutter pub get
- C:\src\flutter\bin\flutter build windows
# flwtch-`cat VERSION`-`cat BUILDDATE`
- $Env:builddir = 'deploy\flwtch-win-'
- $Env:builddir += type .\VERSION

View File

@ -1 +1 @@
v0.0.2-13-g8f493b8-2021-05-03-18-51
v0.0.2-24-ga1095b7-2021-05-11-00-13

2
android/.gitignore vendored
View File

@ -8,4 +8,4 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
# key.properties

View File

@ -25,6 +25,13 @@ 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')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
@ -46,11 +53,20 @@ android {
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
// signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}

View File

@ -8,7 +8,7 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutter_app"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/knott">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

4
android/key.properties Normal file
View File

@ -0,0 +1,4 @@
storePassword=%jks-password%
keyPassword=%jks-password%
keyAlias=cwtch-upload
storeFile=upload-keystore.jks

View File

@ -100,6 +100,20 @@ class CwtchNotifier {
}
}
break;
case "SendMessageToGroupError":
// from me (already displayed - do not update counter)
print("SendMessageToGroupError: $data");
var idx = data["Signature"];
var key = profileCN.getProfile(data["ProfileOnion"]).contactList.getContact(data["GroupID"]).getMessageKey(idx);
if (key == null) break;
try {
var message = Provider.of<MessageState>(key.currentContext, listen: false);
if (message == null) break;
message.error = true;
} catch (e) {
// ignore, we likely have an old key that has been replaced with an actual signature
}
break;
case "AppError":
print("New App Error: $data");
error.handleUpdate(data["Data"]);
@ -148,11 +162,11 @@ class CwtchNotifier {
print("server state change: $data");
profileCN.getProfile(data["ProfileOnion"]).contactList.contacts.forEach((contact) {
if (contact.isGroup == true && contact.server == data["GroupServer"]) {
print("server state change: $data " + contact.server);
contact.status = data["ConnectionState"];
}
});
break;
default:
print("unhandled event: $type");
}

View File

@ -361,6 +361,7 @@ class MessageState extends ChangeNotifier {
String _senderImage;
String _signature = "";
bool _ackd = false;
bool _error = false;
bool _loaded = false;
MessageState({
@ -376,6 +377,7 @@ class MessageState extends ChangeNotifier {
get overlay => this._overlay;
get timestamp => this._timestamp;
get ackd => this._ackd;
get error => this._error;
get senderOnion => this._senderOnion;
get senderImage => this._senderImage;
get loaded => this._loaded;
@ -389,6 +391,11 @@ class MessageState extends ChangeNotifier {
notifyListeners();
}
set error(bool newVal) {
this._error = newVal;
notifyListeners();
}
void tryLoad(BuildContext context) {
Provider.of<FlwtchState>(context, listen: false).cwtch.GetMessage(profileOnion, contactHandle, messageIndex).then((jsonMessage) {
dynamic messageWrapper = jsonDecode(jsonMessage);
@ -431,8 +438,12 @@ class MessageState extends ChangeNotifier {
}
this._loaded = true;
//update ackd last as it's changenotified
this._ackd = messageWrapper['Acknowledged'];
//update ackd and error last as they are changenotified
this.ackd = messageWrapper['Acknowledged'];
if (messageWrapper['Error'] != null) {
this.error = true;
}
});
}
}

View File

@ -101,6 +101,8 @@ class _MessageViewState extends State<MessageView> {
focusNode.requestFocus();
Future.delayed(const Duration(milliseconds: 80), () {
Provider.of<ContactInfoState>(context, listen: false).totalMessages++;
// Resort the contact list...
Provider.of<ProfileInfoState>(context, listen: false).contactList.updateLastMessageTime(Provider.of<ContactInfoState>(context, listen: false).onion, DateTime.now());
});
}

View File

@ -61,9 +61,11 @@ class MessageBubbleState extends State<MessageBubble> {
textAlign: fromMe ? TextAlign.right : TextAlign.left),
!fromMe
? SizedBox(width: 1, height: 1)
: Provider.of<MessageState>(context).ackd
: Provider.of<MessageState>(context).ackd == true
? Icon(Icons.check_circle_outline, color: Provider.of<Settings>(context).theme.messageFromMeTextColor(), size: 12)
: Icon(Icons.hourglass_bottom_outlined, color: Provider.of<Settings>(context).theme.messageFromMeTextColor(), size: 12)
: (Provider.of<MessageState>(context).error == true
? Icon(Icons.error_outline, color: Provider.of<Settings>(context).theme.messageFromMeTextColor(), size: 12)
: Icon(Icons.hourglass_bottom_outlined, color: Provider.of<Settings>(context).theme.messageFromMeTextColor(), size: 12))
],
));