Repository: syncthing/syncthing
File: gui/default/syncthing/core/syncthingController.js (JavaScript)

Code before:
            }
            return alert(failure);
        };

        $scope.shareDeviceId = function(method) {
            // Title and footer can be reused between email, SMS, and possibly
            // other methods, hence we define them separately in the beginning.
            var title = $translate.instant("{%name%} has shared their Syncthing device ID!", {name: $scope.currentDevice.name});
            var footer = $translate.instant("Learn more at {%address%}.", {address: "https://syncthing.net"});

            switch (method) {
                case 'email':
                    var subject = title;
                    var body = $translate.instant("You have been invited to connect with {%name%} using Syncthing!\r\n\r\nTo accept the invitation, add a new device using the ID below.", {name: $scope.currentDevice.name});
                    body += '\r\n\r\n';
                    body += $scope.currentDevice.deviceID;
                    body += '\r\n\r\n';
                    body += $translate.instant("Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it's transmitted over the internet.");
                    body += '\r\n\r\n';
                    body += footer;
                    try {
                        location.href = 'mailto:?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(body);
                        success = true;
                    }
                    catch (ex) {
                        var error = $translate.instant("No email client found. Do you want to copy the email text to clipboard instead?");
                        if (confirm(error)) {
                              $scope.copyToClipboard(onclick, body);
                        }
                    }
                    break;
                case 'sms':
                    // SMS is limited to 160 characters (non-Unicode), so we keep
                    // it as short as possible, e.g. by stripping hyphens from
                    // device ID. The current minimum length is around 150 chars,
                    // but some room is required for longer sharing device names.
                    var body = title;
                    body += '\r\n\r\n';
                    body += $scope.currentDevice.deviceID.replace(/-/g, '');
                    body += '\r\n\r\n';
                    body += footer;
                    try {
                        location.href = 'sms://;?&body=' + encodeURIComponent(body);
                        success = true;
                    }
                    catch (ex) {
                        var error = $translate.instant("No SMS client found. Do you want to copy the SMS text to clipboard instead?");
                        if (confirm(error)) {
                              $scope.copyToClipboard(onclick, body);
                        }
                    }

Review comment (suggestion):
This message always appears for me (on Firefox), right before the mail client shows up.  Same with the SMS error message, where the desktop browser is still asking for an application to handle sms:// links.

Code after:
        $scope.themeName = function (theme) {
            var translation = $translate.instant("theme-name-" + theme);
            if (translation.indexOf("theme-name-") == 0) {
                // Fall back to simple Title Casing on missing translation
                translation = theme.toLowerCase().replace(/(?:^|\s)\S/g, function (a) {
                    return a.toUpperCase();
                });
            }
            return translation;
        };

        $scope.modalLoaded = function () {
            // once all modal elements have been processed
            if ($('modal').length === 0) {
                // pseudo main. called on all definitions assigned
                initController();
            }
        };

        $scope.toggleUnits = function () {
            $scope.metricRates = !$scope.metricRates;
            try {
                window.localStorage["metricRates"] = $scope.metricRates;
            } catch (exception) { }
        };

        $scope.sizeOf = function (dict) {
            if (dict === undefined) {
                return 0;
            }
            return Object.keys(dict).length;
        };

        $scope.has = function (array, element) {
            return array.indexOf(element) >= 0;
        };

        $scope.dismissNotification = function (id) {
            var idx = $scope.config.options.unackedNotificationIDs.indexOf(id);
            if (idx > -1) {
                $scope.config.options.unackedNotificationIDs.splice(idx, 1);
                $scope.saveConfig();
            }
        };

        $scope.abbreviatedError = function (addr) {
            var status = $scope.system.lastDialStatus[addr];
            if (!status || !status.error) {
                return null;
            }
            var time = $filter('date')(status.when, "HH:mm:ss")