Skip to content

Commit

Permalink
point thunder at hopandzip
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrett Bischof committed Feb 5, 2024
1 parent 510f177 commit 60bcc7d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions lemmy-instances.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ vlemmy.net
waveform.social
www.hexbear.net
yiffit.net
hopandzip.com
3 changes: 2 additions & 1 deletion lib/account/pages/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:thunder/utils/instance.dart';
import 'package:thunder/utils/links.dart';
import 'package:thunder/utils/text_input_formatter.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:thunder/globals.dart';

class LoginPage extends StatefulWidget {
final VoidCallback popRegister;
Expand Down Expand Up @@ -391,7 +392,7 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
void _addAnonymousInstance() async {
if (await isLemmyInstance(_instanceTextEditingController.text)) {
final SharedPreferences prefs = (await UserPreferences.instance).sharedPreferences;
List<String> anonymousInstances = prefs.getStringList(LocalSettings.anonymousInstances.name) ?? ['lemmy.ml'];
List<String> anonymousInstances = prefs.getStringList(LocalSettings.anonymousInstances.name) ?? [lemmyDefault];
if (anonymousInstances.contains(_instanceTextEditingController.text)) {
setState(() {
instanceValidated = false;
Expand Down
1 change: 1 addition & 0 deletions lib/globals.dart
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
const String currentVersion = '0.2.8+37';
const String lemmyDefault = 'hopandzip.com';
1 change: 1 addition & 0 deletions lib/instances.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ const List<String> instances = [
'waveform.social',
'www.hexbear.net',
'yiffit.net',
'hopandzip.com',
];
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import 'package:thunder/thunder/thunder.dart';
import 'package:thunder/user/bloc/user_bloc.dart';
import 'package:thunder/utils/global_context.dart';
import 'package:flutter/foundation.dart';
import 'package:thunder/globals.dart';

void main() async {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -46,7 +47,7 @@ void main() async {
DartPingIOS.register();
}

final String initialInstance = (await UserPreferences.instance).sharedPreferences.getString(LocalSettings.currentAnonymousInstance.name) ?? 'hopandzip.com';
final String initialInstance = (await UserPreferences.instance).sharedPreferences.getString(LocalSettings.currentAnonymousInstance.name) ?? lemmyDefault;
LemmyClient.instance.changeBaseUrl(initialInstance);

runApp(const ThunderApp());
Expand Down
5 changes: 3 additions & 2 deletions lib/thunder/bloc/thunder_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:thunder/core/singletons/lemmy_client.dart';
import 'package:thunder/core/singletons/preferences.dart';
import 'package:thunder/core/update/check_github_update.dart';
import 'package:thunder/utils/constants.dart';
import 'package:thunder/globals.dart';

part 'thunder_event.dart';

Expand Down Expand Up @@ -212,8 +213,8 @@ class ThunderBloc extends Bloc<ThunderEvent, ThunderState> {

List<String> anonymousInstances = prefs.getStringList(LocalSettings.anonymousInstances.name) ??
// If the user already has some accouts (i.e., an upgrade), we don't want to just throw an anonymous instance at them
((await Account.accounts()).isNotEmpty ? [] : ['lemmy.ml']);
String currentAnonymousInstance = prefs.getString(LocalSettings.currentAnonymousInstance.name) ?? 'lemmy.ml';
((await Account.accounts()).isNotEmpty ? [] : [lemmyDefault]);
String currentAnonymousInstance = prefs.getString(LocalSettings.currentAnonymousInstance.name) ?? lemmyDefault;

return emit(state.copyWith(
status: ThunderStatus.success,
Expand Down
4 changes: 2 additions & 2 deletions lib/thunder/bloc/thunder_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class ThunderState extends Equatable {

/// -------------------------- Accessibility Related Settings --------------------------
this.reduceAnimations = false,
this.anonymousInstances = const ['lemmy.ml'],
this.currentAnonymousInstance = 'lemmy.ml',
this.anonymousInstances = const [lemmyDefault],
this.currentAnonymousInstance = lemmyDefault,

/// --------------------------------- UI Events ---------------------------------
// Expand/Close FAB event
Expand Down

0 comments on commit 60bcc7d

Please sign in to comment.