Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable browser in iOS, related fixes #1552

Merged
merged 4 commits into from
Apr 29, 2024
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
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
globals: {
ENV_MOBILE_DEVICE: true,
},
ignorePatterns: ['dist', 'www'],
ignorePatterns: ['dist', 'platforms', 'plugins', 'www'],
extends: [
'plugin:vue/recommended',
'plugin:@intlify/vue-i18n/recommended',
Expand Down
16 changes: 2 additions & 14 deletions src/components/mobile/TabBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<ConnectionStatus />

<div class="wrapper">
<ButtonPlain
v-if="!$globals.DISABLED_BROWSER"
:to="browserPath"
>
<ButtonPlain :to="browserPath">
<Grid />
<div>{{ $t('app.title') }}</div>
</ButtonPlain>
Expand All @@ -16,14 +13,6 @@
<div>{{ $t('transfer.title') }}</div>
</ButtonPlain>

<ButtonPlain
v-if="$globals.DISABLED_BROWSER"
:to="{ name: 'transaction-list' }"
>
<List />
<div>{{ $t('transfer.transaction.title') }}</div>
</ButtonPlain>

<ButtonPlain
:class="showAccountSwitcher ? 'router-link-active' : ''"
@click="accountSwitcher"
Expand All @@ -48,7 +37,7 @@
import { mapState, mapGetters } from 'vuex';
import ButtonPlain from '../ButtonPlain.vue';
import {
Grid, Transfer, List, Contacts, Settings,
Grid, Transfer, Contacts, Settings,
} from '../icons';
import AeIdenticon from '../AeIdenticon.vue';
import ConnectionStatus from '../ConnectionStatus.vue';
Expand All @@ -60,7 +49,6 @@ export default {
ButtonPlain,
Grid,
Transfer,
List,
Contacts,
Settings,
ConnectionStatus,
Expand Down
2 changes: 1 addition & 1 deletion src/components/mobile/Tooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {

return this.showBelow
? { top: `${bottom + arrowSize}px` }
: { bottom: `${document.documentElement.clientHeight - top + arrowSize}px` };
: { bottom: `${this.$parent.$el.clientHeight - top + arrowSize}px` };
},
arrowStyle() {
if (!this.anchorRect || !this.isMounted) return {};
Expand Down
2 changes: 0 additions & 2 deletions src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ export const IS_IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MS
export const RUNNING_IN_FRAME = window.parent !== window;

export const RUNNING_IN_POPUP = !!window.opener && window.name === 'popup';

export const DISABLED_BROWSER = process.env.VUE_APP_CORDOVA && IS_IOS;
2 changes: 0 additions & 2 deletions src/pages/mobile/AppBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
ref="iframe"
:src="url"
:title="url"
:scrolling="$globals.IS_IOS && 'no'"
importance="high"
sandbox="allow-scripts allow-same-origin allow-forms allow-modals"
allow="camera; microphone"
Expand Down Expand Up @@ -151,7 +150,6 @@ export default {

iframe {
flex-grow: 1;
width: 100vw;
border: none;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/pages/mobile/Onboarding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@

<script>
import AeButton from '../../components/AeButton.vue';
import { DISABLED_BROWSER } from '../../lib/constants';

export default {
components: { AeButton },
data: () => ({
stepRouteNames: [
'onboarding',
'onboarding-send',
...DISABLED_BROWSER ? [] : ['onboarding-aepps'],
'onboarding-aepps',
'onboarding-subaccounts',
],
}),
Expand Down
4 changes: 2 additions & 2 deletions src/pages/mobile/TransactionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Page
header-fill="primary"
class="transaction-list"
:right-button-icon-name="$globals.DISABLED_BROWSER ? '' : 'close'"
:right-button-to="$globals.DISABLED_BROWSER ? '' : { name: 'transfer' }"
right-button-icon-name="close"
:right-button-to="{ name: 'transfer' }"
>
<div
slot="title"
Expand Down
6 changes: 2 additions & 4 deletions src/pages/mobile/Transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<LeftMore slot="right" />
</ListItem>
<ListItem
v-if="!$globals.DISABLED_BROWSER"
:to="{ name: 'transaction-list' }"
:title="$t('transfer.transaction.title')"
:subtitle="$t('transfer.transaction.subtitle')"
Expand Down Expand Up @@ -77,7 +76,6 @@ import Guide from '../../components/Guide.vue';
import AeAccount from '../../components/AeAccount.vue';
import { LeftMore } from '../../components/icons';
import ListItem from '../../components/ListItem.vue';
import { DISABLED_BROWSER } from '../../lib/constants';

export default {
components: {
Expand Down Expand Up @@ -106,10 +104,10 @@ export default {
tooltips: [{
selector: '.transfer .ae-account .ae-identicon',
...this.$t('transfer.tooltips.identicon'),
}, ...!DISABLED_BROWSER ? [{
}, {
selector: '.transfer .tab-bar .button-plain',
...this.$t('transfer.tooltips.browser'),
}] : [], {
}, {
selector: '.transfer .tab-bar .button-plain:nth-child(3)',
...this.$t('transfer.tooltips.account-switcher'),
}, {
Expand Down
6 changes: 3 additions & 3 deletions src/router/routes/mobile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DISABLED_BROWSER, IS_PWA, ROUTE_MOBILE_LOGGED_IN } from '../../lib/constants';
import { IS_PWA, ROUTE_MOBILE_LOGGED_IN } from '../../lib/constants';
import { send } from '../../lib/localStorageCall';
import { ensureLoggedIn, mergeEnterHandlers } from '../utils';
import store from '../../store/index';
Expand Down Expand Up @@ -180,13 +180,13 @@ export default [{
props: true,
}, {
name: 'transaction-list',
path: `${DISABLED_BROWSER ? '' : '/transfer'}/transactions/:direction?`,
path: '/transfer/transactions/:direction?',
component: TransactionList,
beforeEnter: ensureLoggedIn,
props: true,
}, {
name: 'transaction-details',
path: `${DISABLED_BROWSER ? '' : '/transfer'}/transactions/details/:hash`,
path: '/transfer/transactions/details/:hash',
component: TransactionDetails,
beforeEnter: ensureLoggedIn,
props: true,
Expand Down
11 changes: 11 additions & 0 deletions src/store/plugins/initSdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ export default (store) => {
]);
// TODO: remove after updating sdk
sdk.Ae.defaults.verify = false;

// backported fix https://github.com/aeternity/aepp-sdk-js/pull/1980
const { getWalletInfo } = sdk;
sdk.getWalletInfo = () => {
const { origin, ...info } = getWalletInfo.call(sdk);
return {
...info,
origin: 'file://' === info.origin ? '*' : info.origin,
};
}

sdk.selectNode(network.name);
sdk.middleware = middleware;
sdk.middleware2 = middleware2;
Expand Down
3 changes: 1 addition & 2 deletions src/ui-common.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Vue from 'vue';
import 'focus-visible';
import './components/icon.scss';
import { IS_IOS, DISABLED_BROWSER, ROUTE_MOBILE_LOGGED_IN } from './lib/constants';
import { IS_IOS, ROUTE_MOBILE_LOGGED_IN } from './lib/constants';

Vue.prototype.$globals = {
ENV_MOBILE_DEVICE: ENV_MOBILE_DEVICE, // eslint-disable-line object-shorthand
IS_IOS,
VUE_APP_CORDOVA: process.env.VUE_APP_CORDOVA,
DISABLED_BROWSER,
ROUTE_MOBILE_LOGGED_IN,
};
Loading