diff --git a/api/geth_backend.go b/api/geth_backend.go index 6123597a8..58dc1b3ed 100644 --- a/api/geth_backend.go +++ b/api/geth_backend.go @@ -704,6 +704,16 @@ func (b *GethStatusBackend) saveAccountsAndSettings(settings settings.Settings, if err != nil { return err } + + // In case of setting up new account either way (creating new, importing seed phrase, keycard account...) we should not + // back up any data after login, as it was the case before, that's the reason why we're setting last backup time to the time + // when an account was created. + now := time.Now().Unix() + err = accdb.SetLastBackup(uint64(now)) + if err != nil { + return err + } + return accdb.SaveAccounts(subaccs) } diff --git a/appdatabase/migrations/bindata.go b/appdatabase/migrations/bindata.go index 2e9555fa9..e264716fe 100644 --- a/appdatabase/migrations/bindata.go +++ b/appdatabase/migrations/bindata.go @@ -38,6 +38,7 @@ // 1664392661_add_third_party_id_to_waku_messages.up.sql (70B) // 1664783660_add_sync_info_to_saved_addresses.up.sql (388B) // 1668109917_wakunodes.up.sql (99B) +// 1670249678_display_name_to_settings_sync_clock_table.up.sql (83B) // 1670836810_add_imported_flag_to_community_archive_hashes.up.sql (144B) // 1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql (86B) // doc.go (74B) @@ -124,7 +125,7 @@ func _1640111208_dummyUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xf0, 0xae, 0x20, 0x6e, 0x75, 0xd1, 0x36, 0x14, 0xf2, 0x40, 0xe5, 0xd6, 0x7a, 0xc4, 0xa5, 0x72, 0xaa, 0xb5, 0x4d, 0x71, 0x97, 0xb8, 0xe8, 0x95, 0x22, 0x95, 0xa2, 0xac, 0xaf, 0x48, 0x58}} return a, nil } @@ -144,7 +145,7 @@ func _1642666031_add_removed_clock_to_bookmarksUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x4e, 0x38, 0x99, 0x7a, 0xc, 0x90, 0x13, 0xec, 0xfe, 0x2f, 0x55, 0xff, 0xb7, 0xb6, 0xaa, 0x96, 0xc6, 0x92, 0x79, 0xcc, 0xee, 0x4e, 0x99, 0x53, 0xfe, 0x1c, 0xbb, 0x32, 0x2, 0xa4, 0x27}} return a, nil } @@ -164,7 +165,7 @@ func _1643644541_gif_api_key_settingUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1b, 0x94, 0x28, 0xfb, 0x66, 0xd1, 0x7c, 0xb8, 0x89, 0xe2, 0xb4, 0x71, 0x65, 0x24, 0x57, 0x22, 0x95, 0x38, 0x97, 0x3, 0x9b, 0xc6, 0xa4, 0x41, 0x7b, 0xba, 0xf7, 0xdb, 0x70, 0xf7, 0x20, 0x3a}} return a, nil } @@ -184,7 +185,7 @@ func _1644188994_recent_stickersUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1e, 0xad, 0xaa, 0x30, 0xbf, 0x4, 0x7, 0xf8, 0xc3, 0x3, 0xb8, 0x97, 0x23, 0x2b, 0xbd, 0x1c, 0x60, 0x69, 0xb0, 0x42, 0x5e, 0x6b, 0xd, 0xa7, 0xa3, 0x6b, 0x2e, 0xdc, 0x70, 0x13, 0x72, 0x7}} return a, nil } @@ -204,7 +205,7 @@ func _1646659233_add_address_to_dapp_permisssionUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0xb0, 0x35, 0xcc, 0x2e, 0x16, 0xe6, 0x15, 0x86, 0x2c, 0x37, 0x80, 0xae, 0xa3, 0xc5, 0x31, 0x78, 0x5, 0x9d, 0xcd, 0x7b, 0xeb, 0x5f, 0xf2, 0xb3, 0x74, 0x72, 0xdf, 0xcf, 0x88, 0xb, 0x40}} return a, nil } @@ -224,7 +225,7 @@ func _1646841105_add_emoji_accountUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe6, 0x77, 0x29, 0x95, 0x18, 0x64, 0x82, 0x63, 0xe7, 0xaf, 0x6c, 0xa9, 0x15, 0x7d, 0x46, 0xa6, 0xbc, 0xdf, 0xa7, 0xd, 0x2b, 0xd2, 0x2d, 0x97, 0x4d, 0xa, 0x6b, 0xd, 0x6e, 0x90, 0x42, 0x5c}} return a, nil } @@ -244,7 +245,7 @@ func _1647278782_display_nameUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xa1, 0x1f, 0x3e, 0x61, 0x65, 0x8d, 0xff, 0xee, 0xde, 0xc5, 0x91, 0xd9, 0x5c, 0xb5, 0xe2, 0xf0, 0xb7, 0xe7, 0x5c, 0x5c, 0x16, 0x25, 0x89, 0xee, 0x78, 0x12, 0xea, 0x3e, 0x48, 0x41, 0xa6}} return a, nil } @@ -264,7 +265,7 @@ func _1647862838_reset_last_backupUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x21, 0xe3, 0xd5, 0xf6, 0x5f, 0xfe, 0x65, 0xfa, 0x1d, 0x88, 0xf8, 0x5f, 0x24, 0x71, 0x34, 0x68, 0x96, 0x2a, 0x60, 0x87, 0x15, 0x82, 0x4d, 0x8a, 0x59, 0x3d, 0x1f, 0xd8, 0x56, 0xd4, 0xfb, 0xda}} return a, nil } @@ -284,7 +285,7 @@ func _1647871652_add_settings_sync_clock_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd8, 0x58, 0xec, 0x85, 0x90, 0xfa, 0x30, 0x98, 0x98, 0x9a, 0xa6, 0xa8, 0x96, 0x2b, 0x38, 0x93, 0xf3, 0xae, 0x46, 0x74, 0xa4, 0x41, 0x62, 0x9b, 0x2, 0x86, 0xbf, 0xe5, 0x2a, 0xce, 0xe2, 0xc0}} return a, nil } @@ -304,7 +305,7 @@ func _1647880168_add_torrent_configUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1, 0x92, 0x22, 0x37, 0x96, 0xf3, 0xb5, 0x5b, 0x27, 0xd0, 0x7d, 0x43, 0x5, 0x4e, 0x9d, 0xe2, 0x49, 0xbe, 0x86, 0x31, 0xa1, 0x89, 0xff, 0xd6, 0x51, 0xe0, 0x9c, 0xb, 0xda, 0xfc, 0xf2, 0x93}} return a, nil } @@ -324,7 +325,7 @@ func _1647882837_add_communities_settings_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbd, 0x87, 0x78, 0x99, 0xd9, 0x5d, 0xbd, 0xf7, 0x57, 0x9c, 0xca, 0x97, 0xbd, 0xb3, 0xe9, 0xb5, 0x89, 0x31, 0x3f, 0xf6, 0x5c, 0x13, 0xb, 0xc3, 0x54, 0x93, 0x18, 0x40, 0x7, 0x82, 0xfe, 0x7e}} return a, nil } @@ -344,7 +345,7 @@ func _1647956635_add_waku_messages_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0xe, 0xe1, 0xdc, 0xda, 0x2e, 0x89, 0x8d, 0xdc, 0x2a, 0x1c, 0x13, 0xa1, 0xfc, 0xfe, 0xf, 0xb2, 0xb9, 0x85, 0xc8, 0x45, 0xd6, 0xd1, 0x7, 0x5c, 0xa3, 0x8, 0x47, 0x44, 0x6d, 0x96, 0xe0}} return a, nil } @@ -364,7 +365,7 @@ func _1648554928_network_testUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9a, 0xc5, 0x7f, 0x87, 0xf3, 0x2c, 0xf7, 0xbb, 0xd3, 0x3a, 0x4e, 0x76, 0x88, 0xca, 0xaf, 0x73, 0xce, 0x8f, 0xa1, 0xf6, 0x3d, 0x4d, 0xed, 0x6f, 0x49, 0xf2, 0xfe, 0x56, 0x2a, 0x60, 0x68, 0xca}} return a, nil } @@ -384,7 +385,7 @@ func _1649174829_add_visitble_tokenUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa3, 0x22, 0xc0, 0x2b, 0x3f, 0x4f, 0x3d, 0x5e, 0x4c, 0x68, 0x7c, 0xd0, 0x15, 0x36, 0x9f, 0xec, 0xa1, 0x2a, 0x7b, 0xb4, 0xe3, 0xc6, 0xc9, 0xb4, 0x81, 0x50, 0x4a, 0x11, 0x3b, 0x35, 0x7, 0xcf}} return a, nil } @@ -404,7 +405,7 @@ func _1649882262_add_derived_from_accountsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0xb9, 0x44, 0x4d, 0x85, 0x8d, 0x7f, 0xb4, 0xae, 0x4f, 0x5c, 0x66, 0x64, 0xb6, 0xe2, 0xe, 0x3d, 0xad, 0x9d, 0x8, 0x4f, 0xab, 0x6e, 0xa8, 0x7d, 0x76, 0x3, 0xad, 0x96, 0x1, 0xee, 0x5c}} return a, nil } @@ -424,7 +425,7 @@ func _1650612625_add_community_message_archive_hashes_tableUpSql() (*asset, erro return nil, err } - info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x48, 0x31, 0xb3, 0x75, 0x23, 0xe2, 0x45, 0xe, 0x47, 0x1b, 0x35, 0xa5, 0x6e, 0x83, 0x4e, 0x64, 0x7d, 0xd7, 0xa2, 0xda, 0xe9, 0x53, 0xf1, 0x16, 0x86, 0x2c, 0x57, 0xad, 0xfa, 0xca, 0x39, 0xde}} return a, nil } @@ -444,7 +445,7 @@ func _1650616788_add_communities_archives_info_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0x4f, 0x80, 0x45, 0xb9, 0xd9, 0x15, 0xe2, 0x78, 0xd0, 0xcb, 0x71, 0xc1, 0x1b, 0xb7, 0x1b, 0x1b, 0x97, 0xfe, 0x47, 0x53, 0x3c, 0x62, 0xbc, 0xdd, 0x3a, 0x94, 0x1a, 0xc, 0x48, 0x76, 0xe}} return a, nil } @@ -464,7 +465,7 @@ func _1652715604_add_clock_accountsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb6, 0xd9, 0x8d, 0x73, 0xc9, 0xef, 0xfa, 0xb1, 0x4b, 0xa5, 0xf3, 0x5, 0x19, 0x26, 0x46, 0xf8, 0x47, 0x93, 0xdb, 0xac, 0x2, 0xef, 0xf9, 0x71, 0x56, 0x83, 0xe6, 0x2d, 0xb0, 0xd7, 0x83, 0x5c}} return a, nil } @@ -484,7 +485,7 @@ func _1653037334_add_notifications_settings_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4b, 0xc4, 0x65, 0xac, 0xa, 0xf2, 0xef, 0xb6, 0x39, 0x3c, 0xc5, 0xb1, 0xb2, 0x9c, 0x86, 0x58, 0xe0, 0x38, 0xcb, 0x57, 0x3c, 0x76, 0x73, 0x87, 0x79, 0x4e, 0xf6, 0xed, 0xb0, 0x8e, 0x9e, 0xa}} return a, nil } @@ -504,7 +505,7 @@ func _1654702119_add_mutual_contact_settingsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x26, 0x66, 0x67, 0x50, 0xfe, 0xd7, 0xe3, 0x29, 0x8b, 0xff, 0x9d, 0x5a, 0x87, 0xa7, 0x99, 0x6e, 0xd6, 0xcd, 0x2e, 0xbb, 0x17, 0xdf, 0x7f, 0xf7, 0xa3, 0xfa, 0x32, 0x7c, 0x2d, 0x92, 0xc8, 0x74}} return a, nil } @@ -524,7 +525,7 @@ func _1655375270_add_clock_field_to_communities_settings_tableUpSql() (*asset, e return nil, err } - info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x19, 0xc5, 0xc0, 0xf9, 0x84, 0x53, 0xdf, 0x83, 0xcf, 0xb6, 0x40, 0x6d, 0xf5, 0xdc, 0x77, 0x37, 0xb7, 0xe3, 0xa, 0x75, 0xe7, 0x6, 0x11, 0xca, 0x2b, 0x51, 0x92, 0xdd, 0x7d, 0xdb, 0xc3, 0xf5}} return a, nil } @@ -544,7 +545,7 @@ func _1655385721_drop_networks_configUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfc, 0xa7, 0x20, 0xbb, 0x67, 0x21, 0xe, 0xc6, 0xc8, 0x21, 0x74, 0xe0, 0xce, 0xc8, 0xe2, 0x2, 0xb4, 0xea, 0xf0, 0xe5, 0xc4, 0x4d, 0xdd, 0xd4, 0x52, 0x31, 0xa9, 0x3d, 0xcd, 0xd8, 0x9b, 0xab}} return a, nil } @@ -564,7 +565,7 @@ func _1655385724_networks_chaincolor_shortnameUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd9, 0xe7, 0x84, 0xbb, 0x5f, 0xd2, 0x2c, 0x42, 0x88, 0x62, 0x52, 0xb6, 0x58, 0x31, 0xac, 0xc, 0x96, 0x2b, 0x1b, 0xe5, 0x4e, 0x9a, 0x3a, 0xf6, 0xf6, 0xfc, 0xa9, 0x1a, 0x35, 0x62, 0x28, 0x88}} return a, nil } @@ -584,7 +585,7 @@ func _1655456688_add_deleted_at_field_to_bookmarks_tableUpSql() (*asset, error) return nil, err } - info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe7, 0x9a, 0xbd, 0x9a, 0xc9, 0xf, 0xdf, 0x90, 0x0, 0x5d, 0xea, 0x6e, 0x7d, 0x51, 0x95, 0xcd, 0x90, 0xd3, 0x1a, 0x36, 0x6c, 0xf4, 0xbd, 0xa7, 0x6b, 0xbf, 0xe5, 0xdb, 0xa3, 0x88, 0xe3, 0x50}} return a, nil } @@ -604,7 +605,7 @@ func _1655462032_create_bookmarks_deleted_at_indexUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf, 0x8e, 0x20, 0x6b, 0x14, 0x9e, 0xcd, 0x97, 0xd3, 0xfe, 0x62, 0x3, 0x26, 0x59, 0x1, 0x6c, 0x99, 0xef, 0x6d, 0x21, 0xd4, 0xb5, 0xa3, 0xf4, 0x39, 0x40, 0x54, 0x6, 0xd, 0x60, 0x13, 0x38}} return a, nil } @@ -624,7 +625,7 @@ func _1657617291_add_multi_transactions_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x86, 0xb0, 0x4e, 0x8c, 0x4, 0x82, 0xb4, 0x43, 0xaa, 0xd0, 0x16, 0xdd, 0xcb, 0x88, 0x81, 0xac, 0x4, 0x34, 0x1a, 0x8f, 0x2e, 0xc5, 0x69, 0xb, 0xf0, 0x17, 0xf7, 0xe3, 0x9, 0xe, 0x54, 0xe0}} return a, nil } @@ -644,7 +645,7 @@ func _1660134042_add_social_links_settings_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x73, 0xb6, 0xe7, 0x3f, 0xaa, 0x39, 0x9a, 0x56, 0x56, 0x31, 0xf1, 0x8e, 0x26, 0x23, 0x1, 0xe4, 0xfa, 0x98, 0xfe, 0x78, 0x87, 0x20, 0xcb, 0x52, 0xf4, 0x38, 0x7f, 0xc4, 0x1c, 0x4, 0x22}} return a, nil } @@ -664,7 +665,7 @@ func _1660134060_settings_bioUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x25, 0xa0, 0xa6, 0x47, 0xff, 0xbc, 0x2a, 0x0, 0xff, 0x59, 0x4b, 0xb0, 0xc9, 0x4e, 0x15, 0xe4, 0xd9, 0xda, 0xeb, 0xfe, 0x55, 0x98, 0xc3, 0x9d, 0x96, 0xe7, 0xf, 0xd1, 0x5c, 0x93, 0x73}} return a, nil } @@ -684,7 +685,7 @@ func _1660134070_add_wakuv2_storeUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1d, 0xe6, 0xc3, 0x9, 0xef, 0xdc, 0xae, 0x49, 0x30, 0x78, 0x54, 0xd6, 0xdb, 0xbf, 0xc0, 0x8e, 0x25, 0x8f, 0xfc, 0x67, 0x80, 0x39, 0x37, 0xd4, 0x86, 0xc1, 0x85, 0xc8, 0x99, 0xc4, 0x59, 0xd4}} return a, nil } @@ -704,7 +705,7 @@ func _1660134072_waku2_store_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xeb, 0xb4, 0xa0, 0xa1, 0x2b, 0xcb, 0x4c, 0x3c, 0xc6, 0xd0, 0xe8, 0x96, 0xe3, 0x96, 0xf1, 0x4f, 0x1f, 0xe0, 0xe7, 0x1f, 0x85, 0xa3, 0xe, 0xf7, 0x52, 0x56, 0x63, 0x2b, 0xb0, 0x87, 0x7b}} return a, nil } @@ -724,7 +725,7 @@ func _1662365868_add_key_uid_accountsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc6, 0xd8, 0x2f, 0x2f, 0x3b, 0xa8, 0xbd, 0x6d, 0xf6, 0x87, 0x7e, 0xd2, 0xf1, 0xa2, 0xf7, 0x81, 0x6a, 0x23, 0x10, 0xbc, 0xbf, 0x5b, 0xe7, 0x2b, 0x9c, 0xa9, 0x8a, 0x18, 0xbb, 0xd0, 0x86, 0x91}} return a, nil } @@ -744,7 +745,7 @@ func _1662447680_add_keypairs_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdc, 0x25, 0xa9, 0xc7, 0x63, 0x27, 0x97, 0x35, 0x5f, 0x6b, 0xab, 0x26, 0xcb, 0xf9, 0xbd, 0x5e, 0xac, 0x3, 0xa0, 0x5e, 0xb9, 0x71, 0xa3, 0x1f, 0xb3, 0x4f, 0x7f, 0x79, 0x28, 0x48, 0xbe, 0xc}} return a, nil } @@ -764,7 +765,7 @@ func _1662460056_move_favourites_to_saved_addressesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0xa2, 0x8c, 0xa3, 0xec, 0xad, 0xdf, 0xc3, 0x48, 0x5, 0x9b, 0x50, 0x25, 0x59, 0xae, 0x7d, 0xee, 0x58, 0xd2, 0x41, 0x27, 0xf2, 0x22, 0x2e, 0x9a, 0xb9, 0x4a, 0xcc, 0x38, 0x6e, 0x3a, 0xb2}} return a, nil } @@ -784,7 +785,7 @@ func _1662738097_add_base_fee_transactionUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6b, 0xfb, 0x10, 0xae, 0xfc, 0x77, 0x70, 0x98, 0x6f, 0xec, 0xaa, 0xcd, 0x7, 0xc7, 0x74, 0x23, 0xc, 0xd5, 0x1e, 0x82, 0xdd, 0xfe, 0xff, 0x3b, 0xd2, 0x49, 0x10, 0x5b, 0x30, 0xc, 0x2d, 0xb0}} return a, nil } @@ -804,7 +805,7 @@ func _1662972194_add_keypairs_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xab, 0x76, 0xf2, 0x86, 0xe1, 0x7e, 0xe9, 0x47, 0x32, 0x48, 0xd5, 0x6b, 0xe5, 0xd, 0xab, 0xb7, 0xf1, 0xd4, 0xf1, 0xad, 0x38, 0xa6, 0x11, 0xe7, 0xce, 0x5c, 0x11, 0x11, 0xf, 0x47, 0xb2, 0x4}} return a, nil } @@ -824,7 +825,7 @@ func _1664392661_add_third_party_id_to_waku_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfd, 0x67, 0x66, 0x9e, 0x66, 0x74, 0xce, 0x1c, 0xb, 0x1b, 0x9d, 0xd5, 0xfc, 0x65, 0xe, 0x83, 0x90, 0x4c, 0x61, 0x4e, 0x6b, 0xe7, 0x86, 0xbe, 0x36, 0x4f, 0x91, 0x36, 0x4, 0x47, 0x7b, 0x82}} return a, nil } @@ -844,7 +845,7 @@ func _1664783660_add_sync_info_to_saved_addressesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x67, 0x7c, 0x3a, 0x95, 0x4e, 0x55, 0xb2, 0xbd, 0xb4, 0x18, 0x93, 0xc1, 0xcf, 0x9f, 0x12, 0xbb, 0x49, 0x8a, 0x2a, 0x6a, 0x2a, 0x7f, 0xad, 0x44, 0xc3, 0xf, 0x3a, 0x79, 0x18, 0xb9, 0x4c, 0x64}} return a, nil } @@ -864,11 +865,31 @@ func _1668109917_wakunodesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(0664), modTime: time.Unix(1669200987, 0)} + info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x29, 0xaa, 0x9e, 0x2, 0x66, 0x85, 0x69, 0xa8, 0xd9, 0xe2, 0x4b, 0x8d, 0x2a, 0x9c, 0xdf, 0xd2, 0xef, 0x64, 0x58, 0xe3, 0xa6, 0xe7, 0xc1, 0xd1, 0xc8, 0x9c, 0xc0, 0x2c, 0x1, 0xa8, 0x7b, 0x81}} return a, nil } +var __1670249678_display_name_to_settings_sync_clock_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x04\xc0\x41\x0a\x42\x21\x10\x06\xe0\xab\xfc\x47\x68\xdf\x6a\xca\x29\x82\x69\x1e\x3c\xc6\xb5\x88\x49\x48\x66\xc1\xb8\xf1\xf6\xef\x23\x31\xde\x61\x74\x11\x86\xd7\x39\xdb\x78\x7b\xf2\x35\x4a\x2a\xfd\x57\x3e\xa0\x10\x70\xdd\x24\x3e\x15\xaf\xe6\xff\x9e\x57\x1a\xf9\x5b\xf1\x50\xe3\x3b\xef\xd0\xcd\xa0\x51\x04\x81\x6f\x14\xc5\x70\x3a\x1f\x01\x00\x00\xff\xff\x39\x3a\xe6\xb0\x53\x00\x00\x00") + +func _1670249678_display_name_to_settings_sync_clock_tableUpSqlBytes() ([]byte, error) { + return bindataRead( + __1670249678_display_name_to_settings_sync_clock_tableUpSql, + "1670249678_display_name_to_settings_sync_clock_table.up.sql", + ) +} + +func _1670249678_display_name_to_settings_sync_clock_tableUpSql() (*asset, error) { + bytes, err := _1670249678_display_name_to_settings_sync_clock_tableUpSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "1670249678_display_name_to_settings_sync_clock_table.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1671625544, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x39, 0x18, 0xdc, 0xc4, 0x1f, 0x79, 0x22, 0x16, 0x4d, 0xdf, 0x6c, 0x66, 0xd5, 0xa4, 0x88, 0x5d, 0x5, 0x37, 0xa7, 0x41, 0x5, 0x50, 0xae, 0x12, 0xfa, 0x7e, 0x89, 0x24, 0x5c, 0xae, 0x30, 0xfc}} + return a, nil +} + var __1670836810_add_imported_flag_to_community_archive_hashesUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x48\xce\xcf\xcd\x2d\xcd\xcb\x2c\xa9\x8c\xcf\x4d\x2d\x2e\x4e\x4c\x4f\x8d\x4f\x2c\x4a\xce\xc8\x2c\x4b\x8d\xcf\x48\x2c\xce\x48\x2d\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\xc8\xcc\x2d\xc8\x2f\x2a\x49\x4d\x51\x70\xf2\xf7\xf7\x51\x70\x71\x75\x73\x0c\xf5\x09\x51\x70\x73\xf4\x09\x76\xb5\xe6\x0a\x0d\x70\x71\x0c\x21\xc2\xbc\x60\xd7\x10\x84\x41\xb6\x0a\x06\xd6\x5c\x5c\x80\x00\x00\x00\xff\xff\xf5\xc9\x5a\x6d\x90\x00\x00\x00") func _1670836810_add_imported_flag_to_community_archive_hashesUpSqlBytes() ([]byte, error) { @@ -884,7 +905,7 @@ func _1670836810_add_imported_flag_to_community_archive_hashesUpSql() (*asset, e return nil, err } - info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(0664), modTime: time.Unix(1670944751, 0)} + info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(0644), modTime: time.Unix(1671625544, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6f, 0xf, 0xf0, 0xbd, 0xfe, 0x63, 0x25, 0x8f, 0x5e, 0x46, 0x4b, 0x45, 0x31, 0x8b, 0x3e, 0xd8, 0x6b, 0x5d, 0x9d, 0x6d, 0x10, 0x9a, 0x87, 0x4b, 0x18, 0xc6, 0x39, 0x81, 0x6e, 0xe4, 0x75, 0xfb}} return a, nil } @@ -904,7 +925,7 @@ func _1671438731_add_magnetlink_uri_to_communities_archive_infoUpSql() (*asset, return nil, err } - info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(0664), modTime: time.Unix(1671438768, 0)} + info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(0644), modTime: time.Unix(1671625544, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xda, 0x8b, 0x4b, 0xd6, 0xd8, 0xe2, 0x3d, 0xf7, 0x6b, 0xcd, 0x1e, 0x70, 0x9, 0x2e, 0x35, 0x4, 0x61, 0xc3, 0xb5, 0x9d, 0xc5, 0x27, 0x21, 0xa, 0x5a, 0xd6, 0x3e, 0xa6, 0x24, 0xa2, 0x12, 0xdf}} return a, nil } @@ -924,7 +945,7 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0664), modTime: time.Unix(1668713068, 0)} + info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1670843716, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}} return a, nil } @@ -1096,6 +1117,8 @@ var _bindata = map[string]func() (*asset, error){ "1668109917_wakunodes.up.sql": _1668109917_wakunodesUpSql, + "1670249678_display_name_to_settings_sync_clock_table.up.sql": _1670249678_display_name_to_settings_sync_clock_tableUpSql, + "1670836810_add_imported_flag_to_community_archive_hashes.up.sql": _1670836810_add_imported_flag_to_community_archive_hashesUpSql, "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql": _1671438731_add_magnetlink_uri_to_communities_archive_infoUpSql, @@ -1182,6 +1205,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "1664392661_add_third_party_id_to_waku_messages.up.sql": &bintree{_1664392661_add_third_party_id_to_waku_messagesUpSql, map[string]*bintree{}}, "1664783660_add_sync_info_to_saved_addresses.up.sql": &bintree{_1664783660_add_sync_info_to_saved_addressesUpSql, map[string]*bintree{}}, "1668109917_wakunodes.up.sql": &bintree{_1668109917_wakunodesUpSql, map[string]*bintree{}}, + "1670249678_display_name_to_settings_sync_clock_table.up.sql": &bintree{_1670249678_display_name_to_settings_sync_clock_tableUpSql, map[string]*bintree{}}, "1670836810_add_imported_flag_to_community_archive_hashes.up.sql": &bintree{_1670836810_add_imported_flag_to_community_archive_hashesUpSql, map[string]*bintree{}}, "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql": &bintree{_1671438731_add_magnetlink_uri_to_communities_archive_infoUpSql, map[string]*bintree{}}, "doc.go": &bintree{docGo, map[string]*bintree{}}, diff --git a/appdatabase/migrations/sql/1670249678_display_name_to_settings_sync_clock_table.up.sql b/appdatabase/migrations/sql/1670249678_display_name_to_settings_sync_clock_table.up.sql new file mode 100644 index 000000000..2e1e3b3f8 --- /dev/null +++ b/appdatabase/migrations/sql/1670249678_display_name_to_settings_sync_clock_table.up.sql @@ -0,0 +1 @@ +ALTER TABLE settings_sync_clock ADD COLUMN display_name INTEGER NOT NULL DEFAULT 0; \ No newline at end of file diff --git a/multiaccounts/settings/columns.go b/multiaccounts/settings/columns.go index 3a963d476..dc58db4e2 100644 --- a/multiaccounts/settings/columns.go +++ b/multiaccounts/settings/columns.go @@ -72,6 +72,12 @@ var ( DisplayName = SettingField{ reactFieldName: "display-name", dBColumnName: "display_name", + syncProtobufFactory: &SyncProtobufFactory{ + fromInterface: displayNameProtobufFactory, + fromStruct: displayNameProtobufFactoryStruct, + valueFromProtobuf: StringFromSyncProtobuf, + protobufType: protobuf.SyncSetting_DISPLAY_NAME, + }, } Bio = SettingField{ reactFieldName: "bio", diff --git a/multiaccounts/settings/database.go b/multiaccounts/settings/database.go index f2f68b0f3..2e9989003 100644 --- a/multiaccounts/settings/database.go +++ b/multiaccounts/settings/database.go @@ -426,6 +426,14 @@ func (db *Database) GetMessagesFromContactsOnly() (result bool, err error) { return result, err } +func (db *Database) GetProfilePicturesShowTo() (result int64, err error) { + err = db.makeSelectRow(ProfilePicturesShowTo).Scan(&result) + if err == sql.ErrNoRows { + return result, nil + } + return result, err +} + func (db *Database) GetLatestDerivedPath() (result uint, err error) { err = db.makeSelectRow(LatestDerivedPath).Scan(&result) return diff --git a/multiaccounts/settings/structs.go b/multiaccounts/settings/structs.go index 49e602743..a4010093b 100644 --- a/multiaccounts/settings/structs.go +++ b/multiaccounts/settings/structs.go @@ -9,8 +9,8 @@ import ( ) type ValueHandler func(interface{}) (interface{}, error) -type SyncSettingProtobufFactoryInterface func(interface{}, uint64, string) (*common.RawMessage, error) -type SyncSettingProtobufFactoryStruct func(Settings, uint64, string) (*common.RawMessage, error) +type SyncSettingProtobufFactoryInterface func(interface{}, uint64, string) (*common.RawMessage, *protobuf.SyncSetting, error) +type SyncSettingProtobufFactoryStruct func(Settings, uint64, string) (*common.RawMessage, *protobuf.SyncSetting, error) type SyncSettingProtobufToValue func(setting *protobuf.SyncSetting) interface{} // SyncProtobufFactory represents a collection of functionality to generate and parse *protobuf.SyncSetting diff --git a/multiaccounts/settings/sync_protobuf_factories.go b/multiaccounts/settings/sync_protobuf_factories.go index 76ebd2f80..876c9af00 100644 --- a/multiaccounts/settings/sync_protobuf_factories.go +++ b/multiaccounts/settings/sync_protobuf_factories.go @@ -33,123 +33,128 @@ func buildRawSyncSettingMessage(msg *protobuf.SyncSetting, chatID string) (*comm // Currency -func buildRawCurrencySyncMessage(v string, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawCurrencySyncMessage(v string, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_CURRENCY, Value: &protobuf.SyncSetting_ValueString{ValueString: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func currencyProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func currencyProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := assertString(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawCurrencySyncMessage(v, clock, chatID) } -func currencyProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func currencyProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { return buildRawCurrencySyncMessage(s.Currency, clock, chatID) } // GifFavorites -func buildRawGifFavoritesSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawGifFavoritesSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_GIF_FAVOURITES, Value: &protobuf.SyncSetting_ValueBytes{ValueBytes: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func gifFavouritesProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func gifFavouritesProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := assertBytes(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawGifFavoritesSyncMessage(v, clock, chatID) } -func gifFavouritesProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func gifFavouritesProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { gf := extractJSONRawMessage(s.GifFavorites) return buildRawGifFavoritesSyncMessage(gf, clock, chatID) } // GifRecents -func buildRawGifRecentsSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawGifRecentsSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_GIF_RECENTS, Value: &protobuf.SyncSetting_ValueBytes{ValueBytes: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func gifRecentsProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func gifRecentsProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := assertBytes(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawGifRecentsSyncMessage(v, clock, chatID) } -func gifRecentsProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func gifRecentsProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { gr := extractJSONRawMessage(s.GifRecents) return buildRawGifRecentsSyncMessage(gr, clock, chatID) } // MessagesFromContactsOnly -func buildRawMessagesFromContactsOnlySyncMessage(v bool, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawMessagesFromContactsOnlySyncMessage(v bool, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_MESSAGES_FROM_CONTACTS_ONLY, Value: &protobuf.SyncSetting_ValueBool{ValueBool: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func messagesFromContactsOnlyProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func messagesFromContactsOnlyProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := assertBool(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawMessagesFromContactsOnlySyncMessage(v, clock, chatID) } -func messagesFromContactsOnlyProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func messagesFromContactsOnlyProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { return buildRawMessagesFromContactsOnlySyncMessage(s.MessagesFromContactsOnly, clock, chatID) } // PreferredName -func buildRawPreferredNameSyncMessage(v string, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawPreferredNameSyncMessage(v string, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_PREFERRED_NAME, Value: &protobuf.SyncSetting_ValueString{ValueString: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func preferredNameProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func preferredNameProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := assertString(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawPreferredNameSyncMessage(v, clock, chatID) } -func preferredNameProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func preferredNameProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { var pn string if s.PreferredName != nil { pn = *s.PreferredName @@ -160,171 +165,178 @@ func preferredNameProtobufFactoryStruct(s Settings, clock uint64, chatID string) // PreviewPrivacy -func buildRawPreviewPrivacySyncMessage(v bool, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawPreviewPrivacySyncMessage(v bool, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_PREVIEW_PRIVACY, Value: &protobuf.SyncSetting_ValueBool{ValueBool: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func previewPrivacyProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func previewPrivacyProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := assertBool(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawPreviewPrivacySyncMessage(v, clock, chatID) } -func previewPrivacyProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func previewPrivacyProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { return buildRawPreviewPrivacySyncMessage(s.PreviewPrivacy, clock, chatID) } // ProfilePicturesShowTo -func buildRawProfilePicturesShowToSyncMessage(v int64, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawProfilePicturesShowToSyncMessage(v int64, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_PROFILE_PICTURES_SHOW_TO, Value: &protobuf.SyncSetting_ValueInt64{ValueInt64: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func profilePicturesShowToProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func profilePicturesShowToProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := parseNumberToInt64(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawProfilePicturesShowToSyncMessage(v, clock, chatID) } -func profilePicturesShowToProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func profilePicturesShowToProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { return buildRawProfilePicturesShowToSyncMessage(int64(s.ProfilePicturesShowTo), clock, chatID) } // ProfilePicturesVisibility -func buildRawProfilePicturesVisibilitySyncMessage(v int64, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawProfilePicturesVisibilitySyncMessage(v int64, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_PROFILE_PICTURES_VISIBILITY, Value: &protobuf.SyncSetting_ValueInt64{ValueInt64: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func profilePicturesVisibilityProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func profilePicturesVisibilityProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := parseNumberToInt64(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawProfilePicturesVisibilitySyncMessage(v, clock, chatID) } -func profilePicturesVisibilityProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func profilePicturesVisibilityProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { return buildRawProfilePicturesVisibilitySyncMessage(int64(s.ProfilePicturesVisibility), clock, chatID) } // SendStatusUpdates -func buildRawSendStatusUpdatesSyncMessage(v bool, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawSendStatusUpdatesSyncMessage(v bool, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_SEND_STATUS_UPDATES, Value: &protobuf.SyncSetting_ValueBool{ValueBool: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func sendStatusUpdatesProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func sendStatusUpdatesProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := assertBool(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawSendStatusUpdatesSyncMessage(v, clock, chatID) } -func sendStatusUpdatesProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func sendStatusUpdatesProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { return buildRawSendStatusUpdatesSyncMessage(s.SendStatusUpdates, clock, chatID) } // StickerPacksInstalled -func buildRawStickerPacksInstalledSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawStickerPacksInstalledSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_STICKERS_PACKS_INSTALLED, Value: &protobuf.SyncSetting_ValueBytes{ValueBytes: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func stickersPacksInstalledProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func stickersPacksInstalledProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := parseJSONBlobData(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawStickerPacksInstalledSyncMessage(v, clock, chatID) } -func stickersPacksInstalledProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func stickersPacksInstalledProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { spi := extractJSONRawMessage(s.StickerPacksInstalled) return buildRawStickerPacksInstalledSyncMessage(spi, clock, chatID) } // StickerPacksPending -func buildRawStickerPacksPendingSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawStickerPacksPendingSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_STICKERS_PACKS_PENDING, Value: &protobuf.SyncSetting_ValueBytes{ValueBytes: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func stickersPacksPendingProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func stickersPacksPendingProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := parseJSONBlobData(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawStickerPacksPendingSyncMessage(v, clock, chatID) } -func stickersPacksPendingProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func stickersPacksPendingProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { spp := extractJSONRawMessage(s.StickerPacksPending) return buildRawStickerPacksPendingSyncMessage(spp, clock, chatID) } // StickersRecentStickers -func buildRawStickersRecentStickersSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, error) { +func buildRawStickersRecentStickersSyncMessage(v []byte, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { pb := &protobuf.SyncSetting{ Type: protobuf.SyncSetting_STICKERS_RECENT_STICKERS, Value: &protobuf.SyncSetting_ValueBytes{ValueBytes: v}, Clock: clock, } - return buildRawSyncSettingMessage(pb, chatID) + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err } -func stickersRecentStickersProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, error) { +func stickersRecentStickersProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { v, err := parseJSONBlobData(value) if err != nil { - return nil, err + return nil, nil, err } return buildRawStickersRecentStickersSyncMessage(v, clock, chatID) } -func stickersRecentStickersProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, error) { +func stickersRecentStickersProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { srs := extractJSONRawMessage(s.StickersRecentStickers) return buildRawStickersRecentStickersSyncMessage(srs, clock, chatID) } @@ -426,3 +438,29 @@ func extractJSONRawMessage(jrm *json.RawMessage) []byte { } return out } + +// DisplayName + +func buildRawDisplayNameSyncMessage(v string, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { + pb := &protobuf.SyncSetting{ + Type: protobuf.SyncSetting_DISPLAY_NAME, + Value: &protobuf.SyncSetting_ValueString{ValueString: v}, + Clock: clock, + } + rm, err := buildRawSyncSettingMessage(pb, chatID) + return rm, pb, err +} + +func displayNameProtobufFactory(value interface{}, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { + v, err := assertString(value) + if err != nil { + return nil, nil, err + } + + return buildRawDisplayNameSyncMessage(v, clock, chatID) +} + +func displayNameProtobufFactoryStruct(s Settings, clock uint64, chatID string) (*common.RawMessage, *protobuf.SyncSetting, error) { + + return buildRawDisplayNameSyncMessage(s.DisplayName, clock, chatID) +} diff --git a/multiaccounts/settings/sync_protobuf_factories_test.go b/multiaccounts/settings/sync_protobuf_factories_test.go index 5c7f8a870..e9f12be94 100644 --- a/multiaccounts/settings/sync_protobuf_factories_test.go +++ b/multiaccounts/settings/sync_protobuf_factories_test.go @@ -43,7 +43,7 @@ func TestProfilePicturesVisibilityProtobufFactory(t *testing.T) { for _, c := range cs { a := require.New(t) - rm, err := profilePicturesVisibilityProtobufFactory(c.Input.Value, c.Input.Clock, "0x123def") + rm, _, err := profilePicturesVisibilityProtobufFactory(c.Input.Value, c.Input.Clock, "0x123def") a.NoError(err, c.Name) ppvp := new(protobuf.SyncSetting) diff --git a/protocol/communities_messenger_test.go b/protocol/communities_messenger_test.go index c1e85b598..258e7cc4d 100644 --- a/protocol/communities_messenger_test.go +++ b/protocol/communities_messenger_test.go @@ -556,7 +556,7 @@ func (s *MessengerCommunitiesSuite) TestCommunityContactCodeAdvertisement() { s.joinCommunity(community, s.alice) // Trigger ContactCodeAdvertisement - err := s.bob.SetDisplayName("bobby") + err := s.bob.SetDisplayName("bobby", true) s.Require().NoError(err) err = s.bob.SetBio("I like P2P chats") s.Require().NoError(err) diff --git a/protocol/messenger.go b/protocol/messenger.go index 4d92f49f5..600b436ef 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -151,6 +151,7 @@ type Messenger struct { downloadHistoryArchiveTasksWaitGroup sync.WaitGroup verificationDatabase *verification.Persistence savedAddressesManager *wallet.SavedAddressesManager + backedupMessagesHandler backupHandler // TODO(samyoul) Determine if/how the remaining usage of this mutex can be removed mutex sync.Mutex @@ -479,6 +480,9 @@ func NewMessenger( }, logger: logger, savedAddressesManager: savedAddressesManager, + backedupMessagesHandler: backupHandler{ + postponeHandling: true, + }, } if c.outputMessagesCSV { @@ -684,6 +688,7 @@ func (m *Messenger) Start() (*MessengerResponse, error) { m.broadcastLatestUserStatus() m.timeoutAutomaticStatusUpdates() m.startBackupLoop() + m.startWaitingForTheLatestBackedupMessageLoop() err = m.startAutoMessageLoop() if err != nil { return nil, err @@ -3570,9 +3575,11 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte p := msg.ParsedMessage.Interface().(protobuf.Backup) m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, p) logger.Debug("Handling Backup", zap.Any("message", p)) - err = m.HandleBackup(messageState, p) - if err != nil { - logger.Warn("failed to handle Backup", zap.Error(err)) + errors := m.HandleBackup(messageState, p) + if len(errors) > 0 { + for _, err := range errors { + logger.Warn("failed to handle Backup", zap.Error(err)) + } allMessagesProcessed = false continue } @@ -3706,12 +3713,13 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, ss) logger.Debug("Handling SyncSetting", zap.Any("message", ss)) - err := m.handleSyncSetting(messageState.Response, &ss) + settingField, err := m.extractSyncSetting(&ss) if err != nil { logger.Warn("failed to handle SyncSetting", zap.Error(err)) allMessagesProcessed = false continue } + messageState.Response.Settings = append(messageState.Response.Settings, settingField) case protobuf.RequestAddressForTransaction: command := msg.ParsedMessage.Interface().(protobuf.RequestAddressForTransaction) diff --git a/protocol/messenger_backup.go b/protocol/messenger_backup.go index f52348c6f..9b12296e9 100644 --- a/protocol/messenger_backup.go +++ b/protocol/messenger_backup.go @@ -7,6 +7,7 @@ import ( "github.com/golang/protobuf/proto" "go.uber.org/zap" + "github.com/status-im/status-go/multiaccounts/settings" "github.com/status-im/status-go/protocol/common" "github.com/status-im/status-go/protocol/protobuf" ) @@ -78,6 +79,124 @@ func (m *Messenger) startBackupLoop() { } func (m *Messenger) BackupData(ctx context.Context) (uint64, error) { + clock, chat := m.getLastClockWithRelatedChat() + contactsToBackup := m.backupContacts(ctx) + communitiesToBackup, err := m.backupCommunities(ctx, clock) + if err != nil { + return 0, err + } + profileToBackup, err := m.backupProfile(ctx, clock) + if err != nil { + return 0, err + } + _, settings, errors := m.prepareSyncSettingsMessages(clock) + if len(errors) != 0 { + // return just the first error, the others have been logged + return 0, errors[0] + } + + backupDetailsOnly := func() *protobuf.Backup { + return &protobuf.Backup{ + Clock: clock, + ContactsDetails: &protobuf.FetchingBackedUpDataDetails{ + DataNumber: uint32(0), + TotalNumber: uint32(len(contactsToBackup)), + }, + CommunitiesDetails: &protobuf.FetchingBackedUpDataDetails{ + DataNumber: uint32(0), + TotalNumber: uint32(len(communitiesToBackup)), + }, + ProfileDetails: &protobuf.FetchingBackedUpDataDetails{ + DataNumber: uint32(0), + TotalNumber: uint32(len(profileToBackup)), + }, + SettingsDetails: &protobuf.FetchingBackedUpDataDetails{ + DataNumber: uint32(0), + TotalNumber: uint32(len(settings)), + }, + } + } + + // Update contacts messages encode and dispatch + for i, d := range contactsToBackup { + pb := backupDetailsOnly() + pb.ContactsDetails.DataNumber = uint32(i + 1) + pb.Contacts = d.Contacts + err = m.encodeAndDispatchBackupMessage(ctx, pb, chat.ID) + if err != nil { + return 0, err + } + } + + // Update communities messages encode and dispatch + for i, d := range communitiesToBackup { + pb := backupDetailsOnly() + pb.CommunitiesDetails.DataNumber = uint32(i + 1) + pb.Communities = d.Communities + err = m.encodeAndDispatchBackupMessage(ctx, pb, chat.ID) + if err != nil { + return 0, err + } + } + + // Update profile messages encode and dispatch + for i, d := range profileToBackup { + pb := backupDetailsOnly() + pb.ProfileDetails.DataNumber = uint32(i + 1) + pb.Profile = d.Profile + err = m.encodeAndDispatchBackupMessage(ctx, pb, chat.ID) + if err != nil { + return 0, err + } + } + + // Update settings messages encode and dispatch + for i, d := range settings { + pb := backupDetailsOnly() + pb.SettingsDetails.DataNumber = uint32(i + 1) + pb.Setting = d + err = m.encodeAndDispatchBackupMessage(ctx, pb, chat.ID) + if err != nil { + return 0, err + } + } + + chat.LastClockValue = clock + err = m.saveChat(chat) + if err != nil { + return 0, err + } + + clockInSeconds := clock / 1000 + err = m.settings.SetLastBackup(clockInSeconds) + if err != nil { + return 0, err + } + if m.config.messengerSignalsHandler != nil { + m.config.messengerSignalsHandler.BackupPerformed(clockInSeconds) + } + + return clockInSeconds, nil +} + +func (m *Messenger) encodeAndDispatchBackupMessage(ctx context.Context, message *protobuf.Backup, chatID string) error { + encodedMessage, err := proto.Marshal(message) + if err != nil { + return err + } + + _, err = m.dispatchMessage(ctx, common.RawMessage{ + LocalChatID: chatID, + Payload: encodedMessage, + SkipEncryption: true, + SendOnPersonalTopic: true, + MessageType: protobuf.ApplicationMetadataMessage_BACKUP, + }) + + return err +} + +func (m *Messenger) backupContacts(ctx context.Context) []*protobuf.Backup { var contacts []*protobuf.SyncInstallationContactV2 m.allContacts.Range(func(contactID string, contact *Contact) (shouldContinue bool) { syncContact := m.syncBackupContact(ctx, contact) @@ -87,8 +206,7 @@ func (m *Messenger) BackupData(ctx context.Context) (uint64, error) { return true }) - clock, chat := m.getLastClockWithRelatedChat() - + var backupMessages []*protobuf.Backup for i := 0; i < len(contacts); i += BackupContactsPerBatch { j := i + BackupContactsPerBatch if j > len(contacts) { @@ -100,52 +218,41 @@ func (m *Messenger) BackupData(ctx context.Context) (uint64, error) { backupMessage := &protobuf.Backup{ Contacts: contactsToAdd, } - - encodedMessage, err := proto.Marshal(backupMessage) - if err != nil { - return 0, err - } - - _, err = m.dispatchMessage(ctx, common.RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - SkipEncryption: true, - SendOnPersonalTopic: true, - MessageType: protobuf.ApplicationMetadataMessage_BACKUP, - }) - if err != nil { - return 0, err - } - + backupMessages = append(backupMessages, backupMessage) } + return backupMessages +} + +func (m *Messenger) backupCommunities(ctx context.Context, clock uint64) ([]*protobuf.Backup, error) { joinedCs, err := m.communitiesManager.JoinedAndPendingCommunitiesWithRequests() if err != nil { - return 0, err + return nil, err } deletedCs, err := m.communitiesManager.DeletedCommunities() if err != nil { - return 0, err + return nil, err } + var backupMessages []*protobuf.Backup cs := append(joinedCs, deletedCs...) for _, c := range cs { _, beingImported := m.importingCommunities[c.IDString()] if !beingImported { settings, err := m.communitiesManager.GetCommunitySettingsByID(c.ID()) if err != nil { - return 0, err + return nil, err } syncMessage, err := c.ToSyncCommunityProtobuf(clock, settings) if err != nil { - return 0, err + return nil, err } encodedKeys, err := m.encryptor.GetAllHREncodedKeys(c.ID()) if err != nil { - return 0, err + return nil, err } syncMessage.EncryptionKeys = encodedKeys @@ -153,39 +260,11 @@ func (m *Messenger) BackupData(ctx context.Context) (uint64, error) { Communities: []*protobuf.SyncCommunity{syncMessage}, } - encodedMessage, err := proto.Marshal(backupMessage) - if err != nil { - return 0, err - } - - _, err = m.dispatchMessage(ctx, common.RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - SkipEncryption: true, - SendOnPersonalTopic: true, - MessageType: protobuf.ApplicationMetadataMessage_BACKUP, - }) - if err != nil { - return 0, err - } + backupMessages = append(backupMessages, backupMessage) } } - chat.LastClockValue = clock - err = m.saveChat(chat) - if err != nil { - return 0, err - } - clockInSeconds := clock / 1000 - err = m.settings.SetLastBackup(clockInSeconds) - if err != nil { - return 0, err - } - if m.config.messengerSignalsHandler != nil { - m.config.messengerSignalsHandler.BackupPerformed(clockInSeconds) - } - - return clockInSeconds, nil + return backupMessages, nil } // syncContact sync as contact with paired devices @@ -220,3 +299,54 @@ func (m *Messenger) syncBackupContact(ctx context.Context, contact *Contact) *pr TrustStatus: int64(contact.TrustStatus), } } + +func (m *Messenger) backupProfile(ctx context.Context, clock uint64) ([]*protobuf.Backup, error) { + displayName, err := m.settings.DisplayName() + if err != nil { + return nil, err + } + + displayNameClock, err := m.settings.GetSettingLastSynced(settings.DisplayName) + if err != nil { + return nil, err + } + if displayNameClock == 0 { + displayNameClock = clock + } + + keyUID := m.account.KeyUID + images, err := m.multiAccounts.GetIdentityImages(keyUID) + if err != nil { + return nil, err + } + + pictures := make([]*protobuf.SyncProfilePicture, len(images)) + for i, image := range images { + p := &protobuf.SyncProfilePicture{} + p.Name = image.Name + p.Payload = image.Payload + p.Width = uint32(image.Width) + p.Height = uint32(image.Height) + p.FileSize = uint32(image.FileSize) + p.ResizeTarget = uint32(image.ResizeTarget) + if image.Clock == 0 { + p.Clock = clock + } else { + p.Clock = image.Clock + } + pictures[i] = p + } + + backupMessage := &protobuf.Backup{ + Profile: &protobuf.BackedUpProfile{ + KeyUid: keyUID, + DisplayName: displayName, + Pictures: pictures, + DisplayNameClock: displayNameClock, + }, + } + + backupMessages := []*protobuf.Backup{backupMessage} + + return backupMessages, nil +} diff --git a/protocol/messenger_backup_handler.go b/protocol/messenger_backup_handler.go new file mode 100644 index 000000000..d6c978042 --- /dev/null +++ b/protocol/messenger_backup_handler.go @@ -0,0 +1,205 @@ +package protocol + +import ( + "sync" + "time" + + "go.uber.org/zap" + + "github.com/status-im/status-go/images" + "github.com/status-im/status-go/multiaccounts/settings" + "github.com/status-im/status-go/protocol/protobuf" + "github.com/status-im/status-go/protocol/wakusync" +) + +const ( + // timeToPostponeBackedUpMessagesHandling - the idea is to wait for 30 secs in loading state with the hope that at least + // one message from the set of last backed up messages will arrive, that we can know which set of messages to work with + timeToPostponeBackedUpMessagesHandling = 30 * time.Second + + SyncWakuSectionKeyProfile = "profile" + SyncWakuSectionKeyContacts = "contacts" + SyncWakuSectionKeyCommunities = "communities" + SyncWakuSectionKeySettings = "settings" +) + +type backupHandler struct { + messagesToProceed []protobuf.Backup + lastKnownTime uint64 + postponeHandling bool + postponeTasksWaitGroup sync.WaitGroup +} + +func (bh *backupHandler) addMessage(message protobuf.Backup) { + if message.Clock < bh.lastKnownTime { + return + } + if message.Clock > bh.lastKnownTime { + bh.messagesToProceed = nil + bh.lastKnownTime = message.Clock + } + + bh.messagesToProceed = append(bh.messagesToProceed, message) +} + +func (m *Messenger) startWaitingForTheLatestBackedupMessageLoop() { + ticker := time.NewTicker(timeToPostponeBackedUpMessagesHandling) + m.backedupMessagesHandler.postponeTasksWaitGroup.Add(1) + go func() { + defer m.backedupMessagesHandler.postponeTasksWaitGroup.Done() + for { + select { + case <-ticker.C: + if !m.backedupMessagesHandler.postponeHandling { + return + } + m.backedupMessagesHandler.postponeHandling = false + + for _, msg := range m.backedupMessagesHandler.messagesToProceed { + messageState := m.buildMessageState() + errors := m.HandleBackup(messageState, msg) + if len(errors) > 0 { + for _, err := range errors { + m.logger.Warn("failed to handle postponed Backup messages", zap.Error(err)) + } + } + } + + m.backedupMessagesHandler.messagesToProceed = nil + case <-m.quit: + ticker.Stop() + return + } + } + }() +} + +func (m *Messenger) HandleBackup(state *ReceivedMessageState, message protobuf.Backup) []error { + var errors []error + if m.backedupMessagesHandler.postponeHandling { + m.backedupMessagesHandler.addMessage(message) + return errors + } + + err := m.handleBackedUpProfile(message.Profile, message.Clock) + if err != nil { + errors = append(errors, err) + } + + for _, contact := range message.Contacts { + err = m.HandleSyncInstallationContact(state, *contact) + if err != nil { + errors = append(errors, err) + } + } + + for _, community := range message.Communities { + err = m.handleSyncCommunity(state, *community) + if err != nil { + errors = append(errors, err) + } + } + err = m.handleBackedUpSettings(message.Setting) + if err != nil { + errors = append(errors, err) + } + + if m.config.messengerSignalsHandler != nil { + response := wakusync.WakuBackedUpDataResponse{} + + response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyProfile, message.ProfileDetails) + response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyContacts, message.ContactsDetails) + response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeyCommunities, message.CommunitiesDetails) + response.AddFetchingBackedUpDataDetails(SyncWakuSectionKeySettings, message.SettingsDetails) + + m.config.messengerSignalsHandler.SendWakuFetchingBackupProgress(&response) + } + + return errors +} + +func (m *Messenger) handleBackedUpProfile(message *protobuf.BackedUpProfile, backupTime uint64) error { + if message == nil { + return nil + } + + dbDisplayNameClock, err := m.settings.GetSettingLastSynced(settings.DisplayName) + if err != nil { + return err + } + + response := wakusync.WakuBackedUpDataResponse{ + Profile: &wakusync.BackedUpProfile{}, + } + + if dbDisplayNameClock < message.DisplayNameClock { + err := m.SetDisplayName(message.DisplayName, false) + response.AddDisplayName(message.DisplayName, err == nil) + } + + syncWithBackedUpImages := false + dbImages, err := m.multiAccounts.GetIdentityImages(message.KeyUid) + if err != nil { + syncWithBackedUpImages = true + } + if len(dbImages) == 0 { + if len(message.Pictures) > 0 { + syncWithBackedUpImages = true + } + } else { + // since both images (large and thumbnail) are always stored in the same time, we're free to use either of those two clocks for comparison + lastImageStoredClock := dbImages[0].Clock + syncWithBackedUpImages = lastImageStoredClock < backupTime + } + + if syncWithBackedUpImages { + if len(message.Pictures) == 0 { + err = m.multiAccounts.DeleteIdentityImage(message.KeyUid) + response.AddImages(nil, err == nil) + } else { + idImages := make([]images.IdentityImage, len(message.Pictures)) + for i, pic := range message.Pictures { + img := images.IdentityImage{ + Name: pic.Name, + Payload: pic.Payload, + Width: int(pic.Width), + Height: int(pic.Height), + FileSize: int(pic.FileSize), + ResizeTarget: int(pic.ResizeTarget), + Clock: pic.Clock, + } + idImages[i] = img + } + err = m.multiAccounts.StoreIdentityImages(message.KeyUid, idImages, false) + response.AddImages(idImages, err == nil) + } + } + + if m.config.messengerSignalsHandler != nil { + m.config.messengerSignalsHandler.SendWakuBackedUpProfile(&response) + } + + return err +} + +func (m *Messenger) handleBackedUpSettings(message *protobuf.SyncSetting) error { + if message == nil { + return nil + } + + settingField, err := m.extractSyncSetting(message) + if err != nil { + m.logger.Warn("failed to handle SyncSetting from backed up message", zap.Error(err)) + return nil + } + + response := wakusync.WakuBackedUpDataResponse{ + Setting: settingField, + } + + if m.config.messengerSignalsHandler != nil { + m.config.messengerSignalsHandler.SendWakuBackedUpSettings(&response) + } + + return nil +} diff --git a/protocol/messenger_backup_test.go b/protocol/messenger_backup_test.go index 428df9b50..49c830d71 100644 --- a/protocol/messenger_backup_test.go +++ b/protocol/messenger_backup_test.go @@ -3,6 +3,8 @@ package protocol import ( "context" "crypto/ecdsa" + "encoding/json" + "fmt" "testing" "github.com/stretchr/testify/suite" @@ -11,6 +13,8 @@ import ( gethbridge "github.com/status-im/status-go/eth-node/bridge/geth" "github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/types" + "github.com/status-im/status-go/images" + "github.com/status-im/status-go/multiaccounts/settings" "github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/requests" "github.com/status-im/status-go/protocol/tt" @@ -106,13 +110,9 @@ func (s *MessengerBackupSuite) TestBackupContacts() { _, err = WaitOnMessengerResponse( bob2, func(r *MessengerResponse) bool { - _, err := s.m.RetrieveAll() + _, err := bob2.RetrieveAll() if err != nil { - s.logger.Info("Failed") - return false - } - - if len(bob2.Contacts()) < 2 { + bob2.logger.Info("Failed") return false } @@ -122,6 +122,9 @@ func (s *MessengerBackupSuite) TestBackupContacts() { "contacts not backed up", ) s.Require().NoError(err) + + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + s.Require().Len(bob2.AddedContacts(), 2) actualContacts = bob2.AddedContacts() @@ -138,6 +141,193 @@ func (s *MessengerBackupSuite) TestBackupContacts() { s.Require().Equal(clock, lastBackup) } +func (s *MessengerBackupSuite) TestBackupProfile() { + const bob1DisplayName = "bobby" + + // Create bob1 + bob1 := s.m + err := bob1.SetDisplayName(bob1DisplayName, true) + s.Require().NoError(err) + bob1KeyUID := bob1.account.KeyUID + imagesExpected := fmt.Sprintf(`[{"keyUid":"%s","type":"large","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUg=","width":240,"height":300,"fileSize":1024,"resizeTarget":240,"clock":0},{"keyUid":"%s","type":"thumbnail","uri":"data:image/jpeg;base64,/9j/2wCEAFA3PEY8MlA=","width":80,"height":80,"fileSize":256,"resizeTarget":80,"clock":0}]`, + bob1KeyUID, bob1KeyUID) + + iis := images.SampleIdentityImages() + s.Require().NoError(bob1.multiAccounts.StoreIdentityImages(bob1KeyUID, iis, false)) + + // Create bob2 + bob2, err := newMessengerWithKey(s.shh, bob1.identity, s.logger, nil) + s.Require().NoError(err) + _, err = bob2.Start() + s.Require().NoError(err) + + // Check bob1 + storedBob1DisplayName, err := bob1.settings.DisplayName() + s.Require().NoError(err) + s.Require().Equal(bob1DisplayName, storedBob1DisplayName) + + bob1Images, err := bob1.multiAccounts.GetIdentityImages(bob1KeyUID) + s.Require().NoError(err) + jBob1Images, err := json.Marshal(bob1Images) + s.Require().NoError(err) + s.Require().Equal(imagesExpected, string(jBob1Images)) + + // Check bob2 + storedBob2DisplayName, err := bob2.settings.DisplayName() + s.Require().NoError(err) + s.Require().Equal("", storedBob2DisplayName) + + var expectedEmpty []*images.IdentityImage + bob2Images, err := bob2.multiAccounts.GetIdentityImages(bob1KeyUID) + s.Require().NoError(err) + s.Require().Equal(expectedEmpty, bob2Images) + + // Backup + clock, err := bob1.BackupData(context.Background()) + s.Require().NoError(err) + + // Wait for the message to reach its destination + _, err = WaitOnMessengerResponse( + bob2, + func(r *MessengerResponse) bool { + _, err := bob2.RetrieveAll() + if err != nil { + bob2.logger.Info("Failed") + return false + } + + return true + }, + "profile data not backed up", + ) + s.Require().NoError(err) + + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + + // Check bob2 + storedBob2DisplayName, err = bob2.settings.DisplayName() + s.Require().NoError(err) + s.Require().Equal(bob1DisplayName, storedBob2DisplayName) + + bob2Images, err = bob2.multiAccounts.GetIdentityImages(bob1KeyUID) + s.Require().NoError(err) + s.Require().Equal(2, len(bob2Images)) + s.Require().Equal(bob2Images[0].Payload, bob1Images[0].Payload) + s.Require().Equal(bob2Images[1].Payload, bob1Images[1].Payload) + + lastBackup, err := bob1.lastBackup() + s.Require().NoError(err) + s.Require().NotEmpty(lastBackup) + s.Require().Equal(clock, lastBackup) +} + +func (s *MessengerBackupSuite) TestBackupSettings() { + const ( + bob1DisplayName = "bobby" + bob1Currency = "eur" + bob1MessagesFromContactsOnly = true + bob1ProfilePicturesShowTo = settings.ProfilePicturesShowToEveryone + bob1ProfilePicturesVisibility = settings.ProfilePicturesVisibilityEveryone + ) + + // Create bob1 and set fields which are supposed to be backed up to/fetched from waku + bob1 := s.m + err := bob1.settings.SaveSettingField(settings.DisplayName, bob1DisplayName) + s.Require().NoError(err) + err = bob1.settings.SaveSettingField(settings.Currency, bob1Currency) + s.Require().NoError(err) + err = bob1.settings.SaveSettingField(settings.MessagesFromContactsOnly, bob1MessagesFromContactsOnly) + s.Require().NoError(err) + err = bob1.settings.SaveSettingField(settings.ProfilePicturesShowTo, bob1ProfilePicturesShowTo) + s.Require().NoError(err) + err = bob1.settings.SaveSettingField(settings.ProfilePicturesVisibility, bob1ProfilePicturesVisibility) + s.Require().NoError(err) + + // Create bob2 + bob2, err := newMessengerWithKey(s.shh, bob1.identity, s.logger, nil) + s.Require().NoError(err) + _, err = bob2.Start() + s.Require().NoError(err) + + // Check bob1 + storedBob1DisplayName, err := bob1.settings.DisplayName() + s.Require().NoError(err) + s.Require().Equal(bob1DisplayName, storedBob1DisplayName) + storedBob1Currency, err := bob1.settings.GetCurrency() + s.Require().NoError(err) + s.Require().Equal(bob1Currency, storedBob1Currency) + storedBob1MessagesFromContactsOnly, err := bob1.settings.GetMessagesFromContactsOnly() + s.Require().NoError(err) + s.Require().Equal(bob1MessagesFromContactsOnly, storedBob1MessagesFromContactsOnly) + storedBob1ProfilePicturesShowTo, err := bob1.settings.GetProfilePicturesShowTo() + s.Require().NoError(err) + s.Require().Equal(int64(bob1ProfilePicturesShowTo), storedBob1ProfilePicturesShowTo) + storedBob1ProfilePicturesVisibility, err := bob1.settings.GetProfilePicturesVisibility() + s.Require().NoError(err) + s.Require().Equal(int(bob1ProfilePicturesVisibility), storedBob1ProfilePicturesVisibility) + + // Check bob2 + storedBob2DisplayName, err := bob2.settings.DisplayName() + s.Require().NoError(err) + s.Require().NotEqual(storedBob1DisplayName, storedBob2DisplayName) + storedBob2Currency, err := bob2.settings.GetCurrency() + s.Require().NoError(err) + s.Require().NotEqual(storedBob1Currency, storedBob2Currency) + storedBob2MessagesFromContactsOnly, err := bob2.settings.GetMessagesFromContactsOnly() + s.Require().NoError(err) + s.Require().NotEqual(storedBob1MessagesFromContactsOnly, storedBob2MessagesFromContactsOnly) + storedBob2ProfilePicturesShowTo, err := bob2.settings.GetProfilePicturesShowTo() + s.Require().NoError(err) + s.Require().NotEqual(storedBob1ProfilePicturesShowTo, storedBob2ProfilePicturesShowTo) + storedBob2ProfilePicturesVisibility, err := bob2.settings.GetProfilePicturesVisibility() + s.Require().NoError(err) + s.Require().NotEqual(storedBob1ProfilePicturesVisibility, storedBob2ProfilePicturesVisibility) + + // Backup + clock, err := bob1.BackupData(context.Background()) + s.Require().NoError(err) + + // Wait for the message to reach its destination + _, err = WaitOnMessengerResponse( + bob2, + func(r *MessengerResponse) bool { + _, err := bob2.RetrieveAll() + if err != nil { + bob2.logger.Info("Failed") + return false + } + + return true + }, + "profile data not backed up", + ) + s.Require().NoError(err) + + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + + // Check bob2 + storedBob2DisplayName, err = bob2.settings.DisplayName() + s.Require().NoError(err) + s.Require().Equal(storedBob1DisplayName, storedBob2DisplayName) + storedBob2Currency, err = bob2.settings.GetCurrency() + s.Require().NoError(err) + s.Require().Equal(storedBob1Currency, storedBob2Currency) + storedBob2MessagesFromContactsOnly, err = bob2.settings.GetMessagesFromContactsOnly() + s.Require().NoError(err) + s.Require().Equal(storedBob1MessagesFromContactsOnly, storedBob2MessagesFromContactsOnly) + storedBob2ProfilePicturesShowTo, err = bob2.settings.GetProfilePicturesShowTo() + s.Require().NoError(err) + s.Require().Equal(storedBob1ProfilePicturesShowTo, storedBob2ProfilePicturesShowTo) + storedBob2ProfilePicturesVisibility, err = bob2.settings.GetProfilePicturesVisibility() + s.Require().NoError(err) + s.Require().Equal(storedBob1ProfilePicturesVisibility, storedBob2ProfilePicturesVisibility) + + lastBackup, err := bob1.lastBackup() + s.Require().NoError(err) + s.Require().NotEmpty(lastBackup) + s.Require().Equal(clock, lastBackup) +} + func (s *MessengerBackupSuite) TestBackupContactsGreaterThanBatch() { bob1 := s.m // Create bob2 @@ -170,22 +360,21 @@ func (s *MessengerBackupSuite) TestBackupContactsGreaterThanBatch() { _, err = WaitOnMessengerResponse( bob2, func(r *MessengerResponse) bool { - _, err := s.m.RetrieveAll() + _, err := bob2.RetrieveAll() if err != nil { s.logger.Info("Failed") return false } - if len(bob2.Contacts()) < BackupContactsPerBatch*2 { - return false - } - return true - }, "contacts not backed up", ) s.Require().NoError(err) + + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + + s.Require().Less(BackupContactsPerBatch*2, len(bob2.Contacts())) s.Require().Len(bob2.AddedContacts(), BackupContactsPerBatch*2) } @@ -246,23 +435,21 @@ func (s *MessengerBackupSuite) TestBackupRemovedContact() { _, err = WaitOnMessengerResponse( bob2, func(r *MessengerResponse) bool { - _, err := s.m.RetrieveAll() + _, err := bob2.RetrieveAll() if err != nil { - s.logger.Info("Failed") - return false - } - - if len(bob2.Contacts()) != 1 && bob2.Contacts()[0].ID != contactID1 { + bob2.logger.Info("Failed") return false } return true - }, "contacts not backed up", ) // Bob 2 should remove the contact s.Require().NoError(err) + + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + s.Require().Len(bob2.AddedContacts(), 1) s.Require().Equal(contactID1, bob2.AddedContacts()[0].ID) @@ -303,25 +490,27 @@ func (s *MessengerBackupSuite) TestBackupLocalNickname() { _, err = WaitOnMessengerResponse( bob2, func(r *MessengerResponse) bool { - _, err := s.m.RetrieveAll() + _, err := bob2.RetrieveAll() if err != nil { - s.logger.Info("Failed") + bob2.logger.Info("Failed") return false } - for _, c := range bob2.Contacts() { - if c.ID == contactID1 { - actualContact = c - return true - } - } - return false - + return true }, "contacts not backed up", ) s.Require().NoError(err) + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + + for _, c := range bob2.Contacts() { + if c.ID == contactID1 { + actualContact = c + break + } + } + s.Require().Equal(actualContact.LocalNickname, nickname) lastBackup, err := bob1.lastBackup() s.Require().NoError(err) @@ -356,11 +545,20 @@ func (s *MessengerBackupSuite) TestBackupBlockedContacts() { _, err = WaitOnMessengerResponse( bob2, func(r *MessengerResponse) bool { - return len(bob2.AddedContacts()) >= 1 + _, err := bob2.RetrieveAll() + if err != nil { + bob2.logger.Info("Failed") + return false + } + + return true }, "contacts not backed up", ) s.Require().NoError(err) + + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + s.Require().Len(bob2.AddedContacts(), 1) actualContacts := bob2.AddedContacts() @@ -422,19 +620,21 @@ func (s *MessengerBackupSuite) TestBackupCommunities() { _, err = WaitOnMessengerResponse( bob2, func(r *MessengerResponse) bool { - _, err := s.m.RetrieveAll() + _, err := bob2.RetrieveAll() if err != nil { - s.logger.Info("Failed") + bob2.logger.Info("Failed") return false } - communities, err := bob2.Communities() - s.Require().NoError(err) - return len(communities) >= 2 + return true }, "communities not backed up", ) + s.Require().NoError(err) + + bob2.backedupMessagesHandler.postponeTasksWaitGroup.Wait() + communities, err = bob2.JoinedCommunities() s.Require().NoError(err) s.Require().Len(communities, 1) diff --git a/protocol/messenger_config.go b/protocol/messenger_config.go index e4f70335f..24d32bf37 100644 --- a/protocol/messenger_config.go +++ b/protocol/messenger_config.go @@ -23,6 +23,7 @@ import ( "github.com/status-im/status-go/protocol/pushnotificationclient" "github.com/status-im/status-go/protocol/pushnotificationserver" "github.com/status-im/status-go/protocol/transport" + "github.com/status-im/status-go/protocol/wakusync" "github.com/status-im/status-go/services/mailservers" ) @@ -52,6 +53,9 @@ type MessengerSignalsHandler interface { DiscordCommunityImportProgress(importProgress *discord.ImportProgress) DiscordCommunityImportFinished(communityID string) DiscordCommunityImportCancelled(communityID string) + SendWakuFetchingBackupProgress(response *wakusync.WakuBackedUpDataResponse) + SendWakuBackedUpProfile(response *wakusync.WakuBackedUpDataResponse) + SendWakuBackedUpSettings(response *wakusync.WakuBackedUpDataResponse) } type config struct { diff --git a/protocol/messenger_handler.go b/protocol/messenger_handler.go index d03a79b67..df10f75e2 100644 --- a/protocol/messenger_handler.go +++ b/protocol/messenger_handler.go @@ -407,24 +407,6 @@ func (m *Messenger) handleCommandMessage(state *ReceivedMessageState, message *c return nil } -func (m *Messenger) HandleBackup(state *ReceivedMessageState, message protobuf.Backup) error { - for _, contact := range message.Contacts { - err := m.HandleSyncInstallationContact(state, *contact) - if err != nil { - return err - } - } - - for _, community := range message.Communities { - err := m.handleSyncCommunity(state, *community) - if err != nil { - return err - } - } - - return nil -} - func (m *Messenger) HandleSyncInstallationContact(state *ReceivedMessageState, message protobuf.SyncInstallationContactV2) error { removedOrBlocked := message.Removed || message.Blocked chat, ok := state.AllChats.Load(message.Id) diff --git a/protocol/messenger_identity.go b/protocol/messenger_identity.go index c85031aa3..910c684ab 100644 --- a/protocol/messenger_identity.go +++ b/protocol/messenger_identity.go @@ -49,7 +49,7 @@ func ValidateDisplayName(displayName *string) error { return nil } -func (m *Messenger) SetDisplayName(displayName string) error { +func (m *Messenger) SetDisplayName(displayName string, publishChange bool) error { currDisplayName, err := m.settings.DisplayName() if err != nil { return err @@ -74,12 +74,16 @@ func (m *Messenger) SetDisplayName(displayName string) error { return err } - err = m.resetLastPublishedTimeForChatIdentity() - if err != nil { - return err + if publishChange { + err = m.resetLastPublishedTimeForChatIdentity() + if err != nil { + return err + } + + return m.publishContactCode() } - return m.publishContactCode() + return nil } func ValidateBio(bio *string) error { diff --git a/protocol/messenger_sync_settings.go b/protocol/messenger_sync_settings.go index 294e82586..6e633d8cb 100644 --- a/protocol/messenger_sync_settings.go +++ b/protocol/messenger_sync_settings.go @@ -8,94 +8,111 @@ import ( "github.com/status-im/status-go/multiaccounts/errors" "github.com/status-im/status-go/multiaccounts/settings" + "github.com/status-im/status-go/protocol/common" "github.com/status-im/status-go/protocol/protobuf" ) // syncSettings syncs all settings that are syncable -func (m *Messenger) syncSettings() error { - logger := m.logger.Named("syncSettings") - +func (m *Messenger) prepareSyncSettingsMessages(currentClock uint64) (resultRaw []*common.RawMessage, resultSync []*protobuf.SyncSetting, errors []error) { s, err := m.settings.GetSettings() if err != nil { - return err + errors = append(errors, err) + return } + logger := m.logger.Named("prepareSyncSettings") // Do not use the network clock, use the db value _, chat := m.getLastClockWithRelatedChat() - var errs []error for _, sf := range settings.SettingFieldRegister { if sf.CanSync(settings.FromStruct) { // Pull clock from the db clock, err := m.settings.GetSettingLastSynced(sf) if err != nil { logger.Error("m.settings.GetSettingLastSynced", zap.Error(err), zap.Any("SettingField", sf)) - return err + errors = append(errors, err) + return + } + if clock == 0 { + clock = currentClock } // Build protobuf - rm, err := sf.SyncProtobufFactory().FromStruct()(s, clock, chat.ID) + rm, sm, err := sf.SyncProtobufFactory().FromStruct()(s, clock, chat.ID) if err != nil { // Collect errors to give other sync messages a chance to send logger.Error("SyncProtobufFactory.Struct", zap.Error(err)) - errs = append(errs, err) + errors = append(errors, err) } - _, err = m.dispatchMessage(context.Background(), *rm) - if err != nil { - logger.Error("dispatchMessage", zap.Error(err)) - return err - } - logger.Debug("dispatchMessage success", zap.Any("rm", rm)) + resultRaw = append(resultRaw, rm) + resultSync = append(resultSync, sm) } } + return +} - if len(errs) != 0 { +func (m *Messenger) syncSettings() error { + logger := m.logger.Named("syncSettings") + + clock, _ := m.getLastClockWithRelatedChat() + rawMessages, _, errors := m.prepareSyncSettingsMessages(clock) + + if len(errors) != 0 { // return just the first error, the others have been logged - return errs[0] + return errors[0] } + + for _, rm := range rawMessages { + _, err := m.dispatchMessage(context.Background(), *rm) + if err != nil { + logger.Error("dispatchMessage", zap.Error(err)) + return err + } + logger.Debug("dispatchMessage success", zap.Any("rm", rm)) + } + return nil } -// handleSyncSetting parses incoming *protobuf.SyncSetting and stores the setting data if needed -func (m *Messenger) handleSyncSetting(response *MessengerResponse, syncSetting *protobuf.SyncSetting) error { +// extractSyncSetting parses incoming *protobuf.SyncSetting and stores the setting data if needed +func (m *Messenger) extractSyncSetting(syncSetting *protobuf.SyncSetting) (*settings.SyncSettingField, error) { sf, err := settings.GetFieldFromProtobufType(syncSetting.Type) if err != nil { m.logger.Error( - "handleSyncSetting - settings.GetFieldFromProtobufType", + "extractSyncSetting - settings.GetFieldFromProtobufType", zap.Error(err), zap.Any("syncSetting", syncSetting), ) - return err + return nil, err } spf := sf.SyncProtobufFactory() if spf == nil { - m.logger.Warn("handleSyncSetting - received protobuf for setting with no SyncProtobufFactory", zap.Any("SettingField", sf)) - return nil + m.logger.Warn("extractSyncSetting - received protobuf for setting with no SyncProtobufFactory", zap.Any("SettingField", sf)) + return nil, nil } if spf.Inactive() { - m.logger.Warn("handleSyncSetting - received protobuf for inactive sync setting", zap.Any("SettingField", sf)) - return nil + m.logger.Warn("extractSyncSetting - received protobuf for inactive sync setting", zap.Any("SettingField", sf)) + return nil, nil } value := spf.ExtractValueFromProtobuf()(syncSetting) err = m.settings.SaveSyncSetting(sf, value, syncSetting.Clock) if err == errors.ErrNewClockOlderThanCurrent { - m.logger.Info("handleSyncSetting - SaveSyncSetting :", zap.Error(err)) - return nil + m.logger.Info("extractSyncSetting - SaveSyncSetting :", zap.Error(err)) + return nil, nil } if err != nil { - return err + return nil, err } if v, ok := value.([]byte); ok { value = json.RawMessage(v) } - response.Settings = append(response.Settings, &settings.SyncSettingField{SettingField: sf, Value: value}) - return nil + return &settings.SyncSettingField{SettingField: sf, Value: value}, nil } // startSyncSettingsLoop watches the m.settings.SyncQueue and sends a sync message in response to a settings update @@ -117,7 +134,7 @@ func (m *Messenger) startSyncSettingsLoop() { logger.Error("m.settings.SetSettingLastSynced", zap.Error(err)) break } - rm, err := s.SyncProtobufFactory().FromInterface()(s.Value, clock, chat.ID) + rm, _, err := s.SyncProtobufFactory().FromInterface()(s.Value, clock, chat.ID) if err != nil { logger.Error("SyncProtobufFactory().FromInterface", zap.Error(err), zap.Any("SyncSettingField", s)) break diff --git a/protocol/protobuf/pairing.pb.go b/protocol/protobuf/pairing.pb.go index 6c0bb1ecb..c2864fe97 100644 --- a/protocol/protobuf/pairing.pb.go +++ b/protocol/protobuf/pairing.pb.go @@ -45,7 +45,7 @@ func (x SyncTrustedUser_TrustStatus) String() string { } func (SyncTrustedUser_TrustStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{24, 0} + return fileDescriptor_d61ab7221f0b5518, []int{25, 0} } type SyncVerificationRequest_VerificationStatus int32 @@ -79,7 +79,7 @@ func (x SyncVerificationRequest_VerificationStatus) String() string { } func (SyncVerificationRequest_VerificationStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{25, 0} + return fileDescriptor_d61ab7221f0b5518, []int{26, 0} } type SyncContactRequestDecision_DecisionStatus int32 @@ -104,14 +104,70 @@ func (x SyncContactRequestDecision_DecisionStatus) String() string { } func (SyncContactRequestDecision_DecisionStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{26, 0} + return fileDescriptor_d61ab7221f0b5518, []int{27, 0} +} + +// `FetchingBackedUpDataDetails` is used to describe how many messages a single backup data structure consists of +type FetchingBackedUpDataDetails struct { + DataNumber uint32 `protobuf:"varint,1,opt,name=data_number,json=dataNumber,proto3" json:"data_number,omitempty"` + TotalNumber uint32 `protobuf:"varint,2,opt,name=total_number,json=totalNumber,proto3" json:"total_number,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FetchingBackedUpDataDetails) Reset() { *m = FetchingBackedUpDataDetails{} } +func (m *FetchingBackedUpDataDetails) String() string { return proto.CompactTextString(m) } +func (*FetchingBackedUpDataDetails) ProtoMessage() {} +func (*FetchingBackedUpDataDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_d61ab7221f0b5518, []int{0} +} + +func (m *FetchingBackedUpDataDetails) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FetchingBackedUpDataDetails.Unmarshal(m, b) +} +func (m *FetchingBackedUpDataDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FetchingBackedUpDataDetails.Marshal(b, m, deterministic) +} +func (m *FetchingBackedUpDataDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_FetchingBackedUpDataDetails.Merge(m, src) +} +func (m *FetchingBackedUpDataDetails) XXX_Size() int { + return xxx_messageInfo_FetchingBackedUpDataDetails.Size(m) +} +func (m *FetchingBackedUpDataDetails) XXX_DiscardUnknown() { + xxx_messageInfo_FetchingBackedUpDataDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_FetchingBackedUpDataDetails proto.InternalMessageInfo + +func (m *FetchingBackedUpDataDetails) GetDataNumber() uint32 { + if m != nil { + return m.DataNumber + } + return 0 +} + +func (m *FetchingBackedUpDataDetails) GetTotalNumber() uint32 { + if m != nil { + return m.TotalNumber + } + return 0 } type Backup struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - Contacts []*SyncInstallationContactV2 `protobuf:"bytes,3,rep,name=contacts,proto3" json:"contacts,omitempty"` - Communities []*SyncCommunity `protobuf:"bytes,4,rep,name=communities,proto3" json:"communities,omitempty"` + Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + // this is what we already had + Contacts []*SyncInstallationContactV2 `protobuf:"bytes,3,rep,name=contacts,proto3" json:"contacts,omitempty"` + Communities []*SyncCommunity `protobuf:"bytes,4,rep,name=communities,proto3" json:"communities,omitempty"` + // newly added details to be backed up to and fetched from waku + ContactsDetails *FetchingBackedUpDataDetails `protobuf:"bytes,5,opt,name=contactsDetails,proto3" json:"contactsDetails,omitempty"` + CommunitiesDetails *FetchingBackedUpDataDetails `protobuf:"bytes,6,opt,name=communitiesDetails,proto3" json:"communitiesDetails,omitempty"` + Profile *BackedUpProfile `protobuf:"bytes,7,opt,name=profile,proto3" json:"profile,omitempty"` + ProfileDetails *FetchingBackedUpDataDetails `protobuf:"bytes,8,opt,name=profileDetails,proto3" json:"profileDetails,omitempty"` + Setting *SyncSetting `protobuf:"bytes,9,opt,name=setting,proto3" json:"setting,omitempty"` + SettingsDetails *FetchingBackedUpDataDetails `protobuf:"bytes,10,opt,name=settingsDetails,proto3" json:"settingsDetails,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -121,7 +177,7 @@ func (m *Backup) Reset() { *m = Backup{} } func (m *Backup) String() string { return proto.CompactTextString(m) } func (*Backup) ProtoMessage() {} func (*Backup) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{0} + return fileDescriptor_d61ab7221f0b5518, []int{1} } func (m *Backup) XXX_Unmarshal(b []byte) error { @@ -170,6 +226,48 @@ func (m *Backup) GetCommunities() []*SyncCommunity { return nil } +func (m *Backup) GetContactsDetails() *FetchingBackedUpDataDetails { + if m != nil { + return m.ContactsDetails + } + return nil +} + +func (m *Backup) GetCommunitiesDetails() *FetchingBackedUpDataDetails { + if m != nil { + return m.CommunitiesDetails + } + return nil +} + +func (m *Backup) GetProfile() *BackedUpProfile { + if m != nil { + return m.Profile + } + return nil +} + +func (m *Backup) GetProfileDetails() *FetchingBackedUpDataDetails { + if m != nil { + return m.ProfileDetails + } + return nil +} + +func (m *Backup) GetSetting() *SyncSetting { + if m != nil { + return m.Setting + } + return nil +} + +func (m *Backup) GetSettingsDetails() *FetchingBackedUpDataDetails { + if m != nil { + return m.SettingsDetails + } + return nil +} + type MultiAccount struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` @@ -188,7 +286,7 @@ func (m *MultiAccount) Reset() { *m = MultiAccount{} } func (m *MultiAccount) String() string { return proto.CompactTextString(m) } func (*MultiAccount) ProtoMessage() {} func (*MultiAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{1} + return fileDescriptor_d61ab7221f0b5518, []int{2} } func (m *MultiAccount) XXX_Unmarshal(b []byte) error { @@ -276,7 +374,7 @@ func (m *MultiAccount_ColourHash) Reset() { *m = MultiAccount_ColourHash func (m *MultiAccount_ColourHash) String() string { return proto.CompactTextString(m) } func (*MultiAccount_ColourHash) ProtoMessage() {} func (*MultiAccount_ColourHash) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{1, 0} + return fileDescriptor_d61ab7221f0b5518, []int{2, 0} } func (m *MultiAccount_ColourHash) XXX_Unmarshal(b []byte) error { @@ -322,7 +420,7 @@ func (m *MultiAccount_IdentityImage) Reset() { *m = MultiAccount_Identit func (m *MultiAccount_IdentityImage) String() string { return proto.CompactTextString(m) } func (*MultiAccount_IdentityImage) ProtoMessage() {} func (*MultiAccount_IdentityImage) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{1, 1} + return fileDescriptor_d61ab7221f0b5518, []int{2, 1} } func (m *MultiAccount_IdentityImage) XXX_Unmarshal(b []byte) error { @@ -412,7 +510,7 @@ func (m *LocalPairingPayload) Reset() { *m = LocalPairingPayload{} } func (m *LocalPairingPayload) String() string { return proto.CompactTextString(m) } func (*LocalPairingPayload) ProtoMessage() {} func (*LocalPairingPayload) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{2} + return fileDescriptor_d61ab7221f0b5518, []int{3} } func (m *LocalPairingPayload) XXX_Unmarshal(b []byte) error { @@ -466,7 +564,7 @@ func (m *LocalPairingPayload_Key) Reset() { *m = LocalPairingPayload_Key func (m *LocalPairingPayload_Key) String() string { return proto.CompactTextString(m) } func (*LocalPairingPayload_Key) ProtoMessage() {} func (*LocalPairingPayload_Key) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{2, 0} + return fileDescriptor_d61ab7221f0b5518, []int{3, 0} } func (m *LocalPairingPayload_Key) XXX_Unmarshal(b []byte) error { @@ -515,7 +613,7 @@ func (m *PairInstallation) Reset() { *m = PairInstallation{} } func (m *PairInstallation) String() string { return proto.CompactTextString(m) } func (*PairInstallation) ProtoMessage() {} func (*PairInstallation) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{3} + return fileDescriptor_d61ab7221f0b5518, []int{4} } func (m *PairInstallation) XXX_Unmarshal(b []byte) error { @@ -581,7 +679,7 @@ func (m *SyncInstallationContact) Reset() { *m = SyncInstallationContact func (m *SyncInstallationContact) String() string { return proto.CompactTextString(m) } func (*SyncInstallationContact) ProtoMessage() {} func (*SyncInstallationContact) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{4} + return fileDescriptor_d61ab7221f0b5518, []int{5} } func (m *SyncInstallationContact) XXX_Unmarshal(b []byte) error { @@ -675,7 +773,7 @@ func (m *SyncInstallationContactV2) Reset() { *m = SyncInstallationConta func (m *SyncInstallationContactV2) String() string { return proto.CompactTextString(m) } func (*SyncInstallationContactV2) ProtoMessage() {} func (*SyncInstallationContactV2) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{5} + return fileDescriptor_d61ab7221f0b5518, []int{6} } func (m *SyncInstallationContactV2) XXX_Unmarshal(b []byte) error { @@ -807,7 +905,7 @@ func (m *SyncInstallationAccount) Reset() { *m = SyncInstallationAccount func (m *SyncInstallationAccount) String() string { return proto.CompactTextString(m) } func (*SyncInstallationAccount) ProtoMessage() {} func (*SyncInstallationAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{6} + return fileDescriptor_d61ab7221f0b5518, []int{7} } func (m *SyncInstallationAccount) XXX_Unmarshal(b []byte) error { @@ -861,7 +959,7 @@ func (m *SyncInstallationPublicChat) Reset() { *m = SyncInstallationPubl func (m *SyncInstallationPublicChat) String() string { return proto.CompactTextString(m) } func (*SyncInstallationPublicChat) ProtoMessage() {} func (*SyncInstallationPublicChat) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{7} + return fileDescriptor_d61ab7221f0b5518, []int{8} } func (m *SyncInstallationPublicChat) XXX_Unmarshal(b []byte) error { @@ -918,7 +1016,7 @@ func (m *SyncCommunity) Reset() { *m = SyncCommunity{} } func (m *SyncCommunity) String() string { return proto.CompactTextString(m) } func (*SyncCommunity) ProtoMessage() {} func (*SyncCommunity) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{8} + return fileDescriptor_d61ab7221f0b5518, []int{9} } func (m *SyncCommunity) XXX_Unmarshal(b []byte) error { @@ -1040,7 +1138,7 @@ func (m *SyncCommunityRequestsToJoin) Reset() { *m = SyncCommunityReques func (m *SyncCommunityRequestsToJoin) String() string { return proto.CompactTextString(m) } func (*SyncCommunityRequestsToJoin) ProtoMessage() {} func (*SyncCommunityRequestsToJoin) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{9} + return fileDescriptor_d61ab7221f0b5518, []int{10} } func (m *SyncCommunityRequestsToJoin) XXX_Unmarshal(b []byte) error { @@ -1124,7 +1222,7 @@ func (m *SyncInstallation) Reset() { *m = SyncInstallation{} } func (m *SyncInstallation) String() string { return proto.CompactTextString(m) } func (*SyncInstallation) ProtoMessage() {} func (*SyncInstallation) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{10} + return fileDescriptor_d61ab7221f0b5518, []int{11} } func (m *SyncInstallation) XXX_Unmarshal(b []byte) error { @@ -1185,7 +1283,7 @@ func (m *SyncChatRemoved) Reset() { *m = SyncChatRemoved{} } func (m *SyncChatRemoved) String() string { return proto.CompactTextString(m) } func (*SyncChatRemoved) ProtoMessage() {} func (*SyncChatRemoved) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{11} + return fileDescriptor_d61ab7221f0b5518, []int{12} } func (m *SyncChatRemoved) XXX_Unmarshal(b []byte) error { @@ -1232,7 +1330,7 @@ func (m *SyncChatMessagesRead) Reset() { *m = SyncChatMessagesRead{} } func (m *SyncChatMessagesRead) String() string { return proto.CompactTextString(m) } func (*SyncChatMessagesRead) ProtoMessage() {} func (*SyncChatMessagesRead) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{12} + return fileDescriptor_d61ab7221f0b5518, []int{13} } func (m *SyncChatMessagesRead) XXX_Unmarshal(b []byte) error { @@ -1279,7 +1377,7 @@ func (m *SyncActivityCenterRead) Reset() { *m = SyncActivityCenterRead{} func (m *SyncActivityCenterRead) String() string { return proto.CompactTextString(m) } func (*SyncActivityCenterRead) ProtoMessage() {} func (*SyncActivityCenterRead) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{13} + return fileDescriptor_d61ab7221f0b5518, []int{14} } func (m *SyncActivityCenterRead) XXX_Unmarshal(b []byte) error { @@ -1326,7 +1424,7 @@ func (m *SyncActivityCenterAccepted) Reset() { *m = SyncActivityCenterAc func (m *SyncActivityCenterAccepted) String() string { return proto.CompactTextString(m) } func (*SyncActivityCenterAccepted) ProtoMessage() {} func (*SyncActivityCenterAccepted) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{14} + return fileDescriptor_d61ab7221f0b5518, []int{15} } func (m *SyncActivityCenterAccepted) XXX_Unmarshal(b []byte) error { @@ -1373,7 +1471,7 @@ func (m *SyncActivityCenterDismissed) Reset() { *m = SyncActivityCenterD func (m *SyncActivityCenterDismissed) String() string { return proto.CompactTextString(m) } func (*SyncActivityCenterDismissed) ProtoMessage() {} func (*SyncActivityCenterDismissed) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{15} + return fileDescriptor_d61ab7221f0b5518, []int{16} } func (m *SyncActivityCenterDismissed) XXX_Unmarshal(b []byte) error { @@ -1424,7 +1522,7 @@ func (m *SyncBookmark) Reset() { *m = SyncBookmark{} } func (m *SyncBookmark) String() string { return proto.CompactTextString(m) } func (*SyncBookmark) ProtoMessage() {} func (*SyncBookmark) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{16} + return fileDescriptor_d61ab7221f0b5518, []int{17} } func (m *SyncBookmark) XXX_Unmarshal(b []byte) error { @@ -1499,7 +1597,7 @@ func (m *SyncClearHistory) Reset() { *m = SyncClearHistory{} } func (m *SyncClearHistory) String() string { return proto.CompactTextString(m) } func (*SyncClearHistory) ProtoMessage() {} func (*SyncClearHistory) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{17} + return fileDescriptor_d61ab7221f0b5518, []int{18} } func (m *SyncClearHistory) XXX_Unmarshal(b []byte) error { @@ -1551,7 +1649,7 @@ func (m *SyncProfilePicture) Reset() { *m = SyncProfilePicture{} } func (m *SyncProfilePicture) String() string { return proto.CompactTextString(m) } func (*SyncProfilePicture) ProtoMessage() {} func (*SyncProfilePicture) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{18} + return fileDescriptor_d61ab7221f0b5518, []int{19} } func (m *SyncProfilePicture) XXX_Unmarshal(b []byte) error { @@ -1633,7 +1731,7 @@ func (m *SyncProfilePictures) Reset() { *m = SyncProfilePictures{} } func (m *SyncProfilePictures) String() string { return proto.CompactTextString(m) } func (*SyncProfilePictures) ProtoMessage() {} func (*SyncProfilePictures) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{19} + return fileDescriptor_d61ab7221f0b5518, []int{20} } func (m *SyncProfilePictures) XXX_Unmarshal(b []byte) error { @@ -1690,7 +1788,7 @@ func (m *SyncWalletAccount) Reset() { *m = SyncWalletAccount{} } func (m *SyncWalletAccount) String() string { return proto.CompactTextString(m) } func (*SyncWalletAccount) ProtoMessage() {} func (*SyncWalletAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{20} + return fileDescriptor_d61ab7221f0b5518, []int{21} } func (m *SyncWalletAccount) XXX_Unmarshal(b []byte) error { @@ -1806,7 +1904,7 @@ func (m *SyncWalletAccounts) Reset() { *m = SyncWalletAccounts{} } func (m *SyncWalletAccounts) String() string { return proto.CompactTextString(m) } func (*SyncWalletAccounts) ProtoMessage() {} func (*SyncWalletAccounts) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{21} + return fileDescriptor_d61ab7221f0b5518, []int{22} } func (m *SyncWalletAccounts) XXX_Unmarshal(b []byte) error { @@ -1850,7 +1948,7 @@ func (m *SyncSavedAddress) Reset() { *m = SyncSavedAddress{} } func (m *SyncSavedAddress) String() string { return proto.CompactTextString(m) } func (*SyncSavedAddress) ProtoMessage() {} func (*SyncSavedAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{22} + return fileDescriptor_d61ab7221f0b5518, []int{23} } func (m *SyncSavedAddress) XXX_Unmarshal(b []byte) error { @@ -1926,7 +2024,7 @@ func (m *SyncCommunitySettings) Reset() { *m = SyncCommunitySettings{} } func (m *SyncCommunitySettings) String() string { return proto.CompactTextString(m) } func (*SyncCommunitySettings) ProtoMessage() {} func (*SyncCommunitySettings) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{23} + return fileDescriptor_d61ab7221f0b5518, []int{24} } func (m *SyncCommunitySettings) XXX_Unmarshal(b []byte) error { @@ -1981,7 +2079,7 @@ func (m *SyncTrustedUser) Reset() { *m = SyncTrustedUser{} } func (m *SyncTrustedUser) String() string { return proto.CompactTextString(m) } func (*SyncTrustedUser) ProtoMessage() {} func (*SyncTrustedUser) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{24} + return fileDescriptor_d61ab7221f0b5518, []int{25} } func (m *SyncTrustedUser) XXX_Unmarshal(b []byte) error { @@ -2042,7 +2140,7 @@ func (m *SyncVerificationRequest) Reset() { *m = SyncVerificationRequest func (m *SyncVerificationRequest) String() string { return proto.CompactTextString(m) } func (*SyncVerificationRequest) ProtoMessage() {} func (*SyncVerificationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{25} + return fileDescriptor_d61ab7221f0b5518, []int{26} } func (m *SyncVerificationRequest) XXX_Unmarshal(b []byte) error { @@ -2139,7 +2237,7 @@ func (m *SyncContactRequestDecision) Reset() { *m = SyncContactRequestDe func (m *SyncContactRequestDecision) String() string { return proto.CompactTextString(m) } func (*SyncContactRequestDecision) ProtoMessage() {} func (*SyncContactRequestDecision) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{26} + return fileDescriptor_d61ab7221f0b5518, []int{27} } func (m *SyncContactRequestDecision) XXX_Unmarshal(b []byte) error { @@ -2181,10 +2279,75 @@ func (m *SyncContactRequestDecision) GetDecisionStatus() SyncContactRequestDecis return SyncContactRequestDecision_ACCEPTED } +// `BackedUpProfile` is used to describe profile of logged in user +type BackedUpProfile struct { + KeyUid string `protobuf:"bytes,1,opt,name=key_uid,json=keyUid,proto3" json:"key_uid,omitempty"` + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + DisplayNameClock uint64 `protobuf:"varint,3,opt,name=display_name_clock,json=displayNameClock,proto3" json:"display_name_clock,omitempty"` + Pictures []*SyncProfilePicture `protobuf:"bytes,4,rep,name=pictures,proto3" json:"pictures,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BackedUpProfile) Reset() { *m = BackedUpProfile{} } +func (m *BackedUpProfile) String() string { return proto.CompactTextString(m) } +func (*BackedUpProfile) ProtoMessage() {} +func (*BackedUpProfile) Descriptor() ([]byte, []int) { + return fileDescriptor_d61ab7221f0b5518, []int{28} +} + +func (m *BackedUpProfile) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BackedUpProfile.Unmarshal(m, b) +} +func (m *BackedUpProfile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BackedUpProfile.Marshal(b, m, deterministic) +} +func (m *BackedUpProfile) XXX_Merge(src proto.Message) { + xxx_messageInfo_BackedUpProfile.Merge(m, src) +} +func (m *BackedUpProfile) XXX_Size() int { + return xxx_messageInfo_BackedUpProfile.Size(m) +} +func (m *BackedUpProfile) XXX_DiscardUnknown() { + xxx_messageInfo_BackedUpProfile.DiscardUnknown(m) +} + +var xxx_messageInfo_BackedUpProfile proto.InternalMessageInfo + +func (m *BackedUpProfile) GetKeyUid() string { + if m != nil { + return m.KeyUid + } + return "" +} + +func (m *BackedUpProfile) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *BackedUpProfile) GetDisplayNameClock() uint64 { + if m != nil { + return m.DisplayNameClock + } + return 0 +} + +func (m *BackedUpProfile) GetPictures() []*SyncProfilePicture { + if m != nil { + return m.Pictures + } + return nil +} + func init() { proto.RegisterEnum("protobuf.SyncTrustedUser_TrustStatus", SyncTrustedUser_TrustStatus_name, SyncTrustedUser_TrustStatus_value) proto.RegisterEnum("protobuf.SyncVerificationRequest_VerificationStatus", SyncVerificationRequest_VerificationStatus_name, SyncVerificationRequest_VerificationStatus_value) proto.RegisterEnum("protobuf.SyncContactRequestDecision_DecisionStatus", SyncContactRequestDecision_DecisionStatus_name, SyncContactRequestDecision_DecisionStatus_value) + proto.RegisterType((*FetchingBackedUpDataDetails)(nil), "protobuf.FetchingBackedUpDataDetails") proto.RegisterType((*Backup)(nil), "protobuf.Backup") proto.RegisterType((*MultiAccount)(nil), "protobuf.MultiAccount") proto.RegisterType((*MultiAccount_ColourHash)(nil), "protobuf.MultiAccount.ColourHash") @@ -2215,6 +2378,7 @@ func init() { proto.RegisterType((*SyncTrustedUser)(nil), "protobuf.SyncTrustedUser") proto.RegisterType((*SyncVerificationRequest)(nil), "protobuf.SyncVerificationRequest") proto.RegisterType((*SyncContactRequestDecision)(nil), "protobuf.SyncContactRequestDecision") + proto.RegisterType((*BackedUpProfile)(nil), "protobuf.BackedUpProfile") } func init() { @@ -2222,129 +2386,141 @@ func init() { } var fileDescriptor_d61ab7221f0b5518 = []byte{ - // 1977 bytes of a gzipped FileD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- 0xd7, 0x5a, 0xae, 0x1c, 0x23, 0x26, 0x39, 0xb3, 0xaa, 0x9f, 0x72, 0x8c, 0x2b, 0x63, 0xec, 0x91, - 0x14, 0xa8, 0x27, 0x5f, 0x2e, 0xa2, 0x76, 0x42, 0xc4, 0x4c, 0x13, 0x2b, 0x39, 0xc6, 0x5e, 0x52, - 0x94, 0x70, 0xf9, 0x80, 0xe9, 0x96, 0x6b, 0x7a, 0x1e, 0xef, 0x76, 0x29, 0xde, 0x78, 0x1e, 0x7c, - 0x65, 0xca, 0xbe, 0xd4, 0x76, 0x95, 0x20, 0xa3, 0xca, 0x82, 0x80, 0x46, 0xba, 0x21, 0x69, 0x69, - 0x33, 0xd3, 0x72, 0x5e, 0xa9, 0x0c, 0xab, 0x38, 0x8b, 0x5b, 0x9f, 0x42, 0x4b, 0xd7, 0xbc, 0xbc, - 0x5a, 0xdf, 0xaf, 0x7a, 0xbf, 0xa2, 0xef, 0x16, 0xca, 0xce, 0x1f, 0x0d, 0x95, 0xfe, 0x47, 0xe4, - 0x82, 0x06, 0x43, 0xed, 0xcb, 0x92, 0x97, 0x8d, 0xaa, 0x97, 0xd7, 0xbd, 0x28, 0x77, 0xa0, 0x7d, - 0x46, 0x2e, 0xe2, 0x65, 0xca, 0x04, 0xd5, 0xce, 0x5f, 0x01, 0xd8, 0xc9, 0xfc, 0x19, 0x61, 0xf2, - 0x21, 0x53, 0x97, 0xa1, 0x6c, 0x4a, 0x79, 0x12, 0x5c, 0x73, 0x65, 0x1f, 0x41, 0x57, 0xb1, 0x2f, - 0xaf, 0x9c, 0x99, 0x1d, 0x85, 0x8d, 0x64, 0x7e, 0xfe, 0xc6, 0x80, 0xff, 0x5b, 0xcb, 0x07, 0x36, - 0x64, 0xce, 0xe5, 0xee, 0xa8, 0x4e, 0x50, 0xe9, 0x8e, 0x63, 0x78, 0x38, 0x53, 0x05, 0xc0, 0x23, - 0xa9, 0x3f, 0x63, 0x17, 0xd4, 0xe3, 0xcb, 0x24, 0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, 0xaa, - 0x67, 0xd7, 0x9c, 0x7a, 0xff, 0xcd, 0x95, 0x27, 0xc9, 0xda, 0x67, 0x8a, 0x8a, 0x61, 0xbb, 0x68, - 0xe0, 0x3f, 0x02, 0xeb, 0xea, 0xcc, 0x2b, 0xb1, 0x38, 0x1c, 0x4f, 0x0f, 0x26, 0xd3, 0xaf, 0x06, - 0x86, 0xd5, 0x85, 0xd6, 0x70, 0x34, 0x1a, 0x1f, 0x62, 0x64, 0x6a, 0x28, 0x1d, 0x8c, 0x47, 0x2f, - 0x27, 0xd3, 0xf1, 0xc1, 0xc0, 0x44, 0x69, 0x34, 0x9c, 0x8e, 0xc6, 0x2f, 0xc7, 0x07, 0x83, 0xba, - 0xf3, 0x77, 0x43, 0x75, 0xf6, 0x9c, 0x6c, 0x29, 0x3b, 0x0f, 0xa8, 0xcf, 0xf8, 0xe6, 0xbf, 0x13, - 0x76, 0xa0, 0xad, 0xfd, 0x39, 0xc9, 0x33, 0x6d, 0x05, 0x58, 0x3f, 0x85, 0xad, 0x40, 0xcf, 0xf7, - 0x2a, 0x99, 0xf7, 0xc9, 0x65, 0x8e, 0xb4, 0x6e, 0xcb, 0xfd, 0x7c, 0xa0, 0xdd, 0xd3, 0x0f, 0x2a, - 0xb2, 0xf3, 0x2d, 0xe8, 0x57, 0x35, 0x2a, 0x87, 0x7d, 0xaf, 0x72, 0x58, 0xe3, 0x59, 0xef, 0x27, - 0x9d, 0xfd, 0x8f, 0x9f, 0xe6, 0xdb, 0x9e, 0x36, 0xe4, 0xe8, 0x93, 0x7f, 0x05, 0x00, 0x00, 0xff, - 0xff, 0x8d, 0x35, 0xba, 0x88, 0x16, 0x15, 0x00, 0x00, + // 2174 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x51, 0x73, 0x1b, 0x49, + 0x11, 0xbe, 0xd5, 0x2a, 0x96, 0xd4, 0x92, 0x6d,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 0x6d, 0x7b, + 0x9a, 0x92, 0x0f, 0xe0, 0x4a, 0x10, 0x25, 0xc1, 0x29, 0x1a, 0xaa, 0x53, 0x43, 0x90, 0x0d, 0xa8, + 0x89, 0x10, 0x35, 0x5b, 0xb4, 0x26, 0x42, 0xf2, 0x63, 0x68, 0x06, 0x49, 0xac, 0x58, 0xa0, 0x64, + 0xcf, 0xdd, 0x76, 0x1f, 0xb4, 0x1f, 0xde, 0xdb, 0x29, 0x4e, 0xb1, 0x73, 0x90, 0xc7, 0xc1, 0x30, + 0x96, 0x8a, 0x45, 0x11, 0x53, 0x22, 0x89, 0x07, 0x46, 0xf2, 0xd5, 0x43, 0x3a, 0x53, 0x22, 0x3f, + 0x82, 0x76, 0x90, 0x4c, 0x26, 0xd3, 0x58, 0x28, 0xc1, 0x65, 0xaf, 0x8e, 0x36, 0xae, 0x57, 0x6d, + 0x0c, 0xac, 0x40, 0x4e, 0xcb, 0xb2, 0xe4, 0x25, 0x6c, 0x16, 0x66, 0x6c, 0x0c, 0x7a, 0x57, 0xb6, + 0x9d, 0x07, 0xed, 0x87, 0xf7, 0xe7, 0xea, 0x17, 0x04, 0x8c, 0x2e, 0x6a, 0x93, 0x23, 0x20, 0x25, + 0xfb, 0x85, 0xcd, 0xb5, 0x77, 0xb1, 0xb9, 0xc4, 0x00, 0x79, 0x04, 0x8d, 0x34, 0x4b, 0xde, 0x88, + 0x88, 0xf7, 0x1a, 0x68, 0xeb, 0xc6, 0xdc, 0x56, 0x61, 0x63, 0xdf, 0x08, 0xd0, 0x42, 0x92, 0xbc, + 0x80, 0x0d, 0xbb, 0x2c, 0xfc, 0x68, 0xbe, 0x8b, 0x1f, 0x0b, 0xca, 0xe4, 0x13, 0x68, 0xd8, 0x6a, + 0xea, 0xb5, 0xd0, 0xce, 0x87, 0xd5, 0x10, 0x1f, 0x98, 0x4d, 0x5a, 0x48, 0xe9, 0xe0, 0x16, 0xe5, + 0x57, 0x38, 0x00, 0xef, 0x14, 0xdc, 0x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, 0xbb, 0xae, 0xa6, 0x06, + 0xfd, 0xd1, 0x60, 0xef, 0xf9, 0xde, 0x6e, 0xb7, 0xee, 0xfd, 0xd3, 0x31, 0x93, 0xbd, 0x00, 0x5b, + 0xc6, 0xcf, 0x5d, 0x1e, 0x08, 0xb9, 0xfa, 0xef, 0x84, 0x5b, 0xd0, 0xb2, 0xf1, 0x1c, 0x16, 0x95, + 0x36, 0x67, 0x90, 0x5f, 0xc0, 0x66, 0x68, 0xf5, 0xfd, 0x4a, 0xe5, 0x3d, 0x5a, 0xc4, 0x48, 0xcb, + 0x3e, 0xb9, 0x53, 0x2c, 0x6c, 0x78, 0x36, 0xc2, 0x0a, 0xed, 0x7d, 0x0c, 0x1b, 0x55, 0x89, 0xca, + 0x61, 0xdf, 0xab, 0x1c, 0xd6, 0xf1, 0xbe, 0x75, 0x60, 0x73, 0xe1, 0x6f, 0xd2, 0xd5, 0xd3, 0xe6, + 0x2e, 0x74, 0x42, 0x21, 0xd3, 0x88, 0xe5, 0x7e, 0xa9, 0x1f, 0xb5, 0x2d, 0x0f, 0x71, 0xf2, 0xc7, + 0x40, 0xca, 0x22, 0x7e, 0x19, 0x65, 0x77, 0x4b, 0x82, 0xd8, 0x4e, 0x2a, 0xe3, 0xab, 0xfe, 0x2e, + 0xe3, 0xeb, 0xc9, 0xfa, 0xcf, 0xdb, 0x3b, 0x9f, 0x3c, 0x2e, 0x64, 0x8f, 0xd7, 0x70, 0xf5, 0xe8, + 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x30, 0x89, 0x4d, 0x75, 0xf4, 0x17, 0x00, 0x00, } diff --git a/protocol/protobuf/pairing.proto b/protocol/protobuf/pairing.proto index 8f49a9d65..4b3ecb57a 100644 --- a/protocol/protobuf/pairing.proto +++ b/protocol/protobuf/pairing.proto @@ -1,14 +1,30 @@ syntax = "proto3"; +import "sync_settings.proto"; + option go_package = "./;protobuf"; package protobuf; +/* `FetchingBackedUpDataDetails` is used to describe how many messages a single backup data structure consists of */ +message FetchingBackedUpDataDetails { + uint32 data_number = 1; + uint32 total_number = 2; +} + message Backup { uint64 clock = 1; string id = 2; +/* this is what we already had */ repeated SyncInstallationContactV2 contacts = 3; repeated SyncCommunity communities = 4; +/* newly added details to be backed up to and fetched from waku */ + FetchingBackedUpDataDetails contactsDetails = 5; + FetchingBackedUpDataDetails communitiesDetails = 6; + BackedUpProfile profile = 7; + FetchingBackedUpDataDetails profileDetails = 8; + SyncSetting setting = 9; + FetchingBackedUpDataDetails settingsDetails = 10; } message MultiAccount { @@ -255,3 +271,11 @@ message SyncContactRequestDecision { DECLINED = 1; } } + +/* `BackedUpProfile` is used to describe profile of logged in user */ +message BackedUpProfile { + string key_uid = 1; + string display_name = 2; + uint64 display_name_clock = 3; + repeated SyncProfilePicture pictures = 4; +} diff --git a/protocol/protobuf/sync_settings.pb.go b/protocol/protobuf/sync_settings.pb.go index 16d909e18..cc913a6b3 100644 --- a/protocol/protobuf/sync_settings.pb.go +++ b/protocol/protobuf/sync_settings.pb.go @@ -36,6 +36,7 @@ const ( SyncSetting_STICKERS_PACKS_INSTALLED SyncSetting_Type = 10 SyncSetting_STICKERS_PACKS_PENDING SyncSetting_Type = 11 SyncSetting_STICKERS_RECENT_STICKERS SyncSetting_Type = 12 + SyncSetting_DISPLAY_NAME SyncSetting_Type = 13 ) var SyncSetting_Type_name = map[int32]string{ @@ -52,6 +53,7 @@ var SyncSetting_Type_name = map[int32]string{ 10: "STICKERS_PACKS_INSTALLED", 11: "STICKERS_PACKS_PENDING", 12: "STICKERS_RECENT_STICKERS", + 13: "DISPLAY_NAME", } var SyncSetting_Type_value = map[string]int32{ @@ -68,6 +70,7 @@ var SyncSetting_Type_value = map[string]int32{ "STICKERS_PACKS_INSTALLED": 10, "STICKERS_PACKS_PENDING": 11, "STICKERS_RECENT_STICKERS": 12, + "DISPLAY_NAME": 13, } func (x SyncSetting_Type) String() string { @@ -215,33 +218,34 @@ func init() { } var fileDescriptor_e2f7a0bce2873c78 = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0xcd, 0x8e, 0xd3, 0x30, - 0x10, 0x80, 0x9b, 0x36, 0xfd, 0x9b, 0x94, 0x5d, 0xcb, 0x45, 0x10, 0x2d, 0x48, 0x1b, 0x96, 0x4b, - 0x4e, 0x41, 0x02, 0xc4, 0x85, 0x53, 0x9a, 0x38, 0xad, 0xd5, 0xd4, 0x89, 0x6c, 0xa7, 0x55, 0xb9, - 0x58, 0xb4, 0x0a, 0xab, 0x8a, 0x2a, 0xa9, 0x36, 0x29, 0x52, 0x9e, 0x89, 0x97, 0xe0, 0xd1, 0x50, - 0x12, 0xca, 0xdf, 0x9e, 0xec, 0xf9, 0xe6, 0x9b, 0xf1, 0x68, 0x64, 0x98, 0x16, 0x55, 0xb6, 0x57, - 0x45, 0x5a, 0x96, 0x87, 0xec, 0xbe, 0x70, 0x4e, 0x0f, 0x79, 0x99, 0xe3, 0x51, 0x73, 0xec, 0xce, - 0x5f, 0xee, 0xbe, 0xeb, 0x60, 0x88, 0x2a, 0xdb, 0x8b, 0x56, 0xc0, 0x0e, 0xe8, 0x65, 0x75, 0x4a, - 0x4d, 0xcd, 0xd2, 0xec, 0xab, 0xb7, 0x37, 0xce, 0x45, 0x74, 0xfe, 0x92, 0x1c, 0x59, 0x9d, 0x52, - 0xde, 0x78, 0xf8, 0x29, 0xf4, 0xf7, 0xc7, 0x7c, 0xff, 0xd5, 0xec, 0x5a, 0x9a, 0xad, 0xf3, 0x36, - 0xc0, 0xaf, 0x61, 0xf2, 0xed, 0xf3, 0xf1, 0x9c, 0xaa, 0xa2, 0x7c, 0x38, 0x64, 0xf7, 0x66, 0xcf, - 0xd2, 0xec, 0xf1, 0xa2, 0xc3, 0x8d, 0x86, 0x8a, 0x06, 0xe2, 0x57, 0xd0, 0x86, 0x6a, 0x57, 0x95, - 0x69, 0x61, 0xea, 0x96,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, 0x20, 0xcc, 0x57, 0x42, 0xba, 0x32, - 0x11, 0x2a, 0x89, 0x7d, 0xb7, 0x9e, 0x70, 0x5c, 0xf7, 0x15, 0x92, 0x7a, 0x4b, 0xc2, 0x85, 0x8a, - 0x5d, 0x6f, 0x29, 0x14, 0x65, 0x42, 0xba, 0x61, 0x48, 0x7c, 0x04, 0xf8, 0x06, 0x9e, 0xfd, 0x97, - 0x8d, 0x09, 0xf3, 0x29, 0x9b, 0x23, 0xe3, 0x9f, 0xca, 0x76, 0x0b, 0xea, 0x12, 0xa3, 0xc9, 0x6c, - 0x08, 0xfd, 0x76, 0xe5, 0x4f, 0x3e, 0x19, 0xce, 0x9b, 0x8f, 0x97, 0x3f, 0xb1, 0x1b, 0x34, 0xb7, - 0x77, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x91, 0x74, 0x80, 0x25, 0x64, 0x02, 0x00, 0x00, + // 458 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0xcd, 0x8e, 0xda, 0x30, + 0x10, 0x80, 0xc9, 0x12, 0xfe, 0x26, 0xec, 0xae, 0x65, 0xaa, 0x36, 0xda, 0x56, 0xda, 0x74, 0x7b, + 0xc9, 0x29, 0x95, 0xda, 0xaa, 0x97, 0x9e, 0x4c, 0x62, 0xc0, 0x22, 0x38, 0x91, 0xc7, 0x01, 0xd1, + 0x8b, 0x55, 0x10, 0x5d, 0xa1, 0x22, 0x82, 0x96, 0x6c, 0x25, 0x1e, 0xae, 0x2f, 0xd1, 0x27, 0xaa, + 0x92, 0x94, 0xfe, 0x9e, 0x92, 0xf9, 0xe6, 0x9b, 0xf1, 0xf8, 0x07, 0x06, 0xc7, 0xd3, 0x7e, 0x6d, + 0x8e, 0x9b, 0xa2, 0xd8, 0xee, 0xef, 0x8f, 0xc1, 0xe1, 0x21, 0x2f, 0x72, 0xda, 0xad, 0x3e, 0xab, + 0x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xc2, 0xf3, 0x19, 0x47, 0x64, 0x63, 0x8e, 0x66, 0xa4, 0x92, 0x99, + 0x09, 0x13, 0xa9, 0x59, 0xa8, 0xd1, 0x24, 0x32, 0x5e, 0x12, 0xbb, 0x2c, 0x4a, 0x15, 0x1f, 0x71, + 0xa5, 0x78, 0x64, 0x24, 0x9b, 0x71, 0xd2, 0xa2, 0x03, 0xb8, 0x4e, 0x15, 0x9f, 0x0b, 0xbe, 0x30, + 0xa9, 0x12, 0x73, 0x16, 0x2e, 0x49, 0x9b, 0xbe, 0x00, 0x37, 0x55, 0xc9, 0x48, 0xc4, 0xdc, 0xa4, + 0x22, 0xd4, 0x99, 0xe2, 0x68, 0x70, 0x92, 0x2c, 0x8c, 0x4e, 0x48, 0xa7, 0x5c, 0xe7, 0xbf, 0xec, + 0x5c, 0xa0, 0x18, 0x8a, 0x58, 0xe8, 0x25, 0xe9, 0xd2, 0x67, 0x30, 0x40, 0x2e, 0x23, 0x83, 0x9a, + 0xe9, 0x0c, 0x4d, 0x96, 0x46, 0xac, 0x9c, 0xb0, 0x57, 0xf6, 0x45, 0x2d, 0xc2, 0x29, 0x57, 0x68, + 0x52, 0x16, 0x4e, 0xd1, 0x08, 0x89, 0x9a, 0xc5, 0x31, 0x8f, 0x08, 0xd0, 0x1b, 0x78, 0xfa, 0x4f, + 0x36, 0xe5, 0x32, 0x12, 0x72, 0x4c, 0x9c, 0xbf, 0x2a, 0xeb, 0x53, 0x30, 0xe7, 0x98, 0xf4, 0x29, + 0x81, 0x7e, 0x24, 0x30, 0x8d, 0xd9, 0xb2, 0xde, 0xd6, 0xe5, 0xb0, 0x03, 0xad, 0xfa, 0x12, 0x2e, + 0x3f, 0x3a, 0xc1, 0xeb, 0x0f, 0xe7, 0x57, 0xb2, 0x6a, 0x57, 0x7f, 0x6f, 0x7f, 0x04, 0x00, 0x00, + 0xff, 0xff, 0x8b, 0x2e, 0x81, 0x96, 0x76, 0x02, 0x00, 0x00, } diff --git a/protocol/protobuf/sync_settings.proto b/protocol/protobuf/sync_settings.proto index cfe3d1754..899b5fbb0 100644 --- a/protocol/protobuf/sync_settings.proto +++ b/protocol/protobuf/sync_settings.proto @@ -28,6 +28,7 @@ message SyncSetting { STICKERS_PACKS_INSTALLED = 10; STICKERS_PACKS_PENDING = 11; STICKERS_RECENT_STICKERS = 12; + DISPLAY_NAME = 13; } } diff --git a/protocol/wakusync/profile_response.go b/protocol/wakusync/profile_response.go new file mode 100644 index 000000000..d1ce6fa44 --- /dev/null +++ b/protocol/wakusync/profile_response.go @@ -0,0 +1,22 @@ +package wakusync + +import ( + "github.com/status-im/status-go/images" +) + +type BackedUpProfile struct { + DisplayName string `json:"displayName,omitempty"` + DisplayNameStored bool `json:"displayNameStored,omitempty"` + Images []images.IdentityImage `json:"images,omitempty,omitempty"` + ImagesStored bool `json:"imagesStored,omitempty"` +} + +func (sfwr *WakuBackedUpDataResponse) AddDisplayName(displayName string, stored bool) { + sfwr.Profile.DisplayName = displayName + sfwr.Profile.DisplayNameStored = stored +} + +func (sfwr *WakuBackedUpDataResponse) AddImages(images []images.IdentityImage, stored bool) { + sfwr.Profile.ImagesStored = stored + sfwr.Profile.Images = images +} diff --git a/protocol/wakusync/progress_response.go b/protocol/wakusync/progress_response.go new file mode 100644 index 000000000..28311653d --- /dev/null +++ b/protocol/wakusync/progress_response.go @@ -0,0 +1,36 @@ +package wakusync + +import ( + "github.com/status-im/status-go/protocol/protobuf" +) + +type FetchingBackupedDataDetails struct { + DataNumber uint32 `json:"dataNumber,omitempty"` + TotalNumber uint32 `json:"totalNumber,omitempty"` +} + +func (sfwr *WakuBackedUpDataResponse) AddFetchingBackedUpDataDetails(section string, details *protobuf.FetchingBackedUpDataDetails) { + if details == nil { + return + } + if sfwr.FetchingDataProgress == nil { + sfwr.FetchingDataProgress = make(map[string]protobuf.FetchingBackedUpDataDetails) + } + + sfwr.FetchingDataProgress[section] = *details +} + +func (sfwr *WakuBackedUpDataResponse) FetchingBackedUpDataDetails() map[string]FetchingBackupedDataDetails { + if len(sfwr.FetchingDataProgress) == 0 { + return nil + } + + result := make(map[string]FetchingBackupedDataDetails) + for section, details := range sfwr.FetchingDataProgress { + result[section] = FetchingBackupedDataDetails{ + DataNumber: details.DataNumber, + TotalNumber: details.TotalNumber, + } + } + return result +} diff --git a/protocol/wakusync/response.go b/protocol/wakusync/response.go new file mode 100644 index 000000000..af0cb5b67 --- /dev/null +++ b/protocol/wakusync/response.go @@ -0,0 +1,29 @@ +package wakusync + +import ( + "encoding/json" + + "github.com/status-im/status-go/multiaccounts/settings" + "github.com/status-im/status-go/protocol/protobuf" +) + +type WakuBackedUpDataResponse struct { + FetchingDataProgress map[string]protobuf.FetchingBackedUpDataDetails // key represents the data/section backup details refer to + Profile *BackedUpProfile + Setting *settings.SyncSettingField +} + +func (sfwr *WakuBackedUpDataResponse) MarshalJSON() ([]byte, error) { + responseItem := struct { + FetchingDataProgress map[string]FetchingBackupedDataDetails `json:"fetchingBackedUpDataProgress,omitempty"` + Profile *BackedUpProfile `json:"backedUpProfile,omitempty"` + Setting *settings.SyncSettingField `json:"backedUpSettings,omitempty"` + }{ + Profile: sfwr.Profile, + Setting: sfwr.Setting, + } + + responseItem.FetchingDataProgress = sfwr.FetchingBackedUpDataDetails() + + return json.Marshal(responseItem) +} diff --git a/services/ext/api.go b/services/ext/api.go index 163405341..30851495a 100644 --- a/services/ext/api.go +++ b/services/ext/api.go @@ -789,7 +789,7 @@ func (api *PublicAPI) SendContactUpdate(ctx context.Context, contactID, name, pi } func (api *PublicAPI) SetDisplayName(ctx context.Context, displayName string) error { - return api.service.messenger.SetDisplayName(displayName) + return api.service.messenger.SetDisplayName(displayName, true) } func (api *PublicAPI) MarkAsTrusted(ctx context.Context, contactID string) error { diff --git a/services/ext/signal.go b/services/ext/signal.go index 71fe2081d..dc586b3e2 100644 --- a/services/ext/signal.go +++ b/services/ext/signal.go @@ -5,6 +5,7 @@ import ( "github.com/status-im/status-go/protocol" "github.com/status-im/status-go/protocol/communities" "github.com/status-im/status-go/protocol/discord" + "github.com/status-im/status-go/protocol/wakusync" "github.com/status-im/status-go/signal" ) @@ -143,3 +144,15 @@ func (m *MessengerSignalsHandler) DiscordCommunityImportFinished(id string) { func (m *MessengerSignalsHandler) DiscordCommunityImportCancelled(id string) { signal.SendDiscordCommunityImportCancelled(id) } + +func (m *MessengerSignalsHandler) SendWakuFetchingBackupProgress(response *wakusync.WakuBackedUpDataResponse) { + signal.SendWakuFetchingBackupProgress(response) +} + +func (m *MessengerSignalsHandler) SendWakuBackedUpProfile(response *wakusync.WakuBackedUpDataResponse) { + signal.SendWakuBackedUpProfile(response) +} + +func (m *MessengerSignalsHandler) SendWakuBackedUpSettings(response *wakusync.WakuBackedUpDataResponse) { + signal.SendWakuBackedUpSettings(response) +} diff --git a/signal/events_sync_from_waku.go b/signal/events_sync_from_waku.go new file mode 100644 index 000000000..8f7372e60 --- /dev/null +++ b/signal/events_sync_from_waku.go @@ -0,0 +1,26 @@ +package signal + +import "encoding/json" + +const ( + // EventWakuFetchingBackupProgress is triggered during the syncing from waku + EventWakuFetchingBackupProgress = "waku.fetching.backup.progress" + + // EventSyncFromWakuProfile is triggered during the syncing user profile from waku + EventWakuBackedUpProfile = "waku.backedup.profile" + + // EventWakuBackedUpSettings is triggered during the syncing user settings from waku + EventWakuBackedUpSettings = "waku.backedup.settings" +) + +func SendWakuFetchingBackupProgress(obj json.Marshaler) { + send(EventWakuFetchingBackupProgress, obj) +} + +func SendWakuBackedUpProfile(obj json.Marshaler) { + send(EventWakuBackedUpProfile, obj) +} + +func SendWakuBackedUpSettings(obj json.Marshaler) { + send(EventWakuBackedUpSettings, obj) +}