Skip to content

Commit 1e18cd8

Browse files
committed
fix avatars again
1 parent d5ae92a commit 1e18cd8

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/HelperGeneric.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,42 @@ static byte[] read_chunk_from_SD_file(String file_name_with_path, long position,
17721772
return out;
17731773
}
17741774

1775-
static void write_chunk_to_VFS_file(String file_name_with_path, final long position, long file_chunk_length, final byte[] data)
1775+
static void write_chunk_to_VFS_file(String file_name_with_path, long position, long file_chunk_length, final byte[] data)
1776+
{
1777+
try
1778+
{
1779+
final ByteBuffer data_bb = ByteBuffer.wrap(data);
1780+
info.guardianproject.iocipher.RandomAccessFile raf = new info.guardianproject.iocipher.RandomAccessFile(
1781+
file_name_with_path, "rw");
1782+
info.guardianproject.iocipher.IOCipherFileChannel inChannel = raf.getChannel();
1783+
// inChannel.lseek(position, OsConstants.SEEK_SET);
1784+
inChannel.write(data_bb, position);
1785+
1786+
try
1787+
{
1788+
inChannel.close();
1789+
}
1790+
catch (Exception e)
1791+
{
1792+
e.printStackTrace();
1793+
}
1794+
1795+
try
1796+
{
1797+
raf.close();
1798+
}
1799+
catch (Exception e)
1800+
{
1801+
e.printStackTrace();
1802+
}
1803+
}
1804+
catch (Exception e)
1805+
{
1806+
e.printStackTrace();
1807+
}
1808+
}
1809+
1810+
static void Xwrite_chunk_to_VFS_file(String file_name_with_path, final long position, long file_chunk_length, final byte[] data)
17761811
{
17771812
try
17781813
{

android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4804,7 +4804,7 @@ else if (file_size == 0)
48044804
}
48054805

48064806

4807-
Log.i(TAG, "file_recv:incoming avatar");
4807+
Log.i(TAG, "file_recv:incoming avatar:size=" + file_size);
48084808
String file_name_avatar = FRIEND_AVATAR_FILENAME;
48094809
Filetransfer f = new Filetransfer();
48104810
f.tox_public_key_string = HelperFriend.tox_friend_get_public_key__wrapper(friend_number);
@@ -5021,6 +5021,8 @@ static void android_tox_callback_file_recv_chunk_cb_method(long friend_number, l
50215021
HelperFriend.set_friend_avatar(HelperFriend.tox_friend_get_public_key__wrapper(friend_number),
50225022
VFS_PREFIX + VFS_FILE_DIR + "/" + f.tox_public_key_string + "/",
50235023
f.file_name);
5024+
// Log.i(TAG, "file_recv_chunk:kind=avatar:set_friend_avatar:" + VFS_PREFIX + VFS_FILE_DIR + "/" +
5025+
// f.tox_public_key_string + "/" + f.file_name);
50245026
}
50255027
else
50265028
{

0 commit comments

Comments
 (0)