Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
zarEclEC committed Jan 20, 2020
1 parent 0b0cac5 commit 89d2723
Show file tree
Hide file tree
Showing 18 changed files with 1,051 additions and 230 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You will require Android Studio 3.4, Android NDK rev. 20 and Android SDK 8.1

Nekogram is forked from Telegram, thus most locales follows the translations of Telegram for Android, checkout https://translations.telegram.org/en/android/.

As for the Nekogram specialized strings, translations are located at `TMessagesProj/src/main/res/values-{language-code}/strings_neko.xml`.
As for the Nekogram specialized strings, we use Crowdin to translate Nekogram. Join project at https://neko.crowdin.com/nekogram. Help us bring Nekogram to the world!

## Contributors

Expand Down
6 changes: 3 additions & 3 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies {
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-config:19.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-vision:16.2.0'
Expand All @@ -31,6 +30,7 @@ dependencies {
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.code.gson:gson:2.8.6'
implementation files('libs/libgsaverification-client.aar')
}

Expand Down Expand Up @@ -290,7 +290,7 @@ android {
}
}

defaultConfig.versionCode = 10 * 1837
defaultConfig.versionCode = 10 * 1839

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down Expand Up @@ -325,7 +325,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionName "5.13.1.4"
versionName "5.13.1.5"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

Expand Down
4 changes: 4 additions & 0 deletions TMessagesProj/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@

<meta-data android:name="android.max_aspect" android:value="2.5" />

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification" />

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,10 @@ public static Typeface getTypeface(String assetPath) {
if (assetPath.contains("mono")) {
return Typeface.MONOSPACE;
}
return Typeface.create((Typeface) null, Typeface.NORMAL);
if (assetPath.contains("mw_bold")) {
return Typeface.create("serif", Typeface.BOLD);
}
//return Typeface.create((Typeface) null, Typeface.NORMAL);
}
if (!typefaceCache.containsKey(assetPath)) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1837;
public static int BUILD_VERSION = 1839;
public static String BUILD_VERSION_STRING = "5.13.0";
public static int APP_ID = 336779; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
public static String APP_HASH = "b91eefacc86747c068c8d8a16b41500d"; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
import java.util.Map;
import java.util.concurrent.CountDownLatch;

import tw.nekomimi.nekogram.NekoConfig;

@SuppressWarnings("unchecked")
public class MediaDataController extends BaseController {

Expand Down Expand Up @@ -289,7 +291,7 @@ public void addRecentSticker(final int type, Object parentObject, TLRPC.Document
getFileRefController().requestReference(parentObject, req);
}
});
maxCount = getMessagesController().maxFaveStickersCount;
maxCount = NekoConfig.unlimitedFavedStickers ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount;
} else {
maxCount = getMessagesController().maxRecentStickersCount;
}
Expand Down Expand Up @@ -785,7 +787,7 @@ protected void processLoadedRecentDocuments(final int type, final ArrayList<TLRP
maxCount = getMessagesController().maxRecentGifsCount;
} else {
if (type == TYPE_FAVE) {
maxCount = getMessagesController().maxFaveStickersCount;
maxCount = NekoConfig.unlimitedFavedStickers ? Integer.MAX_VALUE : getMessagesController().maxFaveStickersCount;
} else {
maxCount = getMessagesController().maxRecentStickersCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import android.text.TextUtils;
import android.util.Base64;

import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;

import org.json.JSONArray;
import org.json.JSONObject;
import org.telegram.messenger.AccountInstance;
Expand Down Expand Up @@ -1223,7 +1220,6 @@ protected void onPostExecute(final NativeByteBuffer result) {
private static class FirebaseTask extends AsyncTask<Void, Void, NativeByteBuffer> {

private int currentAccount;
private FirebaseRemoteConfig firebaseRemoteConfig;

public FirebaseTask(int instance) {
super();
Expand All @@ -1235,43 +1231,14 @@ protected NativeByteBuffer doInBackground(Void... voids) {
if (native_isTestBackend(currentAccount) != 0) {
throw new Exception("test backend");
}
firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(BuildConfig.DEBUG).build();
firebaseRemoteConfig.setConfigSettings(configSettings);
String currentValue = firebaseRemoteConfig.getString("ipconfigv3");
if (BuildVars.LOGS_ENABLED) {
FileLog.d("current firebase value = " + currentValue);
}

firebaseRemoteConfig.fetch(0).addOnCompleteListener(finishedTask -> {
final boolean success = finishedTask.isSuccessful();
Utilities.stageQueue.postRunnable(() -> {
currentTask = null;
String config = null;
if (success) {
firebaseRemoteConfig.activateFetched();
config = firebaseRemoteConfig.getString("ipconfigv3");
}
if (!TextUtils.isEmpty(config)) {
byte[] bytes = Base64.decode(config, Base64.DEFAULT);
try {
NativeByteBuffer buffer = new NativeByteBuffer(bytes.length);
buffer.writeBytes(bytes);
int date = (int) (firebaseRemoteConfig.getInfo().getFetchTimeMillis() / 1000);
native_applyDnsConfig(currentAccount, buffer.address, AccountInstance.getInstance(currentAccount).getUserConfig().getClientPhone(), date);
} catch (Exception e) {
FileLog.e(e);
}
} else {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("failed to get firebase result");
FileLog.d("start dns txt task");
}
DnsTxtLoadTask task = new DnsTxtLoadTask(currentAccount);
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
currentTask = task;
}
});
Utilities.stageQueue.postRunnable(() -> {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("failed to get firebase result");
FileLog.d("start dns txt task");
}
DnsTxtLoadTask task = new DnsTxtLoadTask(currentAccount);
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
currentTask = task;
});
} catch (Throwable e) {
Utilities.stageQueue.postRunnable(() -> {
Expand Down
27 changes: 16 additions & 11 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
import org.telegram.ui.Components.UndoView;
import org.telegram.ui.Components.voip.VoIPHelper;

import tw.nekomimi.nekogram.MessageDetailsActivity;
import tw.nekomimi.nekogram.MessageHelper;
import tw.nekomimi.nekogram.NekoConfig;

Expand Down Expand Up @@ -13723,17 +13724,18 @@ private void createMenu(View v, boolean single, boolean listView, float x, float
}
boolean allowRepeat = currentUser != null
|| (currentChat != null && ChatObject.canSendMessages(currentChat));
boolean allowPrpr = currentUser != null
|| (currentChat != null && ChatObject.canSendMessages(currentChat) && !currentChat.broadcast &&
message.isFromUser());
boolean allowViewHistory = currentUser == null
&& (currentChat != null && !currentChat.broadcast && message.isFromUser());

if (allowRepeat) {
items.add(LocaleController.getString("Repeat", R.string.Repeat));
options.add(94);
icons.add(R.drawable.msg_repeat);
}
}
if (!inScheduleMode) {
boolean allowPrpr = currentUser != null
|| (currentChat != null && ChatObject.canSendMessages(currentChat) && !currentChat.broadcast &&
message.isFromUser());
boolean allowViewHistory = currentUser == null
&& (currentChat != null && !currentChat.broadcast && message.isFromUser());
if (allowPrpr && NekoConfig.showPrPr) {
items.add(LocaleController.getString("Prpr", R.string.Prpr));
options.add(92);
Expand All @@ -13744,6 +13746,11 @@ private void createMenu(View v, boolean single, boolean listView, float x, float
options.add(90);
icons.add(R.drawable.menu_recent);
}
if (NekoConfig.showMessageDetails) {
items.add(LocaleController.getString("MessageDetails", R.string.MessageDetails));
options.add(89);
icons.add(R.drawable.menu_info);
}
}
if (allowUnpin) {
items.add(LocaleController.getString("UnpinMessage", R.string.UnpinMessage));
Expand Down Expand Up @@ -13805,11 +13812,6 @@ private void createMenu(View v, boolean single, boolean listView, float x, float
items.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
options.add(10);
icons.add(R.drawable.msg_download);
if (NekoConfig.showDeleteDownloadedFile) {
items.add(LocaleController.getString("DeleteDownloadedFile", R.string.DeleteDownloadedFile));
options.add(91);
icons.add(R.drawable.menu_clearcache);
}
items.add(LocaleController.getString("ShareFile", R.string.ShareFile));
options.add(6);
icons.add(R.drawable.msg_shareout);
Expand Down Expand Up @@ -14705,6 +14707,9 @@ private void processSelectedOption(int option) {
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
break;
} case 89: {
presentFragment(new MessageDetailsActivity(selectedObject));
break;
} case 90: {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.from_id);
getMediaDataController().searchMessagesInChat("", dialog_id, mergeDialogId, classGuid, 0, user);
Expand Down
Loading

0 comments on commit 89d2723

Please sign in to comment.