Tuesday, June 20, 2023

Stanford CS193p - Developing Apps for iOS

 

Stanford CS193p - Developing Apps for iOS


Lecture 2: Learning more about SwiftUI

Xcode code snippet


SF Symbols (5)




internal external parameter names

Lecture 4: Memorize Game Logic



hello 不是 string

hello 是 enum XD


後來發現有 2023 版本!!


trailing syntax @ Lecture 2 | Stanford CS193p 2023


state @ Lecture 2 | Stanford CS193p 2023





Friday, June 16, 2023

Retrofit x xml

因為工作上需要,暫時得自己生假資料

然後不想做假資料,就看了一下 open data 有提供 縣市 & 鄉鎮 的 api


但給的格式是 xml, 所以研究了一下怎麼在 retrofit 裡面 parse xml


SimpleXmlConverterFactory


雖然可以用,但被列為廢棄了,再找一下發現有 大大推薦 替代方案


Tickaroo/tikxml


import 的時候有遇到一些麻煩,dependency 有些複雜,最後搞定的設定如下:

project gradle : 

//Jitpack pulls the dependencies straight from GitHub and builds them (for TikXML)
maven { url 'https://www.jitpack.io' }


app gradle :

// TikXML, xml parser
// wee need processor & processor-common to generate objectClass$$TypeAdapter
implementation 'com.github.Tickaroo.tikxml:annotation:0.8.15'
implementation 'com.github.Tickaroo.tikxml:core:0.8.15'
implementation'com.github.Tickaroo.tikxml:retrofit-converter:0.8.15'
// we need this guava to avoid Duplicate class com.google.common.util.concurrent.internal.InternalFutureFailureAccess for retrofit-converter
implementation 'com.google.guava:guava:27.0.1-android'
kapt 'com.github.Tickaroo.tikxml:processor-common:0.8.15'
kapt 'com.github.Tickaroo.tikxml:processor:0.8.15'

proguard:

# for TikXML
-keep class com.tickaroo.tikxml.** { *; }
-keep @com.tickaroo.tikxml.annotation.Xml public class *
-keep class **$$TypeAdapter { *; }

-keepclasseswithmembernames class * {
@com.tickaroo.tikxml.* <fields>;
}

-keepclasseswithmembernames class * {
@com.tickaroo.tikxml.* <methods>;
}
# end for TikXML





Compose Multiplatform application

Compose Multiplatform get started 

JetBrains/compose-multiplatform 看到 All platforms at once

再到  JetBrains/compose-multiplatform-ios-android-template

(有 iOS / android / desktop, 但沒有 web XD)

fork 出來弄了一版可以 preview android / iOS 

要繼續研究 web ~

Sunday, April 2, 2023

KMM first class... or lib

 Set up an environment


終於有空擋可以嘗試了,嗚嗚嗚




哎呀,K 醫生說我有這些症頭




照建議把 export LANG=en_US.UTF-8 & export LC_ALL=en_US.UTF-8 加入 ~/.zprofile,然後裝完 cocoapod 後裝 ruby 再乖乖裝 java


但目前沒裝 IDE, 先用 android studio 擋著先XD

無腦先 build 遇到 error, 檢查一陣子發現是剛剛裝的 jvm 版本跟 gradle 的不符(兩者皆需 11)
改裝 openjdk11 就可以 build 了



先上 gitlab

加了版號,成功出現在 jar 裡面,但是 clean & build 後 cocoapods 沒產出來!?




Tuesday, March 21, 2023

PhahTaiLo

 這次要挑戰寫出可以測試是否能是否能正確打出台羅拼音的 app 


考慮到跨平台,應該會用 kmm 吧....

上面的輸入框是我用 教育部提供的 臺灣閩南語漢字輸入法 打進去的喔

程式碼裡面的 a-kīm 是從 這邊 複製來的



Friday, October 21, 2022

終於弄到實機

 但跑出來的結果跟模擬器一樣...

API exception 10















還有實機多了模擬器一顆按鈕













回去乖乖翻資料,發現之前的筆記上提到 github project 要仔細看 Constants.java and PaymentsUtil.java,發現 CURRENCY_CODE 我從 USD 改成 TW,應該是 TWD 才對,也把 exampleGatewayMerchantId 改成 YOUR_GATEWAY_MERCHANT_ID (因為我挑 ctbcbank 所以要帶這個,在之前的 payment provider 有提到)

改好後終於擺脫 error 10 !! (是說這 error 也太.... 幾乎找不到參考資料,大部分都說是 sign in 的資訊)












上次卡關的時候有用本帳號加入群組,今天突破後改用免洗帳號,結果就出現需要新增信用卡的情況,記得原本在 Test card suite 裡面是說:

These sample credit cards are intended for use with our integration checklist. To use them in our TEST environment, join our user group. While logged into an account that has joined the above group and viewing the payment sheet in the test environment, the Google Pay payment sheet will display a set of test cards. 

以為 group 裡面會有個 sheet contains sample credit card, 但群組裡面空空如也,仔細看上面寫著:

Congratulations! You now have access to our test suite! No further action is required.

To test this feature, navigate to the demo page in our dev docs. Once you click on the Google Pay payment button, you should see our test cards instead of your own production cards.

猜想可能沒加過信用卡不行,或者時間差的關係,就換上本帳號,果真看到測試卡片了(上方右側)

按下 Continue 被要求加個螢幕鎖,展開發現蠻多卡片可以挑的 XD

然後就順利完成購物啦 Yeah~


PS 後來大概過半個小時,免洗帳號也出現測試信用卡了~

PS 有一度 factory reset 實機,多的那顆按鈕就不見了...