Merge pull request #2682 from krille-chan/krille/fix-sso-android
chore: Follow up sso on android
This commit is contained in:
commit
150ab800ee
3 changed files with 1 additions and 28 deletions
|
|
@ -106,7 +106,7 @@
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="im.fluffychat" android:host="login"/>
|
<data android:scheme="im.fluffychat"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
import 'package:fluffychat/pages/sign_in/view_model/model/public_homeserver_data.dart';
|
|
||||||
|
|
||||||
int sortHomeservers(PublicHomeserverData a, PublicHomeserverData b) {
|
|
||||||
return _calcHomeserverScore(b).compareTo(_calcHomeserverScore(a));
|
|
||||||
}
|
|
||||||
|
|
||||||
int _calcHomeserverScore(PublicHomeserverData homeserver) {
|
|
||||||
var score = 0;
|
|
||||||
if (homeserver.description?.isNotEmpty == true) score++;
|
|
||||||
if (homeserver.website?.isNotEmpty == true) score++;
|
|
||||||
score += (homeserver.languages?.length ?? 0);
|
|
||||||
score += (homeserver.features?.length ?? 0);
|
|
||||||
score += (homeserver.onlineStatus ?? 0);
|
|
||||||
if (homeserver.ipv6 == true) score++;
|
|
||||||
if (homeserver.isp?.isNotEmpty == true) score++;
|
|
||||||
if (homeserver.privacy?.isNotEmpty == true) score++;
|
|
||||||
if (homeserver.rules?.isNotEmpty == true) score++;
|
|
||||||
if (homeserver.version?.isNotEmpty == true) score++;
|
|
||||||
if (homeserver.usingVanillaReg == true) score--;
|
|
||||||
if (homeserver.regLink != null) score--;
|
|
||||||
if (homeserver.regMethod != 'SSO') score--;
|
|
||||||
if (homeserver.regMethod == 'In-house Element') score--;
|
|
||||||
return score;
|
|
||||||
}
|
|
||||||
|
|
@ -7,7 +7,6 @@ import 'package:matrix/matrix_api_lite/utils/logs.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/config/setting_keys.dart';
|
import 'package:fluffychat/config/setting_keys.dart';
|
||||||
import 'package:fluffychat/pages/sign_in/utils/sort_homeservers.dart';
|
|
||||||
import 'package:fluffychat/pages/sign_in/view_model/model/public_homeserver_data.dart';
|
import 'package:fluffychat/pages/sign_in/view_model/model/public_homeserver_data.dart';
|
||||||
import 'package:fluffychat/pages/sign_in/view_model/sign_in_state.dart';
|
import 'package:fluffychat/pages/sign_in/view_model/sign_in_state.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
@ -74,8 +73,6 @@ class SignInViewModel extends ValueNotifier<SignInState> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
publicHomeservers.sort(sortHomeservers);
|
|
||||||
|
|
||||||
final defaultServer = publicHomeservers.singleWhereOrNull(
|
final defaultServer = publicHomeservers.singleWhereOrNull(
|
||||||
(server) => server.name == AppSettings.defaultHomeserver.value,
|
(server) => server.name == AppSettings.defaultHomeserver.value,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue