Skip to content

Commit

Permalink
fix(uni-mp-weibo): remove uni-h5 modify
Browse files Browse the repository at this point in the history
  • Loading branch information
lingxiao7 committed Jul 20, 2023
1 parent dc77d9b commit da03de3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 109 deletions.
46 changes: 9 additions & 37 deletions packages/uni-h5/dist/uni-h5.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ function initPageInternalInstance(openType, url, pageQuery, meta, eventChannel,
meta,
openType,
eventChannel,
statusBarStyle: titleColor === "#ffffff" ? "light" : "dark"
statusBarStyle: titleColor === "#000000" ? "dark" : "light"
};
}
function invokeHook(vm, name, args) {
Expand Down Expand Up @@ -508,21 +508,21 @@ function wrapperEvent(event, evt) {
}
const invokeOnCallback = (name, res) => UniServiceJSBridge.emit("api." + name, res);
let invokeViewMethodId = 1;
function publishViewMethodName(pageId) {
return (pageId || getCurrentPageId()) + "." + INVOKE_VIEW_API;
function publishViewMethodName() {
return getCurrentPageId() + "." + INVOKE_VIEW_API;
}
const invokeViewMethod = (name, args, pageId, callback) => {
const { subscribe, publishHandler } = UniServiceJSBridge;
const id = callback ? invokeViewMethodId++ : 0;
callback && subscribe(INVOKE_VIEW_API + "." + id, callback, true);
publishHandler(publishViewMethodName(pageId), { id, name, args }, pageId);
publishHandler(publishViewMethodName(), { id, name, args }, pageId);
};
const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
const { subscribe, unsubscribe, publishHandler } = UniServiceJSBridge;
const id = invokeViewMethodId++;
const subscribeName = INVOKE_VIEW_API + "." + id;
subscribe(subscribeName, callback);
publishHandler(publishViewMethodName(pageId), { id, name, args }, pageId);
publishHandler(publishViewMethodName(), { id, name, args }, pageId);
return () => {
unsubscribe(subscribeName);
};
Expand Down Expand Up @@ -1008,13 +1008,6 @@ const index$A = /* @__PURE__ */ defineBuiltInComponent({
}
return;
}
if (
// @ts-ignore
window.weibo && // @ts-ignore
typeof window.weibo.share === "function" && props2.openType === "share"
) {
window.weibo.share();
}
});
const uniLabel = vue.inject(uniLabelKey, false);
if (uniLabel) {
Expand Down Expand Up @@ -1405,11 +1398,6 @@ function handlePromise(promise) {
}
function promisify(name, fn) {
return (args = {}, ...rest) => {
try {
if (false)
;
} catch (e2) {
}
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
Expand Down Expand Up @@ -1502,14 +1490,6 @@ function wrapperTaskApi(name, fn, protocol, options) {
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
try {
if (window.weibo && window.weibo[name]) {
window.currentWeiboApiName = name;
var value = window.weibo[name](args);
return value;
}
} catch (e2) {
}
const errMsg = beforeInvokeApi(name, args, protocol, options);
if (errMsg) {
throw new Error(errMsg);
Expand Down Expand Up @@ -2879,19 +2859,11 @@ function useImageState(rootRef, props2) {
opts[0] && (position = opts[0]);
opts[1] && (size = opts[1]);
}
if (window.weibo && props2.src.startsWith("Temp")) {
imgSrc.value = `../../${props2.src}`;
}
return `background-image:${imgSrc.value ? 'url("' + imgSrc.value + '")' : "none"};background-position:${position};background-size:${size};`;
});
const state = vue.reactive({
rootEl: rootRef,
src: vue.computed(function() {
if (window.weibo && props2.src.startsWith("Temp")) {
return `../../${props2.src}`;
}
return props2.src ? getRealPath(props2.src) : "";
}),
src: vue.computed(() => props2.src ? getRealPath(props2.src) : ""),
origWidth: 0,
origHeight: 0,
origStyle: {
Expand Down Expand Up @@ -5402,7 +5374,7 @@ const index$o = /* @__PURE__ */ defineBuiltInComponent({
field
} = useRadioInject(radioChecked, radioValue, reset);
const _onClick = ($event) => {
if (props2.disabled || radioChecked.value) {
if (props2.disabled) {
return;
}
radioChecked.value = true;
Expand Down Expand Up @@ -7523,8 +7495,8 @@ function normalizePageMeta(pageMeta) {
navigationBar.titleText = navigationBar.titleText || "";
navigationBar.type = navigationBar.type || "default";
navigationBar.titleSize = titleSize || "16px";
navigationBar.titleColor = titleColor || "#000000";
navigationBar.backgroundColor = backgroundColor || "#F8F8F8";
navigationBar.titleColor = titleColor || "#ffffff";
navigationBar.backgroundColor = backgroundColor || "#F7F7F7";
__UNI_FEATURE_I18N_LOCALE__ && initNavigationBarI18n(navigationBar);
}
return pageMeta;
Expand Down
82 changes: 10 additions & 72 deletions packages/uni-h5/dist/uni-h5.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ function initPageInternalInstance(openType, url, pageQuery, meta, eventChannel,
meta,
openType,
eventChannel,
statusBarStyle: titleColor === "#ffffff" ? "light" : "dark"
statusBarStyle: titleColor === "#000000" ? "dark" : "light"
};
}
function removeHook(vm, name, hook) {
Expand Down Expand Up @@ -1510,7 +1510,6 @@ function getWxsVm(el) {
return el.__vueParentComponent && el.__vueParentComponent.proxy;
}
}
const isKeyboardEvent = (val) => !val.type.indexOf("key") && val instanceof KeyboardEvent;
const isClickEvent = (val) => val.type === "click";
const isMouseEvent = (val) => val.type.indexOf("mouse") === 0 || ["contextmenu"].includes(val.type);
const isTouchEvent = (val) => typeof TouchEvent !== "undefined" && val instanceof TouchEvent || val.type.indexOf("touch") === 0 || ["longpress"].indexOf(val.type) >= 0;
Expand Down Expand Up @@ -1540,15 +1539,6 @@ function $nne(evt, eventValue, instance2) {
const top = getWindowTop();
res.touches = normalizeTouchEvent(evt.touches, top);
res.changedTouches = normalizeTouchEvent(evt.changedTouches, top);
} else if (isKeyboardEvent(evt)) {
const proxyKeys = ["key", "code"];
proxyKeys.forEach((key) => {
Object.defineProperty(res, key, {
get() {
return evt[key];
}
});
});
}
{
return wrapperH5WxsEvent(
Expand Down Expand Up @@ -1653,21 +1643,21 @@ function initViewPlugin(app) {
}
const invokeOnCallback = (name, res) => UniServiceJSBridge.emit("api." + name, res);
let invokeViewMethodId = 1;
function publishViewMethodName(pageId) {
return (pageId || getCurrentPageId()) + "." + INVOKE_VIEW_API;
function publishViewMethodName() {
return getCurrentPageId() + "." + INVOKE_VIEW_API;
}
const invokeViewMethod = (name, args, pageId, callback) => {
const { subscribe, publishHandler } = UniServiceJSBridge;
const id2 = callback ? invokeViewMethodId++ : 0;
callback && subscribe(INVOKE_VIEW_API + "." + id2, callback, true);
publishHandler(publishViewMethodName(pageId), { id: id2, name, args }, pageId);
publishHandler(publishViewMethodName(), { id: id2, name, args }, pageId);
};
const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
const { subscribe, unsubscribe, publishHandler } = UniServiceJSBridge;
const id2 = invokeViewMethodId++;
const subscribeName = INVOKE_VIEW_API + "." + id2;
subscribe(subscribeName, callback);
publishHandler(publishViewMethodName(pageId), { id: id2, name, args }, pageId);
publishHandler(publishViewMethodName(), { id: id2, name, args }, pageId);
return () => {
unsubscribe(subscribeName);
};
Expand Down Expand Up @@ -2312,13 +2302,6 @@ const index$x = /* @__PURE__ */ defineBuiltInComponent({
}
return;
}
if (
// @ts-ignore
window.weibo && // @ts-ignore
typeof window.weibo.share === "function" && props2.openType === "share"
) {
window.weibo.share();
}
});
const uniLabel = inject(uniLabelKey, false);
if (uniLabel) {
Expand Down Expand Up @@ -3008,11 +2991,6 @@ function handlePromise(promise) {
}
function promisify(name, fn) {
return (args = {}, ...rest) => {
try {
if (false)
;
} catch (e2) {
}
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
Expand Down Expand Up @@ -3143,14 +3121,6 @@ function wrapperTaskApi(name, fn, protocol, options) {
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
try {
if (window.weibo && window.weibo[name]) {
window.currentWeiboApiName = name;
var value = window.weibo[name](args);
return value;
}
} catch (e2) {
}
const errMsg = beforeInvokeApi(name, args, protocol, options);
if (errMsg) {
throw new Error(errMsg);
Expand Down Expand Up @@ -5183,45 +5153,21 @@ function offPageNotFound(hook) {
offAppHook(ON_PAGE_NOT_FOUND, hook);
}
function onError(hook) {
if (window.weibo) {
window.weibo.onError(hook);
return;
}
onAppHook(ON_ERROR, hook);
}
function offError(hook) {
if (window.weibo) {
window.weibo.offError(hook);
return;
}
offAppHook(ON_ERROR, hook);
}
function onAppShow(hook) {
if (window.weibo) {
window.weibo.onAppShow(hook);
return;
}
onAppHook(ON_SHOW, hook);
}
function offAppShow(hook) {
if (window.weibo) {
window.weibo.offAppShow(hook);
return;
}
offAppHook(ON_SHOW, hook);
}
function onAppHide(hook) {
if (window.weibo) {
window.weibo.onAppHide(hook);
return;
}
onAppHook(ON_HIDE, hook);
}
function offAppHide(hook) {
if (window.weibo) {
window.weibo.offAppHide(hook);
return;
}
offAppHook(ON_HIDE, hook);
}
const API_GET_ENTER_OPTIONS_SYNC = "getEnterOptionsSync";
Expand Down Expand Up @@ -8980,19 +8926,11 @@ function useImageState(rootRef, props2) {
opts[0] && (position = opts[0]);
opts[1] && (size = opts[1]);
}
if (window.weibo && props2.src.startsWith("Temp")) {
imgSrc.value = `../../${props2.src}`;
}
return `background-image:${imgSrc.value ? 'url("' + imgSrc.value + '")' : "none"};background-position:${position};background-size:${size};`;
});
const state2 = reactive({
rootEl: rootRef,
src: computed(function() {
if (window.weibo && props2.src.startsWith("Temp")) {
return `../../${props2.src}`;
}
return props2.src ? getRealPath(props2.src) : "";
}),
src: computed(() => props2.src ? getRealPath(props2.src) : ""),
origWidth: 0,
origHeight: 0,
origStyle: {
Expand Down Expand Up @@ -12679,7 +12617,7 @@ const index$m = /* @__PURE__ */ defineBuiltInComponent({
field
} = useRadioInject(radioChecked, radioValue, reset);
const _onClick = ($event) => {
if (props2.disabled || radioChecked.value) {
if (props2.disabled) {
return;
}
radioChecked.value = true;
Expand Down Expand Up @@ -15180,8 +15118,8 @@ function normalizePageMeta(pageMeta) {
navigationBar.titleText = navigationBar.titleText || "";
navigationBar.type = navigationBar.type || "default";
navigationBar.titleSize = titleSize || "16px";
navigationBar.titleColor = titleColor || "#000000";
navigationBar.backgroundColor = backgroundColor || "#F8F8F8";
navigationBar.titleColor = titleColor || "#ffffff";
navigationBar.backgroundColor = backgroundColor || "#F7F7F7";
__UNI_FEATURE_I18N_LOCALE__ && initNavigationBarI18n(navigationBar);
}
if (__UNI_FEATURE_PAGES__ && history.state) {
Expand Down Expand Up @@ -20390,7 +20328,7 @@ function useList(state2) {
function pushData(array) {
array.forEach((item) => {
list2.push({
name: item.title || item.name,
name: item.title,
address: item.address,
distance: item._distance || item.distance,
latitude: item.location.lat,
Expand Down

0 comments on commit da03de3

Please sign in to comment.