Skip to content

Commit

Permalink
Merge pull request #208 from Crossbell-Box/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dohooo committed Jul 20, 2023
2 parents d1259f5 + a1772da commit ae1ebba
Show file tree
Hide file tree
Showing 53 changed files with 96 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-balloons-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"xlog": patch
---

Avoid redirect to official website with external browser if didn't download wallet. It will now go directly to the App Store.
5 changes: 5 additions & 0 deletions .changeset/nine-games-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"xlog": minor
---

Support App Store review in app.
2 changes: 2 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default (_: ConfigContext): ExpoConfig => {
policy: "appVersion",
},
ios: {
appStoreUrl: "https://apps.apple.com/app/xlog-on-chain-blogging/id6449499296",
supportsTablet: true,
bundleIdentifier: config.scheme,
associatedDomains: [
Expand All @@ -86,6 +87,7 @@ export default (_: ConfigContext): ExpoConfig => {
googleServicesFile: config.iosGoogleServicesFile,
},
android: {
playStoreUrl: "https://play.google.com/store/apps/details?id=com.crossbell.xlog",
package: config.scheme,
intentFilters: [
{
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"update:preview": "EXPO_NO_DOTENV=1 STAGE=test node scripts/eas-update.js eas update --non-interactive --channel preview --auto",
"build:development": "EXPO_NO_DOTENV=1 STAGE=development eas build --non-interactive --profile development",
"build:preview": "EXPO_NO_DOTENV=1 STAGE=staging eas build --non-interactive --profile preview",
"build:production": "eas build --non-interactive --profile production --auto-submit",
"submit:all": "eas build --non-interactive --profile production --auto-submit -p all",
"submit:ios": "eas build --non-interactive --profile production --auto-submit -p ios",
"submit:android": "eas build --non-interactive --profile production --auto-submit -p android",
"generate-env-types:common": "dotenv-types-generator -f ./.env.common -m",
"generate-env-types:env": "dotenv-types-generator -f ./.env.development -m",
"generate-env-types": "run-s generate-env-types:common",
Expand Down
79 changes: 77 additions & 2 deletions src/components/ConnectionButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { FC } from "react";
import { useEffect, useRef } from "react";
import { useTranslation } from "react-i18next";
import Animated, { FadeIn, FadeOut, FlipInXDown, FlipOutXUp } from "react-native-reanimated";
import { Alert, Linking } from "react-native";
import Animated, { FadeIn, FadeOut, FlipInXDown } from "react-native-reanimated";

import {
useConnectedAccount,
Expand All @@ -11,12 +12,16 @@ import {
useIsWalletSignedIn,
} from "@crossbell/react-account";
import { Plug, Wallet } from "@tamagui/lucide-icons";
import { useToastController } from "@tamagui/toast";
import { useWalletConnectModal } from "@walletconnect/modal-react-native";
import * as Haptics from "expo-haptics";
import * as StoreReview from "expo-store-review";
import * as Sentry from "sentry-expo";
import type { StackProps } from "tamagui";
import { Button, Stack } from "tamagui";

import { IS_IOS } from "@/constants";
import { useAppIsActive } from "@/hooks/use-app-state";
import { useRootNavigation } from "@/hooks/use-navigation";
import { useOneTimeTogglerWithSignOP } from "@/hooks/use-signin-tips-toggler";
import { GA } from "@/utils/GA";
Expand Down Expand Up @@ -57,7 +62,77 @@ export const ConnectionButton: FC<Props> = (props) => {
function ConnectBtn({ navigateToLogin }: { navigateToLogin: boolean }) {
const i18n = useTranslation();
const navigation = useRootNavigation();
const { open } = useWalletConnectModal();
const { open, isOpen } = useWalletConnectModal();
const toast = useToastController();

const isActive = useAppIsActive();

/**
* Temporarily fix.
* https://github.com/WalletConnect/modal-react-native/issues/49
*/
useEffect(() => { isActive && toast.hide(); }, [isActive]);
useEffect(() => {
if (!IS_IOS) {
return;
}

async function getAppId(scheme) {
const response = await fetch(`https://itunes.apple.com/search?term=${scheme}&entity=software`);
const data = await response.json();
const id = data.results[0].trackId;
return id;
}

const _originalOpenURL = Linking.openURL.bind(Linking);
let prevScheme = "";

Linking.openURL = async (url) => {
const isHttp = url.startsWith("http") || url.startsWith("https");

if (isHttp) {
Alert.alert(
i18n.t("Alert"),
i18n.t("Didn't find your wallet, would you like to download it?"),
[
{
text: i18n.t("Cancel"),
style: "cancel",
},
{
text: i18n.t("Confirm"),
onPress: async () => {
toast.show(i18n.t("Redirecting..."), {
burntOptions: {
preset: "none",
haptic: "none",
},
});
try {
const appId = await getAppId(prevScheme);
Linking.openURL(`itms-apps://itunes.apple.com/app/id${appId}`);
}
catch (e) {
Alert.alert(
i18n.t("Alert"),
i18n.t("Redirecting failed, please download it from App Store manually."),
);
}
},
},
],
);
}
else {
prevScheme = url.split(":")[0];
await _originalOpenURL(url);
}
};

return () => {
Linking.openURL = _originalOpenURL;
};
}, [isOpen]);

const handleConnect = () => {
if (navigateToLogin) {
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,8 @@
"Network Error": "网络错误",
"Check updates": "检查更新",
"delete account alert": "您确定要删除您的账户吗?此操作无法撤销。请键入 <T> {{name}} </T> 以确认。",
"By signing, you can interact without clicking to agree the smart contracts every time. We are in Beta, and new users who try it out will be rewarded with 0.01 $CSB.": "通过签署授权,你可以在每次互动时无需点击同意智能合约。我们正在测试阶段,新用户试用将获得0.01 $CSB的奖励。"
"By signing, you can interact without clicking to agree the smart contracts every time. We are in Beta, and new users who try it out will be rewarded with 0.01 $CSB.": "通过签署授权,你可以在每次互动时无需点击同意智能合约。我们正在测试阶段,新用户试用将获得0.01 $CSB的奖励。",
"Didn't find your wallet, would you like to download it?": "没有找到该钱包,是否前往下载?",
"Redirecting...": "跳转中...",
"Redirecting to App Store failed, please download it from App Store manually.": "跳转失败,请前往App Store进行下载。",
}
Binary file removed submission/Android/pad 10/Screenshot_1687189365.png
Binary file not shown.
Binary file removed submission/Android/pad 10/Screenshot_1687189669.png
Binary file not shown.
Binary file removed submission/Android/pad 10/Screenshot_1687189987.png
Binary file not shown.
Binary file removed submission/Android/pad 7/Screenshot_1687189039.png
Binary file not shown.
Binary file removed submission/Android/pad 7/Screenshot_1687189061.png
Binary file not shown.
Binary file removed submission/Android/pad 7/Screenshot_1687189080.png
Binary file not shown.
Binary file removed submission/Android/phone/Screenshot_1687188614.png
Binary file not shown.
Binary file removed submission/Android/phone/Screenshot_1687188652.png
Binary file not shown.
Binary file removed submission/Android/phone/Screenshot_1687188664.png
Binary file not shown.
Binary file removed submission/Android/phone/Screenshot_1687190482.png
Binary file not shown.
Binary file added submission/draft/Android/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submission/draft/Android/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submission/draft/Styled/243shots_so.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added submission/draft/iPhone/original/IMG_9433.PNG
Binary file added submission/draft/iPhone/original/IMG_9435.PNG
Binary file added submission/draft/iPhone/original/IMG_9436.PNG
Binary file added submission/draft/iPhone/original/IMG_9437.PNG
Binary file added submission/draft/iPhone/original/IMG_9438.PNG
Binary file added submission/draft/iPhone/original/IMG_9439.PNG
Binary file added submission/draft/iPhone/original/IMG_9440.PNG
Binary file added submission/draft/iPhone/original/IMG_9441.PNG
Binary file added submission/draft/iPhone/original/IMG_9442.PNG
Binary file added submission/draft/iPhone/original/IMG_9443.PNG
Binary file added submission/draft/iPhone/original/IMG_9444.PNG

0 comments on commit ae1ebba

Please sign in to comment.