Browse Source

Usernames draft

master
Igor Zhukov 10 years ago
parent
commit
52e639cfa4
  1. 3
      app/css/app.css
  2. 14
      app/css/desktop.css
  3. BIN
      app/img/icons/IconsetW.png
  4. BIN
      app/img/icons/IconsetW_1x.png
  5. 8
      app/js/controllers.js
  6. 4
      app/js/lib/config.js
  7. 2
      app/js/lib/mtproto.js
  8. 36
      app/js/lib/schema.tl.txt
  9. 12
      app/js/locales/en-us.json
  10. 25
      app/partials/desktop/settings_modal.html
  11. 15
      app/partials/desktop/user_modal.html
  12. 31
      app/partials/desktop/username_edit_modal.html

3
app/css/app.css

@ -473,7 +473,8 @@ input[type="number"] { @@ -473,7 +473,8 @@ input[type="number"] {
.modal_section_body {
padding: 14px 14px;
}
.modal_section_body p {
.modal_section_body p,
.modal_section_body dl {
margin: 5px 0;
}
.modal_section:last-child .modal_section_body {

14
app/css/desktop.css

@ -545,7 +545,19 @@ div.im_panel_own_photo { @@ -545,7 +545,19 @@ div.im_panel_own_photo {
}
.user_modal_status {
color: #999;
margin-bottom: 16px;
margin-bottom: 15px;
}
.modal_section_body dt {
font-weight: normal;
display: inline-block;
width: 80px;
}
.modal_section_body dd {
display: inline-block;
}
.settings_modal_username_link,
.settings_modal_username_link:hover {
color: inherit;
}
.user_modal_main_btn {

BIN
app/img/icons/IconsetW.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

BIN
app/img/icons/IconsetW_1x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

8
app/js/controllers.js

@ -2119,6 +2119,14 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -2119,6 +2119,14 @@ angular.module('myApp.controllers', ['myApp.i18n'])
});
};
$scope.changeUsername = function () {
$modal.open({
templateUrl: templateUrl('username_edit_modal'),
controller: 'UsernameEditModalController',
windowClass: 'username_edit_modal_window mobile_modal'
});
};
$scope.terminateSessions = function () {
ErrorService.confirm({type: 'TERMINATE_SESSIONS'}).then(function () {
MtpApiManager.invokeApi('auth.resetAuthorizations', {});

4
app/js/lib/config.js

File diff suppressed because one or more lines are too long

2
app/js/lib/mtproto.js

@ -711,7 +711,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils']) @@ -711,7 +711,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
var serializer = new TLSerialization(options);
if (!this.connectionInited) {
serializer.storeInt(0x50858a19, 'invokeWithLayer17');
serializer.storeInt(0x1c900537, 'invokeWithLayer18');
serializer.storeInt(0x69796de9, 'initConnection');
serializer.storeInt(Config.App.id, 'api_id');
serializer.storeString(navigator.userAgent || 'Unknown UserAgent', 'device_model');

36
app/js/lib/schema.tl.txt

@ -70,11 +70,11 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL @@ -70,11 +70,11 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL
fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
userEmpty#200250ba id:int = User;
userSelf#720535ec id:int first_name:string last_name:string phone:string photo:UserProfilePhoto status:UserStatus inactive:Bool = User;
userContact#f2fb8319 id:int first_name:string last_name:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userRequest#22e8ceb0 id:int first_name:string last_name:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userForeign#5214c89d id:int first_name:string last_name:string access_hash:long photo:UserProfilePhoto status:UserStatus = User;
userDeleted#b29ad7cc id:int first_name:string last_name:string = User;
userSelf#7007b451 id:int first_name:string last_name:string username:string phone:string photo:UserProfilePhoto status:UserStatus inactive:Bool = User;
userContact#cab35e18 id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userRequest#d9ccc4ef id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userForeign#75cf7a8 id:int first_name:string last_name:string username:string access_hash:long photo:UserProfilePhoto status:UserStatus = User;
userDeleted#d6016d7a id:int first_name:string last_name:string username:string = User;
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto;
@ -166,8 +166,6 @@ importedContact#d0028438 user_id:int client_id:long = ImportedContact; @@ -166,8 +166,6 @@ importedContact#d0028438 user_id:int client_id:long = ImportedContact;
contactBlocked#561bc879 user_id:int date:int = ContactBlocked;
contactFound#ea879f95 user_id:int = ContactFound;
contactSuggested#3de191a1 user_id:int mutual_contacts:int = ContactSuggested;
contactStatus#aa77b873 user_id:int expires:int = ContactStatus;
@ -192,8 +190,6 @@ contacts.importedContacts#ad524315 imported:Vector<ImportedContact> retry_contac @@ -192,8 +190,6 @@ contacts.importedContacts#ad524315 imported:Vector<ImportedContact> retry_contac
contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
contacts.found#566000e results:Vector<ContactFound> users:Vector<User> = contacts.Found;
contacts.suggested#5649dcc5 results:Vector<ContactSuggested> users:Vector<User> = contacts.Suggested;
messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
@ -235,7 +231,7 @@ updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; @@ -235,7 +231,7 @@ updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update;
updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update;
updateChatParticipants#7761198 participants:ChatParticipants = Update;
updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update;
updateUserName#da22d9ad user_id:int first_name:string last_name:string = Update;
updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update;
updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update;
updateContactRegistered#2575bbb9 user_id:int date:int = Update;
updateContactLink#51a48a9a user_id:int my_link:contacts.MyLink foreign_link:contacts.ForeignLink = Update;
@ -389,11 +385,17 @@ sendMessageUploadDocumentAction#8faee98e = SendMessageAction; @@ -389,11 +385,17 @@ sendMessageUploadDocumentAction#8faee98e = SendMessageAction;
sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
sendMessageChooseContactAction#628cbc6f = SendMessageAction;
contactFound#ea879f95 user_id:int = ContactFound;
contacts.found#566000e results:Vector<ContactFound> users:Vector<User> = contacts.Found;
updateServiceNotification#382dd3e4 type:string message:string media:MessageMedia popup:Bool = Update;
---functions---
invokeAfterMsg#cb9f372d msg_id:long query:!X = X;
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
invokeAfterMsgs#3dc4b4f0 msg_ids:Vector<long> query:!X = X;
invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;
auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone;
auth.sendCode#768d5f4d phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode;
@ -422,7 +424,6 @@ users.getFullUser#ca30a5b1 id:InputUser = UserFull; @@ -422,7 +424,6 @@ users.getFullUser#ca30a5b1 id:InputUser = UserFull;
contacts.getStatuses#c4a353ee = Vector<ContactStatus>;
contacts.getContacts#22c6aa08 hash:string = contacts.Contacts;
contacts.importContacts#da30b32d contacts:Vector<InputContact> replace:Bool = contacts.ImportedContacts;
contacts.search#11f812d8 q:string limit:int = contacts.Found;
contacts.getSuggested#cd773428 limit:int = contacts.Suggested;
contacts.deleteContact#8e953744 id:InputUser = contacts.Link;
contacts.deleteContacts#59ab389e id:Vector<InputUser> = Bool;
@ -499,7 +500,7 @@ messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>; @@ -499,7 +500,7 @@ messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>;
upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;
initConnection#69796de9 api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X;
initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X;
help.getSupport#9cdf08cd = help.Support;
@ -507,4 +508,9 @@ auth.sendSms#da9f3e8 phone_number:string phone_code_hash:string = Bool; @@ -507,4 +508,9 @@ auth.sendSms#da9f3e8 phone_number:string phone_code_hash:string = Bool;
messages.readMessageContents#354b5bc2 id:Vector<int> = Vector<int>;
invokeWithLayer17#50858a19 query:!X = X;
account.checkUsername#2714d86c username:string = Bool;
account.updateUsername#3e0bdd7c username:string = User;
contacts.search#11f812d8 q:string limit:int = contacts.Found;
invokeWithLayer18#1c900537 {X:Type} query:!X = X;

12
app/js/locales/en-us.json

@ -30,6 +30,8 @@ @@ -30,6 +30,8 @@
"settings_modal_set_photo": "Set profile photo",
"settings_modal_photo_updating": "Updating",
"settings_modal_edit_profile": "Edit profile",
"settings_modal_edit_username": "Change username",
"settings_modal_empty_username_set": "Set username",
"settings_modal_terminate_sessions": "Terminate all sessions",
"settings_modal_settings": "Settings",
"settings_modal_notification_alert": "Notification alerts",
@ -41,7 +43,6 @@ @@ -41,7 +43,6 @@
"settings_modal_enter_send_description_md": "**Enter** - send message, **Shift + Enter** - new line",
"settings_modal_ctrl_enter_send_description_md": "**Ctrl + Enter** - send message, **Enter** - new line",
"settings_modal_send_on_enter": "Send on Enter",
"settings_modal_phone": "Phone",
"settings_modal_about": "About",
"settings_modal_source_code_github": "Source code on GitHub",
"settings_modal_follow_us_twitter": "Follow us on Twitter!",
@ -55,6 +56,13 @@ @@ -55,6 +56,13 @@
"profile_edit_submit": "Save",
"profile_edit_submit_active": "Saving...",
"username_edit_modal_title": "Change username",
"username_edit_placeholder": "Username",
"username_edit_description_md": "Set username to ...",
"username_edit_submit": "Save",
"username_edit_submit_active": "Saving...",
"user_modal_menu_more": "More",
"user_modal_send_message": "Send message",
"user_modal_edit_contact": "Edit contact",
@ -62,7 +70,9 @@ @@ -62,7 +70,9 @@
"user_modal_add_contact": "Add to contacts",
"user_modal_share_contact": "Share contact",
"user_modal_delete_chat": "Delete chat",
"user_modal_info": "Info",
"user_modal_phone": "Phone",
"user_modal_username": "Username",
"user_modal_settings": "Settings",
"user_modal_notifications": "Notifications",
"user_modal_contact_info": "Contact info",

25
app/partials/desktop/settings_modal.html

@ -41,6 +41,9 @@ @@ -41,6 +41,9 @@
<li>
<a ng-click="editProfile()" my-i18n="settings_modal_edit_profile"></a>
</li>
<li>
<a ng-click="changeUsername()" my-i18n="settings_modal_edit_username"></a>
</li>
<li>
<a ng-click="terminateSessions()" my-i18n="settings_modal_terminate_sessions"></a>
</li>
@ -52,10 +55,22 @@ @@ -52,10 +55,22 @@
</div>
<div class="modal_section" ng-if="profile.phone">
<h3 class="modal_section_header" my-i18n="settings_modal_phone"></h3>
<div class="modal_section">
<h3 class="modal_section_header" my-i18n="user_modal_info"></h3>
<div class="modal_section_body">
<p><span ng-bind="profile.phone | phoneNumber"></span></p>
<dl ng-if="profile.phone">
<dt><my-i18n msgid="user_modal_phone"></my-i18n>:</dt>
<dd ng-bind="profile.phone | phoneNumber"></dd>
</dl>
<dl>
<dt><my-i18n msgid="user_modal_username"></my-i18n>:</dt>
<dd ng-switch="profile.username.length > 0">
<a class="settings_modal_username_link" ng-switch-when="true" href="" ng-click="changeUsername()" ng-bind="'@' + profile.username"></a>
<a ng-switch-default href="" ng-click="changeUsername()" my-i18n="settings_modal_empty_username_set"></a>
</dd>
</dl>
</div>
</div>
@ -64,10 +79,6 @@ @@ -64,10 +79,6 @@
<div class="modal_section_body">
<div class="tg_form_group">
<!--label my-i18n="settings_modal_language"></label>
<select class="tg_select" ng-model="i18n.locale">
<option value="{{lang}}" ng-selected="lang == i18n.locale" ng-repeat="(lang, name) in i18n.supported" ng-bind="name"></option>
</select-->
<a class="tg_checkbox" ng-click="toggleDesktop()" ng-class="notify.desktop ? 'tg_checkbox_on' : ''">
<span class="icon icon-checkbox-outer"><i class="icon-checkbox-inner"></i></span>

15
app/partials/desktop/user_modal.html

@ -50,10 +50,19 @@ @@ -50,10 +50,19 @@
</div>
<div class="modal_section" ng-if="user.phone">
<h3 class="modal_section_header" my-i18n="user_modal_phone"></h3>
<div class="modal_section" ng-if="user.phone || user.username">
<h3 class="modal_section_header" my-i18n="user_modal_info"></h3>
<div class="modal_section_body">
<p><span ng-bind="user.phone | phoneNumber"></span></p>
<dl ng-if="user.phone">
<dt><my-i18n msgid="user_modal_phone"></my-i18n>:</dt>
<dd ng-bind="user.phone | phoneNumber"></dd>
</dl>
<dl ng-if="user.username">
<dt><my-i18n msgid="user_modal_username"></my-i18n>:</dt>
<dd ng-bind="'@' + user.username"></dd>
</dl>
</div>
</div>

31
app/partials/desktop/username_edit_modal.html

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
<div class="username_edit_modal_wrap" my-modal-position>
<a class="modal-close-button" ng-click="$dismiss()"><i></i></a>
<div class="modal-body">
<form class="modal_simple_form" ng-submit="updateUsername()">
<h4 my-i18n="username_edit_modal_title"></h4>
<div class="form-group import_modal_field_wrap" ng-class="{'has-error': error.field == 'username', 'has-feedback': error.field == 'username', 'has-success': error.field == 'username'}">
<label class="control-label" ng-bind="error.feedback"></label>
<input class="form-control input-sm" my-focused type="text" placeholder="{{'username_edit_placeholder' | i18n}}" ng-model="profile.username" name="username"/>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
<div class="form-group import_modal_field_wrap" ng-class="{'has-error': error.field == 'username'}">
</div>
<div class="modal_simple_form_description" my-i18n="username_edit_description_md"></div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-link" ng-click="$dismiss()" my-i18n="modal_cancel"></a>
<button class="btn btn-primary" ng-class="{disabled: profile.updating}" ng-click="updateUsername()" ng-bind="profile.updating ? 'username_edit_submit_active' : 'username_edit_submit' | i18n" ng-disabled="profile.updating"></button>
</div>
</div>
Loading…
Cancel
Save