Skip to content

Commit

Permalink
TW-1699: app does start on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Te-Z committed Apr 26, 2024
1 parent 2cdf44c commit 0742534
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/config/go_routes/go_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ abstract class AppRoutes {
path: '/home',
pageBuilder: (context, state) => defaultPageBuilder(
context,
PlatformInfos.isMobile
PlatformInfos.isMobile || PlatformInfos.isLinux
? const TwakeWelcome()
: AutoHomeserverPicker(
loggedOut: state.extra is bool ? state.extra as bool? : null,
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/bootstrap/bootstrap_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
if (PlatformInfos.isAndroid) {
return L10n.of(context)!.storeInAndroidKeystore;
}
if (PlatformInfos.isIOS || PlatformInfos.isMacOS) {
if (PlatformInfos.isIOS || PlatformInfos.isMacOS || PlatformInfos.isLinux) {
return L10n.of(context)!.storeInAppleKeyChain;
}
return L10n.of(context)!.storeSecurlyOnThisDevice;
Expand Down
1 change: 1 addition & 0 deletions lib/pages/chat/events/message_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class MessageContent extends StatelessWidget
if (PlatformInfos.isMobile ||
PlatformInfos.isMacOS ||
PlatformInfos.isWeb
// TODO: test this
// Disabled until https://github.com/bleonard252/just_audio_mpv/issues/3
// is fixed
// || PlatformInfos.isLinux
Expand Down
5 changes: 4 additions & 1 deletion lib/pages/dialer/dialer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ class MyCallingPage extends State<Calling> {

void _playCallSound() async {
const path = 'assets/sounds/call.ogg';
if (kIsWeb || PlatformInfos.isMobile || PlatformInfos.isMacOS) {
if (kIsWeb ||
PlatformInfos.isMobile ||
PlatformInfos.isMacOS ||
PlatformInfos.isLinux) {
final player = AudioPlayer();
await player.setAsset(path);
player.play();
Expand Down
9 changes: 8 additions & 1 deletion lib/presentation/mixins/connect_page_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,19 @@ mixin ConnectPageMixin {
bool supportsSso(BuildContext context) =>
(PlatformInfos.isMobile ||
PlatformInfos.isWeb ||
PlatformInfos.isMacOS) &&
PlatformInfos.isMacOS ||
PlatformInfos.isLinux) &&
supportsFlow(context: context, flowType: 'm.login.sso');

bool supportsLogin(BuildContext context) =>
supportsFlow(context: context, flowType: 'm.login.password');

String _getRedirectUrlScheme(String redirectUrl) {
// Remove when package limitation will be fixed
// https://pub.dev/packages/flutter_web_auth_2#windows-and-linux
if (PlatformInfos.isLinux || PlatformInfos.isWindows) {
return "http://localhost:60665";
}
return Uri.parse(redirectUrl).scheme;
}

Expand Down Expand Up @@ -92,6 +98,7 @@ mixin ConnectPageMixin {
redirectUrl: redirectUrl,
);
final urlScheme = _getRedirectUrlScheme(redirectUrl);
print("tez: urlScheme = $urlScheme");
return await FlutterWebAuth2.authenticate(
url: url,
callbackUrlScheme: urlScheme,
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/client_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ abstract class ClientManager {
AuthenticationTypes.password,
if (PlatformInfos.isMobile ||
PlatformInfos.isWeb ||
PlatformInfos.isMacOS)
PlatformInfos.isMacOS ||
PlatformInfos.isLinux)
AuthenticationTypes.sso,
},
nativeImplementations: nativeImplementations,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/voip/user_media_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class UserMediaManager {
Future<void> startRingingTone() async {
if (PlatformInfos.isMobile) {
await FlutterRingtonePlayer.playRingtone(volume: 80);
} else if ((kIsWeb || PlatformInfos.isMacOS) &&
} else if ((kIsWeb || PlatformInfos.isMacOS || PlatformInfos.isLinux) &&
_assetsAudioPlayer != null) {
const path = 'assets/sounds/phone.ogg';
final player = _assetsAudioPlayer = AudioPlayer();
Expand Down
25 changes: 13 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1022,26 +1022,27 @@ packages:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: f2afec1f1762c040a349ea2a588e32f442da5d0db3494a52a929a97c9e550bc5
sha256: ffdbb60130e4665d2af814a0267c481bcf522c41ae2e43caf69fa0146876d685
url: "https://pub.dev"
source: hosted
version: "7.0.1"
version: "9.0.0"
flutter_secure_storage_linux:
dependency: transitive
dependency: "direct overridden"
description:
name: flutter_secure_storage_linux
sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e"
url: "https://pub.dev"
source: hosted
path: flutter_secure_storage_linux
ref: develop
resolved-ref: "27d3e2e69123f0c712919ad392e15830741e4383"
url: "https://github.com/tomekit/flutter_secure_storage.git"
source: git
version: "1.2.0"
flutter_secure_storage_macos:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: ff0768a6700ea1d9620e03518e2e25eac86a8bd07ca3556e9617bfa5ace4bd00
sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.1"
flutter_secure_storage_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -3064,13 +3065,13 @@ packages:
source: hosted
version: "1.1.0"
web:
dependency: transitive
dependency: "direct overridden"
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.5.1"
web_socket_channel:
dependency: transitive
description:
Expand Down
9 changes: 8 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies:
flutter_olm: ^1.2.0
flutter_openssl_crypto: ^0.1.0
flutter_ringtone_player: ^3.1.1
flutter_secure_storage: ^7.0.1
flutter_secure_storage: ^9.0.0
flutter_svg: ^0.22.0
flutter_typeahead: ^5.1.0
flutter_web_auth_2: ^3.1.1
Expand Down Expand Up @@ -245,6 +245,12 @@ dependency_overrides:
git:
url: https://gitlab.com/TheOneWithTheBraid/flutter_secure_storage_windows.git
ref: main
# https://github.com/mogol/flutter_secure_storage/issues/616
flutter_secure_storage_linux:
git:
url: https://github.com/tomekit/flutter_secure_storage.git
ref: develop
path: flutter_secure_storage_linux
geolocator_android:
hosted:
name: geolocator_android
Expand All @@ -269,6 +275,7 @@ dependency_overrides:
git:
url: https://github.com/linagora/matrix_link_text.git
ref: twake-supported
web: ^0.5.0

cider:
link_template:
Expand Down

0 comments on commit 0742534

Please sign in to comment.