@ -9,6 +9,7 @@
initialize : function ( options ) {
initialize : function ( options ) {
this . name = options . name ;
this . name = options . name ;
this . defaultValue = options . defaultValue ;
this . defaultValue = options . defaultValue ;
this . event = options . event ;
this . populate ( ) ;
this . populate ( ) ;
} ,
} ,
events : {
events : {
@ -18,6 +19,9 @@
var value = e . target . checked ;
var value = e . target . checked ;
storage . put ( this . name , value ) ;
storage . put ( this . name , value ) ;
console . log ( this . name , 'changed to' , value ) ;
console . log ( this . name , 'changed to' , value ) ;
if ( this . event ) {
this . $el . trigger ( this . event ) ;
}
} ,
} ,
populate : function ( ) {
populate : function ( ) {
var value = storage . get ( this . name , this . defaultValue ) ;
var value = storage . get ( this . name , this . defaultValue ) ;
@ -28,6 +32,7 @@
initialize : function ( options ) {
initialize : function ( options ) {
this . name = options . name ;
this . name = options . name ;
this . defaultValue = options . defaultValue ;
this . defaultValue = options . defaultValue ;
this . event = options . event ;
this . populate ( ) ;
this . populate ( ) ;
} ,
} ,
events : {
events : {
@ -37,7 +42,9 @@
var value = this . $ ( e . target ) . val ( ) ;
var value = this . $ ( e . target ) . val ( ) ;
storage . put ( this . name , value ) ;
storage . put ( this . name , value ) ;
console . log ( this . name , 'changed to' , value ) ;
console . log ( this . name , 'changed to' , value ) ;
this . $el . trigger ( 'change-theme' ) ;
if ( this . event ) {
this . $el . trigger ( this . event ) ;
}
} ,
} ,
populate : function ( ) {
populate : function ( ) {
var value = storage . get ( this . name , this . defaultValue ) ;
var value = storage . get ( this . name , this . defaultValue ) ;
@ -57,13 +64,20 @@
new RadioButtonGroupView ( {
new RadioButtonGroupView ( {
el : this . $ ( '.theme-settings' ) ,
el : this . $ ( '.theme-settings' ) ,
defaultValue : 'android' ,
defaultValue : 'android' ,
name : 'theme-setting'
name : 'theme-setting' ,
event : 'change-theme'
} ) ;
} ) ;
new CheckboxView ( {
new CheckboxView ( {
el : this . $ ( '.audio-notification-setting' ) ,
el : this . $ ( '.audio-notification-setting' ) ,
defaultValue : false ,
defaultValue : false ,
name : 'audio-notification'
name : 'audio-notification'
} ) ;
} ) ;
new CheckboxView ( {
el : this . $ ( '.menu-bar-setting' ) ,
defaultValue : false ,
name : 'hide-menu-bar' ,
event : 'change-hide-menu'
} ) ;
if ( textsecure . storage . user . getDeviceId ( ) != '1' ) {
if ( textsecure . storage . user . getDeviceId ( ) != '1' ) {
var syncView = new SyncView ( ) . render ( ) ;
var syncView = new SyncView ( ) . render ( ) ;
this . $ ( '.content' ) . append ( syncView . el ) ;
this . $ ( '.content' ) . append ( syncView . el ) ;
@ -84,6 +98,7 @@
nameOnly : i18n ( 'nameOnly' ) ,
nameOnly : i18n ( 'nameOnly' ) ,
audioNotificationDescription : i18n ( 'audioNotificationDescription' ) ,
audioNotificationDescription : i18n ( 'audioNotificationDescription' ) ,
themeAndroidDark : i18n ( 'themeAndroidDark' ) ,
themeAndroidDark : i18n ( 'themeAndroidDark' ) ,
hideMenuBar : i18n ( 'hideMenuBar' ) ,
} ;
} ;
}
}
} ) ;
} ) ;