new splash flow in conjunction with startCwtch changes in libcwtch-go; new version of flutter splash with error message display ability; cleaning old code
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
f08062c0fb
commit
650148d731
|
@ -1 +1 @@
|
||||||
v0.0.2-66-g39187a7-2021-06-15-00-32
|
v0.0.2-70-gc5f36a9-2021-06-15-18-07
|
|
@ -54,7 +54,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
val torPath = (a.get("torPath") as? String) ?: "tor"
|
val torPath = (a.get("torPath") as? String) ?: "tor"
|
||||||
Log.i("FlwtchWorker.kt", "appDir: '$appDir' torPath: '$torPath'")
|
Log.i("FlwtchWorker.kt", "appDir: '$appDir' torPath: '$torPath'")
|
||||||
|
|
||||||
if (Cwtch.startCwtch(appDir, torPath) != 0.toByte()) return Result.failure()
|
if (Cwtch.startCwtch(appDir, torPath) != 0.toLong()) return Result.failure()
|
||||||
|
|
||||||
// infinite coroutine :)
|
// infinite coroutine :)
|
||||||
while(true) {
|
while(true) {
|
||||||
|
@ -62,13 +62,13 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
if (evt.EventType == "NewMessageFromPeer") {
|
if (evt.EventType == "NewMessageFromPeer") {
|
||||||
val data = JSONObject(evt.Data)
|
val data = JSONObject(evt.Data)
|
||||||
val channelId =
|
val channelId =
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
createMessageNotificationChannel(data.getString("RemotePeer"), data.getString("RemotePeer"))
|
createMessageNotificationChannel(data.getString("RemotePeer"), data.getString("RemotePeer"))
|
||||||
} else {
|
} else {
|
||||||
// If earlier version channel ID is not used
|
// If earlier version channel ID is not used
|
||||||
// https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#NotificationCompat.Builder(android.content.Context)
|
// https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#NotificationCompat.Builder(android.content.Context)
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
val loader = FlutterInjector.instance().flutterLoader()
|
val loader = FlutterInjector.instance().flutterLoader()
|
||||||
val key = loader.getLookupKeyForAsset("assets/"+data.getString("Picture"))//"assets/profiles/001-centaur.png")
|
val key = loader.getLookupKeyForAsset("assets/"+data.getString("Picture"))//"assets/profiles/001-centaur.png")
|
||||||
|
@ -82,13 +82,13 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
}
|
}
|
||||||
|
|
||||||
val newNotification = NotificationCompat.Builder(applicationContext, channelId)
|
val newNotification = NotificationCompat.Builder(applicationContext, channelId)
|
||||||
.setContentTitle(data.getString("Nick"))
|
.setContentTitle(data.getString("Nick"))
|
||||||
.setContentText("New message")
|
.setContentText("New message")
|
||||||
.setLargeIcon(BitmapFactory.decodeStream(fh))
|
.setLargeIcon(BitmapFactory.decodeStream(fh))
|
||||||
.setSmallIcon(R.mipmap.knott)
|
.setSmallIcon(R.mipmap.knott)
|
||||||
.setContentIntent(PendingIntent.getActivity(applicationContext, 1, clickIntent, PendingIntent.FLAG_UPDATE_CURRENT))
|
.setContentIntent(PendingIntent.getActivity(applicationContext, 1, clickIntent, PendingIntent.FLAG_UPDATE_CURRENT))
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.build()
|
.build()
|
||||||
notificationManager.notify(getNotificationID(data.getString("ProfileOnion"), data.getString("RemotePeer")), newNotification)
|
notificationManager.notify(getNotificationID(data.getString("ProfileOnion"), data.getString("RemotePeer")), newNotification)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,10 +104,6 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
"ReconnectCwtchForeground" -> {
|
"ReconnectCwtchForeground" -> {
|
||||||
Cwtch.reconnectCwtchForeground()
|
Cwtch.reconnectCwtchForeground()
|
||||||
}
|
}
|
||||||
"SelectProfile" -> {
|
|
||||||
val onion = (a.get("profile") as? String) ?: "";
|
|
||||||
Cwtch.selectProfile(onion)
|
|
||||||
}
|
|
||||||
"CreateProfile" -> {
|
"CreateProfile" -> {
|
||||||
val nick = (a.get("nick") as? String) ?: "";
|
val nick = (a.get("nick") as? String) ?: "";
|
||||||
val pass = (a.get("pass") as? String) ?: "";
|
val pass = (a.get("pass") as? String) ?: "";
|
||||||
|
@ -118,8 +114,6 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
Cwtch.loadProfiles(pass)
|
Cwtch.loadProfiles(pass)
|
||||||
}
|
}
|
||||||
"GetProfiles" -> Result.success(Data.Builder().putString("result", Cwtch.getProfiles()).build())
|
"GetProfiles" -> Result.success(Data.Builder().putString("result", Cwtch.getProfiles()).build())
|
||||||
// "ACNEvents" -> result.success(Cwtch.acnEvents())
|
|
||||||
"ContactEvents" -> Result.success(Data.Builder().putString("result", Cwtch.contactEvents()).build())
|
|
||||||
"NumMessages" -> {
|
"NumMessages" -> {
|
||||||
val profile = (a.get("profile") as? String) ?: "";
|
val profile = (a.get("profile") as? String) ?: "";
|
||||||
val handle = (a.get("contact") as? String) ?: "";
|
val handle = (a.get("contact") as? String) ?: "";
|
||||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/src/services/text_input.dart';
|
||||||
|
|
||||||
abstract class Cwtch {
|
abstract class Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<dynamic> Start();
|
Future<void> Start();
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<void> ReconnectCwtchForeground();
|
Future<void> ReconnectCwtchForeground();
|
||||||
|
|
||||||
|
@ -31,11 +31,6 @@ abstract class Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
void DebugResetContact(String profileOnion, String contactHandle);
|
void DebugResetContact(String profileOnion, String contactHandle);
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<dynamic> ACNEvents();
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<dynamic> ContactEvents();
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<dynamic> GetProfiles();
|
Future<dynamic> GetProfiles();
|
||||||
|
|
||||||
|
|
|
@ -17,17 +17,25 @@ class CwtchNotifier {
|
||||||
late ErrorHandler error;
|
late ErrorHandler error;
|
||||||
late TorStatus torStatus;
|
late TorStatus torStatus;
|
||||||
late NotificationsManager notificationManager;
|
late NotificationsManager notificationManager;
|
||||||
|
late AppState appState;
|
||||||
|
|
||||||
CwtchNotifier(ProfileListState pcn, Settings settingsCN, ErrorHandler errorCN, TorStatus torStatusCN, NotificationsManager notificationManagerP) {
|
CwtchNotifier(ProfileListState pcn, Settings settingsCN, ErrorHandler errorCN, TorStatus torStatusCN, NotificationsManager notificationManagerP, AppState appStateCN) {
|
||||||
profileCN = pcn;
|
profileCN = pcn;
|
||||||
settings = settingsCN;
|
settings = settingsCN;
|
||||||
error = errorCN;
|
error = errorCN;
|
||||||
torStatus = torStatusCN;
|
torStatus = torStatusCN;
|
||||||
notificationManager = notificationManagerP;
|
notificationManager = notificationManagerP;
|
||||||
|
appState = appStateCN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleMessage(String type, dynamic data) {
|
void handleMessage(String type, dynamic data) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case "CwtchStarted":
|
||||||
|
appState.SetCwtchInit();
|
||||||
|
break;
|
||||||
|
case "CwtchStartError":
|
||||||
|
appState.SetAppError(data["Error"]);
|
||||||
|
break;
|
||||||
case "NewPeer":
|
case "NewPeer":
|
||||||
profileCN.add(ProfileInfoState(
|
profileCN.add(ProfileInfoState(
|
||||||
onion: data["Identity"], nickname: data["name"], imagePath: data["picture"], contactsJson: data["ContactsJson"], serversJson: data["ServerList"], online: data["Online"] == "true"));
|
onion: data["Identity"], nickname: data["name"], imagePath: data["picture"], contactsJson: data["ContactsJson"], serversJson: data["ServerList"], online: data["Online"] == "true"));
|
||||||
|
|
|
@ -58,8 +58,8 @@ typedef GetJsonBlobFromStrStrIntFn = Pointer<Utf8> Function(Pointer<Utf8>, int,
|
||||||
typedef get_json_blob_from_str_str_int_int_function = Pointer<Utf8> Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int32, Int32);
|
typedef get_json_blob_from_str_str_int_int_function = Pointer<Utf8> Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int32, Int32);
|
||||||
typedef GetJsonBlobFromStrStrIntIntFn = Pointer<Utf8> Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int, int);
|
typedef GetJsonBlobFromStrStrIntIntFn = Pointer<Utf8> Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int, int);
|
||||||
|
|
||||||
typedef acn_events_function = Pointer<Utf8> Function();
|
typedef appbus_events_function = Pointer<Utf8> Function();
|
||||||
typedef ACNEventsFn = Pointer<Utf8> Function();
|
typedef AppbusEventsFn = Pointer<Utf8> Function();
|
||||||
|
|
||||||
class CwtchFfi implements Cwtch {
|
class CwtchFfi implements Cwtch {
|
||||||
late DynamicLibrary library;
|
late DynamicLibrary library;
|
||||||
|
@ -80,7 +80,7 @@ class CwtchFfi implements Cwtch {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<dynamic> Start() async {
|
Future<void> Start() async {
|
||||||
String home = "";
|
String home = "";
|
||||||
String bundledTor = "";
|
String bundledTor = "";
|
||||||
Map<String, String> envVars = Platform.environment;
|
Map<String, String> envVars = Platform.environment;
|
||||||
|
@ -146,9 +146,9 @@ class CwtchFfi implements Cwtch {
|
||||||
library = DynamicLibrary.open("libCwtch.so");
|
library = DynamicLibrary.open("libCwtch.so");
|
||||||
}
|
}
|
||||||
|
|
||||||
var getAppbusEventC = library.lookup<NativeFunction<acn_events_function>>("c_GetAppBusEvent");
|
var getAppbusEventC = library.lookup<NativeFunction<appbus_events_function>>("c_GetAppBusEvent");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final GetAppbusEvent = getAppbusEventC.asFunction<ACNEventsFn>();
|
final GetAppbusEvent = getAppbusEventC.asFunction<AppbusEventsFn>();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Pointer<Utf8> result = GetAppbusEvent();
|
Pointer<Utf8> result = GetAppbusEvent();
|
||||||
|
@ -185,28 +185,6 @@ class CwtchFfi implements Cwtch {
|
||||||
LoadProfiles(ut8pass, ut8pass.length);
|
LoadProfiles(ut8pass, ut8pass.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<String> ACNEvents() async {
|
|
||||||
var acnEventsC = library.lookup<NativeFunction<acn_events_function>>("c_ACNEvents");
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
final ACNEvents = acnEventsC.asFunction<ACNEventsFn>();
|
|
||||||
|
|
||||||
Pointer<Utf8> result = ACNEvents();
|
|
||||||
String event = result.toDartString();
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<String> ContactEvents() async {
|
|
||||||
var acnEventsC = library.lookup<NativeFunction<acn_events_function>>("c_ContactEvents");
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
final ContactEvents = acnEventsC.asFunction<ACNEventsFn>();
|
|
||||||
|
|
||||||
Pointer<Utf8> result = ContactEvents();
|
|
||||||
String event = result.toDartString();
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<String> GetProfiles() async {
|
Future<String> GetProfiles() async {
|
||||||
var getProfilesC = library.lookup<NativeFunction<get_json_blob_void_function>>("c_GetProfiles");
|
var getProfilesC = library.lookup<NativeFunction<get_json_blob_void_function>>("c_GetProfiles");
|
||||||
|
|
|
@ -42,7 +42,7 @@ class CwtchGomobile implements Cwtch {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<dynamic> Start() async {
|
Future<void> Start() async {
|
||||||
print("gomobile.dart: Start()...");
|
print("gomobile.dart: Start()...");
|
||||||
var cwtchDir = path.join((await androidHomeDirectory).path, ".cwtch");
|
var cwtchDir = path.join((await androidHomeDirectory).path, ".cwtch");
|
||||||
if (EnvironmentConfig.BUILD_VER == dev_version) {
|
if (EnvironmentConfig.BUILD_VER == dev_version) {
|
||||||
|
@ -86,17 +86,6 @@ class CwtchGomobile implements Cwtch {
|
||||||
cwtchPlatform.invokeMethod("DeleteProfile", {"onion": onion, "pass": pass});
|
cwtchPlatform.invokeMethod("DeleteProfile", {"onion": onion, "pass": pass});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<dynamic> ACNEvents() {
|
|
||||||
return cwtchPlatform.invokeMethod("ACNEvents");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<dynamic> ContactEvents() {
|
|
||||||
return cwtchPlatform.invokeMethod("ContactEvents");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<dynamic> GetProfiles() {
|
Future<dynamic> GetProfiles() {
|
||||||
print("gomobile.dart: GetProfiles()");
|
print("gomobile.dart: GetProfiles()");
|
||||||
return cwtchPlatform.invokeMethod("GetProfiles");
|
return cwtchPlatform.invokeMethod("GetProfiles");
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:isolate';
|
||||||
|
|
||||||
import 'package:cwtch/notification_manager.dart';
|
import 'package:cwtch/notification_manager.dart';
|
||||||
import 'package:cwtch/views/messageview.dart';
|
import 'package:cwtch/views/messageview.dart';
|
||||||
|
@ -26,9 +27,12 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
var globalSettings = Settings(Locale("en", ''), Opaque.dark);
|
var globalSettings = Settings(Locale("en", ''), Opaque.dark);
|
||||||
var globalErrorHandler = ErrorHandler();
|
var globalErrorHandler = ErrorHandler();
|
||||||
var globalTorStatus = TorStatus();
|
var globalTorStatus = TorStatus();
|
||||||
|
var globalAppState = AppState();
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
print("main()");
|
||||||
LicenseRegistry.addLicense(() => licenses());
|
LicenseRegistry.addLicense(() => licenses());
|
||||||
|
print("runApp()");
|
||||||
runApp(Flwtch());
|
runApp(Flwtch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +46,6 @@ class Flwtch extends StatefulWidget {
|
||||||
class FlwtchState extends State<Flwtch> {
|
class FlwtchState extends State<Flwtch> {
|
||||||
final TextStyle biggerFont = const TextStyle(fontSize: 18);
|
final TextStyle biggerFont = const TextStyle(fontSize: 18);
|
||||||
late Cwtch cwtch;
|
late Cwtch cwtch;
|
||||||
bool cwtchInit = false;
|
|
||||||
late ProfileInfoState selectedProfile;
|
late ProfileInfoState selectedProfile;
|
||||||
String selectedConversation = "";
|
String selectedConversation = "";
|
||||||
var columns = [1]; // default or 'single column' mode
|
var columns = [1]; // default or 'single column' mode
|
||||||
|
@ -53,37 +56,37 @@ class FlwtchState extends State<Flwtch> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
|
print("Init state");
|
||||||
super.initState();
|
super.initState();
|
||||||
cwtchInit = false;
|
|
||||||
|
|
||||||
profs = ProfileListState();
|
profs = ProfileListState();
|
||||||
notificationClickChannel.setMethodCallHandler(_externalNotificationClicked);
|
notificationClickChannel.setMethodCallHandler(_externalNotificationClicked);
|
||||||
|
print("initState set cwtch...");
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager());
|
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
||||||
cwtch = CwtchGomobile(cwtchNotifier);
|
cwtch = CwtchGomobile(cwtchNotifier);
|
||||||
} else if (Platform.isLinux) {
|
} else if (Platform.isLinux) {
|
||||||
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, LinuxNotificationsManager());
|
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, LinuxNotificationsManager(), globalAppState);
|
||||||
cwtch = CwtchFfi(cwtchNotifier);
|
cwtch = CwtchFfi(cwtchNotifier);
|
||||||
} else {
|
} else {
|
||||||
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager());
|
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
||||||
cwtch = CwtchFfi(cwtchNotifier);
|
cwtch = CwtchFfi(cwtchNotifier);
|
||||||
}
|
}
|
||||||
|
print("initState cwtch.Start()...");
|
||||||
cwtch.Start();
|
cwtch.Start();
|
||||||
setState(() {
|
print("initState done!");
|
||||||
cwtchInit = true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeNotifierProvider<TorStatus> getTorStatusProvider() => ChangeNotifierProvider.value(value: globalTorStatus);
|
ChangeNotifierProvider<TorStatus> getTorStatusProvider() => ChangeNotifierProvider.value(value: globalTorStatus);
|
||||||
ChangeNotifierProvider<ErrorHandler> getErrorHandlerProvider() => ChangeNotifierProvider.value(value: globalErrorHandler);
|
ChangeNotifierProvider<ErrorHandler> getErrorHandlerProvider() => ChangeNotifierProvider.value(value: globalErrorHandler);
|
||||||
ChangeNotifierProvider<Settings> getSettingsProvider() => ChangeNotifierProvider.value(value: globalSettings);
|
ChangeNotifierProvider<Settings> getSettingsProvider() => ChangeNotifierProvider.value(value: globalSettings);
|
||||||
|
ChangeNotifierProvider<AppState> getAppStateProvider() => ChangeNotifierProvider.value(value: globalAppState);
|
||||||
Provider<FlwtchState> getFlwtchStateProvider() => Provider<FlwtchState>(create: (_) => this);
|
Provider<FlwtchState> getFlwtchStateProvider() => Provider<FlwtchState>(create: (_) => this);
|
||||||
ChangeNotifierProvider<ProfileListState> getProfileListProvider() => ChangeNotifierProvider(create: (context) => profs);
|
ChangeNotifierProvider<ProfileListState> getProfileListProvider() => ChangeNotifierProvider(create: (context) => profs);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print("build()");
|
||||||
//appStatus = AppModel(cwtch: cwtch);
|
//appStatus = AppModel(cwtch: cwtch);
|
||||||
globalSettings.initPackageInfo();
|
globalSettings.initPackageInfo();
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
|
@ -93,10 +96,11 @@ class FlwtchState extends State<Flwtch> {
|
||||||
getSettingsProvider(),
|
getSettingsProvider(),
|
||||||
getErrorHandlerProvider(),
|
getErrorHandlerProvider(),
|
||||||
getTorStatusProvider(),
|
getTorStatusProvider(),
|
||||||
|
getAppStateProvider(),
|
||||||
],
|
],
|
||||||
builder: (context, widget) {
|
builder: (context, widget) {
|
||||||
return Consumer<Settings>(
|
return Consumer2<Settings, AppState>(
|
||||||
builder: (context, settings, child) => MaterialApp(
|
builder: (context, settings, appState, child) => MaterialApp(
|
||||||
key: Key('app'),
|
key: Key('app'),
|
||||||
navigatorKey: navKey,
|
navigatorKey: navKey,
|
||||||
locale: settings.locale,
|
locale: settings.locale,
|
||||||
|
@ -104,7 +108,7 @@ class FlwtchState extends State<Flwtch> {
|
||||||
supportedLocales: AppLocalizations.supportedLocales,
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
title: 'Cwtch',
|
title: 'Cwtch',
|
||||||
theme: mkThemeData(settings),
|
theme: mkThemeData(settings),
|
||||||
home: cwtchInit == true ? (columns.length == 3 ? TripleColumnView() : ShiftRightFixer(child: ProfileMgrView())) : SplashView(),
|
home: appState.cwtchInit == true ? (columns.length == 3 ? TripleColumnView() : ShiftRightFixer(child: ProfileMgrView())) : SplashView(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -61,6 +61,21 @@ class ProfileListState extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AppState extends ChangeNotifier {
|
||||||
|
bool cwtchInit = false;
|
||||||
|
String appError = "";
|
||||||
|
|
||||||
|
void SetCwtchInit() {
|
||||||
|
cwtchInit = true;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetAppError(String error) {
|
||||||
|
appError = error;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ContactListState extends ChangeNotifier {
|
class ContactListState extends ChangeNotifier {
|
||||||
List<ContactInfoState> _contacts = [];
|
List<ContactInfoState> _contacts = [];
|
||||||
String _filter = "";
|
String _filter = "";
|
||||||
|
|
|
@ -1,11 +1,34 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../model.dart';
|
||||||
|
import '../settings.dart';
|
||||||
|
|
||||||
class SplashView extends StatelessWidget {
|
class SplashView extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Consumer<AppState>(
|
||||||
body: const Center(child: const Text("Loading Cwtch...")),
|
builder: (context, appState, child) => Scaffold(
|
||||||
);
|
body: Center(child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image(image: AssetImage("assets/knott.png"),
|
||||||
|
filterQuality: FilterQuality.medium,
|
||||||
|
isAntiAlias: true,
|
||||||
|
width: 200,
|
||||||
|
height: 200,),
|
||||||
|
Image(image: AssetImage("assets/cwtch_title.png"),
|
||||||
|
filterQuality: FilterQuality.medium,
|
||||||
|
isAntiAlias: true,),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Text(appState.appError == "" ? "Loading Cwtch..." : appState.appError,
|
||||||
|
style: TextStyle(fontSize: 16.0, color: appState.appError == "" ? Provider.of<Settings>(context).theme.mainTextColor() : Provider.of<Settings>(context).theme.textfieldErrorColor())),
|
||||||
|
),
|
||||||
|
Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")),
|
||||||
|
])),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ class _ProfileRowState extends State<ProfileRow> {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
var flwtch = Provider.of<FlwtchState>(context, listen: false);
|
var flwtch = Provider.of<FlwtchState>(context, listen: false);
|
||||||
flwtch.cwtch.SelectProfile(profile.onion);
|
|
||||||
flwtch.setState(() {
|
flwtch.setState(() {
|
||||||
flwtch.selectedProfile = profile;
|
flwtch.selectedProfile = profile;
|
||||||
flwtch.selectedConversation = "";
|
flwtch.selectedConversation = "";
|
||||||
|
|
Loading…
Reference in New Issue