Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified android/lib/arm64-v8a/librnpushy.so
Binary file not shown.
Binary file modified android/lib/armeabi-v7a/librnpushy.so
Binary file not shown.
Binary file modified android/lib/x86/librnpushy.so
Binary file not shown.
Binary file modified android/lib/x86_64/librnpushy.so
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

final class ApkInstaller {
private static final String SESSION_ID_EXTRA =
Texts.reveal("3919bac3ab8a6b512c3e08f0c0b6de60452311edfbc8f680624b2d1de38da5a58e65557f3ecaeb8ea3b859661f3dc3f98bab48646c042bd0e19ca546681c2939");
Texts.INSTALLER_SESSION_EXTRA;
private static final ConcurrentHashMap<Integer, Promise> pendingPromises =
new ConcurrentHashMap<Integer, Promise>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class DownloadTask implements Runnable {
// Bundle delta entry inside a patch archive, stored encoded.
private static final String BUNDLE_DELTA_ENTRY =
Texts.reveal("3319f0d4b6c56a502c3b10fcdca0de7d4b3307e9");
Texts.BUNDLE_DELTA_ENTRY;

// Resume sidecars are a few hundred bytes of JSON.
private static final long MAX_SIDECAR_BYTES = 64 * 1024;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static synchronized void ensureLoaded() {
}

try {
System.loadLibrary(Texts.reveal("2819e4c4bd8371"));
System.loadLibrary(Texts.LIBRARY_NAME);
} catch (UnsatisfiedLinkError error) {
UnsatisfiedLinkError wrapped = new UnsatisfiedLinkError(
"Failed to load the native library. Original error: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private static void reloadReactHost(Object reactHost, JSBundleLoader loader) thr
jsBundleLoaderField.setAccessible(true);
jsBundleLoaderField.set(reactHostDelegate, loader);

Method reloadMethod = reactHost.getClass().getMethod(Texts.reveal("2812f8deaf8f"), String.class);
Method reloadMethod = reactHost.getClass().getMethod(Texts.RELOAD_METHOD, String.class);
reloadMethod.invoke(reactHost, Texts.LOG_TAG);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
final class SyncCoordinator {
// Version-info flag read by JS (metadata.ts), stored encoded.
private static final String INFO_CRASH_HOLD = Texts.reveal("3905f5c2a6b96d56212a19");
private static final String INFO_CRASH_HOLD = Texts.INFO_CRASH_HOLD;

// Shared with Harmony. The response cache lives in its own
// SharedPreferences file (UpdateContext.getNativeCheckCache).
Expand Down
16 changes: 15 additions & 1 deletion android/src/main/java/cn/reactnative/modules/update/Texts.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@
* UpdateContext's native library load.
*/
final class Texts {
/** Log tag shared by the module. */
// <generated:texts> (scripts/contract.ts; bun scripts/generate-contract.ts)
// Version-info flag of a version a crash hold installed (read by JS).
static final String INFO_CRASH_HOLD = reveal("3905f5c2a6b96d56212a19");
static final String PREFERENCES_NAME = reveal("2f07f0d0ba8e");
static final String STORAGE_DIR_NAME = reveal("0502e4d5af9f6d");
// The bundle patch entry inside a patch archive.
static final String BUNDLE_DELTA_ENTRY = reveal("3319f0d4b6c56a502c3b10fcdca0de7d4b3307e9");
static final String OPTION_URL_KEY = reveal("2f07f0d0ba8e5d572e");
static final String PPK_DELTA_SUFFIX = reveal("7407e4dae09b69512137");
// Archive suffix of a patch against the installed package.
static final String PACKAGE_DELTA_SUFFIX = reveal("7416e4dae09b69512137");
static final String LOG_TAG = reveal("2812f5d2bac6664436360afc9ba680694b3301");
static final String LIBRARY_NAME = reveal("2819e4c4bd8371");
static final String INSTALLER_SESSION_EXTRA = reveal("3919bac3ab8a6b512c3e08f0c0b6de60452311edfbc8f680624b2d1de38da5a58e65557f3ecaeb8ea3b859661f3dc3f98bab48646c042bd0e19ca546681c2939");
static final String RELOAD_METHOD = reveal("2812f8deaf8f");
// </generated:texts>

private Texts() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ private UpdateContext(Context context) {
this.context = context.getApplicationContext();
this.executor = Threads.single("pushy-download", false);

this.rootDir = new File(this.context.getFilesDir(), Texts.reveal("0502e4d5af9f6d"));
this.rootDir = new File(this.context.getFilesDir(), Texts.STORAGE_DIR_NAME);

if (!rootDir.exists() && !rootDir.mkdirs() && !rootDir.exists()) {
throw new IllegalStateException("Failed to create storage root dir: " + rootDir);
}

this.sp = this.context.getSharedPreferences(Texts.reveal("2f07f0d0ba8e"), Context.MODE_PRIVATE);
this.sp = this.context.getSharedPreferences(Texts.PREFERENCES_NAME, Context.MODE_PRIVATE);
this.checkCacheSp = this.context.getSharedPreferences(
Texts.reveal("2f07f0d0ba8e") + "_check", Context.MODE_PRIVATE);
Texts.PREFERENCES_NAME + "_check", Context.MODE_PRIVATE);
this.packageInfo = lookupPackageInfo(this.context);
this.reactInstanceManager = pendingReactInstanceManager;

Expand Down Expand Up @@ -387,7 +387,7 @@ DownloadTaskParams downloadPatchFromApk(
}
DownloadTaskParams params = downloadParams(
DownloadTaskParams.TASK_TYPE_PATCH_FROM_APK, url, hash, listener, deadlineNanos);
params.targetFile = new File(rootDir, hash + Texts.reveal("7416e4dae09b69512137"));
params.targetFile = new File(rootDir, hash + Texts.PACKAGE_DELTA_SUFFIX);
params.unzipDirectory = new File(rootDir, hash);
enqueue(params);
return params;
Expand All @@ -407,7 +407,7 @@ DownloadTaskParams downloadPatchFromPpk(
DownloadTaskParams params = downloadParams(
DownloadTaskParams.TASK_TYPE_PATCH_FROM_PPK, url, hash, listener, deadlineNanos);
params.originHash = originHash;
params.targetFile = new File(rootDir, originHash + "-" + hash + Texts.reveal("7407e4dae09b69512137"));
params.targetFile = new File(rootDir, originHash + "-" + hash + Texts.PPK_DELTA_SUFFIX);
params.unzipDirectory = new File(rootDir, hash);
params.originDirectory = new File(rootDir, originHash);
enqueue(params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class UpdateModule extends NativePushySpec {
// Download URL option key, stored encoded.
private static final String OPTION_URL = Texts.reveal("2f07f0d0ba8e5d572e");
private static final String OPTION_URL = Texts.OPTION_URL_KEY;

private final ReactApplicationContext reactContext;
private final UpdateContext updateContext;
Expand Down
5 changes: 2 additions & 3 deletions cpp/android_jni/jni_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <android/log.h>

#include "../patch_core/obscured_text.h"
#include "../patch_core/native_texts.h"

// Keep the core internal to whichever binary links it (see podspec Core).
#pragma GCC visibility push(hidden)
Expand All @@ -13,8 +13,7 @@ namespace jni_log {

// Same logcat tag as the Java layer (Texts.LOG_TAG), stored encoded.
inline const char* Tag() {
static const char* const tag =
text::RevealStatic("2812f5d2bac6664436360afc9ba680694b3301");
static const char* const tag = texts::LogTag().c_str();
return tag;
}

Expand Down
8 changes: 3 additions & 5 deletions cpp/android_jni/update_core_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "jni_log.h"
#include "jni_natives.h"
#include "../patch_core/obscured_text.h"
#include "../patch_core/native_texts.h"

#include <string>
#include <vector>
Expand Down Expand Up @@ -105,8 +105,7 @@ bool LookupConstructor(
}

bool InitStateResultIds(JNIEnv* env) {
const std::string name = pushy::text::Reveal(
"3919bbc3ab8a6b512c3e08f0c0b6df60452311edfbc8f780624b2d1de38c93a99b63511201f9cd97878c695522");
const std::string& name = pushy::texts::StateResultClass();
StateResultIds ids;
ids.clazz = FindGlobalClass(env, name);
if (ids.clazz == nullptr) {
Expand All @@ -131,8 +130,7 @@ bool InitStateResultIds(JNIEnv* env) {
}

bool InitCopyGroupIds(JNIEnv* env) {
const std::string name = pushy::text::Reveal(
"3919bbc3ab8a6b512c3e08f0c0b6df60452311edfbc8f780624b2d1de38c83b28a6e732301fed897878c695522");
const std::string& name = pushy::texts::CopyGroupResultClass();
CopyGroupIds ids;
ids.clazz = FindGlobalClass(env, name);
ids.string_class = FindGlobalClass(env, "java/lang/String");
Expand Down
5 changes: 2 additions & 3 deletions cpp/patch_core/archive_patch_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <unordered_map>
#include <utility>

#include "obscured_text.h"
#include "native_texts.h"

namespace pushy {
namespace archive_patch {
Expand All @@ -22,8 +22,7 @@ bool HasEntry(const std::vector<std::string>& entry_names, const std::string& na
} // namespace

const std::string& DefaultBundleDeltaEntryName() {
static const std::string name = text::Reveal("3319f0d4b6c56a502c3b10fcdca0de7d4b3307e9");
return name;
return texts::BundleDeltaEntry();
}

EntryAction ClassifyEntry(
Expand Down
102 changes: 102 additions & 0 deletions cpp/patch_core/native_texts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#ifndef PUSHY_PATCH_CORE_NATIVE_TEXTS_H_
#define PUSHY_PATCH_CORE_NATIVE_TEXTS_H_

#include <string>
#include <vector>

#include "obscured_text.h"

// The plain text shipped native code needs but must not carry in its string
// tables (update wording, service addresses), stored encoded and decoded on
// first use. Shared by the C++ cores and iOS; Android and Harmony get their
// copies in Texts.java / Texts.ts. All generated from scripts/contract.ts.
// Keep the core internal to whichever binary links it (see podspec Core).
#pragma GCC visibility push(hidden)

namespace pushy {
namespace texts {

// <generated:texts> (scripts/contract.ts; bun scripts/generate-contract.ts)
// The round status / decision reason when nothing is to be installed.
inline const std::string& StatusNone() {
static const std::string value = text::Reveal("3418c1c1aa8a7c40");
return value;
}
// Version-info flag of a version a crash hold installed (read by JS).
inline const std::string& InfoCrashHold() {
static const std::string value = text::Reveal("3905f5c2a6b96d56212a19");
return value;
}
// Version-info flag of a version the server forceBoot-activated.
inline const std::string& InfoForceBoot() {
static const std::string value = text::Reveal("3c18e6d2aba9674a360d19ead5a695");
return value;
}
inline const std::string& QueryPath() {
static const std::string value = text::Reveal("7514fcd4ad805d55263e08fc99");
return value;
}
// The afterDownload policy that activates for the next launch.
inline const std::string& PolicyNextLaunch() {
static const std::string value = text::Reveal("2912e0ffab8e6c70323b1dedd3");
return value;
}
inline const std::string& FieldAvailable() {
static const std::string value = text::Reveal("2f07f0d0ba8e");
return value;
}
// The bundle patch entry inside a patch archive.
inline const std::string& BundleDeltaEntry() {
static const std::string value = text::Reveal("3319f0d4b6c56a502c3b10fcdca0de7d4b3307e9");
return value;
}
inline const std::string& OptionUrlKey() {
static const std::string value = text::Reveal("2f07f0d0ba8e5d572e");
return value;
}
inline const std::string& PpkDeltaSuffix() {
static const std::string value = text::Reveal("7407e4dae09b69512137");
return value;
}
// Archive suffix of a patch against the installed package.
inline const std::string& PackageDeltaSuffix() {
static const std::string value = text::Reveal("741ee4d0e09b69512137");
return value;
}
inline const std::string& PackageUpdatedMarkedKey() {
static const std::string value = text::Reveal("0832d5f29aa549710b0939daf88ca058790f3dded7e888b451640d2ec3f69099bb43711523cafa8ea7bb4372132a");
return value;
}
inline const std::string& LogTag() {
static const std::string value = text::Reveal("2812f5d2bac6664436360afc9ba680694b3301");
return value;
}
inline const std::string& StateResultClass() {
static const std::string value = text::Reveal("3919bbc3ab8a6b512c3e08f0c0b6df60452311edfbc8f780624b2d1de38c93a99b63511201f9cd97878c695522");
return value;
}
inline const std::string& CopyGroupResultClass() {
static const std::string value = text::Reveal("3919bbc3ab8a6b512c3e08f0c0b6df60452311edfbc8f780624b2d1de38c83b28a6e732301fed897878c695522");
return value;
}
// Pushy's own service addresses, configure()'s defaults.
inline std::vector<std::string> DefaultEndpoints() {
return {
text::Reveal("3203e0c1bdd1270a372f18f8c2b6de7f4f2607f5b3d5b9817b592947e5cdefbc8a7e"),
text::Reveal("3203e0c1bdd1270a372f18f8c2b6de7f4f2607f5f0daac9c644a620ae88ca1ad93"),
};
}
inline std::vector<std::string> DefaultQueryUrls() {
return {
text::Reveal("3203e0c1bdd1270a253608fcd3fd9362476817f4f0d5a1996342631be3c2a3a9d779552507fdcde8928a6f512f5ce2ccbdc869404d2f1de79daa826d562c0913eec4fa9b7d4426"),
text::Reveal("3203e0c1bdd1270a213b12b7dca09468462e12f3b0d5bd813d482446f4c6a1be8e79552507fdcda68cd06e5c3710e480a4867048483e55e0c2ab8d7d43030d1ce9c3b183214e2601f2f0d5b782601e2719e8ca"),
};
}
// </generated:texts>

} // namespace texts
} // namespace pushy

#pragma GCC visibility pop

#endif // PUSHY_PATCH_CORE_NATIVE_TEXTS_H_
30 changes: 5 additions & 25 deletions cpp/update_flow_core/native_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <utility>
#include <vector>

#include "../patch_core/obscured_text.h"
#include "../patch_core/native_texts.h"

namespace flowcore {

Expand Down Expand Up @@ -104,30 +104,10 @@ Value ParseObject(const std::string& json) {
return ok && value.IsObject() ? value : Value::Undefined();
}

const std::string& PolicyNextLaunch() {
static const std::string value =
pushy::text::Reveal("2912e0ffab8e6c70323b1dedd3");
return value;
}

// Pushy's own service addresses, encoded by scripts/encode-native-text.ts.
std::vector<std::string> DefaultEndpoints() {
return {
pushy::text::Reveal(
"3203e0c1bdd1270a372f18f8c2b6de7f4f2607f5b3d5b9817b592947e5cdefbc8a7e"),
pushy::text::Reveal(
"3203e0c1bdd1270a372f18f8c2b6de7f4f2607f5f0daac9c644a620ae88ca1ad93"),
};
}

// One literal per address: src/__tests__/nativeTextEncoding.test.ts finds
// them by pattern.
std::vector<std::string> DefaultQueryUrls() {
return {
pushy::text::Reveal("3203e0c1bdd1270a253608fcd3fd9362476817f4f0d5a1996342631be3c2a3a9d779552507fdcde8928a6f512f5ce2ccbdc869404d2f1de79daa826d562c0913eec4fa9b7d4426"),
pushy::text::Reveal("3203e0c1bdd1270a213b12b7dca09468462e12f3b0d5bd813d482446f4c6a1be8e79552507fdcda68cd06e5c3710e480a4867048483e55e0c2ab8d7d43030d1ce9c3b183214e2601f2f0d5b782601e2719e8ca"),
};
}
// Stored encoded (native_texts.h), Pushy's service addresses among them.
using pushy::texts::DefaultEndpoints;
using pushy::texts::DefaultQueryUrls;
using pushy::texts::PolicyNextLaunch;

Value StringArray(const std::vector<std::string>& values) {
Value array = Value::Array();
Expand Down
15 changes: 4 additions & 11 deletions cpp/update_flow_core/native_round.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <utility>

#include "../patch_core/hbc_transform_wire.h"
#include "../patch_core/obscured_text.h"
#include "../patch_core/native_texts.h"
#include "native_config.h"
#include "update_flow_core.h"

Expand All @@ -14,16 +14,9 @@ using flowjson::Value;

namespace {

// Stored encoded (see obscured_text.h).
const std::string& QueryPath() {
static const std::string value = pushy::text::Reveal("7514fcd4ad805d55263e08fc99");
return value;
}
const std::string& InfoForceBoot() {
static const std::string value =
pushy::text::Reveal("3c18e6d2aba9674a360d19ead5a695");
return value;
}
// Stored encoded (native_texts.h).
using pushy::texts::InfoForceBoot;
using pushy::texts::QueryPath;

// The lists NextQueryStep walks, in order; the state's "list" names the
// current one ("" once the query is over).
Expand Down
19 changes: 6 additions & 13 deletions cpp/update_flow_core/round_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cmath>
#include <utility>

#include "../patch_core/obscured_text.h"
#include "../patch_core/native_texts.h"
#include "native_config.h"
#include "native_round.h"
#include "update_flow_core.h"
Expand All @@ -14,18 +14,11 @@ using flowjson::Value;

namespace {

// Stored encoded (see obscured_text.h): the result status of a round that
// found nothing to install, and the version-info flag of a version a crash
// hold installed (read by JS).
const std::string& StatusNone() {
static const std::string value = pushy::text::Reveal("3418c1c1aa8a7c40");
return value;
}
const std::string& InfoCrashHold() {
static const std::string value =
pushy::text::Reveal("3905f5c2a6b96d56212a19");
return value;
}
// Stored encoded (native_texts.h): the result status of a round that found
// nothing to install, and the version-info flag of a version a crash hold
// installed (read by JS).
using pushy::texts::InfoCrashHold;
using pushy::texts::StatusNone;

// Phases: what the round waits for.
const char kAwaitEnv[] = "env";
Expand Down
Loading
Loading