Skip to content

Commit

Permalink
Merge pull request #177 from MXCzkEVM/pre_main_qa
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
reasje authored Feb 3, 2025
2 parents 342dd06 + 20adace commit 83bd64e
Show file tree
Hide file tree
Showing 13 changed files with 690 additions and 580 deletions.
71 changes: 34 additions & 37 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ on:
jobs:
build-apk:
name: Build-apk
runs-on: ubuntu-latest
# This version contains CMake 3.18 but the latest contains 3.30
# We will need to check CMake 3.30 compatibility and then upgrade
runs-on: ubuntu-22.04
steps:
- name: Checkout code with submodules
uses: actions/checkout@v4
Expand Down Expand Up @@ -48,7 +50,6 @@ jobs:
source-dir: build/app/outputs/flutter-apk
destination-dir: app


build-macos:
name: Build-ios
# https://github.com/actions/runner-images
Expand Down Expand Up @@ -79,6 +80,37 @@ jobs:
# Try running the build locally with the build command to be sure of this path
path: build/ios/ipa/*.ipa

build-macos-simulator:
name: Build-ios-simulator
# https://github.com/actions/runner-images
# https://xcodereleases.com/
runs-on: macos-15

steps:
- name: Select Xcode version 16.1
run: sudo xcode-select -s /Applications/Xcode_16.1.app

- name: Checkout code with submodules
uses: actions/checkout@v4
with:
submodules: recursive

- uses: sheenhx/action-flutter-build-ios@main
with:
# always use --export-options-plist=ios/GithubActionsExportOptions.plist
build-cmd: flutter build ios --simulator --no-codesign --debug --dart-define=FLUTTER_BUILD_MODE=debug
certificate-base64: ${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}
certificate-password: ${{ secrets.IOS_BUILD_CERTIFICATE_PASSWORD }}
provisioning-profile-base64: ${{ secrets.IOS_MOBILE_PROVISIONING_PROFILE_BASE64 }}
keychain-password: ${{ secrets.IOS_GITHUB_KEYCHAIN_PASSWORD }}

- name: Archive .app
uses: actions/upload-artifact@v4
with:
name: simulator-app
# Try running the build locally with the build command to be sure of this path
path: build/ios/iphonesimulator/*.app

upload-combined:
name: Combine and Upload Builds
needs: [build-apk, build-macos]
Expand Down Expand Up @@ -121,38 +153,3 @@ jobs:
generateReleaseNotes: true
body: >
<a href="https://play.google.com/store/apps/details?id=com.moonchain.app" target="_blank"><img width="500" alt="image" src="https://github.com/user-attachments/assets/802b4fa6-8978-4b01-8de7-68207a5f8d77"></a><a href="https://apps.apple.com/app/moonbase-the-mining-hub/id6736371768" target="_blank"><img width="500" alt="image" src="https://github.com/user-attachments/assets/ed4678e2-4099-498c-92ee-94b88b620c21"></a>
- name: Upload APK to Waldo
uses: waldoapp/gh-action-upload@v2
with:
build_path: combined-builds/android/moonchain.apk
upload_token: ${{ secrets.WALDO_SESSIONS_ANDROID }}

build-waldo:
name: Build-waldo
# https://github.com/actions/runner-images
# https://xcodereleases.com/
runs-on: macos-15

steps:
- name: Select Xcode version 16.1
run: sudo xcode-select -s /Applications/Xcode_16.1.app

- name: Checkout code with submodules
uses: actions/checkout@v4
with:
submodules: recursive

- uses: sheenhx/action-flutter-build-ios@main
with:
# always use --export-options-plist=ios/GithubActionsExportOptions.plist
build-cmd: flutter build ios --simulator
certificate-base64: ${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}
certificate-password: ${{ secrets.IOS_BUILD_CERTIFICATE_PASSWORD }}
provisioning-profile-base64: ${{ secrets.IOS_MOBILE_PROVISIONING_PROFILE_BASE64 }}
keychain-password: ${{ secrets.IOS_GITHUB_KEYCHAIN_PASSWORD }}
- name: Upload IPA to Waldo
uses: waldoapp/gh-action-upload@v2
with:
build_path: build/ios/iphonesimulator/Runner.app
upload_token: ${{ secrets.WALDO_SESSIONS_IOS }}
2 changes: 1 addition & 1 deletion .github/workflows/submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
build-apk:
name: Build-aab
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout code with submodules
uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
.gradle/
.project
.classpath
.fvm

# iOS
ios/Podfile.lock
Expand All @@ -46,4 +45,7 @@ ios/build
lib/generated_plugin_registrant.dart

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

# FVM Version Cache
.fvm/
4 changes: 4 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@

<application tools:replace="android:label" android:label="MoonBase" android:name="${applicationName}" android:icon="@mipmap/ic_launcher" android:theme="@style/LaunchTheme" android:requestLegacyExternalStorage="true">

# This is line is to disable Impeller
<meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="false" />

<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="moonchain_wallet_channel" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
Expand Down
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,7 @@
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>FLTEnableImpeller</key>
<false />
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,11 @@ int parseDate(List<int> data) {
}

int parseInt(List<int> data) {
return int.parse(data.reversed.map((e) => e.toString()).join(''));
final processedData = BlueberryCommandsUtils.radix16bcd(data,no0x: true)
.map((d) => d.toString().replaceFirst('0x', '')) // Convert to string and remove '0x'
.toList()
.reversed
.join('');

return int.parse('0x$processedData', );
}
3 changes: 3 additions & 0 deletions lib/features/dapps/subfeatures/open_dapp/open_dapp_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class OpenDAppPage extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final presenter = ref.read(openDAppPageContainer.actions);
final state = ref.watch(openDAppPageContainer.state);
presenter.initialUrl = Uri.parse(url);

const rightToLeftPrimaryVelocity = 2000;
const leftToRightPrimaryVelocity = 3000;

Expand Down Expand Up @@ -81,6 +83,7 @@ class OpenDAppPage extends HookConsumerWidget {
onLoadStop: (controller, url) {
presenter.injectCopyHandling();
presenter.injectScrollDetector();
presenter.injectHairyRelatedScripts();
if (!state.isLoadStopCalled) {
presenter.injectMXCWalletJSChannel();
presenter.changeOnLoadStopCalled();
Expand Down
40 changes: 40 additions & 0 deletions lib/features/dapps/subfeatures/open_dapp/open_dapp_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class OpenDAppPresenter extends CompletePresenter<OpenDAppState> {

Timer? characteristicListenerTimer;
StreamSubscription<List<int>>? characteristicValueStreamSubscription;
Uri? initialUrl;

MinerHooksHelper get minerHooksHelper => MinerHooksHelper(
translate: translate,
Expand Down Expand Up @@ -267,6 +268,45 @@ class OpenDAppPresenter extends CompletePresenter<OpenDAppState> {
}
}

void injectHairyRelatedScripts() async {
await injectHairyScript();
injectDAppOrigin();
}


Future<void> injectHairyScript() async {
const hairyScript = """
const send = XMLHttpRequest.prototype.send
XMLHttpRequest.prototype.send = function (body) {
this.addEventListener('readystatechange', function listener() {
if (this.readyState !== 3 || this.status !== 200)
return
if (!this.responseURL.includes('pass/serviceLoginAuth2'))
return
const state = this.responseText
const data = JSON.parse(state.replaceAll('&&&START&&&', ''))
if (data.code !== 0)
return
setTimeout(() => document.querySelector('.mi-form-helper-text--error').remove())
setTimeout(() => document.querySelector('._-src-components-FormErrorMessage-formErrorMessage').remove())
Object.defineProperty(this, 'responseText', { value: '' })
location.href = `\${window.axs.origin}?state=\${encodeURIComponent(state)}&body=\${encodeURIComponent(body)}`
})
return send.apply(this, arguments)
}
""";
await state.webviewController!.evaluateJavascript(source: hairyScript);
}

// This is requested by Hairy on Xiaomi related feature
void injectDAppOrigin() async {
collectLog('Injecting origin $initialUrl to axs.origin object');
await state.webviewController!
.evaluateJavascript(source: "window.axs.origin = '${initialUrl!.origin}';");
await state.webviewController!.evaluateJavascript(
source: "console.log(\"window.axs.origin \" + window.axs.origin)");
}

injectScrollDetector() {
state.webviewController!
.evaluateJavascript(source: JSChannelScripts.overScrollScript);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ class NotificationsPresenter extends CompletePresenter<NotificationsState>
lowBalanceController.addListener(onLowBalanceChange);
transactionFeeController.addListener(onTransactionFeeChange);

// Future.delayed(
// const Duration(
// milliseconds: 1,
// ),
// () {
// showSnackBar(
// context: context!,
// content: translate(
// 'let_us_personalize_your_notifications_choose_which_ones_you_want_to_see')!);

// }
// );
Future.delayed(
const Duration(
milliseconds: 1,
),
() {
showSnackBar(
context: context!,
content: translate(
'let_us_personalize_your_notifications_choose_which_ones_you_want_to_see')!);

}
);

Future.delayed(
const Duration(
Expand Down
2 changes: 1 addition & 1 deletion packages/shared
Loading

0 comments on commit 83bd64e

Please sign in to comment.