Skip to content

Commit

Permalink
[0.0.21] Signup Email + Bug Fixes (#139)
Browse files Browse the repository at this point in the history
* copy regarding alpha in ios only

* iOS issues

* signup bug fixes, standardizing secure text inputs, drafting step-email, colour clean up

* more drafting of email step in signup process

* adding global alerts provider with empty scaffold, color cleanup

* dynamically add signup steps based on homeserver

* fixing regex and email validation errors

* properly sending email verficiation, drafting email verification waiting screen

* email verification now works with matrix.org

* allow manual check for verfication from server

* cleanup and signup on auth state change bug

* adding back on login view

* adding read receipts

* more intro flow UI touchups
  • Loading branch information
ereio authored Jul 19, 2020
1 parent c4d22f8 commit 58bcc3f
Show file tree
Hide file tree
Showing 63 changed files with 1,958 additions and 958 deletions.
1 change: 1 addition & 0 deletions assets/graphics/undraw_message_sent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/graphics/undraw_new_message.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/Flutter/.last_build_id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
58eeeb327edd86c20605308dcccf607d
211ec0c685daabf82f10bc1ab4a21d76
14 changes: 13 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ PODS:
- OLMKit/olmcpp (3.1.0)
- path_provider (0.0.1):
- Flutter
- path_provider_linux (0.0.1):
- Flutter
- path_provider_macos (0.0.1):
- Flutter
- SDWebImage (5.8.0):
- SDWebImage/Core (= 5.8.0)
- SDWebImage/Core (5.8.0)
Expand Down Expand Up @@ -82,6 +86,8 @@ DEPENDENCIES:
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- OLMKit
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
- path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
Expand Down Expand Up @@ -116,6 +122,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
path_provider_linux:
:path: ".symlinks/plugins/path_provider_linux/ios"
path_provider_macos:
:path: ".symlinks/plugins/path_provider_macos/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
url_launcher:
Expand All @@ -140,7 +150,9 @@ SPEC CHECKSUMS:
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
image_picker: 66aa71bc96850a90590a35d4c4a2907b0d823109
OLMKit: 4ee0159d63feeb86d836fdcfefe418e163511639
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
SDWebImage: 84000f962cbfa70c07f19d2234cbfcf5d779b5dc
SDWebImageFLPlugin: 6c2295fb1242d44467c6c87dc5db6b0a13228fd8
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
Expand Down
3 changes: 3 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
Expand Down Expand Up @@ -527,6 +528,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
Expand Down Expand Up @@ -559,6 +561,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
Expand Down
3 changes: 3 additions & 0 deletions lib/global/assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class Assets {
static const heroSignupUsername = 'assets/graphics/undraw_profile_data.svg';
static const heroSignupPassword = 'assets/graphics/undraw_in_thought.svg';
static const heroSignupHomeserver = 'assets/graphics/undraw_mention.svg';
static const heroSignupEmail = 'assets/graphics/undraw_message_sent.svg';
static const heroSignupVerificationView =
'assets/graphics/undraw_new_message.svg';

// chat
static const heroChatNotFound = 'assets/graphics/undraw_not_found.svg';
Expand Down
45 changes: 0 additions & 45 deletions lib/global/colors.dart

This file was deleted.

45 changes: 45 additions & 0 deletions lib/global/colours.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';

/**
* British localization because
* google monopolized the namespaces
*/
class Colours {
static const cyanSyphon = 0xff34C7B5;
static const cyanSyphonAlpha = 0xAA34C7B5;

static const blueBubbly = 0xff4476CC;

static const greyEnabled = 0xffFAFAFA;
static const greyDisabled = 0xffD8D8D8;
static const greyDark = 0xff4D5767;
static const greyBubble = 0xffEEEEEE;

static const blackDefault = 0xff121212;
static const greyDefault = 0xFF9E9E9E;
static const whiteDefault = 0xffFEFEFE;

// Material colors at shades of 700
static const chatRed = 0xFFC62828;
static const chatOrange = 0xFFF57C00;
static const chatPurple = 0xFF7B1FA2;
static const chatGreen = 0xFF388E3C;
static const chatMagenta = 0xFFC2185B;
static const chatTeal = 0xFF00796B;
static const chatBlue = 0xFF1976D2;

static const chatColors = [
Color(Colours.chatRed),
Color(Colours.chatOrange),
Color(Colours.chatPurple),
Color(Colours.chatTeal),
Color(Colours.chatMagenta),
Color(Colours.chatGreen),
Color(Colours.chatBlue),
];
}

Color hashedColor(String hashable) {
int hash = hashable.codeUnits.reduce((value, element) => value + element);
return Colours.chatColors[hash % Colours.chatColors.length];
}
19 changes: 15 additions & 4 deletions lib/global/dimensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import 'package:flutter/material.dart';

class Dimensions {
// Generic
static const double widgetHeightMax = 1024;
static const scrollviewPadding = EdgeInsets.only(
bottom: 32,
);
static const double widgetHeightMax = 1024;

// Media
static const double mediaSize = 264;
Expand Down Expand Up @@ -50,6 +50,7 @@ class Dimensions {
static const double inputSizeMax = 296;

static const double inputHeight = 52;
static const double inputBorderRadius = 30.0;
static const double inputWidthMin = inputSizeMin;
static const double inputWidthMax = inputSizeMax; // 43 * 8

Expand All @@ -59,10 +60,9 @@ class Dimensions {
);

// Dialogs

static const EdgeInsets dialogPadding = EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
horizontal: 24,
vertical: 16,
);

static const EdgeInsets dialogContentPadding = EdgeInsets.symmetric(
Expand Down Expand Up @@ -99,6 +99,17 @@ class Dimensions {
}

// Content

static contentWidth(BuildContext context) {
final size = MediaQuery.of(context).size;
return size.width * 0.75;
}

static contentWidthWide(BuildContext context) {
final size = MediaQuery.of(context).size;
return size.width * 0.8;
}

static const contentPadding = EdgeInsets.symmetric(
horizontal: 32,
vertical: 8,
Expand Down
46 changes: 46 additions & 0 deletions lib/global/libs/matrix/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class MatrixAuthTypes {
static const TOKEN = 'm.login.token';
static const TERMS = 'm.login.terms';
static const DUMMY = 'm.login.dummy';
static const EMAIL = 'm.login.email.identity';
}

abstract class Auth {
Expand Down Expand Up @@ -55,6 +56,35 @@ abstract class Auth {
return await json.decode(response.body);
}

/**
* Register New User
*
* inhibit_login automatically logs in the user after creation
*/
static FutureOr<dynamic> registerEmail({
String protocol,
String homeserver,
String clientSecret,
String email,
int sendAttempt = 1,
}) async {
String url =
'$protocol$homeserver/_matrix/client/r0/register/email/requestToken';

Map body = {
"email": email,
"client_secret": clientSecret,
"send_attempt": sendAttempt,
};

final response = await http.post(
url,
body: json.encode(body),
);

return await json.decode(response.body);
}

/**
* Register New User
*
Expand All @@ -68,6 +98,7 @@ abstract class Auth {
String session,
String authType = MatrixAuthTypes.DUMMY,
String authValue,
Map authParams,
String deviceId,
String deviceName,
}) async {
Expand Down Expand Up @@ -99,6 +130,21 @@ abstract class Auth {
}
};
break;
case MatrixAuthTypes.EMAIL:
body = {
'auth': {
'type': MatrixAuthTypes.EMAIL,
"threepid_creds": {
"sid": authParams['sid'],
"client_secret": authParams['client_secret'],
},
"threepidCreds": {
"sid": authParams['sid'],
"client_secret": authParams['client_secret'],
}
}
};
break;
case MatrixAuthTypes.DUMMY: // default
default:
break;
Expand Down
2 changes: 2 additions & 0 deletions lib/global/libs/matrix/errors.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class MatrixErrors {
static const String room_unknown = 'M_UNKNOWN';
static const String not_authorized = 'M_UNAUTHORIZED';
static const String room_not_found = 'M_NOT_FOUND';
static const String user_in_use = 'M_USER_IN_USE';
static const String unknown_token = 'M_UNKNOWN_TOKEN';
static const String email_in_use = 'M_THREEPID_IN_USE';
}
14 changes: 10 additions & 4 deletions lib/global/libs/matrix/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,25 +293,31 @@ abstract class Events {
*
* https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid
*/
static Future<dynamic> sendReadReceipt({
static Future<dynamic> sendReadMarkers({
String protocol = 'https://',
String homeserver = 'matrix.org',
String accessToken,
String roomId,
String receiptType,
String messageId,
String lastRead,
bool readAll = true,
}) async {
String url =
'$protocol$homeserver/_matrix/client/r0/rooms/$roomId/receipt/$receiptType/$messageId';
'$protocol$homeserver/_matrix/client/r0/rooms/$roomId/read_markers';

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
};

Map body = {
'm.fully_read': readAll ? messageId : lastRead,
'm.read': messageId,
};

final response = await http.post(
url,
headers: headers,
body: json.encode({}),
body: json.encode(body),
);

return await json.decode(response.body);
Expand Down
2 changes: 2 additions & 0 deletions lib/global/libs/matrix/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ abstract class MatrixApi {
static final registerUser = Auth.registerUser;
static final updatePassword = Auth.updatePassword;
static final checkUsernameAvailability = Auth.checkUsernameAvailability;
static final registerEmail = Auth.registerEmail;

// Search
static final searchRooms = Search.searchRooms;
Expand All @@ -36,6 +37,7 @@ abstract class MatrixApi {
// Events
static final sendEvent = Events.sendEvent;
static final sendTyping = Events.sendTyping;
static final sendReadReceipts = Events.sendReadMarkers;
static final sendMessage = Events.sendMessage;
static final sendMessageEncrypted = Events.sendMessageEncrypted;
static final fetchStateEvents = Events.fetchStateEvents;
Expand Down
Loading

0 comments on commit 58bcc3f

Please sign in to comment.