mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove Android references from wrapper and make it standalone usable
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
package com.b44t.messenger;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class DcChatlist {
|
||||
|
||||
public DcChatlist(long chatlistCPtr) {
|
||||
@@ -17,10 +14,10 @@ public class DcChatlist {
|
||||
|
||||
public native int getCnt ();
|
||||
public native int getChatId (int index);
|
||||
public @NonNull DcChat getChat (int index) { return new DcChat(getChatCPtr(index)); }
|
||||
public DcChat getChat (int index) { return new DcChat(getChatCPtr(index)); }
|
||||
public native int getMsgId (int index);
|
||||
public @NonNull DcMsg getMsg (int index) { return new DcMsg(getMsgCPtr(index)); }
|
||||
public @NonNull DcLot getSummary(int index, @Nullable DcChat chat) { return new DcLot(getSummaryCPtr(index, chat==null? 0 : chat.getChatCPtr())); }
|
||||
public DcMsg getMsg (int index) { return new DcMsg(getMsgCPtr(index)); }
|
||||
public DcLot getSummary(int index, DcChat chat) { return new DcLot(getSummaryCPtr(index, chat==null? 0 : chat.getChatCPtr())); }
|
||||
|
||||
public class Item {
|
||||
public DcLot summary;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
|
||||
public class DcContact {
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.b44t.messenger;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class DcContext {
|
||||
|
||||
public final static int DC_PREF_DEFAULT_MDNS_ENABLED = 1;
|
||||
@@ -124,14 +121,14 @@ public class DcContext {
|
||||
public native int lookupContactIdByAddr(String addr);
|
||||
public native int[] getContacts (int flags, String query);
|
||||
public native int[] getBlockedContacts ();
|
||||
public @NonNull DcContact getContact (int contact_id) { return new DcContact(getContactCPtr(contact_id)); }
|
||||
public DcContact getContact (int contact_id) { return new DcContact(getContactCPtr(contact_id)); }
|
||||
public native int createContact (String name, String addr);
|
||||
public native void blockContact (int id, int block);
|
||||
public native String getContactEncrInfo (int contact_id);
|
||||
public native boolean deleteContact (int id);
|
||||
public native int addAddressBook (String adrbook);
|
||||
public @NonNull DcChatlist getChatlist (int listflags, String query, int queryId) { return new DcChatlist(getChatlistCPtr(listflags, query, queryId)); }
|
||||
public @NonNull DcChat getChat (int chat_id) { return new DcChat(getChatCPtr(chat_id)); }
|
||||
public DcChatlist getChatlist (int listflags, String query, int queryId) { return new DcChatlist(getChatlistCPtr(listflags, query, queryId)); }
|
||||
public DcChat getChat (int chat_id) { return new DcChat(getChatCPtr(chat_id)); }
|
||||
public native String getChatEncrInfo (int chat_id);
|
||||
public native void markseenMsgs (int msg_ids[]);
|
||||
public native void marknoticedChat (int chat_id);
|
||||
@@ -143,7 +140,7 @@ public class DcContext {
|
||||
public native int addContactToChat (int chat_id, int contact_id);
|
||||
public native int removeContactFromChat(int chat_id, int contact_id);
|
||||
public native void setDraft (int chat_id, DcMsg msg/*null=delete*/);
|
||||
public @Nullable DcMsg getDraft (int chat_id) { return new DcMsg(getDraftCPtr(chat_id)); }
|
||||
public DcMsg getDraft (int chat_id) { return new DcMsg(getDraftCPtr(chat_id)); }
|
||||
public native int setChatName (int chat_id, String name);
|
||||
public native int setChatProfileImage (int chat_id, String name);
|
||||
public native int[] getChatMsgs (int chat_id, int flags, int marker1before);
|
||||
@@ -157,7 +154,7 @@ public class DcContext {
|
||||
public native boolean setChatMuteDuration (int chat_id, long duration);
|
||||
public native void deleteChat (int chat_id);
|
||||
public native int decideOnContactRequest(int msg_id, int decision);
|
||||
public @NonNull DcMsg getMsg (int msg_id) { return new DcMsg(getMsgCPtr(msg_id)); }
|
||||
public DcMsg getMsg (int msg_id) { return new DcMsg(getMsgCPtr(msg_id)); }
|
||||
public native String getMsgInfo (int id);
|
||||
public native String getMsgHtml (int msg_id);
|
||||
public native int getFreshMsgCount (int chat_id);
|
||||
@@ -170,14 +167,14 @@ public class DcContext {
|
||||
public native int sendVideochatInvitation(int chat_id);
|
||||
public native int addDeviceMsg (String label, DcMsg msg);
|
||||
public native boolean wasDeviceMsgEverAdded(String label);
|
||||
public @NonNull DcLot checkQr (String qr) { return new DcLot(checkQrCPtr(qr)); }
|
||||
public DcLot checkQr (String qr) { return new DcLot(checkQrCPtr(qr)); }
|
||||
public native String getSecurejoinQr (int chat_id);
|
||||
public native int joinSecurejoin (String qr);
|
||||
public native void sendLocationsToChat (int chat_id, int seconds);
|
||||
public native boolean isSendingLocationsToChat(int chat_id);
|
||||
public @NonNull DcArray getLocations (int chat_id, int contact_id, long timestamp_start, long timestamp_end) { return new DcArray(getLocationsCPtr(chat_id, contact_id, timestamp_start, timestamp_end)); }
|
||||
public DcArray getLocations (int chat_id, int contact_id, long timestamp_start, long timestamp_end) { return new DcArray(getLocationsCPtr(chat_id, contact_id, timestamp_start, timestamp_end)); }
|
||||
public native void deleteAllLocations ();
|
||||
public @Nullable DcProvider getProviderFromEmail (String email) { long cptr = getProviderFromEmailCPtr(email); return cptr!=0 ? new DcProvider(cptr) : null; }
|
||||
public DcProvider getProviderFromEmail (String email) { long cptr = getProviderFromEmailCPtr(email); return cptr!=0 ? new DcProvider(cptr) : null; }
|
||||
|
||||
/**
|
||||
* @return true if at least one chat has location streaming enabled
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.connect.ApplicationDcContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -58,9 +51,6 @@ public class DcMsg {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (this.getId() == 0) {
|
||||
Log.e(TAG, "encountered a DcMsg with id 0.");
|
||||
}
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
@@ -77,7 +67,7 @@ public class DcMsg {
|
||||
/**
|
||||
* If given a message, calculates the position of the message in the chat
|
||||
*/
|
||||
public static int getMessagePosition(DcMsg msg, ApplicationDcContext dcContext) {
|
||||
public static int getMessagePosition(DcMsg msg, DcContext dcContext) {
|
||||
int msgs[] = dcContext.getChatMsgs(msg.getChatId(), 0, 0);
|
||||
int startingPosition = -1;
|
||||
int msgId = msg.getId();
|
||||
@@ -105,7 +95,7 @@ public class DcMsg {
|
||||
public native int getHeight (int def);
|
||||
public native int getDuration ();
|
||||
public native void lateFilingMediaSize(int width, int height, int duration);
|
||||
public @NonNull DcLot getSummary (DcChat chat) { return new DcLot(getSummaryCPtr(chat.getChatCPtr())); }
|
||||
public DcLot getSummary (DcChat chat) { return new DcLot(getSummaryCPtr(chat.getChatCPtr())); }
|
||||
public native String getSummarytext (int approx_characters);
|
||||
public native int showPadlock ();
|
||||
public boolean hasFile () { String file = getFile(); return file!=null && !file.isEmpty(); }
|
||||
@@ -129,9 +119,9 @@ public class DcMsg {
|
||||
public void setQuote (DcMsg quote) { setQuoteCPtr(quote.msgCPtr); }
|
||||
public native String getQuotedText ();
|
||||
public native String getError ();
|
||||
private native @Nullable String getOverrideSenderName();
|
||||
private native String getOverrideSenderName();
|
||||
|
||||
public @NonNull String getSenderName(@NonNull DcContact dcContact, boolean markOverride) {
|
||||
public String getSenderName(DcContact dcContact, boolean markOverride) {
|
||||
String overrideName = getOverrideSenderName();
|
||||
if (overrideName != null) {
|
||||
return (markOverride ? "~" : "") + overrideName;
|
||||
|
||||
Reference in New Issue
Block a user