Skip to content

Commit

Permalink
Merge pull request #1928 from uProxy/dborkan-notification
Browse files Browse the repository at this point in the history
Notify existing users that Google and Facebook social networks have changed
  • Loading branch information
dborkan committed Sep 28, 2015
2 parents 997e10a + b917398 commit 581cbed
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/generic_core/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export var settings :uproxy_core_api.GlobalSettings = {
statsReportingEnabled: false,
consoleFilter: loggingTypes.Level.warn,
language: 'en',
force_message_version: 0 // zero means "don't override"
force_message_version: 0, // zero means "don't override"
// TODO: remove this in November 2015, to allow 1 month for existing users to
// see the notification that Google+Facebook social providers have changed.
hasSeenGoogleAndFacebookChangedNotification: false
};

export var natType :string = '';
Expand Down
10 changes: 9 additions & 1 deletion src/generic_core/uproxy_core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ export class uProxyCore implements uproxy_core_api.CoreApi {
var logins :Promise<void>[] = [];

for (var i in networks) {
var networkName = networks[i]
if (!(networkName in social_network.networks)) {
// Network may have been removed, e.g. old "Facebook" network is now
// "Facebook-Firebase-V2".
continue;
}
logins.push(this.login({
network: networks[i],
network: networkName,
reconnect: true,
}).catch(() => {
// any failure to login should just be ignored - the user will either
Expand Down Expand Up @@ -226,6 +232,8 @@ export class uProxyCore implements uproxy_core_api.CoreApi {
globals.settings.consoleFilter);
globals.settings.language = newSettings.language;
globals.settings.force_message_version = newSettings.force_message_version;
globals.settings.hasSeenGoogleAndFacebookChangedNotification =
newSettings.hasSeenGoogleAndFacebookChangedNotification;
}

public getFullState = () :Promise<uproxy_core_api.InitialState> => {
Expand Down
4 changes: 4 additions & 0 deletions src/generic_ui/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -818,5 +818,9 @@
"INVITE_EMAIL_BODY": {
"description": "Default email body for sending an uProxy invite",
"message": "__name__ has invited you to connect with him on uProxy. To do so, click on the invitation link below or paste it into uProxy.<br><br>__url__<br><br>If you don’t have uProxy installed, you can get it from <a href='uproxy.org'>uproxy.org</a> or directly from the Chrome webstore (<a href='https://chrome.google.com/webstore/detail/uproxy-part-1-of-2/pjpcdnccaekokkkeheolmpkfifcbibnj'>part 1</a> and <a href='https://chrome.google.com/webstore/detail/uproxy-part-2-of-2/fmdppkkepalnkeommjadgbhiohihdhii'>part 2</a>) and Firefox Marketplace (<a href='https://addons.mozilla.org/en-US/firefox/addon/uproxy-firefox/'>here</a>)."
},
"GOOGLE_AND_FACEBOOK_CHANGED_NOTIFICATION": {
"description": "",
"message": "<h2>We've made big changes to how uProxy works with social networks!</h2><ul><li><strong>We've introduced a new Gmail network</strong> that allows you to connect with anyone who has a Gmail account. Use the the button in the lower right of the buddy list to send them an invitation.</li><li><strong>The \"Google\" network is now called Google Hangouts.</strong> Because Google is removing technology we rely on, our support for this network will be removed.</li><li><strong>Facebook contacts are now added by invitation.</strong> You can invite friends using the button at the lower right of the contact list, and only friends you've invited will be able to tell you're using uProxy. To make this change, we've had to reset your friend list, so you'll have to invite friends you want to connect to.</li></ul><p>Please send feedback about these changes using the feedback link in the menu or by emailing info@uProxy.org</p>"
}
}
19 changes: 19 additions & 0 deletions src/generic_ui/polymer/root.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@
width: 56px;
padding: 15px;
}
#googleAndFacebookChangedOverlay {
background-color: white;
height: 100%;
width: 100%;
padding: 2em;
line-height: 20px;
}
#googleAndFacebookChangedOverlay ul li {
margin-top: 1em;
}
</style>

<core-signals on-core-signal-close-settings="{{ closeSettings }}"></core-signals>
Expand All @@ -277,6 +287,15 @@
<uproxy-splash id='splash' hidden?='{{ui_constants.View.SPLASH!=ui.view}}'>
</uproxy-splash>

<core-overlay id='googleAndFacebookChangedOverlay' opened='{{ model.globalSettings.hasSeenWelcome && !model.globalSettings.hasSeenGoogleAndFacebookChangedNotification }}' on-core-overlay-open='{{ googleAndFacebookChangedNotificationOpened }}'>
<div id='googleAndFacebookChangedNotificationContent'>
<!-- content is set using .innerHTML so that we can embed HTML in translations -->
</div>
<div style="text-align:center;">
<uproxy-button on-tap='{{ dismissGoogleAndFacebookChangedNotification }}'>{{ "OK" | $$ }}</uproxy-button>
</div>
</core-overlay>

<core-drawer-panel id='mainPanel' forceNarrow='true' drawerWidth='300px'
hidden?='{{ ui.view !== ui_constants.View.ROSTER }}' rightDrawer='{{ dir == "rtl" ? true : false }}'>
<core-header-panel drawer>
Expand Down
11 changes: 11 additions & 0 deletions src/generic_ui/polymer/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Polymer({
ui.setMode(ui_types.Mode.SHARE);
},
closedWelcome: function() {
// New users (who have just completed the welcome screen) will not need
// to see the Google and Facebook changed notification.
model.globalSettings.hasSeenGoogleAndFacebookChangedNotification = true;
model.globalSettings.hasSeenWelcome = true;
core.updateGlobalSettings(model.globalSettings);
},
Expand All @@ -78,6 +81,14 @@ Polymer({
dismissCopyPasteError: function() {
ui.copyPasteError = ui_types.CopyPasteError.NONE;
},
googleAndFacebookChangedNotificationOpened: function() {
this.$.googleAndFacebookChangedNotificationContent.innerHTML =
ui.i18n_t("GOOGLE_AND_FACEBOOK_CHANGED_NOTIFICATION");
},
dismissGoogleAndFacebookChangedNotification: function() {
model.globalSettings.hasSeenGoogleAndFacebookChangedNotification = true;
core.updateGlobalSettings(model.globalSettings);
},
openDialog: function(e :Event, detail :dialog_description) {
/* 'detail' parameter holds the data that was passed when the open-dialog
* signal was fired. It should be of the form:
Expand Down
3 changes: 2 additions & 1 deletion src/generic_ui/scripts/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export class Model {
statsReportingEnabled: false,
consoleFilter: 2, // loggingTypes.Level.warn
language: 'en',
force_message_version: 0
force_message_version: 0,
hasSeenGoogleAndFacebookChangedNotification: false
};

public reconnecting = false;
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/uproxy_core_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface GlobalSettings {
consoleFilter :loggingTypes.Level;
language :string;
force_message_version :number;
hasSeenGoogleAndFacebookChangedNotification :boolean;
}
export interface InitialState {
networkNames :string[];
Expand Down

0 comments on commit 581cbed

Please sign in to comment.